Commit 761a2898 authored by Aashish Chaudhary's avatar Aashish Chaudhary

Fixing variable names

Change-Id: Idf654e3155aea3785b76a92484c199559ddb1566
parent 85240e2f
......@@ -25,8 +25,8 @@
//////////////////////////////////////////////////////////////////////////////
/// 3D texture coordinates form vertex shader
varying vec3 m_texture_coords;
varying vec3 m_vertex_pos;
varying vec3 ip_textureCoords;
varying vec3 ip_vertexPos;
//////////////////////////////////////////////////////////////////////////////
///
......@@ -34,15 +34,17 @@ varying vec3 m_vertex_pos;
///
//////////////////////////////////////////////////////////////////////////////
vec4 g_frag_color;
vec4 g_fragColor;
//////////////////////////////////////////////////////////////////////////////
///
/// Uniforms, attributes, and globals
///
//////////////////////////////////////////////////////////////////////////////
vec3 g_data_pos;
vec3 g_dir_step;
vec3 g_dataPos;
vec3 g_dirStep;
vec4 g_srcColor;
vec4 g_eyePosObj;
//VTK::Base::Dec
//VTK::Termination::Dec
......@@ -61,7 +63,7 @@ vec3 g_dir_step;
/// We support only 8 clipping planes for now
/// The first value is the size of the data array for clipping
/// planes (origin, normal)
uniform float m_clipping_planes[49];
uniform float in_clippingPlanes[49];
//////////////////////////////////////////////////////////////////////////////
///
......@@ -70,9 +72,9 @@ uniform float m_clipping_planes[49];
//////////////////////////////////////////////////////////////////////////////
void main()
{
/// Initialize g_frag_color (output) to 0
g_frag_color = vec4(0.0);
g_dir_step = vec3(0.0);
/// Initialize g_fragColor (output) to 0
g_fragColor = vec4(0.0);
g_dirStep = vec3(0.0);
//VTK::Base::Init
//VTK::Terminate::Init
......@@ -91,8 +93,8 @@ void main()
//VTK::CompositeMask::Impl
//VTK::Shading::Impl
/// Advance ray by m_dir_step
g_data_pos += g_dir_step;
/// Advance ray
g_dataPos += g_dirStep;
}
//VTK::Base::Exit
......@@ -101,5 +103,5 @@ void main()
//VTK::Clipping::Exit
//VTK::Shading::Exit
gl_FragColor = g_frag_color;
gl_FragColor = g_fragColor;
}
......@@ -36,7 +36,7 @@
/// Inputs
///
//////////////////////////////////////////////////////////////////////////////
attribute vec3 m_in_vertex_pos;
attribute vec3 in_vertexPos;
//////////////////////////////////////////////////////////////////////////////
///
......@@ -44,8 +44,8 @@ attribute vec3 m_in_vertex_pos;
///
//////////////////////////////////////////////////////////////////////////////
/// 3D texture coordinates for texture lookup in the fragment shader
varying vec3 m_texture_coords;
varying vec3 m_vertex_pos;
varying vec3 ip_textureCoords;
varying vec3 ip_vertexPos;
void main()
{
......@@ -56,5 +56,5 @@ void main()
//VTK::ComputeTextureCoords::Impl
/// Copy incoming vertex position for the fragment shader
m_vertex_pos = m_in_vertex_pos;
ip_vertexPos = in_vertexPos;
}
......@@ -845,7 +845,7 @@ int vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateOpacityTransferFunction(
{
if (!vol)
{
std::cerr << "Invalid m_volume" << std::endl;
std::cerr << "Invalid in_volume" << std::endl;
return 1;
}
......@@ -1026,7 +1026,7 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateLightingParameters(
return;
}
this->ShaderProgram->SetUniformi("m_twoSidedLighting",
this->ShaderProgram->SetUniformi("in_twoSidedLighting",
ren->GetTwoSidedLighting());
if (this->LightComplexity < 2)
......@@ -1071,9 +1071,9 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateLightingParameters(
}
}
this->ShaderProgram->SetUniform3fv("m_lightColor", numberOfLights, lightColor);
this->ShaderProgram->SetUniform3fv("m_lightDirection", numberOfLights, lightDirection);
this->ShaderProgram->SetUniformi("m_numberOfLights", numberOfLights);
this->ShaderProgram->SetUniform3fv("in_lightColor", numberOfLights, lightColor);
this->ShaderProgram->SetUniform3fv("in_lightDirection", numberOfLights, lightDirection);
this->ShaderProgram->SetUniformi("in_numberOfLights", numberOfLights);
// we are done unless we have positional lights
if (this->LightComplexity < 3)
......@@ -1109,11 +1109,11 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateLightingParameters(
numberOfLights++;
}
}
this->ShaderProgram->SetUniform3fv("m_lightAttenuation", numberOfLights, lightAttenuation);
this->ShaderProgram->SetUniform1iv("m_lightPositional", numberOfLights, lightPositional);
this->ShaderProgram->SetUniform3fv("m_lightPosition", numberOfLights, lightPosition);
this->ShaderProgram->SetUniform1fv("m_lightExponent", numberOfLights, lightExponent);
this->ShaderProgram->SetUniform1fv("m_lightConeAngle", numberOfLights, lightConeAngle);
this->ShaderProgram->SetUniform3fv("in_lightAttenuation", numberOfLights, lightAttenuation);
this->ShaderProgram->SetUniform1iv("in_lightPositional", numberOfLights, lightPositional);
this->ShaderProgram->SetUniform3fv("in_lightPosition", numberOfLights, lightPosition);
this->ShaderProgram->SetUniform1fv("in_lightExponent", numberOfLights, lightExponent);
this->ShaderProgram->SetUniform1fv("in_lightConeAngle", numberOfLights, lightConeAngle);
}
//----------------------------------------------------------------------------
......@@ -1349,8 +1349,8 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateVolumeGeometry(
points->GetData()->GetDataTypeSize(),
points->GetData()->GetVoidPointer(0), GL_STATIC_DRAW);
this->ShaderProgram->EnableAttributeArray("m_in_vertex_pos");
this->ShaderProgram->UseAttributeArray("m_in_vertex_pos", 0, 0, VTK_FLOAT,
this->ShaderProgram->EnableAttributeArray("in_vertexPos");
this->ShaderProgram->UseAttributeArray("in_vertexPos", 0, 0, VTK_FLOAT,
3, vtkShaderProgram::NoNormalize);
glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, this->CubeIndicesId);
......@@ -1364,8 +1364,8 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateVolumeGeometry(
glBindVertexArray(this->CubeVAOId);
#else
glBindBuffer (GL_ARRAY_BUFFER, this->CubeVBOId);
this->ShaderProgram->EnableAttributeArray("m_in_vertex_pos");
this->ShaderProgram->UseAttributeArray("m_in_vertex_pos", 0, 0, VTK_FLOAT,
this->ShaderProgram->EnableAttributeArray("in_vertexPos");
this->ShaderProgram->UseAttributeArray("in_vertexPos", 0, 0, VTK_FLOAT,
3, vtkShaderProgram::NoNormalize);
glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, this->CubeIndicesId);
#endif
......@@ -1472,7 +1472,7 @@ void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::UpdateClipping(
clippingPlanes[0] = clippingPlanes.size() > 0 ?
(clippingPlanes.size() - 1) : 0;
this->ShaderProgram->SetUniform1fv("m_clipping_planes",
this->ShaderProgram->SetUniform1fv("in_clippingPlanes",
static_cast<int>(clippingPlanes.size()),
&clippingPlanes[0]);
}
......@@ -1945,7 +1945,7 @@ void vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer* ren,
// Make sure the context is current
ren->GetRenderWindow()->MakeCurrent();
// Update m_volume first to make sure states are current
// Update in_volume first to make sure states are current
vol->Update();
vtkImageData* input = this->GetTransformedInput();
......@@ -2073,7 +2073,7 @@ void vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer* ren,
this->Impl->UpdateNoiseTexture();
// Grab depth sampler buffer (to handle cases when we are rendering geometry
// and m_volume together
// and in_volume together
this->Impl->UpdateDepthTexture(ren, vol);
// Update lighting parameters
......@@ -2114,63 +2114,63 @@ void vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer* ren,
ren->GetActiveCamera()->GetDirectionOfProjection(dir);
vtkInternal::ToFloat(dir[0], dir[1], dir[2], fvalue3);
this->Impl->ShaderProgram->SetUniform3fv(
"m_projection_direction", 1, &fvalue3);
"in_projectionDirection", 1, &fvalue3);
}
// Pass constant uniforms at initialization
// Step should be dependant on the bounds and not on the texture size
// since we can have non uniform voxel size / spacing / aspect ratio
vtkInternal::ToFloat(this->Impl->CellStep, fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("m_cell_step", 1, &fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("in_cellStep", 1, &fvalue3);
vtkInternal::ToFloat(this->Impl->CellScale, fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("m_cell_scale", 1, &fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("in_cellScale", 1, &fvalue3);
vtkInternal::ToFloat(this->Impl->CellSpacing, fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("m_cell_spacing", 1, &fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("in_cellSpacing", 1, &fvalue3);
this->Impl->ShaderProgram->SetUniformf("m_sample_distance",
this->Impl->ShaderProgram->SetUniformf("in_sampleDistance",
this->Impl->ActualSampleDistance);
vtkInternal::ToFloat(this->Impl->ScalarsRange, fvalue2);
this->Impl->ShaderProgram->SetUniform2fv("m_scalars_range", 1, &fvalue2);
this->Impl->ShaderProgram->SetUniform2fv("in_scalarsRange", 1, &fvalue2);
this->Impl->ShaderProgram->SetUniformi("m_volume", 0);
this->Impl->ShaderProgram->SetUniformi("m_opacity_transfer_func", 2);
this->Impl->ShaderProgram->SetUniformi("m_noise_sampler", 3);
this->Impl->ShaderProgram->SetUniformi("m_depth_sampler", 4);
this->Impl->ShaderProgram->SetUniformi("m_gradient_transfer_func", 5);
this->Impl->ShaderProgram->SetUniformi("in_volume", 0);
this->Impl->ShaderProgram->SetUniformi("in_opacityTransferFunc", 2);
this->Impl->ShaderProgram->SetUniformi("in_noiseSampler", 3);
this->Impl->ShaderProgram->SetUniformi("in_depthSampler", 4);
this->Impl->ShaderProgram->SetUniformi("in_gradientTransferFunc", 5);
if (this->Impl->CurrentMask)
{
this->Impl->ShaderProgram->SetUniformi("m_mask", 6);
this->Impl->ShaderProgram->SetUniformi("in_mask", 6);
}
if(numberOfScalarComponents == 1 &&
this->BlendMode!=vtkGPUVolumeRayCastMapper::ADDITIVE_BLEND)
{
this->Impl->ShaderProgram->SetUniformi("m_color_transfer_func", 1);
this->Impl->ShaderProgram->SetUniformi("in_colorTransferFunc", 1);
if (this->MaskInput != 0 && this->MaskType == LabelMapMaskType)
{
this->Impl->ShaderProgram->SetUniformi("m_mask_1", 7);
this->Impl->ShaderProgram->SetUniformi("m_mask_2", 8);
this->Impl->ShaderProgram->SetUniformf("m_mask_blendfactor",
this->Impl->ShaderProgram->SetUniformi("in_mask1", 7);
this->Impl->ShaderProgram->SetUniformi("in_mask2", 8);
this->Impl->ShaderProgram->SetUniformf("in_maskBlendFactor",
this->MaskBlendFactor);
}
}
fvalue3[0] = fvalue3[1] = fvalue3[2] = vol->GetProperty()->GetAmbient();
this->Impl->ShaderProgram->SetUniform3f("m_ambient", fvalue3);
this->Impl->ShaderProgram->SetUniform3f("in_ambient", fvalue3);
fvalue3[0] = fvalue3[1] = fvalue3[2] = vol->GetProperty()->GetDiffuse();
this->Impl->ShaderProgram->SetUniform3f("m_diffuse", fvalue3);
this->Impl->ShaderProgram->SetUniform3f("in_diffuce", fvalue3);
fvalue3[0] = fvalue3[1] = fvalue3[2] = vol->GetProperty()->GetSpecular();
this->Impl->ShaderProgram->SetUniform3f("m_specular", fvalue3);
this->Impl->ShaderProgram->SetUniform3f("in_specular", fvalue3);
fvalue3[0] = vol->GetProperty()->GetSpecularPower();
this->Impl->ShaderProgram->SetUniformf("m_shininess", fvalue3[0]);
this->Impl->ShaderProgram->SetUniformf("in_shininess", fvalue3[0]);
// Bind textures
// Volume texture is at unit 0
......@@ -2216,12 +2216,12 @@ void vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer* ren,
this->Impl->InverseProjectionMat->Invert();
vtkInternal::VtkToGlMatrix(projectionMat4x4, fvalue16);
this->Impl->ShaderProgram->SetUniformMatrix4x4(
"m_projection_matrix", &(fvalue16[0]));
"in_projectionMatrix", &(fvalue16[0]));
vtkInternal::VtkToGlMatrix(this->Impl->InverseProjectionMat.GetPointer(),
fvalue16);
this->Impl->ShaderProgram->SetUniformMatrix4x4(
"m_inverse_projection_matrix", &(fvalue16[0]));
"in_inverseProjectionMatrix", &(fvalue16[0]));
// Will require transpose of this matrix for OpenGL
vtkMatrix4x4* modelviewMat4x4 =
......@@ -2231,12 +2231,12 @@ void vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer* ren,
vtkInternal::VtkToGlMatrix(modelviewMat4x4, fvalue16);
this->Impl->ShaderProgram->SetUniformMatrix4x4(
"m_modelview_matrix", &(fvalue16[0]));
"in_modelViewMatrix", &(fvalue16[0]));
vtkInternal::VtkToGlMatrix(this->Impl->InverseModelViewMat.GetPointer(),
fvalue16);
this->Impl->ShaderProgram->SetUniformMatrix4x4(
"m_inverse_modelview_matrix", &(fvalue16[0]));
"in_inverseModelViewMatrix", &(fvalue16[0]));
// Will require transpose of this matrix for OpenGL
// Scene matrix
......@@ -2246,12 +2246,12 @@ void vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer* ren,
vtkInternal::VtkToGlMatrix(volumeMatrix4x4, fvalue16);
this->Impl->ShaderProgram->SetUniformMatrix4x4(
"m_volume_matrix", &(fvalue16[0]));
"in_volumeMatrix", &(fvalue16[0]));
vtkInternal::VtkToGlMatrix(this->Impl->InverseVolumeMat.GetPointer(),
fvalue16);
this->Impl->ShaderProgram->SetUniformMatrix4x4(
"m_inverse_volume_matrix", &(fvalue16[0]));
"in_inverseVolumeMatrix", &(fvalue16[0]));
// Compute texture to dataset matrix
this->Impl->TextureToDataSetMat->Identity();
......@@ -2276,12 +2276,12 @@ void vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer* ren,
vtkInternal::VtkToGlMatrix(this->Impl->TextureToDataSetMat.GetPointer(),
fvalue16);
this->Impl->ShaderProgram->SetUniformMatrix4x4(
"m_texture_dataset_matrix", &(fvalue16[0]));
"in_textureDatasetMatrix", &(fvalue16[0]));
vtkInternal::VtkToGlMatrix(
this->Impl->InverseTextureToDataSetMat.GetPointer(), fvalue16);
this->Impl->ShaderProgram->SetUniformMatrix4x4(
"m_inverse_texture_dataset_matrix", &(fvalue16[0]));
"in_inverseTextureDatasetMatrix", &(fvalue16[0]));
vtkMatrix4x4::Multiply4x4(modelviewMat4x4, volumeMatrix4x4,
this->Impl->TextureToEyeTransposeInverse.GetPointer());
......@@ -2293,42 +2293,42 @@ void vtkOpenGLGPUVolumeRayCastMapper::GPURender(vtkRenderer* ren,
vtkInternal::VtkToGlMatrix(
this->Impl->TextureToEyeTransposeInverse.GetPointer(), fvalue16);
this->Impl->ShaderProgram->SetUniformMatrix4x4(
"m_texture_to_eye_it", &(fvalue16[0]));
"in_texureToEyeIt", &(fvalue16[0]));
vtkInternal::ToFloat(ren->GetActiveCamera()->GetPosition(), fvalue3, 3);
this->Impl->ShaderProgram->SetUniform3fv("m_camera_pos", 1, &fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("in_cameraPos", 1, &fvalue3);
vtkInternal::ToFloat(this->Impl->LoadedBounds[0],
this->Impl->LoadedBounds[2],
this->Impl->LoadedBounds[4], fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("m_vol_extents_min", 1, &fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("in_volumeExtentsMin", 1, &fvalue3);
vtkInternal::ToFloat(this->Impl->LoadedBounds[1],
this->Impl->LoadedBounds[3],
this->Impl->LoadedBounds[5], fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("m_vol_extents_max", 1, &fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("in_volumeExtentsMax", 1, &fvalue3);
vtkInternal::ToFloat(this->Impl->Extents[0],
this->Impl->Extents[2],
this->Impl->Extents[4], fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("m_texture_extents_min", 1, &fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("in_textureExtentsMin", 1, &fvalue3);
vtkInternal::ToFloat(this->Impl->Extents[1],
this->Impl->Extents[3],
this->Impl->Extents[5], fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("m_texture_extents_max", 1, &fvalue3);
this->Impl->ShaderProgram->SetUniform3fv("in_textureExtentsMax", 1, &fvalue3);
// TODO Take consideration of reduction factor
vtkInternal::ToFloat(this->Impl->WindowLowerLeft, fvalue2);
this->Impl->ShaderProgram->SetUniform2fv("m_window_lower_left_corner", 1, &fvalue2);
this->Impl->ShaderProgram->SetUniform2fv("in_windowLowerLeftCorner", 1, &fvalue2);
vtkInternal::ToFloat(1.0 / this->Impl->WindowSize[0],
1.0 / this->Impl->WindowSize[1], fvalue2);
this->Impl->ShaderProgram->SetUniform2fv("m_inv_original_window_size", 1, &fvalue2);
this->Impl->ShaderProgram->SetUniform2fv("in_inverseOriginalWindowSize", 1, &fvalue2);
vtkInternal::ToFloat(1.0 / this->Impl->WindowSize[0],
1.0 / this->Impl->WindowSize[1], fvalue2);
this->Impl->ShaderProgram->SetUniform2fv("m_inv_window_size", 1, &fvalue2);
this->Impl->ShaderProgram->SetUniform2fv("in_inverseWindowSize", 1, &fvalue2);
// Updating cropping if enabled
this->Impl->UpdateCropping(ren, vol);
......
......@@ -31,7 +31,7 @@ class vtkVolumeStateRAII
this->CullFaceEnabled = (glIsEnabled(GL_CULL_FACE) != 0);
// Enable texture 1D and 3D as we are using it
// for transfer functions and m_volume data
// for transfer functions and in_volume data
glEnable(GL_TEXTURE_1D);
glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_3D);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment