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 #include "iengine/fview.h" 00033 00034 class csColor; 00035 class csFlags; 00036 class csVector3; 00037 00038 struct iLight; 00039 struct iLightingInfo; 00040 struct iMovable; 00041 struct iObject; 00042 struct iSector; 00043 struct iSceneNode; 00044 struct iShaderVariableContext; 00045 00046 struct iBaseHalo; 00047 struct iCrossHalo; 00048 struct iNovaHalo; 00049 struct iFlareHalo; 00050 00058 #define CS_LIGHT_ACTIVEHALO 0x80000000 00059 00064 enum csLightDynamicType 00065 { 00071 CS_LIGHT_DYNAMICTYPE_STATIC = 1, 00072 00078 CS_LIGHT_DYNAMICTYPE_PSEUDO = 2, 00079 00085 CS_LIGHT_DYNAMICTYPE_DYNAMIC = 3 00086 }; 00089 00090 #define CS_DEFAULT_LIGHT_LEVEL 20 00092 #define CS_NORMAL_LIGHT_LEVEL 128 00093 00107 enum csLightAttenuationMode 00108 { 00110 CS_ATTN_NONE = 0, 00112 CS_ATTN_LINEAR = 1, 00114 CS_ATTN_INVERSE = 2, 00116 CS_ATTN_REALISTIC = 3, 00121 CS_ATTN_CLQ = 4 00122 }; 00137 enum csLightType 00138 { 00140 CS_LIGHT_POINTLIGHT, 00142 CS_LIGHT_DIRECTIONAL, 00144 CS_LIGHT_SPOTLIGHT 00145 }; 00146 00155 struct iLightCallback : public virtual iBase 00156 { 00157 SCF_INTERFACE(iLightCallback,2,0,0); 00162 virtual void OnColorChange (iLight* light, const csColor& newcolor) = 0; 00163 00168 virtual void OnPositionChange (iLight* light, const csVector3& newpos) = 0; 00169 00174 virtual void OnSectorChange (iLight* light, iSector* newsector) = 0; 00175 00180 virtual void OnRadiusChange (iLight* light, float newradius) = 0; 00181 00186 virtual void OnDestroy (iLight* light) = 0; 00187 00192 virtual void OnAttenuationChange (iLight* light, int newatt) = 0; 00193 }; 00194 00195 00231 struct iLight : public virtual iBase 00232 { 00233 SCF_INTERFACE(iLight,2,0,0); 00235 virtual const char* GetLightID () = 0; 00236 00238 virtual iObject *QueryObject() = 0; 00239 00247 virtual csLightDynamicType GetDynamicType () const = 0; 00248 00253 virtual const csVector3& GetCenter () const = 0; 00258 virtual const csVector3 GetFullCenter () const = 0; 00260 virtual void SetCenter (const csVector3& pos) = 0; 00261 00263 virtual iSector *GetSector () = 0; 00264 00273 virtual iMovable *GetMovable () = 0; 00274 00278 virtual iSceneNode* QuerySceneNode () = 0; 00279 00281 virtual const csColor& GetColor () const = 0; 00283 virtual void SetColor (const csColor& col) = 0; 00284 00286 virtual const csColor& GetSpecularColor () const = 0; 00288 virtual void SetSpecularColor (const csColor& col) = 0; 00289 00291 virtual csLightType GetType () const = 0; 00293 virtual void SetType (csLightType type) = 0; 00294 00299 virtual csLightAttenuationMode GetAttenuationMode () const = 0; 00304 virtual void SetAttenuationMode (csLightAttenuationMode a) = 0; 00305 00310 virtual void SetAttenuationConstants (const csVector3& constants) = 0; 00315 virtual const csVector3 &GetAttenuationConstants () const = 0; 00316 00323 virtual float GetCutoffDistance () const = 0; 00324 00331 virtual void SetCutoffDistance (float distance) = 0; 00332 00338 virtual float GetDirectionalCutoffRadius () const = 0; 00339 00345 virtual void SetDirectionalCutoffRadius (float radius) = 0; 00346 00350 virtual void SetSpotLightFalloff (float inner, float outer) = 0; 00351 00355 virtual void GetSpotLightFalloff (float& inner, float& outer) const = 0; 00356 00358 virtual iCrossHalo* CreateCrossHalo (float intensity, float cross) = 0; 00360 virtual iNovaHalo* CreateNovaHalo (int seed, int num_spokes, 00361 float roundness) = 0; 00363 virtual iFlareHalo* CreateFlareHalo () = 0; 00364 00366 virtual iBaseHalo* GetHalo () const = 0; 00367 00369 virtual float GetBrightnessAtDistance (float d) const = 0; 00370 00376 virtual csFlags& GetFlags () = 0; 00377 00382 virtual void SetLightCallback (iLightCallback* cb) = 0; 00383 00387 virtual void RemoveLightCallback (iLightCallback* cb) = 0; 00388 00390 virtual int GetLightCallbackCount () const = 0; 00391 00393 virtual iLightCallback* GetLightCallback (int idx) const = 0; 00394 00399 virtual uint32 GetLightNumber () const = 0; 00400 00406 virtual void AddAffectedLightingInfo (iLightingInfo* li) = 0; 00407 00411 virtual void RemoveAffectedLightingInfo (iLightingInfo* li) = 0; 00412 00417 virtual void Setup () = 0; 00418 00422 virtual iShaderVariableContext* GetSVContext() = 0; 00423 }; 00424 00434 struct iLightList : public virtual iBase 00435 { 00436 SCF_INTERFACE(iLightList,2,0,0); 00438 virtual int GetCount () const = 0; 00439 00441 virtual iLight *Get (int n) const = 0; 00442 00444 virtual int Add (iLight *obj) = 0; 00445 00447 virtual bool Remove (iLight *obj) = 0; 00448 00450 virtual bool Remove (int n) = 0; 00451 00453 virtual void RemoveAll () = 0; 00454 00456 virtual int Find (iLight *obj) const = 0; 00457 00459 virtual iLight *FindByName (const char *Name) const = 0; 00460 00462 virtual iLight *FindByID (const char* id) const = 0; 00463 }; 00464 00470 struct iLightingProcessData : public virtual iBase 00471 { 00472 SCF_INTERFACE (iLightingProcessData, 1, 0, 0); 00473 00478 virtual void FinalizeLighting () = 0; 00479 }; 00480 00487 struct iLightingProcessInfo : public iFrustumViewUserdata 00488 { 00489 SCF_INTERFACE(iLightingProcessInfo,2,0,0); 00491 virtual iLight* GetLight () const = 0; 00492 00494 virtual bool IsDynamic () const = 0; 00495 00497 virtual void SetColor (const csColor& col) = 0; 00498 00500 virtual const csColor& GetColor () const = 0; 00501 00507 virtual void AttachUserdata (iLightingProcessData* userdata) = 0; 00508 00512 virtual csPtr<iLightingProcessData> QueryUserdata (scfInterfaceID id, 00513 int version) = 0; 00514 00520 virtual void FinalizeLighting () = 0; 00521 }; 00522 00535 struct iLightIterator : public virtual iBase 00536 { 00537 SCF_INTERFACE (iLightIterator, 0, 1, 0); 00538 00540 virtual bool HasNext () = 0; 00541 00543 virtual iLight* Next () = 0; 00544 00546 virtual iSector* GetLastSector () = 0; 00547 00549 virtual void Reset () = 0; 00550 00551 }; 00552 00555 #endif // __CS_IENGINE_LIGHT_H__ 00556
Generated for Crystal Space 1.4.0 by doxygen 1.5.8