Commit f545b663 authored by Marcus D. Hanwell's avatar Marcus D. Hanwell

Roughly mapping the colors/scalars, updates to shaders

Attempt to map the colors/scalars, and adjust the shader according
to whether color is a uniform or an attribute. Added some logic to
deal with building normals as the painters do, but error out for
now. This is also not even close to dealing with cell colors and/or
properties.

Change-Id: If584570b71dca4db3e9fd6c4ad95af58c00dea32
parent 3c2af931
......@@ -27,8 +27,8 @@ attribute vec4 vertexMC;
attribute vec3 normalMC;
// material property values
//VTK::Color::Dec
uniform float opacity;
uniform vec3 diffuseColor;
uniform vec3 specularColor;
uniform float specularPower;
......@@ -49,7 +49,7 @@ void main()
float sf = pow(df, specularPower);
//vec3 ambient = 0.4 * color;
vec3 diffuse = df * diffuseColor;
vec3 diffuse = df * color.rgb;
vec3 specular = sf * specularColor;
fcolor = vec4(diffuse + specular, opacity);
......
......@@ -26,8 +26,8 @@ attribute vec4 vertexMC;
attribute vec3 normalMC;
// material property values
//VTK::Color::Dec
uniform float opacity;
uniform vec3 diffuseColor;
uniform vec3 specularColor;
uniform float specularPower;
......@@ -38,7 +38,6 @@ uniform mat4 MCVCMatrix; // combined Model to View transform
uniform mat4 VCDCMatrix; // the camera's projection matrix
uniform mat3 normalMatrix; // transform model coordinate directions to view coordinates
uniform int numberOfLights; // only allow for up to 6 active lights
uniform vec3 lightColor[6]; // intensity weighted color
uniform vec3 lightDirectionVC[6]; // normalized
......@@ -54,7 +53,7 @@ void main()
// now compute the vertex color
vec3 normalVC = normalize(normalMatrix * normalMC);
vec3 viewDirectionVC = normalize(vec3(0.0, 0.0, 1.0) - vertexVC);
vec3 viewDirectionVC = normalize(vec3(0.0, 0.0, 1.0) - vertexVC.xyz);
vec3 diffuse = vec3(0,0,0);
vec3 specular = vec3(0,0,0);
......@@ -72,10 +71,7 @@ void main()
}
}
diffuse = diffuse * diffuseColor;
diffuse = diffuse * color.rgb;
specular = specular * specularColor;
fcolor = vec4(diffuse + specular, opacity);
}
......@@ -25,8 +25,8 @@ attribute vec4 vertexMC;
attribute vec3 normalMC;
// material property values
//VTK::Color::Dec
uniform float opacity;
uniform vec3 diffuseColor;
uniform vec3 specularColor;
uniform float specularPower;
......@@ -112,7 +112,7 @@ void main()
}
}
diffuse = diffuse * diffuseColor;
diffuse = diffuse * color.rgb;
specular = specular * specularColor;
fcolor = vec4(diffuse + specular, opacity);
}
......
This diff is collapsed.
......@@ -72,7 +72,10 @@ protected:
// Description:
// Update the scene when necessary.
void UpdateVBO();
void UpdateVBO(vtkActor *act);
void MapScalars(vtkDataSet* output, double alpha, bool multiplyWithAlpha,
vtkDataSet* input);
// Description:
// Set the shader parameteres related to lighting
......@@ -91,6 +94,7 @@ protected:
class Private;
Private *Internal;
bool UsingScalarColoring;
vtkTimeStamp VBOUpdateTime; // When was the VBO updated?
bool Initialized; // Hack - ensure glewinit has been called - move to window.
......
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