diff --git a/CMakeLists.txt b/CMakeLists.txt index ee2caaf..e5ee1d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,6 @@ set(CMAKE_CXX_EXTENSIONS OFF) enable_testing() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -add_subdirectory(vendor) add_subdirectory(libs) add_subdirectory(src) diff --git a/data/input/scene.yml b/data/input/scene.yml new file mode 100644 index 0000000..260ba1f --- /dev/null +++ b/data/input/scene.yml @@ -0,0 +1,93 @@ +# ----------------------------------------------------------------- +# Exemplo de Arquivo de Cena para o Renderizador Prism +# Este arquivo demonstra o uso de múltiplos objetos, materiais +# e transformações para criar uma cena complexa. +# ----------------------------------------------------------------- + +# Definições reutilizáveis da cena, como materiais. +# Usamos âncoras (&) para definir um material e aliases (*) para reutilizá-lo. +definitions: + materials: + # Material fosco para o chão + chao_cinza: &material_chao + color: [0.8, 0.8, 0.8] + ka: [0.1, 0.1, 0.1] # Pouca reflexão ambiente + ks: [0.1, 0.1, 0.1] # Pouco brilho especular + ns: 10 + + # Material de plástico vermelho, com brilho moderado + plastico_vermelho: &material_esfera_vermelha + color: [1.0, 0.2, 0.2] + ka: [0.2, 0.05, 0.05] + ks: [0.7, 0.7, 0.7] # Brilho especular forte + ns: 128 # Expoente de brilho alto para um highlight pequeno e intenso + + # Material metálico/refletivo para o cubo + metal_azul: &material_cubo_metalico + color: [0.2, 0.3, 1.0] + ka: [0.1, 0.1, 0.2] + ks: [0.9, 0.9, 0.9] # Reflexão especular muito alta + ns: 256 + + # Material de vidro para o triângulo + vidro_transparente: &material_vidro + color: [0.9, 0.9, 1.0] # Cor levemente azulada + ka: [0.1, 0.1, 0.1] + ks: [0.8, 0.8, 0.8] + ns: 200 + ni: 1.5 # Índice de refração (típico para vidro) + d: 0.1 # Opacidade (valor 'd' baixo significa mais transparente) + +# ----------------------------------------------------------------- +# Configurações da Câmera +# ----------------------------------------------------------------- +camera: + image_width: 960 + image_height: 540 + screen_distance: 1.5 + viewport_width: 2.0 + viewport_height: 1.125 + lookfrom: [0, 2, 8] # Posição da câmera + lookat: [0, 0, 0] # Ponto para onde a câmera olha + vup: [0, 1, 0] # Vetor "para cima" + +# ----------------------------------------------------------------- +# Lista de Objetos na Cena +# ----------------------------------------------------------------- +objects: + - name: Chão + type: plane + point_on_plane: [0, -1, 0] # Ponto que define a altura do plano + normal: [0, 1, 0] # Vetor normal aponta para cima + material: *material_chao # Reutiliza o material do chão definido acima + + - name: Esfera Vermelha Principal + type: sphere + center: [-1.5, 0, 0] + radius: 1.0 + material: *material_esfera_vermelha # Reutiliza o material de plástico + + - name: Malha de Cubo Metálico + type: mesh + path: "./data/input/cubo.obj" # Caminho para o arquivo .obj + material: *material_cubo_metalico # Reutiliza o material metálico + # Múltiplas transformações são aplicadas em ordem + transform: + - type: scaling + factors: [0.7, 0.7, 0.7] # Primeiro, diminui a escala do cubo + - type: rotation + angle: 45 # Em graus (o parser converterá para radianos) + axis: [0, 1, 0] # Rotaciona em torno do eixo Y + - type: translation + vector: [1.5, 0, -1] # Por último, move o cubo para sua posição final + + - name: Triângulo de Vidro + type: triangle + # Vértices definidos diretamente no arquivo de cena + p1: [-3, -1, -5] + p2: [3, -1, -5] + p3: [0, 4, -5] + material: *material_vidro # Reutiliza o material de vidro + transform: + - type: translation + vector: [0, 0, 2] # Move o triângulo um pouco para frente \ No newline at end of file diff --git a/libs/Prism/CMakeLists.txt b/libs/Prism/CMakeLists.txt index 3388827..957ee2a 100644 --- a/libs/Prism/CMakeLists.txt +++ b/libs/Prism/CMakeLists.txt @@ -1,3 +1,11 @@ +include(FetchContent) +FetchContent_Declare( + yaml-cpp + GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git + GIT_TAG 0.8.0 +) +FetchContent_MakeAvailable(yaml-cpp) + file(GLOB_RECURSE PRISM_SOURCES CONFIGURE_DEPENDS "src/*.cpp") add_library(Prism SHARED ${PRISM_SOURCES}) @@ -9,6 +17,8 @@ target_include_directories(Prism PUBLIC "${CMAKE_CURRENT_BINARY_DIR}" ) +target_link_libraries(Prism PUBLIC yaml-cpp) + install(TARGETS Prism RUNTIME DESTINATION bin # Para .dll no Windows LIBRARY DESTINATION lib # Para .so no Linux, .dylib no macOS diff --git a/libs/Prism/include/Prism.hpp b/libs/Prism/include/Prism.hpp index d17f727..f4eb640 100644 --- a/libs/Prism/include/Prism.hpp +++ b/libs/Prism/include/Prism.hpp @@ -14,3 +14,5 @@ #include "Prism/triangle.hpp" #include "Prism/utils.hpp" #include "Prism/vector.hpp" +#include "Prism/scene_parser.hpp" +#include "Prism/style.hpp" \ No newline at end of file diff --git a/libs/Prism/include/Prism/Colormap.hpp b/libs/Prism/include/Prism/Colormap.hpp index 62dbcd7..6e93f11 100644 --- a/libs/Prism/include/Prism/Colormap.hpp +++ b/libs/Prism/include/Prism/Colormap.hpp @@ -26,6 +26,7 @@ A classe precisa ser instânciada passando o caminho do arquivo .mtl corresponde #include #include #include +#include "Prism/style.hpp" using namespace std; namespace Prism { @@ -43,7 +44,7 @@ class colormap { std::ifstream mtlFile(input); if (!mtlFile.is_open()) { - std::cerr << "erro abrindo arquivo cores.mtl\n"; + Style::logError("erro abrindo arquivo cores.mtl"); } string line, currentMaterial; @@ -98,7 +99,7 @@ class colormap { if (mp.find(s) != mp.end()) { return Vector3(mp[s].color.r, mp[s].color.g, mp[s].color.b); } else { - cerr << "Error: cor " << s << " indefinida no arquivo .mtl\n"; + Style::logError("Cor " + s + " indefinida no arquivo .mtl"); return Vector3(0, 0, 0); } } @@ -107,7 +108,7 @@ class colormap { if (mp.find(s) != mp.end()) { return mp[s]; } else { - cerr << "Error: Cor " << s << " indefinida no arquivo .mtl\n"; + Style::logError("Cor " + s + " indefinida no arquivo .mtl"); return Material(); } } diff --git a/libs/Prism/include/Prism/ObjReader.hpp b/libs/Prism/include/Prism/ObjReader.hpp index 949dccb..3281010 100644 --- a/libs/Prism/include/Prism/ObjReader.hpp +++ b/libs/Prism/include/Prism/ObjReader.hpp @@ -6,6 +6,7 @@ #include "Prism/point.hpp" #include "Prism/triangle.hpp" #include "Prism/vector.hpp" +#include "Prism/style.hpp" #include "prism_export.h" #include #include @@ -26,7 +27,7 @@ class ObjReader { ObjReader(const std::string& filename) { file.open(filename); if (!file.is_open()) { - std::cerr << "Erro ao abrir o arquivo: " << filename << std::endl; + Style::logError("Erro ao abrir o arquivo: " + filename); return; } diff --git a/libs/Prism/include/Prism/scene_parser.hpp b/libs/Prism/include/Prism/scene_parser.hpp new file mode 100644 index 0000000..52f195b --- /dev/null +++ b/libs/Prism/include/Prism/scene_parser.hpp @@ -0,0 +1,37 @@ +#ifndef PRISM_SCENEPARSER_HPP_ +#define PRISM_SCENEPARSER_HPP_ + +#include "Prism/scene.hpp" +#include "prism_export.h" +#include + +namespace Prism { + +/** + * @class SceneParser + * @brief Reads and parses a scene description from a YAML file. + * The SceneParser class is responsible for reading a YAML file that describes a 3D scene, including + * camera settings, materials, and objects. It constructs a Scene object that can be rendered. + */ +class PRISM_EXPORT SceneParser { + public: + /** + * @brief Constructor that initializes the SceneParser with the path to the scene file. + * @param sceneFilePath The path to the YAML file containing the scene description. + */ + explicit SceneParser(const std::string& sceneFilePath); + + /** + * @brief Parses the scene file and constructs a Scene object. + * @return A Scene object containing the parsed camera, materials, and objects. + * @throws std::runtime_error if there is an error reading or parsing the YAML file. + */ + Scene parse(); + + private: + std::string filePath; ///< The path to the YAML file containing the scene description +}; + +} // namespace Prism + +#endif // PRISM_SCENEPARSER_HPP_ \ No newline at end of file diff --git a/libs/Prism/include/Prism/style.hpp b/libs/Prism/include/Prism/style.hpp new file mode 100644 index 0000000..4bc034d --- /dev/null +++ b/libs/Prism/include/Prism/style.hpp @@ -0,0 +1,95 @@ +#ifndef PRISM_STYLE_HPP_ +#define PRISM_STYLE_HPP_ + +#include "prism_export.h" +#include +#include + +namespace Prism { + +/** + * @namespace Style + * @brief Provides constants for colored console output. + * + * This namespace centralizes ANSI escape codes for styling text in the terminal, + * ensuring a consistent look and feel for all engine logs. + */ +namespace Style { + + // --- Basic Colors --- + const std::string RESET = "\033[0m"; + const std::string YELLOW = "\033[0;33m"; + const std::string GREEN = "\033[0;32m"; + const std::string CYAN = "\033[0;36m"; + const std::string GRAY = "\033[0;90m"; + const std::string RED = "\033[0;31m"; + + // --- Bold Variants --- + const std::string BOLD_CYAN = "\033[1;36m"; + const std::string BOLD_GREEN = "\033[1;32m"; + const std::string BOLD_RED = "\033[1;31m"; + const std::string BOLD_YELLOW= "\033[1;33m"; + + /** + * @brief Logs a formatted informational message to std::clog. + * @param message The message to display. + */ + inline void logInfo(const std::string& message) { + std::clog << YELLOW << "[INFO] " << RESET << message << std::endl; + } + + /** + * @brief Logs a formatted completion message to std::clog. + * @param message The message to display. + */ + inline void logDone(const std::string& message) { + std::clog << GREEN << "[DONE] " << RESET << message << std::endl; + } + + /** + * @brief Logs a formatted error message to std::cerr. + * @param message The error message to display. + */ + inline void logError(const std::string& message) { + std::cerr << BOLD_RED << "[ERROR] " << RESET + << RED << message << RESET << std::endl; + } + + /** + * @brief Logs a formatted warning message to std::clog. + * @param message The warning message to display. + */ + inline void logWarning(const std::string& message) { + std::clog << BOLD_YELLOW << "[WARNING] " << RESET + << YELLOW << message << RESET << std::endl; + } + + /** + * @brief Displays a dynamic status bar on the current line in std::clog. + * @param progress A value between 0.0 and 1.0 indicating completion. + * @param width The total character width of the bar itself. + */ + inline void logStatusBar(double progress, int width = 25) { + if (progress < 0.0) progress = 0.0; + if (progress > 1.0) progress = 1.0; + + int bar_fill = static_cast(progress * width); + int percentage = static_cast(progress * 100.0); + + // \r (carriage return) move o cursor para o início da linha + std::clog << GREEN << "\rProgress: [" << RESET; + for (int i = 0; i < width; ++i) { + if (i < bar_fill) std::clog << "="; + else std::clog << " "; + } + std::clog << GREEN << "] " << percentage << "%" << RESET << std::flush; + + if (progress >= 1.0) { + std::clog << '\n' << std::endl; + } + } + +} // namespace Style +} // namespace Prism + +#endif // PRISM_STYLE_HPP_ \ No newline at end of file diff --git a/libs/Prism/src/init.cpp b/libs/Prism/src/init.cpp new file mode 100644 index 0000000..a661694 --- /dev/null +++ b/libs/Prism/src/init.cpp @@ -0,0 +1,20 @@ +#include "Prism/style.hpp" +#include + +namespace Prism { + +/** + * @struct PrismInitializer + * @brief A helper class whose sole purpose is to run code in its + * constructor, before the program's 'main'. + */ +struct PrismInitializer { + PrismInitializer() { + // This code will run once when the library is loaded. + std::clog << Style::BOLD_CYAN << "\n[PRISM RENDER ENGINE]\n" << Style::RESET << std::endl; + } +}; + +static PrismInitializer initializer; + +} // namespace Prism \ No newline at end of file diff --git a/libs/Prism/src/scene.cpp b/libs/Prism/src/scene.cpp index 0363792..020b21e 100644 --- a/libs/Prism/src/scene.cpp +++ b/libs/Prism/src/scene.cpp @@ -1,6 +1,7 @@ #include "Prism/scene.hpp" #include "Prism/color.hpp" #include "Prism/material.hpp" +#include "Prism/style.hpp" #include #include #include @@ -51,8 +52,8 @@ std::filesystem::path generate_filename() { return ss.str(); } - std::cerr << "Error: Could not get local time for filename generation.\n"; - std::cerr << "Using fallback filename.\n"; + Style::logError("Could not get local time for filename generation."); + Style::logWarning("Using fallback filename."); return "render_fallback.ppm"; } @@ -64,15 +65,21 @@ void Scene::render() const { std::ofstream image_file(full_path, std::ios::trunc); if (!image_file.is_open()) { - std::cerr << "Error: Could not open the file for writing.\n"; + Style::logError("could not open the file for writing."); return; } - image_file << "P3\n" << camera_.pixel_width << " " << camera_.pixel_height << "\n255\n"; + auto clean_path = std::filesystem::weakly_canonical(output_dir); + + Style::logInfo("Output directory: " + Prism::Style::CYAN + clean_path.string()); + Style::logInfo("Starting render...\n"); - std::clog << "Starting render...\n"; + image_file << "P3\n" << camera_.pixel_width << " " << camera_.pixel_height << "\n255\n"; + int total_pixels = camera_.pixel_height * camera_.pixel_width; int pixels_done = 0; + const int progress_bar_width = 25; + int last_progress_percent = -1; for (Ray const& ray : camera_) { HitRecord closest_hit_rec; @@ -98,16 +105,19 @@ void Scene::render() const { image_file << pixel_color << '\n'; - if (++pixels_done % camera_.pixel_width == 0) { - double percent = - (static_cast(pixels_done) / (camera_.pixel_height * camera_.pixel_width)) * - 100.0; - std::clog << "\rProgress: " << static_cast(percent) << "%" << std::flush; + pixels_done++; + int current_progress_percent = static_cast((static_cast(pixels_done) / total_pixels) * 100.0); + + if (current_progress_percent > last_progress_percent) { + last_progress_percent = current_progress_percent; + Style::logStatusBar(static_cast(current_progress_percent) / 100.0); } } - - std::clog << "\nRendering complete.\nImage saved as " << filename << ".\n"; + image_file.close(); + + Style::logDone("Rendering complete."); + Style::logDone("Image saved as: " + Prism::Style::CYAN + generate_filename().string()); } } // namespace Prism \ No newline at end of file diff --git a/libs/Prism/src/scene_parser.cpp b/libs/Prism/src/scene_parser.cpp new file mode 100644 index 0000000..d6a9f83 --- /dev/null +++ b/libs/Prism/src/scene_parser.cpp @@ -0,0 +1,194 @@ +#include "Prism/scene_parser.hpp" +#include +#include +#include +#include +#include +#include "Prism/scene.hpp" +#include "Prism/camera.hpp" +#include "Prism/material.hpp" +#include "Prism/point.hpp" +#include "Prism/vector.hpp" +#include "Prism/matrix.hpp" +#include "Prism/objects.hpp" +#include "Prism/sphere.hpp" +#include "Prism/plane.hpp" +#include "Prism/triangle.hpp" +#include "Prism/mesh.hpp" +#include "Prism/color.hpp" +#include "Prism/style.hpp" +#include + +#ifndef M_PI +#define M_PI 3.14159265358979323846 // Define M_PI if not already defined +#endif + +namespace Prism { + +// --- Parsing Helper Functions --- + +// Converts a YAML node [x, y, z] to a Point3 +Point3 parsePoint(const YAML::Node& node) { + if (!node.IsSequence() || node.size() != 3) { + throw std::runtime_error("Parsing error: Malformed 3D point."); + } + return Point3(node[0].as(), node[1].as(), node[2].as()); +} + +// Converts a YAML node [x, y, z] to a Vector3 +Vector3 parseVector(const YAML::Node& node) { + if (!node.IsSequence() || node.size() != 3) { + throw std::runtime_error("Parsing error: Malformed 3D vector."); + } + return Vector3(node[0].as(), node[1].as(), node[2].as()); +} + +// Converts a YAML node with material properties to a Material +std::shared_ptr parseMaterial(const YAML::Node& node) { + auto mat = std::make_shared(); + + if (node["color"]) {Vector3 v = parseVector(node["color"]); mat->color = Color(v.x, v.y, v.z);} + if (node["ka"]) mat->ka = parseVector(node["ka"]); + if (node["ks"]) mat->ks = parseVector(node["ks"]); + if (node["ke"]) mat->ke = parseVector(node["ke"]); + if (node["ns"]) mat->ns = node["ns"].as(); + if (node["ni"]) mat->ni = node["ni"].as(); + if (node["d"]) mat->d = node["d"].as(); + return mat; +} + +// Converts a YAML list of transformations into a single transformation matrix +Matrix parseTransformations(const YAML::Node& node) { + Matrix final_transform = Matrix::identity(4); + if (!node) return final_transform; + + // Transformations are applied in the reverse order of the list (standard in computer graphics) + for (int i = node.size() - 1; i >= 0; --i) { + const auto& transform_node = node[i]; + std::string type = transform_node["type"].as(); + Matrix current_transform = Matrix::identity(4); + + if (type == "translation") { + Vector3 v = parseVector(transform_node["vector"]); + current_transform = Matrix::translation(v.x, v.y, v.z); + } else if (type == "rotation") { + double angle_deg = transform_node["angle"].as(); + double angle_rad = angle_deg * (M_PI / 180.0); // Convert to radians + current_transform = Matrix::rotation(angle_rad, parseVector(transform_node["axis"])); + } else if (type == "scaling") { + Vector3 v = parseVector(transform_node["factors"]); + current_transform = Matrix::scaling(v.x, v.y, v.z); + } else { + Style::logWarning("Unknown transformation type: " + type + ". Skipping this transformation."); + continue; // Skip unknown transformation types + } + final_transform = final_transform * current_transform; + } + return final_transform; +} + +// --- SceneParser Class Implementation --- + +SceneParser::SceneParser(const std::string& sceneFilePath) : filePath(sceneFilePath) {} + +Scene SceneParser::parse() { + YAML::Node root; + try { + root = YAML::LoadFile(filePath); + } catch (const YAML::Exception& e) { + throw std::runtime_error("Error loading YAML file: " + std::string(e.what())); + } + + Style::logInfo("Parsing scene from file: " + Style::CYAN + filePath); + + // Parse the Camera + if (!root["camera"]) { + throw std::runtime_error("'camera' node not found in the scene file."); + } + const auto& cam_node = root["camera"]; + Camera camera( + parsePoint(cam_node["lookfrom"]), + parsePoint(cam_node["lookat"]), + parseVector(cam_node["vup"]), + cam_node["screen_distance"].as(), + cam_node["viewport_height"].as(), + cam_node["viewport_width"].as(), + cam_node["image_height"].as(), + cam_node["image_width"].as() + ); + + Scene scene(std::move(camera)); + + // Parse Material Definitions (for reuse) + std::map> materials; + if (root["definitions"] && root["definitions"]["materials"]) { + for (const auto& mat_node : root["definitions"]["materials"]) { + std::string name = mat_node.first.as(); + materials[name] = parseMaterial(mat_node.second); + } + } + + // Parse Objects + if (!root["objects"] || !root["objects"].IsSequence()) { + throw std::runtime_error("'objects' node not found or is not a list."); + } + + for (const auto& obj_node : root["objects"]) { + std::string type = obj_node["type"].as(); + + // Find the material (whether defined inline or by reference) + std::shared_ptr material; + if (obj_node["material"].IsMap()) { + material = parseMaterial(obj_node["material"]); + } else if (obj_node["material"].IsScalar()) { + std::string mat_name = obj_node["material"].as(); + if (materials.count(mat_name)) { + material = materials.at(mat_name); + } else { + throw std::runtime_error("Referenced material not found: " + mat_name); + } + } else { + material = std::make_shared(); // Default material + } + + std::unique_ptr object; + + if (type == "sphere") { + object = std::make_unique( + parsePoint(obj_node["center"]), + obj_node["radius"].as(), + material); + } else if (type == "plane") { + object = std::make_unique( + parsePoint(obj_node["point_on_plane"]), + parseVector(obj_node["normal"]), + material); + } else if (type == "triangle") { + object = std::make_unique( + parsePoint(obj_node["p1"]), + parsePoint(obj_node["p2"]), + parsePoint(obj_node["p3"]), + material); + } else if (type == "mesh") { + std::string path = obj_node["path"].as(); + object = std::make_unique(path); + // Overrides the .obj material with the one from the .yml, if specified + if(obj_node["material"]) { + auto mesh_ptr = static_cast(object.get()); + // (A material setter would be needed in the Mesh class here) + } + } else { + Style::logWarning("Unknown object type: " + type + ". Skipping this object."); + continue; + } + + if (object) { + object->setTransform(parseTransformations(obj_node["transform"])); + scene.addObject(std::move(object)); + } + } + + return scene; +} + +} // namespace Prism \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 140b404..9cb43e8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,7 +3,6 @@ add_executable(${PROJECT_NAME}) target_sources(${PROJECT_NAME} PRIVATE main.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE include) -target_link_libraries(${PROJECT_NAME} PRIVATE vendor) if (CMAKE_BUILD_TYPE STREQUAL "Debug") add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD diff --git a/src/main.cpp b/src/main.cpp index b69e8a2..ac573fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,77 +1,14 @@ #include "Prism.hpp" -#include "Prism/plane.hpp" -#include -#include +#include int main() { - // Configuração da Câmera - Prism::Point3 lookfrom(-4, 4, 4); - Prism::Point3 lookat(0, 0, -0.75); - Prism::Vector3 vup(0, 1, 0); - auto aspect_ratio = 16.0 / 9.0; - int image_width = 480; - int image_height = static_cast(image_width / aspect_ratio); - - Prism::Camera cam(lookfrom, lookat, vup, 2.0, 2.0, 2.0 * aspect_ratio, image_height, - image_width); - - // Criação da Cena - Prism::Scene scene(std::move(cam)); - - // Objreader - Prism ::ObjReader reader("./data/input/cubo.obj"); - - // Criação dos Materiais - auto material_chao = std::make_shared(Prism::Color(0.8, 0.8, 0.8)); - auto material_esfera_1 = - std::make_shared(Prism::Color(1.0, 0.3, 0.3)); // Vermelho/Rosa - auto material_esfera_2 = std::make_shared(Prism::Color(0.3, 0.3, 1.0)); // Azul - - // Adição dos Objetos à Cena - - auto cube = std::make_unique(reader); - - Prism::Matrix teste = Prism::Matrix(4, 4); - teste[0][0] = 1; - teste[0][1] = 0; - teste[0][2] = 0; - teste[0][3] = 2; - teste[1][0] = 0; - teste[1][1] = 1; - teste[1][2] = 0; - teste[1][3] = 2; - teste[2][0] = 0; - teste[2][1] = 0; - teste[2][2] = 1; - teste[2][3] = 0; - teste[3][0] = 0; - teste[3][1] = 0; - teste[3][2] = 0; - teste[3][3] = 1; - - cube->setTransform( - // Prism::Matrix::translation(3, {2, 2, 0}) * - teste * Prism::Matrix::rotation(45, {1, 0, 0}) * Prism::Matrix::scaling(0.5, 0.5, 0.5)); - - scene.addObject(std::move(cube)); - - auto plane = std::make_unique(Prism::Point3(0, -0.5, 0), Prism::Vector3(0, 1, 0), - material_chao); - - // plane->setTransform(Prism::Matrix::rotation(45, {1,0,0})); - - scene.addObject(std::move(plane)); - - // scene.addObject(std::make_unique( - // Prism::Point3(0, 0, -1), 0.5, material_esfera_1 - // )); - - // scene.addObject(std::make_unique( - // Prism::Point3(-0.35, -0.2, -0.6), 0.3, material_esfera_2 - // )); - - // 5. Renderização - scene.render(); + try { + Prism::SceneParser("./data/input/scene.yml").parse().render(); + + } catch (const std::exception& e) { + Prism::Style::logError(e.what()); + return 1; + } return 0; } \ No newline at end of file diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt deleted file mode 100644 index 03e7ab8..0000000 --- a/vendor/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_library(vendor INTERFACE)