30 #include <boost/shared_array.hpp>
49 namespace ost {
namespace gfx {
62 namespace impl {
class SceneFX;}
87 struct SceneViewStackEntry {
93 typedef std::stack<SceneViewStackEntry> SceneViewStack;
158 float GetNear()
const;
222 autoslab_mode_=std::min(2,std::max(0,mode));
227 return autoslab_mode_;
294 unsigned int h,
bool transparent=
false);
297 unsigned int h,
int max_samples,
bool transparent=
false);
303 void ExportPov(
const std::string& fname,
const std::string& wdir=
".");
319 void Pick(
int mx,
int my,
int mask);
324 std::pair<GfxObjP, mol::AtomHandle>
PickAtom(
int mx,
int my);
416 void Add(
const GfxNodeP& go,
bool redraw=
true);
516 template <
typename ACTION>
517 void NotifyObservers(
const ACTION&
action) {
518 std::for_each(observers_.begin(), observers_.end(),
action);
522 Scene& operator=(
const Scene&) {
return *
this;}
529 void ActivateGLContext()
const;
545 unsigned int vp_width_,vp_height_;
547 SceneViewStack scene_view_stack_;
568 std::string def_shading_mode_;
570 uint selection_mode_;
573 std::vector<unsigned char> tmp_tex_;
575 GLuint glyph_tex_id_;
576 std::vector<geom::Vec2> glyph_map_;
577 float def_text_size_;
580 std::vector<boost::shared_array<unsigned char> > blur_buffer_;
582 unsigned int stereo_mode_;
583 unsigned int stereo_alg_;
584 bool stereo_inverted_;
586 Real stereo_iod_,stereo_distance_;
587 unsigned int scene_left_tex_;
588 unsigned int scene_right_tex_;
589 unsigned int bg_mode_;
591 bool bg_stereo_mode_;
592 float bg_stereo_offset_;
595 unsigned int bg_tex_;
599 float export_aspect_;
600 bool show_export_aspect_;
602 void set_near(
float n);
603 void set_far(
float f);
604 void flag_all_dirty();
607 void stereo_projection(
int view);
609 void render_export_aspect();
612 void render_stereo();
616 bool IsNameAvailable(
const String& name)
const;
Three dimensional vector class, using Real precision.
graphical rendering of mol::EntityHandle entites
main class for all graphic objects
main class for organization and root for the graphical display
bool HasMultisample() const
void SetShadowWeight(float w)
multiplier for shadow strength
std::pair< GfxObjP, mol::AtomHandle > PickAtom(int mx, int my)
pick atom at given mouse coord
void SetAmbientOcclusion(bool f)
experimental feature
int GetShadowQuality() const
get shadow quality
unsigned int GetStereoAlg() const
return current stereo algorithm
geom::Vec3 GetLightDir() const
get main light direction
void Autoslab()
adjust near and far clipping plane to fit visible objects
void SetBackgroundStereoOffset(float)
background tile left/right offset
void SetLightProp(const Color &amb, const Color &diff, const Color &spec)
set ambient, diffuse and specular light color
uint GetSelectionMode() const
void Apply(GfxNodeVisitor &v) const
apply node visitor to root node
void SetExportAspect(float a)
bool HasNode(const String &name) const
whether the scene contains a node of the given name
bool GetStereoFlip() const
return invert flag for stereo
bool GetFog() const
check fog status
void BlurSnapshot()
experimental feature
void SetDepthDarkening(bool f)
experimental feature
void Pick(int mx, int my, int mask)
pick at given mouse coords
GfxNodeP GetRootNode() const
get root node of scene graph
void AttachObserver(SceneObserver *o)
observer interface (internal use)
void InitGL(bool full=true)
initialize OpenGL after context has been setup (internal use)
Real GetStereoDistance() const
return current stereo distance offset from COR
bool GetShadow() const
get shadow mapping status
geom::Vec4 GetHemiParams() const
void SetBackground(const Bitmap &bm)
set background image
void SetStereoFlip(bool f)
invert stereo eyes for stereo mode=0
void SetLightProp(float amb, float diff, float spec)
set ambient, diffuse and specular light intensity
void Remove(const GfxNodeP &go)
remove graphical object from scene remove graphical object from the scene
void ExportPov(const std::string &fname, const std::string &wdir=".")
export scene into povray files named fname.pov and fname.inc
geom::Mat4 GetProjection() const
bool GetShowExportAspect() const
size_t GetNodeCount() const
get total number of nodes in scene
Viewport GetViewport() const
void SetBackgroundStereoMode(bool)
use bg bitmap for stereo mode this tiles the background bitmap at the far plane
bool GetAmbientOcclusion() const
experimental feature
void SetStereoMode(unsigned int mode)
set stereo mode one of 0 (off), 1 (quad-buffered) 2 (interlaced (for special monitors))
void SetStereoDistance(Real)
set stereo distance offset from COR
void Unregister(GLWinBase *win)
gui glue interface (internal use)
void SetBlur(uint n)
experimental feature
void Export(const String &fname, unsigned int w, unsigned int h, bool transparent=false)
int GetAutoslabMode() const
return current autoslab mode
void SetBackground(const Gradient &g)
set background gradient
void SetBackground(const Color &c)
set background color
geom::Vec3 Project(const geom::Vec3 &v, bool ignore_vp=false) const
calculate projection of a point into the scene
void PopView()
retrieve a previously pushed orientation
void SetTestMode(bool t)
switch into test mode (internal use)
void SetFogFarOffset(float o)
offset between far clipping plane and end of fog
void CenterOn(const GfxObjP &s)
center given object
void DetachObserver(SceneObserver *o)
observer interface (internal use)
uint GetAmbientOcclusionMode() const
experimental feature
void Export(const String &fname, bool transparent=false)
export snapshot of current scene
geom::AlignedCuboid GetBoundingBox(bool use_tf=true) const
return bounding box of scene
float GetExportAspect() const
void SetFogNearOffset(float o)
offset between near clipping plane and start of fog
geom::Transform GetTransform() const
get full underlying transformation
void SetTransform(const geom::Transform &t)
set transform
void Autoslab(bool fast, bool)
DEPRECATED, use Autoslab() and SetAutoslabMode(int)
void Export(Exporter *ex) const
export scene via exporter
float GetFogFarOffset() const
void SetStereoView(int)
stereo view mode one of 0 (center), -1 (left), 1 (right)
Color GetFogColor() const
get the fog color
geom::AlignedCuboid GetBoundingBox(const geom::Transform &tf) const
return bounding box of with a given transform
void SetRTC(const geom::Mat4 &rtc)
sets a previously retrieved orientation
Color GetBackground() const
get background color
void SetShadow(bool f)
turn shadow mapping on and off
void SetFixCenter(bool f)
if true fix center of rotation upon input induced shift
bool Rename(const String &old_name, const String &new_name)
rename an existing graphical object defunct for now
void SetNearFar(float n, float f)
set near and far clipping plane at once
void NodeTransformed(const GfxObjP &object)
void Remove(const String &name)
remove graphical object from the scene
void SetFogOffsets(float no, float fo)
convenciene function to set fog near and far offset
void SelectionChanged(const String &name, const mol::EntityView &sel)
void ResetProjection()
brief re-generates the projection matrix (internal use)
void SetShowCenter(bool f)
show center of rotation of true
void SetStereoAlg(unsigned int)
set stereo algorithm one of 0 (default) or 1
bool GetFixCenter() const
return flag
uint GetAmbientOcclusionQuality() const
experimental feature
void SetSelectionMode(uint m)
set the selection mode
void SetNear(float n)
set near clipping plane
void SetAmbientOcclusionSize(float f)
experimental feature
int GetStereoMode() const
void Register(GLWinBase *win)
gui glue interface (internal use)
void RenderGL()
render all gl objects (internal use)
void SetShowExportAspect(bool f)
geom::Vec3 GetCenter() const
retrieve center
float GetDefaultTextSize()
void SetStereoIOD(Real)
set stereo eye distance
void Resize(int w, int h)
handle new viewport size (internal use)
void SetAmbientOcclusionWeight(float f)
experimental feature
bool GetBackgroundStereoMode() const
void SetLightDir(const geom::Vec3 &dir)
set main light direction
void StatusMessage(const String &s)
send status message to gui
void RemoveAll()
remove all objects from the scene
float GetAmbientOcclusionWeight() const
experimental feature
void RenderText(const TextPrim &t)
internal use
void SetFOV(float f)
set field of view angle
void SetFar(float f)
set far clipping plane
void SetAmbientOcclusionMode(uint m)
experimental feature
void NodeAdded(const GfxNodeP &node)
geom::Mat3 GetLightRot() const
get main light orientation (internal debugging use)
float GetFogNearOffset() const
void AutoAutoslab(bool f)
turn automatic autoslab'bing on or off for each scene update
void RequestRedraw()
request redraw of gl scene
void CenterOn(const String &s)
center on object of given name
void SetShadingMode(const std::string &smode)
select shading mode one of fallback, basic, default, hf, toon1, toon2
float GetBackgroundStereoOffset() const
GfxObjP operator[](const String &name)
retrieve gfx object by name
void Apply(const InputEvent &ie, bool request_redraw=true)
actual event handling for scene (internal use)
geom::Vec3 UnProject(const geom::Vec3 &v, bool ignore_vp=false) const
calculate unprojected point out of the scene
float GetShadowWeight() const
get shadow strength
void AutoslabMax()
DEPRECATED, use SetAutoslabMode(2)
bool GetAutoAutoslab() const
get current state of automatic autoslab'bing
void SetBeaconOff()
experimental feature
void SetCenter(const geom::Vec3 &cen)
center rotation on the given point
void SetAlphaBias(Real bias)
geom::Mat4 GetRTC() const
returns a compact, internal representation of the scene orientation
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 ObjectChanged(const String &name)
float ElapsedTime() const
bool GetShowCenter() const
void Autoslab(bool fast)
DEPRECATED, use Autoslab() and SetAutoslabMode(int)
void SetBeacon(int wx, int wy)
experimental feature
static Scene & Instance()
void SetFogColor(const Color &c)
set the fog color
void SetHemiParams(const geom::Vec4 &)
void SetDepthDarkeningWeight(float f)
experimental feature
void SetShadowQuality(int q)
shadow quality from 0 (low) to 3 (high), default=1
void PushView()
push the current orientation onto a stack
void SetAmbientOcclusionQuality(uint q)
experimental feature
void SetViewport(int w, int h)
set the viewport; the mapping to the visible window (internal use)
void SetFog(bool f)
turn fog on or off
int GetStereoView() const
return current stereo view mode
void SetAutoslabMode(int mode)
set autoslab mode
geom::Mat4 GetInvertedProjection() const
float GetAmbientOcclusionSize() const
experimental feature
Real GetStereoIOD() const
return current stereo eye distance
void RenderModeChanged(const String &name)
float GetFar() const
get far clipping plane
Interface for observing graphical objects.
#define DLLEXPORT_OST_GFX
boost::shared_ptr< GfxNode > GfxNodeP
boost::shared_ptr< GfxObj > GfxObjP
std::vector< SceneObserver * > SceneObserverList