Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include "gl_globals.h"
#include "vs_globals.h"
#include "vegastrike.h"
#include "config_xml.h"
#include "gfxlib.h"
#include "lin_time.h"
#include <map>
#include <set>
#include <boost/algorithm/string/predicate.hpp>
Go to the source code of this file.
Macros | |
#define | NUMFRAMESLOOK 128 |
Typedefs | |
typedef std::pair< unsigned int, std::pair< std::string, std::string > > | ProgramCacheKey |
typedef std::map < ProgramCacheKey, int > | ProgramCache |
typedef std::map< int, ProgramCacheKey > | ProgramICache |
Enumerations | |
enum | GameSpeed { JUSTRIGHT, TOOSLOW, TOOFAST } |
Functions | |
static ProgramCache::key_type | cacheKey (const std::string &vp, const std::string &fp, const char *defines) |
static bool | validateLog (GLuint obj, bool shader, bool allowSoftwareEmulation=false) |
void | printLog (GLuint obj, bool shader) |
static VSFileSystem::VSError | getProgramSource (const std::string &path, std::vector< std::string > &lines, std::set< std::string > &processed_includes, char *buf, size_t buflen) |
static VSFileSystem::VSError | getProgramSource (const std::string &path, std::string &source) |
static std::string | appendDefines (const std::string &prog, const char *extra_defines) |
static int | GFXCreateProgramNoCache (const char *vprogram, const char *fprogram, const char *extra_defines) |
int | GFXCreateProgram (const char *vprogram, const char *fprogram, const char *extra_defines) |
int | GFXCreateProgram (char *vprogram, char *fprogram, char *extra_defines) |
void | GFXDestroyProgram (int program) |
int | getDefaultProgram () |
void | GFXReloadDefaultShader () |
GameSpeed | GFXGetFramerate () |
bool | GFXShaderReloaded () |
bool | GFXDefaultShaderSupported () |
int | GFXActivateShader (int program) |
int | GFXActivateShader (const char *program) |
void | GFXDeactivateShader () |
int | GFXShaderConstant (int name, float v1, float v2, float v3, float v4) |
int | GFXShaderConstant (int name, const float *values) |
int | GFXShaderConstant (int name, GFXColor v) |
int | GFXShaderConstant (int name, Vector v) |
int | GFXShaderConstant (int name, float v1) |
int | GFXShaderConstantv (int name, unsigned int count, const float *values) |
int | GFXShaderConstant4v (int name, unsigned int count, const float *values) |
int | GFXShaderConstanti (int name, int value) |
int | GFXShaderConstantv (int name, unsigned int count, const int *value) |
int | GFXNamedShaderConstant (int progID, const char *name) |
int | GFXNamedShaderConstant (char *progID, const char *name) |
int | GFXGetProgramVersion () |
Variables | |
static ProgramCache | programCache |
static ProgramICache | programICache |
static int | programChanged = false |
static int | programVersion = 0 |
static int | defaultprog = 0 |
static int | lowfiprog = 0 |
static int | hifiprog = 0 |
std::string | hifiProgramName = "default" |
std::string | lowfiProgramName = "lite" |
unsigned int | gpdcounter = (1<<30) |
GameSpeed | gameplaydata [NUMFRAMESLOOK] = {JUSTRIGHT} |
#define NUMFRAMESLOOK 128 |
Definition at line 409 of file gl_program.cpp.
Referenced by GFXGetFramerate().
typedef std::map< ProgramCacheKey, int > ProgramCache |
Definition at line 20 of file gl_program.cpp.
typedef std::pair< unsigned int , std::pair< std::string, std::string > > ProgramCacheKey |
Definition at line 19 of file gl_program.cpp.
typedef std::map< int, ProgramCacheKey > ProgramICache |
Definition at line 21 of file gl_program.cpp.
enum GameSpeed |
Enumerator | |
---|---|
JUSTRIGHT | |
TOOSLOW | |
TOOFAST |
Definition at line 401 of file gl_program.cpp.
|
static |
|
static |
Definition at line 26 of file gl_program.cpp.
Referenced by GFXCreateProgram(), and GFXNamedShaderConstant().
int getDefaultProgram | ( | ) |
Definition at line 349 of file gl_program.cpp.
References defaultprog, VegaConfig::getVariable(), GFXCreateProgram(), hifiprog, hifiProgramName, lowfiprog, lowfiProgramName, programChanged, and vs_config.
Referenced by GFXActivateShader(), and GFXDefaultShaderSupported().
|
static |
Definition at line 87 of file gl_program.cpp.
References VSFileSystem::VSFile::Close(), f, VSFileSystem::Ok, VSFileSystem::VSFile::OpenReadOnly(), VSFileSystem::VSFile::ReadLine(), VSFileSystem::UnknownFile, and VSFileSystem::vs_fprintf().
Referenced by getProgramSource(), and GFXCreateProgramNoCache().
|
static |
Definition at line 145 of file gl_program.cpp.
References getProgramSource(), and VSFileSystem::Ok.
int GFXActivateShader | ( | const char * | program) |
Definition at line 519 of file gl_program.cpp.
References getDefaultProgram(), GFXActivateShader(), and GFXCreateProgram().
Referenced by GFXActivateShader(), GFXDeactivateShader(), and GFXShaderReloaded().
int GFXCreateProgram | ( | const char * | vprogram, |
const char * | fprogram, | ||
const char * | extra_defines | ||
) |
Definition at line 302 of file gl_program.cpp.
References cacheKey(), GFXCreateProgramNoCache(), programCache, and programICache.
Referenced by Technique::Pass::compile(), getDefaultProgram(), GFXActivateShader(), GFXCreateProgram(), and GFXReloadDefaultShader().
int GFXCreateProgram | ( | char * | vprogram, |
char * | fprogram, | ||
char * | extra_defines | ||
) |
Definition at line 313 of file gl_program.cpp.
References GFXCreateProgram().
|
static |
Definition at line 186 of file gl_program.cpp.
References appendDefines(), fprintf, getProgramSource(), glAttachShader_p, glCompileShader_p, glCreateProgram_p, glCreateShader_p, glDeleteProgram_p, glDeleteShader_p, glGetProgramInfoLog_p, glGetProgramiv_p, glGetShaderiv_p, glLinkProgram_p, glShaderSource_p, VSFileSystem::Ok, printLog(), validateLog(), and vf.
Referenced by GFXCreateProgram().
void GFXDeactivateShader | ( | ) |
Definition at line 528 of file gl_program.cpp.
References GFXActivateShader().
Referenced by Mesh::ProcessUndrawnMeshes(), and Mesh::ProcessZFarMeshes().
bool GFXDefaultShaderSupported | ( | ) |
Definition at line 499 of file gl_program.cpp.
References getDefaultProgram().
Referenced by init_opengl_extensions().
void GFXDestroyProgram | ( | int | program) |
Definition at line 318 of file gl_program.cpp.
References programCache, and programICache.
Referenced by Technique::Pass::compile().
GameSpeed GFXGetFramerate | ( | ) |
Definition at line 412 of file gl_program.cpp.
References defaultprog, gameplaydata, gpdcounter, hifiprog, i, int, j, JUSTRIGHT, lasttime, NUMFRAMESLOOK, queryTime(), TOOFAST, and TOOSLOW.
Referenced by GFXShaderReloaded().
int GFXGetProgramVersion | ( | ) |
Definition at line 647 of file gl_program.cpp.
References programVersion.
Referenced by Technique::Pass::compile(), and Technique::compile().
int GFXNamedShaderConstant | ( | char * | progID, |
const char * | name | ||
) |
Definition at line 639 of file gl_program.cpp.
References cacheKey(), defaultprog, GFXNamedShaderConstant(), and programCache.
Referenced by Technique::Pass::compile(), and GFXNamedShaderConstant().
void GFXReloadDefaultShader | ( | ) |
Definition at line 373 of file gl_program.cpp.
References defaultprog, GFXCreateProgram(), glDeleteProgram_p, hifiprog, hifiProgramName, lowfiprog, lowfiProgramName, programChanged, programVersion, and VSFileSystem::vs_fprintf().
Referenced by doReloadShader().
Definition at line 546 of file gl_program.cpp.
References GFXShaderConstant().
Definition at line 551 of file gl_program.cpp.
References GFXColor::a, GFXColor::b, GFXColor::g, GFXShaderConstant(), and GFXColor::r.
Definition at line 556 of file gl_program.cpp.
References GFXShaderConstant().
Referenced by GFXShaderConstant().
Definition at line 587 of file gl_program.cpp.
References glUniform4fv_p.
Referenced by GFXUploadLightState().
Definition at line 600 of file gl_program.cpp.
References glUniform1i_p.
Referenced by GFXUploadLightState().
Definition at line 574 of file gl_program.cpp.
References glUniform1fv_p.
Referenced by GFXUploadLightState().
bool GFXShaderReloaded | ( | ) |
Definition at line 463 of file gl_program.cpp.
References defaultprog, VegaConfig::getVariable(), GFXActivateShader(), GFXGetFramerate(), hifiprog, lowfiprog, XMLSupport::parse_bool(), programChanged, TOOFAST, TOOSLOW, and vs_config.
void printLog | ( | GLuint | obj, |
bool | shader | ||
) |
Definition at line 68 of file gl_program.cpp.
References fprintf, glGetProgramInfoLog_p, and glGetShaderInfoLog_p.
Referenced by GFXCreateProgramNoCache().
Definition at line 37 of file gl_program.cpp.
References glGetProgramInfoLog_p, and glGetShaderInfoLog_p.
Referenced by GFXCreateProgramNoCache().
|
static |
Definition at line 337 of file gl_program.cpp.
Referenced by getDefaultProgram(), GFXGetFramerate(), GFXNamedShaderConstant(), GFXReloadDefaultShader(), and GFXShaderReloaded().
GameSpeed gameplaydata[NUMFRAMESLOOK] = {JUSTRIGHT} |
Definition at line 410 of file gl_program.cpp.
Referenced by GFXGetFramerate().
unsigned int gpdcounter = (1<<30) |
Definition at line 408 of file gl_program.cpp.
Referenced by GFXGetFramerate().
|
static |
Definition at line 339 of file gl_program.cpp.
Referenced by getDefaultProgram(), GFXGetFramerate(), GFXReloadDefaultShader(), and GFXShaderReloaded().
std::string hifiProgramName = "default" |
Definition at line 345 of file gl_program.cpp.
Referenced by getDefaultProgram(), and GFXReloadDefaultShader().
|
static |
Definition at line 338 of file gl_program.cpp.
Referenced by getDefaultProgram(), GFXReloadDefaultShader(), and GFXShaderReloaded().
std::string lowfiProgramName = "lite" |
Definition at line 346 of file gl_program.cpp.
Referenced by getDefaultProgram(), and GFXReloadDefaultShader().
|
static |
Definition at line 23 of file gl_program.cpp.
Referenced by GFXCreateProgram(), GFXDestroyProgram(), and GFXNamedShaderConstant().
|
static |
Definition at line 335 of file gl_program.cpp.
Referenced by getDefaultProgram(), GFXActivateShader(), GFXReloadDefaultShader(), and GFXShaderReloaded().
|
static |
Definition at line 24 of file gl_program.cpp.
Referenced by GFXCreateProgram(), and GFXDestroyProgram().
|
static |
Definition at line 336 of file gl_program.cpp.
Referenced by GFXGetProgramVersion(), and GFXReloadDefaultShader().