Last change
on this file since 3680 was
3680,
checked in by ldelgass, 11 years ago
|
Improved cloud support in vtkvis: handle ugrids with no cells as well as
polydata clouds, add cloudstyle options to some graphics objects.
|
-
Property svn:eol-style set to
native
|
File size:
1.3 KB
|
Rev | Line | |
---|
[3154] | 1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
| 2 | /* |
---|
[3177] | 3 | * Copyright (C) 2004-2012 HUBzero Foundation, LLC |
---|
[3154] | 4 | * |
---|
| 5 | * Author: Leif Delgass <ldelgass@purdue.edu> |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include <vtkPolyDataMapper.h> |
---|
| 9 | #include <vtkActor.h> |
---|
| 10 | #include <vtkDiskSource.h> |
---|
[3680] | 11 | #include <vtkPolyDataNormals.h> |
---|
[3154] | 12 | |
---|
[3616] | 13 | #include "Disk.h" |
---|
[3154] | 14 | #include "Trace.h" |
---|
| 15 | |
---|
[3615] | 16 | using namespace VtkVis; |
---|
[3154] | 17 | |
---|
| 18 | Disk::Disk() : |
---|
[3680] | 19 | Shape(), |
---|
| 20 | _flipNormals(false) |
---|
[3154] | 21 | { |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | Disk::~Disk() |
---|
| 25 | { |
---|
| 26 | TRACE("Deleting Disk"); |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | void Disk::update() |
---|
| 30 | { |
---|
| 31 | if (_disk == NULL) { |
---|
| 32 | _disk = vtkSmartPointer<vtkDiskSource>::New(); |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | if (_pdMapper == NULL) { |
---|
| 36 | _pdMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); |
---|
| 37 | _pdMapper->SetResolveCoincidentTopologyToPolygonOffset(); |
---|
| 38 | _pdMapper->ScalarVisibilityOff(); |
---|
| 39 | } |
---|
| 40 | |
---|
[3680] | 41 | vtkSmartPointer<vtkPolyDataNormals> normalFilter = vtkSmartPointer<vtkPolyDataNormals>::New(); |
---|
| 42 | normalFilter->SetInputConnection(_disk->GetOutputPort()); |
---|
| 43 | normalFilter->AutoOrientNormalsOff(); |
---|
| 44 | normalFilter->SetFlipNormals(_flipNormals ? 1 : 0); |
---|
[3154] | 45 | |
---|
[3680] | 46 | _pdMapper->SetInputConnection(normalFilter->GetOutputPort()); |
---|
| 47 | |
---|
[3154] | 48 | initProp(); |
---|
| 49 | |
---|
| 50 | getActor()->SetMapper(_pdMapper); |
---|
| 51 | _pdMapper->Update(); |
---|
| 52 | } |
---|
[3680] | 53 | |
---|
| 54 | void Disk::flipNormals(bool state) |
---|
| 55 | { |
---|
| 56 | if (_flipNormals != state) { |
---|
| 57 | _flipNormals = state; |
---|
| 58 | update(); |
---|
| 59 | } |
---|
| 60 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.