More vertex semantic adjustments

This commit is contained in:
Jack Andersen 2015-11-25 14:22:05 -10:00
parent 3bcfa99b5a
commit 6c83991e2a
4 changed files with 40 additions and 6 deletions

View File

@ -23,7 +23,8 @@ struct IGraphicsCommandQueue
virtual void setShaderDataBinding(IShaderDataBinding* binding)=0;
virtual void setRenderTarget(ITextureR* target)=0;
virtual void setViewport(const SWindowRect& rect)=0;
virtual void setScissor(const SWindowRect& rect)=0;
/**
* @brief Which dynamic buffer slot is being populated for pending command list
* @return Index [0,2] indicating the buffer slot

View File

@ -101,10 +101,13 @@ struct IVertexFormat {};
enum class VertexSemantic
{
None = 0,
Position,
Normal,
Position3,
Position4,
Normal3,
Normal4,
Color,
UV,
ColorUNorm,
UV2,
UV4,
Weight,
ModelView,

View File

@ -554,10 +554,14 @@ static const GLint SEMANTIC_COUNT_TABLE[] =
{
0,
3,
4,
3,
4,
4,
4,
2,
4,
4,
4
};
@ -565,10 +569,14 @@ static const size_t SEMANTIC_SIZE_TABLE[] =
{
0,
12,
16,
12,
16,
16,
4,
8,
16,
16,
16
};
@ -577,9 +585,13 @@ static const GLenum SEMANTIC_TYPE_TABLE[] =
GL_INVALID_ENUM,
GL_FLOAT,
GL_FLOAT,
GL_FLOAT,
GL_FLOAT,
GL_FLOAT,
GL_UNSIGNED_BYTE,
GL_FLOAT,
GL_FLOAT,
GL_FLOAT,
GL_FLOAT
};
@ -596,6 +608,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
SetShaderDataBinding,
SetRenderTarget,
SetViewport,
SetScissor,
SetClearColor,
ClearTarget,
SetDrawPrimitive,
@ -791,6 +804,16 @@ struct GLCommandQueue : IGraphicsCommandQueue
glViewport(cmd.rect.location[0], cmd.rect.location[1],
cmd.rect.size[0], cmd.rect.size[1]);
break;
case Command::Op::SetScissor:
if (cmd.rect.size[0] == 0 && cmd.rect.size[1] == 0)
glDisable(GL_SCISSOR_TEST);
else
{
glEnable(GL_SCISSOR_TEST);
glScissor(cmd.rect.location[0], cmd.rect.location[1],
cmd.rect.size[0], cmd.rect.size[1]);
}
break;
case Command::Op::SetClearColor:
glClearColor(cmd.rgba[0], cmd.rgba[1], cmd.rgba[2], cmd.rgba[3]);
break;
@ -868,6 +891,13 @@ struct GLCommandQueue : IGraphicsCommandQueue
cmds.emplace_back(Command::Op::SetViewport);
cmds.back().rect = rect;
}
void setScissor(const SWindowRect& rect)
{
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
cmds.emplace_back(Command::Op::SetScissor);
cmds.back().rect = rect;
}
int pendingDynamicSlot()
{

View File

@ -256,8 +256,8 @@ struct TestApplicationCallback : IApplicationCallback
/* Make vertex format */
VertexElementDescriptor descs[2] =
{
{vbo, nullptr, VertexSemantic::Position},
{vbo, nullptr, VertexSemantic::UV}
{vbo, nullptr, VertexSemantic::Position3},
{vbo, nullptr, VertexSemantic::UV2}
};
IVertexFormat* vfmt = factory->newVertexFormat(2, descs);