1 #include <cpPlugins/Interface/Mesh.h>
3 #include <vtkPolyData.h>
5 // -------------------------------------------------------------------------
6 void cpPlugins::Interface::Mesh::
7 SetVTK( vtkObject* mesh )
9 if( dynamic_cast< vtkPolyData* >( mesh ) != NULL )
10 this->m_VTKObject = mesh;
12 this->m_VTKObject = NULL;
13 this->m_Mapper = NULL;
18 // -------------------------------------------------------------------------
19 void cpPlugins::Interface::Mesh::
22 vtkPolyData* pd = this->GetVTK< vtkPolyData >( );
26 this->m_Mapper.GetPointer( ) == NULL ||
27 this->m_Actor.GetPointer( ) == NULL
32 pd->GetScalarRange( range );
34 this->m_Normals = vtkSmartPointer< vtkPolyDataNormals >::New( );
35 this->m_Stripper = vtkSmartPointer< vtkStripper >::New( );
36 this->m_Mapper = vtkSmartPointer< vtkPolyDataMapper >::New( );
37 this->m_Actor = vtkSmartPointer< vtkQuadricLODActor >::New( );
39 this->m_Normals->SetInputData( pd );
40 this->m_Normals->SetFeatureAngle( 60.0 );
41 this->m_Stripper->SetInputConnection( this->m_Normals->GetOutputPort( ) );
42 this->m_Mapper->SetInputConnection( this->m_Stripper->GetOutputPort( ) );
43 this->m_Mapper->UseLookupTableScalarRangeOff( );
44 this->m_Mapper->SetScalarRange(
45 range[ 0 ], ( ( range[ 1 ] - range[ 0 ] ) * 0.75 ) + range[ 0 ]
47 this->m_Actor->SetMapper( this->m_Mapper );
48 this->m_Actor->DeferLODConstructionOff( );
52 TODO: vtkQuadricLODActor : AllocatedRenderTime
58 // -------------------------------------------------------------------------
59 vtkActor* cpPlugins::Interface::Mesh::
62 return( this->m_Actor );
65 // -------------------------------------------------------------------------
66 const vtkActor* cpPlugins::Interface::Mesh::
69 return( this->m_Actor );
72 // -------------------------------------------------------------------------
73 cpPlugins::Interface::Mesh::
81 // -------------------------------------------------------------------------
82 cpPlugins::Interface::Mesh::