浏览代码

gpu: rename FrameBuffer to Framebuffer.

legacy
Sam Hocevar sam 12 年前
父节点
当前提交
2c3092ef28
共有 5 个文件被更改,包括 34 次插入34 次删除
  1. +14
    -14
      src/gpu/framebuffer.cpp
  2. +7
    -7
      src/lol/gpu/framebuffer.h
  3. +1
    -1
      src/lol/gpu/shader.h
  4. +3
    -3
      tutorial/08_fbo.cpp
  5. +9
    -9
      tutorial/12_voronoi.cpp

+ 14
- 14
src/gpu/framebuffer.cpp 查看文件

@@ -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;

@@ -55,11 +55,11 @@ class FrameBufferData
};

//
// The FrameBufferFormat struct
// The FramebufferFormat struct
// ----------------------
//

uint32_t FrameBufferFormat::GetFormat()
uint32_t FramebufferFormat::GetFormat()
{
switch (m_format)
{
@@ -156,7 +156,7 @@ uint32_t FrameBufferFormat::GetFormat()
return 0;
}

uint32_t FrameBufferFormat::GetFormatOrder()
uint32_t FramebufferFormat::GetFormatOrder()
{
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;
#if defined USE_D3D9
@@ -317,7 +317,7 @@ FrameBuffer::FrameBuffer(ivec2 size, FrameBufferFormat fbo_format)
#endif
}

FrameBuffer::~FrameBuffer()
Framebuffer::~Framebuffer()
{
#if defined USE_D3D9 || defined _XBOX
m_data->m_surface->Release();
@@ -337,7 +337,7 @@ FrameBuffer::~FrameBuffer()
delete m_data;
}

ShaderTexture FrameBuffer::GetTexture() const
ShaderTexture Framebuffer::GetTexture() const
{
ShaderTexture ret;
#if defined USE_D3D9 || defined _XBOX
@@ -348,12 +348,12 @@ ShaderTexture FrameBuffer::GetTexture() const
return ret;
}

ivec2 FrameBuffer::GetSize() const
ivec2 Framebuffer::GetSize() const
{
return m_data->m_size;
}

void FrameBuffer::Bind()
void Framebuffer::Bind()
{
#if defined USE_D3D9 || defined _XBOX
if (FAILED(g_d3ddevice->GetRenderTarget(0, &m_data->m_back_surface)))
@@ -371,7 +371,7 @@ void FrameBuffer::Bind()
#endif
}

void FrameBuffer::Unbind()
void Framebuffer::Unbind()
{
#if defined USE_D3D9
if (FAILED(g_d3ddevice->SetRenderTarget(0, m_data->m_back_surface)))


+ 7
- 7
src/lol/gpu/framebuffer.h 查看文件

@@ -9,7 +9,7 @@
//

//
// The FrameBuffer class
// The Framebuffer class
// ---------------------
//

@@ -21,7 +21,7 @@
namespace lol
{

struct FrameBufferFormat
struct FramebufferFormat
{
enum Value
{
@@ -88,18 +88,18 @@ struct FrameBufferFormat
m_format;
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) {}
inline uint32_t GetFormat();
inline uint32_t GetFormatOrder();
inline operator Value() { return m_format; }
};

class FrameBuffer
class Framebuffer
{
public:
FrameBuffer(ivec2 size, FrameBufferFormat fbo_format=FrameBufferFormat());
~FrameBuffer();
Framebuffer(ivec2 size, FramebufferFormat fbo_format = FramebufferFormat());
~Framebuffer();

ShaderTexture GetTexture() const;
ivec2 GetSize() const;
@@ -108,7 +108,7 @@ public:
void Unbind();

private:
class FrameBufferData *m_data;
class FramebufferData *m_data;
};

} /* namespace lol */


+ 1
- 1
src/lol/gpu/shader.h 查看文件

@@ -49,7 +49,7 @@ private:
struct ShaderTexture
{
friend class Shader;
friend class FrameBuffer;
friend class Framebuffer;
friend class Texture;

public:


+ 3
- 3
tutorial/08_fbo.cpp 查看文件

@@ -70,7 +70,7 @@ public:
memcpy(vertices, &m_vertices[0], m_vertices.Bytes());
m_vbo->Unlock();

m_fbo = new FrameBuffer(Video::GetSize());
m_fbo = new Framebuffer(Video::GetSize());
m_fbo->Bind();
Video::SetClearColor(vec4(0.f, 0.f, 0.f, 1.f));
Video::SetClearDepth(1.f);
@@ -90,7 +90,7 @@ public:
#if _XBOX
/* FIXME: the Xbox enforces full EDRAM clears on each frame, so
* 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_texture, m_fbo->GetTexture(), 0);
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;
VertexDeclaration *m_vdecl;
VertexBuffer *m_vbo;
FrameBuffer *m_fbo;
Framebuffer *m_fbo;
double m_time;
vec3 m_hotspot, m_color;
bool m_ready;


+ 9
- 9
tutorial/12_voronoi.cpp 查看文件

@@ -94,7 +94,7 @@ public:

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)
{
@@ -128,7 +128,7 @@ public:
m_fbos.Last().m1->Unbind();
}

temp_buffer = new FrameBuffer(Video::GetSize());
temp_buffer = new Framebuffer(Video::GetSize());
temp_buffer->Bind();
Video::SetClearColor(vec4(0.f, 0.f, 0.f, 1.f));
Video::SetClearDepth(1.f);
@@ -223,8 +223,8 @@ public:
int buf = voronoi_points.Count() % 2;
for (int j = 0; j < voronoi_points.Count(); ++j)
{
FrameBuffer *dst_buf;
FrameBuffer *src_buf;
Framebuffer *dst_buf;
Framebuffer *src_buf;
if (buf)
{
@@ -275,8 +275,8 @@ public:
int buf = 0;
while (1)
{
FrameBuffer *dst_buf;
FrameBuffer *src_buf;
Framebuffer *dst_buf;
Framebuffer *src_buf;
Shader *shader;

if (curres == ivec2(0))
@@ -305,7 +305,7 @@ public:
#if _XBOX
/* FIXME: the Xbox enforces full EDRAM clears on each frame, so
* 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_texture, m_fbo->GetTexture(), 0);
//m_vdecl->SetStream(m_vbo, m_fbos[m_cur_fbo].m4.Last());
@@ -365,8 +365,8 @@ private:
VertexDeclaration *m_vdecl;
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 m_cur_fbo;


正在加载...
取消
保存