Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include "gfxlib.h"
#include "gl_light.h"
#include <stack>
#include <assert.h>
#include "vs_globals.h"
#include "config_xml.h"
Go to the source code of this file.
Functions | |
void | GFXPushGlobalEffects () |
GFXBOOL | GFXPopGlobalEffects () |
This function undoes the above function to restore the global lights after specialFX phase. More... | |
GFXBOOL | GFXSetCutoff (const float ttcutoff) |
Sets the intensity cutoff before picked lights are ignored. More... | |
void | GFXSetOptimalIntensity (const float intensity, const float saturate) |
Sets the optimal intensity given that Optimal number of lights is fulfilled. More... | |
GFXBOOL | GFXSetOptimalNumLights (const int numLights) |
Sets number of lights graphics can handle optimally. More... | |
GFXBOOL | GFXSetSeparateSpecularColor (const GFXBOOL spec) |
Sets the light model to have separate specular color (if available) More... | |
GFXBOOL | GFXLightContextAmbient (const GFXColor &amb) |
Sets the ambient light value. More... | |
GFXBOOL | GFXGetLightContextAmbient (GFXColor &amb) |
Gets the ambient light value. More... | |
GFXBOOL | GFXCreateLight (int &light, const GFXLight &templatecopy, const bool global) |
void | GFXDeleteLight (const int light) |
Deletes a light, removing it from the light table if necessary. More... | |
GFXBOOL | GFXSetLight (const int light, const enum LIGHT_TARGET lt, const GFXColor &color) |
Modifies the parameters of the given light. More... | |
GFXBOOL | GFXEnableLight (int light) |
activates a light if not already activated More... | |
GFXBOOL | GFXDisableLight (int light) |
Deactivates an active light. More... | |
static void | SetupGLLightGlobals () |
void | GFXCreateLightContext (int &con_number) |
creates a light context (relevant to a star system) to add lights to More... | |
void | GFXDeleteLightContext (int con_number) |
Deletes a light context (hence a star system) More... | |
void | GFXSetLightContext (const int con_number) |
Sets active light context (restores all gllights in such context) More... | |
void | GFXDestroyAllLights () |
Variables | |
GLint | GFX_MAX_LIGHTS = 8 |
GLint | GFX_OPTIMAL_LIGHTS = 4 |
GFXBOOL | GFXLIGHTING = GFXFALSE |
int | _currentContext = 0 |
The curren tlight context. More... | |
vector< vector< gfx_light > > | _local_lights_dat |
The light data _llights points to one of these. More... | |
vector< GFXColor > | _ambient_light |
The ambient lights that are around. More... | |
vector< gfx_light > * | _llights = NULL |
The lights existing in a certain context. Points to _local_lights_dat. More... | |
OpenGLLights * | GLLights = NULL |
currently stored GL lights! More... | |
static stack< bool * > | GlobalEffects |
static stack< bool * > | GlobalEffectsFreelist |
static stack< GFXColor > | GlobalEffectsAmbient |
GFXCreateLight gets a light as a parameter. It sets light to have the index of the created light for modification in the future. If the light is global, it will always affect objects in space. if the light is not global, it is local and goes into a 3d hashtable to be picked at a later point on a per object basis.
Definition at line 272 of file gl_light.cpp.
References _llights.
Referenced by Stars::Draw(), BaseInterface::Room::BaseShip::Draw(), Mesh::DrawNow(), SetupCloakState(), and Atmosphere::Update().
void GFXCreateLightContext | ( | int & | con_number) |
creates a light context (relevant to a star system) to add lights to
Definition at line 317 of file gl_light.cpp.
References _ambient_light, _currentContext, _local_lights_dat, GFXBOOL, GFXFALSE, GFXSetLightContext(), GFXTRUE, and SetupGLLightGlobals().
Referenced by GameStarSystem::GameStarSystem(), GFXInit(), and GameUniverse::StartGFX().
void GFXDeleteLight | ( | const int | light) |
Deletes a light, removing it from the light table if necessary.
Definition at line 282 of file gl_light.cpp.
Referenced by Atmosphere::Draw(), Stars::Draw(), BaseInterface::Room::BaseShip::Draw(), Mesh::DrawNow(), and GamePlanet::Kill().
void GFXDeleteLightContext | ( | int | con_number) |
Deletes a light context (hence a star system)
Definition at line 331 of file gl_light.cpp.
References _local_lights_dat.
void GFXDestroyAllLights | ( | ) |
Deactivates an active light.
Definition at line 306 of file gl_light.cpp.
References _llights, GFXFALSE, and GFXTRUE.
Referenced by GamePlanet::DisableLights(), and Atmosphere::Draw().
activates a light if not already activated
Definition at line 296 of file gl_light.cpp.
References _llights, GFXFALSE, and GFXTRUE.
Referenced by GamePlanet::EnableLights(), and Atmosphere::Update().
Gets the ambient light value.
Definition at line 264 of file gl_light.cpp.
References _ambient_light, _currentContext, GFXFALSE, and GFXTRUE.
Referenced by GameStarSystem::Draw(), SphereMesh::ProcessDrawQueue(), CityLights::ProcessDrawQueue(), Terrain::Render(), and Terrain::RenderAll().
Sets the ambient light value.
Definition at line 251 of file gl_light.cpp.
References _ambient_light, _currentContext, GFXColor::a, GFXColor::b, GFXColor::g, GFXFALSE, GFXTRUE, and GFXColor::r.
Referenced by GameStarSystem::Draw(), GFXPopGlobalEffects(), GFXPushGlobalEffects(), SphereMesh::ProcessDrawQueue(), CityLights::ProcessDrawQueue(), Terrain::Render(), Terrain::RenderAll(), and GameUniverse::StartGFX().
GFXBOOL GFXPopGlobalEffects | ( | ) |
This function undoes the above function to restore the global lights after specialFX phase.
Definition at line 67 of file gl_light.cpp.
References GFX_MAX_LIGHTS, GFXLightContextAmbient(), GlobalEffects, GlobalEffectsAmbient, GlobalEffectsFreelist, and i.
Referenced by GameStarSystem::Draw(), Stars::Draw(), and Mesh::ProcessUndrawnMeshes().
void GFXPushGlobalEffects | ( | ) |
In the case of shields and other T&L based effects, the global lights must be disabled yet saved for later use while the selected lights are used shortly then disabled. This saves values of global lights
Definition at line 45 of file gl_light.cpp.
References _ambient_light, _currentContext, GFX_MAX_LIGHTS, GFXLightContextAmbient(), OpenGLL::GL_ENABLED, GlobalEffects, GlobalEffectsAmbient, GlobalEffectsFreelist, i, OpenGLLights::options, and unpicklights().
Referenced by Stars::Draw(), and Mesh::ProcessUndrawnMeshes().
Sets the intensity cutoff before picked lights are ignored.
Definition at line 214 of file gl_light.cpp.
References GFXFALSE, GFXTRUE, and intensity_cutoff.
Referenced by SetupGLLightGlobals().
GFXBOOL GFXSetLight | ( | const int | light, |
const enum LIGHT_TARGET | lt, | ||
const GFXColor & | color | ||
) |
Modifies the parameters of the given light.
Definition at line 287 of file gl_light.cpp.
References _llights, GFXFALSE, and GFXTRUE.
Referenced by GamePlanet::Draw().
void GFXSetLightContext | ( | const int | con_number) |
Sets active light context (restores all gllights in such context)
Definition at line 336 of file gl_light.cpp.
References _ambient_light, _currentContext, _llights, _local_lights_dat, GFX_MAX_LIGHTS, OpenGLL::GLL_OFF, i, OpenGLLights::index, lighttable, OpenGLLights::options, and unpicklights().
Referenced by ClientServerSetLightContext(), GFXCreateLightContext(), GameUniverse::StartGFX(), and GameStarSystem::SwapIn().
Sets the optimal intensity given that Optimal number of lights is fulfilled.
Definition at line 222 of file gl_light.cpp.
References optintense, optsat, and saturate().
Referenced by SetupGLLightGlobals().
Sets number of lights graphics can handle optimally.
Definition at line 228 of file gl_light.cpp.
References GFX_MAX_LIGHTS, GFX_OPTIMAL_LIGHTS, GFXFALSE, and GFXTRUE.
Referenced by SetupGLLightGlobals().
Sets the light model to have separate specular color (if available)
Definition at line 236 of file gl_light.cpp.
References GFXFALSE, and GFXTRUE.
Referenced by RestoreEnvmapState(), RestoreSpecMapState(), SetupEnvmapPass(), SetupGLLightGlobals(), SetupSpecMapFirstPass(), and SetupSpecMapSecondPass().
|
static |
Definition at line 372 of file gl_light.cpp.
References VegaConfig::getVariable(), GFX_MAX_LIGHTS, GFXFALSE, GFXSetCutoff(), GFXSetOptimalIntensity(), GFXSetOptimalNumLights(), GFXSetSeparateSpecularColor(), GFXTRUE, i, index, XMLSupport::parse_bool(), XMLSupport::parse_float(), XMLSupport::parse_int(), and vs_config.
Referenced by GFXCreateLightContext().
vector< GFXColor > _ambient_light |
The ambient lights that are around.
Definition at line 36 of file gl_light.cpp.
Referenced by GFXCreateLightContext(), GFXGetLightContextAmbient(), GFXLightContextAmbient(), GFXPushGlobalEffects(), and GFXSetLightContext().
int _currentContext = 0 |
The curren tlight context.
Definition at line 34 of file gl_light.cpp.
Referenced by GFXCreateLightContext(), GFXGetLightContextAmbient(), GFXLightContextAmbient(), GFXPushGlobalEffects(), and GFXSetLightContext().
vector< gfx_light >* _llights = NULL |
The lights existing in a certain context. Points to _local_lights_dat.
Definition at line 37 of file gl_light.cpp.
Referenced by gfx_light::dopickenables(), GFXCreateLight(), GFXDisableLight(), GFXEnableLight(), GFXSetLight(), GFXSetLightContext(), light_rekey_frame(), gfx_light::lightNum(), gfx_light::TrashFromGLLights(), and unpicklights().
vector< vector< gfx_light > > _local_lights_dat |
The light data _llights points to one of these.
Definition at line 35 of file gl_light.cpp.
Referenced by GFXCreateLightContext(), GFXDeleteLightContext(), and GFXSetLightContext().
GLint GFX_MAX_LIGHTS = 8 |
Definition at line 30 of file gl_light.cpp.
Referenced by findGlobalClobberable(), findLocalClobberable(), GFXPickLights(), GFXPopGlobalEffects(), GFXPushGlobalEffects(), GFXSetLightContext(), GFXSetOptimalNumLights(), GFXUploadLightState(), light_rekey_frame(), and SetupGLLightGlobals().
GLint GFX_OPTIMAL_LIGHTS = 4 |
Definition at line 31 of file gl_light.cpp.
Referenced by GFXSetOptimalNumLights().
Definition at line 32 of file gl_light.cpp.
Referenced by GFXDisable(), and GFXEnable().
OpenGLLights* GLLights = NULL |
currently stored GL lights!
Definition at line 40 of file gl_light.cpp.
Referenced by gfx_light::ClobberGLLight(), gfx_light::ContextSwitchClobberLight(), gfx_light::Disable(), gfx_light::dopickenables(), gfx_light::Enable(), findGlobalClobberable(), findLocalClobberable(), gfx_light::FinesseClobberLight(), GFXPickLights(), light_rekey_frame(), gfx_light::TrashFromGLLights(), and unpicklights().
|
static |
Definition at line 41 of file gl_light.cpp.
Referenced by GFXPopGlobalEffects(), and GFXPushGlobalEffects().
|
static |
Definition at line 43 of file gl_light.cpp.
Referenced by GFXPopGlobalEffects(), and GFXPushGlobalEffects().
|
static |
Definition at line 42 of file gl_light.cpp.
Referenced by GFXPopGlobalEffects(), and GFXPushGlobalEffects().