+ | Cylinder intersectio and rotation but capped edge + need opti

This commit is contained in:
TheRedShip
2025-01-09 22:42:09 +01:00
parent 0ece075f1a
commit 9aa1de378f
10 changed files with 155 additions and 11 deletions

View File

@ -107,13 +107,19 @@ void Scene::updateGPUData()
gpu_obj.position = cube->getPosition();
gpu_obj.vertex1 = cube->getSize();
}
else if (obj->getType() == Object::Type::CYLINDER)
{
auto cylinder = static_cast<Cylinder *>(obj);
gpu_obj.normal = glm::vec3(cylinder->getRadius(), cylinder->getHeight(), 0.0f);
gpu_obj.transform = glm::mat4(cylinder->getRotation());
}
else if (obj->getType() == Object::Type::PORTAL)
{
auto portal = static_cast<Portal *>(obj);
gpu_obj.vertex1 = portal->getUp();
gpu_obj.vertex2 = portal->getRight();
gpu_obj.normal = portal->getNormal();
gpu_obj.transform = glm::mat4(portal->getTransform());
gpu_obj.transform = glm::mat4(portal->getRotation());
Portal *linked = static_cast<Portal *>(_objects[i - 2]);

View File

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