Commit 41f9ac45 authored by Ken Martin's avatar Ken Martin

in progress

parent 41652830
......@@ -36,6 +36,8 @@ set(shader_files
glsl/vtkglPolyDataVSPositionalLights.glsl
glsl/vtkglVertexShader.glsl
glsl/vtkglPolyDataFS.glsl
glsl/vtkglPolyDataVSFlatOld.glsl
glsl/vtkglPolyDataFSFlatOld.glsl
)
unset(shader_h_files)
......
......@@ -60,7 +60,7 @@ int TestVBOPLYMapper(int argc, char *argv[])
actor->GetProperty()->SetAmbient(0.5);
actor->GetProperty()->SetSpecularPower(20.0);
actor->GetProperty()->SetOpacity(1.0);
actor->GetProperty()->SetRepresentationToWireframe();
//actor->GetProperty()->SetRepresentationToWireframe();
vtkNew<vtkRenderWindowInteractor> interactor;
interactor->SetRenderWindow(renderWindow.Get());
......
......@@ -213,28 +213,11 @@ void vtkOpenGL2Renderer::DeviceRender(void)
this->RenderWindow->MakeCurrent();
vtkOpenGLClearErrorMacro();
// standard render method
this->ClearLights();
this->UpdateCamera();
this->UpdateLightGeometry();
this->UpdateLights();
// set matrix mode for actors
glMatrixMode(GL_MODELVIEW);
this->UpdateGeometry();
// clean up the model view matrix set up by the camera
glMatrixMode(GL_MODELVIEW);
GLint mvDepth;
glGetIntegerv(GL_MODELVIEW_STACK_DEPTH, &mvDepth);
if (mvDepth>1)
{
glPopMatrix();
}
vtkOpenGLCheckErrorMacro("failed after DeviceRender");
}
......@@ -1085,9 +1068,6 @@ void vtkOpenGL2Renderer::Clear(void)
glPushAttrib(GL_ENABLE_BIT | GL_TRANSFORM_BIT);
glDisable(GL_ALPHA_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_1D);
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glShadeModel(GL_SMOOTH); // color interpolation
......@@ -1208,21 +1188,12 @@ void vtkOpenGL2Renderer::DevicePickRender()
this->RenderWindow->MakeCurrent();
vtkOpenGLClearErrorMacro();
// standard render method
this->ClearLights();
this->UpdateCamera();
this->UpdateLightGeometry();
this->UpdateLights();
// set matrix mode for actors
glMatrixMode(GL_MODELVIEW);
this->PickGeometry();
// clean up the model view matrix set up by the camera
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
vtkOpenGLCheckErrorMacro("failed after DevicePickRender");
}
......
......@@ -45,11 +45,6 @@ public:
// override this method.
virtual void DeviceRenderTranslucentPolygonalGeometry();
// Description:
// Internal method temporarily removes lights before reloading them
// into graphics pipeline.
void ClearLights(void) {};
void Clear(void);
// Description:
......
......@@ -39,6 +39,8 @@
#include "vtkLightCollection.h"
// Bring in our shader symbols.
#include "vtkglPolyDataVSFlatOld.h"
#include "vtkglPolyDataFSFlatOld.h"
#include "vtkglPolyDataVSLightKit.h"
#include "vtkglPolyDataVSHeadlight.h"
#include "vtkglPolyDataVSPositionalLights.h"
......@@ -173,19 +175,18 @@ void vtkVBOPolyDataMapper::UpdateShader(vtkRenderer* ren, vtkActor *vtkNotUsed(a
case 1:
tris.fsFile = vtkglPolyDataFS;
tris.vsFile = vtkglPolyDataVSHeadlight;
// tris.vsFile = vtkglPolyDataVSPositionalLights;
break;
case 2:
tris.fsFile = vtkglPolyDataFS;
// tris.vsFile = vtkglPolyDataVSHeadlight;
tris.vsFile = vtkglPolyDataVSLightKit;
// tris.vsFile = vtkglPolyDataVSPositionalLights;
break;
case 3:
tris.fsFile = vtkglPolyDataFS;
tris.vsFile = vtkglPolyDataVSPositionalLights;
break;
}
tris.fsFile = vtkglPolyDataFSFlatOld;
tris.vsFile = vtkglPolyDataVSFlatOld;
// compile and link the shader program if it has changed
// eventually use some sort of caching here
......@@ -798,6 +799,29 @@ void vtkVBOPolyDataMapper::UpdateVBO(vtkActor *act)
return;
}
// are they cell or point scalars
bool cellScalars = false;
if ( this->Colors )
{
if ( (this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA ||
this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA ||
this->ScalarMode == VTK_SCALAR_MODE_USE_FIELD_DATA ||
!input->GetPointData()->GetScalars() )
&& this->ScalarMode != VTK_SCALAR_MODE_USE_POINT_FIELD_DATA)
{
cellScalars = true;
}
}
// if we have cell scalars then we have to
// explode the data, at the same time we will triangulate
// any non triangles
if (cellScalars)
{
}
vtkSmartPointer<vtkDataArray> n;
// This replicates how the painter decided on normal generation.
......@@ -813,6 +837,7 @@ void vtkVBOPolyDataMapper::UpdateVBO(vtkActor *act)
vtkNew<vtkPolyDataNormals> computeNormals;
computeNormals->SetInputData(poly);
computeNormals->SplittingOff();
//computeNormals->SetfeatureAngle(0.01);
computeNormals->Update();
n = computeNormals->GetOutput()->GetPointData()->GetNormals();
}
......
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