InteriorInstance Class Reference

#include <interiorInstance.h>

Inheritance diagram for InteriorInstance:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 InteriorInstance ()
 ~InteriorInstance ()
S32 getSurfaceZone (U32 surfaceindex, Interior *detail)
bool buildPolyList (AbstractPolyList *polyList, const Box3F &box, const SphereF &sphere)
 Builds a list of polygons which intersect a bounding volume.
bool castRay (const Point3F &start, const Point3F &end, RayInfo *info)
 Casts a ray and obtain collision information, returns true if RayInfo is modified.
virtual void setTransform (const MatrixF &mat)
 Sets the Object -> World transform.
void buildConvex (const Box3F &box, Convex *convex)
 Builds a convex hull for this object.
bool inAlarmState ()
 This returns true if the interior is in an alarm state.
bool useSmoothLighting ()
 This returns true if the interior should be lit with smooth lighting (slower).
void setAlarmMode (const bool alarm)
 This sets the alarm mode of the interior.
void renewOverlays ()
 Reloads material information if the interior skin changes.
void setSkinBase (const char *newBase)
 Sets the interior skin to something different.
 DECLARE_CONOBJECT (InteriorInstance)
bool readLightmaps (GBitmap ****lightmaps)
 Reads the lightmaps of the interior into the provided pointer.
LM_HANDLE getLMHandle ()
 Returns the Light Manager handle.
SFXProfilegetAudioProfile ()
 Returns the audio profile.
SFXEnvironmentgetAudioEnvironment () const
 Returns the audio environment.
bool getPointInsideScale (const Point3F &pos, F32 *pScale)
 This is used to determine just how 'inside' a point is in an interior.
ResourceOld< InteriorResource > & getResource ()
 Returns the interior resource.
U32 getCRC ()
 Returns the CRC for validation.
virtual void updateReflection ()
 This is a callback for objects that have reflections and are added to the "reflectiveSet" SimSet.
StringTableEntry getInteriorFileName ()
Subobject access interface
U32 getNumDetailLevels ()
 Returns the number of detail levels for an object.
InteriorgetDetailLevel (const U32 level)
 Gets the interior associated with a particular detail level.
void setDetailLevel (S32 level=-1)
 Sets the detail level to render manually.

Static Public Member Functions

static void init ()
static void destroy ()
static void initPersistFields ()
 Register dynamic fields in a subclass of ConsoleObject.
static void consoleInit ()
 Register global constant variables and do other one-time initialization tasks in a subclass of ConsoleObject.
static bool setInteriorFile (void *obj, const char *data)

Public Attributes

ObjectRenderInst::RenderDelegate mDebugRenderDelegate
Vector< ReflectPlanemReflectPlanes
 Reflection related.

Static Public Attributes

static bool smDontRestrictOutside
static F32 smDetailModification

Protected Member Functions

bool onAdd ()
 Called when the object is added to the sim.
void onRemove ()
 Called when the object is removed from the sim.
void inspectPreApply ()
 Called before any property of the object is changed in the world editor.
void inspectPostApply ()
 Called after any property of the object is changed in the world editor.
bool onSceneAdd (SceneGraph *graph)
 Called when this is added to the SceneGraph.
void onSceneRemove ()
 Called when this is removed from the SceneGraph.
U32 getPointZone (const Point3F &p)
 Returns the zone containing p.
bool getOverlappingZones (SceneObject *obj, U32 *zones, U32 *numZones)
 If an object exists in multiple zones, this method will give you the number and indices of these zones (storing them in the provided variables).
U32 calcDetailLevel (SceneState *, const Point3F &)
bool prepRenderImage (SceneState *state, const U32 stateKey, const U32 startZone, const bool modifyBaseZoneState)
 Called when the SceneGraph is ready for the registration of RenderImages.
void renderObject (ObjectRenderInst *ri, BaseMatInstance *)
bool scopeObject (const Point3F &rootPosition, const F32 rootDistance, bool *zoneScopeState)
 This is called on a zone managing object to scope all the zones managed.
bool loadInterior ()
void unloadInterior ()

Private Types

typedef SceneObject Parent
 InitMask = BIT(0)
 TransformMask = BIT(1)
 AlarmMask = BIT(2)
 _lightupdate0 = BIT(3)
 _lightupdate1 = BIT(4)
 _lightupdate2 = BIT(5)
 _lightupdate3 = BIT(6)
 _lightupdate4 = BIT(7)
 _lightupdate5 = BIT(8)
 _lightupdate6 = BIT(9)
 _lightupdate7 = BIT(10)
 SkinBaseMask = BIT(11)
 AudioMask = BIT(12)
 NextFreeMask = BIT(13)
 LightUpdateBitStart = 3
 LightUpdateBitEnd = 10
 Normal = 0
 Alarm = 1
enum  UpdateMaskBits {
  InitMask = BIT(0),
  TransformMask = BIT(1),
  AlarmMask = BIT(2),
  _lightupdate0 = BIT(3),
  _lightupdate1 = BIT(4),
  _lightupdate2 = BIT(5),
  _lightupdate3 = BIT(6),
  _lightupdate4 = BIT(7),
  _lightupdate5 = BIT(8),
  _lightupdate6 = BIT(9),
  _lightupdate7 = BIT(10),
  SkinBaseMask = BIT(11),
  AudioMask = BIT(12),
  NextFreeMask = BIT(13)
}
enum  Constants {
  LightUpdateBitStart = 3,
  LightUpdateBitEnd = 10
}
enum  AlarmState {
  Normal = 0,
  Alarm = 1
}

Private Member Functions

U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream)
 Instructs this object to pack its state for transfer over the network.
void unpackUpdate (NetConnection *conn, BitStream *stream)
 Instructs this object to read state data previously packed with packUpdate.
void createTriggerTransform (const InteriorResTrigger *trigger, MatrixF *transform)
 Creates a transform based on an trigger area.

Private Attributes

ConvexmConvexList
StringTableEntry mInteriorFileName
 File name of the interior this instance encapuslates.
U32 mInteriorFileHash
 Hash for interior file name, used for sorting.
ResourceOld< InteriorResourcemInteriorRes
 Interior managed by resource manager.
StringTableEntry mSkinBase
 Skin for this interior.
bool mShowTerrainInside
 Enables or disables terrain showing through the interior.
bool mSmoothLighting
 Enables or disables doing the longer smooth lighting calculations.
SFXProfilemAudioProfile
 Audio profile.
SFXEnvironmentmAudioEnvironment
 Audio environment.
S32 mForcedDetailLevel
 Forced LOD, if -1 auto LOD.
U32 mCRC
 CRC for the interior.
LM_HANDLE mLMHandle
 Handle to the light manager.
bool mAlarmState
 Alarm state of the interior.

Friends

class FloorPlan

Member Typedef Documentation

Reimplemented from SceneObject.


Member Enumeration Documentation

Enumerator:
InitMask 
TransformMask 
AlarmMask 
_lightupdate0 
_lightupdate1 
_lightupdate2 
_lightupdate3 
_lightupdate4 
_lightupdate5 
_lightupdate6 
_lightupdate7 
SkinBaseMask 
AudioMask 
NextFreeMask 

Enumerator:
LightUpdateBitStart 
LightUpdateBitEnd 

Enumerator:
Normal 
Alarm 


Constructor & Destructor Documentation

InteriorInstance::InteriorInstance (  ) 

InteriorInstance::~InteriorInstance (  ) 


Member Function Documentation

S32 InteriorInstance::getSurfaceZone ( U32  surfaceindex,
Interior detail 
)

static void InteriorInstance::init (  )  [static]

static void InteriorInstance::destroy (  )  [static]

bool InteriorInstance::buildPolyList ( AbstractPolyList polyList,
const Box3F box,
const SphereF sphere 
) [virtual]

Builds a list of polygons which intersect a bounding volume.

This will use either the sphere or the box, not both, the SceneObject implimentation ignores sphere.

See also:
AbstractPolyList
Parameters:
polyList Poly list build (out)
box Box bounding volume
sphere Sphere bounding volume

Reimplemented from SceneObject.

bool InteriorInstance::castRay ( const Point3F start,
const Point3F end,
RayInfo info 
) [virtual]

Casts a ray and obtain collision information, returns true if RayInfo is modified.

Parameters:
start Start point of ray
end End point of ray
info Collision information obtained (out)

Reimplemented from SceneObject.

virtual void InteriorInstance::setTransform ( const MatrixF mat  )  [virtual]

Sets the Object -> World transform.

Parameters:
mat New transform matrix

Reimplemented from SceneObject.

void InteriorInstance::buildConvex ( const Box3F box,
Convex convex 
) [virtual]

Builds a convex hull for this object.

Think of a convex hull as a low-res mesh which covers, as tightly as possible, the object mesh, and is used as a collision mesh.

Parameters:
box 
convex Convex mesh generated (out)

Reimplemented from SceneObject.

bool InteriorInstance::inAlarmState (  )  [inline]

This returns true if the interior is in an alarm state.

Alarm state will put different lighting into the interior and also possibly have an audio element also.

bool InteriorInstance::useSmoothLighting (  )  [inline]

This returns true if the interior should be lit with smooth lighting (slower).

void InteriorInstance::setAlarmMode ( const bool  alarm  ) 

This sets the alarm mode of the interior.

Parameters:
alarm If true the interior will be in an alarm state next frame

U32 InteriorInstance::getNumDetailLevels (  ) 

Returns the number of detail levels for an object.

Interior* InteriorInstance::getDetailLevel ( const U32  level  ) 

Gets the interior associated with a particular detail level.

Parameters:
level Detail level

void InteriorInstance::setDetailLevel ( S32  level = -1  )  [inline]

Sets the detail level to render manually.

Parameters:
level Detail level to force

void InteriorInstance::renewOverlays (  ) 

Reloads material information if the interior skin changes.

void InteriorInstance::setSkinBase ( const char *  newBase  ) 

Sets the interior skin to something different.

Parameters:
newBase New base skin

InteriorInstance::DECLARE_CONOBJECT ( InteriorInstance   ) 

static void InteriorInstance::initPersistFields (  )  [static]

Register dynamic fields in a subclass of ConsoleObject.

See also:
addField(), addFieldV(), addDeprecatedField(), addGroup(), endGroup()

Reimplemented from SceneObject.

static void InteriorInstance::consoleInit (  )  [static]

Register global constant variables and do other one-time initialization tasks in a subclass of ConsoleObject.

See also:
console

Reimplemented from ConsoleObject.

bool InteriorInstance::readLightmaps ( GBitmap ****  lightmaps  ) 

Reads the lightmaps of the interior into the provided pointer.

Parameters:
lightmaps Lightmaps in the interior (out)

bool InteriorInstance::onAdd (  )  [protected, virtual]

Called when the object is added to the sim.

Reimplemented from SceneObject.

void InteriorInstance::onRemove (  )  [protected, virtual]

Called when the object is removed from the sim.

Reimplemented from SceneObject.

void InteriorInstance::inspectPreApply (  )  [protected, virtual]

Called before any property of the object is changed in the world editor.

The calling order here is:

Reimplemented from SimObject.

void InteriorInstance::inspectPostApply (  )  [protected, virtual]

Called after any property of the object is changed in the world editor.

See also:
inspectPreApply

Reimplemented from SceneObject.

bool InteriorInstance::onSceneAdd ( SceneGraph graph  )  [protected, virtual]

Called when this is added to the SceneGraph.

Parameters:
graph SceneGraph this is getting added to

Reimplemented from SceneObject.

void InteriorInstance::onSceneRemove (  )  [protected, virtual]

Called when this is removed from the SceneGraph.

Reimplemented from SceneObject.

U32 InteriorInstance::getPointZone ( const Point3F p  )  [protected, virtual]

Returns the zone containing p.

Parameters:
p Point to test.

Reimplemented from SceneObject.

bool InteriorInstance::getOverlappingZones ( SceneObject obj,
U32 zones,
U32 numZones 
) [protected, virtual]

If an object exists in multiple zones, this method will give you the number and indices of these zones (storing them in the provided variables).

Parameters:
obj Object in question.
zones Indices of zones containing the object. (out)
numZones Number of elements in the returned array. (out)

Reimplemented from SceneObject.

U32 InteriorInstance::calcDetailLevel ( SceneState ,
const Point3F  
) [protected]

bool InteriorInstance::prepRenderImage ( SceneState state,
const U32  stateKey,
const U32  startZone,
const bool  modifyBaseZoneState 
) [protected, virtual]

Called when the SceneGraph is ready for the registration of RenderImages.

See also:
SceneState
Parameters:
state SceneState
stateKey State key of the current SceneState
startZone Base zone index
modifyBaseZoneState If true, the object needs to modify the zone state.

Reimplemented from SceneObject.

void InteriorInstance::renderObject ( ObjectRenderInst ri,
BaseMatInstance  
) [protected]

bool InteriorInstance::scopeObject ( const Point3F rootPosition,
const F32  rootDistance,
bool zoneScopeState 
) [protected, virtual]

This is called on a zone managing object to scope all the zones managed.

Parameters:
rootPosition Camera position
rootDistance Camera visible distance
zoneScopeState Array of booleans which line up with the collection of zones, marked true if that zone is scoped (out)

Reimplemented from SceneObject.

bool InteriorInstance::loadInterior (  )  [protected]

void InteriorInstance::unloadInterior (  )  [protected]

U32 InteriorInstance::packUpdate ( NetConnection conn,
U32  mask,
BitStream stream 
) [private, virtual]

Instructs this object to pack its state for transfer over the network.

Parameters:
conn Net connection being used
mask Mask indicating fields to transmit.
stream Bitstream to pack data to
Returns:
Any bits which were not dealt with. The value is stored by the networking system. Don't set bits you weren't passed.

Reimplemented from NetObject.

void InteriorInstance::unpackUpdate ( NetConnection conn,
BitStream stream 
) [private, virtual]

Instructs this object to read state data previously packed with packUpdate.

Parameters:
conn Net connection being used
stream stream to read from

Reimplemented from NetObject.

LM_HANDLE InteriorInstance::getLMHandle (  )  [inline]

Returns the Light Manager handle.

SFXProfile* InteriorInstance::getAudioProfile (  )  [inline]

Returns the audio profile.

SFXEnvironment* InteriorInstance::getAudioEnvironment (  )  const [inline]

Returns the audio environment.

bool InteriorInstance::getPointInsideScale ( const Point3F pos,
F32 pScale 
)

This is used to determine just how 'inside' a point is in an interior.

This is used by the environmental audio code for audio properties and the function always returns true.

Parameters:
pos Point to test
pScale How inside is the point 0 = totally outside, 1 = totally inside (out)

ResourceOld<InteriorResource>& InteriorInstance::getResource (  )  [inline]

Returns the interior resource.

U32 InteriorInstance::getCRC (  )  [inline]

Returns the CRC for validation.

void InteriorInstance::createTriggerTransform ( const InteriorResTrigger trigger,
MatrixF transform 
) [private]

Creates a transform based on an trigger area.

Parameters:
trigger Trigger to create a transform for
transform Transform generated (out)

virtual void InteriorInstance::updateReflection (  )  [virtual]

This is a callback for objects that have reflections and are added to the "reflectiveSet" SimSet.

Reimplemented from SceneObject.

static bool InteriorInstance::setInteriorFile ( void obj,
const char *  data 
) [static]

StringTableEntry InteriorInstance::getInteriorFileName (  )  [inline]


Friends And Related Function Documentation

friend class FloorPlan [friend]


Member Data Documentation

File name of the interior this instance encapuslates.

Hash for interior file name, used for sorting.

Interior managed by resource manager.

Skin for this interior.

Enables or disables terrain showing through the interior.

Enables or disables doing the longer smooth lighting calculations.

Forced LOD, if -1 auto LOD.

CRC for the interior.

Handle to the light manager.

Alarm state of the interior.