3Depict
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Scene Class Reference

The scene class brings together elements such as objects, lights, and cameras. More...

#include <scene.h>

Collaboration diagram for Scene:
Collaboration graph
[legend]

Public Member Functions

 Scene ()
 Constructor. More...
 
virtual ~Scene ()
 Destructor. More...
 
void setVisControl (VisController *v)
 Set the vis control. More...
 
void draw (bool noUpdateCam=false)
 Draw the objects in the active window. May adjust cameras and compute bounding as needed. More...
 
void drawOverlays (bool noCamUpdate=false) const
 Draw the normal overlays. More...
 
void clearAll ()
 clear rendering vectors More...
 
void clearObjs ()
 Clear drawing objects vector. More...
 
void clearRefObjs ()
 Clear the reference object vector. More...
 
bool hasOverlays () const
 Do we have overlay items? More...
 
void getLightPos (float *f) const
 Obtain the scene's light coordinates in camera relative space. More...
 
void setLightPos (const float *f)
 Obtain the scene's light coordinates in camera relative space. More...
 
void setAspect (float newAspect)
 Set the aspect ratio of the output window. Required. More...
 
float getAspect () const
 retrieve aspect ratio (h/w) of output win More...
 
void addDrawable (const DrawableObj *)
 Add a drawable object. More...
 
void addRefDrawable (const DrawableObj *)
 Add a drawable to the reference only section. More...
 
bool setProgressAnimation (const std::vector< std::string > &animFiles)
 
void resetProgressAnim ()
 
void removeDrawable (unsigned int)
 remove a drawable object More...
 
void setActiveCam (Camera *c)
 Set the active camera directly. More...
 
void setActiveCamByClone (const Camera *c)
 set the active camera More...
 
CameragetActiveCam ()
 get the active camera More...
 
Point3D getActiveCamLoc () const
 get the active camera's location More...
 
void setTempCam ()
 Construct (or refresh) a temporary camera. More...
 
CameragetTempCam ()
 Return pointer to active camera. Must init a temporary camera first! (use setTempCam) More...
 
void commitTempCam ()
 Make the temp camera permanent. More...
 
void discardTempCam ()
 Discard the temporary camera. More...
 
bool haveTempCam () const
 Are we using a temporary camera? More...
 
CameracloneActiveCam () const
 Clone the active camera. More...
 
void ensureVisible (unsigned int direction)
 Modify the active camera position to ensure that scene is visible. More...
 
void finaliseCam ()
 Call if user has stopped interacting with camera briefly. More...
 
unsigned int glSelect (bool storeSelection=true)
 perform an openGL selection rendering pass. Return More...
 
void clearDevices ()
 Clear the current selection devices. More...
 
void applyDevice (float startX, float startY, float curX, float curY, unsigned int keyFlags, unsigned int mouseflags, bool permanent=true)
 Apply the device given the following start and end. More...
 
bool isInteractionLocked () const
 
void lockInteraction (bool amLocking=true)
 Prevent user interaction. More...
 
void setSelectionMode (bool selMode)
 Set selection mode true=select on, false=select off. More...
 
void setHoverMode (bool hMode)
 Set the hover mode to control drawing. More...
 
void setLastHover (unsigned int hover)
 Return the last object over which the cursor was hovered. More...
 
unsigned int getLastSelected () const
 Get the last selected object from call to glSelect() More...
 
unsigned int getLastHover () const
 Return the last object over which the cursor was hovered. More...
 
unsigned int duplicateCameras (std::vector< Camera *> &cams) const
 Duplicates the internal camera vector. return value is active camera. More...
 
void getEffects (std::vector< const Effect *> &effects) const
 Get a copy of the effects pointers. More...
 
void setAlpha (bool newAlpha)
 Set whether to use alpha blending. More...
 
void setLighting (bool newLight)
 Set whether to enable lighting. More...
 
void setWorldAxisVisible (bool newAxis)
 Set whether to enable the XYZ world axes. More...
 
bool getWorldAxisVisible () const
 Get whether the XYZ world axes are enabled. More...
 
void setWinSize (unsigned int x, unsigned int y)
 Set window size. More...
 
BoundCube getBound () const
 Get the scene bounding box. More...
 
void setBackgroundColour (float newR, float newG, float newB)
 Set the background colour. More...
 
void getBackgroundColour (float &newR, float &newG, float &newB) const
 
void computeSceneLimits ()
 Computes the bounding box for the scene. More...
 
void setEffects (bool enable)
 Set whether to use effects or not. More...
 
void setEffectVec (std::vector< Effect *> &e)
 Set the effect vector. More...
 
unsigned int addEffect (Effect *e)
 Add an effect. More...
 
void removeEffect (unsigned int uniqueEffectID)
 Remove a given effect. More...
 
void clearEffects ()
 Clear effects vector. More...
 

Static Public Member Functions

static std::string getGlVersion ()
 

Public Attributes

DrawProgressCircleOverlay progressCircle
 

Detailed Description

The scene class brings together elements such as objects, lights, and cameras.

Constructor & Destructor Documentation

◆ Scene()

Scene::Scene ( )

Constructor.

References DrawableObj::setTexPool().

◆ ~Scene()

Scene::~Scene ( )
virtual

Member Function Documentation

◆ addDrawable()

void Scene::addDrawable ( const DrawableObj obj)

Add a drawable object.

Pointer must be set to a valid (allocated) object. !Scene will delete upon call to clearAll, clearObjs or !upon destruction

References BoundCube::expand(), DrawableObj::getBoundingBox(), and BoundCube::isValid().

Referenced by getAspect().

Here is the caller graph for this function:

◆ addEffect()

unsigned int Scene::addEffect ( Effect e)

Add an effect.

References ASSERT, UniqueIDHandler::genId(), and UniqueIDHandler::size().

Referenced by setEffects(), and setEffectVec().

Here is the caller graph for this function:

◆ addRefDrawable()

void Scene::addRefDrawable ( const DrawableObj obj)

Add a drawable to the reference only section.

References ASSERT, BoundCube::expand(), DrawableObj::getBoundingBox(), and BoundCube::isValid().

Referenced by getAspect().

Here is the caller graph for this function:

◆ applyDevice()

void Scene::applyDevice ( float  startX,
float  startY,
float  curX,
float  curY,
unsigned int  keyFlags,
unsigned int  mouseflags,
bool  permanent = true 
)

◆ clearAll()

void Scene::clearAll ( )

clear rendering vectors

References clearObjs(), clearRefObjs(), and BoundCube::setInverseLimits().

Referenced by VisController::clearScene(), setVisControl(), and ~Scene().

Here is the caller graph for this function:

◆ clearDevices()

void Scene::clearDevices ( )

Clear the current selection devices.

Referenced by cloneActiveCam().

Here is the caller graph for this function:

◆ clearEffects()

void Scene::clearEffects ( )

Clear effects vector.

References UniqueIDHandler::clear().

Referenced by setEffects(), and setEffectVec().

Here is the caller graph for this function:

◆ clearObjs()

void Scene::clearObjs ( )

Clear drawing objects vector.

Referenced by clearAll(), and setVisControl().

Here is the caller graph for this function:

◆ clearRefObjs()

void Scene::clearRefObjs ( )

Clear the reference object vector.

Referenced by clearAll(), and setVisControl().

Here is the caller graph for this function:

◆ cloneActiveCam()

Camera* Scene::cloneActiveCam ( ) const
inline

◆ commitTempCam()

void Scene::commitTempCam ( )

Make the temp camera permanent.

References ASSERT.

Referenced by getAspect(), BasicGLPane::mouseLeftWindow(), BasicGLPane::mouseMoved(), and BasicGLPane::mouseReleased().

Here is the caller graph for this function:

◆ computeSceneLimits()

void Scene::computeSceneLimits ( )

Computes the bounding box for the scene.

References ASSERT, BoundCube::expand(), BoundCube::getCentroid(), BoundCube::isValid(), BoundCube::setBounds(), and BoundCube::setInverseLimits().

Referenced by applyDevice(), ensureVisible(), getBackgroundColour(), glSelect(), and ~Scene().

Here is the caller graph for this function:

◆ discardTempCam()

void Scene::discardTempCam ( )

Discard the temporary camera.

Referenced by getAspect(), BasicGLPane::mouseMoved(), BasicGLPane::saveImageSequence(), setActiveCam(), and setActiveCamByClone().

Here is the caller graph for this function:

◆ draw()

void Scene::draw ( bool  noUpdateCam = false)

◆ drawOverlays()

void Scene::drawOverlays ( bool  noCamUpdate = false) const

◆ duplicateCameras()

unsigned int Scene::duplicateCameras ( std::vector< Camera *> &  cams) const

Duplicates the internal camera vector. return value is active camera.

Referenced by getLastHover().

Here is the caller graph for this function:

◆ ensureVisible()

void Scene::ensureVisible ( unsigned int  direction)

Modify the active camera position to ensure that scene is visible.

References computeSceneLimits(), and Camera::ensureVisible().

Referenced by cloneActiveCam(), and BasicGLPane::keyPressed().

Here is the caller graph for this function:

◆ finaliseCam()

void Scene::finaliseCam ( )

Call if user has stopped interacting with camera briefly.

References CAM_LOOKAT, and Camera::type().

Referenced by cloneActiveCam(), and BasicGLPane::mouseReleased().

Here is the caller graph for this function:

◆ getActiveCam()

Camera * Scene::getActiveCam ( )

get the active camera

Referenced by applyDevice(), getAspect(), BasicGLPane::keyReleased(), BasicGLPane::mouseWheelMoved(), BasicGLPane::saveImage(), and BasicGLPane::saveImageSequence().

Here is the caller graph for this function:

◆ getActiveCamLoc()

Point3D Scene::getActiveCamLoc ( ) const

get the active camera's location

Referenced by getAspect().

Here is the caller graph for this function:

◆ getAspect()

float Scene::getAspect ( ) const
inline

◆ getBackgroundColour()

void Scene::getBackgroundColour ( float &  newR,
float &  newG,
float &  newB 
) const
inline

References computeSceneLimits().

Referenced by BasicGLPane::getGlClearColour(), BasicGLPane::saveImage(), and BasicGLPane::updateClearColour().

Here is the caller graph for this function:

◆ getBound()

BoundCube Scene::getBound ( ) const
inline

Get the scene bounding box.

Referenced by BasicGLPane::saveImage().

Here is the caller graph for this function:

◆ getEffects()

void Scene::getEffects ( std::vector< const Effect *> &  effects) const

Get a copy of the effects pointers.

Referenced by getLastHover().

Here is the caller graph for this function:

◆ getGlVersion()

static std::string Scene::getGlVersion ( )
inlinestatic

◆ getLastHover()

unsigned int Scene::getLastHover ( ) const
inline

Return the last object over which the cursor was hovered.

References duplicateCameras(), and getEffects().

Referenced by BasicGLPane::setSceneInteractionAllowed().

Here is the caller graph for this function:

◆ getLastSelected()

unsigned int Scene::getLastSelected ( ) const
inline

Get the last selected object from call to glSelect()

Referenced by BasicGLPane::mouseDown(), and BasicGLPane::setSceneInteractionAllowed().

Here is the caller graph for this function:

◆ getLightPos()

void Scene::getLightPos ( float *  f) const

Obtain the scene's light coordinates in camera relative space.

Referenced by BasicGLPane::saveImage(), and setVisControl().

Here is the caller graph for this function:

◆ getTempCam()

Camera * Scene::getTempCam ( )

Return pointer to active camera. Must init a temporary camera first! (use setTempCam)

References ASSERT.

Referenced by getAspect(), BasicGLPane::keyReleased(), BasicGLPane::mouseMoved(), and BasicGLPane::mouseWheelMoved().

Here is the caller graph for this function:

◆ getWorldAxisVisible()

bool Scene::getWorldAxisVisible ( ) const
inline

Get whether the XYZ world axes are enabled.

◆ glSelect()

unsigned int Scene::glSelect ( bool  storeSelection = true)

perform an openGL selection rendering pass. Return

References Camera::apply(), ASSERT, computeSceneLimits(), and BoundCube::isValid().

Referenced by cloneActiveCam(), and BasicGLPane::setSceneInteractionAllowed().

Here is the caller graph for this function:

◆ hasOverlays()

bool Scene::hasOverlays ( ) const

Do we have overlay items?

References Camera::apply(), Camera::getViewDirection(), progressCircle, DrawableOverlay::setPosition(), and DrawableOverlay::setSize().

Referenced by BasicGLPane::saveImage(), and setVisControl().

Here is the caller graph for this function:

◆ haveTempCam()

bool Scene::haveTempCam ( ) const
inline

◆ isInteractionLocked()

bool Scene::isInteractionLocked ( ) const
inline

◆ lockInteraction()

void Scene::lockInteraction ( bool  amLocking = true)
inline

Prevent user interaction.

Referenced by BasicGLPane::setSceneInteractionAllowed().

Here is the caller graph for this function:

◆ removeDrawable()

void Scene::removeDrawable ( unsigned  int)

remove a drawable object

Referenced by getAspect().

Here is the caller graph for this function:

◆ removeEffect()

void Scene::removeEffect ( unsigned int  uniqueEffectID)

Remove a given effect.

References UniqueIDHandler::getPos(), and UniqueIDHandler::killByPos().

Referenced by setEffects().

Here is the caller graph for this function:

◆ resetProgressAnim()

void Scene::resetProgressAnim ( )

References progressCircle, DrawProgressCircleOverlay::reset(), and DrawAnimatedOverlay::resetTime().

Referenced by getAspect().

Here is the caller graph for this function:

◆ setActiveCam()

void Scene::setActiveCam ( Camera c)

Set the active camera directly.

References discardTempCam().

Referenced by getAspect(), and BasicGLPane::saveImageSequence().

Here is the caller graph for this function:

◆ setActiveCamByClone()

void Scene::setActiveCamByClone ( const Camera c)

set the active camera

References Camera::clone(), and discardTempCam().

Referenced by getAspect().

Here is the caller graph for this function:

◆ setAlpha()

void Scene::setAlpha ( bool  newAlpha)
inline

Set whether to use alpha blending.

◆ setAspect()

void Scene::setAspect ( float  newAspect)

Set the aspect ratio of the output window. Required.

Referenced by BasicGLPane::prepare3DViewport(), and setVisControl().

Here is the caller graph for this function:

◆ setBackgroundColour()

void Scene::setBackgroundColour ( float  newR,
float  newG,
float  newB 
)
inline

Set the background colour.

Referenced by BasicGLPane::setGlClearColour().

Here is the caller graph for this function:

◆ setEffects()

void Scene::setEffects ( bool  enable)
inline

Set whether to use effects or not.

References addEffect(), clearEffects(), removeEffect(), and setEffectVec().

◆ setEffectVec()

void Scene::setEffectVec ( std::vector< Effect *> &  e)

Set the effect vector.

Pointers will become "owned" by scene and will be deleted during destruction, clear, or next setEffectVec call input vector will be cleared.

References addEffect(), and clearEffects().

Referenced by setEffects().

Here is the caller graph for this function:

◆ setHoverMode()

void Scene::setHoverMode ( bool  hMode)
inline

Set the hover mode to control drawing.

Referenced by BasicGLPane::setSceneInteractionAllowed().

Here is the caller graph for this function:

◆ setLastHover()

void Scene::setLastHover ( unsigned int  hover)
inline

Return the last object over which the cursor was hovered.

Referenced by BasicGLPane::setSceneInteractionAllowed().

Here is the caller graph for this function:

◆ setLighting()

void Scene::setLighting ( bool  newLight)
inline

Set whether to enable lighting.

◆ setLightPos()

void Scene::setLightPos ( const float *  f)

Obtain the scene's light coordinates in camera relative space.

Referenced by BasicGLPane::saveImage(), and setVisControl().

Here is the caller graph for this function:

◆ setProgressAnimation()

bool Scene::setProgressAnimation ( const std::vector< std::string > &  animFiles)

Referenced by getAspect().

Here is the caller graph for this function:

◆ setSelectionMode()

void Scene::setSelectionMode ( bool  selMode)
inline

Set selection mode true=select on, false=select off.

Referenced by BasicGLPane::mouseDown(), BasicGLPane::mouseLeftWindow(), and BasicGLPane::mouseReleased().

Here is the caller graph for this function:

◆ setTempCam()

void Scene::setTempCam ( )

Construct (or refresh) a temporary camera.

this temporary camera is discarded with either killTempCam or reset to the active camera with another call to setTempCam(). The temporary camera overrides the existing camera setup

References Camera::clone().

Referenced by getAspect(), and BasicGLPane::mouseMoved().

Here is the caller graph for this function:

◆ setVisControl()

void Scene::setVisControl ( VisController v)
inline

Set the vis control.

References clearAll(), clearObjs(), clearRefObjs(), draw(), drawOverlays(), getLightPos(), hasOverlays(), setAspect(), and setLightPos().

Referenced by VisController::VisController().

Here is the caller graph for this function:

◆ setWinSize()

void Scene::setWinSize ( unsigned int  x,
unsigned int  y 
)
inline

Set window size.

Referenced by BasicGLPane::prepare3DViewport().

Here is the caller graph for this function:

◆ setWorldAxisVisible()

void Scene::setWorldAxisVisible ( bool  newAxis)
inline

Set whether to enable the XYZ world axes.

Member Data Documentation

◆ progressCircle

DrawProgressCircleOverlay Scene::progressCircle

The documentation for this class was generated from the following files: