+ | Cube intersection but problem with quads

This commit is contained in:
TheRedShip
2025-01-07 00:16:47 +01:00
parent a06e1f80a8
commit 56d3a1394b
9 changed files with 204 additions and 11 deletions

View File

@ -99,6 +99,13 @@ void Scene::updateGPUData()
gpu_obj.vertex2 = triangle->getVertex3();
gpu_obj.normal = triangle->getNormal();
}
else if (obj->getType() == Object::Type::CUBE)
{
auto cube = static_cast<const Cube *>(obj);
gpu_obj.position = cube->getPosition();
gpu_obj.vertex1 = cube->getSize();
gpu_obj.type = static_cast<int>(cube->getType());
}
_gpu_objects.push_back(gpu_obj);
}

View File

@ -37,6 +37,12 @@ SceneParser::SceneParser(Scene *scene) : _scene(scene)
try { return (new Triangle(ss)); }
catch (const std::exception &e) { throw; }
};
object_parsers["cu"] = [](std::stringstream &ss) -> Object *
{
try { return (new Cube(ss)); }
catch (const std::exception &e) { throw; }
};
}
void SceneParser::parseMaterial(std::stringstream &line)