OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Data Structures | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
Scene Class Reference

#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 SetShadingMode (const std::string &smode)
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, 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)
Color GetBackground () 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 (const mol::Transform &tf) const
mol::Transform GetTransform () const
void SetTransform (const mol::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)
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 ()
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
void SetFogNearOffset (float o)
float GetFogNearOffset () const
void SetFogFarOffset (float o)
float GetFogFarOffset () const
void SetFogOffsets (float no, float fo)
void Autoslab (bool fast=false, bool redraw=true)
void AutoslabMax ()
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 79 of file scene.hh.


Member Function Documentation

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

add graphical object to scene

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

actual event handling for scene (internal use)

void Apply ( GfxNodeVisitor v) const

apply node visitor to root node

void AttachObserver ( SceneObserver o)

observer interface (internal use)

void AutoAutoslab ( bool  f)

turn on automatic auto-slabbing (using the fast bounding box alg)

void Autoslab ( bool  fast = false,
bool  redraw = true 
)

adjust near and far clipping plane to fit visible objects

void AutoslabMax ( )

adjust clipping planes to fix maximal extent of all objects even under rotation

void BlurSnapshot ( )

experimental feature

void CenterOn ( const String s)

center on object of given name

void CenterOn ( const GfxObjP s)

center given object

void DetachObserver ( SceneObserver o)

observer interface (internal use)

float ElapsedTime ( ) const
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 Export ( const String fname,
bool  transparent = false 
)

export snapshot of current scene

void Export ( Exporter ex) const

export scene via exporter

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 GetAmbientOcclusionWeight ( ) const

experimental feature

bool GetAutoAutoslab ( ) const
inline

get current state of automatic auto-slabbing

Definition at line 197 of file scene.hh.

Color GetBackground ( ) const

get background color

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

return bounding box of scene under given transform

geom::Vec3 GetCenter ( ) const

retrieve center

float GetDefaultTextSize ( )
float GetFar ( ) const

get far clipping plane

bool GetFixCenter ( ) const
inline

return flag

Definition at line 430 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::Vec3 GetLightDir ( ) const
inline

get main light direction

Definition at line 240 of file scene.hh.

geom::Mat3 GetLightRot ( ) const
inline

get main light orientation (internal debugging use)

Definition at line 242 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

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

unsigned int GetStereoAlg ( ) const
inline

return current stereo algorithm

Definition at line 231 of file scene.hh.

Real GetStereoDistance ( ) const
inline

return current stereo distance offset from COR

Definition at line 225 of file scene.hh.

bool GetStereoFlip ( ) const
inline

return invert flag for stereo

Definition at line 209 of file scene.hh.

Real GetStereoIOD ( ) const
inline

return current stereo eye distance

Definition at line 220 of file scene.hh.

int GetStereoMode ( ) const
inline

Definition at line 204 of file scene.hh.

int GetStereoView ( ) const
inline

return current stereo view mode

Definition at line 215 of file scene.hh.

mol::Transform GetTransform ( ) const

get full underlying transformation

Viewport GetViewport ( ) const
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 GfxNodeP go)

remove graphical object from scene remove graphical object from the scene

void Remove ( const String name)

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 SetAmbientOcclusionWeight ( float  f)

experimental feature

void SetBackground ( const Color c)

set background color

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 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 427 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 SetLightDir ( const geom::Vec3 dir)

set main light direction

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

set ambient, diffuse and specular light color

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

set ambient, diffuse and specular light intensity

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 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 mol::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 
)

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

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

friend class GfxNode
friend

Definition at line 447 of file scene.hh.

friend class GfxObj
friend

Definition at line 446 of file scene.hh.

friend class impl::SceneFX
friend

Definition at line 80 of file scene.hh.


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