mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
In a material world...
git-svn-id: https://svn.eduke32.com/eduke32@1153 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
08923413f2
commit
bd98e3676b
2 changed files with 81 additions and 56 deletions
|
@ -42,16 +42,21 @@ extern int pr_gpusmoothing;
|
||||||
|
|
||||||
extern int glerror;
|
extern int glerror;
|
||||||
|
|
||||||
// DATA
|
// MATERIAL
|
||||||
|
typedef struct s_prmaterial {
|
||||||
|
GLuint diffusemap;
|
||||||
|
GLfloat diffusemodulation[4];
|
||||||
|
GLuint glowmap;
|
||||||
|
} _prmaterial;
|
||||||
|
|
||||||
|
// BUILD DATA
|
||||||
typedef struct s_prplane {
|
typedef struct s_prplane {
|
||||||
// geometry
|
// geometry
|
||||||
GLfloat* buffer;
|
GLfloat* buffer;
|
||||||
GLuint vbo;
|
GLuint vbo;
|
||||||
// attributes
|
// attributes
|
||||||
GLdouble plane[4];
|
GLdouble plane[4];
|
||||||
GLfloat color[4];
|
_prmaterial material;
|
||||||
GLuint glpic;
|
|
||||||
GLuint fbglpic;
|
|
||||||
// elements
|
// elements
|
||||||
GLushort* indices;
|
GLushort* indices;
|
||||||
GLuint ivbo;
|
GLuint ivbo;
|
||||||
|
@ -108,6 +113,7 @@ typedef struct s_pranimatespritesinfo {
|
||||||
int x, y, a, smoothratio;
|
int x, y, a, smoothratio;
|
||||||
} _pranimatespritesinfo;
|
} _pranimatespritesinfo;
|
||||||
|
|
||||||
|
// LIGHTS
|
||||||
#define PR_MAXLIGHTS 128
|
#define PR_MAXLIGHTS 128
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -122,6 +128,7 @@ typedef struct s_prlight {
|
||||||
prlighttype type;
|
prlighttype type;
|
||||||
} _prlight;
|
} _prlight;
|
||||||
|
|
||||||
|
// PROGRAMS
|
||||||
#define PR_INFO_LOG_BUFFER_SIZE 512
|
#define PR_INFO_LOG_BUFFER_SIZE 512
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -21,7 +21,7 @@ GLenum modelvbousage = GL_STATIC_DRAW_ARB;
|
||||||
|
|
||||||
GLuint modelvp;
|
GLuint modelvp;
|
||||||
|
|
||||||
// DATA
|
// BUILD DATA
|
||||||
_prsector *prsectors[MAXSECTORS];
|
_prsector *prsectors[MAXSECTORS];
|
||||||
_prwall *prwalls[MAXWALLS];
|
_prwall *prwalls[MAXWALLS];
|
||||||
|
|
||||||
|
@ -118,9 +118,11 @@ GLuint skyboxdatavbo;
|
||||||
|
|
||||||
GLfloat artskydata[16];
|
GLfloat artskydata[16];
|
||||||
|
|
||||||
|
// LIGHTS
|
||||||
_prlight prlights[PR_MAXLIGHTS];
|
_prlight prlights[PR_MAXLIGHTS];
|
||||||
int lightcount;
|
int lightcount;
|
||||||
|
|
||||||
|
// PROGRAMS
|
||||||
_prprogrambit prprogrambits[PR_BIT_COUNT] = {
|
_prprogrambit prprogrambits[PR_BIT_COUNT] = {
|
||||||
{
|
{
|
||||||
.bit = 1 << PR_BIT_DEFAULT,
|
.bit = 1 << PR_BIT_DEFAULT,
|
||||||
|
@ -494,27 +496,29 @@ void polymer_drawsprite(int snum)
|
||||||
|
|
||||||
pth = gltexcache(curpicnum, tspr->pal, 0);
|
pth = gltexcache(curpicnum, tspr->pal, 0);
|
||||||
|
|
||||||
spriteplane.color[0] = spriteplane.color[1] = spriteplane.color[2] =
|
spriteplane.material.diffusemodulation[0] =
|
||||||
((float)(numpalookups-min(max(tspr->shade*shadescale,0),numpalookups)))/((float)numpalookups);
|
spriteplane.material.diffusemodulation[1] =
|
||||||
|
spriteplane.material.diffusemodulation[2] =
|
||||||
|
((float)(numpalookups-min(max(tspr->shade*shadescale,0),numpalookups)))/((float)numpalookups);
|
||||||
|
|
||||||
if (pth && (pth->flags & 2) && (pth->palnum != tspr->pal))
|
if (pth && (pth->flags & 2) && (pth->palnum != tspr->pal))
|
||||||
{
|
{
|
||||||
spriteplane.color[0] *= (float)hictinting[tspr->pal].r / 255.0;
|
spriteplane.material.diffusemodulation[0] *= (float)hictinting[tspr->pal].r / 255.0;
|
||||||
spriteplane.color[1] *= (float)hictinting[tspr->pal].g / 255.0;
|
spriteplane.material.diffusemodulation[1] *= (float)hictinting[tspr->pal].g / 255.0;
|
||||||
spriteplane.color[2] *= (float)hictinting[tspr->pal].b / 255.0;
|
spriteplane.material.diffusemodulation[2] *= (float)hictinting[tspr->pal].b / 255.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tspr->cstat & 2)
|
if (tspr->cstat & 2)
|
||||||
{
|
{
|
||||||
if (tspr->cstat & 512)
|
if (tspr->cstat & 512)
|
||||||
spriteplane.color[3] = 0.33f;
|
spriteplane.material.diffusemodulation[3] = 0.33f;
|
||||||
else
|
else
|
||||||
spriteplane.color[3] = 0.66f;
|
spriteplane.material.diffusemodulation[3] = 0.66f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
spriteplane.color[3] = 1.0f;
|
spriteplane.material.diffusemodulation[3] = 1.0f;
|
||||||
|
|
||||||
spriteplane.glpic = (pth) ? pth->glpic : 0;
|
spriteplane.material.diffusemap = (pth) ? pth->glpic : 0;
|
||||||
|
|
||||||
if (((tspr->cstat>>4) & 3) == 0)
|
if (((tspr->cstat>>4) & 3) == 0)
|
||||||
xratio = (float)(tspr->xrepeat) * 32.0f / 160.0f;
|
xratio = (float)(tspr->xrepeat) * 32.0f / 160.0f;
|
||||||
|
@ -998,12 +1002,18 @@ static void polymer_drawplane(short sectnum, short wallnum, _prplane* pl
|
||||||
bglMatrixMode(GL_MODELVIEW);
|
bglMatrixMode(GL_MODELVIEW);
|
||||||
bglPopMatrix();
|
bglPopMatrix();
|
||||||
|
|
||||||
bglColor4f(plane->color[0], plane->color[1], plane->color[2], 0.0f);
|
bglColor4f(plane->material.diffusemodulation[0],
|
||||||
|
plane->material.diffusemodulation[1],
|
||||||
|
plane->material.diffusemodulation[2],
|
||||||
|
0.0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
bglColor4f(plane->color[0], plane->color[1], plane->color[2], plane->color[3]);
|
bglColor4f(plane->material.diffusemodulation[0],
|
||||||
|
plane->material.diffusemodulation[1],
|
||||||
|
plane->material.diffusemodulation[2],
|
||||||
|
plane->material.diffusemodulation[3]);
|
||||||
|
|
||||||
bglBindTexture(GL_TEXTURE_2D, plane->glpic);
|
bglBindTexture(GL_TEXTURE_2D, plane->material.diffusemap);
|
||||||
if (plane->vbo && (pr_vbos > 0))
|
if (plane->vbo && (pr_vbos > 0))
|
||||||
{
|
{
|
||||||
OMGDRAWSHITVBO;
|
OMGDRAWSHITVBO;
|
||||||
|
@ -1303,23 +1313,23 @@ attributes:
|
||||||
{
|
{
|
||||||
//attributes
|
//attributes
|
||||||
j = 2;
|
j = 2;
|
||||||
curbuffer = s->floor.color;
|
curbuffer = s->floor.material.diffusemodulation;
|
||||||
curstat = sec->floorshade;
|
curstat = sec->floorshade;
|
||||||
curxpanning = sec->floorpal;
|
curxpanning = sec->floorpal;
|
||||||
curpicnum = floorpicnum;
|
curpicnum = floorpicnum;
|
||||||
curglpic = &s->floor.glpic;
|
curglpic = &s->floor.material.diffusemap;
|
||||||
curfbglpic = &s->floor.fbglpic;
|
curfbglpic = &s->floor.material.glowmap;
|
||||||
|
|
||||||
while (j > 0)
|
while (j > 0)
|
||||||
{
|
{
|
||||||
if (j == 1)
|
if (j == 1)
|
||||||
{
|
{
|
||||||
curbuffer = s->ceil.color;
|
curbuffer = s->ceil.material.diffusemodulation;
|
||||||
curstat = sec->ceilingshade;
|
curstat = sec->ceilingshade;
|
||||||
curxpanning = sec->ceilingpal;
|
curxpanning = sec->ceilingpal;
|
||||||
curpicnum = ceilingpicnum;
|
curpicnum = ceilingpicnum;
|
||||||
curglpic = &s->ceil.glpic;
|
curglpic = &s->ceil.material.diffusemap;
|
||||||
curfbglpic = &s->ceil.fbglpic;
|
curfbglpic = &s->ceil.material.glowmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!waloff[curpicnum])
|
if (!waloff[curpicnum])
|
||||||
|
@ -1661,22 +1671,24 @@ static void polymer_updatewall(short wallnum)
|
||||||
loadtile(curpicnum);
|
loadtile(curpicnum);
|
||||||
|
|
||||||
pth = gltexcache(curpicnum, wal->pal, 0);
|
pth = gltexcache(curpicnum, wal->pal, 0);
|
||||||
w->wall.glpic = pth ? pth->glpic : 0;
|
w->wall.material.diffusemap = pth ? pth->glpic : 0;
|
||||||
|
|
||||||
if (pth && (pth->flags & 16))
|
if (pth && (pth->flags & 16))
|
||||||
w->wall.fbglpic = pth->ofb->glpic;
|
w->wall.material.glowmap = pth->ofb->glpic;
|
||||||
else
|
else
|
||||||
w->wall.fbglpic = 0;
|
w->wall.material.glowmap = 0;
|
||||||
|
|
||||||
w->wall.color[0] = w->wall.color[1] = w->wall.color[2] =
|
w->wall.material.diffusemodulation[0] =
|
||||||
|
w->wall.material.diffusemodulation[1] =
|
||||||
|
w->wall.material.diffusemodulation[2] =
|
||||||
((float)(numpalookups-min(max(wal->shade*shadescale,0),numpalookups)))/((float)numpalookups);
|
((float)(numpalookups-min(max(wal->shade*shadescale,0),numpalookups)))/((float)numpalookups);
|
||||||
w->wall.color[3] = 1.0f;
|
w->wall.material.diffusemodulation[3] = 1.0f;
|
||||||
|
|
||||||
if (pth && (pth->flags & 2) && (pth->palnum != wal->pal))
|
if (pth && (pth->flags & 2) && (pth->palnum != wal->pal))
|
||||||
{
|
{
|
||||||
w->wall.color[0] *= (float)hictinting[wal->pal].r / 255.0;
|
w->wall.material.diffusemodulation[0] *= (float)hictinting[wal->pal].r / 255.0;
|
||||||
w->wall.color[1] *= (float)hictinting[wal->pal].g / 255.0;
|
w->wall.material.diffusemodulation[1] *= (float)hictinting[wal->pal].g / 255.0;
|
||||||
w->wall.color[2] *= (float)hictinting[wal->pal].b / 255.0;
|
w->wall.material.diffusemodulation[2] *= (float)hictinting[wal->pal].b / 255.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wal->cstat & 4)
|
if (wal->cstat & 4)
|
||||||
|
@ -1758,22 +1770,24 @@ static void polymer_updatewall(short wallnum)
|
||||||
loadtile(curpicnum);
|
loadtile(curpicnum);
|
||||||
|
|
||||||
pth = gltexcache(curpicnum, curpal, 0);
|
pth = gltexcache(curpicnum, curpal, 0);
|
||||||
w->wall.glpic = pth ? pth->glpic : 0;
|
w->wall.material.diffusemap = pth ? pth->glpic : 0;
|
||||||
|
|
||||||
if (pth && (pth->flags & 16))
|
if (pth && (pth->flags & 16))
|
||||||
w->wall.fbglpic = pth->ofb->glpic;
|
w->wall.material.glowmap = pth->ofb->glpic;
|
||||||
else
|
else
|
||||||
w->wall.fbglpic = 0;
|
w->wall.material.glowmap = 0;
|
||||||
|
|
||||||
w->wall.color[0] = w->wall.color[1] = w->wall.color[2] =
|
w->wall.material.diffusemodulation[0] =
|
||||||
|
w->wall.material.diffusemodulation[1] =
|
||||||
|
w->wall.material.diffusemodulation[2] =
|
||||||
((float)(numpalookups-min(max(curshade*shadescale,0),numpalookups)))/((float)numpalookups);
|
((float)(numpalookups-min(max(curshade*shadescale,0),numpalookups)))/((float)numpalookups);
|
||||||
w->wall.color[3] = 1.0f;
|
w->wall.material.diffusemodulation[3] = 1.0f;
|
||||||
|
|
||||||
if (pth && (pth->flags & 2) && (pth->palnum != curpal))
|
if (pth && (pth->flags & 2) && (pth->palnum != curpal))
|
||||||
{
|
{
|
||||||
w->wall.color[0] *= (float)hictinting[curpal].r / 255.0;
|
w->wall.material.diffusemodulation[0] *= (float)hictinting[curpal].r / 255.0;
|
||||||
w->wall.color[1] *= (float)hictinting[curpal].g / 255.0;
|
w->wall.material.diffusemodulation[1] *= (float)hictinting[curpal].g / 255.0;
|
||||||
w->wall.color[2] *= (float)hictinting[curpal].b / 255.0;
|
w->wall.material.diffusemodulation[2] *= (float)hictinting[curpal].b / 255.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!(wal->cstat & 2) && (wal->cstat & 4)) || ((wal->cstat & 2) && (wall[nwallnum].cstat & 4)))
|
if ((!(wal->cstat & 2) && (wal->cstat & 4)) || ((wal->cstat & 2) && (wall[nwallnum].cstat & 4)))
|
||||||
|
@ -1853,46 +1867,50 @@ static void polymer_updatewall(short wallnum)
|
||||||
loadtile(wal->overpicnum);
|
loadtile(wal->overpicnum);
|
||||||
|
|
||||||
pth = gltexcache(wal->overpicnum, wal->pal, 0);
|
pth = gltexcache(wal->overpicnum, wal->pal, 0);
|
||||||
w->mask.glpic = pth ? pth->glpic : 0;
|
w->mask.material.diffusemap = pth ? pth->glpic : 0;
|
||||||
|
|
||||||
w->mask.color[0] = w->mask.color[1] = w->mask.color[2] =
|
w->mask.material.diffusemodulation[0] =
|
||||||
|
w->mask.material.diffusemodulation[1] =
|
||||||
|
w->mask.material.diffusemodulation[2] =
|
||||||
((float)(numpalookups-min(max(wal->shade*shadescale,0),numpalookups)))/((float)numpalookups);
|
((float)(numpalookups-min(max(wal->shade*shadescale,0),numpalookups)))/((float)numpalookups);
|
||||||
w->mask.color[3] = 1.0f;
|
w->mask.material.diffusemodulation[3] = 1.0f;
|
||||||
|
|
||||||
if (pth && (pth->flags & 2) && (pth->palnum != wal->pal))
|
if (pth && (pth->flags & 2) && (pth->palnum != wal->pal))
|
||||||
{
|
{
|
||||||
w->mask.color[0] *= (float)hictinting[wal->pal].r / 255.0;
|
w->mask.material.diffusemodulation[0] *= (float)hictinting[wal->pal].r / 255.0;
|
||||||
w->mask.color[1] *= (float)hictinting[wal->pal].g / 255.0;
|
w->mask.material.diffusemodulation[1] *= (float)hictinting[wal->pal].g / 255.0;
|
||||||
w->mask.color[2] *= (float)hictinting[wal->pal].b / 255.0;
|
w->mask.material.diffusemodulation[2] *= (float)hictinting[wal->pal].b / 255.0;
|
||||||
}
|
}
|
||||||
if (wal->cstat & 128)
|
if (wal->cstat & 128)
|
||||||
{
|
{
|
||||||
if (wal->cstat & 512)
|
if (wal->cstat & 512)
|
||||||
w->mask.color[3] = 0.33f;
|
w->mask.material.diffusemodulation[3] = 0.33f;
|
||||||
else
|
else
|
||||||
w->mask.color[3] = 0.66f;
|
w->mask.material.diffusemodulation[3] = 0.66f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
w->mask.color[3] = 1.0f;
|
w->mask.material.diffusemodulation[3] = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
pth = gltexcache(curpicnum, wal->pal, 0);
|
pth = gltexcache(curpicnum, wal->pal, 0);
|
||||||
w->over.glpic = pth ? pth->glpic : 0;
|
w->over.material.diffusemap = pth ? pth->glpic : 0;
|
||||||
|
|
||||||
if (pth && (pth->flags & 16))
|
if (pth && (pth->flags & 16))
|
||||||
w->over.fbglpic = pth->ofb->glpic;
|
w->over.material.glowmap = pth->ofb->glpic;
|
||||||
else
|
else
|
||||||
w->over.fbglpic = 0;
|
w->over.material.glowmap = 0;
|
||||||
|
|
||||||
w->over.color[0] = w->over.color[1] = w->over.color[2] =
|
w->over.material.diffusemodulation[0] =
|
||||||
|
w->over.material.diffusemodulation[1] =
|
||||||
|
w->over.material.diffusemodulation[2] =
|
||||||
((float)(numpalookups-min(max(wal->shade*shadescale,0),numpalookups)))/((float)numpalookups);
|
((float)(numpalookups-min(max(wal->shade*shadescale,0),numpalookups)))/((float)numpalookups);
|
||||||
w->over.color[3] = 1.0f;
|
w->over.material.diffusemodulation[3] = 1.0f;
|
||||||
|
|
||||||
if (pth && (pth->flags & 2) && (pth->palnum != wal->pal))
|
if (pth && (pth->flags & 2) && (pth->palnum != wal->pal))
|
||||||
{
|
{
|
||||||
w->over.color[0] *= (float)hictinting[wal->pal].r / 255.0;
|
w->over.material.diffusemodulation[0] *= (float)hictinting[wal->pal].r / 255.0;
|
||||||
w->over.color[1] *= (float)hictinting[wal->pal].g / 255.0;
|
w->over.material.diffusemodulation[1] *= (float)hictinting[wal->pal].g / 255.0;
|
||||||
w->over.color[2] *= (float)hictinting[wal->pal].b / 255.0;
|
w->over.material.diffusemodulation[2] *= (float)hictinting[wal->pal].b / 255.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wal->cstat & 4)
|
if (wal->cstat & 4)
|
||||||
|
|
Loading…
Reference in a new issue