SO3Engine
SO3VirtualPointer.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
32#ifndef __SO3VIRTUAL_POINTER_H__
33#define __SO3VIRTUAL_POINTER_H__
34
40#include "SO3Utils/SO3RayCast.h"
41
42namespace SO3
43{
44
45class _SO3_Export SVirtualPointer : public SNode
46{
47public:
48protected:
49private:
50 Ogre::Camera* mRayCam;
51 bool mState;
52 bool mAutoUpdate;
53 unsigned int mRenderSize;
54 float mMaxlength;
55 SWindow::SelectorMode mSelectorMode;
56 SSubEntityCameraSelectorBuffer* mCameraSelector;
57 SRaycastResult mRaycastValue;
58 int mId;
59
60public:
63 SVirtualPointer(SScene* parent, const std::string& dynamicCubeMapName, const float maxlength = 1000.0f);
64
68
71 void SetEnable(const bool& newState);
72
75 bool GetEnable();
76
79 void SetSelectorMode(SWindow::SelectorMode mode);
80
83 void SetMaxLength(const float& length);
84
87 float GetMaxLength();
88
91 int GetID();
92
96 void Update();
97
98 void Click(const MouseButtonId& btn);
99
100 void UnClick(const MouseButtonId& btn);
101
102 void MoveCursor(const MouseButtonId& btn);
103
104 void Wheel(const int delta);
105
106 bool HasWidgetUnder();
107
108 float GetLength();
109
110 Ogre::Vector3 GetTargetPosition();
111
112 SEntity* GetSelectedObject();
113
114 SMaterial* GetSelectedMaterial();
115
116 int GetSelectedSubEntity();
117
118 const SRaycastResult& GetRaycastResult();
119protected:
120private:
125
126 void CheckRayCastValidity();
127};
128
129}
130
131#endif
librairies include