*** empty log message ***

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1228 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2007-08-12 09:14:43 +00:00
parent 2089b76a9f
commit d70d8e5238
6 changed files with 23 additions and 39 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ extern Texture *crosshair;
extern void createtexture(int tnum, int w, int h, void *pixels, int clamp, bool mipmap, GLenum format);
extern Texture *textureload(const char *name, int clamp = 0);
extern int lookuptexture(int tex, int &xs, int &ys);
extern Texture *lookuptexture(int tex);
extern void draw_envbox(int fogdist);
extern int maxtmus;
+17 -24
View File
@@ -45,8 +45,7 @@ int renderedtexs = 0;
void renderstripssky()
{
if(skystrips.tris.first.empty() && skystrips.tristrips.first.empty() && skystrips.quads.first.empty()) return;
int xs, ys;
glBindTexture(GL_TEXTURE_2D, lookuptexture(DEFAULT_SKY, xs, ys));
glBindTexture(GL_TEXTURE_2D, lookuptexture(DEFAULT_SKY)->id);
RENDERSTRIPS(skystrips.tris, GL_TRIANGLES);
RENDERSTRIPS(skystrips.tristrips, GL_TRIANGLE_STRIP);
RENDERSTRIPS(skystrips.quads, GL_QUADS);
@@ -54,11 +53,10 @@ void renderstripssky()
void renderstrips()
{
int xs, ys;
loopj(renderedtexs)
{
stripbatch &sb = stripbatches[j];
glBindTexture(GL_TEXTURE_2D, lookuptexture(sb.tex, xs, ys));
glBindTexture(GL_TEXTURE_2D, lookuptexture(sb.tex)->id);
RENDERSTRIPS(sb.tris, GL_TRIANGLES);
RENDERSTRIPS(sb.tristrips, GL_TRIANGLE_STRIP);
RENDERSTRIPS(sb.quads, GL_QUADS);
@@ -143,10 +141,9 @@ void render_flat(int wtex, int x, int y, int size, int h, sqr *l1, sqr *l2, sqr
{
if(showm) { l3 = l1 = &sbright; l4 = l2 = &sdark; }
int sx, sy;
lookuptexture(wtex, sx, sy);
float xf = TEXTURESCALE/sx;
float yf = TEXTURESCALE/sy;
Texture *t = lookuptexture(wtex);
float xf = TEXTURESCALE/t->xs;
float yf = TEXTURESCALE/t->ys;
float xs = size*xf;
float ys = size*yf;
float xo = xf*x;
@@ -221,10 +218,9 @@ void render_flatdelta(int wtex, int x, int y, int size, float h1, float h2, floa
{
if(showm) { l3 = l1 = &sbright; l4 = l2 = &sdark; }
int sx, sy;
lookuptexture(wtex, sx, sy);
float xf = TEXTURESCALE/sx;
float yf = TEXTURESCALE/sy;
Texture *t = lookuptexture(wtex);
float xf = TEXTURESCALE/t->xs;
float yf = TEXTURESCALE/t->ys;
float xs = size*xf;
float ys = size*yf;
float xo = xf*x;
@@ -276,19 +272,17 @@ void render_2tris(sqr *h, sqr *s, int x1, int y1, int x2, int y2, int x3, int y3
{
stripend();
int sx, sy;
lookuptexture(h->ftex, sx, sy);
float xf = TEXTURESCALE/sx;
float yf = TEXTURESCALE/sy;
Texture *t = lookuptexture(h->ftex);
float xf = TEXTURESCALE/t->xs;
float yf = TEXTURESCALE/t->ys;
vert(x1, y1, h->floor, l1, xf*x1, yf*y1);
vert(x2, y2, h->floor, l2, xf*x2, yf*y2);
vert(x3, y3, h->floor, l3, xf*x3, yf*y3);
addstrip(mergestrips ? GL_TRIANGLES : GL_TRIANGLE_STRIP, h->ftex, verts.length()-3, 3);
lookuptexture(h->ctex, sx, sy);
xf = TEXTURESCALE/sx;
yf = TEXTURESCALE/sy;
t = lookuptexture(h->ctex);
xf = TEXTURESCALE/t->xs;
yf = TEXTURESCALE/t->ys;
vert(x3, y3, h->ceil, l3, xf*x3, yf*y3);
vert(x2, y2, h->ceil, l2, xf*x2, yf*y2);
@@ -317,10 +311,9 @@ void render_square(int wtex, float floor1, float floor2, float ceil1, float ceil
stripend();
if(showm) { l1 = &sbright; l2 = &sdark; }
int sx, sy;
lookuptexture(wtex, sx, sy);
float xf = TEXTURESCALE/sx;
float yf = TEXTURESCALE/sy;
Texture *t = lookuptexture(wtex);
float xf = TEXTURESCALE/t->xs;
float yf = TEXTURESCALE/t->ys;
float xs = size*xf;
float xo = xf*(x1==x2 ? min(y1,y2) : min(x1,x2));
+1 -2
View File
@@ -318,13 +318,12 @@ void preload_entmodels()
void preload_mapmodels()
{
int xs, ys;
loopv(ents)
{
entity &e = ents[i];
if(e.type!=MAPMODEL || !mapmodels.inrange(e.attr2)) continue;
if(!loadmodel(NULL, e.attr2)) continue;
if(e.attr4) lookuptexture(e.attr4, xs, ys);
if(e.attr4) lookuptexture(e.attr4);
}
}
+2 -5
View File
@@ -121,7 +121,7 @@ void texture(char *aframe, char *name)
COMMAND(texturereset, ARG_NONE);
COMMAND(texture, ARG_2STR);
int lookuptexture(int tex, int &xs, int &ys)
Texture *lookuptexture(int tex)
{
Texture *t = crosshair;
if(slots.inrange(tex))
@@ -135,10 +135,7 @@ int lookuptexture(int tex, int &xs, int &ys)
}
if(s.tex) t = s.tex;
}
xs = t->xs;
ys = t->ys;
return t->id;
return t;
}
Texture *sky[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
+1 -5
View File
@@ -128,11 +128,7 @@ struct vertmodel : model
if(!(as.anim&ANIM_NOSKIN))
{
GLuint id = tex < 0 ? -tex : skin->id;
if(tex > 0)
{
int xs, ys;
id = lookuptexture(tex, xs, ys);
}
if(tex > 0) id = lookuptexture(tex)->id;
if(id!=lasttex)
{
glBindTexture(GL_TEXTURE_2D, id);
+1 -2
View File
@@ -357,9 +357,8 @@ void load_world(char *mname) // still supports all map formats that have
execfile("config/default_map_settings.cfg");
execfile(pcfname);
execfile(mcfname);
int xs, ys;
c2skeepalive();
loopi(256) if(texuse[i]) lookuptexture(i, xs, ys);
loopi(256) if(texuse[i]) lookuptexture(i);
c2skeepalive();
preload_mapmodels();
c2skeepalive();