[1809] | 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-2005 The OGRE Team
|
---|
| 8 | Also see acknowledgements in Readme.html
|
---|
| 9 |
|
---|
| 10 | This program is free software; you can redistribute it and/or modify it under
|
---|
| 11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
| 12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
| 13 | version.
|
---|
| 14 |
|
---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
| 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
| 17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
| 18 |
|
---|
| 19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
| 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
| 21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
| 22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
| 23 | -----------------------------------------------------------------------------
|
---|
| 24 | */
|
---|
| 25 |
|
---|
| 26 | #ifndef __MovableObject_H__
|
---|
| 27 | #define __MovableObject_H__
|
---|
| 28 |
|
---|
| 29 | // Precompiler options
|
---|
| 30 | #include "OgrePrerequisites.h"
|
---|
| 31 | #include "OgreRenderQueue.h"
|
---|
| 32 | #include "OgreAxisAlignedBox.h"
|
---|
| 33 | #include "OgreSphere.h"
|
---|
| 34 | #include "OgreShadowCaster.h"
|
---|
| 35 | #include "OgreFactoryObj.h"
|
---|
| 36 | #include "OgreAnimable.h"
|
---|
| 37 | #include "OgreAny.h"
|
---|
| 38 | #include "OgreUserDefinedObject.h"
|
---|
| 39 |
|
---|
| 40 | namespace Ogre {
|
---|
| 41 |
|
---|
| 42 | // Forward declaration
|
---|
| 43 | class MovableObjectFactory;
|
---|
| 44 |
|
---|
| 45 | /** Abstract class definining a movable object in a scene.
|
---|
| 46 | @remarks
|
---|
| 47 | Instances of this class are discrete, relatively small, movable objects
|
---|
| 48 | which are attached to SceneNode objects to define their position.
|
---|
| 49 | */
|
---|
| 50 | class _OgreExport MovableObject : public ShadowCaster, public AnimableObject
|
---|
| 51 | {
|
---|
| 52 | protected:
|
---|
| 53 | /// Name of this object
|
---|
| 54 | String mName;
|
---|
| 55 | /// Creator of this object (if created by a factory)
|
---|
| 56 | MovableObjectFactory* mCreator;
|
---|
| 57 | /// SceneManager holding this object (if applicable)
|
---|
| 58 | SceneManager* mManager;
|
---|
| 59 | /// node to which this object is attached
|
---|
| 60 | Node* mParentNode;
|
---|
| 61 | bool mParentIsTagPoint;
|
---|
| 62 | /// Is this object visible?
|
---|
| 63 | bool mVisible;
|
---|
| 64 | /// Upper distance to still render
|
---|
| 65 | Real mUpperDistance;
|
---|
| 66 | Real mSquaredUpperDistance;
|
---|
| 67 | /// Hidden because of distance?
|
---|
| 68 | bool mBeyondFarDistance;
|
---|
| 69 | /// User defined link to another object / value / whatever
|
---|
| 70 | Any mUserAny;
|
---|
| 71 | /// The render queue to use when rendering this object
|
---|
| 72 | uint8 mRenderQueueID;
|
---|
| 73 | /// Flags whether the RenderQueue's default should be used.
|
---|
| 74 | bool mRenderQueueIDSet;
|
---|
| 75 | /// Flags determining whether this object is included / excluded from scene queries
|
---|
| 76 | uint32 mQueryFlags;
|
---|
| 77 | /// Flags determining whether this object is visible (compared to SceneManager mask)
|
---|
| 78 | uint32 mVisibilityFlags;
|
---|
| 79 | /// Cached world AABB of this object
|
---|
| 80 | mutable AxisAlignedBox mWorldAABB;
|
---|
| 81 | // Cached world bounding sphere
|
---|
| 82 | mutable Sphere mWorldBoundingSphere;
|
---|
| 83 | /// World space AABB of this object's dark cap
|
---|
| 84 | mutable AxisAlignedBox mWorldDarkCapBounds;
|
---|
| 85 | /// Does this object cast shadows?
|
---|
| 86 | bool mCastShadows;
|
---|
| 87 |
|
---|
| 88 | // Static members
|
---|
| 89 | /// Default query flags
|
---|
| 90 | static uint32 msDefaultQueryFlags;
|
---|
| 91 | /// Default visibility flags
|
---|
| 92 | static uint32 msDefaultVisibilityFlags;
|
---|
| 93 |
|
---|
| 94 |
|
---|
| 95 |
|
---|
| 96 | public:
|
---|
| 97 | /// Constructor
|
---|
| 98 | MovableObject();
|
---|
| 99 |
|
---|
| 100 | /// Named constructor
|
---|
| 101 | MovableObject(const String& name);
|
---|
| 102 | /** Virtual destructor - read Scott Meyers if you don't know why this is needed.
|
---|
| 103 | */
|
---|
| 104 | virtual ~MovableObject();
|
---|
| 105 |
|
---|
| 106 | /** Notify the object of it's creator (internal use only) */
|
---|
| 107 | virtual void _notifyCreator(MovableObjectFactory* fact) { mCreator = fact; }
|
---|
| 108 | /** Get the creator of this object, if any (internal use only) */
|
---|
| 109 | virtual MovableObjectFactory* _getCreator(void) const { return mCreator; }
|
---|
| 110 | /** Notify the object of it's manager (internal use only) */
|
---|
| 111 | virtual void _notifyManager(SceneManager* man) { mManager = man; }
|
---|
| 112 | /** Get the manager of this object, if any (internal use only) */
|
---|
| 113 | virtual SceneManager* _getManager(void) const { return mManager; }
|
---|
| 114 |
|
---|
| 115 | /** Returns the name of this object. */
|
---|
| 116 | virtual const String& getName(void) const { return mName; }
|
---|
| 117 |
|
---|
| 118 | /** Returns the type name of this object. */
|
---|
| 119 | virtual const String& getMovableType(void) const = 0;
|
---|
| 120 |
|
---|
| 121 | /** Returns the node to which this object is attached.
|
---|
| 122 | @remarks
|
---|
| 123 | A MovableObject may be attached to either a SceneNode or to a TagPoint,
|
---|
| 124 | the latter case if it's attached to a bone on an animated entity.
|
---|
| 125 | Both are Node subclasses so this method will return either.
|
---|
| 126 | */
|
---|
| 127 | virtual Node* getParentNode(void) const;
|
---|
| 128 |
|
---|
| 129 | /** Returns the scene node to which this object is attached.
|
---|
| 130 | @remarks
|
---|
| 131 | A MovableObject may be attached to either a SceneNode or to a TagPoint,
|
---|
| 132 | the latter case if it's attached to a bone on an animated entity.
|
---|
| 133 | This method will return the scene node of the parent entity
|
---|
| 134 | if the latter is true.
|
---|
| 135 | */
|
---|
| 136 | virtual SceneNode* getParentSceneNode(void) const;
|
---|
| 137 |
|
---|
| 138 | /** Internal method called to notify the object that it has been attached to a node.
|
---|
| 139 | */
|
---|
| 140 | virtual void _notifyAttached(Node* parent, bool isTagPoint = false);
|
---|
| 141 |
|
---|
| 142 | /** Returns true if this object is attached to a SceneNode or TagPoint. */
|
---|
| 143 | virtual bool isAttached(void) const;
|
---|
| 144 |
|
---|
| 145 | /** Returns true if this object is attached to a SceneNode or TagPoint,
|
---|
| 146 | and this SceneNode / TagPoint is currently in an active part of the
|
---|
| 147 | scene graph. */
|
---|
| 148 | virtual bool isInScene(void) const;
|
---|
| 149 |
|
---|
| 150 | /** Internal method to notify the object of the camera to be used for the next rendering operation.
|
---|
| 151 | @remarks
|
---|
| 152 | Certain objects may want to do specific processing based on the camera position. This method notifies
|
---|
| 153 | them incase they wish to do this.
|
---|
| 154 | */
|
---|
| 155 | virtual void _notifyCurrentCamera(Camera* cam);
|
---|
| 156 |
|
---|
| 157 | /** Retrieves the local axis-aligned bounding box for this object.
|
---|
| 158 | @remarks
|
---|
| 159 | This bounding box is in local coordinates.
|
---|
| 160 | */
|
---|
| 161 | virtual const AxisAlignedBox& getBoundingBox(void) const = 0;
|
---|
| 162 |
|
---|
| 163 | /** Retrieves the radius of the origin-centered bounding sphere
|
---|
| 164 | for this object.
|
---|
| 165 | */
|
---|
| 166 | virtual Real getBoundingRadius(void) const = 0;
|
---|
| 167 |
|
---|
| 168 | /** Retrieves the axis-aligned bounding box for this object in world coordinates. */
|
---|
| 169 | virtual const AxisAlignedBox& getWorldBoundingBox(bool derive = false) const;
|
---|
| 170 | /** Retrieves the worldspace bounding sphere for this object. */
|
---|
| 171 | virtual const Sphere& getWorldBoundingSphere(bool derive = false) const;
|
---|
| 172 | /** Internal method by which the movable object must add Renderable subclass instances to the rendering queue.
|
---|
| 173 | @remarks
|
---|
| 174 | The engine will call this method when this object is to be rendered. The object must then create one or more
|
---|
| 175 | Renderable subclass instances which it places on the passed in Queue for rendering.
|
---|
| 176 | */
|
---|
| 177 | virtual void _updateRenderQueue(RenderQueue* queue) = 0;
|
---|
| 178 |
|
---|
| 179 | /** Tells this object whether to be visible or not, if it has a renderable component.
|
---|
| 180 | @note An alternative approach of making an object invisible is to detach it
|
---|
| 181 | from it's SceneNode, or to remove the SceneNode entirely.
|
---|
| 182 | Detaching a node means that structurally the scene graph changes.
|
---|
| 183 | Once this change has taken place, the objects / nodes that have been
|
---|
| 184 | removed have less overhead to the visbility detection pass than simply
|
---|
| 185 | making the object invisible, so if you do this and leave the objects
|
---|
| 186 | out of the tree for a long time, it's faster. However, the act of
|
---|
| 187 | detaching / reattaching nodes is in itself more expensive than
|
---|
| 188 | setting an object visibility flag, since in the latter case
|
---|
| 189 | structural changes are not made. Therefore, small or frequent visbility
|
---|
| 190 | changes are best done using this method; large or more longer term
|
---|
| 191 | changes are best done by detaching.
|
---|
| 192 | */
|
---|
| 193 | virtual void setVisible(bool visible);
|
---|
| 194 |
|
---|
| 195 | /** Gets this object whether to be visible or not, if it has a renderable component.
|
---|
| 196 | @remarks
|
---|
| 197 | Returns the value set by MovableObject::setVisible only.
|
---|
| 198 | */
|
---|
| 199 | virtual bool getVisible(void) const;
|
---|
| 200 |
|
---|
| 201 | /** Returns whether or not this object is supposed to be visible or not.
|
---|
| 202 | @remarks
|
---|
| 203 | Takes into account both upper rendering distance and visible flag.
|
---|
| 204 | */
|
---|
| 205 | virtual bool isVisible(void) const;
|
---|
| 206 |
|
---|
| 207 | /** Sets the distance at which the object is no longer rendered.
|
---|
| 208 | @param dist Distance beyond which the object will not be rendered
|
---|
| 209 | (the default is 0, which means objects are always rendered).
|
---|
| 210 | */
|
---|
| 211 | virtual void setRenderingDistance(Real dist) {
|
---|
| 212 | mUpperDistance = dist;
|
---|
| 213 | mSquaredUpperDistance = mUpperDistance * mUpperDistance;
|
---|
| 214 | }
|
---|
| 215 |
|
---|
| 216 | /** Gets the distance at which batches are no longer rendered. */
|
---|
| 217 | virtual Real getRenderingDistance(void) const { return mUpperDistance; }
|
---|
| 218 |
|
---|
| 219 | /** Call this to associate your own custom user object instance with this MovableObject.
|
---|
| 220 | @remarks
|
---|
| 221 | By simply making your game / application object a subclass of UserDefinedObject, you
|
---|
| 222 | can establish a link between an OGRE instance of MovableObject and your own application
|
---|
| 223 | classes. Call this method to establish the link.
|
---|
| 224 | */
|
---|
| 225 | virtual void setUserObject(UserDefinedObject* obj) { mUserAny = Any(obj); }
|
---|
| 226 | /** Retrieves a pointer to a custom application object associated with this movable by an earlier
|
---|
| 227 | call to setUserObject.
|
---|
| 228 | */
|
---|
| 229 | virtual UserDefinedObject* getUserObject(void)
|
---|
| 230 | {
|
---|
| 231 | return mUserAny.isEmpty() ? 0 : any_cast<UserDefinedObject*>(mUserAny);
|
---|
| 232 | }
|
---|
| 233 |
|
---|
| 234 | /** Sets any kind of user value on this object.
|
---|
| 235 | @remarks
|
---|
| 236 | This method allows you to associate any user value you like with
|
---|
| 237 | this MovableObject. This can be a pointer back to one of your own
|
---|
| 238 | classes for instance.
|
---|
| 239 | @note This value is shared with setUserObject so don't use both!
|
---|
| 240 | */
|
---|
| 241 | virtual void setUserAny(const Any& anything) { mUserAny = anything; }
|
---|
| 242 |
|
---|
| 243 | /** Retrieves the custom user value associated with this object.
|
---|
| 244 | */
|
---|
| 245 | virtual const Any& getUserAny(void) const { return mUserAny; }
|
---|
| 246 |
|
---|
| 247 | /** Sets the render queue group this entity will be rendered through.
|
---|
| 248 | @remarks
|
---|
| 249 | Render queues are grouped to allow you to more tightly control the ordering
|
---|
| 250 | of rendered objects. If you do not call this method, all Entity objects default
|
---|
| 251 | to the default queue (RenderQueue::getDefaultQueueGroup), which is fine for most objects. You may want to alter this
|
---|
| 252 | if you want this entity to always appear in front of other objects, e.g. for
|
---|
| 253 | a 3D menu system or such.
|
---|
| 254 | @par
|
---|
| 255 | See RenderQueue for more details.
|
---|
| 256 | @param queueID Enumerated value of the queue group to use.
|
---|
| 257 | */
|
---|
| 258 | virtual void setRenderQueueGroup(uint8 queueID);
|
---|
| 259 |
|
---|
| 260 | /** Gets the queue group for this entity, see setRenderQueueGroup for full details. */
|
---|
| 261 | virtual uint8 getRenderQueueGroup(void) const;
|
---|
| 262 |
|
---|
| 263 | /// return the full transformation of the parent sceneNode or the attachingPoint node
|
---|
| 264 | virtual const Matrix4& _getParentNodeFullTransform(void) const;
|
---|
| 265 |
|
---|
| 266 | /** Sets the query flags for this object.
|
---|
| 267 | @remarks
|
---|
| 268 | When performing a scene query, this object will be included or excluded according
|
---|
| 269 | to flags on the object and flags on the query. This is a bitwise value, so only when
|
---|
| 270 | a bit on these flags is set, will it be included in a query asking for that flag. The
|
---|
| 271 | meaning of the bits is application-specific.
|
---|
| 272 | */
|
---|
| 273 | virtual void setQueryFlags(uint32 flags) { mQueryFlags = flags; }
|
---|
| 274 |
|
---|
| 275 | /** As setQueryFlags, except the flags passed as parameters are appended to the
|
---|
| 276 | existing flags on this object. */
|
---|
| 277 | virtual void addQueryFlags(uint32 flags) { mQueryFlags |= flags; }
|
---|
| 278 |
|
---|
| 279 | /** As setQueryFlags, except the flags passed as parameters are removed from the
|
---|
| 280 | existing flags on this object. */
|
---|
| 281 | virtual void removeQueryFlags(unsigned long flags) { mQueryFlags &= ~flags; }
|
---|
| 282 |
|
---|
| 283 | /// Returns the query flags relevant for this object
|
---|
| 284 | virtual uint32 getQueryFlags(void) const { return mQueryFlags; }
|
---|
| 285 |
|
---|
| 286 | /** Set the default query flags for all future MovableObject instances.
|
---|
| 287 | */
|
---|
| 288 | static void setDefaultQueryFlags(uint32 flags) { msDefaultQueryFlags = flags; }
|
---|
| 289 |
|
---|
| 290 | /** Get the default query flags for all future MovableObject instances.
|
---|
| 291 | */
|
---|
| 292 | static uint32 getDefaultQueryFlags(uint32 flags) { return msDefaultQueryFlags; }
|
---|
| 293 |
|
---|
| 294 |
|
---|
| 295 | /** Sets the visiblity flags for this object.
|
---|
| 296 | @remarks
|
---|
| 297 | As well as a simple true/false value for visibility (as seen in setVisible),
|
---|
| 298 | you can also set visiblity flags which when 'and'ed with the SceneManager's
|
---|
| 299 | visibility mask can also make an object invisible.
|
---|
| 300 | */
|
---|
| 301 | virtual void setVisibilityFlags(uint32 flags) { mVisibilityFlags = flags; }
|
---|
| 302 |
|
---|
| 303 | /** As setVisibilityFlags, except the flags passed as parameters are appended to the
|
---|
| 304 | existing flags on this object. */
|
---|
| 305 | virtual void addVisibilityFlags(uint32 flags) { mVisibilityFlags |= flags; }
|
---|
| 306 |
|
---|
| 307 | /** As setVisibilityFlags, except the flags passed as parameters are removed from the
|
---|
| 308 | existing flags on this object. */
|
---|
| 309 | virtual void removeVisibilityFlags(uint32 flags) { mVisibilityFlags &= ~flags; }
|
---|
| 310 |
|
---|
| 311 | /// Returns the visibility flags relevant for this object
|
---|
| 312 | virtual uint32 getVisibilityFlags(void) const { return mVisibilityFlags; }
|
---|
| 313 |
|
---|
| 314 | /** Set the default visibility flags for all future MovableObject instances.
|
---|
| 315 | */
|
---|
| 316 | static void setDefaultVisibilityFlags(uint32 flags) { msDefaultVisibilityFlags = flags; }
|
---|
| 317 |
|
---|
| 318 | /** Get the default visibility flags for all future MovableObject instances.
|
---|
| 319 | */
|
---|
| 320 | static uint32 getDefaultVisibilityFlags(uint32 flags) { return msDefaultVisibilityFlags; }
|
---|
| 321 |
|
---|
| 322 | /// Define a default implementation of method from ShadowCaster which implements no shadows
|
---|
| 323 | EdgeData* getEdgeList(void) { return NULL; }
|
---|
| 324 | /// Define a default implementation of method from ShadowCaster which implements no shadows
|
---|
| 325 | ShadowRenderableListIterator getShadowVolumeRenderableIterator(
|
---|
| 326 | ShadowTechnique shadowTechnique, const Light* light,
|
---|
| 327 | HardwareIndexBufferSharedPtr* indexBuffer,
|
---|
| 328 | bool extrudeVertices, Real extrusionDist, unsigned long flags = 0);
|
---|
| 329 |
|
---|
| 330 | /** Overridden member from ShadowCaster. */
|
---|
| 331 | const AxisAlignedBox& getLightCapBounds(void) const;
|
---|
| 332 | /** Overridden member from ShadowCaster. */
|
---|
| 333 | const AxisAlignedBox& getDarkCapBounds(const Light& light, Real dirLightExtrusionDist) const;
|
---|
| 334 | /** Sets whether or not this object will cast shadows.
|
---|
| 335 | @remarks
|
---|
| 336 | This setting simply allows you to turn on/off shadows for a given object.
|
---|
| 337 | An object will not cast shadows unless the scene supports it in any case
|
---|
| 338 | (see SceneManager::setShadowTechnique), and also the material which is
|
---|
| 339 | in use must also have shadow casting enabled. By default all entities cast
|
---|
| 340 | shadows. If, however, for some reason you wish to disable this for a single
|
---|
| 341 | object then you can do so using this method.
|
---|
| 342 | @note This method normally refers to objects which block the light, but
|
---|
| 343 | since Light is also a subclass of MovableObject, in that context it means
|
---|
| 344 | whether the light causes shadows itself.
|
---|
| 345 | */
|
---|
| 346 | void setCastShadows(bool enabled) { mCastShadows = enabled; }
|
---|
| 347 | /** Returns whether shadow casting is enabled for this object. */
|
---|
| 348 | bool getCastShadows(void) const { return mCastShadows; }
|
---|
| 349 | /** Get the distance to extrude for a point/spot light */
|
---|
| 350 | Real getPointExtrusionDistance(const Light* l) const;
|
---|
| 351 | /** Get the 'type flags' for this MovableObject.
|
---|
| 352 | @remarks
|
---|
| 353 | A type flag identifies the type of the MovableObject as a bitpattern.
|
---|
| 354 | This is used for categorical inclusion / exclusion in SceneQuery
|
---|
| 355 | objects. By default, this method returns all ones for objects not
|
---|
| 356 | created by a MovableObjectFactory (hence always including them);
|
---|
| 357 | otherwise it returns the value assigned to the MovableObjectFactory.
|
---|
| 358 | Custom objects which don't use MovableObjectFactory will need to
|
---|
| 359 | override this if they want to be included in queries.
|
---|
| 360 | */
|
---|
| 361 | virtual uint32 getTypeFlags(void) const;
|
---|
| 362 |
|
---|
| 363 |
|
---|
| 364 |
|
---|
| 365 |
|
---|
| 366 |
|
---|
| 367 | };
|
---|
| 368 |
|
---|
| 369 | /** Interface definition for a factory class which produces a certain
|
---|
| 370 | kind of MovableObject, and can be registered with Root in order
|
---|
| 371 | to allow all clients to produce new instances of this object, integrated
|
---|
| 372 | with the standard Ogre processing.
|
---|
| 373 | */
|
---|
| 374 | class _OgreExport MovableObjectFactory
|
---|
| 375 | {
|
---|
| 376 | protected:
|
---|
| 377 | /// Type flag, allocated if requested
|
---|
| 378 | unsigned long mTypeFlag;
|
---|
| 379 |
|
---|
| 380 | /// Internal implementation of create method - must be overridden
|
---|
| 381 | virtual MovableObject* createInstanceImpl(
|
---|
| 382 | const String& name, const NameValuePairList* params = 0) = 0;
|
---|
| 383 | public:
|
---|
| 384 | MovableObjectFactory() : mTypeFlag(0xFFFFFFFF) {}
|
---|
| 385 | virtual ~MovableObjectFactory() {}
|
---|
| 386 | /// Get the type of the object to be created
|
---|
| 387 | virtual const String& getType(void) const = 0;
|
---|
| 388 |
|
---|
| 389 | /** Create a new instance of the object.
|
---|
| 390 | @param name The name of the new object
|
---|
| 391 | @param manager The SceneManager instance that will be holding the
|
---|
| 392 | instance once created.
|
---|
| 393 | @param params Name/value pair list of additional parameters required to
|
---|
| 394 | construct the object (defined per subtype). Optional.
|
---|
| 395 | */
|
---|
| 396 | virtual MovableObject* createInstance(
|
---|
| 397 | const String& name, SceneManager* manager,
|
---|
| 398 | const NameValuePairList* params = 0);
|
---|
| 399 | /** Destroy an instance of the object */
|
---|
| 400 | virtual void destroyInstance(MovableObject* obj) = 0;
|
---|
| 401 |
|
---|
| 402 | /** Does this factory require the allocation of a 'type flag', used to
|
---|
| 403 | selectively include / exclude this type from scene queries?
|
---|
| 404 | @remarks
|
---|
| 405 | The default implementation here is to return 'false', ie not to
|
---|
| 406 | request a unique type mask from Root. For objects that
|
---|
| 407 | never need to be excluded in SceneQuery results, that's fine, since
|
---|
| 408 | the default implementation of MovableObject::getTypeFlags is to return
|
---|
| 409 | all ones, hence matching any query type mask. However, if you want the
|
---|
| 410 | objects created by this factory to be filterable by queries using a
|
---|
| 411 | broad type, you have to give them a (preferably unique) type mask -
|
---|
| 412 | and given that you don't know what other MovableObject types are
|
---|
| 413 | registered, Root will allocate you one.
|
---|
| 414 | */
|
---|
| 415 | virtual bool requestTypeFlags(void) const { return false; }
|
---|
| 416 | /** Notify this factory of the type mask to apply.
|
---|
| 417 | @remarks
|
---|
| 418 | This should normally only be called by Root in response to
|
---|
| 419 | a 'true' result from requestTypeMask. However, you can actually use
|
---|
| 420 | it yourself if you're careful; for example to assign the same mask
|
---|
| 421 | to a number of different types of object, should you always wish them
|
---|
| 422 | to be treated the same in queries.
|
---|
| 423 | */
|
---|
| 424 | void _notifyTypeFlags(unsigned long flag) { mTypeFlag = flag; }
|
---|
| 425 |
|
---|
| 426 | /** Gets the type flag for this factory.
|
---|
| 427 | @remarks
|
---|
| 428 | A type flag is like a query flag, except that it applies to all instances
|
---|
| 429 | of a certain type of object.
|
---|
| 430 | */
|
---|
| 431 | unsigned long getTypeFlags(void) const { return mTypeFlag; }
|
---|
| 432 |
|
---|
| 433 | };
|
---|
| 434 |
|
---|
| 435 | }
|
---|
| 436 | #endif
|
---|