/usr/include/OGRE/OgreMovableObject.h is in libogre-dev 1.7.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | /*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2011 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __MovableObject_H__
#define __MovableObject_H__
// Precompiler options
#include "OgrePrerequisites.h"
#include "OgreRenderQueue.h"
#include "OgreAxisAlignedBox.h"
#include "OgreSphere.h"
#include "OgreShadowCaster.h"
#include "OgreFactoryObj.h"
#include "OgreAnimable.h"
#include "OgreAny.h"
#include "OgreUserObjectBindings.h"
namespace Ogre {
// Forward declaration
class MovableObjectFactory;
/** \addtogroup Core
* @{
*/
/** \addtogroup Scene
* @{
*/
/** Abstract class defining a movable object in a scene.
@remarks
Instances of this class are discrete, relatively small, movable objects
which are attached to SceneNode objects to define their position.
*/
class _OgreExport MovableObject : public ShadowCaster, public AnimableObject, public MovableAlloc
{
public:
/** Listener which gets called back on MovableObject events.
*/
class _OgreExport Listener
{
public:
Listener(void) {}
virtual ~Listener() {}
/** MovableObject is being destroyed */
virtual void objectDestroyed(MovableObject*) {}
/** MovableObject has been attached to a node */
virtual void objectAttached(MovableObject*) {}
/** MovableObject has been detached from a node */
virtual void objectDetached(MovableObject*) {}
/** MovableObject has been moved */
virtual void objectMoved(MovableObject*) {}
/** Called when the movable object of the camera to be used for rendering.
@returns
true if allows queue for rendering, false otherwise.
*/
virtual bool objectRendering(const MovableObject*, const Camera*) { return true; }
/** Called when the movable object needs to query a light list.
@remarks
If you want to customize light finding for this object, you should override
this method and hook into MovableObject via MovableObject::setListener.
Be aware that the default method caches results within a frame to
prevent unnecessary recalculation, so if you override this you
should provide your own caching to maintain performance.
@note
If you use texture shadows, there is an additional restriction -
since the lights which should have shadow textures rendered for
them are determined based on the entire frustum, and not per-object,
it is important that the lights returned at the start of this
list (up to the number of shadow textures available) are the same
lights that were used to generate the shadow textures,
and they are in the same order (particularly for additive effects).
@note
This method will not be called for additive stencil shadows since the
light list cannot be varied per object with this technique.
@returns
A pointer to a light list if you populated the light list yourself, or
NULL to fall back on the default finding process.
*/
virtual const LightList* objectQueryLights(const MovableObject*) { return 0; }
};
protected:
/// Name of this object
String mName;
/// Creator of this object (if created by a factory)
MovableObjectFactory* mCreator;
/// SceneManager holding this object (if applicable)
SceneManager* mManager;
/// node to which this object is attached
Node* mParentNode;
bool mParentIsTagPoint;
/// Is this object visible?
bool mVisible;
/// Is debug display enabled?
bool mDebugDisplay;
/// Upper distance to still render
Real mUpperDistance;
Real mSquaredUpperDistance;
/// Hidden because of distance?
bool mBeyondFarDistance;
/// User objects binding.
UserObjectBindings mUserObjectBindings;
/// The render queue to use when rendering this object
uint8 mRenderQueueID;
/// Flags whether the RenderQueue's default should be used.
bool mRenderQueueIDSet;
/// The render queue group to use when rendering this object
ushort mRenderQueuePriority;
/// Flags whether the RenderQueue's default should be used.
bool mRenderQueuePrioritySet;
/// Flags determining whether this object is included / excluded from scene queries
uint32 mQueryFlags;
/// Flags determining whether this object is visible (compared to SceneManager mask)
uint32 mVisibilityFlags;
/// Cached world AABB of this object
mutable AxisAlignedBox mWorldAABB;
// Cached world bounding sphere
mutable Sphere mWorldBoundingSphere;
/// World space AABB of this object's dark cap
mutable AxisAlignedBox mWorldDarkCapBounds;
/// Does this object cast shadows?
bool mCastShadows;
/// Does rendering this object disabled by listener?
bool mRenderingDisabled;
/// MovableObject listener - only one allowed (no list) for size & performance reasons. */
Listener* mListener;
/// List of lights for this object
mutable LightList mLightList;
/// The last frame that this light list was updated in
mutable ulong mLightListUpdated;
/// the light mask defined for this movable. This will be taken into consideration when deciding which light should affect this movable
uint32 mLightMask;
// Static members
/// Default query flags
static uint32 msDefaultQueryFlags;
/// Default visibility flags
static uint32 msDefaultVisibilityFlags;
public:
/// Constructor
MovableObject();
/// Named constructor
MovableObject(const String& name);
/** Virtual destructor - read Scott Meyers if you don't know why this is needed.
*/
virtual ~MovableObject();
/** Notify the object of it's creator (internal use only) */
virtual void _notifyCreator(MovableObjectFactory* fact) { mCreator = fact; }
/** Get the creator of this object, if any (internal use only) */
virtual MovableObjectFactory* _getCreator(void) const { return mCreator; }
/** Notify the object of it's manager (internal use only) */
virtual void _notifyManager(SceneManager* man) { mManager = man; }
/** Get the manager of this object, if any (internal use only) */
virtual SceneManager* _getManager(void) const { return mManager; }
/** Returns the name of this object. */
virtual const String& getName(void) const { return mName; }
/** Returns the type name of this object. */
virtual const String& getMovableType(void) const = 0;
/** Returns the node to which this object is attached.
@remarks
A MovableObject may be attached to either a SceneNode or to a TagPoint,
the latter case if it's attached to a bone on an animated entity.
Both are Node subclasses so this method will return either.
*/
virtual Node* getParentNode(void) const;
/** Returns the scene node to which this object is attached.
@remarks
A MovableObject may be attached to either a SceneNode or to a TagPoint,
the latter case if it's attached to a bone on an animated entity.
This method will return the scene node of the parent entity
if the latter is true.
*/
virtual SceneNode* getParentSceneNode(void) const;
/// Gets whether the parent node is a TagPoint (or a SceneNode)
virtual bool isParentTagPoint() const { return mParentIsTagPoint; }
/** Internal method called to notify the object that it has been attached to a node.
*/
virtual void _notifyAttached(Node* parent, bool isTagPoint = false);
/** Returns true if this object is attached to a SceneNode or TagPoint. */
virtual bool isAttached(void) const;
/** Detaches an object from a parent SceneNode or TagPoint, if attached. */
virtual void detachFromParent(void);
/** Returns true if this object is attached to a SceneNode or TagPoint,
and this SceneNode / TagPoint is currently in an active part of the
scene graph. */
virtual bool isInScene(void) const;
/** Internal method called to notify the object that it has been moved.
*/
virtual void _notifyMoved(void);
/** Internal method to notify the object of the camera to be used for the next rendering operation.
@remarks
Certain objects may want to do specific processing based on the camera position. This method notifies
them in case they wish to do this.
*/
virtual void _notifyCurrentCamera(Camera* cam);
/** Retrieves the local axis-aligned bounding box for this object.
@remarks
This bounding box is in local coordinates.
*/
virtual const AxisAlignedBox& getBoundingBox(void) const = 0;
/** Retrieves the radius of the origin-centered bounding sphere
for this object.
*/
virtual Real getBoundingRadius(void) const = 0;
/** Retrieves the axis-aligned bounding box for this object in world coordinates. */
virtual const AxisAlignedBox& getWorldBoundingBox(bool derive = false) const;
/** Retrieves the worldspace bounding sphere for this object. */
virtual const Sphere& getWorldBoundingSphere(bool derive = false) const;
/** Internal method by which the movable object must add Renderable subclass instances to the rendering queue.
@remarks
The engine will call this method when this object is to be rendered. The object must then create one or more
Renderable subclass instances which it places on the passed in Queue for rendering.
*/
virtual void _updateRenderQueue(RenderQueue* queue) = 0;
/** Tells this object whether to be visible or not, if it has a renderable component.
@note An alternative approach of making an object invisible is to detach it
from it's SceneNode, or to remove the SceneNode entirely.
Detaching a node means that structurally the scene graph changes.
Once this change has taken place, the objects / nodes that have been
removed have less overhead to the visibility detection pass than simply
making the object invisible, so if you do this and leave the objects
out of the tree for a long time, it's faster. However, the act of
detaching / reattaching nodes is in itself more expensive than
setting an object visibility flag, since in the latter case
structural changes are not made. Therefore, small or frequent visibility
changes are best done using this method; large or more longer term
changes are best done by detaching.
*/
virtual void setVisible(bool visible);
/** Gets this object whether to be visible or not, if it has a renderable component.
@remarks
Returns the value set by MovableObject::setVisible only.
*/
virtual bool getVisible(void) const;
/** Returns whether or not this object is supposed to be visible or not.
@remarks
Takes into account both upper rendering distance and visible flag.
*/
virtual bool isVisible(void) const;
/** Sets the distance at which the object is no longer rendered.
@param dist Distance beyond which the object will not be rendered
(the default is 0, which means objects are always rendered).
*/
virtual void setRenderingDistance(Real dist) {
mUpperDistance = dist;
mSquaredUpperDistance = mUpperDistance * mUpperDistance;
}
/** Gets the distance at which batches are no longer rendered. */
virtual Real getRenderingDistance(void) const { return mUpperDistance; }
/** @deprecated use UserObjectBindings::setUserAny via getUserObjectBindings() instead.
Sets any kind of user value on this object.
@remarks
This method allows you to associate any user value you like with
this MovableObject. This can be a pointer back to one of your own
classes for instance.
*/
virtual void setUserAny(const Any& anything) { getUserObjectBindings().setUserAny(anything); }
/** @deprecated use UserObjectBindings::getUserAny via getUserObjectBindings() instead.
Retrieves the custom user value associated with this object.
*/
virtual const Any& getUserAny(void) const { return getUserObjectBindings().getUserAny(); }
/** Return an instance of user objects binding associated with this class.
You can use it to associate one or more custom objects with this class instance.
@see UserObjectBindings::setUserAny.
*/
UserObjectBindings& getUserObjectBindings() { return mUserObjectBindings; }
/** Return an instance of user objects binding associated with this class.
You can use it to associate one or more custom objects with this class instance.
@see UserObjectBindings::setUserAny.
*/
const UserObjectBindings& getUserObjectBindings() const { return mUserObjectBindings; }
/** Sets the render queue group this entity will be rendered through.
@remarks
Render queues are grouped to allow you to more tightly control the ordering
of rendered objects. If you do not call this method, all Entity objects default
to the default queue (RenderQueue::getDefaultQueueGroup), which is fine for most objects. You may want to alter this
if you want this entity to always appear in front of other objects, e.g. for
a 3D menu system or such.
@par
See RenderQueue for more details.
@param queueID Enumerated value of the queue group to use. See the
enum RenderQueueGroupID for what kind of values can be used here.
*/
virtual void setRenderQueueGroup(uint8 queueID);
/** Sets the render queue group and group priority this entity will be rendered through.
@remarks
Render queues are grouped to allow you to more tightly control the ordering
of rendered objects. Within a single render group there another type of grouping
called priority which allows further control. If you do not call this method,
all Entity objects default to the default queue and priority
(RenderQueue::getDefaultQueueGroup, RenderQueue::getDefaultRenderablePriority),
which is fine for most objects. You may want to alter this if you want this entity
to always appear in front of other objects, e.g. for a 3D menu system or such.
@par
See RenderQueue for more details.
@param queueID Enumerated value of the queue group to use. See the
enum RenderQueueGroupID for what kind of values can be used here.
@param priority The priority within a group to use.
*/
virtual void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority);
/** Gets the queue group for this entity, see setRenderQueueGroup for full details. */
virtual uint8 getRenderQueueGroup(void) const;
/// return the full transformation of the parent sceneNode or the attachingPoint node
virtual const Matrix4& _getParentNodeFullTransform(void) const;
/** Sets the query flags for this object.
@remarks
When performing a scene query, this object will be included or excluded according
to flags on the object and flags on the query. This is a bitwise value, so only when
a bit on these flags is set, will it be included in a query asking for that flag. The
meaning of the bits is application-specific.
*/
virtual void setQueryFlags(uint32 flags) { mQueryFlags = flags; }
/** As setQueryFlags, except the flags passed as parameters are appended to the
existing flags on this object. */
virtual void addQueryFlags(uint32 flags) { mQueryFlags |= flags; }
/** As setQueryFlags, except the flags passed as parameters are removed from the
existing flags on this object. */
virtual void removeQueryFlags(uint32 flags) { mQueryFlags &= ~flags; }
/// Returns the query flags relevant for this object
virtual uint32 getQueryFlags(void) const { return mQueryFlags; }
/** Set the default query flags for all future MovableObject instances.
*/
static void setDefaultQueryFlags(uint32 flags) { msDefaultQueryFlags = flags; }
/** Get the default query flags for all future MovableObject instances.
*/
static uint32 getDefaultQueryFlags() { return msDefaultQueryFlags; }
/** Sets the visiblity flags for this object.
@remarks
As well as a simple true/false value for visibility (as seen in setVisible),
you can also set visiblity flags which when 'and'ed with the SceneManager's
visibility mask can also make an object invisible.
*/
virtual void setVisibilityFlags(uint32 flags) { mVisibilityFlags = flags; }
/** As setVisibilityFlags, except the flags passed as parameters are appended to the
existing flags on this object. */
virtual void addVisibilityFlags(uint32 flags) { mVisibilityFlags |= flags; }
/** As setVisibilityFlags, except the flags passed as parameters are removed from the
existing flags on this object. */
virtual void removeVisibilityFlags(uint32 flags) { mVisibilityFlags &= ~flags; }
/// Returns the visibility flags relevant for this object
virtual uint32 getVisibilityFlags(void) const { return mVisibilityFlags; }
/** Set the default visibility flags for all future MovableObject instances.
*/
static void setDefaultVisibilityFlags(uint32 flags) { msDefaultVisibilityFlags = flags; }
/** Get the default visibility flags for all future MovableObject instances.
*/
static uint32 getDefaultVisibilityFlags() { return msDefaultVisibilityFlags; }
/** Sets a listener for this object.
@remarks
Note for size and performance reasons only one listener per object
is allowed.
*/
virtual void setListener(Listener* listener) { mListener = listener; }
/** Gets the current listener for this object.
*/
virtual Listener* getListener(void) const { return mListener; }
/** Gets a list of lights, ordered relative to how close they are to this movable object.
@remarks
By default, this method gives the listener a chance to populate light list first,
if there is no listener or Listener::objectQueryLights returns NULL, it'll
query the light list from parent entity if it is present, or returns
SceneNode::findLights if it has parent scene node, otherwise it just returns
an empty list.
@par
The object internally caches the light list, so it will recalculate
it only when object is moved, or lights that affect the frustum have
been changed (@see SceneManager::_getLightsDirtyCounter),
but if listener exists, it will be called each time, so the listener
should implement their own cache mechanism to optimise performance.
@par
This method can be useful when implementing Renderable::getLights in case
the renderable is a part of the movable.
@returns The list of lights use to lighting this object.
*/
virtual const LightList& queryLights(void) const;
/** Get a bitwise mask which will filter the lights affecting this object
@remarks
By default, this mask is fully set meaning all lights will affect this object
*/
virtual uint32 getLightMask()const { return mLightMask; }
/** Set a bitwise mask which will filter the lights affecting this object
@remarks
This mask will be compared against the mask held against Light to determine
if a light should affect a given object.
By default, this mask is fully set meaning all lights will affect this object
*/
virtual void setLightMask(uint32 lightMask);
/** Returns a pointer to the current list of lights for this object.
@remarks
You should not modify this list outside of MovableObject::Listener::objectQueryLights
(say if you want to use it to implement this method, and use the pointer
as a return value) and for reading it's only accurate as at the last frame.
*/
virtual LightList* _getLightList() { return &mLightList; }
/// Define a default implementation of method from ShadowCaster which implements no shadows
EdgeData* getEdgeList(void) { return NULL; }
/// Define a default implementation of method from ShadowCaster which implements no shadows
bool hasEdgeList(void) { return false; }
/// Define a default implementation of method from ShadowCaster which implements no shadows
ShadowRenderableListIterator getShadowVolumeRenderableIterator(
ShadowTechnique shadowTechnique, const Light* light,
HardwareIndexBufferSharedPtr* indexBuffer,
bool extrudeVertices, Real extrusionDist, unsigned long flags = 0);
/** Overridden member from ShadowCaster. */
const AxisAlignedBox& getLightCapBounds(void) const;
/** Overridden member from ShadowCaster. */
const AxisAlignedBox& getDarkCapBounds(const Light& light, Real dirLightExtrusionDist) const;
/** Sets whether or not this object will cast shadows.
@remarks
This setting simply allows you to turn on/off shadows for a given object.
An object will not cast shadows unless the scene supports it in any case
(see SceneManager::setShadowTechnique), and also the material which is
in use must also have shadow casting enabled. By default all entities cast
shadows. If, however, for some reason you wish to disable this for a single
object then you can do so using this method.
@note This method normally refers to objects which block the light, but
since Light is also a subclass of MovableObject, in that context it means
whether the light causes shadows itself.
*/
void setCastShadows(bool enabled) { mCastShadows = enabled; }
/** Returns whether shadow casting is enabled for this object. */
bool getCastShadows(void) const { return mCastShadows; }
/** Returns whether the Material of any Renderable that this MovableObject will add to
the render queue will receive shadows.
*/
bool getReceivesShadows();
/** Get the distance to extrude for a point/spot light */
Real getPointExtrusionDistance(const Light* l) const;
/** Get the 'type flags' for this MovableObject.
@remarks
A type flag identifies the type of the MovableObject as a bitpattern.
This is used for categorical inclusion / exclusion in SceneQuery
objects. By default, this method returns all ones for objects not
created by a MovableObjectFactory (hence always including them);
otherwise it returns the value assigned to the MovableObjectFactory.
Custom objects which don't use MovableObjectFactory will need to
override this if they want to be included in queries.
*/
virtual uint32 getTypeFlags(void) const;
/** Method to allow a caller to abstractly iterate over the Renderable
instances that this MovableObject will add to the render queue when
asked, if any.
@param visitor Pointer to a class implementing the Renderable::Visitor
interface which will be called back for each Renderable which will
be queued. Bear in mind that the state of the Renderable instances
may not be finalised depending on when you call this.
@param debugRenderables If false, only regular renderables will be visited
(those for normal display). If true, debug renderables will be
included too.
*/
virtual void visitRenderables(Renderable::Visitor* visitor,
bool debugRenderables = false) = 0;
/** Sets whether or not the debug display of this object is enabled.
@remarks
Some objects aren't visible themselves but it can be useful to display
a debug representation of them. Or, objects may have an additional
debug display on top of their regular display. This option enables /
disables that debug display. Objects that are not visible never display
debug geometry regardless of this setting.
*/
virtual void setDebugDisplayEnabled(bool enabled) { mDebugDisplay = enabled; }
/// Gets whether debug display of this object is enabled.
virtual bool isDebugDisplayEnabled(void) const { return mDebugDisplay; }
};
/** Interface definition for a factory class which produces a certain
kind of MovableObject, and can be registered with Root in order
to allow all clients to produce new instances of this object, integrated
with the standard Ogre processing.
*/
class _OgreExport MovableObjectFactory : public MovableAlloc
{
protected:
/// Type flag, allocated if requested
unsigned long mTypeFlag;
/// Internal implementation of create method - must be overridden
virtual MovableObject* createInstanceImpl(
const String& name, const NameValuePairList* params = 0) = 0;
public:
MovableObjectFactory() : mTypeFlag(0xFFFFFFFF) {}
virtual ~MovableObjectFactory() {}
/// Get the type of the object to be created
virtual const String& getType(void) const = 0;
/** Create a new instance of the object.
@param name The name of the new object
@param manager The SceneManager instance that will be holding the
instance once created.
@param params Name/value pair list of additional parameters required to
construct the object (defined per subtype). Optional.
*/
virtual MovableObject* createInstance(
const String& name, SceneManager* manager,
const NameValuePairList* params = 0);
/** Destroy an instance of the object */
virtual void destroyInstance(MovableObject* obj) = 0;
/** Does this factory require the allocation of a 'type flag', used to
selectively include / exclude this type from scene queries?
@remarks
The default implementation here is to return 'false', ie not to
request a unique type mask from Root. For objects that
never need to be excluded in SceneQuery results, that's fine, since
the default implementation of MovableObject::getTypeFlags is to return
all ones, hence matching any query type mask. However, if you want the
objects created by this factory to be filterable by queries using a
broad type, you have to give them a (preferably unique) type mask -
and given that you don't know what other MovableObject types are
registered, Root will allocate you one.
*/
virtual bool requestTypeFlags(void) const { return false; }
/** Notify this factory of the type mask to apply.
@remarks
This should normally only be called by Root in response to
a 'true' result from requestTypeMask. However, you can actually use
it yourself if you're careful; for example to assign the same mask
to a number of different types of object, should you always wish them
to be treated the same in queries.
*/
void _notifyTypeFlags(unsigned long flag) { mTypeFlag = flag; }
/** Gets the type flag for this factory.
@remarks
A type flag is like a query flag, except that it applies to all instances
of a certain type of object.
*/
uint32 getTypeFlags(void) const { return mTypeFlag; }
};
/** @} */
/** @} */
}
#endif
|