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/Disk.cpp

    r3680 r3683  
    1010#include <vtkDiskSource.h>
    1111#include <vtkPolyDataNormals.h>
     12#include <vtkReverseSense.h>
    1213
    1314#include "Disk.h"
     
    1718
    1819Disk::Disk() :
    19     Shape(),
    20     _flipNormals(false)
     20    Shape()
    2121{
    2222}
     
    4242    normalFilter->SetInputConnection(_disk->GetOutputPort());
    4343    normalFilter->AutoOrientNormalsOff();
    44     normalFilter->SetFlipNormals(_flipNormals ? 1 : 0);
    4544
    4645    _pdMapper->SetInputConnection(normalFilter->GetOutputPort());
     
    5453void Disk::flipNormals(bool state)
    5554{
    56     if (_flipNormals != state) {
    57         _flipNormals = state;
    58         update();
     55    if (_disk == 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(_disk->GetOutputPort());
     63
     64        _pdMapper->SetInputConnection(filter->GetOutputPort());
     65    } else {
     66        _pdMapper->SetInputConnection(_disk->GetOutputPort());
    5967    }
     68    _pdMapper->Update();
    6069}
Note: See TracChangeset for help on using the changeset viewer.