Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
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 00029 #include "csutil/scf.h" 00030 00031 #include "iengine/fview.h" 00032 00033 class csColor; 00034 class csFlags; 00035 class csVector3; 00036 00037 struct iLight; 00038 struct iLightingInfo; 00039 struct iMovable; 00040 struct iObject; 00041 struct iSector; 00042 00043 struct iBaseHalo; 00044 struct iCrossHalo; 00045 struct iNovaHalo; 00046 struct iFlareHalo; 00047 00055 #define CS_LIGHT_THINGSHADOWS 0x00000001 00056 00062 #define CS_LIGHT_ACTIVEHALO 0x80000000 00063 00068 enum csLightDynamicType 00069 { 00075 CS_LIGHT_DYNAMICTYPE_STATIC = 1, 00076 00082 CS_LIGHT_DYNAMICTYPE_PSEUDO = 2, 00083 00089 CS_LIGHT_DYNAMICTYPE_DYNAMIC = 3 00090 }; 00093 00094 #define CS_DEFAULT_LIGHT_LEVEL 20 00095 00096 #define CS_NORMAL_LIGHT_LEVEL 128 00097 00113 enum csLightAttenuationMode 00114 { 00116 CS_ATTN_NONE = 0, 00118 CS_ATTN_LINEAR = 1, 00120 CS_ATTN_INVERSE = 2, 00122 CS_ATTN_REALISTIC = 3, 00127 CS_ATTN_CLQ = 4 00128 }; 00144 enum csLightType 00145 { 00147 CS_LIGHT_POINTLIGHT, 00149 CS_LIGHT_DIRECTIONAL, 00151 CS_LIGHT_SPOTLIGHT 00152 }; 00153 00154 SCF_VERSION (iLightCallback, 0, 2, 1); 00155 00170 struct iLightCallback : public iBase 00171 { 00176 virtual void OnColorChange (iLight* light, const csColor& newcolor) = 0; 00177 00182 virtual void OnPositionChange (iLight* light, const csVector3& newpos) = 0; 00183 00188 virtual void OnSectorChange (iLight* light, iSector* newsector) = 0; 00189 00194 virtual void OnRadiusChange (iLight* light, float newradius) = 0; 00195 00200 virtual void OnDestroy (iLight* light) = 0; 00201 00206 virtual void OnAttenuationChange (iLight* light, int newatt) = 0; 00207 }; 00208 00209 00210 SCF_VERSION (iLight, 0, 1, 0); 00211 00253 struct iLight : public iBase 00254 { 00256 virtual const char* GetLightID () = 0; 00257 00259 virtual iObject *QueryObject() = 0; 00260 00270 virtual csLightDynamicType GetDynamicType () const = 0; 00271 00273 virtual const csVector3& GetCenter () const = 0; 00275 virtual void SetCenter (const csVector3& pos) = 0; 00276 00278 virtual iSector *GetSector () = 0; 00279 00281 virtual iMovable *GetMovable () = 0; 00282 00284 virtual const csColor& GetColor () const = 0; 00286 virtual void SetColor (const csColor& col) = 0; 00287 00289 virtual const csColor& GetSpecularColor () const = 0; 00291 virtual void SetSpecularColor (const csColor& col) = 0; 00292 00294 virtual csLightType GetType () const = 0; 00296 virtual void SetType (csLightType type) = 0; 00297 00299 virtual const csVector3& GetDirection () const = 0; 00301 virtual void SetDirection (const csVector3& v) = 0; 00302 00307 virtual csLightAttenuationMode GetAttenuationMode () const = 0; 00312 virtual void SetAttenuationMode (csLightAttenuationMode a) = 0; 00313 00318 virtual void SetAttenuationConstants (const csVector3& constants) = 0; 00323 virtual const csVector3 &GetAttenuationConstants () const = 0; 00324 00331 virtual float GetCutoffDistance () const = 0; 00332 00339 virtual void SetCutoffDistance (float distance) = 0; 00340 00346 virtual float GetDirectionalCutoffRadius () const = 0; 00347 00353 virtual void SetDirectionalCutoffRadius (float radius) = 0; 00354 00358 virtual void SetSpotLightFalloff (float inner, float outer) = 0; 00359 00363 virtual void GetSpotLightFalloff (float& inner, float& outer) const = 0; 00364 00366 virtual iCrossHalo* CreateCrossHalo (float intensity, float cross) = 0; 00368 virtual iNovaHalo* CreateNovaHalo (int seed, int num_spokes, 00369 float roundness) = 0; 00371 virtual iFlareHalo* CreateFlareHalo () = 0; 00372 00374 virtual iBaseHalo* GetHalo () const = 0; 00375 00377 virtual float GetBrightnessAtDistance (float d) const = 0; 00378 00387 virtual csFlags& GetFlags () = 0; 00388 00393 virtual void SetLightCallback (iLightCallback* cb) = 0; 00394 00398 virtual void RemoveLightCallback (iLightCallback* cb) = 0; 00399 00401 virtual int GetLightCallbackCount () const = 0; 00402 00404 virtual iLightCallback* GetLightCallback (int idx) const = 0; 00405 00410 virtual uint32 GetLightNumber () const = 0; 00411 00417 virtual void AddAffectedLightingInfo (iLightingInfo* li) = 0; 00418 00422 virtual void RemoveAffectedLightingInfo (iLightingInfo* li) = 0; 00423 00428 virtual void Setup () = 0; 00429 }; 00430 00431 SCF_VERSION (iLightList, 0, 0, 2); 00432 00445 struct iLightList : public iBase 00446 { 00448 virtual int GetCount () const = 0; 00449 00451 virtual iLight *Get (int n) const = 0; 00452 00454 virtual int Add (iLight *obj) = 0; 00455 00457 virtual bool Remove (iLight *obj) = 0; 00458 00460 virtual bool Remove (int n) = 0; 00461 00463 virtual void RemoveAll () = 0; 00464 00466 virtual int Find (iLight *obj) const = 0; 00467 00469 virtual iLight *FindByName (const char *Name) const = 0; 00470 00472 virtual iLight *FindByID (const char* id) const = 0; 00473 }; 00474 00475 SCF_VERSION (iLightingProcessData, 0, 0, 1); 00476 00482 struct iLightingProcessData : public iBase 00483 { 00488 virtual void FinalizeLighting () = 0; 00489 }; 00490 00491 SCF_VERSION (iLightingProcessInfo, 0, 0, 2); 00492 00499 struct iLightingProcessInfo : public iFrustumViewUserdata 00500 { 00502 virtual iLight* GetLight () const = 0; 00503 00505 virtual bool IsDynamic () const = 0; 00506 00508 virtual void SetColor (const csColor& col) = 0; 00509 00511 virtual const csColor& GetColor () const = 0; 00512 00518 virtual void AttachUserdata (iLightingProcessData* userdata) = 0; 00519 00523 virtual csPtr<iLightingProcessData> QueryUserdata (scfInterfaceID id, 00524 int version) = 0; 00525 00531 virtual void FinalizeLighting () = 0; 00532 }; 00533 00534 SCF_VERSION (iLightIterator, 0, 1, 0); 00535 00551 struct iLightIterator : public virtual iBase 00552 { 00554 virtual bool HasNext () = 0; 00555 00557 virtual iLight* Next () = 0; 00558 00560 virtual iSector* GetLastSector () = 0; 00561 00563 virtual void Reset () = 0; 00564 00565 }; 00566 00569 #endif // __CS_IENGINE_LIGHT_H__ 00570
Generated for Crystal Space by doxygen 1.4.4