Remove unused accessors from CDevice

dev-mp
Piotr Dziwinski 2014-08-12 18:18:30 +02:00
parent 360b72ac5a
commit 4bdfa0aa4e
4 changed files with 49 additions and 331 deletions

View File

@ -258,26 +258,16 @@ public:
//! Sets the transform matrix of given type //! Sets the transform matrix of given type
virtual void SetTransform(TransformType type, const Math::Matrix &matrix) = 0; virtual void SetTransform(TransformType type, const Math::Matrix &matrix) = 0;
//! Returns the current transform matrix of given type
virtual const Math::Matrix& GetTransform(TransformType type) = 0;
//! Multiplies the current transform matrix of given type by given matrix
virtual void MultiplyTransform(TransformType type, const Math::Matrix &matrix) = 0;
//! Sets the current material //! Sets the current material
virtual void SetMaterial(const Material &material) = 0; virtual void SetMaterial(const Material &material) = 0;
//! Returns the current material
virtual const Material& GetMaterial() = 0;
//! Returns the maximum number of lights available //! Returns the maximum number of lights available
virtual int GetMaxLightCount() = 0; virtual int GetMaxLightCount() = 0;
//! Sets the light at given index //! Sets the light at given index
virtual void SetLight(int index, const Light &light) = 0; virtual void SetLight(int index, const Light &light) = 0;
//! Returns the current light at given index
virtual const Light& GetLight(int index) = 0;
//! Enables/disables the light at given index //! Enables/disables the light at given index
virtual void SetLightEnabled(int index, bool enabled) = 0; virtual void SetLightEnabled(int index, bool enabled) = 0;
//! Returns the current enable state of light at given index
virtual bool GetLightEnabled(int index) = 0;
//! Creates a texture from image; the image can be safely removed after that //! Creates a texture from image; the image can be safely removed after that
virtual Texture CreateTexture(CImage *image, const TextureCreateParams &params) = 0; virtual Texture CreateTexture(CImage *image, const TextureCreateParams &params) = 0;
@ -294,17 +284,11 @@ public:
virtual void SetTexture(int index, const Texture &texture) = 0; virtual void SetTexture(int index, const Texture &texture) = 0;
//! Sets the texture image by ID at given texture stage //! Sets the texture image by ID at given texture stage
virtual void SetTexture(int index, unsigned int textureId) = 0; virtual void SetTexture(int index, unsigned int textureId) = 0;
//! Returns the (multi)texture at given index
virtual Texture GetTexture(int index) = 0;
//! Enables/disables the given texture stage //! Enables/disables the given texture stage
virtual void SetTextureEnabled(int index, bool enabled) = 0; virtual void SetTextureEnabled(int index, bool enabled) = 0;
//! Returns the current enable state of given texture stage
virtual bool GetTextureEnabled(int index) = 0;
//! Sets the params for texture stage with given index //! Sets the params for texture stage with given index
virtual void SetTextureStageParams(int index, const TextureStageParams &params) = 0; virtual void SetTextureStageParams(int index, const TextureStageParams &params) = 0;
//! Returns the current params of texture stage with given index
virtual TextureStageParams GetTextureStageParams(int index) = 0;
//! Sets only the texture wrap modes (for faster than thru stage params) //! Sets only the texture wrap modes (for faster than thru stage params)
virtual void SetTextureStageWrap(int index, TexWrapMode wrapS, TexWrapMode wrapT) = 0; virtual void SetTextureStageWrap(int index, TexWrapMode wrapS, TexWrapMode wrapT) = 0;
@ -348,61 +332,39 @@ public:
//! Enables/disables the given render state //! Enables/disables the given render state
virtual void SetRenderState(RenderState state, bool enabled) = 0; virtual void SetRenderState(RenderState state, bool enabled) = 0;
//! Returns the current setting of given render state
virtual bool GetRenderState(RenderState state) = 0;
//! Sets the function of depth test //! Sets the function of depth test
virtual void SetDepthTestFunc(CompFunc func) = 0; virtual void SetDepthTestFunc(CompFunc func) = 0;
//! Returns the current function of depth test
virtual CompFunc GetDepthTestFunc() = 0;
//! Sets the depth bias (constant value added to Z-coords) //! Sets the depth bias (constant value added to Z-coords)
virtual void SetDepthBias(float factor) = 0; virtual void SetDepthBias(float factor) = 0;
//! Returns the current depth bias
virtual float GetDepthBias() = 0;
//! Sets the alpha test function and reference value //! Sets the alpha test function and reference value
virtual void SetAlphaTestFunc(CompFunc func, float refValue) = 0; virtual void SetAlphaTestFunc(CompFunc func, float refValue) = 0;
//! Returns the current alpha test function and reference value
virtual void GetAlphaTestFunc(CompFunc &func, float &refValue) = 0;
//! Sets the blending functions for source and destination operations //! Sets the blending functions for source and destination operations
virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend) = 0; virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend) = 0;
//! Returns the current blending functions for source and destination operations
virtual void GetBlendFunc(BlendFunc &srcBlend, BlendFunc &dstBlend) = 0;
//! Sets the clear color //! Sets the clear color
virtual void SetClearColor(const Color &color) = 0; virtual void SetClearColor(const Color &color) = 0;
//! Returns the current clear color
virtual Color GetClearColor() = 0;
//! Sets the global ambient color //! Sets the global ambient color
virtual void SetGlobalAmbient(const Color &color) = 0; virtual void SetGlobalAmbient(const Color &color) = 0;
//! Returns the global ambient color
virtual Color GetGlobalAmbient() = 0;
//! Sets the fog parameters: mode, color, start distance, end distance and density (for exp models) //! Sets the fog parameters: mode, color, start distance, end distance and density (for exp models)
virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density) = 0; virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density) = 0;
//! Returns the current fog parameters: mode, color, start distance, end distance and density (for exp models)
virtual void GetFogParams(FogMode &mode, Color &color, float &start, float &end, float &density) = 0;
//! Sets the current cull mode //! Sets the current cull mode
virtual void SetCullMode(CullMode mode) = 0; virtual void SetCullMode(CullMode mode) = 0;
//! Returns the current cull mode
virtual CullMode GetCullMode() = 0;
//! Sets the shade model //! Sets the shade model
virtual void SetShadeModel(ShadeModel model) = 0; virtual void SetShadeModel(ShadeModel model) = 0;
//! Returns the current shade model
virtual ShadeModel GetShadeModel() = 0;
//! Sets the current fill mode //! Sets the current fill mode
virtual void SetFillMode(FillMode mode) = 0; virtual void SetFillMode(FillMode mode) = 0;
//! Returns the current fill mode
virtual FillMode GetFillMode() = 0;
//! Returns the pixels of the entire screen //! Returns the pixels of the entire screen
virtual void* GetFrameBufferPixels()const = 0; virtual void* GetFrameBufferPixels() const = 0;
}; };

View File

@ -290,11 +290,6 @@ void CGLDevice::SetUseVbo(bool vboAvailable)
m_vboAvailable = vboAvailable; m_vboAvailable = vboAvailable;
} }
bool CGLDevice::GetUseVbo()
{
return m_vboAvailable;
}
void CGLDevice::BeginScene() void CGLDevice::BeginScene()
{ {
Clear(); Clear();
@ -339,44 +334,6 @@ void CGLDevice::SetTransform(TransformType type, const Math::Matrix &matrix)
} }
} }
const Math::Matrix& CGLDevice::GetTransform(TransformType type)
{
if (type == TRANSFORM_WORLD)
return m_worldMat;
else if (type == TRANSFORM_VIEW)
return m_viewMat;
else if (type == TRANSFORM_PROJECTION)
return m_projectionMat;
else
assert(false);
return m_worldMat; // to avoid warning
}
void CGLDevice::MultiplyTransform(TransformType type, const Math::Matrix &matrix)
{
if (type == TRANSFORM_WORLD)
{
m_worldMat = Math::MultiplyMatrices(m_worldMat, matrix);
UpdateModelviewMatrix();
}
else if (type == TRANSFORM_VIEW)
{
m_viewMat = Math::MultiplyMatrices(m_viewMat, matrix);
UpdateModelviewMatrix();
}
else if (type == TRANSFORM_PROJECTION)
{
m_projectionMat = Math::MultiplyMatrices(m_projectionMat, matrix);
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(m_projectionMat.Array());
}
else
{
assert(false);
}
}
void CGLDevice::UpdateModelviewMatrix() void CGLDevice::UpdateModelviewMatrix()
{ {
m_modelviewMat = Math::MultiplyMatrices(m_viewMat, m_worldMat); m_modelviewMat = Math::MultiplyMatrices(m_viewMat, m_worldMat);
@ -402,11 +359,6 @@ void CGLDevice::SetMaterial(const Material &material)
glMaterialfv(GL_FRONT, GL_SPECULAR, m_material.specular.Array()); glMaterialfv(GL_FRONT, GL_SPECULAR, m_material.specular.Array());
} }
const Material& CGLDevice::GetMaterial()
{
return m_material;
}
int CGLDevice::GetMaxLightCount() int CGLDevice::GetMaxLightCount()
{ {
return m_lights.size(); return m_lights.size();
@ -482,14 +434,6 @@ void CGLDevice::UpdateLightPosition(int index)
glPopMatrix(); glPopMatrix();
} }
const Light& CGLDevice::GetLight(int index)
{
assert(index >= 0);
assert(index < static_cast<int>( m_lights.size() ));
return m_lights[index];
}
void CGLDevice::SetLightEnabled(int index, bool enabled) void CGLDevice::SetLightEnabled(int index, bool enabled)
{ {
assert(index >= 0); assert(index >= 0);
@ -503,14 +447,6 @@ void CGLDevice::SetLightEnabled(int index, bool enabled)
glDisable(GL_LIGHT0 + index); glDisable(GL_LIGHT0 + index);
} }
bool CGLDevice::GetLightEnabled(int index)
{
assert(index >= 0);
assert(index < static_cast<int>( m_lights.size() ));
return m_lightsEnabled[index];
}
/** If image is invalid, returns invalid texture. /** If image is invalid, returns invalid texture.
Otherwise, returns pointer to new Texture struct. Otherwise, returns pointer to new Texture struct.
This struct must not be deleted in other way than through DeleteTexture() */ This struct must not be deleted in other way than through DeleteTexture() */
@ -781,15 +717,6 @@ void CGLDevice::SetTexture(int index, unsigned int textureId)
UpdateTextureParams(index); UpdateTextureParams(index);
} }
/**
Returns the previously assigned texture or invalid texture if the given stage is not enabled. */
Texture CGLDevice::GetTexture(int index)
{
assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() ));
return m_currentTextures[index];
}
void CGLDevice::SetTextureEnabled(int index, bool enabled) void CGLDevice::SetTextureEnabled(int index, bool enabled)
{ {
assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() )); assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() ));
@ -813,13 +740,6 @@ void CGLDevice::SetTextureEnabled(int index, bool enabled)
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
} }
bool CGLDevice::GetTextureEnabled(int index)
{
assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() ));
return m_texturesEnabled[index];
}
/** /**
Sets the texture parameters for the given texture stage. Sets the texture parameters for the given texture stage.
If the given texture was not set (bound) yet, nothing happens. If the given texture was not set (bound) yet, nothing happens.
@ -1002,13 +922,6 @@ void CGLDevice::SetTextureStageWrap(int index, TexWrapMode wrapS, TexWrapMode wr
else assert(false); else assert(false);
} }
TextureStageParams CGLDevice::GetTextureStageParams(int index)
{
assert(index >= 0 && index < static_cast<int>( m_currentTextures.size() ));
return m_textureStageParams[index];
}
GLenum TranslateGfxPrimitive(PrimitiveType type) GLenum TranslateGfxPrimitive(PrimitiveType type)
{ {
GLenum flag = 0; GLenum flag = 0;
@ -1529,30 +1442,6 @@ void CGLDevice::SetRenderState(RenderState state, bool enabled)
glDisable(flag); glDisable(flag);
} }
bool CGLDevice::GetRenderState(RenderState state)
{
if (state == RENDER_STATE_LIGHTING)
return m_lighting;
GLenum flag = 0;
switch (state)
{
case RENDER_STATE_DEPTH_WRITE: flag = GL_DEPTH_WRITEMASK; break;
case RENDER_STATE_BLENDING: flag = GL_BLEND; break;
case RENDER_STATE_FOG: flag = GL_FOG; break;
case RENDER_STATE_DEPTH_TEST: flag = GL_DEPTH_TEST; break;
case RENDER_STATE_ALPHA_TEST: flag = GL_ALPHA_TEST; break;
case RENDER_STATE_CULLING: flag = GL_CULL_FACE; break;
default: assert(false); break;
}
GLboolean result = GL_FALSE;
glGetBooleanv(flag, &result);
return result == GL_TRUE;
}
CompFunc TranslateGLCompFunc(GLenum flag) CompFunc TranslateGLCompFunc(GLenum flag)
{ {
switch (flag) switch (flag)
@ -1592,39 +1481,16 @@ void CGLDevice::SetDepthTestFunc(CompFunc func)
glDepthFunc(TranslateGfxCompFunc(func)); glDepthFunc(TranslateGfxCompFunc(func));
} }
CompFunc CGLDevice::GetDepthTestFunc()
{
GLint flag = 0;
glGetIntegerv(GL_DEPTH_FUNC, &flag);
return TranslateGLCompFunc(static_cast<GLenum>(flag));
}
void CGLDevice::SetDepthBias(float factor) void CGLDevice::SetDepthBias(float factor)
{ {
glPolygonOffset(factor, 0.0f); glPolygonOffset(factor, 0.0f);
} }
float CGLDevice::GetDepthBias()
{
GLfloat result = 0.0f;
glGetFloatv(GL_POLYGON_OFFSET_FACTOR, &result);
return result;
}
void CGLDevice::SetAlphaTestFunc(CompFunc func, float refValue) void CGLDevice::SetAlphaTestFunc(CompFunc func, float refValue)
{ {
glAlphaFunc(TranslateGfxCompFunc(func), refValue); glAlphaFunc(TranslateGfxCompFunc(func), refValue);
} }
void CGLDevice::GetAlphaTestFunc(CompFunc &func, float &refValue)
{
GLint flag = 0;
glGetIntegerv(GL_ALPHA_TEST_FUNC, &flag);
func = TranslateGLCompFunc(static_cast<GLenum>(flag));
glGetFloatv(GL_ALPHA_TEST_REF, static_cast<GLfloat*>(&refValue));
}
BlendFunc TranslateGLBlendFunc(GLenum flag) BlendFunc TranslateGLBlendFunc(GLenum flag)
{ {
switch (flag) switch (flag)
@ -1671,41 +1537,16 @@ void CGLDevice::SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend)
glBlendFunc(TranslateGfxBlendFunc(srcBlend), TranslateGfxBlendFunc(dstBlend)); glBlendFunc(TranslateGfxBlendFunc(srcBlend), TranslateGfxBlendFunc(dstBlend));
} }
void CGLDevice::GetBlendFunc(BlendFunc &srcBlend, BlendFunc &dstBlend)
{
GLint srcFlag = 0;
glGetIntegerv(GL_ALPHA_TEST_FUNC, &srcFlag);
srcBlend = TranslateGLBlendFunc(static_cast<GLenum>(srcFlag));
GLint dstFlag = 0;
glGetIntegerv(GL_ALPHA_TEST_FUNC, &dstFlag);
dstBlend = TranslateGLBlendFunc(static_cast<GLenum>(dstFlag));
}
void CGLDevice::SetClearColor(const Color &color) void CGLDevice::SetClearColor(const Color &color)
{ {
glClearColor(color.r, color.g, color.b, color.a); glClearColor(color.r, color.g, color.b, color.a);
} }
Color CGLDevice::GetClearColor()
{
GLfloat color[4] = { 0.0f };
glGetFloatv(GL_COLOR_CLEAR_VALUE, color);
return Color(color[0], color[1], color[2], color[3]);
}
void CGLDevice::SetGlobalAmbient(const Color &color) void CGLDevice::SetGlobalAmbient(const Color &color)
{ {
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, color.Array()); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, color.Array());
} }
Color CGLDevice::GetGlobalAmbient()
{
GLfloat color[4] = { 0.0f };
glGetFloatv(GL_LIGHT_MODEL_AMBIENT, color);
return Color(color[0], color[1], color[2], color[3]);
}
void CGLDevice::SetFogParams(FogMode mode, const Color &color, float start, float end, float density) void CGLDevice::SetFogParams(FogMode mode, const Color &color, float start, float end, float density)
{ {
if (mode == FOG_LINEAR) glFogi(GL_FOG_MODE, GL_LINEAR); if (mode == FOG_LINEAR) glFogi(GL_FOG_MODE, GL_LINEAR);
@ -1719,23 +1560,6 @@ void CGLDevice::SetFogParams(FogMode mode, const Color &color, float start, floa
glFogfv(GL_FOG_COLOR, color.Array()); glFogfv(GL_FOG_COLOR, color.Array());
} }
void CGLDevice::GetFogParams(FogMode &mode, Color &color, float &start, float &end, float &density)
{
GLint flag = 0;
glGetIntegerv(GL_FOG_MODE, &flag);
if (flag == GL_LINEAR) mode = FOG_LINEAR;
else if (flag == GL_EXP) mode = FOG_EXP;
else if (flag == GL_EXP2) mode = FOG_EXP2;
else assert(false);
glGetFloatv(GL_FOG_START, static_cast<GLfloat*>(&start));
glGetFloatv(GL_FOG_END, static_cast<GLfloat*>(&end));
glGetFloatv(GL_FOG_DENSITY, static_cast<GLfloat*>(&density));
GLfloat col[4] = { 0.0f };
glGetFloatv(GL_FOG_COLOR, col);
color = Color(col[0], col[1], col[2], col[3]);
}
void CGLDevice::SetCullMode(CullMode mode) void CGLDevice::SetCullMode(CullMode mode)
{ {
// Cull clockwise back faces, so front face is the opposite // Cull clockwise back faces, so front face is the opposite
@ -1745,16 +1569,6 @@ void CGLDevice::SetCullMode(CullMode mode)
else assert(false); else assert(false);
} }
CullMode CGLDevice::GetCullMode()
{
GLint flag = 0;
glGetIntegerv(GL_FRONT_FACE, &flag);
if (flag == GL_CW) return CULL_CCW;
else if (flag == GL_CCW) return CULL_CW;
else assert(false);
return CULL_CW;
}
void CGLDevice::SetShadeModel(ShadeModel model) void CGLDevice::SetShadeModel(ShadeModel model)
{ {
if (model == SHADE_FLAT) glShadeModel(GL_FLAT); if (model == SHADE_FLAT) glShadeModel(GL_FLAT);
@ -1762,16 +1576,6 @@ void CGLDevice::SetShadeModel(ShadeModel model)
else assert(false); else assert(false);
} }
ShadeModel CGLDevice::GetShadeModel()
{
GLint flag = 0;
glGetIntegerv(GL_SHADE_MODEL, &flag);
if (flag == GL_FLAT) return SHADE_FLAT;
else if (flag == GL_SMOOTH) return SHADE_SMOOTH;
else assert(false);
return SHADE_FLAT;
}
void CGLDevice::SetFillMode(FillMode mode) void CGLDevice::SetFillMode(FillMode mode)
{ {
if (mode == FILL_POINT) glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); if (mode == FILL_POINT) glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
@ -1780,21 +1584,10 @@ void CGLDevice::SetFillMode(FillMode mode)
else assert(false); else assert(false);
} }
FillMode CGLDevice::GetFillMode()
{
GLint flag = 0;
glGetIntegerv(GL_POLYGON_MODE, &flag);
if (flag == GL_POINT) return FILL_POINT;
else if (flag == GL_LINE) return FILL_LINES;
else if (flag == GL_FILL) return FILL_POLY;
else assert(false);
return FILL_POINT;
}
void* CGLDevice::GetFrameBufferPixels()const{ void* CGLDevice::GetFrameBufferPixels()const{
GLubyte* pixels = new GLubyte [4 * m_config.size.x * m_config.size.y]; GLubyte* pixels = new GLubyte[4 * m_config.size.x * m_config.size.y];
glReadPixels(0, 0, m_config.size.x, m_config.size.y, GL_RGBA, GL_UNSIGNED_BYTE, pixels); glReadPixels(0, 0, m_config.size.x, m_config.size.y, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
unsigned int* p = static_cast<unsigned int*> ( static_cast<void*>(pixels) ); unsigned int* p = static_cast<unsigned int*> ( static_cast<void*>(pixels) );

View File

@ -92,103 +92,83 @@ public:
CGLDevice(const GLDeviceConfig &config); CGLDevice(const GLDeviceConfig &config);
virtual ~CGLDevice(); virtual ~CGLDevice();
virtual void DebugHook(); virtual void DebugHook() override;
virtual void DebugLights(); virtual void DebugLights() override;
virtual bool Create(); virtual bool Create() override;
virtual void Destroy(); virtual void Destroy() override;
void ConfigChanged(const GLDeviceConfig &newConfig); void ConfigChanged(const GLDeviceConfig &newConfig);
void SetUseVbo(bool useVbo); void SetUseVbo(bool useVbo);
bool GetUseVbo();
virtual void BeginScene(); virtual void BeginScene() override;
virtual void EndScene(); virtual void EndScene() override;
virtual void Clear(); virtual void Clear() override;
virtual void SetTransform(TransformType type, const Math::Matrix &matrix); virtual void SetTransform(TransformType type, const Math::Matrix &matrix) override;
virtual const Math::Matrix& GetTransform(TransformType type);
virtual void MultiplyTransform(TransformType type, const Math::Matrix &matrix);
virtual void SetMaterial(const Material &material); virtual void SetMaterial(const Material &material) override;
virtual const Material& GetMaterial();
virtual int GetMaxLightCount(); virtual int GetMaxLightCount() override;
virtual void SetLight(int index, const Light &light); virtual void SetLight(int index, const Light &light) override;
virtual const Light& GetLight(int index); virtual void SetLightEnabled(int index, bool enabled) override;
virtual void SetLightEnabled(int index, bool enabled);
virtual bool GetLightEnabled(int index);
virtual Texture CreateTexture(CImage *image, const TextureCreateParams &params); virtual Texture CreateTexture(CImage *image, const TextureCreateParams &params) override;
virtual Texture CreateTexture(ImageData *data, const TextureCreateParams &params); virtual Texture CreateTexture(ImageData *data, const TextureCreateParams &params) override;
virtual void DestroyTexture(const Texture &texture); virtual void DestroyTexture(const Texture &texture) override;
virtual void DestroyAllTextures(); virtual void DestroyAllTextures() override;
virtual int GetMaxTextureStageCount(); virtual int GetMaxTextureStageCount() override;
virtual void SetTexture(int index, const Texture &texture); virtual void SetTexture(int index, const Texture &texture) override;
virtual void SetTexture(int index, unsigned int textureId); virtual void SetTexture(int index, unsigned int textureId) override;
virtual Texture GetTexture(int index); virtual void SetTextureEnabled(int index, bool enabled) override;
virtual void SetTextureEnabled(int index, bool enabled);
virtual bool GetTextureEnabled(int index);
virtual void SetTextureStageParams(int index, const TextureStageParams &params); virtual void SetTextureStageParams(int index, const TextureStageParams &params) override;
virtual TextureStageParams GetTextureStageParams(int index);
virtual void SetTextureStageWrap(int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT); virtual void SetTextureStageWrap(int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT) override;
virtual void DrawPrimitive(PrimitiveType type, const Vertex *vertices , int vertexCount, virtual void DrawPrimitive(PrimitiveType type, const Vertex *vertices , int vertexCount,
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)); Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
virtual void DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, int vertexCount, virtual void DrawPrimitive(PrimitiveType type, const VertexTex2 *vertices, int vertexCount,
Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)); Color color = Color(1.0f, 1.0f, 1.0f, 1.0f)) override;
virtual void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount); virtual void DrawPrimitive(PrimitiveType type, const VertexCol *vertices , int vertexCount) override;
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount); virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override;
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount); virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override;
virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount); virtual unsigned int CreateStaticBuffer(PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount) override;
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const Vertex* vertices, int vertexCount); virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) override;
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount); virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) override;
virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount); virtual void UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount) override;
virtual void DrawStaticBuffer(unsigned int bufferId); virtual void DrawStaticBuffer(unsigned int bufferId) override;
virtual void DestroyStaticBuffer(unsigned int bufferId); virtual void DestroyStaticBuffer(unsigned int bufferId) override;
virtual int ComputeSphereVisibility(const Math::Vector &center, float radius); virtual int ComputeSphereVisibility(const Math::Vector &center, float radius) override;
virtual void SetRenderState(RenderState state, bool enabled); virtual void SetRenderState(RenderState state, bool enabled) override;
virtual bool GetRenderState(RenderState state);
virtual void SetDepthTestFunc(CompFunc func); virtual void SetDepthTestFunc(CompFunc func) override;
virtual CompFunc GetDepthTestFunc();
virtual void SetDepthBias(float factor); virtual void SetDepthBias(float factor) override;
virtual float GetDepthBias();
virtual void SetAlphaTestFunc(CompFunc func, float refValue); virtual void SetAlphaTestFunc(CompFunc func, float refValue) override;
virtual void GetAlphaTestFunc(CompFunc &func, float &refValue);
virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend); virtual void SetBlendFunc(BlendFunc srcBlend, BlendFunc dstBlend) override;
virtual void GetBlendFunc(BlendFunc &srcBlend, BlendFunc &dstBlend);
virtual void SetClearColor(const Color &color); virtual void SetClearColor(const Color &color) override;
virtual Color GetClearColor();
virtual void SetGlobalAmbient(const Color &color); virtual void SetGlobalAmbient(const Color &color) override;
virtual Color GetGlobalAmbient();
virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density); virtual void SetFogParams(FogMode mode, const Color &color, float start, float end, float density) override;
virtual void GetFogParams(FogMode &mode, Color &color, float &start, float &end, float &density);
virtual void SetCullMode(CullMode mode); virtual void SetCullMode(CullMode mode) override;
virtual CullMode GetCullMode();
virtual void SetShadeModel(ShadeModel model); virtual void SetShadeModel(ShadeModel model) override;
virtual ShadeModel GetShadeModel();
virtual void SetFillMode(FillMode mode) ; virtual void SetFillMode(FillMode mode) override;
virtual FillMode GetFillMode();
virtual void* GetFrameBufferPixels()const; virtual void* GetFrameBufferPixels() const override;
private: private:
//! Updates internal modelview matrix //! Updates internal modelview matrix

View File

@ -21,11 +21,8 @@ public:
MOCK_METHOD0(Clear, void()); MOCK_METHOD0(Clear, void());
MOCK_METHOD2(SetTransform, void(Gfx::TransformType type, const Math::Matrix &matrix)); MOCK_METHOD2(SetTransform, void(Gfx::TransformType type, const Math::Matrix &matrix));
MOCK_METHOD1(GetTransform, const Math::Matrix& (Gfx::TransformType type));
MOCK_METHOD2(MultiplyTransform, void(Gfx::TransformType type, const Math::Matrix &matrix));
MOCK_METHOD1(SetMaterial, void(const Gfx::Material &material)); MOCK_METHOD1(SetMaterial, void(const Gfx::Material &material));
MOCK_METHOD0(GetMaterial, const Gfx::Material&());
MOCK_METHOD0(GetMaxLightCount, int()); MOCK_METHOD0(GetMaxLightCount, int());
@ -33,7 +30,6 @@ public:
MOCK_METHOD1(GetLight, const Gfx::Light&(int index)); MOCK_METHOD1(GetLight, const Gfx::Light&(int index));
MOCK_METHOD2(SetLightEnabled, void(int index, bool enabled)); MOCK_METHOD2(SetLightEnabled, void(int index, bool enabled));
MOCK_METHOD1(GetLightEnabled, bool(int index));
MOCK_METHOD2(CreateTexture, Gfx::Texture(CImage *image, const Gfx::TextureCreateParams &params)); MOCK_METHOD2(CreateTexture, Gfx::Texture(CImage *image, const Gfx::TextureCreateParams &params));
MOCK_METHOD2(CreateTexture, Gfx::Texture(ImageData *data, const Gfx::TextureCreateParams &params)); MOCK_METHOD2(CreateTexture, Gfx::Texture(ImageData *data, const Gfx::TextureCreateParams &params));
@ -45,13 +41,10 @@ public:
MOCK_METHOD2(SetTexture, void(int index, const Gfx::Texture &texture)); MOCK_METHOD2(SetTexture, void(int index, const Gfx::Texture &texture));
MOCK_METHOD2(SetTexture, void(int index, unsigned int textureId)); MOCK_METHOD2(SetTexture, void(int index, unsigned int textureId));
MOCK_METHOD1(GetTexture, Gfx::Texture(int index));
MOCK_METHOD2(SetTextureEnabled, void(int index, bool enabled)); MOCK_METHOD2(SetTextureEnabled, void(int index, bool enabled));
MOCK_METHOD1(GetTextureEnabled, bool(int index));
MOCK_METHOD2(SetTextureStageParams, void(int index, const Gfx::TextureStageParams &params)); MOCK_METHOD2(SetTextureStageParams, void(int index, const Gfx::TextureStageParams &params));
MOCK_METHOD1(GetTextureStageParams, Gfx::TextureStageParams(int index));
MOCK_METHOD3(SetTextureStageWrap, void(int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT)); MOCK_METHOD3(SetTextureStageWrap, void(int index, Gfx::TexWrapMode wrapS, Gfx::TexWrapMode wrapT));
@ -77,34 +70,24 @@ public:
MOCK_METHOD1(GetRenderState, bool(Gfx::RenderState state)); MOCK_METHOD1(GetRenderState, bool(Gfx::RenderState state));
MOCK_METHOD1(SetDepthTestFunc, void(Gfx::CompFunc func)); MOCK_METHOD1(SetDepthTestFunc, void(Gfx::CompFunc func));
MOCK_METHOD0(GetDepthTestFunc, Gfx::CompFunc());
MOCK_METHOD1(SetDepthBias, void(float factor)); MOCK_METHOD1(SetDepthBias, void(float factor));
MOCK_METHOD0(GetDepthBias, float());
MOCK_METHOD2(SetAlphaTestFunc, void(Gfx::CompFunc func, float refValue)); MOCK_METHOD2(SetAlphaTestFunc, void(Gfx::CompFunc func, float refValue));
MOCK_METHOD2(GetAlphaTestFunc, void(Gfx::CompFunc &func, float &refValue));
MOCK_METHOD2(SetBlendFunc, void(Gfx::BlendFunc srcBlend, Gfx::BlendFunc dstBlend)); MOCK_METHOD2(SetBlendFunc, void(Gfx::BlendFunc srcBlend, Gfx::BlendFunc dstBlend));
MOCK_METHOD2(GetBlendFunc, void(Gfx::BlendFunc &srcBlend, Gfx::BlendFunc &dstBlend));
MOCK_METHOD1(SetClearColor, void(const Gfx::Color &color)); MOCK_METHOD1(SetClearColor, void(const Gfx::Color &color));
MOCK_METHOD0(GetClearColor, Gfx::Color());
MOCK_METHOD1(SetGlobalAmbient, void(const Gfx::Color &color)); MOCK_METHOD1(SetGlobalAmbient, void(const Gfx::Color &color));
MOCK_METHOD0(GetGlobalAmbient, Gfx::Color());
MOCK_METHOD5(SetFogParams, void(Gfx::FogMode mode, const Gfx::Color &color, float start, float end, float density)); MOCK_METHOD5(SetFogParams, void(Gfx::FogMode mode, const Gfx::Color &color, float start, float end, float density));
MOCK_METHOD5(GetFogParams, void(Gfx::FogMode &mode, Gfx::Color &color, float &start, float &end, float &density));
MOCK_METHOD1(SetCullMode, void(Gfx::CullMode mode)); MOCK_METHOD1(SetCullMode, void(Gfx::CullMode mode));
MOCK_METHOD0(GetCullMode, Gfx::CullMode());
MOCK_METHOD1(SetShadeModel, void(Gfx::ShadeModel model)); MOCK_METHOD1(SetShadeModel, void(Gfx::ShadeModel model));
MOCK_METHOD0(GetShadeModel, Gfx::ShadeModel());
MOCK_METHOD1(SetFillMode, void(Gfx::FillMode mode)); MOCK_METHOD1(SetFillMode, void(Gfx::FillMode mode));
MOCK_METHOD0(GetFillMode, Gfx::FillMode());
MOCK_CONST_METHOD0(GetFrameBufferPixels, void*()); MOCK_CONST_METHOD0(GetFrameBufferPixels, void*());
}; };