------------------------------------------------------------------------------
| 3002 | |
| 3003 | //------------------------------------------------------------------------------ |
| 3004 | void vtkOpenGLPolyDataMapper::SetCameraShaderParameters( |
| 3005 | vtkOpenGLHelper& cellBO, vtkRenderer* ren, vtkActor* actor) |
| 3006 | { |
| 3007 | vtkShaderProgram* program = cellBO.Program; |
| 3008 | |
| 3009 | vtkOpenGLCamera* cam = (vtkOpenGLCamera*)(ren->GetActiveCamera()); |
| 3010 | |
| 3011 | // [WMVD]C == {world, model, view, display} coordinates |
| 3012 | // E.g., WCDC == world to display coordinate transformation |
| 3013 | vtkMatrix4x4* wcdc; |
| 3014 | vtkMatrix4x4* wcvc; |
| 3015 | vtkMatrix3x3* norms; |
| 3016 | vtkMatrix4x4* vcdc; |
| 3017 | cam->GetKeyMatrices(ren, wcvc, norms, vcdc, wcdc); |
| 3018 | |
| 3019 | if (program->IsUniformUsed("ZCalcR")) |
| 3020 | { |
| 3021 | if (cam->GetParallelProjection()) |
| 3022 | { |
| 3023 | program->SetUniformf("ZCalcS", vcdc->GetElement(2, 2)); |
| 3024 | } |
| 3025 | else |
| 3026 | { |
| 3027 | program->SetUniformf("ZCalcS", -0.5 * vcdc->GetElement(2, 2) + 0.5); |
| 3028 | } |
| 3029 | if (this->DrawingSpheres(cellBO, actor)) |
| 3030 | { |
| 3031 | program->SetUniformf("ZCalcR", |
| 3032 | actor->GetProperty()->GetPointSize() / (ren->GetSize()[0] * vcdc->GetElement(0, 0))); |
| 3033 | } |
| 3034 | else |
| 3035 | { |
| 3036 | program->SetUniformf("ZCalcR", |
| 3037 | actor->GetProperty()->GetLineWidth() / (ren->GetSize()[0] * vcdc->GetElement(0, 0))); |
| 3038 | } |
| 3039 | } |
| 3040 | |
| 3041 | // handle coincident |
| 3042 | float factor = 0.0; |
| 3043 | float offset = 0.0; |
| 3044 | this->GetCoincidentParameters(ren, actor, factor, offset); |
| 3045 | if ((factor != 0.0 || offset != 0.0) && cellBO.Program->IsUniformUsed("cOffset") && |
| 3046 | cellBO.Program->IsUniformUsed("cFactor")) |
| 3047 | { |
| 3048 | cellBO.Program->SetUniformf("cOffset", offset); |
| 3049 | cellBO.Program->SetUniformf("cFactor", factor); |
| 3050 | } |
| 3051 | |
| 3052 | // If the VBO coordinates were shifted and scaled, apply the inverse transform |
| 3053 | // to the model->view matrix: |
| 3054 | vtkOpenGLVertexBufferObject* vvbo = this->VBOs->GetVBO("vertexMC"); |
| 3055 | if (vvbo && vvbo->GetCoordShiftAndScaleEnabled()) |
| 3056 | { |
| 3057 | if (!actor->GetIsIdentity()) |
| 3058 | { |
| 3059 | vtkMatrix4x4* mcwc; |
| 3060 | vtkMatrix3x3* anorms; |
| 3061 | static_cast<vtkOpenGLActor*>(actor)->GetKeyMatrices(mcwc, anorms); |
no test coverage detected