| @@ -33,13 +33,13 @@ namespace lol | |||||
| { | { | ||||
| // | // | ||||
| // The FrameBufferData class | |||||
| // The FramebufferData class | |||||
| // ------------------------- | // ------------------------- | ||||
| // | // | ||||
| class FrameBufferData | |||||
| class FramebufferData | |||||
| { | { | ||||
| friend class FrameBuffer; | |||||
| friend class Framebuffer; | |||||
| ivec2 m_size; | ivec2 m_size; | ||||
| @@ -55,11 +55,11 @@ class FrameBufferData | |||||
| }; | }; | ||||
| // | // | ||||
| // The FrameBufferFormat struct | |||||
| // The FramebufferFormat struct | |||||
| // ---------------------- | // ---------------------- | ||||
| // | // | ||||
| uint32_t FrameBufferFormat::GetFormat() | |||||
| uint32_t FramebufferFormat::GetFormat() | |||||
| { | { | ||||
| switch (m_format) | switch (m_format) | ||||
| { | { | ||||
| @@ -156,7 +156,7 @@ uint32_t FrameBufferFormat::GetFormat() | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| uint32_t FrameBufferFormat::GetFormatOrder() | |||||
| uint32_t FramebufferFormat::GetFormatOrder() | |||||
| { | { | ||||
| switch (m_format) | switch (m_format) | ||||
| { | { | ||||
| @@ -226,12 +226,12 @@ uint32_t FrameBufferFormat::GetFormatOrder() | |||||
| } | } | ||||
| // | // | ||||
| // The FrameBuffer class | |||||
| // The Framebuffer class | |||||
| // ---------------------- | // ---------------------- | ||||
| // | // | ||||
| FrameBuffer::FrameBuffer(ivec2 size, FrameBufferFormat fbo_format) | |||||
| : m_data(new FrameBufferData) | |||||
| Framebuffer::Framebuffer(ivec2 size, FramebufferFormat fbo_format) | |||||
| : m_data(new FramebufferData) | |||||
| { | { | ||||
| m_data->m_size = size; | m_data->m_size = size; | ||||
| #if defined USE_D3D9 | #if defined USE_D3D9 | ||||
| @@ -317,7 +317,7 @@ FrameBuffer::FrameBuffer(ivec2 size, FrameBufferFormat fbo_format) | |||||
| #endif | #endif | ||||
| } | } | ||||
| FrameBuffer::~FrameBuffer() | |||||
| Framebuffer::~Framebuffer() | |||||
| { | { | ||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| m_data->m_surface->Release(); | m_data->m_surface->Release(); | ||||
| @@ -337,7 +337,7 @@ FrameBuffer::~FrameBuffer() | |||||
| delete m_data; | delete m_data; | ||||
| } | } | ||||
| ShaderTexture FrameBuffer::GetTexture() const | |||||
| ShaderTexture Framebuffer::GetTexture() const | |||||
| { | { | ||||
| ShaderTexture ret; | ShaderTexture ret; | ||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| @@ -348,12 +348,12 @@ ShaderTexture FrameBuffer::GetTexture() const | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| ivec2 FrameBuffer::GetSize() const | |||||
| ivec2 Framebuffer::GetSize() const | |||||
| { | { | ||||
| return m_data->m_size; | return m_data->m_size; | ||||
| } | } | ||||
| void FrameBuffer::Bind() | |||||
| void Framebuffer::Bind() | |||||
| { | { | ||||
| #if defined USE_D3D9 || defined _XBOX | #if defined USE_D3D9 || defined _XBOX | ||||
| if (FAILED(g_d3ddevice->GetRenderTarget(0, &m_data->m_back_surface))) | if (FAILED(g_d3ddevice->GetRenderTarget(0, &m_data->m_back_surface))) | ||||
| @@ -371,7 +371,7 @@ void FrameBuffer::Bind() | |||||
| #endif | #endif | ||||
| } | } | ||||
| void FrameBuffer::Unbind() | |||||
| void Framebuffer::Unbind() | |||||
| { | { | ||||
| #if defined USE_D3D9 | #if defined USE_D3D9 | ||||
| if (FAILED(g_d3ddevice->SetRenderTarget(0, m_data->m_back_surface))) | if (FAILED(g_d3ddevice->SetRenderTarget(0, m_data->m_back_surface))) | ||||
| @@ -9,7 +9,7 @@ | |||||
| // | // | ||||
| // | // | ||||
| // The FrameBuffer class | |||||
| // The Framebuffer class | |||||
| // --------------------- | // --------------------- | ||||
| // | // | ||||
| @@ -21,7 +21,7 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| struct FrameBufferFormat | |||||
| struct FramebufferFormat | |||||
| { | { | ||||
| enum Value | enum Value | ||||
| { | { | ||||
| @@ -88,18 +88,18 @@ struct FrameBufferFormat | |||||
| m_format; | m_format; | ||||
| bool m_invert_rgb; | bool m_invert_rgb; | ||||
| inline FrameBufferFormat(Value format=RGBA_8, bool invert_rgb=true) | |||||
| inline FramebufferFormat(Value format=RGBA_8, bool invert_rgb=true) | |||||
| : m_format(format), m_invert_rgb(invert_rgb) {} | : m_format(format), m_invert_rgb(invert_rgb) {} | ||||
| inline uint32_t GetFormat(); | inline uint32_t GetFormat(); | ||||
| inline uint32_t GetFormatOrder(); | inline uint32_t GetFormatOrder(); | ||||
| inline operator Value() { return m_format; } | inline operator Value() { return m_format; } | ||||
| }; | }; | ||||
| class FrameBuffer | |||||
| class Framebuffer | |||||
| { | { | ||||
| public: | public: | ||||
| FrameBuffer(ivec2 size, FrameBufferFormat fbo_format=FrameBufferFormat()); | |||||
| ~FrameBuffer(); | |||||
| Framebuffer(ivec2 size, FramebufferFormat fbo_format = FramebufferFormat()); | |||||
| ~Framebuffer(); | |||||
| ShaderTexture GetTexture() const; | ShaderTexture GetTexture() const; | ||||
| ivec2 GetSize() const; | ivec2 GetSize() const; | ||||
| @@ -108,7 +108,7 @@ public: | |||||
| void Unbind(); | void Unbind(); | ||||
| private: | private: | ||||
| class FrameBufferData *m_data; | |||||
| class FramebufferData *m_data; | |||||
| }; | }; | ||||
| } /* namespace lol */ | } /* namespace lol */ | ||||
| @@ -49,7 +49,7 @@ private: | |||||
| struct ShaderTexture | struct ShaderTexture | ||||
| { | { | ||||
| friend class Shader; | friend class Shader; | ||||
| friend class FrameBuffer; | |||||
| friend class Framebuffer; | |||||
| friend class Texture; | friend class Texture; | ||||
| public: | public: | ||||
| @@ -70,7 +70,7 @@ public: | |||||
| memcpy(vertices, &m_vertices[0], m_vertices.Bytes()); | memcpy(vertices, &m_vertices[0], m_vertices.Bytes()); | ||||
| m_vbo->Unlock(); | m_vbo->Unlock(); | ||||
| m_fbo = new FrameBuffer(Video::GetSize()); | |||||
| m_fbo = new Framebuffer(Video::GetSize()); | |||||
| m_fbo->Bind(); | m_fbo->Bind(); | ||||
| Video::SetClearColor(vec4(0.f, 0.f, 0.f, 1.f)); | Video::SetClearColor(vec4(0.f, 0.f, 0.f, 1.f)); | ||||
| Video::SetClearDepth(1.f); | Video::SetClearDepth(1.f); | ||||
| @@ -90,7 +90,7 @@ public: | |||||
| #if _XBOX | #if _XBOX | ||||
| /* FIXME: the Xbox enforces full EDRAM clears on each frame, so | /* FIXME: the Xbox enforces full EDRAM clears on each frame, so | ||||
| * we cannot expect the render target contents to be preserved. | * we cannot expect the render target contents to be preserved. | ||||
| * This code snippet should be moved inside the FrameBuffer class. */ | |||||
| * This code snippet should be moved inside the Framebuffer class. */ | |||||
| m_shader->SetUniform(m_uni_flag, 1.f); | m_shader->SetUniform(m_uni_flag, 1.f); | ||||
| m_shader->SetUniform(m_uni_texture, m_fbo->GetTexture(), 0); | m_shader->SetUniform(m_uni_texture, m_fbo->GetTexture(), 0); | ||||
| m_vdecl->SetStream(m_vbo, m_coord); | m_vdecl->SetStream(m_vbo, m_coord); | ||||
| @@ -126,7 +126,7 @@ private: | |||||
| ShaderUniform m_uni_flag, m_uni_point, m_uni_color, m_uni_texture; | ShaderUniform m_uni_flag, m_uni_point, m_uni_color, m_uni_texture; | ||||
| VertexDeclaration *m_vdecl; | VertexDeclaration *m_vdecl; | ||||
| VertexBuffer *m_vbo; | VertexBuffer *m_vbo; | ||||
| FrameBuffer *m_fbo; | |||||
| Framebuffer *m_fbo; | |||||
| double m_time; | double m_time; | ||||
| vec3 m_hotspot, m_color; | vec3 m_hotspot, m_color; | ||||
| bool m_ready; | bool m_ready; | ||||
| @@ -94,7 +94,7 @@ public: | |||||
| for (int i = 0; i < MaxFboType; ++i) | for (int i = 0; i < MaxFboType; ++i) | ||||
| { | { | ||||
| m_fbos.Push(new FrameBuffer(Video::GetSize()), 0, Array<ShaderUniform>(), Array<ShaderAttrib>() ); | |||||
| m_fbos.Push(new Framebuffer(Video::GetSize()), 0, Array<ShaderUniform>(), Array<ShaderAttrib>() ); | |||||
| if (i == SrcVoronoiFbo) | if (i == SrcVoronoiFbo) | ||||
| { | { | ||||
| @@ -128,7 +128,7 @@ public: | |||||
| m_fbos.Last().m1->Unbind(); | m_fbos.Last().m1->Unbind(); | ||||
| } | } | ||||
| temp_buffer = new FrameBuffer(Video::GetSize()); | |||||
| temp_buffer = new Framebuffer(Video::GetSize()); | |||||
| temp_buffer->Bind(); | temp_buffer->Bind(); | ||||
| Video::SetClearColor(vec4(0.f, 0.f, 0.f, 1.f)); | Video::SetClearColor(vec4(0.f, 0.f, 0.f, 1.f)); | ||||
| Video::SetClearDepth(1.f); | Video::SetClearDepth(1.f); | ||||
| @@ -223,8 +223,8 @@ public: | |||||
| int buf = voronoi_points.Count() % 2; | int buf = voronoi_points.Count() % 2; | ||||
| for (int j = 0; j < voronoi_points.Count(); ++j) | for (int j = 0; j < voronoi_points.Count(); ++j) | ||||
| { | { | ||||
| FrameBuffer *dst_buf; | |||||
| FrameBuffer *src_buf; | |||||
| Framebuffer *dst_buf; | |||||
| Framebuffer *src_buf; | |||||
| if (buf) | if (buf) | ||||
| { | { | ||||
| @@ -275,8 +275,8 @@ public: | |||||
| int buf = 0; | int buf = 0; | ||||
| while (1) | while (1) | ||||
| { | { | ||||
| FrameBuffer *dst_buf; | |||||
| FrameBuffer *src_buf; | |||||
| Framebuffer *dst_buf; | |||||
| Framebuffer *src_buf; | |||||
| Shader *shader; | Shader *shader; | ||||
| if (curres == ivec2(0)) | if (curres == ivec2(0)) | ||||
| @@ -305,7 +305,7 @@ public: | |||||
| #if _XBOX | #if _XBOX | ||||
| /* FIXME: the Xbox enforces full EDRAM clears on each frame, so | /* FIXME: the Xbox enforces full EDRAM clears on each frame, so | ||||
| * we cannot expect the render target contents to be preserved. | * we cannot expect the render target contents to be preserved. | ||||
| * This code snippet should be moved inside the FrameBuffer class. */ | |||||
| * This code snippet should be moved inside the Framebuffer class. */ | |||||
| //m_fbos[m_cur_fbo].m2->SetUniform(m_uni_flag, 1.f); | //m_fbos[m_cur_fbo].m2->SetUniform(m_uni_flag, 1.f); | ||||
| //m_fbos[m_cur_fbo].m2->SetUniform(m_uni_texture, m_fbo->GetTexture(), 0); | //m_fbos[m_cur_fbo].m2->SetUniform(m_uni_texture, m_fbo->GetTexture(), 0); | ||||
| //m_vdecl->SetStream(m_vbo, m_fbos[m_cur_fbo].m4.Last()); | //m_vdecl->SetStream(m_vbo, m_fbos[m_cur_fbo].m4.Last()); | ||||
| @@ -365,8 +365,8 @@ private: | |||||
| VertexDeclaration *m_vdecl; | VertexDeclaration *m_vdecl; | ||||
| VertexBuffer *m_vbo; | VertexBuffer *m_vbo; | ||||
| Array<FrameBuffer *, Shader *, Array<ShaderUniform>, Array<ShaderAttrib> > m_fbos; | |||||
| FrameBuffer *temp_buffer; | |||||
| Array<Framebuffer *, Shader *, Array<ShaderUniform>, Array<ShaderAttrib> > m_fbos; | |||||
| Framebuffer *temp_buffer; | |||||
| int mode; | int mode; | ||||
| int m_cur_fbo; | int m_cur_fbo; | ||||