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 00029 #include "csutil/scf.h" 00030 #include "iengine/fview.h" 00031 00032 class csLight; 00033 class csColor; 00034 class csFlags; 00035 struct iLight; 00036 struct iSector; 00037 struct iObject; 00038 struct iCrossHalo; 00039 struct iNovaHalo; 00040 struct iFlareHalo; 00041 struct iLightingInfo; 00042 00050 #define CS_LIGHT_THINGSHADOWS 0x00000001 00051 00057 #define CS_LIGHT_ACTIVEHALO 0x80000000 00058 00067 #define CS_LIGHT_DYNAMICTYPE_STATIC 1 00068 00074 #define CS_LIGHT_DYNAMICTYPE_PSEUDO 2 00075 00081 #define CS_LIGHT_DYNAMICTYPE_DYNAMIC 3 00082 00084 00085 #define CS_DEFAULT_LIGHT_LEVEL 20 00086 00087 #define CS_NORMAL_LIGHT_LEVEL 128 00088 00100 00101 #define CS_ATTN_NONE 0 00102 00103 #define CS_ATTN_LINEAR 1 00104 00105 #define CS_ATTN_INVERSE 2 00106 00107 #define CS_ATTN_REALISTIC 3 00108 00109 #define CS_ATTN_CLQ 4 00110 00112 SCF_VERSION (iLightCallback, 0, 2, 1); 00113 00128 struct iLightCallback : public iBase 00129 { 00134 virtual void OnColorChange (iLight* light, const csColor& newcolor) = 0; 00135 00140 virtual void OnPositionChange (iLight* light, const csVector3& newpos) = 0; 00141 00146 virtual void OnSectorChange (iLight* light, iSector* newsector) = 0; 00147 00152 virtual void OnRadiusChange (iLight* light, float newradius) = 0; 00153 00158 virtual void OnDestroy (iLight* light) = 0; 00159 00164 virtual void OnAttenuationChange (iLight* light, int newatt) = 0; 00165 }; 00166 00167 00168 SCF_VERSION (iLight, 0, 0, 9); 00169 00211 struct iLight : public iBase 00212 { 00214 virtual csLight* GetPrivateObject () = 0; 00215 00217 virtual const char* GetLightID () = 0; 00218 00220 virtual iObject *QueryObject() = 0; 00221 00231 virtual int GetDynamicType () const = 0; 00232 00234 virtual const csVector3& GetCenter () = 0; 00236 virtual void SetCenter (const csVector3& pos) = 0; 00237 00239 virtual iSector *GetSector () = 0; 00240 00242 virtual const csColor& GetColor () = 0; 00244 virtual void SetColor (const csColor& col) = 0; 00245 00249 virtual float GetInfluenceRadius () = 0; 00250 00254 virtual float GetInfluenceRadiusSq () = 0; 00255 00259 virtual void SetInfluenceRadius (float radius) = 0; 00260 00262 virtual int GetAttenuation () = 0; 00274 virtual void SetAttenuation (int a) = 0; 00275 00281 virtual void SetAttenuationVector (const csVector3& attenv) = 0; 00282 00287 virtual const csVector3 &GetAttenuationVector() = 0; 00288 00296 virtual void CalculateAttenuationVector (int atttype, float radius = 1.0f, 00297 float brightness = 1.0f) = 0; 00298 00307 virtual bool GetDistanceForBrightness (float brightness, float& distance) = 0; 00308 00310 virtual iCrossHalo* CreateCrossHalo (float intensity, float cross) = 0; 00312 virtual iNovaHalo* CreateNovaHalo (int seed, int num_spokes, 00313 float roundness) = 0; 00315 virtual iFlareHalo* CreateFlareHalo () = 0; 00316 00318 virtual float GetBrightnessAtDistance (float d) = 0; 00319 00328 virtual csFlags& GetFlags () = 0; 00329 00334 virtual void SetLightCallback (iLightCallback* cb) = 0; 00335 00339 virtual void RemoveLightCallback (iLightCallback* cb) = 0; 00340 00342 virtual int GetLightCallbackCount () const = 0; 00343 00345 virtual iLightCallback* GetLightCallback (int idx) const = 0; 00346 00351 virtual uint32 GetLightNumber () const = 0; 00352 00358 virtual void AddAffectedLightingInfo (iLightingInfo* li) = 0; 00359 00363 virtual void RemoveAffectedLightingInfo (iLightingInfo* li) = 0; 00364 00369 virtual void Setup () = 0; 00370 }; 00371 00372 SCF_VERSION (iLightList, 0, 0, 2); 00373 00386 struct iLightList : public iBase 00387 { 00389 virtual int GetCount () const = 0; 00390 00392 virtual iLight *Get (int n) const = 0; 00393 00395 virtual int Add (iLight *obj) = 0; 00396 00398 virtual bool Remove (iLight *obj) = 0; 00399 00401 virtual bool Remove (int n) = 0; 00402 00404 virtual void RemoveAll () = 0; 00405 00407 virtual int Find (iLight *obj) const = 0; 00408 00410 virtual iLight *FindByName (const char *Name) const = 0; 00411 00413 virtual iLight *FindByID (const char* id) const = 0; 00414 }; 00415 00416 SCF_VERSION (iLightingProcessData, 0, 0, 1); 00417 00423 struct iLightingProcessData : public iBase 00424 { 00429 virtual void FinalizeLighting () = 0; 00430 }; 00431 00432 SCF_VERSION (iLightingProcessInfo, 0, 0, 2); 00433 00440 struct iLightingProcessInfo : public iFrustumViewUserdata 00441 { 00443 virtual iLight* GetLight () const = 0; 00444 00446 virtual bool IsDynamic () const = 0; 00447 00449 virtual void SetColor (const csColor& col) = 0; 00450 00452 virtual const csColor& GetColor () const = 0; 00453 00459 virtual void AttachUserdata (iLightingProcessData* userdata) = 0; 00460 00464 virtual csPtr<iLightingProcessData> QueryUserdata (scfInterfaceID id, 00465 int version) = 0; 00466 00472 virtual void FinalizeLighting () = 0; 00473 }; 00474 00475 SCF_VERSION (iLightIterator, 0, 1, 0); 00476 00492 struct iLightIterator : public iBase 00493 { 00495 virtual bool HasNext () = 0; 00496 00498 virtual iLight* Next () = 0; 00499 00501 virtual iSector* GetLastSector () = 0; 00502 00504 virtual void Reset () = 0; 00505 00506 }; 00507 00510 #endif // __CS_IENGINE_LIGHT_H__ 00511
Generated for Crystal Space by doxygen 1.2.18