# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/GhostCameraManipulator.hpp

Go to the documentation of this file.

    00001 /**************************************************************************************/
    00002 /*                                                                                    */
    00003 /*  Visualization Library                                                             */
    00004 /*  http://www.visualizationlibrary.com                                               */
    00005 /*                                                                                    */
    00006 /*  Copyright (c) 2005-2010, Michele Bosi                                             */
    00007 /*  All rights reserved.                                                              */
    00008 /*                                                                                    */
    00009 /*  Redistribution and use in source and binary forms, with or without modification,  */
    00010 /*  are permitted provided that the following conditions are met:                     */
    00011 /*                                                                                    */
    00012 /*  - Redistributions of source code must retain the above copyright notice, this     */
    00013 /*  list of conditions and the following disclaimer.                                  */
    00014 /*                                                                                    */
    00015 /*  - Redistributions in binary form must reproduce the above copyright notice, this  */
    00016 /*  list of conditions and the following disclaimer in the documentation and/or       */
    00017 /*  other materials provided with the distribution.                                   */
    00018 /*                                                                                    */
    00019 /*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND   */
    00020 /*  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED     */
    00021 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE            */
    00022 /*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR  */
    00023 /*  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    */
    00024 /*  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;      */
    00025 /*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON    */
    00026 /*  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT           */
    00027 /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     */
    00028 /*  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                      */
    00029 /*                                                                                    */
    00030 /**************************************************************************************/
    00031
    00032 #ifndef GhostCameraManipulator_INCLUDE_ONCE
    00033 #define GhostCameraManipulator_INCLUDE_ONCE
    00034
    00035 #include <vlGraphics/OpenGLContext.hpp>
    00036
    00037 namespace vl
    00038 {
    00039   class Camera;
    00040   //------------------------------------------------------------------------------
    00041   // GhostCameraManipulator
    00042   //------------------------------------------------------------------------------
    00055   class VLGRAPHICS_EXPORT GhostCameraManipulator: public UIEventListener
    00056   {
    00057   public:
    00058     virtual const char* className() { return "vl::GhostCameraManipulator"; }
    00059
    00061     GhostCameraManipulator();
    00062
    00063     // ---  UIEventListener ---
    00064
    00065     virtual void mouseMoveEvent(int x, int y);
    00066
    00067     void enableEvent(bool enabled);
    00068
    00069     virtual void updateEvent();
    00070
    00071     virtual void initEvent() {}
    00072
    00073     virtual void destroyEvent() {}
    00074
    00075     virtual void addedListenerEvent(OpenGLContext*) {}
    00076
    00077     virtual void removedListenerEvent(OpenGLContext*) {}
    00078
    00079     virtual void mouseUpEvent(EMouseButton, int, int) {}
    00080
    00081     virtual void mouseDownEvent(EMouseButton, int, int) {}
    00082
    00083     virtual void mouseWheelEvent(int) {}
    00084
    00085     virtual void keyPressEvent(unsigned short, EKey) {}
    00086
    00087     virtual void keyReleaseEvent(unsigned short, EKey) {}
    00088
    00089     virtual void resizeEvent(int, int) {}
    00090
    00091     virtual void fileDroppedEvent(const std::vector<String>&) {}
    00092
    00093     virtual void visibilityEvent(bool) {}
    00094
    00095     // --- --- ---
    00096
    00098     void setCamera(Camera* camera);
    00099
    00101     Camera* camera();
    00102
    00104     const Camera* camera() const;
    00105
    00107     void setKeysForward(EKey key, EKey modifier = Key_None)  { mKeysForward[0] = key; mKeysForward[1] = modifier; };
    00108
    00110     void setKeysBackward(EKey key, EKey modifier = Key_None) { mKeysBackward[0] = key; mKeysBackward[1] = modifier; };
    00111
    00113     void setKeysLeft(EKey key, EKey modifier = Key_None)     { mKeysLeft[0] = key; mKeysLeft[1] = modifier; };
    00114
    00116     void setKeysRight(EKey key, EKey modifier = Key_None)    { mKeysRight[0] = key; mKeysRight[1] = modifier; };
    00117
    00119     void setKeysUp(EKey key, EKey modifier = Key_None)       { mKeysUp[0] = key; mKeysUp[1] = modifier; };
    00120
    00122     void setKeysDown(EKey key, EKey modifier = Key_None)     { mKeysDown[0] = key; mKeysDown[1] = modifier; };
    00123
    00125     void setRotationSpeed(Real speed) { mRotationSpeed = speed; }
    00126
    00128     Real rotationSpeed() const { return mRotationSpeed; }
    00129
    00131     void setMovementSpeed(Real speed) { mMovementSpeed = speed; }
    00132
    00134     Real movementSpeed() const { return mMovementSpeed; }
    00135
    00136   protected:
    00137     void setPosition(vec3 position) { mPosition = position; }
    00138
    00139     const vec3& position() const { return mPosition; }
    00140
    00141     void setXDegrees(Real degree) { mXDegrees = degree; }
    00142
    00143     Real xDegrees() { return mXDegrees; }
    00144
    00145     void setYDegrees(Real degree) { mYDegrees = degree; }
    00146
    00147     Real yDegrees() { return mYDegrees; }
    00148
    00149   protected:
    00150     ref<Camera> mCamera;
    00151     vec3 mPosition;
    00152     Real mLastTime;
    00153     Real mRotationSpeed;
    00154     Real mMovementSpeed;
    00155     Real mXDegrees;
    00156     Real mYDegrees;
    00157     EKey mKeysForward[2];
    00158     EKey mKeysBackward[2];
    00159     EKey mKeysUp[2];
    00160     EKey mKeysDown[2];
    00161     EKey mKeysLeft[2];
    00162     EKey mKeysRight[2];
    00163   };
    00164 }
    00165
    00166 #endif

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:23.
Permission is granted to use this page to write and publish articles regarding Visualization Library.