#include "MagnumDrawable.h" #include #include "Components.h" namespace Rendering::Magnum { void Drawable::draw(const Matrix4& transformationMatrix, SceneGraph::Camera3D& camera) { const auto mesh = _registry.try_get(_entity); if (!mesh) return; if (const auto material = _registry.try_get(_entity)) { material->_shader-> setDiffuseColor(material->phongConfig->diffuse) .setAmbientColor(material->phongConfig->ambient) .setSpecularColor(material->phongConfig->specular) .setShininess(material->phongConfig->shininess) .setLightPositions({ {camera.cameraMatrix().transformPoint({-3.0f, 10.0f, 10.0f}), 0.0f} }) .setTransformationMatrix(transformationMatrix) .setNormalMatrix(transformationMatrix.normalMatrix()) .setProjectionMatrix(camera.projectionMatrix()) .draw(*mesh->mesh); if (material->texture) { material->_shader->bindDiffuseTexture(*material->texture); } } else { // TODO: Have a default rendering method } } }