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;
96 static Scene& Instance();
103 void SetFogColor(
const Color& c);
105 Color GetFogColor()
const;
108 void SetShadow(
bool f);
110 bool GetShadow()
const;
112 void SetShadowQuality(
int q);
114 int GetShadowQuality()
const;
116 void SetShadowWeight(
float w);
118 float GetShadowWeight()
const;
121 void SetDepthDarkening(
bool f);
123 void SetDepthDarkeningWeight(
float f);
126 void SetAmbientOcclusion(
bool f);
128 bool GetAmbientOcclusion()
const;
130 void SetAmbientOcclusionWeight(
float f);
132 float GetAmbientOcclusionWeight()
const;
134 void SetAmbientOcclusionMode(
uint m);
136 uint GetAmbientOcclusionMode()
const;
138 void SetAmbientOcclusionQuality(
uint q);
140 uint GetAmbientOcclusionQuality()
const;
142 void SetAmbientOcclusionSize(
float f);
144 float GetAmbientOcclusionSize()
const;
151 void SetShadingMode(
const std::string& smode);
158 float GetNear()
const;
162 void SetNear(
float n);
165 float GetFar()
const;
168 void SetFar(
float f);
171 void SetNearFar(
float n,
float f);
174 void SetFOV(
float f);
177 float GetFOV()
const;
182 void SetFogNearOffset(
float o);
185 float GetFogNearOffset()
const;
188 void SetFogFarOffset(
float o);
191 float GetFogFarOffset()
const;
194 void SetFogOffsets(
float no,
float fo);
197 void Autoslab(
bool fast);
200 void Autoslab(
bool fast,
bool);
222 autoslab_mode_=std::min(2,std::max(0,mode));
227 return autoslab_mode_;
235 void AutoAutoslab(
bool f);
244 void SetStereoMode(
unsigned int mode);
248 void SetStereoFlip(
bool f);
254 void SetStereoView(
int);
259 void SetStereoIOD(
Real);
264 void SetStereoDistance(
Real);
270 void SetStereoAlg(
unsigned int);
277 void SetLightProp(
const Color& amb,
const Color& diff,
const Color& spec);
279 void SetLightProp(
float amb,
float diff,
float spec);
289 void SetSelectionMode(
uint m);
290 uint GetSelectionMode()
const;
293 void Export(
const String& fname,
unsigned int w,
294 unsigned int h,
bool transparent=
false);
296 void Export(
const String& fname,
unsigned int w,
297 unsigned int h,
int max_samples,
bool transparent=
false);
300 void Export(
const String& fname,
bool transparent=
false);
303 void ExportPov(
const std::string& fname,
const std::string& wdir=
".");
313 void InitGL(
bool full=
true);
316 void Resize(
int w,
int h);
319 void Pick(
int mx,
int my,
int mask);
321 float GetDefaultTextSize();
324 std::pair<GfxObjP, mol::AtomHandle> PickAtom(
int mx,
int my);
330 void RequestRedraw();
333 void StatusMessage(
const String& s);
336 void SetViewport(
int w,
int h);
339 void SetBackground(
const Color& c);
342 void SetBackground(
const Gradient& g);
345 void SetBackground(
const Bitmap& bm);
348 Color GetBackground()
const;
352 void SetBackgroundStereoMode(
bool);
356 void SetBackgroundStereoOffset(
float);
366 void CenterOn(
const String& s);
369 void CenterOn(
const GfxObjP& s);
407 void ResetProjection();
416 void Add(
const GfxNodeP& go,
bool redraw=
true);
422 void Remove(
const String& name);
429 bool Rename(
const String& old_name,
const String& new_name);
435 bool HasNode(
const String& name)
const;
438 void Apply(
const InputEvent& ie,
bool request_redraw=
true);
447 size_t GetNodeCount()
const;
459 void SetTestMode(
bool t);
461 float ElapsedTime()
const;
467 void SetShowCenter(
bool f);
478 void SetBlur(
uint n);
486 void SetBeacon(
int wx,
int wy);
490 void SetExportAspect(
float a);
492 void SetShowExportAspect(
bool f);
497 void SetAlphaBias(
Real bias);
499 void ContextSwitch();
508 void ObjectChanged(
const String& name);
510 void NodeTransformed(
const GfxObjP&
object);
511 void NodeAdded(
const GfxNodeP& node);
512 void RenderModeChanged(
const String& name);
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);
605 void flag_all_dirty();
608 void stereo_projection(
int view);
610 void render_export_aspect();
613 void render_stereo();
617 bool IsNameAvailable(
const String& name)
const;
geom::Mat3 GetLightRot() const
get main light orientation (internal debugging use)
bool HasMultisample() const
boost::shared_ptr< GfxObj > GfxObjP
bool GetShowExportAspect() const
geom::Vec4 GetHemiParams() const
void SetAutoslabMode(int mode)
set autoslab mode
bool GetShowCenter() const
main class for organization and root for the graphical display
geom::Vec3 GetLightDir() const
get main light direction
main class for all graphic objects
Interface for observing graphical objects.
int GetStereoMode() const
geom::Mat4 GetProjection() const
graphical rendering of mol::EntityHandle entites
#define DLLEXPORT_OST_GFX
bool GetAutoAutoslab() const
get current state of automatic autoslab'bing
int GetStereoView() const
return current stereo view mode
bool GetBackgroundStereoMode() const
Real GetStereoIOD() const
return current stereo eye distance
int GetAutoslabMode() const
return current autoslab mode
bool GetStereoFlip() const
return invert flag for stereo
std::vector< SceneObserver * > SceneObserverList
void SetFixCenter(bool f)
if true fix center of rotation upon input induced shift
Real GetStereoDistance() const
return current stereo distance offset from COR
Three dimensional vector class, using Real precision.
geom::Mat4 GetInvertedProjection() const
float GetExportAspect() const
boost::shared_ptr< GfxNode > GfxNodeP
float GetBackgroundStereoOffset() const
bool GetFixCenter() const
return flag
unsigned int GetStereoAlg() const
return current stereo algorithm