PolySceneLight.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 "PolyGlobals.h"
  12. #include "PolySceneEntity.h"
  13. #include "PolyCoreServices.h"
  14. #include "PolyScene.h"
  15. #include "PolyCamera.h"
  16. #include "PolyMesh.h"
  17. namespace Polycode {
  18. class Scene;
  19. class Camera;
  20. class _PolyExport SceneLight : public SceneEntity {
  21. public:
  22. SceneLight(int type, float intensity, float distance, Scene *parentScene);
  23. virtual ~SceneLight();
  24. float getIntensity();
  25. float getDistance();
  26. int getType();
  27. void renderDepthMap(Scene *scene);
  28. void Render();
  29. Matrix4 getLightViewMatrix();
  30. static const int AREA_LIGHT = 0;
  31. static const int SPOT_LIGHT = 1;
  32. Texture *getZBufferTexture();
  33. Color lightColor;
  34. void setLightColor(float r, float g, float b) { lightColor.r = r; lightColor.g = g; lightColor.b = b; }
  35. void enableShadows(bool val, float resolution=256);
  36. void setShadowMapFOV(float fov);
  37. bool areShadowsEnabled();
  38. int getLightType() { return type; }
  39. private:
  40. int type;
  41. float intensity;
  42. Camera *spotCamera;
  43. Texture *zBufferTexture;
  44. Scene *parentScene;
  45. Matrix4 lightViewMatrix;
  46. float shadowMapRes;
  47. float shadowMapFOV;
  48. bool shadowsEnabled;
  49. float distance;
  50. Mesh *lightMesh;
  51. };
  52. }