| 43 | } |
| 44 | |
| 45 | void LODPreviewMaterialShader::Bind(BindParameters& params) |
| 46 | { |
| 47 | // Find the LOD that produced this draw call |
| 48 | int32 lodIndex = 0; |
| 49 | auto& drawCall = *params.DrawCall; |
| 50 | const ModelLOD* drawCallModelLod; |
| 51 | if (GBufferPass::IndexBufferToModelLOD.TryGet(drawCall.Geometry.IndexBuffer, drawCallModelLod)) |
| 52 | { |
| 53 | lodIndex = drawCallModelLod->GetLODIndex(); |
| 54 | } |
| 55 | |
| 56 | // Bind |
| 57 | const Color colors[MODEL_MAX_LODS] = { |
| 58 | Color::White, |
| 59 | Color::Red, |
| 60 | Color::Orange, |
| 61 | Color::Yellow, |
| 62 | Color::Green, |
| 63 | Color::Blue, |
| 64 | }; |
| 65 | const Color color(colors[lodIndex]); |
| 66 | _material->SetParameterValue(TEXT("Color"), Variant(color)); |
| 67 | _material->Bind(params); |
| 68 | } |
| 69 | |
| 70 | #endif |
no test coverage detected