diff --git a/CMakeLists.txt b/CMakeLists.txt index 83295d7..feccaf0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,10 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/obj) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/obj) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(INCLUDE_PATH "include") +add_library(visualizer STATIC src/visualizer.cpp) +target_include_directories(visualizer PUBLIC include) add_executable(${PROJECT_NAME} src/engine.cpp) add_executable(generator src/generator.cpp) @@ -18,6 +21,9 @@ include_directories(${OpenGL_INCLUDE_DIRS}) link_directories(${OpenGL_LIBRARY_DIRS}) add_definitions(${OpenGL_DEFINITIONS}) +target_include_directories(visualizer PUBLIC include) +target_include_directories(generator PUBLIC include) + if(NOT OPENGL_FOUND) message(FATAL_ERROR "OPENGL not found!") endif(NOT OPENGL_FOUND) diff --git a/include/figure_generator.hpp b/include/figure_generator.hpp index cd37105..7f4c25d 100644 --- a/include/figure_generator.hpp +++ b/include/figure_generator.hpp @@ -3,8 +3,46 @@ #include "figure.hpp" +/** + * @brief Generates a plane + * + * @param length the length of the plane + * @param divisions the number of divisions + * + * @return the generated plane +*/ std::unique_ptr
generatePlane(float length, int divisions); + +/** + * @brief Generates a box + * + * @param dimension the dimension of the box + * @param divisions the number of divisions + * + * @return the generated box +*/ std::unique_ptr
generateBox(float dimension, int divisions); + +/** + * @brief Generates a sphere + * + * @param radius the radius of the sphere + * @param slices the number of slices + * @param stacks the number of stacks + * + * @return the generated sphere +*/ std::unique_ptr
generateSphere(float radius, int slices, int stacks); + +/** + * @brief Generates a cone + * + * @param radius the radius of the cone + * @param height the height of the cone + * @param slices the number of slices + * @param stacks the number of stacks + * + * @return the generated cone +*/ std::unique_ptr
generateCone(float radius, float height, int slices, int stacks); diff --git a/src/generator.cpp b/src/generator.cpp index 0f15b51..b6e40e3 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -1,43 +1,43 @@ #include - #include - -#include "../include/figure.hpp" -#include "../include/figure_generator.hpp" +#include "figure.hpp" +#include "figure_generator.hpp" // Include the figure_generator header inline std::unique_ptr
generateFigure(int argc, char* argv[]) { if (argc < 5) { std::cerr << "Insufficient arguments\n"; - return 0; + return nullptr; } std::string figureType = argv[argc - 1]; + std::string figureName = argv[1]; - if (figureType == "sphere.3d" && argc == 6) { + if (figureName == "sphere" && figureType == "sphere.3d" && argc == 6) { // Generate Sphere std::cout << "Generating Sphere\n"; - return 0; - } else if (figureType == "box.3d" && argc == 5) { + return nullptr; + } else if (figureName == "box" && figureType == "box.3d" && argc == 5) { // Generate Box std::cout << "Generating Box\n"; - return 0; - } else if (figureType == "plane.3d" && argc == 5) { + return nullptr; + } else if (figureName == "plane" && figureType == "plane.3d" && argc == 5) { // Generate Plane - std::cout << "Generating Plane\n"; - return 0; - } else if (figureType == "cone.3d" && argc == 7) { + std::cout << "Generating Plane\n"; // Added newline here + float length = std::stof(argv[2]); + int divisions = std::stoi(argv[3]); + // generatePlane(length, divisions); + return nullptr; + } else if (figureName == "cone" && figureType == "cone.3d" && argc == 7) { // Generate Cone std::cout << "Generating Cone\n"; - return 0; + return nullptr; } else { std::cerr << "Invalid arguments\n"; - return 0; + return nullptr; } - return 0; } int main(int argc, char* argv[]) { std::unique_ptr
figure = generateFigure(argc, argv); - return 0; -} \ No newline at end of file +}