| 484 | */ |
| 485 | |
| 486 | void DepthRenderTechnique::DrawOpaqueModels(const SceneData& sceneData, ForwardRenderQueue::Layer& layer) const |
| 487 | { |
| 488 | const Shader* lastShader = nullptr; |
| 489 | const ShaderUniforms* shaderUniforms = nullptr; |
| 490 | |
| 491 | for (auto& pipelinePair : layer.opaqueModels) |
| 492 | { |
| 493 | const MaterialPipeline* pipeline = pipelinePair.first; |
| 494 | auto& pipelineEntry = pipelinePair.second; |
| 495 | |
| 496 | if (pipelineEntry.maxInstanceCount > 0) |
| 497 | { |
| 498 | bool instancing = (pipelineEntry.maxInstanceCount > NAZARA_GRAPHICS_INSTANCING_MIN_INSTANCES_COUNT); |
| 499 | const MaterialPipeline::Instance& pipelineInstance = pipeline->Apply((instancing) ? ShaderFlags_Instancing : 0); |
| 500 | |
| 501 | const Shader* shader = pipelineInstance.uberInstance->GetShader(); |
| 502 | |
| 503 | // Uniforms are conserved in our program, there's no point to send them back until they change |
| 504 | if (shader != lastShader) |
| 505 | { |
| 506 | // Index of uniforms in the shader |
| 507 | shaderUniforms = GetShaderUniforms(shader); |
| 508 | |
| 509 | // Ambiant color of the scene |
| 510 | shader->SendColor(shaderUniforms->sceneAmbient, sceneData.ambientColor); |
| 511 | |
| 512 | lastShader = shader; |
| 513 | } |
| 514 | |
| 515 | for (auto& materialPair : pipelineEntry.materialMap) |
| 516 | { |
| 517 | const Material* material = materialPair.first; |
| 518 | auto& matEntry = materialPair.second; |
| 519 | |
| 520 | if (matEntry.enabled) |
| 521 | { |
| 522 | material->Apply(pipelineInstance); |
| 523 | |
| 524 | ForwardRenderQueue::MeshInstanceContainer& meshInstances = matEntry.meshMap; |
| 525 | |
| 526 | // Meshes |
| 527 | for (auto& meshIt : meshInstances) |
| 528 | { |
| 529 | const MeshData& meshData = meshIt.first; |
| 530 | auto& meshEntry = meshIt.second; |
| 531 | |
| 532 | std::vector<Matrix4f>& instances = meshEntry.instances; |
| 533 | if (!instances.empty()) |
| 534 | { |
| 535 | const IndexBuffer* indexBuffer = meshData.indexBuffer; |
| 536 | const VertexBuffer* vertexBuffer = meshData.vertexBuffer; |
| 537 | |
| 538 | // Handle draw call before rendering loop |
| 539 | Renderer::DrawCall drawFunc; |
| 540 | Renderer::DrawCallInstanced instancedDrawFunc; |
| 541 | unsigned int indexCount; |
| 542 | |
| 543 | if (indexBuffer) |
nothing calls this directly
no test coverage detected