This project is a 3D cube renderer built using Pygame and PyOpenGL. It allows for rendering 3D cubes with customizable positions, scales, and rotations, and includes a first-person camera for navigating the 3D space.
- Render 3D cubes with different positions, scales, and rotations.
- First-person camera controls for navigating the scene.
- Adjustable camera sensitivity and movement speed.
- Object properties loaded from a JSON file.
- Python 3.x
-
Clone the repository:
git clone https://github.com/LostGameDev/Cube.git cd Cube
-
Install the required Python packages:
pip install -r requirements.txt
-
Place your 3D object definitions in the
objects/objects.json
file. The file should follow this format:{ "ObjectName": [ { "X": 0, "Y": 0, "Z": 0, "ScaleX": 1, "ScaleY": 1, "ScaleZ": 1, "RotationX": 0, "RotationY": 0, "RotationZ": 0, "Red": 0, "Green": 255, "Blue": 0, "Alpha": 255 } ] }
This example will create a green opaque cube at 0, 0, 0 with default scale and with no rotation with the name ObjectName.
-
Run the
main.py
script:python main.py
-
Use the following controls to navigate the scene:
W
: Move forwardS
: Move backwardA
: Move leftD
: Move rightSPACE
: Move upLSHIFT
: Move downMouse
: Look aroundESC
: PauseR
: Reset camera position and reload objectsT
: Enable/disable wireframe modeB
: Enable/disable lightingG
: Enable/disable anti-aliasing
Simply run build.py to compile the program:
python build.py
This project is licensed under the MIT License. See the LICENSE file for details.