本文整理汇总了C++中Shader::GetInstances方法的典型用法代码示例。如果您正苦于以下问题:C++ Shader::GetInstances方法的具体用法?C++ Shader::GetInstances怎么用?C++ Shader::GetInstances使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shader
的用法示例。
在下文中一共展示了Shader::GetInstances方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void Graphics::Render()
{
mat_stack_->Push(camera_->GetViewMatrix());
scene_constants_.fogNear = std::max(scene_constants_.fogNear, 0.5f);
scene_constants_.fogFar = std::max(scene_constants_.fogFar, scene_constants_.fogNear + 1.0f);
Matrix4 modelToWorld;
BeginScene();
graphicsAPI->SetBlendType(BlendType::Off);
graphicsAPI->SetDepthType(DepthType::Normal);
//7 passes because reflection is great
graphicsAPI->ClearRenderTargets();
graphicsAPI->FlushDepth();
graphicsAPI->ClearShaderResources();
graphicsAPI->AddRenderTarget(back_buffer_);
graphicsAPI->SetRenderTargets();
LightingShaderParam paramList;
int count = 0;
Shader* debugShader = nullptr;
for(auto& shaderIt : shaders_)
{
Shader* shader = shaderIt.val;
if(shaderIt.key != "lines" &&
shaderIt.key != "particle")
{
Model* model = nullptr;
for(auto& modelIt : shader->GetInstances())
{
model = modelIt.first;
model->Render();
for(auto& inst : modelIt.second)
{
paramList.modelComp = inst;
paramList.shader = shader;
shader->PrepareBuffers((void*) ¶mList);
shader->Render(model->GetNumVerts());
}
}
}
else
{
debugShader = shader;
}
}
const bool drawParticles = true;
if(drawParticles)
{
//PARTICLES
auto& particleSystems = particle_manager_->GetSystems();
auto shaderIt = shaders_.find("particle");
Shader* particleShader = nullptr;
if(shaderIt != shaders_.end())
{
particleShader = (*shaderIt).val;
}
graphicsAPI->SetBlendType(BlendType::Additive);
graphicsAPI->SetDepthType(DepthType::Off);
ParticleShaderParam particleParam;
particleParam.shader = particleShader;
Model* particleModel;
for(auto& it : particleSystems)
{
for(auto& particleEmitter : it->GetEmitters())
{
particleModel = GetModel(particleEmitter->GetDescription().sourceModel);
if(particleModel)
{
particleModel->Render();
particleParam.emitter = particleEmitter;
auto& particles = particleEmitter->GetParticles();
for(auto& particleIndex : particleEmitter->GetAlive())
{
particleParam.particle = &particles[particleIndex];
particleShader->PrepareBuffers(&particleParam);
particleShader->Render(particleModel->GetNumVerts());
}
}
}
}
graphicsAPI->SetBlendType(BlendType::Off);
//.........这里部分代码省略.........