Implemented TFlags for easy, type-safe bitflags

This commit is contained in:
parax0
2016-01-05 11:50:10 -07:00
parent ee5d5fae0a
commit 5375f34c19
63 changed files with 207 additions and 329 deletions

View File

@@ -82,14 +82,14 @@ void CModel::ClearGLBuffer()
mBuffered = false;
}
void CModel::Draw(ERenderOptions Options, u32 MatSet)
void CModel::Draw(FRenderOptions Options, u32 MatSet)
{
if (!mBuffered) BufferGL();
for (u32 iSurf = 0; iSurf < mSurfaces.size(); iSurf++)
DrawSurface(Options, iSurf, MatSet);
}
void CModel::DrawSurface(ERenderOptions Options, u32 Surface, u32 MatSet)
void CModel::DrawSurface(FRenderOptions Options, u32 Surface, u32 MatSet)
{
if (!mBuffered) BufferGL();
@@ -122,7 +122,7 @@ void CModel::DrawSurface(ERenderOptions Options, u32 Surface, u32 MatSet)
mVBO.Unbind();
}
void CModel::DrawWireframe(ERenderOptions Options, CColor WireColor /*= CColor::skWhite*/)
void CModel::DrawWireframe(FRenderOptions Options, CColor WireColor /*= CColor::skWhite*/)
{
if (!mBuffered) BufferGL();

View File

@@ -6,7 +6,7 @@
#include "Core/Resource/CMaterialSet.h"
#include "Core/OpenGL/CIndexBuffer.h"
#include "Core/OpenGL/GLCommon.h"
#include "Core/Render/ERenderOptions.h"
#include "Core/Render/FRenderOptions.h"
class CModel : public CBasicModel
{
@@ -24,9 +24,9 @@ public:
void BufferGL();
void ClearGLBuffer();
void Draw(ERenderOptions Options, u32 MatSet);
void DrawSurface(ERenderOptions Options, u32 Surface, u32 MatSet);
void DrawWireframe(ERenderOptions Options, CColor WireColor = CColor::skWhite);
void Draw(FRenderOptions Options, u32 MatSet);
void DrawSurface(FRenderOptions Options, u32 Surface, u32 MatSet);
void DrawWireframe(FRenderOptions Options, CColor WireColor = CColor::skWhite);
u32 GetMatSetCount();
u32 GetMatCount();

View File

@@ -97,7 +97,7 @@ void CStaticModel::ClearGLBuffer()
mBuffered = false;
}
void CStaticModel::Draw(ERenderOptions Options)
void CStaticModel::Draw(FRenderOptions Options)
{
if (!mBuffered) BufferGL();
@@ -119,7 +119,7 @@ void CStaticModel::Draw(ERenderOptions Options)
mVBO.Unbind();
}
void CStaticModel::DrawSurface(ERenderOptions Options, u32 Surface)
void CStaticModel::DrawSurface(FRenderOptions Options, u32 Surface)
{
if (!mBuffered) BufferGL();
@@ -144,7 +144,7 @@ void CStaticModel::DrawSurface(ERenderOptions Options, u32 Surface)
mVBO.Unbind();
}
void CStaticModel::DrawWireframe(ERenderOptions Options, CColor WireColor /*= CColor::skWhite*/)
void CStaticModel::DrawWireframe(FRenderOptions Options, CColor WireColor /*= CColor::skWhite*/)
{
if (!mBuffered) BufferGL();

View File

@@ -2,7 +2,7 @@
#define CSTATICMODEL_H
#include "CBasicModel.h"
#include "Core/Render/ERenderOptions.h"
#include "Core/Render/FRenderOptions.h"
#include "Core/OpenGL/CIndexBuffer.h"
/* A CStaticModel is meant for meshes that don't move. It's built specifically with terrain in mind.
@@ -23,9 +23,9 @@ public:
void BufferGL();
void ClearGLBuffer();
void Draw(ERenderOptions Options);
void DrawSurface(ERenderOptions Options, u32 Surface);
void DrawWireframe(ERenderOptions Options, CColor WireColor = CColor::skWhite);
void Draw(FRenderOptions Options);
void DrawSurface(FRenderOptions Options, u32 Surface);
void DrawWireframe(FRenderOptions Options, CColor WireColor = CColor::skWhite);
CMaterial* GetMaterial();
void SetMaterial(CMaterial *pMat);

View File

@@ -1,9 +1,9 @@
#ifndef EVERTEXDESCRIPTION
#define EVERTEXDESCRIPTION
#ifndef EVERTEXATTRIBUTE
#define EVERTEXATTRIBUTE
#include <Common/EnumUtil.h>
#include <Common/Flags.h>
enum EVertexDescription
enum EVertexAttribute
{
eNoAttributes = 0x0,
ePosition = 0x3,
@@ -27,7 +27,7 @@ enum EVertexDescription
eTex5Mtx = 0x40000000,
eTex6Mtx = 0x80000000
};
DEFINE_ENUM_FLAGS(EVertexDescription)
DECLARE_FLAGS(EVertexAttribute, FVertexDescription)
#endif // EVERTEXDESCRIPTION
#endif // EVERTEXATTRIBUTE