Scene Class Reference

main class for organization and root for the graphical display More...

#include <scene.hh>

Data Structures

struct  SceneViewStackEntry

Public Member Functions

void SetFog (bool f)
bool GetFog () const
void SetFogColor (const Color &c)
Color GetFogColor () const
void SetShadow (bool f)
bool GetShadow () const
void SetShadowQuality (int q)
int GetShadowQuality () const
void SetShadowWeight (float w)
float GetShadowWeight () const
void SetDepthDarkening (bool f)
void SetDepthDarkeningWeight (float f)
void SetAmbientOcclusion (bool f)
bool GetAmbientOcclusion () const
void SetAmbientOcclusionWeight (float f)
float GetAmbientOcclusionWeight () const
void SetAmbientOcclusionMode (uint m)
uint GetAmbientOcclusionMode () const
void SetAmbientOcclusionQuality (uint q)
uint GetAmbientOcclusionQuality () const
void SetAmbientOcclusionSize (float f)
float GetAmbientOcclusionSize () const
void SetHemiParams (const geom::Vec4 &)
geom::Vec4 GetHemiParams () const
void SetShadingMode (const std::string &smode)
geom::Mat4 GetProjection () const
geom::Mat4 GetInvertedProjection () const
void SetStereoMode (unsigned int mode)
int GetStereoMode () const
void SetStereoFlip (bool f)
bool GetStereoFlip () const
void SetStereoView (int)
int GetStereoView () const
void SetStereoIOD (Real)
Real GetStereoIOD () const
void SetStereoDistance (Real)
Real GetStereoDistance () const
void SetStereoAlg (unsigned int)
unsigned int GetStereoAlg () const
void SetLightDir (const geom::Vec3 &dir)
void SetLightProp (const Color &amb, const Color &diff, const Color &spec)
void SetLightProp (float amb, float diff, float spec)
geom::Vec3 GetLightDir () const
geom::Mat3 GetLightRot () const
void SetSelectionMode (uint m)
uint GetSelectionMode () const
void Export (const String &fname, unsigned int w, unsigned int h, bool transparent=false)
void Export (const String &fname, unsigned int w, unsigned int h, int max_samples, bool transparent=false)
void Export (const String &fname, bool transparent=false)
void ExportPov (const std::string &fname, const std::string &wdir=".")
void Export (Exporter *ex) const
void OnInput (const InputEvent &e)
void InitGL (bool full=true)
void Resize (int w, int h)
void Pick (int mx, int my, int mask)
float GetDefaultTextSize ()
std::pair< GfxObjP,
mol::AtomHandle
PickAtom (int mx, int my)
void RenderGL ()
void RequestRedraw ()
void StatusMessage (const String &s)
void SetViewport (int w, int h)
void SetBackground (const Color &c)
void SetBackground (const Gradient &g)
void SetBackground (const Bitmap &bm)
Color GetBackground () const
void SetBackgroundStereoMode (bool)
bool GetBackgroundStereoMode () const
void SetBackgroundStereoOffset (float)
float GetBackgroundStereoOffset () const
void SetCenter (const geom::Vec3 &cen)
geom::Vec3 GetCenter () const
void CenterOn (const String &s)
void CenterOn (const GfxObjP &s)
geom::Vec3 Project (const geom::Vec3 &v, bool ignore_vp=false) const
geom::Vec3 UnProject (const geom::Vec3 &v, bool ignore_vp=false) const
geom::AlignedCuboid GetBoundingBox (bool use_tf=true) const
geom::AlignedCuboid GetBoundingBox (const geom::Transform &tf) const
geom::Transform GetTransform () const
void SetTransform (const geom::Transform &t)
geom::Mat4 GetRTC () const
void SetRTC (const geom::Mat4 &rtc)
void PushView ()
void PopView ()
void ResetProjection ()
void Register (GLWinBase *win)
void Unregister (GLWinBase *win)
void AttachObserver (SceneObserver *o)
void DetachObserver (SceneObserver *o)
bool InOffscreenMode () const
void SetTestMode (bool t)
float ElapsedTime () const
Viewport GetViewport () const
bool StartOffscreenMode (unsigned int w, unsigned int h, int max_samples)
bool StartOffscreenMode (unsigned int w, unsigned int h)
void StopOffscreenMode ()
void SetShowCenter (bool f)
bool GetShowCenter () const
void SetFixCenter (bool f)
bool GetFixCenter () const
void SetBlur (uint n)
void BlurSnapshot ()
void RenderText (const TextPrim &t)
void SetBeacon (int wx, int wy)
void SetBeaconOff ()
void SetExportAspect (float a)
float GetExportAspect () const
void SetShowExportAspect (bool f)
bool GetShowExportAspect () const
bool HasMultisample () const
clipping planes, fog and field-of-view



float GetNear () const
void SetNear (float n)
float GetFar () const
void SetFar (float f)
void SetNearFar (float n, float f)
void SetFOV (float f)
float GetFOV () const
float GetAspect () const
void SetFogNearOffset (float o)
float GetFogNearOffset () const
void SetFogFarOffset (float o)
float GetFogFarOffset () const
void SetFogOffsets (float no, float fo)
void Autoslab (bool fast)
void Autoslab (bool fast, bool)
void AutoslabMax ()
void Autoslab ()
void SetAutoslabMode (int mode)
int GetAutoslabMode () const
void AutoAutoslab (bool f)
bool GetAutoAutoslab () const
scene graph



void Add (const GfxNodeP &go, bool redraw=true)
void Remove (const GfxNodeP &go)
void Remove (const String &name)
void RemoveAll ()
bool Rename (const String &old_name, const String &new_name)
GfxObjP operator[] (const String &name)
bool HasNode (const String &name) const
void Apply (const InputEvent &ie, bool request_redraw=true)
void Apply (GfxNodeVisitor &v) const
size_t GetNodeCount () const
GfxNodeP GetRootNode () const

Static Public Member Functions

static SceneInstance ()

Protected Member Functions

void ObjectChanged (const String &name)
void SelectionChanged (const String &name, const mol::EntityView &sel)
void NodeTransformed (const GfxObjP &object)
void NodeAdded (const GfxNodeP &node)
void RenderModeChanged (const String &name)

Friends

class impl::SceneFX
class GfxObj
class GfxNode
class Entity

Detailed Description

main class for organization and root for the graphical display

The scene manages graphical objects for rendering. Typical graphical objects include entities, isocontoured maps, density slabs, molecular surfaces, or primitives such as cuboids, quads and lines. The nodes are organized in a tree-like structure whose root can obtained with GetRootNode().

The center of the eye is controlled with SetCenter() and CenterOn().

By default, the near and far clipping planes are adjusted such that they contain all visible objects in the scene. This behaviour can be turned of by disabling the AutoAutoslab(). The near and far clipping plane can then be adjusted manually.

Definition at line 81 of file scene.hh.


Member Function Documentation

void Add ( const GfxNodeP go,
bool  redraw = true 
)

add graphical object to scene

void Apply ( GfxNodeVisitor v  )  const

apply node visitor to root node

void Apply ( const InputEvent ie,
bool  request_redraw = true 
)

actual event handling for scene (internal use)

void AttachObserver ( SceneObserver o  ) 

observer interface (internal use)

void AutoAutoslab ( bool  f  ) 

turn automatic autoslab'bing on or off for each scene update

the current autoslab mode is honored SetAutoslabMode(int)

void Autoslab (  ) 

adjust near and far clipping plane to fit visible objects

Use autoslab mode to calculate near and far clipping places; this does not need to be called explicitely if AutoAutoslab is active. Uses the mode set by SetAutoslabMode

void Autoslab ( bool  fast,
bool   
)

DEPRECATED, use Autoslab() and SetAutoslabMode(int).

void Autoslab ( bool  fast  ) 

DEPRECATED, use Autoslab() and SetAutoslabMode(int).

void AutoslabMax (  ) 

DEPRECATED, use SetAutoslabMode(2).

void BlurSnapshot (  ) 

experimental feature

void CenterOn ( const GfxObjP s  ) 

center given object

void CenterOn ( const String s  ) 

center on object of given name

void DetachObserver ( SceneObserver o  ) 

observer interface (internal use)

float ElapsedTime (  )  const
void Export ( Exporter ex  )  const

export scene via exporter

void Export ( const String fname,
bool  transparent = false 
)

export snapshot of current scene

void Export ( const String fname,
unsigned int  w,
unsigned int  h,
int  max_samples,
bool  transparent = false 
)

export into bitmap, using multisample anti-aliasing

void Export ( const String fname,
unsigned int  w,
unsigned int  h,
bool  transparent = false 
)

export scene into a bitmap, rendering into offscreen of given size if a main offscreen buffer is active (

See also:
StartOffscreenMode), then the dimensions here are ignored
void ExportPov ( const std::string &  fname,
const std::string &  wdir = "." 
)

export scene into povray files named fname.pov and fname.inc

bool GetAmbientOcclusion (  )  const

experimental feature

uint GetAmbientOcclusionMode (  )  const

experimental feature

uint GetAmbientOcclusionQuality (  )  const

experimental feature

float GetAmbientOcclusionSize (  )  const

experimental feature

float GetAmbientOcclusionWeight (  )  const

experimental feature

float GetAspect (  )  const [inline]

Definition at line 180 of file scene.hh.

bool GetAutoAutoslab (  )  const [inline]

get current state of automatic autoslab'bing

Definition at line 239 of file scene.hh.

int GetAutoslabMode (  )  const [inline]

return current autoslab mode

Definition at line 227 of file scene.hh.

Color GetBackground (  )  const

get background color

bool GetBackgroundStereoMode (  )  const [inline]

Definition at line 358 of file scene.hh.

float GetBackgroundStereoOffset (  )  const [inline]

Definition at line 362 of file scene.hh.

geom::AlignedCuboid GetBoundingBox ( const geom::Transform tf  )  const

return bounding box of with a given transform

geom::AlignedCuboid GetBoundingBox ( bool  use_tf = true  )  const

return bounding box of scene

the sole boolean parameter determines whether or not the scene transformation is applied to calculate the bounding box. Since in most cases it should be used, the default value is true.

geom::Vec3 GetCenter (  )  const

retrieve center

float GetDefaultTextSize (  ) 
float GetExportAspect (  )  const [inline]

Definition at line 523 of file scene.hh.

float GetFar (  )  const

get far clipping plane

bool GetFixCenter (  )  const [inline]

return flag

Definition at line 507 of file scene.hh.

bool GetFog (  )  const

check fog status

Color GetFogColor (  )  const

get the fog color

float GetFogFarOffset (  )  const
See also:
SetFogFarOffset
float GetFogNearOffset (  )  const
See also:
SetFogNearOffset
float GetFOV (  )  const
geom::Vec4 GetHemiParams (  )  const [inline]

Definition at line 148 of file scene.hh.

geom::Mat4 GetInvertedProjection (  )  const [inline]

Definition at line 155 of file scene.hh.

geom::Vec3 GetLightDir (  )  const [inline]

get main light direction

Definition at line 282 of file scene.hh.

geom::Mat3 GetLightRot (  )  const [inline]

get main light orientation (internal debugging use)

Definition at line 284 of file scene.hh.

float GetNear (  )  const

get near clipping plane

size_t GetNodeCount (  )  const

get total number of nodes in scene

To obtain the number of top-level nodes, use GfxNode::GetChildCount() of the root node

geom::Mat4 GetProjection (  )  const [inline]

Definition at line 154 of file scene.hh.

GfxNodeP GetRootNode (  )  const

get root node of scene graph

geom::Mat4 GetRTC (  )  const

returns a compact, internal representation of the scene orientation

uint GetSelectionMode (  )  const
bool GetShadow (  )  const

get shadow mapping status

int GetShadowQuality (  )  const

get shadow quality

float GetShadowWeight (  )  const

get shadow strength

bool GetShowCenter (  )  const [inline]

Definition at line 501 of file scene.hh.

bool GetShowExportAspect (  )  const [inline]

Definition at line 525 of file scene.hh.

unsigned int GetStereoAlg (  )  const [inline]

return current stereo algorithm

Definition at line 273 of file scene.hh.

Real GetStereoDistance (  )  const [inline]

return current stereo distance offset from COR

Definition at line 267 of file scene.hh.

bool GetStereoFlip (  )  const [inline]

return invert flag for stereo

Definition at line 251 of file scene.hh.

Real GetStereoIOD (  )  const [inline]

return current stereo eye distance

Definition at line 262 of file scene.hh.

int GetStereoMode (  )  const [inline]

Definition at line 246 of file scene.hh.

int GetStereoView (  )  const [inline]

return current stereo view mode

Definition at line 257 of file scene.hh.

geom::Transform GetTransform (  )  const

get full underlying transformation

Viewport GetViewport (  )  const
bool HasMultisample (  )  const [inline]

Definition at line 527 of file scene.hh.

bool HasNode ( const String name  )  const

whether the scene contains a node of the given name

void InitGL ( bool  full = true  ) 

initialize OpenGL after context has been setup (internal use)

bool InOffscreenMode (  )  const
static Scene& Instance (  )  [static]
void NodeAdded ( const GfxNodeP node  )  [protected]
void NodeTransformed ( const GfxObjP object  )  [protected]
void ObjectChanged ( const String name  )  [protected]
void OnInput ( const InputEvent e  ) 

entry point for gui events (internal use)

GfxObjP operator[] ( const String name  ) 

retrieve gfx object by name

void Pick ( int  mx,
int  my,
int  mask 
)

pick at given mouse coords

std::pair<GfxObjP, mol::AtomHandle> PickAtom ( int  mx,
int  my 
)

pick atom at given mouse coord

void PopView (  ) 

retrieve a previously pushed orientation

geom::Vec3 Project ( const geom::Vec3 v,
bool  ignore_vp = false 
) const

calculate projection of a point into the scene

void PushView (  ) 

push the current orientation onto a stack

void Register ( GLWinBase win  ) 

gui glue interface (internal use)

void Remove ( const String name  ) 

remove graphical object from the scene

void Remove ( const GfxNodeP go  ) 

remove graphical object from scene remove graphical object from the scene

void RemoveAll (  ) 

remove all objects from the scene

bool Rename ( const String old_name,
const String new_name 
)

rename an existing graphical object defunct for now

void RenderGL (  ) 

render all gl objects (internal use)

void RenderModeChanged ( const String name  )  [protected]
void RenderText ( const TextPrim t  ) 

internal use

void RequestRedraw (  ) 

request redraw of gl scene

void ResetProjection (  ) 

brief re-generates the projection matrix (internal use)

void Resize ( int  w,
int  h 
)

handle new viewport size (internal use)

void SelectionChanged ( const String name,
const mol::EntityView sel 
) [protected]
void SetAmbientOcclusion ( bool  f  ) 

experimental feature

void SetAmbientOcclusionMode ( uint  m  ) 

experimental feature

void SetAmbientOcclusionQuality ( uint  q  ) 

experimental feature

void SetAmbientOcclusionSize ( float  f  ) 

experimental feature

void SetAmbientOcclusionWeight ( float  f  ) 

experimental feature

void SetAutoslabMode ( int  mode  )  [inline]

set autoslab mode

0: fast (default), using only the bounding box 1: precise, using each graphical element (not implemented) 2: max, using maximal extent upon rotation

Definition at line 222 of file scene.hh.

void SetBackground ( const Bitmap bm  ) 

set background image

void SetBackground ( const Gradient g  ) 

set background gradient

void SetBackground ( const Color c  ) 

set background color

void SetBackgroundStereoMode ( bool   ) 

use bg bitmap for stereo mode this tiles the background bitmap at the far plane

void SetBackgroundStereoOffset ( float   ) 

background tile left/right offset

void SetBeacon ( int  wx,
int  wy 
)

experimental feature

void SetBeaconOff (  ) 

experimental feature

void SetBlur ( uint  n  ) 

experimental feature

void SetCenter ( const geom::Vec3 cen  ) 

center rotation on the given point

void SetDepthDarkening ( bool  f  ) 

experimental feature

void SetDepthDarkeningWeight ( float  f  ) 

experimental feature

void SetExportAspect ( float  a  ) 
void SetFar ( float  f  ) 

set far clipping plane

void SetFixCenter ( bool  f  )  [inline]

if true fix center of rotation upon input induced shift

Definition at line 504 of file scene.hh.

void SetFog ( bool  f  ) 

turn fog on or off

void SetFogColor ( const Color c  ) 

set the fog color

void SetFogFarOffset ( float  o  ) 

offset between far clipping plane and end of fog

void SetFogNearOffset ( float  o  ) 

offset between near clipping plane and start of fog

void SetFogOffsets ( float  no,
float  fo 
)

convenciene function to set fog near and far offset

void SetFOV ( float  f  ) 

set field of view angle

void SetHemiParams ( const geom::Vec4  ) 
void SetLightDir ( const geom::Vec3 dir  ) 

set main light direction

void SetLightProp ( float  amb,
float  diff,
float  spec 
)

set ambient, diffuse and specular light intensity

void SetLightProp ( const Color amb,
const Color diff,
const Color spec 
)

set ambient, diffuse and specular light color

void SetNear ( float  n  ) 

set near clipping plane

void SetNearFar ( float  n,
float  f 
)

set near and far clipping plane at once

void SetRTC ( const geom::Mat4 rtc  ) 

sets a previously retrieved orientation

void SetSelectionMode ( uint  m  ) 

set the selection mode

void SetShadingMode ( const std::string &  smode  ) 

select shading mode one of fallback, basic, default, hf, toon1, toon2

void SetShadow ( bool  f  ) 

turn shadow mapping on and off

void SetShadowQuality ( int  q  ) 

shadow quality from 0 (low) to 3 (high), default=1

void SetShadowWeight ( float  w  ) 

multiplier for shadow strength

void SetShowCenter ( bool  f  ) 

show center of rotation of true

void SetShowExportAspect ( bool  f  ) 
void SetStereoAlg ( unsigned  int  ) 

set stereo algorithm one of 0 (default) or 1

void SetStereoDistance ( Real   ) 

set stereo distance offset from COR

void SetStereoFlip ( bool  f  ) 

invert stereo eyes for stereo mode=0

void SetStereoIOD ( Real   ) 

set stereo eye distance

void SetStereoMode ( unsigned int  mode  ) 

set stereo mode one of 0 (off), 1 (quad-buffered) 2 (interlaced (for special monitors))

void SetStereoView ( int   ) 

stereo view mode one of 0 (center), -1 (left), 1 (right)

void SetTestMode ( bool  t  ) 

switch into test mode (internal use)

void SetTransform ( const geom::Transform t  ) 

set transform

void SetViewport ( int  w,
int  h 
)

set the viewport; the mapping to the visible window (internal use)

bool StartOffscreenMode ( unsigned int  w,
unsigned int  h 
)
bool StartOffscreenMode ( unsigned int  w,
unsigned int  h,
int  max_samples 
)

This method has two different tasks.

During interactive rendering, it facilitates export into an offscreen buffer with Scene::Export(file,width,height) by avoiding repeated initializations of the GL state, e.g. during animation rendering.

During batch mode, this is the only way to get meaningful functionality with the gfx module

Returns true upon success and false upon failure

You can ask for multisampling to be enabled by giving the max_samples a value larger than zero; in this case, the framebuffer with at most this many samplebuffers will be used. The recommended value here is 4; going to 8 or 16 may give you higher export times with usually no marked increase in quality.

void StatusMessage ( const String s  ) 

send status message to gui

void StopOffscreenMode (  ) 

stops offline rendering in interactive mode

geom::Vec3 UnProject ( const geom::Vec3 v,
bool  ignore_vp = false 
) const

calculate unprojected point out of the scene

void Unregister ( GLWinBase win  ) 

gui glue interface (internal use)


Friends And Related Function Documentation

friend class Entity [friend]

Definition at line 533 of file scene.hh.

friend class GfxNode [friend]

Definition at line 530 of file scene.hh.

friend class GfxObj [friend]

Definition at line 529 of file scene.hh.

friend class impl::SceneFX [friend]

Definition at line 82 of file scene.hh.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated on 6 Dec 2017 for OpenStructure by  doxygen 1.6.1