Last change
on this file since 3162 was
3148,
checked in by ldelgass, 12 years ago
|
Add Box and Sphere shapes and commands to vtkvis.
|
-
Property svn:eol-style set to
native
|
File size:
969 bytes
|
Line | |
---|
1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /* |
---|
3 | * Copyright (C) 2012, Purdue Research Foundation |
---|
4 | * |
---|
5 | * Author: Leif Delgass <ldelgass@purdue.edu> |
---|
6 | */ |
---|
7 | |
---|
8 | #include <cassert> |
---|
9 | |
---|
10 | #include <vtkDataSet.h> |
---|
11 | #include <vtkPolyData.h> |
---|
12 | #include <vtkPolyDataMapper.h> |
---|
13 | #include <vtkActor.h> |
---|
14 | #include <vtkProperty.h> |
---|
15 | #include <vtkTransform.h> |
---|
16 | #include <vtkCubeSource.h> |
---|
17 | |
---|
18 | #include "RpBox.h" |
---|
19 | #include "Trace.h" |
---|
20 | |
---|
21 | using namespace Rappture::VtkVis; |
---|
22 | |
---|
23 | Box::Box() : |
---|
24 | Shape() |
---|
25 | { |
---|
26 | } |
---|
27 | |
---|
28 | Box::~Box() |
---|
29 | { |
---|
30 | TRACE("Deleting Box"); |
---|
31 | } |
---|
32 | |
---|
33 | void Box::update() |
---|
34 | { |
---|
35 | if (_box == NULL) { |
---|
36 | _box = vtkSmartPointer<vtkCubeSource>::New(); |
---|
37 | } |
---|
38 | |
---|
39 | if (_pdMapper == NULL) { |
---|
40 | _pdMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); |
---|
41 | _pdMapper->SetResolveCoincidentTopologyToPolygonOffset(); |
---|
42 | _pdMapper->ScalarVisibilityOff(); |
---|
43 | } |
---|
44 | |
---|
45 | _pdMapper->SetInputConnection(_box->GetOutputPort()); |
---|
46 | |
---|
47 | initProp(); |
---|
48 | |
---|
49 | getActor()->SetMapper(_pdMapper); |
---|
50 | _pdMapper->Update(); |
---|
51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.