diff --git a/graphics/include/gfx_device.hpp b/graphics/include/gfx_device.hpp index 09ae6a8..7688aa2 100644 --- a/graphics/include/gfx_device.hpp +++ b/graphics/include/gfx_device.hpp @@ -5,8 +5,11 @@ #include "gfx.hpp" namespace gfx { - - struct GFX_API Device { + + // Do not use a pointer to this class, always cast to the proper implementation to avoid V-Table overhead + struct GFX_API IDevice { + + virtual void setViewport(uint32_t top_left_x, uint32_t top_left_y, uint32_t width, uint32_t height) = 0; @@ -17,7 +20,7 @@ namespace gfx { virtual void bufferData(const void* data, Buffer buffer) = 0; virtual void bufferSubData(uint32_t offset, uint32_t size, const void* data, Buffer buffer) = 0; - virtual void drawElements(Primitive primitive, IndexBufferFormat format, uint32_t count, uint32_t offset); + virtual void drawElements(Primitive primitive, IndexBufferFormat format, uint32_t count, uint32_t offset) = 0; virtual void drawArrays() = 0; }; diff --git a/include/components/custom.hpp b/include/components/custom.hpp index 17c8c66..96b8434 100644 --- a/include/components/custom.hpp +++ b/include/components/custom.hpp @@ -14,8 +14,7 @@ namespace components { CustomComponent(Object* parent); virtual ~CustomComponent() = 0; - virtual void onInit(); - virtual void onUpdate(glm::mat4 t); + virtual void onUpdate(glm::mat4 t) {} }; diff --git a/src/components/camera.cpp b/src/components/camera.cpp index ce313b5..edc035b 100644 --- a/src/components/camera.cpp +++ b/src/components/camera.cpp @@ -77,7 +77,7 @@ static glm::vec2 getViewportSize() void Camera::usePerspective(float fovDeg) { constexpr float NEAR = 0.1f; - constexpr float FAR = 1000.0f; + constexpr float FAR = 100000.0f; m_mode = Modes::PERSPECTIVE; m_fovDeg = fovDeg; diff --git a/src/components/custom.cpp b/src/components/custom.cpp index 9338213..a1feee8 100644 --- a/src/components/custom.cpp +++ b/src/components/custom.cpp @@ -4,6 +4,7 @@ namespace components { CustomComponent::CustomComponent(Object* parent) : Component(parent, TypeEnum::CUSTOM) { + } CustomComponent::~CustomComponent() @@ -11,14 +12,4 @@ namespace components { } - void CustomComponent::onInit() - { - - } - - void CustomComponent::onUpdate(glm::mat4 t) - { - - } - } \ No newline at end of file