#include <Assert.h>#include "Genesis.h"#include "BaseType.h"#include "System.h"#include "DCommon.h"Go to the source code of this file.
|
|
Definition at line 40 of file Light.h. Referenced by gePuppet_ComputeAmbientLight(), gePuppet_PrepLights(), geSprite_UpdateLighting(), Light_SetupLightmap(), Light_SetupLights(), and Light_WorldAddLight(). |
|
|
|
|
|
Definition at line 41 of file Light.h. Referenced by Light_WorldGetLTypeCurrent(), Light_WorldSetLTypeTable(), and UpdateLTypeTables(). |
|
|
|
|
|
|
|
|
Definition at line 117 of file Light.c. References BuildLightLUTS(), Engine, GE_TRUE, geBoolean, and InitSqrtTab(). Referenced by Sys_EngineCreate().
00118 {
00119 BuildLightLUTS(Engine);
00120
00121 InitSqrtTab();
00122
00123 return GE_TRUE;
00124 }
|
|
|
Definition at line 129 of file Light.c. References BSPData, CEngine, CWorld, and NULL. Referenced by Sys_EngineFree().
|
|
||||||||||||||||||||||||
|
Definition at line 219 of file Light.c. References GE_RGBA::b, Surf_TexVert::b, geFog::Color, GE_RGBA::g, Surf_TexVert::g, geFloat, geVec3d_AddScaled(), geVec3d_DotProduct(), geVec3d_Length(), geVec3d_Normalize(), geVec3d_Subtract(), int32, geFog::Pos, GE_RGBA::r, Surf_TexVert::r, t, v, geFog::VolumeBrightness, geFog::VolumeRadius, and geFog::VolumeRadiusSquared. Referenced by RenderFace().
00220 {
00221 geVec3d FogRay;
00222 geFloat Radius, RadiusSq, FogRayDot, OneOverRadiusDotBright;
00223 geFloat EyeDist;
00224 int32 i;
00225
00226 Radius = Fog->VolumeRadius;
00227 RadiusSq = Fog->VolumeRadiusSquared;
00228 OneOverRadiusDotBright = (1.0f/Radius)*Fog->VolumeBrightness;
00229
00230 geVec3d_Subtract(&Fog->Pos, POV, &FogRay);
00231 FogRayDot = geVec3d_DotProduct(&FogRay,&FogRay);
00232 EyeDist = (geFloat)sqrt(FogRayDot);
00233
00234 for (i=0; i< NumVerts; i++, Verts++, TexVerts++)
00235 {
00236 geVec3d Ray, Ray2, Impact1, Impact2;
00237 geFloat DistSq, Dist, Disc, v;
00238 geFloat t0, t1, t, VertDist, d, d2;
00239
00240 geVec3d_Subtract(Verts, POV, &Ray);
00241 geVec3d_Normalize(&Ray);
00242
00243 v = geVec3d_DotProduct(&FogRay, &Ray);
00244
00245 Disc = (RadiusSq) - (FogRayDot - (v*v));
00246
00247 if (Disc <= 0)
00248 continue;
00249
00250 d = (geFloat)sqrt(Disc);
00251
00252 t0 = v - d;
00253 t1 = v + d;
00254
00255 if (t0 > 0)
00256 t = t0;
00257 else if (t1 > 0)
00258 t = t1;
00259 else
00260 continue;
00261
00262 geVec3d_Subtract(Verts, &Fog->Pos, &Ray2);
00263 DistSq = geVec3d_DotProduct(&Ray2, &Ray2);
00264 VertDist = (geFloat)sqrt(DistSq);
00265
00266 if (EyeDist < Radius && VertDist < Radius) // Both inside sphere
00267 {
00268 Impact1 = *Verts;
00269 Impact2 = *POV;
00270 }
00271 else if (EyeDist < Radius) // Eye inside
00272 {
00273 Impact1 = *POV;
00274 geVec3d_AddScaled(POV, &Ray, t, &Impact2);
00275 }
00276 else if (VertDist < Radius) // Vert is inside
00277 {
00278 Impact1 = *Verts;
00279 geVec3d_AddScaled(POV, &Ray, t, &Impact2);
00280 }
00281 else // Both lie outside sphere
00282 {
00283 geVec3d_AddScaled(POV, &Ray, t0, &Impact1);
00284 geVec3d_AddScaled(POV, &Ray, t1, &Impact2);
00285 geVec3d_Subtract(&Impact1, POV, &Ray);
00286
00287 d2 = geVec3d_DotProduct(&Ray, &Ray);
00288
00289 if (d2 > DistSq)
00290 continue;
00291 }
00292 geVec3d_Subtract(&Impact1, &Impact2, &Ray);
00293
00294 Dist = geVec3d_Length(&Ray)*OneOverRadiusDotBright;
00295
00296 #if 1
00297 // Fog the Specular RGB
00298 TexVerts->r += Dist*Fog->Color.r;
00299 TexVerts->g += Dist*Fog->Color.g;
00300 TexVerts->b += Dist*Fog->Color.b;
00301 #else
00302 TexVerts->r = 255.0f;
00303 TexVerts->g = 255.0f;
00304 TexVerts->b = 255.0f;
00305 #endif
00306 }
00307 }
|
|
||||||||||||||||
|
Definition at line 1838 of file Light.c. References DRV_RGB::b, GE_RGBA::b, BSPData, Surf_SurfInfo::Flags, DRV_RGB::g, GE_RGBA::g, GE_FALSE, GE_TRUE, geBoolean, geFloat, geVec3d_DotProduct(), GBSP_BSPData::GFXTexInfo, DRV_LInfo::Height, int32, Surf_SurfInfo::LInfo, DRV_LInfo::MinU, DRV_LInfo::MinV, DRV_RGB::r, GE_RGBA::r, DRV_LInfo::RGBLight, SURFINFO_LIGHTMAP, Surf_SurfInfo::TexInfo, and DRV_LInfo::Width. Referenced by gePuppet_ComputeAmbientLight(), and geSprite_UpdateLighting().
01839 {
01840
01841 DRV_RGB *RGBLight;
01842 geFloat fr = 0.0f, fg = 0.0f, fb = 0.0f;
01843 geVec3d VecU, VecV;
01844 geFloat TexU, TexV;
01845 int32 Index, Width, Height;
01846
01847 // Make sure this is a lightmaped face
01848 if (!(Surf->Flags & SURFINFO_LIGHTMAP))
01849 return GE_FALSE;
01850
01851 RGBLight = Surf->LInfo.RGBLight[0];
01852
01853 if (!RGBLight) // Make sure we are not null!!!
01854 return GE_FALSE;
01855
01856 VecU = BSPData->GFXTexInfo[Surf->TexInfo].Vecs[0];
01857 VecV = BSPData->GFXTexInfo[Surf->TexInfo].Vecs[1];
01858
01859 // Project the Point into the texture space
01860 TexU = geVec3d_DotProduct(Pos, &VecU) + BSPData->GFXTexInfo[Surf->TexInfo].Shift[0];
01861 TexV = geVec3d_DotProduct(Pos, &VecV) + BSPData->GFXTexInfo[Surf->TexInfo].Shift[1];
01862
01863 // Align into lightmap space
01864 TexU -= Surf->LInfo.MinU;
01865 TexV -= Surf->LInfo.MinV;
01866
01867 if (TexU < 0 || TexV < 0)
01868 return GE_FALSE;
01869
01870 if (TexU > Surf->LInfo.Width<<4 || TexV > Surf->LInfo.Height<<4)
01871 return GE_FALSE;
01872
01873 // Scale into lightmap space
01874 TexU /= (16);
01875 TexV /= (16);
01876
01877 Width = Surf->LInfo.Width;
01878 Height = Surf->LInfo.Height;
01879
01880 // Cap it off if invalid (for some funky reason)
01881 if (TexU > Width) TexU = (geFloat)Width;
01882 if (TexV > Height) TexV = (geFloat)Height;
01883 if (TexU < 0) TexU = 0.0f;
01884 if (TexV < 0) TexV = 0.0f;
01885
01886 Index = (int32)TexV * Width + (int32)TexU;
01887
01888 // Return the color dude...
01889 RGBA->r = (geFloat)RGBLight[Index].r;
01890 RGBA->g = (geFloat)RGBLight[Index].g;
01891 RGBA->b = (geFloat)RGBLight[Index].b;
01892
01893 return GE_TRUE;
01894 }
|
|
||||||||||||||||
|
Definition at line 1899 of file Light.c. References DRV_RGB::b, GE_RGBA::b, BSPData, Surf_SurfInfo::Flags, DRV_RGB::g, GE_RGBA::g, GE_FALSE, GE_TRUE, geBoolean, geFloat, geVec3d_DotProduct(), GBSP_BSPData::GFXTexInfo, DRV_LInfo::Height, int32, Surf_SurfInfo::LInfo, DRV_LInfo::MinU, DRV_LInfo::MinV, DRV_RGB::r, GE_RGBA::r, DRV_LInfo::RGBLight, SURFINFO_LIGHTMAP, Surf_SurfInfo::TexInfo, and DRV_LInfo::Width.
01900 {
01901
01902 DRV_RGB *RGBLight;
01903 geFloat fr = 0.0f, fg = 0.0f, fb = 0.0f;
01904 geVec3d VecU, VecV;
01905 geFloat TexU, TexV;
01906 int32 Index, Width, Height;
01907
01908 // Make sure this is a lightmaped face
01909 if (!(Surf->Flags & SURFINFO_LIGHTMAP))
01910 return GE_FALSE;
01911
01912 RGBLight = Surf->LInfo.RGBLight[0];
01913
01914 if (!RGBLight) // Make sure we are not null!!!
01915 return GE_FALSE;
01916
01917 TexU = geVec3d_DotProduct(Pos, &VecU) + BSPData->GFXTexInfo[Surf->TexInfo].Shift[0];
01918 TexV = geVec3d_DotProduct(Pos, &VecV) + BSPData->GFXTexInfo[Surf->TexInfo].Shift[1];
01919
01920 // Align into lightmap space
01921 TexU -= Surf->LInfo.MinU;
01922 TexV -= Surf->LInfo.MinV;
01923
01924 if (TexU < 0 || TexV < 0)
01925 return GE_FALSE;
01926
01927 if (TexU > Surf->LInfo.Width<<4 || TexV > Surf->LInfo.Height<<4)
01928 return GE_FALSE;
01929
01930 // Scale into lightmap space
01931 TexU /= (16);
01932 TexV /= (16);
01933
01934 Width = Surf->LInfo.Width;
01935 Height = Surf->LInfo.Height;
01936
01937 // Cap it off if invalid (for some funky reason)
01938 if (TexU > Width) TexU = (geFloat)Width;
01939 if (TexV > Height) TexV = (geFloat)Height;
01940 if (TexU < 0) TexU = 0.0f;
01941 if (TexV < 0) TexV = 0.0f;
01942
01943 Index = (int32)TexV * Width + (int32)TexU;
01944
01945 // Return the color dude...
01946 RGBA->r = (geFloat)RGBLight[Index].r;
01947 RGBA->g = (geFloat)RGBLight[Index].g;
01948 RGBA->b = (geFloat)RGBLight[Index].b;
01949
01950 return GE_TRUE;
01951 }
|
|
||||||||||||||||||||||||
|
Definition at line 1423 of file Light.c. References GE_RGBA::b, Light_DLight::CastShadow, Light_DLight::Color, Light_DLight::FColorB, Light_DLight::FColorG, Light_DLight::FColorR, GE_RGBA::g, GE_TRUE, geBoolean, int32, LIGHT_FRACT, NULL, Light_DLight::Pos, GE_RGBA::r, and Light_DLight::Radius. Referenced by geWorld_SetLightAttributes().
01428 {
01429 assert(Light != NULL);
01430
01431 Light->Pos = *Pos;
01432 Light->Color = *RGBA;
01433 Light->Radius = Radius;
01434
01435 // Pre-compute fixed point light colors
01436 Light->FColorR = (int32)((Light->Color.r/195.0f) * (1<<LIGHT_FRACT));
01437 Light->FColorG = (int32)((Light->Color.g/195.0f) * (1<<LIGHT_FRACT));
01438 Light->FColorB = (int32)((Light->Color.b/195.0f) * (1<<LIGHT_FRACT));
01439
01440 Light->CastShadow = CastShadow;
01441
01442 return GE_TRUE;
01443 }
|
|
|
Definition at line 177 of file Light.c. References CEngine, Engine, GE_TRUE, geBoolean, and NULL. Referenced by World_SetEngine().
|
|
|
Definition at line 205 of file Light.c. References BSPData, CBSP, GE_TRUE, geBoolean, and NULL. Referenced by Surf_WorldInit(), and World_SetGBSP().
|
|
||||||||||||
|
Definition at line 749 of file Light.c. References Light_DLight::Active, AddLightType(), AddLightType0(), AddLightType1(), AddLightTypeWavy(), AddLightTypeWavy1(), DRV_RGB::b, BlankRGB, BSPData, Light_DLight::CastShadow, CBSP, CEngine, CombineDLightWithRGBMap(), CombineDLightWithRGBMapWithShadow(), geWorld::CurFrameDynamic, CWorld, geEngine::DebugInfo, Surf_SurfInfo::DLightFrame, Surf_SurfInfo::DLights, Light_LightInfo::DynamicLights, DRV_LInfo::Face, Surf_SurfInfo::Flags, FogLightmap1(), FogLightmap2(), DRV_RGB::g, GE_FALSE, GE_TRUE, geBoolean, GBSP_BSPData::GFXFaces, GBSP_BSPData::GFXLightData, GBSP_BSPData::GFXTexInfo, DRV_LInfo::Height, int32, LIGHT_FRACT, LightInfo, geWorld::LightInfo, GFX_Face::LightOfs, Sys_DebugInfo::LMap1, Sys_DebugInfo::LMap2, Light_LightInfo::LTypeDynamic, Light_LightInfo::LTypeIntensities, GFX_Face::LTypes, MAX_DYNAMIC_LIGHTS, MirrorRecursion, NULL, Sys_DebugInfo::NumDLights, Light_LightInfo::NumDynamicLights, Surf_SurfInfo::NumLTypes, geWorld::NumVisibleFog, DRV_RGB::r, DRV_LInfo::RGBLight, World_BSP::SurfInfo, SURFINFO_LTYPED, TempRGB, TempRGB32, TempRGB32Fog, TempRGBFog, GFX_Face::TexInfo, TEXINFO_FULLBRIGHT, TRUE, uint8, geWorld::VisibleFog, and DRV_LInfo::Width. Referenced by Engine_InitDriver(), geEngine_CreateWorldLightmapTHandles(), gePuppet_ComputeAmbientLight(), and geSprite_UpdateLighting().
00750 {
00751 int32 LightOffset;
00752 geBoolean IsDyn, HasDLight;
00753 int32 NumLTypes;
00754 int32 i, Ln;
00755 Surf_SurfInfo *SInfo;
00756 GFX_Face *Face;
00757 int32 Intensity;
00758 uint8 *LightData;
00759 int32 lWidth, lHeight, LMapSize, MapNum, SIndex;
00760 int32 *pRGB1;
00761 DRV_RGB *pRGB2;
00762
00763 assert (CBSP != NULL);
00764 assert(BSPData != NULL);
00765 assert(BSPData->GFXFaces != NULL);
00766 assert(BSPData->GFXLightData != NULL);
00767 assert(BSPData->GFXTexInfo != NULL);
00768 assert(CWorld->LightInfo != NULL);
00769
00770 SInfo = &CBSP->SurfInfo[LInfo->Face];
00771 Face = &BSPData->GFXFaces[LInfo->Face];
00772
00773 NumLTypes = SInfo->NumLTypes;
00774
00775 LightOffset = Face->LightOfs;
00776
00777 lWidth = LInfo->Width;
00778 lHeight = LInfo->Height;
00779 LMapSize = lHeight * lWidth;
00780
00781 IsDyn = HasDLight = GE_FALSE;
00782
00783 if (SInfo->DLightFrame == CWorld->CurFrameDynamic)
00784 if (LightInfo->NumDynamicLights > 0 && !(BSPData->GFXTexInfo[Face->TexInfo].Flags & TEXINFO_FULLBRIGHT))
00785 HasDLight = GE_TRUE;
00786
00787 // We can early out if no dlights on this surface, and no styled lighting...
00788 if (!HasDLight && !(SInfo->Flags & SURFINFO_LTYPED))
00789 {
00790 if (LightOffset >=0)
00791 LInfo->RGBLight[0] = (DRV_RGB*)&BSPData->GFXLightData[LightOffset+1];
00792 else
00793 LInfo->RGBLight[0] = BlankRGB;
00794 goto FogOnly;
00795 }
00796
00797 CEngine->DebugInfo.LMap1++;
00798
00799 // If there is light data
00800 if (LightOffset >=0)
00801 {
00802 // FIXME: Take out one byte RGB check...
00803 // Lightmaps are allways RGB now...
00804 LightData = &BSPData->GFXLightData[LightOffset+1];
00805
00806 // layer all styles on first map, using its intensity table
00807 for (MapNum = 0; MapNum < 4; MapNum++)
00808 {
00809 SIndex = Face->LTypes[MapNum];
00810
00811 if (SIndex == 255)
00812 break;
00813
00814 if (LightInfo->LTypeDynamic[SIndex])
00815 IsDyn = GE_TRUE;
00816
00817 Intensity = LightInfo->LTypeIntensities[SIndex];
00818
00819 if (SIndex == 11)
00820 {
00821 if (MapNum == 0)
00822 AddLightTypeWavy1(TempRGB32, LightData, lWidth, lHeight);
00823 else
00824 AddLightTypeWavy(TempRGB32, LightData, lWidth, lHeight);
00825
00826 IsDyn = GE_TRUE; // Need to force to true
00827 }
00828 else
00829 {
00830 if (SIndex == 0) // LType 0 is always in first light slot
00831 AddLightType0(TempRGB32, LightData, lWidth, lHeight);
00832 else
00833 {
00834 if (MapNum == 0)
00835 AddLightType1(TempRGB32, LightData, lWidth, lHeight, Intensity);
00836 else
00837 AddLightType(TempRGB32, LightData, lWidth, lHeight, Intensity);
00838 }
00839 }
00840
00841 LightData += LMapSize*3;
00842 }
00843 }
00844 else
00845 memset(TempRGB32, 0, LMapSize*3*sizeof(TempRGB32[0]));
00846
00847 // Tack on dynamic lights
00848 if (HasDLight)
00849 {
00850 Light_DLight *DLights = LightInfo->DynamicLights;
00851
00852 for (Ln = 0; Ln <MAX_DYNAMIC_LIGHTS; Ln++, DLights++)
00853 {
00854 if (!DLights->Active)
00855 continue;
00856
00857 if (!(SInfo->DLights & (1<<Ln)))
00858 continue;
00859
00860 CEngine->DebugInfo.NumDLights++;
00861
00862 if (DLights->CastShadow)
00863 {
00864 if (CombineDLightWithRGBMapWithShadow(TempRGB32, DLights, Face, SInfo))
00865 IsDyn = GE_TRUE;
00866 }
00867 else
00868 {
00869 if (CombineDLightWithRGBMap(TempRGB32, DLights, Face, SInfo))
00870 IsDyn = GE_TRUE;
00871 }
00872 }
00873 }
00874
00875 // Put the light into a driver compatible pointer, and clamp it
00876 pRGB1 = TempRGB32;
00877 pRGB2 = TempRGB;
00878 for (i=0; i< LMapSize; i++)
00879 {
00880 Intensity = (*pRGB1++) >> LIGHT_FRACT;
00881 if (Intensity > 255)
00882 Intensity = 255;
00883 else if (Intensity < 0 )
00884 Intensity = 0;
00885 pRGB2->r = (uint8)Intensity;
00886
00887 Intensity = (*pRGB1++) >> LIGHT_FRACT;
00888 if (Intensity > 255)
00889 Intensity = 255;
00890 else if (Intensity < 0 )
00891 Intensity = 0;
00892 pRGB2->g = (uint8)Intensity;
00893
00894 Intensity = (*pRGB1++) >> LIGHT_FRACT;
00895 if (Intensity > 255)
00896 Intensity = 255;
00897 else if (Intensity < 0 )
00898 Intensity = 0;
00899 pRGB2->b = (uint8)Intensity;
00900
00901 pRGB2++;
00902 }
00903
00904 // Point the lightmap to the data
00905 LInfo->RGBLight[0] = TempRGB;
00906
00907 FogOnly: // Jump to here, for fog lightmap only...
00908
00909 //
00910 // Fog the lightmap (setup lightmap 1)
00911 //
00912 LInfo->RGBLight[1] = NULL;
00913
00914 #if 1
00915 if (!MirrorRecursion) // Only do fog on first pass, not in mirrors...
00916 {
00917 geFog *Fog;
00918 geBoolean WasFog;
00919
00920 WasFog = GE_FALSE;
00921
00922 if (CWorld->NumVisibleFog)
00923 {
00924 for (i=0; i< CWorld->NumVisibleFog; i++)
00925 {
00926 Fog = CWorld->VisibleFog[i];
00927
00928 if (i == 0) // Use FogLightmap1 for first one ONLY
00929 {
00930 if (FogLightmap1(Fog, TempRGB32Fog, Face, SInfo))
00931 WasFog = GE_TRUE;
00932 }
00933 else // All other fog lights use FogLightmap2
00934 {
00935 if (FogLightmap2(Fog, TempRGB32Fog, Face, SInfo))
00936 WasFog = GE_TRUE;
00937 }
00938 }
00939 }
00940
00941 if (WasFog)
00942 {
00943 CEngine->DebugInfo.LMap2++;
00944
00945 // Put the light into a driver compatible pointer, and clamp it
00946 pRGB1 = TempRGB32Fog;
00947 pRGB2 = TempRGBFog;
00948 for (i=0; i< LMapSize; i++)
00949 {
00950 Intensity = (*pRGB1++) >> LIGHT_FRACT;
00951 if (Intensity > 255)
00952 Intensity = 255;
00953 pRGB2->r = (uint8)Intensity;
00954
00955 Intensity = (*pRGB1++) >> LIGHT_FRACT;
00956 if (Intensity > 255)
00957 Intensity = 255;
00958 pRGB2->g = (uint8)Intensity;
00959
00960 Intensity = (*pRGB1++) >> LIGHT_FRACT;
00961 if (Intensity > 255)
00962 Intensity = 255;
00963 pRGB2->b = (uint8)Intensity;
00964
00965 pRGB2++;
00966 }
00967 IsDyn = TRUE; // Force this face to be dynamic
00968 LInfo->RGBLight[1] = TempRGBFog;
00969 }
00970 }
00971 #endif
00972
00973 if (Dynamic)
00974 {
00975 *Dynamic = IsDyn;
00976 }
00977 }
|
|
|
Definition at line 1258 of file Light.c. References Light_DLight::Active, BSPData, CBSP, geWorld::CurFrameDynamic, Light_LightInfo::DynamicLights, GE_TRUE, geBoolean, geVec3d_Add(), geVec3d_Subtract(), geXForm3d_TransposeTransform(), GBSP_BSPData::GFXModels, int32, LightInfo, MAX_DYNAMIC_LIGHTS, World_BSP::Models, NULL, GBSP_BSPData::NumGFXModels, geWorld_Model::Pivot, Light_DLight::Pos, GFX_Model::RootNode, SetupDynamicLight_r(), UpdateLTypeTables(), geWorld_Model::VisFrame, and geWorld_Model::XForm. Referenced by World_WorldRenderQ().
01259 {
01260 int32 i, Node;
01261 Light_DLight *DLights;
01262
01263 assert(World != NULL);
01264
01265 assert(BSPData != NULL);
01266 assert(BSPData->GFXModels != NULL);
01267 assert(LightInfo != NULL);
01268
01269 // Update the intensity tables for dynamic ltyped lighting
01270 UpdateLTypeTables(World);
01271
01272 DLights = LightInfo->DynamicLights;
01273
01274 #if 0
01275 Node = BSPData->GFXModels[0].RootNode[0];
01276
01277 for (i=0; i< MAX_DYNAMIC_LIGHTS; i++, DLights++)
01278 {
01279 if (!DLights->Active)
01280 continue;
01281
01282 SetupDynamicLight_r(DLights, &DLights->Pos, i, Node);
01283 }
01284 #else
01285 for (i=0; i< MAX_DYNAMIC_LIGHTS; i++, DLights++)
01286 {
01287 int32 m;
01288 geVec3d NewPos;
01289 geWorld_Model *Model;
01290
01291 if (!DLights->Active)
01292 continue;
01293
01294 Model = CBSP->Models;
01295
01296 for (m=0; m< BSPData->NumGFXModels; m++, Model++)
01297 {
01298 if (Model->VisFrame != World->CurFrameDynamic)
01299 continue;
01300
01301 Node = BSPData->GFXModels[m].RootNode[0];
01302
01303 geVec3d_Subtract(&DLights->Pos, &Model->Pivot, &NewPos);
01304 // InverseTransform the light about models center of rotation
01305 geXForm3d_TransposeTransform(&Model->XForm, &NewPos, &NewPos);
01306
01307 geVec3d_Add(&NewPos , &Model->Pivot, &NewPos);
01308
01309 SetupDynamicLight_r(DLights, &NewPos, i, Node);
01310 }
01311 }
01312 #endif
01313
01314 return GE_TRUE;
01315 }
|
|
|
Definition at line 190 of file Light.c. References CWorld, GE_TRUE, geBoolean, GSurfInfo, LightInfo, and NULL. Referenced by Surf_WorldInit(), and World_SetWorld().
|
|
|
Definition at line 1367 of file Light.c. References Light_DLight::Active, Light_LightInfo::DynamicLights, GE_ERR_RENDERQ_OVERFLOW, GE_TRUE, geErrorLog_Add, int32, geWorld::LightInfo, MAX_DYNAMIC_LIGHTS, NULL, and Light_LightInfo::NumDynamicLights. Referenced by geWorld_AddLight().
01368 {
01369 Light_LightInfo *LInfo;
01370 Light_DLight *DLights;
01371 int32 i;
01372
01373 assert(World != NULL);
01374
01375 LInfo = World->LightInfo;
01376
01377 assert(LInfo);
01378
01379 DLights = LInfo->DynamicLights;
01380
01381 for (i=0; i< MAX_DYNAMIC_LIGHTS; i++, DLights++)
01382 {
01383 if (!DLights->Active)
01384 break;
01385 }
01386
01387 if (i >= MAX_DYNAMIC_LIGHTS)
01388 {
01389 geErrorLog_Add(GE_ERR_RENDERQ_OVERFLOW, NULL);
01390 return NULL;
01391 }
01392
01393 // Set it's attributes to some default...
01394 memset(DLights, 0, sizeof(Light_DLight));
01395
01396 DLights->Active = GE_TRUE;
01397 LInfo->NumDynamicLights++;
01398
01399
01400 return DLights;
01401 }
|
|
||||||||||||
|
Definition at line 1319 of file Light.c. References Light_LightInfo::IPos, geWorld::LightInfo, Light_LightInfo::LTypeTable, MAX_LTYPES, and NULL.
01320 {
01321 Light_LightInfo *LInfo;
01322 assert( World != NULL );
01323 assert( LType >= 0 );
01324 assert( LType < MAX_LTYPES );
01325
01326 LInfo = World->LightInfo;
01327 assert( LInfo != NULL );
01328
01329 return (LInfo->LTypeTable[LType][LInfo->IPos[LType]]) ;
01330 }
|
|
|
Definition at line 139 of file Light.c. References GE_ERR_OUT_OF_MEMORY, GE_FALSE, GE_RAM_ALLOCATE_STRUCT, GE_TRUE, geBoolean, geErrorLog_Add, geWorld::LightInfo, NULL, and UpdateLTypeTables(). Referenced by geWorld_Create().
00140 {
00141 assert(World != NULL);
00142
00143 World->LightInfo = GE_RAM_ALLOCATE_STRUCT(Light_LightInfo);
00144
00145 if (!World->LightInfo)
00146 {
00147 geErrorLog_Add(GE_ERR_OUT_OF_MEMORY, NULL);
00148 return GE_FALSE;
00149 }
00150
00151 memset(World->LightInfo, 0, sizeof(Light_LightInfo));
00152
00153 UpdateLTypeTables(World); // Update ltype tables for first frame
00154
00155 return GE_TRUE;
00156 }
|
|
||||||||||||
|
Definition at line 1406 of file Light.c. References Light_DLight::Active, GE_FALSE, geWorld::LightInfo, and Light_LightInfo::NumDynamicLights. Referenced by geWorld_RemoveLight().
|
|
||||||||||||||||
|
Definition at line 1448 of file Light.c. References GE_ERR_INVALID_LTYPE, GE_FALSE, GE_TRUE, geBoolean, geErrorLog_Add, geWorld::LightInfo, Light_LightInfo::LTypeTable, MAX_LTYPES, and NULL. Referenced by geWorld_SetLTypeTable().
01449 {
01450 assert(World != NULL);
01451 assert(World->LightInfo != NULL);
01452
01453 if (LType < 0 || LType >= MAX_LTYPES)
01454 {
01455 geErrorLog_Add(GE_ERR_INVALID_LTYPE, NULL);
01456 return GE_FALSE;
01457 }
01458
01459 assert(strlen(Table) < 70);
01460
01461 strcpy(World->LightInfo->LTypeTable[LType], Table);
01462
01463 return GE_TRUE;
01464 }
|
|
|
Definition at line 161 of file Light.c. References geRam_Free, geWorld::LightInfo, and NULL. Referenced by geWorld_Free().
00162 {
00163 assert(World != NULL);
00164
00165 if (!World->LightInfo)
00166 return;
00167
00168 geRam_Free(World->LightInfo);
00169
00170 World->LightInfo = NULL;
00171 }
|
1.3.2