Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include "gldrv/sdds.h"
#include "gl_globals.h"
#include "vs_globals.h"
#include "vegastrike.h"
#include "config_xml.h"
#include "gfxlib.h"
Go to the source code of this file.
Classes | |
struct | GLTexture |
Macros | |
#define | GL_EXT_texture_env_combine 1 |
#define | GL_TEXTURE_CUBE_MAP_EXT 0x8513 |
#define | GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 |
#define | GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 |
#define | GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 |
#define | GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 |
#define | GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 |
#define | GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A |
#define | GL_CLAMP_TO_EDGE_EXT 0x812F |
#define | GL_CLAMP_TO_BORDER_ARB 0x812D |
Functions | |
GLenum | GetGLTextureTarget (enum TEXTURE_TARGET texture_target) |
GLenum | GetUncompressedTextureFormat (TEXTUREFORMAT textureformat) |
static void | ConvertPalette (unsigned char *dest, unsigned char *src) |
int | tmp_abs (int num) |
bool | isPowerOfTwo (int num, int &which) |
GFXBOOL | GFXCreateTexture (int width, int height, TEXTUREFORMAT textureformat, int *handle, char *palette, int texturestage, enum FILTER mipmap, enum TEXTURE_TARGET texture_target, enum ADDRESSMODE address_mode) |
void | GFXPrioritizeTexture (unsigned int handle, float priority) |
Sets the priority of the texture for memory management. More... | |
void | GFXAttachPalette (unsigned char *palette, int handle) |
Attaches a given palette to the current texture. More... | |
static void | DownSampleTexture (unsigned char **newbuf, const unsigned char *oldbuf, int &height, int &width, int pixsize, int handle, int maxheight, int maxwidth, float newfade) |
static GLenum | RGBCompressed (GLenum internalformat) |
static GLenum | RGBACompressed (GLenum internalformat) |
GLenum | GetTextureFormat (TEXTUREFORMAT textureformat) |
GLenum | GetImageTarget (TEXTURE_IMAGE_TARGET imagetarget) |
const char * | GetImageTargetName (TEXTURE_IMAGE_TARGET imagetarget) |
GFXBOOL | GFXTransferSubTexture (unsigned char *buffer, int handle, int x, int y, unsigned int width, unsigned int height, enum TEXTURE_IMAGE_TARGET imagetarget) |
GFXBOOL | GFXTransferTexture (unsigned char *buffer, int handle, int inWidth, int inHeight, TEXTUREFORMAT internformat, enum TEXTURE_IMAGE_TARGET imagetarget, int maxdimension, GFXBOOL detail_texture, unsigned int pageIndex) |
void | GFXDeleteTexture (int handle) |
Deletes the texture from the graphics card. More... | |
void | GFXInitTextureManager () |
void | GFXDestroyAllTextures () |
Cleans up all textures. More... | |
void | GFXTextureCoordGenMode (int stage, GFXTEXTURECOORDMODE tex, const float params[4], const float paramt[4]) |
void | GFXSelectTexture (int handle, int stage) |
Selects the current texture as being "active" so further drawn objects will have it. More... | |
void | GFXTextureEnv (int stage, GFXTEXTUREENVMODES mode, float arg2) |
void | GFXTextureWrap (int stage, GFXTEXTUREWRAPMODES mode, enum TEXTURE_TARGET target) |
Variables | |
static GLint | MAX_TEXTURE_SIZE = 256 |
static vector< GLTexture > | textures |
static int | activetexture [32] |
#define GL_CLAMP_TO_BORDER_ARB 0x812D |
Definition at line 1235 of file gl_texture.cpp.
Referenced by GFXTextureWrap().
#define GL_CLAMP_TO_EDGE_EXT 0x812F |
Definition at line 1232 of file gl_texture.cpp.
Referenced by GFXTextureWrap().
#define GL_EXT_texture_env_combine 1 |
Definition at line 21 of file gl_texture.cpp.
#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 |
Definition at line 30 of file gl_texture.cpp.
Referenced by GetGLTextureTarget(), GFXCreateTexture(), GFXDisable(), and GFXEnable().
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 |
Definition at line 32 of file gl_texture.cpp.
Referenced by GetImageTarget().
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 |
Definition at line 34 of file gl_texture.cpp.
Referenced by GetImageTarget().
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A |
Definition at line 36 of file gl_texture.cpp.
Referenced by GetImageTarget().
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 |
Definition at line 31 of file gl_texture.cpp.
Referenced by GetImageTarget().
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 |
Definition at line 33 of file gl_texture.cpp.
Referenced by GetImageTarget().
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 |
Definition at line 35 of file gl_texture.cpp.
Referenced by GetImageTarget().
|
static |
Definition at line 98 of file gl_texture.cpp.
References a, and VsnetOSS::memcpy().
Referenced by GFXAttachPalette(), and GFXCreateTexture().
|
static |
Definition at line 416 of file gl_texture.cpp.
References height, i, int, j, k, MAX_TEXTURE_SIZE, and width.
Referenced by GFXTransferTexture().
GLenum GetGLTextureTarget | ( | enum TEXTURE_TARGET | texture_target) |
Definition at line 50 of file gl_state.cpp.
References CUBEMAP, GL_TEXTURE_CUBE_MAP_EXT, GL_TEXTURE_RECTANGLE_ARB, TEXTURE1D, TEXTURE2D, TEXTURE3D, and TEXTURERECT.
Referenced by GFXTextureAddressMode(), GFXTextureWrap(), and GFXToggleTexture().
GLenum GetImageTarget | ( | TEXTURE_IMAGE_TARGET | imagetarget) |
Definition at line 608 of file gl_texture.cpp.
References CUBEMAP_NEGATIVE_X, CUBEMAP_NEGATIVE_Y, CUBEMAP_NEGATIVE_Z, CUBEMAP_POSITIVE_X, CUBEMAP_POSITIVE_Y, CUBEMAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT, GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT, GL_TEXTURE_RECTANGLE_ARB, TEXTURE_2D, and TEXTURE_RECTANGLE.
Referenced by GFXTransferSubTexture(), and GFXTransferTexture().
const char* GetImageTargetName | ( | TEXTURE_IMAGE_TARGET | imagetarget) |
Definition at line 644 of file gl_texture.cpp.
References CUBEMAP_NEGATIVE_X, CUBEMAP_NEGATIVE_Y, CUBEMAP_NEGATIVE_Z, CUBEMAP_POSITIVE_X, CUBEMAP_POSITIVE_Y, CUBEMAP_POSITIVE_Z, TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, and TEXTURE_RECTANGLE.
Referenced by GFXTransferTexture().
GLenum GetTextureFormat | ( | TEXTUREFORMAT | textureformat) |
Definition at line 571 of file gl_texture.cpp.
References DUMMY, DXT1, DXT1RGBA, DXT3, DXT5, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, PNGRGB24, PNGRGBA32, RGB16, RGB24, RGB32, RGBA16, RGBA32, RGBACompressed(), and RGBCompressed().
Referenced by GFXTransferTexture().
GLenum GetUncompressedTextureFormat | ( | TEXTUREFORMAT | textureformat) |
void GFXAttachPalette | ( | unsigned char * | palette, |
int | handle | ||
) |
Attaches a given palette to the current texture.
Definition at line 410 of file gl_texture.cpp.
References ConvertPalette(), and textures.
GFXBOOL GFXCreateTexture | ( | int | width, |
int | height, | ||
TEXTUREFORMAT | externaltextureformat, | ||
int * | handle, | ||
char * | palette = 0 , |
||
int | texturestage = 0 , |
||
enum FILTER | mipmap = MIPMAP , |
||
enum TEXTURE_TARGET | texture_target = TEXTURE2D , |
||
enum ADDRESSMODE | address_mode = DEFAULT_ADDRESS_MODE |
||
) |
Creates a texture with given w,h & tex format. Returns handle in handle var The palette may be specified but defaults to NULL. Texture Stage indicates Which texture unit the texture must reside on. The filter indicates If linear, bilinear, mipmapping or trilinear filterring should be used. Filtering is clamped to g_game.mipmap so hardware isn't abused (3dfx had trilinear troubles, and it might be a memory constraint) Texture target defines the type of texture it is for eventual cube mapping
Definition at line 312 of file gl_texture.cpp.
References activetexture, ConvertPalette(), CUBEMAP, GetUncompressedTextureFormat(), GFXActiveTexture(), GFXTextureAddressMode(), GFXTRUE, gl_options, GL_TEXTURE_CUBE_MAP_EXT, GL_TEXTURE_RECTANGLE_ARB, height, isPowerOfTwo(), gl_options_t::mipmap, MIPMAP, NEAREST, PALETTE8, TEXTURE1D, TEXTURE2D, TEXTURE3D, TEXTURERECT, textures, TRILINEAR, VSFileSystem::vs_dprintf(), and width.
Referenced by Texture::Bind(), PipelinedTexture::Clone(), PipelinedTexture::PipelinedTexture(), StreamTexture::StreamTexture(), and PipelinedTexture::Swap().
void GFXDeleteTexture | ( | int | handle) |
Deletes the texture from the graphics card.
Definition at line 1039 of file gl_texture.cpp.
References activetexture, GFXFALSE, i, and textures.
Referenced by GFXDestroyAllTextures(), Texture::UnBind(), PipelinedTexture::~PipelinedTexture(), and StreamTexture::~StreamTexture().
void GFXDestroyAllTextures | ( | ) |
Cleans up all textures.
Definition at line 1069 of file gl_texture.cpp.
References GFXDeleteTexture(), and textures.
Referenced by GFXShutdown().
void GFXInitTextureManager | ( | ) |
Sets the priority of the texture for memory management.
Definition at line 401 of file gl_texture.cpp.
Referenced by Texture::Prioritize().
Selects the current texture as being "active" so further drawn objects will have it.
Definition at line 1126 of file gl_texture.cpp.
References activetexture, GFXActiveTexture(), gl_options, gl_options_t::Multitexture, and textures.
Referenced by StreamTexture::MakeActive(), PipelinedTexture::MakeActive(), Texture::MakeActive(), PipelinedTexture::MakeBothActive(), and PipelinedTexture::MakeLastActive().
void GFXTextureCoordGenMode | ( | int | stage, |
GFXTEXTURECOORDMODE | tex, | ||
const float | params[4], | ||
const float | paramt[4] | ||
) |
Definition at line 1075 of file gl_texture.cpp.
References CUBE_MAP_GEN, EYE_LINEAR_GEN, GFXActiveTexture(), gl_options, gl_options_t::Multitexture, NO_GEN, OBJECT_LINEAR_GEN, and SPHERE_MAP_GEN.
Referenced by GameStarSystem::activateLightMap(), Background::Draw(), VSSprite::Draw(), Animation::DrawAsVSSprite(), Animation::DrawNoTransform(), Animation::DrawNow(), GFXInit(), RestoreEnvmapState(), RestoreSpecMapState(), and SetupSpecMapFirstPass().
void GFXTextureEnv | ( | int | stage, |
GFXTEXTUREENVMODES | mode, | ||
float | arg2 | ||
) |
Definition at line 1137 of file gl_texture.cpp.
References GFXActiveTexture(), GFXADDSIGNEDTEXTURE, GFXADDTEXTURE, GFXCOMPOSITETEXTURE, GFXDETAILTEXTURE, GFXINTERPOLATETEXTURE, GFXMODULATETEXTURE, GFXREPLACETEXTURE, gl_options, and gl_options_t::Multitexture.
Referenced by GameStarSystem::activateLightMap(), AnimationDraw(), Background::Draw(), VSSprite::Draw(), Animation::DrawAsVSSprite(), Animation::DrawNoTransform(), Animation::DrawNow(), Mesh::DrawNow(), GFXInit(), AnimatedTexture::MakeActive(), Beam::ProcessDrawQueue(), RestoreEnvmapState(), RestoreSpecMapState(), SetupEnvmapPass(), AnimatedTexture::SetupPass(), SetupSpecMapFirstPass(), and SetupSpecMapSecondPass().
void GFXTextureWrap | ( | int | stage, |
GFXTEXTUREWRAPMODES | mode, | ||
enum TEXTURE_TARGET | target | ||
) |
Definition at line 1238 of file gl_texture.cpp.
References GetGLTextureTarget(), GFXActiveTexture(), GFXBORDERTEXTURE, GFXCLAMPTEXTURE, GFXREPEATTEXTURE, GL_CLAMP_TO_BORDER_ARB, GL_CLAMP_TO_EDGE_EXT, gl_options, gl_options_t::Multitexture, TEXTURE1D, and TEXTURE3D.
GFXBOOL GFXTransferSubTexture | ( | unsigned char * | buffer, |
int | handle, | ||
int | x, | ||
int | y, | ||
unsigned int | width, | ||
unsigned int | height, | ||
enum TEXTURE_IMAGE_TARGET | imagetarget | ||
) |
Definition at line 683 of file gl_texture.cpp.
References GetImageTarget(), GFXTRUE, and textures.
Referenced by PipelinedTexture::endMutate().
GFXBOOL GFXTransferTexture | ( | unsigned char * | buffer, |
int | handle, | ||
int | inWidth, | ||
int | inHeight, | ||
enum TEXTUREFORMAT | internalformat, | ||
enum TEXTURE_IMAGE_TARGET | image2D = TEXTURE_2D , |
||
int | max_texture_dimension = 65536 , |
||
GFXBOOL | detailtexture = GFXFALSE , |
||
unsigned int | pageIndex = 0 |
||
) |
Transfers texture to the graphics card with given buffer in previously specified format. Scales texture approrpiately to Max texture sizes gotten from vid card
Definition at line 700 of file gl_texture.cpp.
References gl_options_t::compression, ddsDecompress(), DownSampleTexture(), DXT1, DXT1RGBA, DXT3, DXT5, GetImageTarget(), GetImageTargetName(), GetTextureFormat(), VegaConfig::getVariable(), GFXFALSE, GFXTransferTexture(), GFXTRUE, gl_options, glColorTable_p, glCompressedTexImage2D_p, i, isPowerOfTwo(), j, gl_options_t::max_texture_dimension, MAX_TEXTURE_SIZE, gl_options_t::mipmap, MIPMAP, PALETTE8, gl_options_t::PaletteExt, XMLSupport::parse_bool(), XMLSupport::parse_int(), PNGPALETTE8, PNGRGB24, PNGRGBA32, RGB16, RGB24, RGB32, RGBA16, RGBA32, gl_options_t::s3tc, size, textures, TRILINEAR, vs_config, and VSFileSystem::vs_dprintf().
Referenced by PipelinedTexture::Clone(), GFXTransferTexture(), PipelinedTexture::PipelinedTexture(), StreamTexture::StreamTexture(), Texture::Transfer(), and StreamTexture::UnMap().
Definition at line 111 of file gl_texture.cpp.
References tmp_abs().
Referenced by GFXCreateTexture(), and GFXTransferTexture().
|
static |
Definition at line 549 of file gl_texture.cpp.
References gl_options_t::compression, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, gl_options, and gl_options_t::s3tc.
Referenced by GetTextureFormat().
|
static |
Definition at line 539 of file gl_texture.cpp.
References gl_options_t::compression, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, gl_options, and gl_options_t::s3tc.
Referenced by GetTextureFormat().
Definition at line 106 of file gl_texture.cpp.
Referenced by isPowerOfTwo().
|
static |
Definition at line 91 of file gl_texture.cpp.
Referenced by GFXCreateTexture(), GFXDeleteTexture(), and GFXSelectTexture().
|
static |
Definition at line 40 of file gl_texture.cpp.
Referenced by DownSampleTexture(), GFXInitTextureManager(), and GFXTransferTexture().
|
static |
Definition at line 90 of file gl_texture.cpp.
Referenced by GFXAttachPalette(), GFXCreateTexture(), GFXDeleteTexture(), GFXDestroyAllTextures(), GFXInitTextureManager(), GFXSelectTexture(), GFXTransferSubTexture(), and GFXTransferTexture().