Ignore:
Timestamp:
Jun 12, 2013, 2:51:11 AM (11 years ago)
Author:
ldelgass
Message:

Improvements to 3D shapes in vtkvis. Add preliminary, experimental grouping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/Polygon.cpp

    r3616 r3683  
    99#include <vtkActor.h>
    1010#include <vtkRegularPolygonSource.h>
     11#include <vtkPolyDataNormals.h>
     12#include <vtkReverseSense.h>
    1113
    1214#include "Polygon.h"
     
    3739    }
    3840
     41    vtkSmartPointer<vtkPolyDataNormals> normalFilter = vtkSmartPointer<vtkPolyDataNormals>::New();
     42    normalFilter->SetInputConnection(_polygon->GetOutputPort());
     43    normalFilter->AutoOrientNormalsOff();
     44
    3945    _pdMapper->SetInputConnection(_polygon->GetOutputPort());
    4046
     
    4450    _pdMapper->Update();
    4551}
     52
     53void Polygon::flipNormals(bool state)
     54{
     55    if (_polygon == NULL || _pdMapper == NULL)
     56        return;
     57
     58    if (state) {
     59        vtkSmartPointer<vtkReverseSense> filter = vtkSmartPointer<vtkReverseSense>::New();
     60        filter->ReverseCellsOn();
     61        filter->ReverseNormalsOn();
     62        filter->SetInputConnection(_polygon->GetOutputPort());
     63
     64        _pdMapper->SetInputConnection(filter->GetOutputPort());
     65    } else {
     66        _pdMapper->SetInputConnection(_polygon->GetOutputPort());
     67    }
     68    _pdMapper->Update();
     69}
     70
Note: See TracChangeset for help on using the changeset viewer.