Developer Documentation
 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 
62 
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 
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 
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 
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 
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 
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
ShaderNode * splatShaderNode(BaseObjectData *_object)
Get a ShaderNode from an object.
SplatCloudNode * splatCloudNode(BaseObjectData *_object)
Get a SplatCloudNode from an object.
SplatCloud * splatCloud()
Get SplatCloud.
ShaderNode * shaderNode()
Get Shader's scenegraph Node.
bool getObject(int _identifier, BSplineCurveObject *&_object)
SplatCloudNode * splatCloudNode()
Get SplatCloud's scenegraph Node.
bool dataType(DataType _type) const
Definition: BaseObject.cc:232
static int NOOBJECT
Definition: BaseObject.hh:118
SplatCloudObject * splatCloudObject(BaseObjectData *_object)
Cast an SplatCloudObject to a SplatCloudObject if possible.
#define DATA_SPLATCLOUD
Definition: SplatCloud.hh:65
SplatCloud * splatCloud(BaseObjectData *_object)
Get a SplatCloud from an object.