VISH
0.2
|
A not very useful implementation of a time-dependent homogeneous background.
#include <ocean/plankton/VCreator.hpp> #include <ocean/GLvish/VGLRenderObject.hpp> #include <ocean/plankton/VTime.hpp> using namespace Wizt; namespace { class DynamicBackground : public VGLRenderObject { Slot Red, Green, Blue; override void render(VGLRenderContext&Context) const { VTime t; getParameterValue(t, "time", Context); GLclampf red=1, green=1, blue=1, alpha=1; int r=100, g=100, b=100; Red << Context >> r; Green << Context >> g; Blue << Context >> b; red = r/100. - t(); green = g/100. + t(); blue = b/100.; glClearColor( red, green, blue, alpha ); glClear(GL_COLOR_BUFFER_BIT); } public: const std::type_info&getType() const { return typeid( DynamicBackground ); } DynamicBackground (const string&name, int p, const RefPtr<VCreationPreferences>&VP) : VGLRenderObject(name, BACKGROUND_OBJECT+p, VP) { addParam("time", VTime(0) );//->LocalizeVariable(); Blue = addParam("blue" , 53, new VCreationPreferences("local") ); Green = addParam("green", 65, new VCreationPreferences("local") ); Red = addParam("red" , 65, new VCreationPreferences("local") ); } }; static Ref<VCreator<DynamicBackground> > myDynamicBackground("Backgrounds/DynamicBackground", 0, NullPtr()); }