void RenderState::StateBlock::setState(const char* name, const char* value) { GP_ASSERT(name); if (strcmp(name, "blend") == 0) { setBlend(parseBoolean(value)); } else if (strcmp(name, "blendSrc") == 0 || strcmp(name, "srcBlend") == 0 ) // Leaving srcBlend for backward compat. { setBlendSrc(parseBlend(value)); } else if (strcmp(name, "blendDst") == 0 || strcmp(name, "dstBlend") == 0) // // Leaving dstBlend for backward compat. { setBlendDst(parseBlend(value)); } else if (strcmp(name, "cullFace") == 0) { setCullFace(parseBoolean(value)); } else if (strcmp(name, "depthTest") == 0) { setDepthTest(parseBoolean(value)); } else if (strcmp(name, "depthWrite") == 0) { setDepthWrite(parseBoolean(value)); } else { GP_ERROR("Unsupported render state string '%s'.", name); } }
void RenderState::StateBlock::setState(const std::string& name, const std::string& value) { if (name.compare("blend") == 0) { setBlend(parseBoolean(value)); } else if (name.compare("blendSrc") == 0) { setBlendSrc(parseBlend(value)); } else if (name.compare("blendDst") == 0) { setBlendDst(parseBlend(value)); } else if (name.compare("cullFace") == 0) { setCullFace(parseBoolean(value)); } else if (name.compare("cullFaceSide") == 0) { setCullFaceSide(parseCullFaceSide(value)); } else if (name.compare("frontFace") == 0) { setFrontFace(parseFrontFace(value)); } else if (name.compare("depthTest") == 0) { setDepthTest(parseBoolean(value)); } else if (name.compare("depthWrite") == 0) { setDepthWrite(parseBoolean(value)); } else if (name.compare("depthFunc") == 0) { setDepthFunction(parseDepthFunc(value)); } else if (name.compare("stencilTest") == 0) { setStencilTest(parseBoolean(value)); } else if (name.compare("stencilWrite") == 0) { setStencilWrite(parseUInt(value)); } else if (name.compare("stencilFunc") == 0) { setStencilFunction(parseStencilFunc(value), _stencilFunctionRef, _stencilFunctionMask); } else if (name.compare("stencilFuncRef") == 0) { setStencilFunction(_stencilFunction, parseInt(value), _stencilFunctionMask); } else if (name.compare("stencilFuncMask") == 0) { setStencilFunction(_stencilFunction, _stencilFunctionRef, parseUInt(value)); } else if (name.compare("stencilOpSfail") == 0) { setStencilOperation(parseStencilOp(value), _stencilOpDpfail, _stencilOpDppass); } else if (name.compare("stencilOpDpfail") == 0) { setStencilOperation(_stencilOpSfail, parseStencilOp(value), _stencilOpDppass); } else if (name.compare("stencilOpDppass") == 0) { setStencilOperation(_stencilOpSfail, _stencilOpDpfail, parseStencilOp(value)); } else { CCLOG("Unsupported render state string '%s'.", name.c_str()); } }
void RenderState::StateBlock::setBlendFunc(const BlendFunc& blendFunc) { setBlendSrc((RenderState::Blend)blendFunc.src); setBlendDst((RenderState::Blend)blendFunc.dst); }
void StateBlock::setBlendFunc(const BlendFunc& blendFunc) { setBlendSrc((Blend)blendFunc.src); setBlendDst((Blend)blendFunc.dst); }