{"id":18792365,"url":"https://github.com/kplanisphere/plotted-3d-environment","last_synced_at":"2025-12-28T10:30:16.914Z","repository":{"id":242027973,"uuid":"808486812","full_name":"KPlanisphere/Plotted-3D-Environment","owner":"KPlanisphere","description":"Plotted 3D Environment is a graphical project inspired by Minecraft, designed to demonstrate 3D object creation, animation, and interaction using OpenGL. It features first-person navigation, texture mapping, and collision detection within a dynamic 3D environment filled with obstacles and enemies - Final project for the Graphing course.","archived":false,"fork":false,"pushed_at":"2024-05-31T07:22:44.000Z","size":3288,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-29T15:26:04.396Z","etag":null,"topics":["3d-graphics","animation","camera-movement","collision-detection","computer-graphics","cpp","data-visualization","educational-project","opengl","texture-mapping"],"latest_commit_sha":null,"homepage":"https://linktr.ee/planisphere.kgz","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KPlanisphere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-31T07:09:30.000Z","updated_at":"2024-10-30T13:22:01.000Z","dependencies_parsed_at":"2024-05-31T08:55:35.166Z","dependency_job_id":null,"html_url":"https://github.com/KPlanisphere/Plotted-3D-Environment","commit_stats":null,"previous_names":["kplanisphere/plotted-3d-environment"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KPlanisphere%2FPlotted-3D-Environment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KPlanisphere%2FPlotted-3D-Environment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KPlanisphere%2FPlotted-3D-Environment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KPlanisphere%2FPlotted-3D-Environment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KPlanisphere","download_url":"https://codeload.github.com/KPlanisphere/Plotted-3D-Environment/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239718371,"owners_count":19685725,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d-graphics","animation","camera-movement","collision-detection","computer-graphics","cpp","data-visualization","educational-project","opengl","texture-mapping"],"created_at":"2024-11-07T21:19:38.445Z","updated_at":"2025-12-28T10:30:16.878Z","avatar_url":"https://github.com/KPlanisphere.png","language":"C++","readme":"# Plotted 3D Environment (OpenCraft)\n\n## Overview\n\nPlotted 3D Environment is a graphical project that simulates a 3D environment using OpenGL. The project aims to demonstrate various graphical techniques, including camera movement, texture mapping, collision detection, and object animations.\n\n## Project Description\n\nThis project is inspired by Minecraft and is named OpenCraft. The goal is to navigate through a field with obstacles and enemies to find a specific object to win the game. The player is in first-person view and can move in all directions except up and down. The environment includes trees, houses, and other objects, with collision detection to prevent moving through them. Enemies move randomly and colliding with them results in losing the game.\n\n\u003cp align= \"center\"\u003e\n    \u003cimg src=\"https://github.com/KPlanisphere/binary-tree-operations/assets/60454942/58e05fe9-f970-4ffa-8614-e9689d4cfe4a\" style=\"width: 70%; height: auto;\"\u003e\n\u003c/p\u003e\n\n## Files and Structure\n\nThe repository contains the following files and directories:\n\n- `PFinal_V1.cbp`: The project file for Code::Blocks IDE.\n- `PFinal_V1.depend`: Dependency file for the project.\n- `PFinal_V1.layout`: Layout configuration file for the project.\n- `main.cpp`: The main source code file for the project.\n- `Imagenes/`: Directory containing images used in the project.\n- `bin/`: Directory for binary files.\n- `include/`: Directory for header files.\n- `obj/`: Directory for object files.\n- `src/`: Directory for additional source files.\n- `textura0.bmp` to `textura5.bmp`: Bitmap texture files used in the project.\n\n## Features\n\n### Object Creation and Animation\n\nThe project defines several 3D objects that implement animations through translations, rotations, and scaling. Each object is managed through its own class to maintain control over its specific variables and behaviors.\n\n### Collision Detection\n\nCollision detection ensures that objects do not pass through each other. This is managed by a dedicated class that detects if an object collides with any other object in the scene.\n\n### First-Person View Navigation\n\nThe player navigates the environment in a first-person view. The camera movement is synchronized with the player's movement, controlled by keyboard inputs.\n\n### Texture Mapping\n\nObjects in the scene are textured using images loaded from files. The FileManager class handles the loading and application of textures to various objects.\n\n### State Management\n\nThe project uses OpenGL's state stack to apply geometric transformations to objects. This includes using functions like `glPushMatrix` and `glPopMatrix` to manage the state.\n\n## Main Source File: `main.cpp`\n\nThe main logic of the project is implemented in `main.cpp`. Below is a brief overview of its content:\n\n```cpp\n#include \u003cGL/glut.h\u003e\n#include \u003ccmath\u003e\n#include \u003ciostream\u003e\n#include \"RgbImage.h\"\n#include \"Stage.h\"\n#include \"FileManager.h\"\n#include \"Cubo.h\"\n#include \"Movement.h\"\n#include \"Arbol.h\"\n#include \"ControlV.h\"\n\n#define FPS 60\n#define TO_RADIANS 3.14159265358979323846 / 180.0\n\nGLint tex;\nchar filename[100];\nchar ActualKey;\nbool CStatus[50];\nint band[50];\nControlV CV[50];\nControlV CVG;\n\nvoid init(void) {\n    glutSetCursor(GLUT_CURSOR_NONE);\n    glEnable(GL_DEPTH_TEST);\n    glDepthFunc(GL_LEQUAL);\n    glutWarpPointer(width / 2, height / 2);\n    glClearColor(0, 0, 0, 0);\n    glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);\n    glShadeModel(GL_FLAT);\n    glEnable(GL_DEPTH_TEST);\n    FM.FileLoader();\n}\n\nvoid display() {\n    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\n    glLoadIdentity();\n    MOVE.camera();\n    S.drawAxis();\n    S.GeneralAmbient();\n    S.drawSphere();\n    std::cout \u003c\u003c '(' \u003c\u003c camX \u003c\u003c ',' \u003c\u003c camY \u003c\u003c ',' \u003c\u003c camZ \u003c\u003c ')' \u003c\u003c std::endl;\n    glutSwapBuffers();\n}\n\nvoid reshape(int w, int h) {\n    glViewport(0, 0, w, h);\n    glMatrixMode(GL_PROJECTION);\n    glLoadIdentity();\n    gluPerspective(60, 16.0 / 9.0, 1, 75);\n    glMatrixMode(GL_MODELVIEW);\n}\n\nvoid timer(int) {\n    glutPostRedisplay();\n    glutWarpPointer(width / 2, height / 2);\n    glutTimerFunc(1000 / FPS, timer, 0);\n}\n\nvoid passive_motion(int x, int y) {\n    int dev_x = (width / 2) - x;\n    int dev_y = (height / 2) - y;\n    yaw += (float)dev_x / 50.0;\n    pitch += (float)dev_y / 50.0;\n    if (yaw \u003e 360) yaw = 0;\n    else if (yaw \u003c -360) yaw = 0;\n}\n\nvoid keyboard(unsigned char key, int x, int y) {\n    ActualKey = key;\n    switch (key) {\n        case 'W':\n        case 'w':\n            Forward = true;\n            break;\n        case 'A':\n        case 'a':\n            Left = true;\n            break;\n        case 'S':\n        case 's':\n            Backward = true;\n            break;\n        case 'D':\n        case 'd':\n            Right = true;\n            break;\n        case 32:\n            Up = true;\n            break;\n        case 'C':\n        case 'c':\n            Down = true;\n            break;\n    }\n}\n\nvoid keyboard_up(unsigned char key, int x, int y) {\n    switch (key) {\n        case 'W':\n        case 'w':\n            Forward = false;\n            break;\n        case 'A':\n        case 'a':\n            Left = false;\n            break;\n        case 'S':\n        case 's':\n            Backward = false;\n            break;\n        case 'D':\n        case 'd':\n            Right = false;\n            break;\n        case 32:\n            Up = false;\n            break;\n        case 'C':\n        case 'c':\n            Down = false;\n            break;\n    }\n}\n\nint main(int argc, char** argv) {\n    glutInit(\u0026argc, argv);\n    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);\n    glutInitWindowSize(width, height);\n    glutCreateWindow(\"Plotted 3D Environment | Final Project\");\n    CVG.OriginalControlVariables();\n    init();\n    glutDisplayFunc(display);\n    glutReshapeFunc(reshape);\n    glutPassiveMotionFunc(passive_motion);\n    glutTimerFunc(0, timer, 0);\n    glutKeyboardFunc(keyboard);\n    glutKeyboardUpFunc(keyboard_up);\n    glutMainLoop();\n    return 0;\n}\n```\n\n## How to Build and Run\n\n### Prerequisites\n\n-   Code::Blocks IDE\n-   OpenGL and GLUT libraries\n\n### Steps\n\n1.  Clone the repository:\n    \n```bash\n    git clone https://github.com/KPlanisphere/Plotted-3D-Environment.git\n```\n\n2.  Open the `PFinal_V1.cbp` project file in Code::Blocks.\n3.  Build and run the project within the IDE.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkplanisphere%2Fplotted-3d-environment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkplanisphere%2Fplotted-3d-environment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkplanisphere%2Fplotted-3d-environment/lists"}