temp commit
[SARndbox.git] / LocalWaterTool.h
blob5091e589adb781a025ea5b2834f11722faab774d
1 /***********************************************************************
2 LocalWaterTool - Tool class to locally add or remove water from an
3 augmented reality sandbox.
4 Copyright (c) 2012-2013 Oliver Kreylos
6 This file is part of the Augmented Reality Sandbox (SARndbox).
8 The Augmented Reality Sandbox is free software; you can redistribute it
9 and/or modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version.
13 The Augmented Reality Sandbox is distributed in the hope that it will be
14 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License along
19 with the Augmented Reality Sandbox; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 ***********************************************************************/
23 #ifndef LOCALWATERTOOL_INCLUDED
24 #define LOCALWATERTOOL_INCLUDED
26 #include <GL/gl.h>
27 #include <GL/GLObject.h>
28 #include <Vrui/Tool.h>
29 #include <Vrui/GenericToolFactory.h>
30 #include <Vrui/TransparentObject.h>
31 #include <Vrui/Application.h>
33 /* Forward declarations: */
34 namespace Misc {
35 template <class ParameterParam>
36 class FunctionCall;
38 class GLContextData;
39 typedef Misc::FunctionCall<GLContextData&> AddWaterFunction;
40 class Sandbox;
41 class LocalWaterTool;
42 typedef Vrui::GenericToolFactory<LocalWaterTool> LocalWaterToolFactory;
44 class LocalWaterTool: public Vrui::Tool, public Vrui::Application::Tool<Sandbox>, public GLObject,
45 public Vrui::TransparentObject {
46 friend class Vrui::GenericToolFactory<LocalWaterTool>;
48 /* Elements: */
49 private:
50 static LocalWaterToolFactory* factory; // Pointer to the factory object for this class
52 const AddWaterFunction* addWaterFunction; // Render function registered with the water table
53 GLfloat adding; // Amount of data added or removed from the water table
55 /* Constructors and destructors: */
56 public:
57 static LocalWaterToolFactory* initClass(Vrui::ToolManager& toolManager);
58 LocalWaterTool(const Vrui::ToolFactory* factory, const Vrui::ToolInputAssignment& inputAssignment);
59 virtual ~LocalWaterTool(void);
61 /* Methods from class Vrui::Tool: */
62 virtual void initialize(void);
63 virtual void deinitialize(void);
64 virtual const Vrui::ToolFactory* getFactory(void) const;
65 virtual void buttonCallback(int buttonSlotIndex, Vrui::InputDevice::ButtonCallbackData* cbData);
67 /* Methods from class GLObject: */
68 virtual void initContext(GLContextData& contextData) const;
70 /* Methods from class Vrui::TransparentObject: */
71 virtual void glRenderActionTransparent(GLContextData& contextData) const;
73 /* New methods: */
74 void addWater(GLContextData& contextData)
75 const; // Function to render geometry that adds water to the water table
78 #endif