本文整理汇总了C++中JSONValue::getJSONValue方法的典型用法代码示例。如果您正苦于以下问题:C++ JSONValue::getJSONValue方法的具体用法?C++ JSONValue::getJSONValue怎么用?C++ JSONValue::getJSONValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSONValue
的用法示例。
在下文中一共展示了JSONValue::getJSONValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void RenderStage::init(const JSONValue& renderStageJSON)
{
auto renderStageRenderPassesJSON = renderStageJSON.getJSONValue("renderPasses");
if(!renderStageRenderPassesJSON.isNull())
{
for(unsigned int i = 0; i < renderStageRenderPassesJSON.getSize(); ++i)
if(!renderStageRenderPassesJSON.getJSONArrayItem(i).isNull())
renderPasses.pushBack(createRenderPassFromJson(renderStageRenderPassesJSON.getJSONArrayItem(i)));
}
}
示例2: init
void DeferredStage::init(const JSONValue& deferredgStageJSON)
{
auto gbufferRenderPassJSON = deferredgStageJSON.getJSONValue("GbufferRenderPass");
if(!gbufferRenderPassJSON.isNull())
renderPasses.pushBack(createRenderPassFromJson(gbufferRenderPassJSON));
}
示例3: createRenderPassFromJson
RenderPass RenderStage::createRenderPassFromJson(const JSONValue& renderPassJSON)
{
GraphicSystem& graphicSystem = renderer.getGraphicSystem();
RenderPass renderPass;
auto clearColorJSON = renderPassJSON.getJSONValue("clearColor");
auto colorWriteJSON = renderPassJSON.getJSONValue("colorWrite");
auto depthWriteJSON = renderPassJSON.getJSONValue("depthWrite");
auto renderTargetLayerJSON = renderPassJSON.getJSONValue("renderTargetLayer");
auto flagsJSON = renderPassJSON.getJSONValue("flags");
if(!clearColorJSON.isNull())
renderPass.clearColor = clearColorJSON.getVector4();
if(!colorWriteJSON.isNull())
renderPass.colorWrite = colorWriteJSON.getBool();
if(!depthWriteJSON.isNull())
renderPass.depthWrite = depthWriteJSON.getBool();
if(!renderTargetLayerJSON.isNull())
renderPass.renderTargetLayer = renderTargetLayerJSON.getInt();
if(!flagsJSON.isNull())
{
unsigned int flags = 0;
for(unsigned int i = 0; i < flagsJSON.getSize(); ++i)
{
if(flagsJSON.getJSONArrayItem(i).getString().compare("CLEAR_COLOR") == 0)
flags |= CLEAR_COLOR;
if(flagsJSON.getJSONArrayItem(i).getString().compare("CLEAR_DEPTH") == 0)
flags |= CLEAR_DEPTH;
}
renderPass.flags = flags;
}
auto viewPortJSON = renderPassJSON.getJSONValue("viewPort");
if(!viewPortJSON.isNull())
{
FixedArray<int, 4> viewPort = viewPortJSON.getInt4();
renderPass.viewPort.set(viewPort[0], viewPort[1], viewPort[2], viewPort[3]);
}
else
renderPass.viewPort = renderer.getScreenViewPort();
auto renderTargetJSON = renderPassJSON.getJSONValue("renderTarget");
renderPass.renderTarget = graphicSystem.createRenderTarget(renderTargetJSON);
auto shaderPasses = renderPassJSON.getJSONValue("shaderPasses");
if(!shaderPasses.isNull())
{
for(unsigned int i = 0; i < shaderPasses.getSize(); ++i)
{
auto shaderPassJSON = shaderPasses.getJSONArrayItem(i);
auto programJSON = shaderPassJSON.getJSONValue("shaderProgram");
auto vertexDataJSON = shaderPassJSON.getJSONValue("vertexData");
auto rasterStateJSON = shaderPassJSON.getJSONValue("rasterState");
auto shaderParameterBlocksJSON = shaderPassJSON.getJSONValue("shaderParameterBlocks");
auto texturesJSON = shaderPassJSON.getJSONValue("textures");
ShaderPass shaderPass;
if(!vertexDataJSON.isNull())
{
if(vertexDataJSON.getString().compare("fullScreenQuad") == 0)
shaderPass.vertexData = renderer.getFullScreenQuad();
}
if(!rasterStateJSON.isNull())
{
auto blendFunctionJSON = rasterStateJSON.getJSONValue("blendFunction");
auto compareFunctionJSON = rasterStateJSON.getJSONValue("compareFunction");
auto cullFaceJSON = rasterStateJSON.getJSONValue("cullFace");
auto blendState = !blendFunctionJSON.isNull() ? BlendState(true, enumFromString<BlendFunction>(blendFunctionJSON.getString())) : BlendState(false, BlendFunction::Replace);
auto compareState = !compareFunctionJSON.isNull() ? CompareState(true, enumFromString<CompareFunction>(compareFunctionJSON.getString())) : CompareState(false, CompareFunction::Never);
auto cullState = !cullFaceJSON.isNull() ? CullState(true, enumFromString<CullFace>(cullFaceJSON.getString())) : CullState(false, CullFace::Back);
shaderPass.rasterState = RasterState(blendState, compareState, cullState);
}
if(!shaderParameterBlocksJSON.isNull())
{
for(unsigned int j = 0; j < shaderParameterBlocksJSON.getSize(); ++j)
{
ShaderParameterBlock* block = graphicSystem.createShaderParameterBlock(shaderParameterBlocksJSON.getJSONArrayItem(j));
if(block)
shaderPass.shaderParameterBlocks.pushBack(block);
}
}
if(!texturesJSON.isNull())
{
for(unsigned int j = 0; j < texturesJSON.getSize(); ++j)
{
Texture* texture = graphicSystem.createTexture(texturesJSON.getJSONArrayItem(j));
if(texture)
shaderPass.textures.pushBack(texture);
}
}
if(!programJSON.isNull())
shaderPass.program = graphicSystem.createShaderProgram(programJSON);
renderPass.shaderPasses.pushBack(shaderPass);
}
}
return renderPass;
//.........这里部分代码省略.........