Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | 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 #include "iengine/fview.h" 00031 00032 class csColor; 00033 class csFlags; 00034 struct iLight; 00035 struct iSector; 00036 struct iObject; 00037 struct iBaseHalo; 00038 struct iCrossHalo; 00039 struct iNovaHalo; 00040 struct iFlareHalo; 00041 struct iLightingInfo; 00042 struct iMovable; 00043 00051 #define CS_LIGHT_THINGSHADOWS 0x00000001 00052 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 00091 00092 #define CS_NORMAL_LIGHT_LEVEL 128 00093 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 }; 00140 enum csLightType 00141 { 00143 CS_LIGHT_POINTLIGHT, 00145 CS_LIGHT_DIRECTIONAL, 00147 CS_LIGHT_SPOTLIGHT 00148 }; 00149 00150 SCF_VERSION (iLightCallback, 0, 2, 1); 00151 00166 struct iLightCallback : public iBase 00167 { 00172 virtual void OnColorChange (iLight* light, const csColor& newcolor) = 0; 00173 00178 virtual void OnPositionChange (iLight* light, const csVector3& newpos) = 0; 00179 00184 virtual void OnSectorChange (iLight* light, iSector* newsector) = 0; 00185 00190 virtual void OnRadiusChange (iLight* light, float newradius) = 0; 00191 00196 virtual void OnDestroy (iLight* light) = 0; 00197 00202 virtual void OnAttenuationChange (iLight* light, int newatt) = 0; 00203 }; 00204 00205 00206 SCF_VERSION (iLight, 0, 1, 0); 00207 00249 struct iLight : public iBase 00250 { 00252 virtual const char* GetLightID () = 0; 00253 00255 virtual iObject *QueryObject() = 0; 00256 00266 virtual csLightDynamicType GetDynamicType () const = 0; 00267 00269 virtual const csVector3& GetCenter () const = 0; 00271 virtual void SetCenter (const csVector3& pos) = 0; 00272 00274 virtual iSector *GetSector () = 0; 00275 00277 virtual iMovable *GetMovable () = 0; 00278 00280 virtual const csColor& GetColor () const = 0; 00282 virtual void SetColor (const csColor& col) = 0; 00283 00285 virtual const csColor& GetSpecularColor () const = 0; 00287 virtual void SetSpecularColor (const csColor& col) = 0; 00288 00290 virtual csLightType GetType () const = 0; 00292 virtual void SetType (csLightType type) = 0; 00293 00295 virtual const csVector3& GetDirection () const = 0; 00297 virtual void SetDirection (const csVector3& v) = 0; 00298 00303 virtual csLightAttenuationMode GetAttenuationMode () const = 0; 00308 virtual void SetAttenuationMode (csLightAttenuationMode a) = 0; 00309 00314 virtual void SetAttenuationConstants (const csVector3& constants) = 0; 00319 virtual const csVector3 &GetAttenuationConstants () const = 0; 00320 00327 virtual float GetCutoffDistance () const = 0; 00328 00335 virtual void SetCutoffDistance (float distance) = 0; 00336 00342 virtual float GetDirectionalCutoffRadius () const = 0; 00343 00349 virtual void SetDirectionalCutoffRadius (float radius) = 0; 00350 00354 virtual void SetSpotLightFalloff (float inner, float outer) = 0; 00355 00359 virtual void GetSpotLightFalloff (float& inner, float& outer) const = 0; 00360 00362 virtual iCrossHalo* CreateCrossHalo (float intensity, float cross) = 0; 00364 virtual iNovaHalo* CreateNovaHalo (int seed, int num_spokes, 00365 float roundness) = 0; 00367 virtual iFlareHalo* CreateFlareHalo () = 0; 00368 00370 virtual iBaseHalo* GetHalo () const = 0; 00371 00373 virtual float GetBrightnessAtDistance (float d) const = 0; 00374 00383 virtual csFlags& GetFlags () = 0; 00384 00389 virtual void SetLightCallback (iLightCallback* cb) = 0; 00390 00394 virtual void RemoveLightCallback (iLightCallback* cb) = 0; 00395 00397 virtual int GetLightCallbackCount () const = 0; 00398 00400 virtual iLightCallback* GetLightCallback (int idx) const = 0; 00401 00406 virtual uint32 GetLightNumber () const = 0; 00407 00413 virtual void AddAffectedLightingInfo (iLightingInfo* li) = 0; 00414 00418 virtual void RemoveAffectedLightingInfo (iLightingInfo* li) = 0; 00419 00424 virtual void Setup () = 0; 00425 }; 00426 00427 SCF_VERSION (iLightList, 0, 0, 2); 00428 00441 struct iLightList : public iBase 00442 { 00444 virtual int GetCount () const = 0; 00445 00447 virtual iLight *Get (int n) const = 0; 00448 00450 virtual int Add (iLight *obj) = 0; 00451 00453 virtual bool Remove (iLight *obj) = 0; 00454 00456 virtual bool Remove (int n) = 0; 00457 00459 virtual void RemoveAll () = 0; 00460 00462 virtual int Find (iLight *obj) const = 0; 00463 00465 virtual iLight *FindByName (const char *Name) const = 0; 00466 00468 virtual iLight *FindByID (const char* id) const = 0; 00469 }; 00470 00471 SCF_VERSION (iLightingProcessData, 0, 0, 1); 00472 00478 struct iLightingProcessData : public iBase 00479 { 00484 virtual void FinalizeLighting () = 0; 00485 }; 00486 00487 SCF_VERSION (iLightingProcessInfo, 0, 0, 2); 00488 00495 struct iLightingProcessInfo : public iFrustumViewUserdata 00496 { 00498 virtual iLight* GetLight () const = 0; 00499 00501 virtual bool IsDynamic () const = 0; 00502 00504 virtual void SetColor (const csColor& col) = 0; 00505 00507 virtual const csColor& GetColor () const = 0; 00508 00514 virtual void AttachUserdata (iLightingProcessData* userdata) = 0; 00515 00519 virtual csPtr<iLightingProcessData> QueryUserdata (scfInterfaceID id, 00520 int version) = 0; 00521 00527 virtual void FinalizeLighting () = 0; 00528 }; 00529 00530 SCF_VERSION (iLightIterator, 0, 1, 0); 00531 00547 struct iLightIterator : public iBase 00548 { 00550 virtual bool HasNext () = 0; 00551 00553 virtual iLight* Next () = 0; 00554 00556 virtual iSector* GetLastSector () = 0; 00557 00559 virtual void Reset () = 0; 00560 00561 }; 00562 00565 #endif // __CS_IENGINE_LIGHT_H__ 00566
Generated for Crystal Space by doxygen 1.3.9.1