Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

Rt2dScene
[Rt2d]


Functions

Rt2dObject Rt2dSceneCreate (void)
RwBool  Rt2dSceneDestroy (Rt2dObject *scene)
Rt2dObject Rt2dSceneLock (Rt2dObject *object)
Rt2dObject Rt2dSceneUnlock (Rt2dObject *object)
Rt2dObject Rt2dSceneAddChild (Rt2dObject *scene, Rt2dObject *object)
Rt2dObject Rt2dSceneGetNewChildScene (Rt2dObject *object)
Rt2dObject Rt2dSceneGetNewChildShape (Rt2dObject *object)
Rt2dObject Rt2dSceneGetNewChildPickRegion (Rt2dObject *object)
Rt2dObject Rt2dSceneGetNewChildObjectString (Rt2dObject *object, const RwChar *text, const RwChar *font)
RwInt32  Rt2dSceneGetChildCount (Rt2dObject *scene)
Rt2dObject Rt2dSceneGetChildByIndex (Rt2dObject *scene, RwInt32 index)
Rt2dObject Rt2dSceneRender (Rt2dObject *object)
Rt2dObject Rt2dSceneForAllChildren (Rt2dObject *scene, Rt2dObjectCallBack callback, void *pData)
Rt2dObject Rt2dSceneStreamWrite (Rt2dObject *shape, RwStream *stream)
RwUInt32  Rt2dSceneStreamGetSize (Rt2dObject *scene)
Rt2dObject Rt2dSceneStreamRead (RwStream *stream)
Rt2dObject Rt2dSceneSetDepthDirty (Rt2dObject *scene)
Rt2dObject Rt2dSceneUpdateLTM (Rt2dObject *scene)

Detailed Description

Scenes

Rt2dScene Overview

A scene is a container of 2d objects that can be manipulated and rendered. A scene is a also a 2d object. A scene can contain shapes, object strings, pick regions and other scenes.

Creating a Scene
Adding Objects to a Scene
  1. Rt2dSceneLock locks the scene.
  2. Rt2dSceneAddChild adds an object to the scene.
  3. Rt2dSceneUnlock unlocks the scene.

Function Documentation

Rt2dObject* Rt2dSceneAddChild Rt2dObject   scene,
Rt2dObject   object
 

Rt2dSceneAddChild adds a child object to a scene. The scene must be locked.

Parameters:
scene  is the scene to add the child to
object  is the child to be added
Returns:
returns the scene if successful, NULL otherwise
See also:
Rt2dSceneLock , Rt2dSceneUnlock , Rt2dObjectStringCreate , Rt2dPickRegionCreate , Rt2dSceneCreate , Rt2dShapeCreate
Rt2dObject* Rt2dSceneCreate void   
 

Rt2dSceneCreate allocates storage for the contents of a scene of 2d objects.

Returns:
Returns a new scene if successful, NULL otherwise. The new scene is locked, ready for modification.
See also:
Rt2dSceneDestroy , Rt2dSceneAddChild , Rt2dSceneGetNewChildObjectString , Rt2dSceneGetNewChildPickRegion , Rt2dSceneGetNewChildScene , Rt2dSceneGetNewChildShape
RwBool Rt2dSceneDestroy Rt2dObject   object
 

Rt2dSceneDestroy deallocates storage for a scene of 2d objects. All child objects added to a scene are destroyed.

Note:
Any child object in a scene needs to be unlocked before it can be destroyed. If the child object is not unlocked error messages will be displayed and the object may not be destroyed.
Parameters:
object  Pointer to the object to be destroyed.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
Rt2dSceneCreate , Rt2dSceneAddChild
Rt2dObject* Rt2dSceneForAllChildren Rt2dObject   scene,
Rt2dObjectCallBack    callback,
void *    pData
 

Rt2dSceneForAllChildren Performs a callback on all children of a scene

Parameters:
scene  is the scene to be used
callback  is the function that will be called for each child object
pData  is user data that is passed to the callback function each time
Returns:
returns the scene used
See also:
Rt2dSceneGetChildCount , Rt2dSceneGetChildByIndex
Rt2dObject* Rt2dSceneGetChildByIndex Rt2dObject   scene,
RwInt32    index
 

Rt2dSceneGetChildByIndex Gets a child of a scene by its index number.

Parameters:
scene  is the scene to be used
index  is the index of the child to be obtained
Returns:
Returns a pointer to the specified child.
See also:
Rt2dSceneGetChildCount , Rt2dSceneForAllChildren
RwInt32 Rt2dSceneGetChildCount Rt2dObject   scene
 

Rt2dSceneGetChildCount is used to determine the number of child objects in a scene.

Parameters:
scene  is the scene to be used
Returns:
Returns the number of child objects.
See also:
Rt2dSceneGetChildByIndex , Rt2dSceneForAllChildren
Rt2dObject* Rt2dSceneGetNewChildObjectString Rt2dObject   object,
const RwChar   text,
const RwChar   font
 

Rt2dSceneGetNewChildObjectString creates a new child object string. The scene needs to be locked before a new child object string can be added.

Parameters:
object  is the scene to be used
text  is the string to be displayed
font  is the font filename to be used
Returns:
Returns the new child object string.
See also:
Rt2dSceneLock , Rt2dSceneUnlock , Rt2dSceneGetNewChildPickRegion , Rt2dSceneGetNewChildScene , Rt2dSceneGetNewChildShape
Rt2dObject* Rt2dSceneGetNewChildPickRegion Rt2dObject   object
 

Rt2dSceneGetNewChildPickRegion creates a new child pick region. The scene needs to be locked before a new child pick region can be added.

Parameters:
object  is the scene to be used
Returns:
Returns the new child pick region.
See also:
Rt2dSceneLock , Rt2dSceneUnlock , Rt2dSceneGetNewChildObjectString , Rt2dSceneGetNewChildScene , Rt2dSceneGetNewChildShape
Rt2dObject* Rt2dSceneGetNewChildScene Rt2dObject   object
 

Rt2dSceneGetNewChildScene creates a new child scene. The scene needs to be locked before a new child scene can be added.

Parameters:
object  is the scene to be used
Returns:
Returns the new child scene.
See also:
Rt2dSceneLock , Rt2dSceneUnlock , Rt2dSceneGetNewChildShape , Rt2dSceneGetNewChildPickRegion , Rt2dSceneGetNewChildObjectString
Rt2dObject* Rt2dSceneGetNewChildShape Rt2dObject   object
 

Rt2dSceneGetNewChildShape creates a new child shape. The scene needs to be locked before a new child shape can be added.

Parameters:
object  is the scene to be used
Returns:
Returns the new child shape.
See also:
Rt2dSceneLock , Rt2dSceneUnlock , Rt2dSceneGetNewChildPickRegion , Rt2dSceneGetNewChildObjectString , Rt2dSceneGetNewChildScene
Rt2dObject* Rt2dSceneLock Rt2dObject   object
 

Rt2dSceneLock locks a scene for editing. A locked scene can not be streamed or rendered and is provided only for editing purposes. When a scene is locked child objects can be added to the scene.

Parameters:
object  Pointer to the scene.
Returns:
Returns the new scene if successful, NULL otherwise.
See also:
Rt2dSceneDestroy , Rt2dSceneUnlock , Rt2dSceneAddChild , Rt2dSceneGetNewChildPickRegion , Rt2dSceneGetNewChildObjectString , Rt2dSceneGetNewChildScene , Rt2dSceneGetNewChildShape
Rt2dObject* Rt2dSceneRender Rt2dObject   object
 

Rt2dSceneRender renders all visible 2d objects in a scene.

Parameters:
object  is the scene to be used
Returns:
Returns scene if successful, NULL otherwise.
See also:
Rt2dSceneCreate , Rt2dSceneUpdateLTM
Rt2dObject* Rt2dSceneSetDepthDirty Rt2dObject   scene
 

Rt2dSceneSetDepthDirty Records that the depth of a child has changed and a depth sort is necessary

Parameters:
scene  is the scene of which a child has changed depth
Returns:
returns the scene if successful, NULL otherwise
See also:
Rt2dSceneRender , Rt2dObjectSetDepth
RwUInt32 Rt2dSceneStreamGetSize Rt2dObject   scene
 

Rt2dSceneStreamGetSize is used to determine the size in bytes of the binary representation of the given scene. This is used in the binary chunk header to indicate the size of the chunk. The size does include the size of the chunk header.

Parameters:
scene  Pointer to the scene.
Returns:
Returns a RwUInt32 value equal to the chunk size (in bytes) of the scene
See also:
Rt2dSceneStreamRead , Rt2dSceneStreamWrite
Rt2dObject* Rt2dSceneStreamRead RwStream   stream
 

Rt2dSceneStreamRead Reads a scene object from a stream

The sequence to locate and read a scene from a binary stream is as follows:

   RwStream *stream;
   Rt2dObject *newScene;
  
   stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "mybinary.xxx");
   if( stream )
   {
       if( RwStreamFindChunk(stream, rwID_2DSCENE, NULL, NULL) )
       {
           newScene = Rt2dSceneStreamRead(stream);
       }
  
       RwStreamClose(stream, NULL);
   }
Parameters:
stream  is the stream to be read from
Returns:
returns a new scene if successful, NULL otherwise
See also:
Rt2dSceneStreamWrite , Rt2dSceneStreamGetSize
Rt2dObject* Rt2dSceneStreamWrite Rt2dObject   scene,
RwStream   stream
 

Rt2dSceneStreamWrite Writes a scene to a stream

Parameters:
scene  is the scene to be used
stream  is the stream to be written to
Returns:
returns the object that was used if successful, NULL otherwise
See also:
Rt2dSceneStreamGetSize , Rt2dSceneStreamRead
Rt2dObject* Rt2dSceneUnlock Rt2dObject   object
 

Rt2dSceneUnlock unlocks a scene. An unlocked scene may be streamed and rendered. Objects can also be manipulated in an unlocked scene.

Parameters:
object  Pointer to the scene to be unlocked.
Returns:
Returns the unlocked scene if successful, NULL otherwise.
See also:
Rt2dSceneLock , Rt2dObjectMTMRotate , Rt2dObjectMTMScale , Rt2dObjectMTMTranslate , Rt2dObjectSetColorMultiplier , Rt2dObjectSetColorOffset , Rt2dObjectSetDepth , Rt2dObjectSetVisible
Rt2dObject* Rt2dSceneUpdateLTM Rt2dObject   scene
 

Rt2dSceneUpdateLTM goes through the scene hierarchy and recalculates the scene to see if the LTM needs to be updated. This is only necessary if an update is required before rendering as this operation is also called by Rt2dSceneRender.

Parameters:
scene  is the scene which may need its LTM updating.
Returns:
Returns the scene if successful, NULL otherwise.
See also:
Rt2dSceneRender , Rt2dObjectStringRender , Rt2dShapeRender

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:46:49 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)