TerrainSample.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef TERRAINSAMPLE_H_
  2. #define TERRAINSAMPLE_H_
  3. #include "gameplay.h"
  4. #include "Sample.h"
  5. using namespace gameplay;
  6. class TerrainSample : public Sample, public Control::Listener, private RenderState::AutoBindingResolver
  7. {
  8. public:
  9. TerrainSample();
  10. ~TerrainSample();
  11. void keyEvent(Keyboard::KeyEvent evt, int key);
  12. void touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
  13. bool mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
  14. void controlEvent(Control* control, EventType evt);
  15. protected:
  16. void initialize();
  17. bool intializeLights(Node* node);
  18. void finalize();
  19. void update(float elapsedTime);
  20. void render(float elapsedTime);
  21. bool drawScene(Node* node);
  22. void setMessage(const char* message);
  23. private:
  24. enum Mode
  25. {
  26. MODE_LOOK,
  27. MODE_DROP_SPHERE,
  28. MODE_DROP_BOX
  29. };
  30. Vector3 getLightDirection0() const;
  31. Vector3 getLightColor0() const;
  32. bool resolveAutoBinding(const char* autoBinding, Node* node, MaterialParameter* parameter);
  33. Font* _font;
  34. Scene* _scene;
  35. Terrain* _terrain;
  36. Node* _sky;
  37. Form* _form;
  38. bool _formVisible;
  39. Vector2 _formSize;
  40. bool _wireframe;
  41. bool _debugPhysics;
  42. bool _snapToGround;
  43. bool _vsync;
  44. Mode _mode;
  45. Node* _sphere;
  46. Node* _box;
  47. std::list<Node*> _shapes;
  48. Light* _directionalLight;
  49. };
  50. #endif