30 #include <boost/shared_array.hpp>
47 namespace ost {
namespace gfx {
61 namespace impl {
class SceneFX;}
80 friend class impl::SceneFX;
86 struct SceneViewStackEntry {
92 typedef std::stack<SceneViewStackEntry> SceneViewStack;
95 static Scene& Instance();
102 void SetFogColor(
const Color& c);
104 Color GetFogColor()
const;
107 void SetShadow(
bool f);
109 bool GetShadow()
const;
111 void SetShadowQuality(
int q);
113 int GetShadowQuality()
const;
115 void SetShadowWeight(
float w);
117 float GetShadowWeight()
const;
120 void SetDepthDarkening(
bool f);
122 void SetDepthDarkeningWeight(
float f);
125 void SetAmbientOcclusion(
bool f);
127 bool GetAmbientOcclusion()
const;
129 void SetAmbientOcclusionWeight(
float f);
131 float GetAmbientOcclusionWeight()
const;
133 void SetAmbientOcclusionMode(
uint m);
135 uint GetAmbientOcclusionMode()
const;
137 void SetAmbientOcclusionQuality(
uint q);
139 uint GetAmbientOcclusionQuality()
const;
143 void SetShadingMode(
const std::string& smode);
148 float GetNear()
const;
151 void SetNear(
float n);
154 float GetFar()
const;
157 void SetFar(
float f);
160 void SetNearFar(
float n,
float f);
163 void SetFOV(
float f);
166 float GetFOV()
const;
169 void SetFogNearOffset(
float o);
172 float GetFogNearOffset()
const;
175 void SetFogFarOffset(
float o);
178 float GetFogFarOffset()
const;
181 void SetFogOffsets(
float no,
float fo);
185 void Autoslab(
bool fast=
false,
bool redraw=
true);
194 void AutoAutoslab(
bool f);
203 void SetStereoMode(
unsigned int mode);
207 void SetStereoFlip(
bool f);
213 void SetStereoView(
int);
218 void SetStereoIOD(
Real);
223 void SetStereoDistance(
Real);
229 void SetStereoAlg(
unsigned int);
236 void SetLightProp(
const Color& amb,
const Color& diff,
const Color& spec);
238 void SetLightProp(
float amb,
float diff,
float spec);
248 void SetSelectionMode(
uint m);
249 uint GetSelectionMode()
const;
256 void Export(
const String& fname,
unsigned int w,
257 unsigned int h,
bool transparent=
false);
260 void Export(
const String& fname,
bool transparent=
false);
263 void ExportPov(
const std::string& fname,
const std::string& wdir=
".");
273 void InitGL(
bool full=
true);
276 void Resize(
int w,
int h);
279 void Pick(
int mx,
int my,
int mask);
281 float GetDefaultTextSize();
284 std::pair<GfxObjP, mol::AtomHandle> PickAtom(
int mx,
int my);
290 void RequestRedraw();
293 void StatusMessage(
const String& s);
296 void SetViewport(
int w,
int h);
299 void SetBackground(
const Color& c);
302 Color GetBackground()
const;
311 void CenterOn(
const String& s);
314 void CenterOn(
const GfxObjP& s);
344 void ResetProjection();
354 void Add(
const GfxNodeP& go,
bool redraw=
true);
359 void Remove(
const String& name);
366 bool Rename(
const String& old_name,
const String& new_name);
372 bool HasNode(
const String& name)
const;
375 void Apply(
const InputEvent& ie,
bool request_redraw=
true);
384 size_t GetNodeCount()
const;
395 bool InOffscreenMode()
const;
398 void SetTestMode(
bool t);
400 float ElapsedTime()
const;
417 bool StartOffscreenMode(
unsigned int w,
unsigned int h);
419 void StopOffscreenMode();
422 void SetShowCenter(
bool f);
433 void SetBlur(
uint n);
441 void SetBeacon(
int wx,
int wy);
452 void ObjectChanged(
const String& name);
454 void NodeTransformed(
const GfxObjP&
object);
455 void NodeAdded(
const GfxNodeP& node);
456 void RenderModeChanged(
const String& name);
460 template <
typename ACTION>
461 void NotifyObservers(
const ACTION&
action) {
462 std::for_each(observers_.begin(), observers_.end(),
action);
466 Scene& operator=(
const Scene&) {
return *
this;}
481 unsigned int vp_width_,vp_height_;
483 SceneViewStack scene_view_stack_;
500 bool do_autoslab_,do_autoslab_fast_;
502 bool offscreen_flag_;
503 OffscreenBuffer* main_offscreen_buffer_;
505 std::string def_shading_mode_;
507 uint selection_mode_;
510 std::vector<unsigned char> tmp_tex_;
512 GLuint glyph_tex_id_;
513 std::vector<geom::Vec2> glyph_map_;
514 float def_text_size_;
517 std::vector<boost::shared_array<unsigned char> > blur_buffer_;
519 unsigned int stereo_mode_;
520 unsigned int stereo_alg_;
521 bool stereo_inverted_;
522 unsigned int stereo_eye_;
523 Real stereo_iod_,stereo_distance_;
524 unsigned int scene_left_tex_;
525 unsigned int scene_right_tex_;
527 void set_near(
float n);
528 void set_far(
float f);
530 void flag_all_dirty();
533 void stereo_projection(
int view);
536 void render_stereo();
540 bool IsNameAvailable(
const String& name)
const;