iengine/light.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2000-2001 by Jorrit Tyberghein 00003 Copyright (C) 1999 by Andrew Zabolotny <bit@eltech.ru> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_IENGINE_LIGHT_H__ 00021 #define __CS_IENGINE_LIGHT_H__ 00022 00030 #include "csutil/scf.h" 00031 00032 class csColor; 00033 class csFlags; 00034 class csVector3; 00035 class csVector4; 00036 class csBox3; 00037 00038 struct iLight; 00039 struct iMovable; 00040 struct iObject; 00041 struct iSector; 00042 struct iSceneNode; 00043 struct iShaderVariableContext; 00044 00045 struct iBaseHalo; 00046 struct iCrossHalo; 00047 struct iNovaHalo; 00048 struct iFlareHalo; 00049 00052 00053 #define CS_LIGHT_NOSHADOWS 0x00000001 00054 00060 #define CS_LIGHT_ACTIVEHALO 0x80000000 00061 00066 enum csLightDynamicType 00067 { 00073 CS_LIGHT_DYNAMICTYPE_STATIC = 1, 00074 00080 CS_LIGHT_DYNAMICTYPE_PSEUDO = 2, 00081 00087 CS_LIGHT_DYNAMICTYPE_DYNAMIC = 3 00088 }; 00091 00092 #define CS_DEFAULT_LIGHT_LEVEL 20 00094 #define CS_NORMAL_LIGHT_LEVEL 128 00095 00109 enum csLightAttenuationMode 00110 { 00112 CS_ATTN_NONE = 0, 00114 CS_ATTN_LINEAR = 1, 00116 CS_ATTN_INVERSE = 2, 00118 CS_ATTN_REALISTIC = 3, 00123 CS_ATTN_CLQ = 4 00124 }; 00139 enum csLightType 00140 { 00142 CS_LIGHT_POINTLIGHT, 00144 CS_LIGHT_DIRECTIONAL, 00146 CS_LIGHT_SPOTLIGHT 00147 }; 00148 00157 struct iLightCallback : public virtual iBase 00158 { 00159 SCF_INTERFACE(iLightCallback,2,0,0); 00164 virtual void OnColorChange (iLight* light, const csColor& newcolor) = 0; 00165 00170 virtual void OnPositionChange (iLight* light, const csVector3& newpos) = 0; 00171 00176 virtual void OnSectorChange (iLight* light, iSector* newsector) = 0; 00177 00182 virtual void OnRadiusChange (iLight* light, float newradius) = 0; 00183 00188 virtual void OnDestroy (iLight* light) = 0; 00189 00194 virtual void OnAttenuationChange (iLight* light, int newatt) = 0; 00195 }; 00196 00197 00233 struct iLight : public virtual iBase 00234 { 00235 SCF_INTERFACE(iLight,3,0,2); 00237 virtual const char* GetLightID () = 0; 00238 00240 virtual iObject *QueryObject() = 0; 00241 00249 virtual csLightDynamicType GetDynamicType () const = 0; 00250 00256 CS_DEPRECATED_METHOD_MSG("Deprecated. Use GetMovable() and the iMovable interface.") 00257 virtual const csVector3& GetCenter () const = 0; 00263 CS_DEPRECATED_METHOD_MSG("Deprecated. Use GetMovable() and the iMovable interface.") 00264 virtual const csVector3 GetFullCenter () const = 0; 00269 CS_DEPRECATED_METHOD_MSG("Deprecated. Use GetMovable() and the iMovable interface.") 00270 virtual void SetCenter (const csVector3& pos) = 0; 00271 00276 CS_DEPRECATED_METHOD_MSG("Deprecated. Use GetMovable() and the iMovable interface.") 00277 virtual iSector *GetSector () = 0; 00278 00287 virtual iMovable *GetMovable () = 0; 00288 00292 virtual iSceneNode* QuerySceneNode () = 0; 00293 00295 virtual const csColor& GetColor () const = 0; 00297 virtual void SetColor (const csColor& col) = 0; 00298 00300 virtual const csColor& GetSpecularColor () const = 0; 00302 virtual void SetSpecularColor (const csColor& col) = 0; 00303 00305 virtual csLightType GetType () const = 0; 00307 virtual void SetType (csLightType type) = 0; 00308 00313 virtual csLightAttenuationMode GetAttenuationMode () const = 0; 00318 virtual void SetAttenuationMode (csLightAttenuationMode a) = 0; 00319 00324 virtual void SetAttenuationConstants (const csVector4& constants) = 0; 00329 virtual const csVector4 &GetAttenuationConstants () const = 0; 00330 00337 virtual float GetCutoffDistance () const = 0; 00338 00345 virtual void SetCutoffDistance (float distance) = 0; 00346 00352 virtual float GetDirectionalCutoffRadius () const = 0; 00353 00359 virtual void SetDirectionalCutoffRadius (float radius) = 0; 00360 00364 virtual void SetSpotLightFalloff (float inner, float outer) = 0; 00365 00369 virtual void GetSpotLightFalloff (float& inner, float& outer) const = 0; 00370 00372 virtual iCrossHalo* CreateCrossHalo (float intensity, float cross) = 0; 00374 virtual iNovaHalo* CreateNovaHalo (int seed, int num_spokes, 00375 float roundness) = 0; 00377 virtual iFlareHalo* CreateFlareHalo () = 0; 00378 00380 virtual iBaseHalo* GetHalo () const = 0; 00381 00383 virtual float GetBrightnessAtDistance (float d) const = 0; 00384 00390 virtual csFlags& GetFlags () = 0; 00391 00396 virtual void SetLightCallback (iLightCallback* cb) = 0; 00397 00401 virtual void RemoveLightCallback (iLightCallback* cb) = 0; 00402 00404 virtual int GetLightCallbackCount () const = 0; 00405 00407 virtual iLightCallback* GetLightCallback (int idx) const = 0; 00408 00413 virtual uint32 GetLightNumber () const = 0; 00414 00418 virtual iShaderVariableContext* GetSVContext() = 0; 00419 00421 00424 virtual const csBox3& GetLocalBBox () const = 0; 00425 virtual const csBox3& GetWorldBBox () const = 0; 00427 00433 virtual void OnSetPosition () = 0; 00434 }; 00435 00445 struct iLightList : public virtual iBase 00446 { 00447 SCF_INTERFACE(iLightList,2,0,0); 00449 virtual int GetCount () const = 0; 00450 00452 virtual iLight *Get (int n) const = 0; 00453 00455 virtual int Add (iLight *obj) = 0; 00456 00458 virtual bool Remove (iLight *obj) = 0; 00459 00461 virtual bool Remove (int n) = 0; 00462 00464 virtual void RemoveAll () = 0; 00465 00467 virtual int Find (iLight *obj) const = 0; 00468 00470 virtual iLight *FindByName (const char *Name) const = 0; 00471 00473 virtual iLight *FindByID (const char* id) const = 0; 00474 }; 00475 00488 struct iLightIterator : public virtual iBase 00489 { 00490 SCF_INTERFACE (iLightIterator, 0, 1, 0); 00491 00493 virtual bool HasNext () = 0; 00494 00496 virtual iLight* Next () = 0; 00497 00499 virtual iSector* GetLastSector () = 0; 00500 00502 virtual void Reset () = 0; 00503 00504 }; 00505 00519 struct iLightFactory : public virtual iBase 00520 { 00521 SCF_INTERFACE(iLightFactory,1,0,0); 00522 00524 virtual iObject *QueryObject() = 0; 00525 00533 virtual void SetDynamicType (csLightDynamicType type) = 0; 00534 virtual csLightDynamicType GetDynamicType () const = 0; 00535 00537 virtual const csColor& GetColor () const = 0; 00539 virtual void SetColor (const csColor& col) = 0; 00540 00542 virtual const csColor& GetSpecularColor () const = 0; 00544 virtual void SetSpecularColor (const csColor& col) = 0; 00545 virtual bool IsSpecularColorUsed () const = 0; 00546 00548 virtual csLightType GetType () const = 0; 00550 virtual void SetType (csLightType type) = 0; 00551 00556 virtual csLightAttenuationMode GetAttenuationMode () const = 0; 00561 virtual void SetAttenuationMode (csLightAttenuationMode a) = 0; 00562 00567 virtual void SetAttenuationConstants (const csVector4& constants) = 0; 00572 virtual const csVector4 &GetAttenuationConstants () const = 0; 00573 00580 virtual float GetCutoffDistance () const = 0; 00581 00588 virtual void SetCutoffDistance (float distance) = 0; 00589 00595 virtual float GetDirectionalCutoffRadius () const = 0; 00596 00602 virtual void SetDirectionalCutoffRadius (float radius) = 0; 00603 00607 virtual void SetSpotLightFalloff (float inner, float outer) = 0; 00608 00612 virtual void GetSpotLightFalloff (float& inner, float& outer) const = 0; 00613 00619 virtual csFlags& GetFlags () = 0; 00620 }; 00621 00631 struct iLightFactoryList : public virtual iBase 00632 { 00633 SCF_INTERFACE(iLightFactoryList,1,0,0); 00634 00636 virtual int GetCount () const = 0; 00637 00639 virtual iLightFactory *Get (int n) const = 0; 00640 00642 virtual int Add (iLightFactory *obj) = 0; 00643 00645 virtual bool Remove (iLightFactory *obj) = 0; 00646 00648 virtual bool Remove (int n) = 0; 00649 00651 virtual void RemoveAll () = 0; 00652 00654 virtual int Find (iLightFactory *obj) const = 0; 00655 00657 virtual iLightFactory *FindByName (const char *Name) const = 0; 00658 }; 00659 00662 #endif // __CS_IENGINE_LIGHT_H__ 00663
Generated for Crystal Space 2.1 by doxygen 1.6.1
