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 setShaderDataBinding(IShaderDataBinding* binding)=0;
virtual void setRenderTarget(ITextureR* target)=0; virtual void setRenderTarget(ITextureR* target)=0;
virtual void setViewport(const SWindowRect& rect)=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 * @brief Which dynamic buffer slot is being populated for pending command list
* @return Index [0,2] indicating the buffer slot * @return Index [0,2] indicating the buffer slot

View File

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

View File

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

View File

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