sceneObject.h
Engine/source/scene/sceneObject.h
Classes:
class
A 3D object.
class
Mounted object.
class
Iterator over the zones that the object is assigned to.
class
Bidirectional link between a zone manager and its objects.
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _SCENEOBJECT_H_ 25#define _SCENEOBJECT_H_ 26 27#ifndef _NETOBJECT_H_ 28#include "sim/netObject.h" 29#endif 30 31#ifndef _COLLISION_H_ 32#include "collision/collision.h" 33#endif 34 35#ifndef _OBJECTTYPES_H_ 36#include "T3D/objectTypes.h" 37#endif 38 39#ifndef _COLOR_H_ 40#include "core/color.h" 41#endif 42 43#ifndef _BITSET_H_ 44#include "core/bitSet.h" 45#endif 46 47#ifndef _PROCESSLIST_H_ 48#include "T3D/gameBase/processList.h" 49#endif 50 51#ifndef _SCENECONTAINER_H_ 52#include "scene/sceneContainer.h" 53#endif 54 55#ifndef _GFXDEVICE_H_ 56#include "gfx/gfxDevice.h" 57#endif 58 59 60class SceneManager; 61class SceneRenderState; 62class SceneTraversalState; 63class SceneCameraState; 64class SceneObjectLink; 65class SceneObjectLightingPlugin; 66 67class Convex; 68class LightInfo; 69class SFXAmbience; 70 71struct ObjectRenderInst; 72struct Move; 73 74 75/// A 3D object. 76/// 77/// @section SceneObject_intro Introduction 78/// 79/// SceneObject exists as a foundation for 3D objects in Torque. It provides the 80/// basic functionality for: 81/// - A scene graph (in the Zones and Portals sections), allowing efficient 82/// and robust rendering of the game scene. 83/// - Various helper functions, including functions to get bounding information 84/// and momentum/velocity. 85/// - Collision detection, as well as ray casting. 86/// - Lighting. SceneObjects can register lights both at lightmap generation time, 87/// and dynamic lights at runtime (for special effects, such as from flame or 88/// a projectile, or from an explosion). 89/// - Manipulating scene objects, for instance varying scale. 90/// 91/// @section SceneObject_example An Example 92/// 93/// Melv May has written a most marvelous example object deriving from SceneObject. 94/// Unfortunately this page is too small to contain it. 95/// 96/// @see http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3217 97/// for a copy of Melv's example. 98class SceneObject : public NetObject, private SceneContainer::Link, public ProcessObject 99{ 100 public: 101 102 typedef NetObject Parent; 103 104 friend class SceneManager; 105 friend class SceneContainer; 106 friend class SceneZoneSpaceManager; 107 friend class SceneCullingState; // _getZoneRefHead 108 friend class SceneObjectLink; // mSceneObjectLinks 109 110 enum 111 { 112 /// Maximum number of zones that an object can concurrently be assigned to. 113 MaxObjectZones = 128, 114 115 NumMountPoints = 32, 116 NumMountPointBits = 5, 117 }; 118 119 /// Networking dirty mask. 120 enum SceneObjectMasks 121 { 122 InitialUpdateMask = BIT( 0 ), 123 ScaleMask = BIT( 1 ), 124 FlagMask = BIT( 2 ), 125 MountedMask = BIT( 3 ), 126 NextFreeMask = BIT( 4 ) 127 }; 128 129 /// Bit-flags stored in mObjectFlags. 130 /// If a derived class adds more flags they must overload 131 /// getObjectFlagMax to ensure those flags will be transmitted over 132 /// the network. 133 /// @see getObjectFlagMax 134 enum SceneObjectFlags 135 { 136 /// If set, the object can be rendered. 137 /// @note The per-class render disable flag can override the per-object flag. 138 RenderEnabledFlag = BIT( 0 ), 139 140 /// If set, the object can be selected in the editor. 141 /// @note The per-class selection disable flag can override the per-object flag. 142 SelectionEnabledFlag = BIT( 1 ), 143 144 /// If set, object will not be subjected to culling when in the editor. 145 /// This is useful to bypass zone culling and always render certain editor-only 146 /// visual elements (like the zones themselves). 147 DisableCullingInEditorFlag = BIT( 2 ), 148 149 /// If set, object will be used as a visual occluder. In this case, 150 /// the object should implement buildSilhouette() and return a 151 /// *convex* silhouette polygon. 152 VisualOccluderFlag = BIT( 3 ), 153 154 /// If set, object will be used as a sound occluder. 155 SoundOccluderFlag = BIT( 4 ), 156 157 NextFreeFlag = BIT( 5 ) 158 }; 159 160 protected: 161 162 /// Combination of SceneObjectFlags. 163 BitSet32 mObjectFlags; 164 165 /// SceneManager to which this SceneObject belongs. 166 SceneManager* mSceneManager; 167 168 /// Links installed by SceneTrackers attached to this object. 169 SceneObjectLink* mSceneObjectLinks; 170 171 /// SceneObjectLightingPlugin attached to this object. 172 SceneObjectLightingPlugin* mLightPlugin; 173 174 /// Object type mask. 175 /// @see SimObjectTypes 176 U32 mTypeMask; 177 178 /// @name Mounting 179 /// @{ 180 181 /// Mounted object. 182 struct MountInfo 183 { 184 SceneObject* list; ///< Linked-list of objects mounted on this object 185 SceneObject* object; ///< Object this object is mounted on. 186 SceneObject* link; ///< Link to next object mounted to this object's mount 187 S32 node; ///< Node point we are mounted to. 188 MatrixF xfm; 189 }; 190 191 /// 192 MountInfo mMount; 193 194 /// 195 SimPersistID* mMountPID; 196 197 /// @} 198 199 /// @name Zoning 200 /// @{ 201 202 /// Bidirectional link between a zone manager and its objects. 203 struct ZoneRef : public SceneObjectRefBase< ZoneRef > 204 { 205 /// ID of zone. 206 U32 zone; 207 }; 208 209 /// Iterator over the zones that the object is assigned to. 210 /// @note This iterator expects a clean zoning state. It will not update the 211 /// zoning state in case it is dirty. 212 struct ObjectZonesIterator 213 { 214 ObjectZonesIterator( SceneObject* object ) 215 : mCurrent( object->_getZoneRefHead() ) {} 216 217 bool isValid() const 218 { 219 return ( mCurrent != NULL ); 220 } 221 ObjectZonesIterator& operator++() 222 { 223 AssertFatal( isValid(), "SceneObject::ObjectZonesIterator::operator++ - Invalid iterator!" ); 224 mCurrent = mCurrent->nextInObj; 225 return *this; 226 } 227 U32 operator*() const 228 { 229 AssertFatal( isValid(), "SceneObject::ObjectZonesIterator::operator* - Invalid iterator!" ); 230 return mCurrent->zone; 231 } 232 233 private: 234 ZoneRef* mCurrent; 235 }; 236 237 friend struct ObjectZonesIterator; 238 239 /// If an object moves, its zoning state needs to be updated. This is deferred 240 /// to when the state is actually needed and this flag indicates a refresh 241 /// is necessary. 242 mutable bool mZoneRefDirty; 243 244 /// Number of zones this object is assigned to. 245 /// @note If #mZoneRefDirty is set, this might be outdated. 246 mutable U32 mNumCurrZones; 247 248 /// List of zones that this object is part of. 249 /// @note If #mZoneRefDirty is set, this might be outdated. 250 mutable ZoneRef* mZoneRefHead; 251 252 /// Refresh the zoning state of this object, if it isn't up-to-date anymore. 253 void _updateZoningState() const; 254 255 /// Return the first link in the zone list of this object. Each link represents 256 /// a single zone that the object is assigned to. 257 /// 258 /// @note This method will return the zoning list as is. In case the zoning state 259 /// of the object is dirty, the list contents may be outdated. 260 ZoneRef* _getZoneRefHead() const { return mZoneRefHead; } 261 262 /// Gets the number of zones containing this object. 263 U32 _getNumCurrZones() const { return mNumCurrZones; } 264 265 /// Returns the nth zone containing this object. 266 U32 _getCurrZone( const U32 index ) const; 267 268 /// @} 269 270 /// @name Transform and Collision Members 271 /// @{ 272 273 /// Transform from object space to world space. 274 MatrixF mObjToWorld; 275 276 /// Transform from world space to object space (inverse). 277 MatrixF mWorldToObj; 278 279 /// Object scale. 280 Point3F mObjScale; 281 282 /// Bounding box in object space. 283 Box3F mObjBox; 284 285 /// Bounding box (AABB) in world space. 286 Box3F mWorldBox; 287 288 /// Bounding sphere in world space. 289 SphereF mWorldSphere; 290 291 /// Render matrix to transform object space to world space. 292 MatrixF mRenderObjToWorld; 293 294 /// Render matrix to transform world space to object space. 295 MatrixF mRenderWorldToObj; 296 297 /// Render bounding box in world space. 298 Box3F mRenderWorldBox; 299 300 /// Render bounding sphere in world space. 301 SphereF mRenderWorldSphere; 302 303 /// Whether this object is considered to have an infinite bounding box. 304 bool mGlobalBounds; 305 306 /// 307 S32 mCollisionCount; 308 309 /// Regenerates the world-space bounding box and bounding sphere. 310 void resetWorldBox(); 311 312 /// Regenerates the render-world-space bounding box and sphere. 313 void resetRenderWorldBox(); 314 315 /// Regenerates the object-space bounding box from the world-space 316 /// bounding box, the world space to object space transform, and 317 /// the object scale. 318 void resetObjectBox(); 319 320 /// Called when the size of the object changes. 321 virtual void onScaleChanged() {} 322 323 /// @} 324 325 /// Object which must be ticked before this object. 326 SimObjectPtr< SceneObject> mAfterObject; 327 328 /// @name SceneContainer Interface 329 /// 330 /// When objects are searched, we go through all the zones and ask them for 331 /// all of their objects. Because an object can exist in multiple zones, the 332 /// container sequence key is set to the id of the current search. Then, while 333 /// searching, we check to see if an object's sequence key is the same as the 334 /// current search key. If it is, it will NOT be added to the list of returns 335 /// since it has already been processed. 336 /// 337 /// @{ 338 339 /// Container database that the object is assigned to. 340 SceneContainer* mContainer; 341 342 /// SceneContainer sequence key. 343 U32 mContainerSeqKey; 344 345 /// 346 SceneObjectRef* mBinRefHead; 347 348 U32 mBinMinX; 349 U32 mBinMaxX; 350 U32 mBinMinY; 351 U32 mBinMaxY; 352 353 /// Returns the container sequence key. 354 U32 getContainerSeqKey() const { return mContainerSeqKey; } 355 356 /// Sets the container sequence key. 357 void setContainerSeqKey( const U32 key ) { mContainerSeqKey = key; } 358 359 /// @} 360 361 /// Called when this is added to a SceneManager. 362 virtual bool onSceneAdd() { return true; } 363 364 /// Called when this is removed from its current SceneManager. 365 virtual void onSceneRemove() {} 366 367 /// Returns the greatest object flag bit defined. 368 /// Only bits within this range will be transmitted over the network. 369 virtual U32 getObjectFlagMax() const { return NextFreeFlag - 1; } 370 371 public: 372 373 SceneObject(); 374 virtual ~SceneObject(); 375 bool mPathfindingIgnore; 376 377 /// Triggered when a SceneObject onAdd is called. 378 static Signal< void( SceneObject* ) > smSceneObjectAdd; 379 380 /// Triggered when a SceneObject onRemove is called. 381 static Signal< void( SceneObject* ) > smSceneObjectRemove; 382 383 /// Return the type mask that indicates to which broad object categories 384 /// this object belongs. 385 U32 getTypeMask() const { return mTypeMask; } 386 387 /// @name SceneManager Functionality 388 /// @{ 389 390 /// Return the SceneManager that this SceneObject belongs to. 391 SceneManager* getSceneManager() const { return mSceneManager; } 392 393 /// Adds object to the client or server container depending on the object 394 void addToScene(); 395 396 /// Removes the object from the client/server container 397 void removeFromScene(); 398 399 /// Returns a pointer to the container that contains this object 400 SceneContainer* getContainer() { return mContainer; } 401 402 /// @} 403 404 /// @name Flags 405 /// @{ 406 407 /// Return true if this object is rendered. 408 bool isRenderEnabled() const; 409 410 /// Set whether the object gets rendered. 411 void setRenderEnabled( bool value ); 412 413 /// Return true if this object can be selected in the editor. 414 bool isSelectionEnabled() const; 415 416 /// Set whether the object can be selected in the editor. 417 void setSelectionEnabled( bool value ); 418 419 /// Return true if the object doesn't want to be subjected to culling 420 /// when in the editor. 421 bool isCullingDisabledInEditor() const { return mObjectFlags.test( DisableCullingInEditorFlag ); } 422 423 /// Return true if the object should be taken into account for visual occlusion. 424 bool isVisualOccluder() const { return mObjectFlags.test( VisualOccluderFlag ); } 425 426 /// @} 427 428 /// @name Collision and transform related interface 429 /// 430 /// The Render Transform is the interpolated transform with respect to the 431 /// frame rate. The Render Transform will differ from the object transform 432 /// because the simulation is updated in fixed intervals, which controls the 433 /// object transform. The framerate is, most likely, higher than this rate, 434 /// so that is why the render transform is interpolated and will differ slightly 435 /// from the object transform. 436 /// 437 /// @{ 438 439 /// Disables collisions for this object including raycasts 440 virtual void disableCollision(); 441 442 /// Enables collisions for this object 443 virtual void enableCollision(); 444 445 /// Returns true if collisions are enabled 446 bool isCollisionEnabled() const { return mCollisionCount == 0; } 447 448 /// This gets called when an object collides with this object. 449 /// @param object Object colliding with this object 450 /// @param vec Vector along which collision occurred 451 virtual void onCollision( SceneObject *object, const VectorF &vec ) {} 452 453 /// Returns true if this object allows itself to be displaced 454 /// @see displaceObject 455 virtual bool isDisplacable() const { return false; } 456 457 /// Returns the momentum of this object 458 virtual Point3F getMomentum() const { return Point3F( 0, 0, 0 ); } 459 460 /// Sets the momentum of this object 461 /// @param momentum Momentum 462 virtual void setMomentum( const Point3F& momentum ) {} 463 464 /// Returns the mass of this object 465 virtual F32 getMass() const { return 1.f; } 466 467 /// Displaces this object by a vector 468 /// @param displaceVector Displacement vector 469 virtual bool displaceObject( const Point3F& displaceVector ) { return false; } 470 471 /// Returns the transform which can be used to convert object space 472 /// to world space 473 virtual const MatrixF& getTransform() const { return mObjToWorld; } 474 475 /// Returns the transform which can be used to convert world space 476 /// into object space 477 const MatrixF& getWorldTransform() const { return mWorldToObj; } 478 479 /// Returns the scale of the object 480 const VectorF& getScale() const { return mObjScale; } 481 482 /// Returns the bounding box for this object in local coordinates. 483 const Box3F& getObjBox() const { return mObjBox; } 484 485 /// Returns the bounding box for this object in world coordinates. 486 const Box3F& getWorldBox() const { return mWorldBox; } 487 488 /// Returns the bounding sphere for this object in world coordinates. 489 const SphereF& getWorldSphere() const { return mWorldSphere; } 490 491 /// Returns the center of the bounding box in world coordinates 492 Point3F getBoxCenter() const { return ( mWorldBox.minExtents + mWorldBox.maxExtents ) * 0.5f; } 493 494 /// Sets the Object -> World transform 495 /// 496 /// @param mat New transform matrix 497 virtual void setTransform( const MatrixF &mat ); 498 499 /// Sets the scale for the object 500 /// @param scale Scaling values 501 virtual void setScale( const VectorF &scale ); 502 503 /// This sets the render transform for this object 504 /// @param mat New render transform 505 virtual void setRenderTransform(const MatrixF &mat); 506 507 /// Returns the render transform 508 const MatrixF& getRenderTransform() const { return mRenderObjToWorld; } 509 510 /// Returns the render transform to convert world to local coordinates 511 const MatrixF& getRenderWorldTransform() const { return mRenderWorldToObj; } 512 513 /// Returns the render world box 514 const Box3F& getRenderWorldBox() const { return mRenderWorldBox; } 515 516 /// Sets the state of this object as hidden or not. If an object is hidden 517 /// it is removed entirely from collisions, it is not ghosted and is 518 /// essentially "non existant" as far as simulation is concerned. 519 /// @param hidden True if object is to be hidden 520 virtual void setHidden( bool hidden ); 521 522 /// Builds a convex hull for this object. 523 /// 524 /// Think of a convex hull as a low-res mesh which covers, as tightly as 525 /// possible, the object mesh, and is used as a collision mesh. 526 /// @param box 527 /// @param convex Convex mesh generated (out) 528 virtual void buildConvex( const Box3F& box,Convex* convex ) {} 529 530 /// Builds a list of polygons which intersect a bounding volume. 531 /// 532 /// This will use either the sphere or the box, not both, the 533 /// SceneObject implementation ignores sphere. 534 /// 535 /// @see AbstractPolyList 536 /// @param context A contentual hint as to the type of polylist to build. 537 /// @param polyList Poly list build (out) 538 /// @param box Box bounding volume 539 /// @param sphere Sphere bounding volume 540 /// 541 virtual bool buildPolyList( PolyListContext context, 542 AbstractPolyList* polyList, 543 const Box3F& box, 544 const SphereF& sphere ) { return false; } 545 546 /// Casts a ray and obtain collision information, returns true if RayInfo is modified. 547 /// 548 /// @param start Start point of ray 549 /// @param end End point of ray 550 /// @param info Collision information obtained (out) 551 virtual bool castRay( const Point3F& start, const Point3F& end, RayInfo* info ) { return false; } 552 553 /// Casts a ray against rendered geometry, returns true if RayInfo is modified. 554 /// 555 /// @param start Start point of ray 556 /// @param end End point of ray 557 /// @param info Collision information obtained (out) 558 virtual bool castRayRendered( const Point3F& start, const Point3F& end, RayInfo* info ); 559 560 /// Build a world-space silhouette polygon for the object for the given camera settings. 561 /// This is used for occlusion. 562 /// 563 /// @param cameraState Camera view parameters. 564 /// @param outPoints Vector to store the resulting polygon points in. Leave untouched 565 /// if method is not implemented. 566 virtual void buildSilhouette( const SceneCameraState& cameraState, Vector< Point3F>& outPoints ) {} 567 568 /// Return true if the given point is contained by the object's (collision) shape. 569 /// 570 /// The default implementation will return true if the point is within the object's 571 /// bounding box. Subclasses should implement more precise tests. 572 virtual bool containsPoint( const Point3F &point ); 573 574 virtual bool collideBox( const Point3F& start, const Point3F& end, RayInfo* info ); 575 576 /// Returns the position of the object. 577 virtual Point3F getPosition() const; 578 579 /// Returns the render-position of the object. 580 /// 581 /// @see getRenderTransform 582 Point3F getRenderPosition() const; 583 584 /// Sets the position of the object 585 void setPosition ( const Point3F& pos ); 586 587 /// Gets the velocity of the object. 588 virtual Point3F getVelocity() const { return Point3F::Zero; } 589 590 /// Sets the velocity of the object 591 /// @param v Velocity 592 virtual void setVelocity( const Point3F &v ) {} 593 594 /// Applies an impulse force to this object 595 /// @param pos Position where impulse came from in world space 596 /// @param vec Velocity vector (Impulse force F = m * v) 597 virtual void applyImpulse( const Point3F &pos, const VectorF &vec ) {} 598 599 /// Applies a radial impulse to the object 600 /// using the impulse origin and force. 601 /// @param origin Point of origin of the radial impulse. 602 /// @param radius The radius of the impulse area. 603 /// @param magnitude The strength of the impulse. 604 virtual void applyRadialImpulse( const Point3F &origin, F32 radius, F32 magnitude ) {} 605 606 /// Returns the distance from this object to a point 607 /// @param pnt World space point to measure to 608 virtual F32 distanceTo( const Point3F &pnt ) const; 609 610 /// @} 611 612 /// @name Mounting 613 /// @{ 614 615 /// ex: Mount B to A at A's node N 616 /// A.mountObject( B, N ) 617 /// 618 /// @param obj Object to mount 619 /// @param node Mount node ID 620 virtual void mountObject( SceneObject *obj, S32 node, const MatrixF &xfm = MatrixF::Identity ); 621 622 /// Remove an object mounting 623 /// @param obj Object to unmount 624 virtual void unmountObject( SceneObject *obj ); 625 626 /// Unmount this object from it's mount 627 virtual void unmount(); 628 629 /// Callback when this object is mounted. 630 /// @param obj Object we are mounting to. 631 /// @param node Node we are unmounting from. 632 virtual void onMount( SceneObject *obj, S32 node ); 633 634 /// Callback when this object is unmounted. This should be overridden to 635 /// set maskbits or do other object type specific work. 636 /// @param obj Object we are unmounting from. 637 /// @param node Node we are unmounting from. 638 virtual void onUnmount( SceneObject *obj, S32 node ); 639 640 // Returns mount point to world space transform at tick time. 641 virtual void getMountTransform( S32 index, const MatrixF &xfm, MatrixF *outMat ); 642 643 // Returns mount point to world space transform at render time. 644 // Note this will only be correct if called after this object has interpolated. 645 virtual void getRenderMountTransform( F32 delta, S32 index, const MatrixF &xfm, MatrixF *outMat ); 646 647 /// Return the object that this object is mounted to. 648 virtual SceneObject* getObjectMount() { return mMount.object; } 649 650 /// Return object link of next object mounted to this object's mount 651 virtual SceneObject* getMountLink() { return mMount.link; } 652 653 /// Returns object list of objects mounted to this object. 654 virtual SceneObject* getMountList() { return mMount.list; } 655 656 /// Returns the mount id that this is mounted to. 657 virtual U32 getMountNode() { return mMount.node; } 658 659 /// Returns true if this object is mounted to anything at all 660 /// Also try to resolve the PID to objectId here if it is pending. 661 virtual bool isMounted(); 662 663 /// Returns the number of object mounted along with this 664 virtual S32 getMountedObjectCount(); 665 666 /// Returns the object mounted at a position in the mount list 667 /// @param idx Position on the mount list 668 virtual SceneObject* getMountedObject( S32 idx ); 669 670 /// Returns the node the object at idx is mounted to 671 /// @param idx Index 672 virtual S32 getMountedObjectNode( S32 idx ); 673 674 /// Returns the object a object on the mount list is mounted to 675 /// @param node 676 virtual SceneObject* getMountNodeObject( S32 node ); 677 678 void resolveMountPID(); 679 680 /// @} 681 682 /// @name Sound 683 /// @{ 684 685 /// Return whether the object's collision shape is blocking sound. 686 bool isOccludingSound() const { return mObjectFlags.test( SoundOccluderFlag ); } 687 688 /// Return the ambient sound space active inside the volume of this object or NULL if the object does 689 /// not have its own ambient space. 690 virtual SFXAmbience* getSoundAmbience() const { return NULL; } 691 692 /// @} 693 694 /// @name Rendering 695 /// @{ 696 697 /// Called when the SceneManager is ready for the registration of render instances. 698 /// @param state Rendering state. 699 virtual void prepRenderImage( SceneRenderState* state ) {} 700 701 /// @} 702 703 /// @name Lighting 704 /// @{ 705 706 void setLightingPlugin( SceneObjectLightingPlugin* plugin ) { mLightPlugin = plugin; } 707 SceneObjectLightingPlugin* getLightingPlugin() { return mLightPlugin; } 708 709 /// @} 710 711 /// @name Global Bounds 712 /// @{ 713 714 const bool isGlobalBounds() const 715 { 716 return mGlobalBounds; 717 } 718 719 /// If global bounds are set to be true, then the object is assumed to 720 /// have an infinitely large bounding box for collision and rendering 721 /// purposes. 722 /// 723 /// They can't be toggled currently. 724 void setGlobalBounds(); 725 726 /// @} 727 728 /// Return the ProcessList for this object to use. 729 ProcessList* getProcessList() const; 730 731 // ProcessObject, 732 virtual void processAfter( ProcessObject *obj ); 733 virtual void clearProcessAfter(); 734 virtual ProcessObject* getAfterObject() const { return mAfterObject; } 735 virtual void setProcessTick( bool t ); 736 737 // NetObject. 738 virtual U32 packUpdate( NetConnection* conn, U32 mask, BitStream* stream ); 739 virtual void unpackUpdate( NetConnection* conn, BitStream* stream ); 740 virtual void onCameraScopeQuery( NetConnection* connection, CameraScopeQuery* query ); 741 742 // SimObject. 743 virtual bool onAdd(); 744 virtual void onRemove(); 745 virtual void onDeleteNotify( SimObject *object ); 746 virtual void inspectPostApply(); 747 virtual bool writeField( StringTableEntry fieldName, const char* value ); 748 749 static void initPersistFields(); 750 751 DECLARE_CONOBJECT( SceneObject ); 752 753 private: 754 755 SceneObject( const SceneObject& ); ///< @deprecated disallowed 756 757 /// For ScopeAlways objects to be able to properly implement setHidden(), they 758 /// need to temporarily give up ScopeAlways status while being hidden. Otherwise 759 /// the client-side ghost will not disappear as the server-side object will be 760 /// forced to stay in scope. 761 bool mIsScopeAlways; 762 763 /// @name Protected field getters/setters 764 /// @{ 765 766 static const char* _getRenderEnabled( void *object, const char *data ); 767 static bool _setRenderEnabled( void *object, const char *index, const char *data ); 768 static const char* _getSelectionEnabled( void *object, const char *data ); 769 static bool _setSelectionEnabled( void *object, const char *index, const char *data ); 770 static bool _setFieldPosition( void *object, const char *index, const char *data ); 771 static bool _setFieldRotation( void *object, const char *index, const char *data ); 772 static bool _setFieldScale( void *object, const char *index, const char *data ); 773 static bool _setMountPID( void* object, const char* index, const char* data ); 774 static bool _setAccuEnabled( void *object, const char *index, const char *data ); 775 776 /// @} 777 778 // Accumulation Texture 779 // Note: This was placed in SceneObject to both ShapeBase and TSStatic could support it. 780 public: 781 GFXTextureObject* mAccuTex; 782}; 783 784#endif // _SCENEOBJECT_H_ 785 786
