OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreObjectData.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __ObjectData_H__
29 #define __ObjectData_H__
30 
31 //#include "OgreArrayMatrix4.h"
32 #include "OgreArrayAabb.h"
33 #include "OgreArrayMemoryManager.h"
34 
35 namespace Ogre
36 {
38  struct ObjectData
39  {
41  unsigned char mIndex;
42 
45 
48 
55 
58 
59  //ArraySphere * RESTRICT_ALIAS mWorldSphere;
60 
66 
73 
76 
79 
82 
91 
93  mIndex( 0 ),
94  mParents( 0 ),
95  mLocalAabb( 0 ),
96  mWorldAabb( 0 ),
97  mWorldRadius( 0 ),
98  mUpperDistance( 0 ),
99  mVisibilityFlags( 0 ),
100  mQueryFlags( 0 ),
101  mLightMask( 0 )
102  {
103  }
104 
106  void copy( const ObjectData &inCopy )
107  {
108  mParents[mIndex] = inCopy.mParents[inCopy.mIndex];
109  mOwner[mIndex] = inCopy.mOwner[inCopy.mIndex];
110 
111  Aabb tmp;
112  inCopy.mLocalAabb->getAsAabb( tmp, inCopy.mIndex );
113  mLocalAabb->setFromAabb( tmp, mIndex );
114 
115  inCopy.mWorldAabb->getAsAabb( tmp, inCopy.mIndex );
116  mWorldAabb->setFromAabb( tmp, mIndex );
117 
118  mLocalRadius[mIndex] = inCopy.mLocalRadius[inCopy.mIndex];
119  mWorldRadius[mIndex] = inCopy.mWorldRadius[inCopy.mIndex];
120  mUpperDistance[mIndex] = inCopy.mUpperDistance[inCopy.mIndex];
122  mQueryFlags[mIndex] = inCopy.mQueryFlags[inCopy.mIndex];
123  mLightMask[mIndex] = inCopy.mLightMask[inCopy.mIndex];
124  }
125 
129  void advancePack()
130  {
133  ++mLocalAabb;
134  ++mWorldAabb;
141  }
142 
143  void advancePack( size_t numAdvance )
144  {
145  mParents += ARRAY_PACKED_REALS * numAdvance;
146  mOwner += ARRAY_PACKED_REALS * numAdvance;
147  mLocalAabb += numAdvance;
148  mWorldAabb += numAdvance;
149  mLocalRadius += ARRAY_PACKED_REALS * numAdvance;
150  mWorldRadius += ARRAY_PACKED_REALS * numAdvance;
151  mUpperDistance += ARRAY_PACKED_REALS * numAdvance;
152  mVisibilityFlags += ARRAY_PACKED_REALS * numAdvance;
153  mQueryFlags += ARRAY_PACKED_REALS * numAdvance;
154  mLightMask += ARRAY_PACKED_REALS * numAdvance;
155  }
156 
161  {
162 #ifndef NDEBUG
164 #endif
166  ++mLocalAabb;
167  ++mWorldAabb;
170  }
171 
176  {
178  ++mWorldAabb;
182  }
183 
188  {
189  ++mWorldAabb;
192  }
193 
198  {
200  ++mWorldAabb;
203  }
204 
209  {
211  ++mWorldAabb;
214  }
215 
217  {
219  ++mWorldAabb;
221  }
222  };
223 }
224 
225 #endif
void advancePack(size_t numAdvance)
void copy(const ObjectData &inCopy)
Copies all the scalar data from the parameter into this.
Represents the transform of a single object, arranged in SoA (Structure of Arrays) ...
float Real
Software floating point type.
unsigned int uint32
Definition: OgrePlatform.h:420
ArrayAabb *RESTRICT_ALIAS mWorldAabb
Bounding box in world space.
Real *RESTRICT_ALIAS mLocalRadius
mLocalAabb
uint32 *RESTRICT_ALIAS mVisibilityFlags
Flags determining whether this object is visible (compared to SceneManager mask)
void advanceFrustumPack()
Advances all pointers needed by MovableObject::cullFrustum to the next pack, i.e. ...
void setFromAabb(const Aabb &aabb, size_t index)
Abstract class defining a movable object in a scene.
#define RESTRICT_ALIAS
Definition: OgrePlatform.h:448
void getAsAabb(Aabb &out, size_t index) const
uint32 *RESTRICT_ALIAS mLightMask
The light mask defined for this movable.
void advanceCullLightPack()
Advances all pointers needed by MovableObject::cullLights to the next pack, i.e.
AoS (array of structures) version of ArrayAabb.
Definition: C/OgreAabb.h:78
Real *RESTRICT_ALIAS mWorldRadius
Ours is mWorldRadius[mIndex].
MovableObject ** mOwner
The movable object that owns this ObjectData. Ours is mOwner[mIndex].
#define ARRAY_PACKED_REALS
void advanceBoundsPack()
Advances all pointers needed by MovableObject::updateAllBounds to the next pack, i.e.
void advanceDirtyInstanceMgr()
Advances all pointers needed by InstanceBatch::_updateBounds to the next pack, i.e.
uint32 *RESTRICT_ALIAS mQueryFlags
Flags determining whether this object is included / excluded from scene queries.
void advanceLightPack()
Advances all pointers needed by MovableObject::buildLightList to the next pack, i.e.
Node ** mParents
Holds the pointers to each parent. Ours is mParents[mIndex].
void advancePack()
Advances all pointers to the next pack, i.e.
ArrayAabb *RESTRICT_ALIAS mLocalAabb
Bounding box in local space.
Real *RESTRICT_ALIAS mUpperDistance
Upper distance to still render. Ours is mUpperDistance[mIndex].
Cache-friendly array of Aabb represented as a SoA array.
Class representing a general-purpose node an articulated scene graph.
Definition: OgreNode.h:58
unsigned char mIndex
Which of the packed values is ours. Value in range [0; 4) for SSE2.