00001 00002 #ifndef __CLIGHT_H__ 00003 #define __CLIGHT_H__ 00004 00005 /****************************************************************************\ 00006 * REQUIRED HEADERS * 00007 \****************************************************************************/ 00008 00009 #include <Definitions.h> 00010 #include <Memory/mmgr.h> 00011 00012 #include "Input/IInputHandler.h" 00013 #include "Math/TVector3.h" 00014 00015 /****************************************************************************\ 00016 * DEFINITIONS * 00017 \****************************************************************************/ 00018 00019 #define LIGHT_MODE_LOCAL_VIEWER 1 00020 #define LIGHT_MODE_DIRECTIONAL 0 00021 00022 /****************************************************************************\ 00023 * CLASS * 00024 \****************************************************************************/ 00025 class CLight : public IInputHandler 00026 { 00027 /**************************************************************************\ 00028 * PUBLIC CLASS FUNCTIONS * 00029 \**************************************************************************/ 00030 public: 00031 00032 CLight(float radius); 00033 virtual ~CLight(); 00034 00035 virtual void Reset(); 00036 00037 virtual bool OnMouseMove(sdword sdwX, sdword sdwY, sdword sdwZ); 00038 virtual bool OnMouseKeyDown(byte bKey); 00039 virtual bool OnMouseKeyUp(byte bKey); 00040 virtual bool OnKeyDown(dword dwKey){return true;} 00041 virtual bool OnKeyUp(dword dwKey){return true;} 00042 00043 void SetPos(CVector3f newPos){m_restorepos = newPos;hasChanged=true;} 00044 CVector3f GetPos(){return m_restorepos;} 00045 00046 void SetHeadLight(bool tf); 00047 void SetLocalViewer(bool tf){bLocalViewer = tf; hasChanged=true;} 00048 void SetColor(CVector3f & col){color = col; hasChanged=true;} 00049 void SetSpecularity(float spec){specularity = spec; hasChanged = true;} 00050 void SetAmbience(float amb){ambience = amb; hasChanged = true;} 00051 void SetGradientX(float x){gradDelta.m_X = x; hasChanged = true;} 00052 void SetGradientY(float y){gradDelta.m_Y = y; hasChanged = true;} 00053 void SetGradientZ(float z){gradDelta.m_Z = z; hasChanged = true;} 00054 void Enable(bool tf){bEnabled = tf; hasChanged=true;} 00055 void Show(bool tf){bShow = tf;} 00056 bool HasChanged(){return hasChanged;} 00057 00058 void Draw(); 00059 00060 CVector3f m_pos,m_resetpos,m_restorepos; 00061 CVector3f color; 00062 bool bHeadLight; 00063 bool bLocalViewer; 00064 bool bEnabled; 00065 bool bShow; 00066 bool hasChanged; 00067 00068 CVector3f gradDelta; 00069 float specularity; 00070 float ambience; 00071 00072 /**************************************************************************\ 00073 * PROTECTED CLASS FUNCTIONS * 00074 \**************************************************************************/ 00075 protected: 00076 00077 virtual void Update(){}; 00078 00079 /**************************************************************************\ 00080 * PRIVATE CLASS FUNCTIONS * 00081 \**************************************************************************/ 00082 private: 00083 00084 //Private copy constructor and assignment operator to prevent mistakes: 00085 CLight(const CLight &); 00086 const CLight &operator =(const CLight &); 00087 00088 /**************************************************************************\ 00089 * PROTECTED CLASS MEMBERS * 00090 \**************************************************************************/ 00091 protected: 00092 00093 /**************************************************************************\ 00094 * PRIVATE CLASS MEMBERS * 00095 \**************************************************************************/ 00096 private: 00097 00098 float azimuth, elevation, radius; 00099 bool doOrbit; 00100 }; 00101 00102 #endif