Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

VPScene Class Reference

A set of objects, lights and cameras. More...

#include <vpscene.h>

List of all members.

Public Member Functions

 VPScene ()
virtual ~VPScene ()
std::list< const VPLight * > GetLights ()
std::list< VPCamera * > GetCameras ()
std::list< const VPSceneNode * > GetObjects ()
void AddLight (VPLight *newLight)
 Adds a light to the list of lights.
void AddLight (const VPLight &newLight)
 Adds a light to the list of lights.
void AddCamera (VPCamera *newCamera)
 Add a camera to the list of cameras.
void AddObject (VPSceneNode *newObjectPtr)
 Add a object to the scene.
const VPLightGetLight (const std::string &lightName)
const VPCameraGetCamera (const std::string &cameraName)
const VPSceneNodeGetObject (const std::string &objectName)
VPColor GetBackgroundColor ()
void SetBackgroundColor (VPColor color)
virtual bool DrawOGL () const
 Sets projection and draws graphics objects using OpenGL commands.
bool DrawLightsOGL () const
 Set lights using OpenGL commands.
VPCameraGetCurrentCamera () const
 Returns the current camera in the scene or NULL if no camera exists.
void UseNextCamera ()
 Sets the current camera to the next camera in list of cameras.
void UsePreviousCamera ()
 Sets the current camera to the previous camera in the list of cameras.
void SetAllCamerasAspectRatio (float newAspectRatio)
 Set the aspect ratio of all cameras.
void ComputeBoundingBox ()
 Computes the axis aligned bounding box of all objects.
const VPBoundingBoxGetBoundingBox () const
 Returns the scene bounding box.
unsigned int GetNumLights () const
 Returns the number of light in the scene.
void MakeCameraViewAll ()
 Fits the whole scene to drawing region.
void SetDescription (const std::string &newDescr)
 Sets the scene description.
const std::string & GetDescription ()
 Returns the scene description.

Protected Attributes

std::list< const VPLight * > lights
 Separate lights (not treated as common objects).
std::list< VPCamera * > cameras
std::list< const VPSceneNode * > objects
VPColor background


Detailed Description

A set of objects, lights and cameras.

A Scene is a complete viewable object with objects, lights, cameras and background color.

Definition at line 23 of file vpscene.h.


Constructor & Destructor Documentation

VPScene::VPScene  ) 
 

Definition at line 54 of file vpscene.cpp.

References background, VPColor::BLACK(), and cameras.

VPScene::~VPScene  )  [virtual]
 

Definition at line 59 of file vpscene.cpp.

References lights, and objects.


Member Function Documentation

void VPScene::AddCamera VPCamera newCamera  ) 
 

Add a camera to the list of cameras.

The first added camera is made the current camera. Other cameras are added to end of the list of cameras. Currently, it is not a good idea to share a camera between different scenes, because viewers change the aspect ratio of their scenes.

Definition at line 98 of file vpscene.cpp.

References cameras.

void VPScene::AddLight const VPLight newLight  ) 
 

Adds a light to the list of lights.

This version creates an internal copy of the light, so that the application programmer may free the light's memory space.

Definition at line 92 of file vpscene.cpp.

References VPMemoryObj::autoDelete, and lights.

void VPScene::AddLight VPLight newLight  ) 
 

Adds a light to the list of lights.

This version only copies the light pointer to the internal list. The application programmer should keep the memory space untouched while the scene uses it.

Definition at line 88 of file vpscene.cpp.

References lights.

void VPScene::AddObject VPSceneNode newObjectPtr  ) 
 

Add a object to the scene.

The object's address is added to the scene's list. The application programmer is responsible for freeing memory at the end of scene's life cycle.

Definition at line 104 of file vpscene.cpp.

References objects.

void VPScene::ComputeBoundingBox  ) 
 

Computes the axis aligned bounding box of all objects.

Definition at line 213 of file vpscene.cpp.

References VPGraphicObj::GetRecursiveBoundingBox(), VPBoundingBox::MergeWith(), and objects.

bool VPScene::DrawLightsOGL  )  const
 

Set lights using OpenGL commands.

Lights may be drawn apart from other scene components because they need not be drawn at every rendering cicle.

Returns:
false if VPAT was not compiled with OpenGL support.

Definition at line 172 of file vpscene.cpp.

References lights.

Referenced by DrawOGL().

bool VPScene::DrawOGL  )  const [virtual]
 

Sets projection and draws graphics objects using OpenGL commands.

This method is intended to be executed at every rendering cicle. It does not draw lights (from the "lights" list), because they need not be drawn at every rendering cicle.

Returns:
false if VPAT was not compiled with OpenGL support.

Definition at line 146 of file vpscene.cpp.

References background, DrawLightsOGL(), VPColor::GetScaled(), and objects.

VPColor VPScene::GetBackgroundColor  ) 
 

Definition at line 138 of file vpscene.cpp.

References background.

const VPBoundingBox& VPScene::GetBoundingBox  )  const [inline]
 

Returns the scene bounding box.

Definition at line 96 of file vpscene.h.

const VPCamera* VPScene::GetCamera const std::string &  cameraName  ) 
 

list< VPCamera * > VPScene::GetCameras  ) 
 

Definition at line 80 of file vpscene.cpp.

References cameras.

VPCamera * VPScene::GetCurrentCamera  )  const
 

Returns the current camera in the scene or NULL if no camera exists.

Definition at line 187 of file vpscene.cpp.

References cameras, and NULL.

const std::string& VPScene::GetDescription  )  [inline]
 

Returns the scene description.

Definition at line 111 of file vpscene.h.

const VPLight* VPScene::GetLight const std::string &  lightName  ) 
 

list< const VPLight * > VPScene::GetLights  ) 
 

Definition at line 76 of file vpscene.cpp.

References lights.

unsigned int VPScene::GetNumLights  )  const [inline]
 

Returns the number of light in the scene.

Definition at line 99 of file vpscene.h.

References lights.

const VPSceneNode* VPScene::GetObject const std::string &  objectName  ) 
 

list< const VPSceneNode * > VPScene::GetObjects  ) 
 

Definition at line 84 of file vpscene.cpp.

References objects.

void VPScene::MakeCameraViewAll  ) 
 

Fits the whole scene to drawing region.

Changes current camera's position and clipping planes so that the whole scene fits the viewer window.

Definition at line 236 of file vpscene.cpp.

References cameras, VPBoundingBox::GetCenter(), VPBoundingBox::GetGreaterX(), VPBoundingBox::GetGreaterY(), VPBoundingBox::GetGreaterZ(), VPBoundingBox::GetSmallerX(), VPBoundingBox::GetSmallerY(), VPBoundingBox::GetSmallerZ(), VPBoundingBox::ProcessCenter(), and VPPoint4D::Y().

void VPScene::SetAllCamerasAspectRatio float  newAspectRatio  ) 
 

Set the aspect ratio of all cameras.

Definition at line 206 of file vpscene.cpp.

References cameras.

void VPScene::SetBackgroundColor VPColor  color  ) 
 

Definition at line 142 of file vpscene.cpp.

References background.

void VPScene::SetDescription const std::string &  newDescr  )  [inline]
 

Sets the scene description.

Definition at line 108 of file vpscene.h.

void VPScene::UseNextCamera  ) 
 

Sets the current camera to the next camera in list of cameras.

Definition at line 194 of file vpscene.cpp.

References cameras.

void VPScene::UsePreviousCamera  ) 
 

Sets the current camera to the previous camera in the list of cameras.

Definition at line 200 of file vpscene.cpp.

References cameras.


Member Data Documentation

VPColor VPScene::background [protected]
 

Definition at line 119 of file vpscene.h.

Referenced by DrawOGL(), GetBackgroundColor(), SetBackgroundColor(), and VPScene().

std::list<VPCamera*> VPScene::cameras [protected]
 

Definition at line 117 of file vpscene.h.

Referenced by AddCamera(), GetCameras(), GetCurrentCamera(), MakeCameraViewAll(), SetAllCamerasAspectRatio(), UseNextCamera(), UsePreviousCamera(), and VPScene().

std::list<const VPLight*> VPScene::lights [protected]
 

Separate lights (not treated as common objects).

Definition at line 114 of file vpscene.h.

Referenced by AddLight(), DrawLightsOGL(), GetLights(), GetNumLights(), and ~VPScene().

std::list<const VPSceneNode*> VPScene::objects [protected]
 

Definition at line 118 of file vpscene.h.

Referenced by AddObject(), ComputeBoundingBox(), DrawOGL(), GetObjects(), and ~VPScene().


The documentation for this class was generated from the following files:
Generated on Tue Sep 6 10:00:18 2005 for VPAT by  doxygen 1.4.4