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
|
Line | |
---|
1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /* |
---|
3 | * Copyright (C) 2004-2012 HUBzero Foundation, LLC |
---|
4 | * |
---|
5 | * Author: Leif Delgass <ldelgass@purdue.edu> |
---|
6 | */ |
---|
7 | |
---|
8 | #include <vtkPolyDataMapper.h> |
---|
9 | #include <vtkActor.h> |
---|
10 | #include <vtkDiskSource.h> |
---|
11 | #include <vtkPolyDataNormals.h> |
---|
12 | |
---|
13 | #include "Disk.h" |
---|
14 | #include "Trace.h" |
---|
15 | |
---|
16 | using namespace VtkVis; |
---|
17 | |
---|
18 | Disk::Disk() : |
---|
19 | Shape(), |
---|
20 | _flipNormals(false) |
---|
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 | |
---|
41 | vtkSmartPointer<vtkPolyDataNormals> normalFilter = vtkSmartPointer<vtkPolyDataNormals>::New(); |
---|
42 | normalFilter->SetInputConnection(_disk->GetOutputPort()); |
---|
43 | normalFilter->AutoOrientNormalsOff(); |
---|
44 | normalFilter->SetFlipNormals(_flipNormals ? 1 : 0); |
---|
45 | |
---|
46 | _pdMapper->SetInputConnection(normalFilter->GetOutputPort()); |
---|
47 | |
---|
48 | initProp(); |
---|
49 | |
---|
50 | getActor()->SetMapper(_pdMapper); |
---|
51 | _pdMapper->Update(); |
---|
52 | } |
---|
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.