From 598abe672249b436c5cce028795457662d8d11bf Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Tue, 14 Apr 2015 18:48:06 -0700 Subject: [PATCH] Cleaning up Frambuffer.h --- libraries/gpu/src/gpu/Format.h | 1 + libraries/gpu/src/gpu/Framebuffer.h | 49 ++++++----------------------- 2 files changed, 10 insertions(+), 40 deletions(-) diff --git a/libraries/gpu/src/gpu/Format.h b/libraries/gpu/src/gpu/Format.h index 15c218a577..e43c190819 100644 --- a/libraries/gpu/src/gpu/Format.h +++ b/libraries/gpu/src/gpu/Format.h @@ -35,6 +35,7 @@ typedef glm::vec4 Vec4; typedef glm::vec3 Vec3; typedef glm::vec2 Vec2; typedef glm::ivec2 Vec2i; +typedef glm::uvec2 Vec2u; // Description of a scalar type enum Type { diff --git a/libraries/gpu/src/gpu/Framebuffer.h b/libraries/gpu/src/gpu/Framebuffer.h index a6fc127b17..ef77df7ceb 100755 --- a/libraries/gpu/src/gpu/Framebuffer.h +++ b/libraries/gpu/src/gpu/Framebuffer.h @@ -18,35 +18,6 @@ namespace gpu { typedef Element Format; -class Viewport { -public: - int32 width = 1; - int32 height = 1; - int32 top = 0; - int32 left = 0; - float zmin = 0.f; - float zmax = 1.f; - - Viewport() {} - Viewport(int32 w, int32 h, int32 t = 0, int32 l = 0, float zin = 0.f, float zax = 1.f): - width(w), - height(h), - top(t), - left(l), - zmin(zin), - zmax(zax) - {} - Viewport(const Vec2i& wh, const Vec2i& tl = Vec2i(0), const Vec2& zrange = Vec2(0.f, 1.f)): - width(wh.x), - height(wh.y), - top(tl.x), - left(tl.y), - zmin(zrange.x), - zmax(zrange.y) - {} - ~Viewport() {} -}; - class Swapchain { public: // Properties @@ -147,6 +118,7 @@ public: bool validateTargetCompatibility(const Texture& texture, uint32 subresource = 0) const; + Vec2u getSize() const { return Vec2u(getWidth(), getHeight()); } uint16 getWidth() const; uint16 getHeight() const; uint16 getNumSamples() const; @@ -157,24 +129,21 @@ public: void resize( uint16 width, uint16 height, uint16 samples = 1 ); static const uint32 MAX_NUM_RENDER_BUFFERS = 8; - static uint32 getMaxNumRenderBuffers() { return MAX_NUM_RENDER_BUFFERS; } - - // Get viewport covering the ful Canvas - Viewport getViewport() const { return Viewport(getWidth(), getHeight(), 0, 0); } + static uint32 getMaxNumRenderBuffers() { return MAX_NUM_RENDER_BUFFERS; } protected: - uint16 _width = 0; - uint16 _height = 0; - uint16 _numSamples = 0; + SwapchainPointer _swapchain; + + TextureViews _renderBuffers; + TextureView _depthStencilBuffer; uint32 _bufferMask = 0; uint32 _frameCount = 0; - SwapchainPointer _swapchain; - - TextureViews _renderBuffers; - TextureView _depthStencilBuffer; + uint16 _width = 0; + uint16 _height = 0; + uint16 _numSamples = 0; void updateSize(const TexturePointer& texture);