A 3D-renderer using Swing and basic Graphics. Supports .obj-file loading (no texturing support yet), texture loading for simple objects and map loading from a text-based format.
To run the project you will need Java (JDK 21) and sbt
In the repository root, do sbt run
- Open the file you want to load in Blender
- when Exporting to .obj, choose these settings:
- export the file directly or move it to the objects-folder, this is where the program loads the files.
- In VisualizerApp, add a new object to the World by adding an Object to worldObjects (line 25). There are example imports. Setting a starting scale of 100 is recommended due to scaling differences.
- Move a (continuous) texture image (.png/.jpg confirmed to be working) to textures-folder.
- Load the texture by adding it to the Map 'textures' in VisualizerApp (line 16). There are example textures in the file.
- Apply the new texture by giving the key you gave your texture in step 2 to either 'wallTexture' or 'floorTexture' (lines 22 & 23 in VisualizerApp) OR create a new Cube inside worldObjects and give the texture-key to that.
The file-format understands certain characters that each represent different things. Each character represents a 600-by-600 tile in the coordinate system:
- F : Floor
- _ : Wall that is in the bottom-half of the tile
- - : Wall that is in the top-half of the tile
- | : Wall that is in the center of the tile but has been rotated 90 degrees
- * : an empty tile
- S : the tile where the "Player" starts. If a floorTexture has been set, creates a floor under the player.