TINYGL: Added a few more information to the state stored for Rasterization draw call.

This commit is contained in:
Stefano Musumeci 2014-07-25 15:47:07 +02:00
parent a96597b0e0
commit 83e1d0a699
2 changed files with 20 additions and 0 deletions

View File

@ -173,6 +173,13 @@ RasterizationDrawCall::RasterizationState RasterizationDrawCall::loadState() con
state.texture2DEnabled = c->texture_2d_enabled;
state.texture = c->current_texture;
state.shadowMaskBuf = c->fb->shadow_mask_buf;
state.depthFunction = c->fb->getDepthFunc();
state.depthWrite = c->fb->getDepthWrite();
state.lightingEnabled = c->lighting_enabled;
memcpy(state.viewportScaling, c->viewport.scale._v, sizeof(c->viewport.scale._v));
memcpy(state.viewportTranslation, c->viewport.trans._v, sizeof(c->viewport.trans._v));
memcpy(state.currentColor, c->longcurrent_color, sizeof(c->longcurrent_color));
return state;
}
@ -184,7 +191,10 @@ void RasterizationDrawCall::applyState(const RasterizationDrawCall::Rasterizatio
c->fb->enableBlending(state.enableBlending);
c->fb->enableAlphaTest(state.alphaTest);
c->fb->setAlphaTestFunc(state.alphaFunc, state.alphaRefValue);
c->fb->setDepthFunc(state.depthFunction);
c->fb->enableDepthWrite(state.depthWrite);
c->lighting_enabled = state.lightingEnabled;
c->cull_face_enabled = state.cullFaceEnabled;
c->begin_type = state.beginType;
c->color_mask = state.colorMask;
@ -197,6 +207,10 @@ void RasterizationDrawCall::applyState(const RasterizationDrawCall::Rasterizatio
c->texture_2d_enabled = state.texture2DEnabled;
c->current_texture = state.texture;
c->fb->shadow_mask_buf = state.shadowMaskBuf;
memcpy(c->viewport.scale._v, state.viewportScaling, sizeof(c->viewport.scale._v));
memcpy(c->viewport.trans._v, state.viewportTranslation, sizeof(c->viewport.trans._v));
memcpy(c->longcurrent_color, state.currentColor, sizeof(c->longcurrent_color));
}
RasterizationDrawCall::~RasterizationDrawCall() {

View File

@ -83,13 +83,19 @@ private:
int cullFaceEnabled;
int colorMask;
int depthTest;
int depthFunction;
int depthWrite;
int shadowMode;
int texture2DEnabled;
int currentShadeModel;
int polygonModeBack;
int polygonModeFront;
int lightingEnabled;
bool enableBlending;
int sfactor, dfactor;
unsigned int currentColor[4];
float viewportTranslation[3];
float viewportScaling[3];
bool alphaTest;
int alphaFunc, alphaRefValue;
TinyGL::GLTexture *texture;