Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include <gl_light.h>
Public Member Functions | |
gfx_light () | |
GFXLight | operator= (const GFXLight &tmp) |
assigns a GFXLight to a gfx_light More... | |
int | lightNum () |
Returns the number this light is in the _llights list. More... | |
bool | LocalLight () const |
Returns if this light was saved as a local light. More... | |
bool | enabled () const |
Retursn if this light is enabled. More... | |
int & | Target () |
Returns the target OpenGL light of this light. -1 is unassigned to a "real" light. More... | |
bool | Create (const GFXLight &, bool global) |
void | Kill () |
Disables it (may remove from table), trashes it from GLlights. sets target to -2 (dead) More... | |
void | SendGLPosition (const GLenum target) const |
properly utilizes union to send to OGL More... | |
void | ClobberGLLight (const int target) |
replaces target GL light in the implementation. Sets this->target! Checks for -1 and calls ContextSwitch to clobber completely More... | |
void | FinesseClobberLight (const GLenum target, const int original) |
replaces target GL light, copying all state sets this->target! More... | |
void | ContextSwitchClobberLight (const GLenum target, const int original) const |
replaces target GL light, copying all state sets this->target! More... | |
void | Enable () |
void | Disable () |
void | ResetProperties (const enum LIGHT_TARGET, const GFXColor &color) |
void | AddToTable () |
Adds this light to table (assume local) More... | |
bool | RemoveFromTable (bool shouldremove=true, const GFXLight &t=GFXLight()) |
Removes this light from light table. More... | |
void | TrashFromGLLights () |
Trash this light from active GLLights. More... | |
LineCollide | CalculateBounds (bool &err) |
calculates bounds for the table given cutoffs! More... | |
![]() | |
GFXLight () | |
GFXLight (const bool enabled, const GFXColor &vect, const GFXColor &diffuse=GFXColor(0, 0, 0, 1), const GFXColor &specular=GFXColor(0, 0, 0, 1), const GFXColor &ambient=GFXColor(0, 0, 0, 1), const GFXColor &attenuate=GFXColor(1, 0, 0), const GFXColor &direction=GFXColor(0, 0, 0), float exp=0.0f, float cutoff=180.0f, float size=0.0f) | |
void | SetProperties (enum LIGHT_TARGET, const GFXColor &color) |
GFXColor | GetProperties (enum LIGHT_TARGET) const |
void | setSize (float size_) |
float | getSize () const |
Vector | getPosition () const |
void | disable () |
void | enable () |
bool | attenuated () const |
void | apply_attenuate (bool attenuated) |
Static Public Member Functions | |
static void | dopickenables () |
Do all enables from picking. More... | |
Additional Inherited Members | |
![]() | |
int | target |
physical GL light its saved in More... | |
float | vect [3] |
last is w for positional, otherwise 3 for spec More... | |
int | options |
float | diffuse [4] |
float | specular [4] |
float | ambient [4] |
float | attenuate [3] |
float | direction [3] |
float | exp |
float | cutoff |
float | size |
This stores the state of a given GL Light in its fullness It inherits all values a light may have, and gains a number of functions that assist it in maintaining the virtual OpenGL state amidst the limited Number of lights, etc
Definition at line 23 of file gl_light.h.
|
inline |
Definition at line 25 of file gl_light.h.
void gfx_light::AddToTable | ( | ) |
Adds this light to table (assume local)
Definition at line 388 of file gl_light_state.cpp.
References CalculateBounds(), LineCollideStar::lc, and Hashtable3d< T, COLLIDETABLESIZE, COLLIDETABLEACCURACY, HUGEOBJECT >::Put().
Referenced by Enable(), and ResetProperties().
LineCollide gfx_light::CalculateBounds | ( | bool & | err) |
calculates bounds for the table given cutoffs!
Definition at line 472 of file gl_light_state.cpp.
References GFXLight::ambient, GFXLight::attenuate, GFXLight::diffuse, intensity_cutoff, lightNum(), LineCollide::object, QVector, GFXLight::specular, UniverseUtil::sqrt(), LineCollide::UNIT, and GFXLight::vect.
Referenced by AddToTable(), and RemoveFromTable().
void gfx_light::ClobberGLLight | ( | const int | target) |
replaces target GL light in the implementation. Sets this->target! Checks for -1 and calls ContextSwitch to clobber completely
Definition at line 280 of file gl_light_state.cpp.
References ContextSwitchClobberLight(), enabled(), FinesseClobberLight(), OpenGLL::GL_ENABLED, OpenGLL::GLL_LOCAL, OpenGLL::GLL_ON, GLLights, OpenGLLights::index, index, lightNum(), LocalLight(), OpenGLLights::options, GFXLight::options, and GFXLight::target.
Referenced by Create(), and Enable().
|
inline |
replaces target GL light, copying all state sets this->target!
Definition at line 231 of file gl_light_state.cpp.
References GFXLight::ambient, atten0scale, atten1scale, atten2scale, GFXLight::attenuate, GFXLight::diffuse, GLLights, OpenGLLights::index, SendGLPosition(), GFXLight::specular, and GFXLight::target.
Referenced by ClobberGLLight(), and GFXUploadLightState().
if global, puts it into GLlights (if space ||enabled) <clobber?> for local lights, if enabled, call Enable().
Definition at line 190 of file gl_light_state.cpp.
References _GLLightsEnabled, ClobberGLLight(), GFXLight::disable(), Enable(), enabled(), findGlobalClobberable(), findLocalClobberable(), GFX_LOCAL_LIGHT, and GFXLight::options.
void gfx_light::Disable | ( | ) |
for global lights, GLdisables it. for local lights, removes it from the table. and trashes it form GLlights.
Definition at line 449 of file gl_light_state.cpp.
References _GLLightsEnabled, GFXLight::disable(), enabled(), OpenGLL::GL_ENABLED, OpenGLL::GLL_ON, GLLights, LocalLight(), OpenGLLights::options, GFXLight::options, RemoveFromTable(), GFXLight::target, and TrashFromGLLights().
Referenced by Kill().
|
static |
Do all enables from picking.
Definition at line 187 of file gl_light_pick.cpp.
References _llights, findLocalClobberable(), OpenGLL::GL_ENABLED, OpenGLL::GLL_LOCAL, GLLights, OpenGLLights::index, newpicked, oldpicked, OpenGLLights::options, GFXLight::options, and VSFileSystem::vs_fprintf().
Referenced by GFXPickLights().
void gfx_light::Enable | ( | ) |
for global lights, clobbers SOMETHING for sure, calls GLenable for local lights, puts it into the light table
Definition at line 428 of file gl_light_state.cpp.
References _GLLightsEnabled, AddToTable(), ClobberGLLight(), GFXLight::enable(), enabled(), findGlobalClobberable(), OpenGLL::GL_ENABLED, OpenGLL::GLL_ON, GLLights, LocalLight(), OpenGLLights::options, and GFXLight::target.
Referenced by Create().
|
inline |
Retursn if this light is enabled.
Definition at line 36 of file gl_light.h.
References GFX_LIGHT_ENABLED, and GFXLight::options.
Referenced by ClobberGLLight(), Create(), Disable(), Enable(), and GFXUploadLightState().
|
inline |
replaces target GL light, copying all state sets this->target!
Definition at line 248 of file gl_light_state.cpp.
References GFXLight::ambient, atten0scale, atten1scale, atten2scale, GFXLight::attenuate, GFXLight::attenuated(), GFXLight::diffuse, GLLights, OpenGLLights::index, SendGLPosition(), GFXLight::specular, GFXLight::target, and GFXLight::vect.
Referenced by ClobberGLLight().
void gfx_light::Kill | ( | ) |
Disables it (may remove from table), trashes it from GLlights. sets target to -2 (dead)
Definition at line 211 of file gl_light_state.cpp.
References Disable(), GFXLight::options, GFXLight::target, and TrashFromGLLights().
int gfx_light::lightNum | ( | ) |
Returns the number this light is in the _llights list.
Definition at line 153 of file gl_light_state.cpp.
References _llights.
Referenced by CalculateBounds(), and ClobberGLLight().
|
inline |
Returns if this light was saved as a local light.
Definition at line 31 of file gl_light.h.
References GFX_LOCAL_LIGHT, and GFXLight::options.
Referenced by ClobberGLLight(), Disable(), Enable(), and ResetProperties().
assigns a GFXLight to a gfx_light
Definition at line 147 of file gl_light_state.cpp.
References VsnetOSS::memcpy().
Removes this light from light table.
Definition at line 399 of file gl_light_state.cpp.
References CalculateBounds(), Hashtable3d< T, COLLIDETABLESIZE, COLLIDETABLEACCURACY, HUGEOBJECT >::hash_int(), LineCollideStar::lc, LineCollide::Maxi, LineCollide::Mini, and Hashtable3d< T, COLLIDETABLESIZE, COLLIDETABLEACCURACY, HUGEOBJECT >::Remove().
Referenced by Disable(), and ResetProperties().
void gfx_light::ResetProperties | ( | const enum LIGHT_TARGET | light_targ, |
const GFXColor & | color | ||
) |
sets properties, making minimum GL state changes for global, for local lights, removes it from table, trashes it from GLlights, if enabled, puts it bakc in table.
Definition at line 309 of file gl_light_state.cpp.
References GFXColor::a, AddToTable(), AMBIENT, GFXLight::ambient, GFXLight::apply_attenuate(), atten0scale, atten1scale, atten2scale, ATTENUATE, GFXLight::attenuate, GFXLight::attenuated(), GFXColor::b, changed, DIFFUSE, GFXLight::diffuse, GFXColor::g, LocalLight(), VsnetOSS::memcpy(), POSITION, GFXColor::r, RemoveFromTable(), SendGLPosition(), GFXLight::SetProperties(), SPECULAR, GFXLight::specular, GFXLight::target, TrashFromGLLights(), and GFXLight::vect.
void gfx_light::SendGLPosition | ( | const GLenum | target) | const |
properly utilizes union to send to OGL
ClobberGLLight **** most OpenGL implementation dirty lighting if any info is changed at all having two different lights with the same stats and pos is unlikely at best
Definition at line 225 of file gl_light_state.cpp.
References v, and GFXLight::vect.
Referenced by ContextSwitchClobberLight(), FinesseClobberLight(), and ResetProperties().
|
inline |
Returns the target OpenGL light of this light. -1 is unassigned to a "real" light.
Definition at line 41 of file gl_light.h.
References GFXLight::target.
void gfx_light::TrashFromGLLights | ( | ) |
Trash this light from active GLLights.
Definition at line 377 of file gl_light_state.cpp.
References _llights, OpenGLL::GLL_LOCAL, OpenGLL::GLL_ON, GLLights, OpenGLLights::index, index, OpenGLLights::options, GFXLight::options, removelightfromnewpick(), and GFXLight::target.
Referenced by Disable(), Kill(), and ResetProperties().