Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
PluginFunctionsSplatCloud.cc
1
2 /*===========================================================================*\
3 * *
4 * OpenFlipper *
5 * Copyright (c) 2001-2015, RWTH-Aachen University *
6 * Department of Computer Graphics and Multimedia *
7 * All rights reserved. *
8 * www.openflipper.org *
9 * *
10 *---------------------------------------------------------------------------*
11 * This file is part of OpenFlipper. *
12 *---------------------------------------------------------------------------*
13 * *
14 * Redistribution and use in source and binary forms, with or without *
15 * modification, are permitted provided that the following conditions *
16 * are met: *
17 * *
18 * 1. Redistributions of source code must retain the above copyright notice, *
19 * this list of conditions and the following disclaimer. *
20 * *
21 * 2. Redistributions in binary form must reproduce the above copyright *
22 * notice, this list of conditions and the following disclaimer in the *
23 * documentation and/or other materials provided with the distribution. *
24 * *
25 * 3. Neither the name of the copyright holder nor the names of its *
26 * contributors may be used to endorse or promote products derived from *
27 * this software without specific prior written permission. *
28 * *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
31 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
32 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
33 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
34 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
35 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
36 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
37 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
38 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
39 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
40 * *
41 \*===========================================================================*/
42
43 /*===========================================================================*\
44 * *
45 * $Revision$ *
46 * $LastChangedBy$ *
47 * $Date$ *
48 * *
49 \*===========================================================================*/
50
51 //================================================================
52 //
53 // Plugin Functions for SplatClouds
54 //
55 //================================================================
56
57
58 //== INCLUDES ====================================================
59
60
61 #include "PluginFunctionsSplatCloud.hh"
62
63 #include <OpenFlipper/BasePlugin/PluginFunctions.hh>
64
65
66 //== NAMESPACES ==================================================
67
68
69 namespace PluginFunctions {
70
71
72 //== IMPLEMENTATION ==============================================
73
74
75 //================================================================
76 // Get objects
77 //================================================================
78
79
80 bool getObject( int _identifier, SplatCloudObject *&_object )
81 {
82 if( _identifier == BaseObject::NOOBJECT )
83 {
84 _object = 0;
85 return false;
86 }
87
88 // Get object by using the map accelerated plugin function
89 BaseObjectData* object = 0;
90 PluginFunctions::getObject(_identifier,object);
91
92 _object = dynamic_cast<SplatCloudObject *>( object );
93 return (_object != 0);
94 }
95
96
97 //================================================================
98 // Getting data from objects and casting between them
99 //================================================================
100
101
102 ShaderNode* splatShaderNode( BaseObjectData *_object )
103 {
104 if( !_object )
105 return 0;
106
107 if( !_object->dataType( DATA_SPLATCLOUD ) )
108 return 0;
109
110 SplatCloudObject *object = dynamic_cast<SplatCloudObject *>( _object );
111
112 if ( object == 0 )
113 return 0;
114
115 return object->shaderNode();
116 }
117
118
119 //----------------------------------------------------------------
120
121
122 SplatCloudNode* splatCloudNode( BaseObjectData *_object )
123 {
124 if( !_object )
125 return 0;
126
127 if( !_object->dataType( DATA_SPLATCLOUD ) )
128 return 0;
129
130 SplatCloudObject *object = dynamic_cast<SplatCloudObject *>( _object );
131
132 if ( object == 0 )
133 return 0;
134
135 return object->splatCloudNode();
136 }
137
138
139 //----------------------------------------------------------------
140
141
142 SplatCloud* splatCloud( BaseObjectData *_object )
143 {
144 if( !_object )
145 return 0;
146
147 if( !_object->dataType( DATA_SPLATCLOUD ) )
148 return 0;
149
150 SplatCloudObject *object = dynamic_cast<SplatCloudObject *>( _object );
151
152 if ( object == 0 )
153 return 0;
154
155 return object->splatCloud();
156 }
157
158
159 //----------------------------------------------------------------
160
161
162 SplatCloudObject* splatCloudObject( BaseObjectData *_object )
163 {
164 if( !_object )
165 return 0;
166
167 if( !_object->dataType( DATA_SPLATCLOUD ) )
168 return 0;
169
170 return dynamic_cast<SplatCloudObject *>( _object );
171 }
172
173
174 //----------------------------------------------------------------
175
176
177 SplatCloudObject* splatCloudObject( int _objectId ) {
178
179 if (_objectId == BaseObject::NOOBJECT)
180 return 0;
181
182 // Get object by using the map accelerated plugin function
183 BaseObjectData* object = 0;
184 PluginFunctions::getObject(_objectId,object);
185
186 if ( object == 0 )
187 return 0;
188
189 SplatCloudObject* splatCloudObject = dynamic_cast< SplatCloudObject* >(object);
190
191 return splatCloudObject;
192 }
193
194
195 //================================================================
196
197
198 } // namespace PluginFunctions
PluginFunctions::splatShaderNode
ShaderNode * splatShaderNode(BaseObjectData *_object)
Get a ShaderNode from an object.
Definition: PluginFunctionsSplatCloud.cc:102
PluginFunctions::splatCloudNode
SplatCloudNode * splatCloudNode(BaseObjectData *_object)
Get a SplatCloudNode from an object.
Definition: PluginFunctionsSplatCloud.cc:122
SplatCloudObject::splatCloud
SplatCloud * splatCloud()
Get SplatCloud.
Definition: SplatCloudObject.hh:164
PluginFunctions
Definition: PluginFunctionsBSplineCurve.cc:69
BaseObjectData
Definition: BaseObjectData.hh:105
SplatCloudObject
Definition: SplatCloudObject.hh:82
SplatCloudObject::shaderNode
ShaderNode * shaderNode()
Get Shader's scenegraph Node.
Definition: SplatCloudObject.hh:178
PluginFunctions::getObject
bool getObject(int _identifier, BSplineCurveObject *&_object)
Definition: PluginFunctionsBSplineCurve.cc:75
SplatCloudObject::splatCloudNode
SplatCloudNode * splatCloudNode()
Get SplatCloud's scenegraph Node.
Definition: SplatCloudObject.hh:182
BaseObject::dataType
bool dataType(DataType _type) const
Definition: BaseObject.cc:232
ACG::SceneGraph::SplatCloudNode
Definition: SplatCloudNode.hh:94
BaseObject::NOOBJECT
static int NOOBJECT
Definition: BaseObject.hh:118
PluginFunctionsSplatCloud.hh
PluginFunctions::splatCloudObject
SplatCloudObject * splatCloudObject(BaseObjectData *_object)
Cast an SplatCloudObject to a SplatCloudObject if possible.
Definition: PluginFunctionsSplatCloud.cc:162
DATA_SPLATCLOUD
#define DATA_SPLATCLOUD
Definition: SplatCloud.hh:65
ACG::SceneGraph::ShaderNode
Definition: ShaderNode.hh:87
PluginFunctions.hh
SplatCloud
Definition: SplatCloud.hh:85
PluginFunctions::splatCloud
SplatCloud * splatCloud(BaseObjectData *_object)
Get a SplatCloud from an object.
Definition: PluginFunctionsSplatCloud.cc:142