OpenStructure
Data Structures | Public Member Functions | Static Public Member Functions | Friends
Scene Class Reference

#include <scene.hh>

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
 
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
 
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::AtomHandlePickAtom (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)
 

Static Public Member Functions

static SceneInstance ()
 

Friends

class impl::SceneFX
 

scene graph

class GfxObj
 
class GfxNode
 
class Entity
 
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
 
void AttachObserver (SceneObserver *o)
 
void DetachObserver (SceneObserver *o)
 
void SetTestMode (bool t)
 
float ElapsedTime () const
 
Viewport GetViewport () const
 
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
 
void SetAlphaBias (Real bias)
 
void ContextSwitch ()
 
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)
 

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 80 of file scene.hh.

Member Function Documentation

◆ Add()

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

add graphical object to scene

◆ Apply() [1/2]

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

actual event handling for scene (internal use)

◆ Apply() [2/2]

void Apply ( GfxNodeVisitor v) const

apply node visitor to root node

◆ AttachObserver()

void AttachObserver ( SceneObserver o)

observer interface (internal use)

◆ AutoAutoslab()

void AutoAutoslab ( bool  f)

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

the current autoslab mode is honored SetAutoslabMode(int)

◆ Autoslab() [1/3]

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

◆ Autoslab() [2/3]

void Autoslab ( bool  fast)

DEPRECATED, use Autoslab() and SetAutoslabMode(int)

◆ Autoslab() [3/3]

void Autoslab ( bool  fast,
bool   
)

DEPRECATED, use Autoslab() and SetAutoslabMode(int)

◆ AutoslabMax()

void AutoslabMax ( )

DEPRECATED, use SetAutoslabMode(2)

◆ BlurSnapshot()

void BlurSnapshot ( )

experimental feature

◆ CenterOn() [1/2]

void CenterOn ( const GfxObjP s)

center given object

◆ CenterOn() [2/2]

void CenterOn ( const String s)

center on object of given name

◆ ContextSwitch()

void ContextSwitch ( )

◆ DetachObserver()

void DetachObserver ( SceneObserver o)

observer interface (internal use)

◆ ElapsedTime()

float ElapsedTime ( ) const

◆ Export() [1/4]

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

export snapshot of current scene

◆ Export() [2/4]

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

◆ Export() [3/4]

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

export into bitmap, using multisample anti-aliasing

◆ Export() [4/4]

void Export ( Exporter ex) const

export scene via exporter

◆ ExportPov()

void ExportPov ( const std::string &  fname,
const std::string &  wdir = "." 
)

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

◆ GetAmbientOcclusion()

bool GetAmbientOcclusion ( ) const

experimental feature

◆ GetAmbientOcclusionMode()

uint GetAmbientOcclusionMode ( ) const

experimental feature

◆ GetAmbientOcclusionQuality()

uint GetAmbientOcclusionQuality ( ) const

experimental feature

◆ GetAmbientOcclusionSize()

float GetAmbientOcclusionSize ( ) const

experimental feature

◆ GetAmbientOcclusionWeight()

float GetAmbientOcclusionWeight ( ) const

experimental feature

◆ GetAspect()

float GetAspect ( ) const
inline

Definition at line 179 of file scene.hh.

◆ GetAutoAutoslab()

bool GetAutoAutoslab ( ) const
inline

get current state of automatic autoslab'bing

Definition at line 238 of file scene.hh.

◆ GetAutoslabMode()

int GetAutoslabMode ( ) const
inline

return current autoslab mode

Definition at line 226 of file scene.hh.

◆ GetBackground()

Color GetBackground ( ) const

get background color

◆ GetBackgroundStereoMode()

bool GetBackgroundStereoMode ( ) const
inline

Definition at line 353 of file scene.hh.

◆ GetBackgroundStereoOffset()

float GetBackgroundStereoOffset ( ) const
inline

Definition at line 357 of file scene.hh.

◆ GetBoundingBox() [1/2]

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.

◆ GetBoundingBox() [2/2]

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

return bounding box of with a given transform

◆ GetCenter()

geom::Vec3 GetCenter ( ) const

retrieve center

◆ GetDefaultTextSize()

float GetDefaultTextSize ( )

◆ GetExportAspect()

float GetExportAspect ( ) const
inline

Definition at line 491 of file scene.hh.

◆ GetFar()

float GetFar ( ) const

get far clipping plane

◆ GetFixCenter()

bool GetFixCenter ( ) const
inline

return flag

Definition at line 475 of file scene.hh.

◆ GetFog()

bool GetFog ( ) const

check fog status

◆ GetFogColor()

Color GetFogColor ( ) const

get the fog color

◆ GetFogFarOffset()

float GetFogFarOffset ( ) const
See also
SetFogFarOffset

◆ GetFogNearOffset()

float GetFogNearOffset ( ) const

◆ GetFOV()

float GetFOV ( ) const

◆ GetHemiParams()

geom::Vec4 GetHemiParams ( ) const
inline

Definition at line 147 of file scene.hh.

◆ GetInvertedProjection()

geom::Mat4 GetInvertedProjection ( ) const
inline

Definition at line 154 of file scene.hh.

◆ GetLightDir()

geom::Vec3 GetLightDir ( ) const
inline

get main light direction

Definition at line 281 of file scene.hh.

◆ GetLightRot()

geom::Mat3 GetLightRot ( ) const
inline

get main light orientation (internal debugging use)

Definition at line 283 of file scene.hh.

◆ GetNear()

float GetNear ( ) const

get near clipping plane

◆ GetNodeCount()

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

◆ GetProjection()

geom::Mat4 GetProjection ( ) const
inline

Definition at line 153 of file scene.hh.

◆ GetRootNode()

GfxNodeP GetRootNode ( ) const

get root node of scene graph

◆ GetRTC()

geom::Mat4 GetRTC ( ) const

returns a compact, internal representation of the scene orientation

◆ GetSelectionMode()

uint GetSelectionMode ( ) const

◆ GetShadow()

bool GetShadow ( ) const

get shadow mapping status

◆ GetShadowQuality()

int GetShadowQuality ( ) const

get shadow quality

◆ GetShadowWeight()

float GetShadowWeight ( ) const

get shadow strength

◆ GetShowCenter()

bool GetShowCenter ( ) const
inline

Definition at line 469 of file scene.hh.

◆ GetShowExportAspect()

bool GetShowExportAspect ( ) const
inline

Definition at line 493 of file scene.hh.

◆ GetStereoAlg()

unsigned int GetStereoAlg ( ) const
inline

return current stereo algorithm

Definition at line 272 of file scene.hh.

◆ GetStereoDistance()

Real GetStereoDistance ( ) const
inline

return current stereo distance offset from COR

Definition at line 266 of file scene.hh.

◆ GetStereoFlip()

bool GetStereoFlip ( ) const
inline

return invert flag for stereo

Definition at line 250 of file scene.hh.

◆ GetStereoIOD()

Real GetStereoIOD ( ) const
inline

return current stereo eye distance

Definition at line 261 of file scene.hh.

◆ GetStereoMode()

int GetStereoMode ( ) const
inline

Definition at line 245 of file scene.hh.

◆ GetStereoView()

int GetStereoView ( ) const
inline

return current stereo view mode

Definition at line 256 of file scene.hh.

◆ GetTransform()

geom::Transform GetTransform ( ) const

get full underlying transformation

◆ GetViewport()

Viewport GetViewport ( ) const

◆ HasMultisample()

bool HasMultisample ( ) const
inline

Definition at line 495 of file scene.hh.

◆ HasNode()

bool HasNode ( const String name) const

whether the scene contains a node of the given name

◆ InitGL()

void InitGL ( bool  full = true)

initialize OpenGL after context has been setup (internal use)

◆ Instance()

static Scene& Instance ( )
static

◆ NodeAdded()

void NodeAdded ( const GfxNodeP node)
protected

◆ NodeTransformed()

void NodeTransformed ( const GfxObjP object)
protected

◆ ObjectChanged()

void ObjectChanged ( const String name)
protected

◆ OnInput()

void OnInput ( const InputEvent e)

entry point for gui events (internal use)

◆ operator[]()

GfxObjP operator[] ( const String name)

retrieve gfx object by name

◆ Pick()

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

pick at given mouse coords

◆ PickAtom()

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

pick atom at given mouse coord

◆ PopView()

void PopView ( )

retrieve a previously pushed orientation

◆ Project()

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

calculate projection of a point into the scene

◆ PushView()

void PushView ( )

push the current orientation onto a stack

◆ Register()

void Register ( GLWinBase win)

gui glue interface (internal use)

◆ Remove() [1/2]

void Remove ( const GfxNodeP go)

remove graphical object from scene remove graphical object from the scene

◆ Remove() [2/2]

void Remove ( const String name)

remove graphical object from the scene

◆ RemoveAll()

void RemoveAll ( )

remove all objects from the scene

◆ Rename()

bool Rename ( const String old_name,
const String new_name 
)

rename an existing graphical object defunct for now

◆ RenderGL()

void RenderGL ( )

render all gl objects (internal use)

◆ RenderModeChanged()

void RenderModeChanged ( const String name)
protected

◆ RenderText()

void RenderText ( const TextPrim t)

internal use

◆ RequestRedraw()

void RequestRedraw ( )

request redraw of gl scene

◆ ResetProjection()

void ResetProjection ( )

brief re-generates the projection matrix (internal use)

◆ Resize()

void Resize ( int  w,
int  h 
)

handle new viewport size (internal use)

◆ SelectionChanged()

void SelectionChanged ( const String name,
const mol::EntityView sel 
)
protected

◆ SetAlphaBias()

void SetAlphaBias ( Real  bias)

◆ SetAmbientOcclusion()

void SetAmbientOcclusion ( bool  f)

experimental feature

◆ SetAmbientOcclusionMode()

void SetAmbientOcclusionMode ( uint  m)

experimental feature

◆ SetAmbientOcclusionQuality()

void SetAmbientOcclusionQuality ( uint  q)

experimental feature

◆ SetAmbientOcclusionSize()

void SetAmbientOcclusionSize ( float  f)

experimental feature

◆ SetAmbientOcclusionWeight()

void SetAmbientOcclusionWeight ( float  f)

experimental feature

◆ SetAutoslabMode()

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 221 of file scene.hh.

◆ SetBackground() [1/3]

void SetBackground ( const Bitmap bm)

set background image

◆ SetBackground() [2/3]

void SetBackground ( const Color c)

set background color

◆ SetBackground() [3/3]

void SetBackground ( const Gradient g)

set background gradient

◆ SetBackgroundStereoMode()

void SetBackgroundStereoMode ( bool  )

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

◆ SetBackgroundStereoOffset()

void SetBackgroundStereoOffset ( float  )

background tile left/right offset

◆ SetBeacon()

void SetBeacon ( int  wx,
int  wy 
)

experimental feature

◆ SetBeaconOff()

void SetBeaconOff ( )

experimental feature

◆ SetBlur()

void SetBlur ( uint  n)

experimental feature

◆ SetCenter()

void SetCenter ( const geom::Vec3 cen)

center rotation on the given point

◆ SetDepthDarkening()

void SetDepthDarkening ( bool  f)

experimental feature

◆ SetDepthDarkeningWeight()

void SetDepthDarkeningWeight ( float  f)

experimental feature

◆ SetExportAspect()

void SetExportAspect ( float  a)

◆ SetFar()

void SetFar ( float  f)

set far clipping plane

◆ SetFixCenter()

void SetFixCenter ( bool  f)
inline

if true fix center of rotation upon input induced shift

Definition at line 472 of file scene.hh.

◆ SetFog()

void SetFog ( bool  f)

turn fog on or off

◆ SetFogColor()

void SetFogColor ( const Color c)

set the fog color

◆ SetFogFarOffset()

void SetFogFarOffset ( float  o)

offset between far clipping plane and end of fog

◆ SetFogNearOffset()

void SetFogNearOffset ( float  o)

offset between near clipping plane and start of fog

◆ SetFogOffsets()

void SetFogOffsets ( float  no,
float  fo 
)

convenciene function to set fog near and far offset

◆ SetFOV()

void SetFOV ( float  f)

set field of view angle

◆ SetHemiParams()

void SetHemiParams ( const geom::Vec4 )

◆ SetLightDir()

void SetLightDir ( const geom::Vec3 dir)

set main light direction

◆ SetLightProp() [1/2]

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

set ambient, diffuse and specular light color

◆ SetLightProp() [2/2]

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

set ambient, diffuse and specular light intensity

◆ SetNear()

void SetNear ( float  n)

set near clipping plane

◆ SetNearFar()

void SetNearFar ( float  n,
float  f 
)

set near and far clipping plane at once

◆ SetRTC()

void SetRTC ( const geom::Mat4 rtc)

sets a previously retrieved orientation

◆ SetSelectionMode()

void SetSelectionMode ( uint  m)

set the selection mode

◆ SetShadingMode()

void SetShadingMode ( const std::string &  smode)

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

◆ SetShadow()

void SetShadow ( bool  f)

turn shadow mapping on and off

◆ SetShadowQuality()

void SetShadowQuality ( int  q)

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

◆ SetShadowWeight()

void SetShadowWeight ( float  w)

multiplier for shadow strength

◆ SetShowCenter()

void SetShowCenter ( bool  f)

show center of rotation of true

◆ SetShowExportAspect()

void SetShowExportAspect ( bool  f)

◆ SetStereoAlg()

void SetStereoAlg ( unsigned int  )

set stereo algorithm one of 0 (default) or 1

◆ SetStereoDistance()

void SetStereoDistance ( Real  )

set stereo distance offset from COR

◆ SetStereoFlip()

void SetStereoFlip ( bool  f)

invert stereo eyes for stereo mode=0

◆ SetStereoIOD()

void SetStereoIOD ( Real  )

set stereo eye distance

◆ SetStereoMode()

void SetStereoMode ( unsigned int  mode)

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

◆ SetStereoView()

void SetStereoView ( int  )

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

◆ SetTestMode()

void SetTestMode ( bool  t)

switch into test mode (internal use)

◆ SetTransform()

void SetTransform ( const geom::Transform t)

set transform

◆ SetViewport()

void SetViewport ( int  w,
int  h 
)

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

◆ StatusMessage()

void StatusMessage ( const String s)

send status message to gui

◆ UnProject()

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

calculate unprojected point out of the scene

◆ Unregister()

void Unregister ( GLWinBase win)

gui glue interface (internal use)

Friends And Related Function Documentation

◆ Entity

friend class Entity
friend

Definition at line 506 of file scene.hh.

◆ GfxNode

friend class GfxNode
friend

Definition at line 503 of file scene.hh.

◆ GfxObj

friend class GfxObj
friend

Definition at line 502 of file scene.hh.

◆ impl::SceneFX

friend class impl::SceneFX
friend

Definition at line 81 of file scene.hh.


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