PolySceneLight.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * PolySceneLight.h
  3. * Poly
  4. *
  5. * Created by Ivan Safrin on 9/21/08.
  6. * Copyright 2008 __MyCompanyName__. All rights reserved.
  7. *
  8. */
  9. // @package Scene
  10. #pragma once
  11. #include "PolyString.h"
  12. #include "PolyGlobals.h"
  13. #include "PolySceneEntity.h"
  14. #include "PolyCoreServices.h"
  15. #include "PolyScene.h"
  16. #include "PolyCamera.h"
  17. #include "PolyMesh.h"
  18. namespace Polycode {
  19. class Scene;
  20. class Camera;
  21. class _PolyExport SceneLight : public SceneEntity {
  22. public:
  23. SceneLight(int type, float intensity, float distance, Scene *parentScene);
  24. virtual ~SceneLight();
  25. float getIntensity();
  26. float getDistance();
  27. int getType();
  28. void renderDepthMap(Scene *scene);
  29. void Render();
  30. Matrix4 getLightViewMatrix();
  31. static const int AREA_LIGHT = 0;
  32. static const int SPOT_LIGHT = 1;
  33. Texture *getZBufferTexture();
  34. Color lightColor;
  35. void setLightColor(float r, float g, float b) { lightColor.r = r; lightColor.g = g; lightColor.b = b; }
  36. void enableShadows(bool val, float resolution=256);
  37. void setShadowMapFOV(float fov);
  38. bool areShadowsEnabled();
  39. int getLightType() { return type; }
  40. private:
  41. int type;
  42. float intensity;
  43. Camera *spotCamera;
  44. Texture *zBufferTexture;
  45. Scene *parentScene;
  46. Matrix4 lightViewMatrix;
  47. float shadowMapRes;
  48. float shadowMapFOV;
  49. bool shadowsEnabled;
  50. float distance;
  51. Mesh *lightMesh;
  52. };
  53. }