Semantic Pointing for Object Picking in Complex 3D Environments
by Christian Kössler and Felix Kreuzer
 All Classes Files Functions Variables Macros Pages
Scene.hpp
1 #pragma once
2 #pragma warning( disable : 4482 )
3 
4 #include "Shader.hpp"
5 #include "Camera.hpp"
6 #include <map>
7 #include <set>
8 #include "SoundInterface.hpp"
9 #include <vector>
10 #include "Plane.hpp"
11 
12 class Sector;
13 class GameObject;
14 class Model;
15 struct ViewPlane;
16 
21 class Scene
22 {
23 public:
24  static enum States { Normal, Won, Lost, Init };
25  Scene(void);
26  ~Scene(void);
27  bool Scene::init(void);
28  void Scene::update(float timeDiff);
29 
35  void Scene::updateBorderParts(float timeDiff);
36  void Scene::updateCamera(float timeDiff, bool firstUpdate);
37  void Scene::updateLight(float timeDiff);
38  void Scene::updateLightning(float timeDiff);
39  void Scene::updateSkyBox(float timeDiff);
40  void Scene::updateInfoPanel();
41 
47  void Scene::updateObjectPicking(float timeDiff);
48  void Scene::updateSectors(float timeDiff, bool firstUpdate);
49  void Scene::updateBadFactor(float timeDiff);
50  void Scene::updateSound(float timeDiff);
51 
52  void Scene::draw(void);
53 
57  void Scene::drawObjectIDs();
58  void Scene::handleShoot(int button);
59  bool Scene::checkFrustumCulling(GameObject *gameObject);
60  void Scene::resize(int x, int y);
61  void Scene::toggleMipMapping(void);
62  void Scene::toggleTrilinear(void);
63  void Scene::toggleWireFrame(void);
64  void Scene::toggleTransparency(void);
65  void Scene::toggleFrustumCulling(void);
66  void Scene::toggleNightMode(void);
67  void Scene::togglePause(glm::vec3 *cameraPosition = NULL);
68  void Scene::generateRandom();
69  void Scene::setUniforms(const Model *model, const GameObject *gameobject, const Sector *sector = NULL);
70  void Scene::drawModel(const Model * model,const string mode = "normal", bool specialoffset = false, int specialoffsetposition = -1);
71  void Scene::playSingleSoundDistance(float maxLength, glm::vec3 positionObject, SoundInterface::Sounds soundType, bool debugOutput = false);
72  States mState;
73  int mScreenWidth, mScreenHeight;
74  Model *mModelTree, *mModelMoai, *mModelGround, *mModelGroundBorder, *mModelInfoPanel, *mModelSkybox, *mModelPeopleGood, *mModelPeopleBad, *mModelLight, *mModelHolyGrenade, *mModelHolyGrenadeBorder, *mModelLightning, *mModelStoneWall, *mModelOverlay;
75  Camera *mCamera;
76  GameObject *mLight, *mLightning, *mSkybox, **mGroundParts, **mGroundBorderParts, *mInfoPanel;
77  GameObject *mMousePointer;
78  glm::mat4 *mProjectionMatrix, *mProjectionMatrixTexProj, *mProjectionMatrixOrtho;
79  Shader *mShaderBlinnphong, *mShaderSkybox, *mShaderFbo, *mShaderOverlay;
80  float mBadFactor, mLightningAlive, mSpeedFactor, mTimeDiffWonOrLostWait;
81  int mBadSwapping, mCountDrawnObjects, mCountCulledObjects;
82  bool mNightMode, mPaused, mMipMapping, mTrilinear, mWireFrame, mTransparency, mFrustumCulling;
83  Sector **mSectors;
84  SoundInterface *mSoundInterface;
85  glm::ivec2 *mMousePosition;
86  Plane mPlanes[6];
87  static std::map<int, GameObject*> sGameObjects;
88 
89 private:
90  bool mLightningVaoOnlyUpdate;
91  GLuint mFboId, mFboImgId;
92  Shader *mShaderActive;
93  void Scene::setShaderActive(Shader *shader);
94  glm::ivec2 *mCursorLastPos;
95  double mCursorFactor, mDistance;
96  GameObject* mSelectedObject;
97  glm::ivec2 mPickBufferFrom, mPickBufferSize;
98 };
99 
void updateObjectPicking(float timeDiff)
Reads the Pickbuffer (or at least a part of it) from the GPU memory and calculates the nearest object...
Definition: Scene.cpp:793
void updateCursorPosition()
This method updates the position of our own visual mouse cursor according to the speed which is depen...
Definition: Scene.cpp:767
void drawObjectIDs()
Draws the pickable objects into a FBO with objectIds as pixel values.
Definition: Scene.cpp:1219
This Class Contains most of the Game Logic and Draw Calls.
Definition: Scene.hpp:21