------------------------------------------------------------------------------
| 2377 | |
| 2378 | //------------------------------------------------------------------------------ |
| 2379 | void vtkOpenGLPolyDataMapper::ReplaceShaderPositionVC( |
| 2380 | std::map<vtkShader::Type, vtkShader*> shaders, vtkRenderer*, vtkActor* actor) |
| 2381 | { |
| 2382 | std::string VSSource = shaders[vtkShader::Vertex]->GetSource(); |
| 2383 | std::string GSSource = shaders[vtkShader::Geometry]->GetSource(); |
| 2384 | std::string FSSource = shaders[vtkShader::Fragment]->GetSource(); |
| 2385 | |
| 2386 | vtkShaderProgram::Substitute( |
| 2387 | FSSource, "//VTK::Camera::Dec", "uniform int cameraParallel;\n", false); |
| 2388 | |
| 2389 | // do we need the vertex in the shader in View Coordinates |
| 2390 | bool isLightingUsed = |
| 2391 | this->PrimitiveInfo[this->LastBoundBO].LastLightComplexity != primitiveInfo::NoLighting; |
| 2392 | if (isLightingUsed || this->DrawingTubes(*this->LastBoundBO, actor)) |
| 2393 | { |
| 2394 | vtkShaderProgram::Substitute(VSSource, "//VTK::PositionVC::Dec", "out vec4 vertexVCVSOutput;"); |
| 2395 | vtkShaderProgram::Substitute(VSSource, "//VTK::PositionVC::Impl", |
| 2396 | "vertexVCVSOutput = MCVCMatrix * vertexMC;\n" |
| 2397 | " gl_Position = MCDCMatrix * vertexMC;\n"); |
| 2398 | vtkShaderProgram::Substitute(VSSource, "//VTK::Camera::Dec", |
| 2399 | "uniform mat4 MCDCMatrix;\n" |
| 2400 | "uniform mat4 MCVCMatrix;"); |
| 2401 | vtkShaderProgram::Substitute(GSSource, "//VTK::PositionVC::Dec", |
| 2402 | "in vec4 vertexVCVSOutput[];\n" |
| 2403 | "out vec4 vertexVCGSOutput;"); |
| 2404 | vtkShaderProgram::Substitute( |
| 2405 | GSSource, "//VTK::PositionVC::Impl", "vertexVCGSOutput = vertexVCVSOutput[i];"); |
| 2406 | vtkShaderProgram::Substitute(FSSource, "//VTK::PositionVC::Dec", "in vec4 vertexVCVSOutput;"); |
| 2407 | vtkShaderProgram::Substitute( |
| 2408 | FSSource, "//VTK::PositionVC::Impl", "vec4 vertexVC = vertexVCVSOutput;"); |
| 2409 | } |
| 2410 | else |
| 2411 | { |
| 2412 | vtkShaderProgram::Substitute(VSSource, "//VTK::Camera::Dec", "uniform mat4 MCDCMatrix;"); |
| 2413 | vtkShaderProgram::Substitute( |
| 2414 | VSSource, "//VTK::PositionVC::Impl", " gl_Position = MCDCMatrix * vertexMC;\n"); |
| 2415 | } |
| 2416 | shaders[vtkShader::Vertex]->SetSource(VSSource); |
| 2417 | shaders[vtkShader::Geometry]->SetSource(GSSource); |
| 2418 | shaders[vtkShader::Fragment]->SetSource(FSSource); |
| 2419 | } |
| 2420 | |
| 2421 | //------------------------------------------------------------------------------ |
| 2422 | void vtkOpenGLPolyDataMapper::ReplaceShaderPrimID( |
no test coverage detected