00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00036 class PG_API pgLts
00037 {
00038 friend class pgDrawMgr;
00039
00040 public:
00041 pgDefineException(ExceptionInvalidArgument);
00042 pgDefineException(ExceptionNotFound);
00043 pgDefineException(ExceptionSameIDExists);
00044
00045 static const u32 MAX_PARA_LIGHT_NUM = 3;
00046 static const u32 MAX_NEAR_LIGHT_NUM = 3;
00047
00048 pgLts* getPrevN() const;
00049 pgLts* getNextN() const;
00050
00051 pgID getID() const;
00052
00053 pgCol getAmbientColor() const;
00054 void setAmbientColor(pgCol col);
00055
00056 bool isParaLightActive(u8 index) const;
00057 void setParaLightActive(u8 index, bool is_active);
00058
00059 const pgVec& getParaLightDir(u8 index) const;
00060 void setParaLightDir(u8 index, const pgVec& dir);
00061
00062 pgCol getParaLightColor(u8 index) const;
00063 void setParaLightColor(u8 index, pgCol col);
00064
00065 u32 getPointLightNum() const;
00066 pgLit* getPointLight(pgID lit_id);
00067 pgLit* newPointLight(pgID lit_id);
00068 void deletePointLight(pgID lit_id);
00069 pgLit* getFirstPointLightN() const;
00070 pgLit* getLastPointLightN() const;
00071 void clearPointLight();
00072
00073 void findNearLight(const pgVec& pos);
00074 u8 getNearLightNum() const;
00075 const pgVec& getNearLightDir(u8 index) const;
00076 pgCol getNearLightColor(u8 index) const;
00077
00078 private:
00079 struct ParaLight
00080 {
00081 pgType<u8, bool> is_active;
00082 pgVec dir;
00083 pgCol col;
00084 u16 col_int;
00085 };
00086
00087 struct NearLight
00088 {
00089 pgVec dir;
00090 pgCol col;
00091 u16 col_int;
00092 };
00093
00094 pgLts(pgID lts_id);
00095 ~pgLts();
00096 void operator=(const pgLts&);
00097
00098 pgLit* getPointLightN(pgID lit_id);
00099
00100 void addLightToNearLight(const pgVec& dir, pgCol col, u16 col_int);
00101
00102 pgID m_id;
00103 pgCol m_amb_col;
00104 ParaLight m_para_lit[MAX_PARA_LIGHT_NUM];
00105 u8 m_near_lit_num;
00106 u8 m_near_lit_index_tbl[MAX_NEAR_LIGHT_NUM];
00107 NearLight m_near_lit[MAX_NEAR_LIGHT_NUM];
00108 pgList<pgLit> m_lit_list;
00109 };