LightSample.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #ifndef LIGHTSAMPLE_H_
  2. #define LIGHTSAMPLE_H_
  3. #include "gameplay.h"
  4. #include "Sample.h"
  5. #include "Material.h"
  6. #include "Model.h"
  7. using namespace gameplay;
  8. /**
  9. * Sample for lights.
  10. */
  11. class LightSample : public Sample, Control::Listener
  12. {
  13. public:
  14. LightSample();
  15. void touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
  16. bool mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
  17. void keyEvent(Keyboard::KeyEvent evt, int key);
  18. void controlEvent(Control* control, EventType evt);
  19. protected:
  20. void initialize();
  21. void finalize();
  22. void update(float elapsedTime);
  23. void render(float elapsedTime);
  24. private:
  25. void initializeDirectionalTechnique(const char* technique);
  26. void initializeSpotTechnique(const char* technique);
  27. void initializePointTechnique(const char* technique);
  28. void setUnlitMaterialTexture(Model* model, const char* texturePath, bool mipmap = true);
  29. void setColorValue(const Vector3& value);
  30. void setSpecularValue(float);
  31. bool drawScene(Node* node);
  32. Font* _font;
  33. Scene* _scene;
  34. Node* _modelNode;
  35. Node* _directionalLightNode;
  36. Node* _pointLightNode;
  37. Node* _spotLightNode;
  38. Node* _usedForMoving;
  39. Model* _model;
  40. Model* _directionalLightQuadModel;
  41. Model* _spotLightQuadModel;
  42. Model* _pointLightQuadModel;
  43. Material* _unlitMaterial;
  44. Material* _texturedMaterial;
  45. Material* _bumpedMaterial;
  46. Material* _bumpedSpecularMaterial;
  47. Material* _lighting;
  48. RadioButton* _noLight;
  49. RadioButton* _directional;
  50. RadioButton* _spot;
  51. RadioButton* _point;
  52. Container* _properties;
  53. Slider* _redSlider;
  54. Slider* _greenSlider;
  55. Slider* _blueSlider;
  56. Slider* _specularSlider;
  57. CheckBox* _addSpecular;
  58. CheckBox* _addBumped;
  59. Form* _form;
  60. bool _touched;
  61. int _touchX, _touchY;
  62. };
  63. #endif