mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
copy code
This commit is contained in:
parent
1426ebec20
commit
304a906aa7
3 changed files with 67 additions and 57 deletions
|
@ -717,59 +717,11 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
|||
polymost_bindPth(pth, mSampler);
|
||||
|
||||
}
|
||||
|
||||
VSMatrix texmat;
|
||||
// texture scale by parkar request
|
||||
if (pth->hicr && !drawingskybox && ((pth->hicr->scale.x != 1.0f) || (pth->hicr->scale.y != 1.0f)))
|
||||
{
|
||||
texmat.loadIdentity();
|
||||
texmat.scale(pth->hicr->scale.x, pth->hicr->scale.y, 1.0f);
|
||||
GLInterface.SetMatrix(Matrix_Texture, &texmat);
|
||||
}
|
||||
|
||||
if (videoGetRenderMode() == REND_POLYMOST)
|
||||
if (videoGetRenderMode() == REND_POLYMOST)
|
||||
{
|
||||
polymost_updatePalette();
|
||||
}
|
||||
|
||||
// detail texture
|
||||
if (r_detailmapping)
|
||||
{
|
||||
pthtyp *detailpth = NULL;
|
||||
|
||||
if (usehightile && !drawingskybox && hicfindsubst(globalpicnum, DETAILPAL, 1) &&
|
||||
(detailpth = texcache_fetch(globalpicnum, DETAILPAL, 0, method & ~DAMETH_MASKPROPS)) &&
|
||||
detailpth->hicr && detailpth->hicr->palnum == DETAILPAL)
|
||||
{
|
||||
GLInterface.UseDetailMapping(true);
|
||||
polymost_setupdetailtexture(3, detailpth->glpic);
|
||||
|
||||
texmat.loadIdentity();
|
||||
|
||||
if (pth->hicr && ((pth->hicr->scale.x != 1.0f) || (pth->hicr->scale.y != 1.0f)))
|
||||
texmat.scale(pth->hicr->scale.x, pth->hicr->scale.y, 1.0f);
|
||||
|
||||
if ((detailpth->hicr->scale.x != 1.0f) || (detailpth->hicr->scale.y != 1.0f))
|
||||
texmat.scale(detailpth->hicr->scale.x, detailpth->hicr->scale.y, 1.0f);
|
||||
|
||||
GLInterface.SetMatrix(Matrix_Detail, &texmat);
|
||||
}
|
||||
}
|
||||
|
||||
// glow texture
|
||||
if (r_glowmapping)
|
||||
{
|
||||
pthtyp *glowpth = NULL;
|
||||
|
||||
if (usehightile && !drawingskybox && hicfindsubst(globalpicnum, GLOWPAL, 1) &&
|
||||
(glowpth = texcache_fetch(globalpicnum, GLOWPAL, 0, (method & ~DAMETH_MASKPROPS) | DAMETH_MASK)) &&
|
||||
glowpth->hicr && (glowpth->hicr->palnum == GLOWPAL))
|
||||
{
|
||||
GLInterface.UseGlowMapping(true);
|
||||
polymost_setupglowtexture(4, glowpth->glpic);
|
||||
}
|
||||
}
|
||||
|
||||
if ((method & DAMETH_WALL) != 0)
|
||||
{
|
||||
int32_t size = tilesize.y;
|
||||
|
@ -872,13 +824,6 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
|||
GLInterface.UseGlowMapping(false);
|
||||
GLInterface.SetNpotEmulation(false, 1.f, 0.f);
|
||||
|
||||
if (pth->hicr)
|
||||
{
|
||||
VSMatrix identity(0);
|
||||
GLInterface.SetMatrix(Matrix_Texture, &identity);
|
||||
GLInterface.SetMatrix(Matrix_Detail, &identity);
|
||||
}
|
||||
|
||||
if (skyzbufferhack && skyzbufferhack_pass == 0)
|
||||
{
|
||||
vec3d_t const bxtex = xtex, bytex = ytex, botex = otex;
|
||||
|
|
|
@ -201,7 +201,68 @@ std::pair<size_t, BaseVertex *> GLInstance::AllocVertices(size_t num)
|
|||
return std::make_pair((size_t)0, Buffer.data());
|
||||
}
|
||||
|
||||
static GLint primtypes[] =
|
||||
void GLInstance::ApplyTextureProps()
|
||||
{
|
||||
|
||||
VSMatrix texmat;
|
||||
// texture scale by parkar request
|
||||
if (pth->hicr && !drawingskybox && ((pth->hicr->scale.x != 1.0f) || (pth->hicr->scale.y != 1.0f)))
|
||||
{
|
||||
texmat.loadIdentity();
|
||||
texmat.scale(pth->hicr->scale.x, pth->hicr->scale.y, 1.0f);
|
||||
GLInterface.SetMatrix(Matrix_Texture, &texmat);
|
||||
}
|
||||
|
||||
// detail texture
|
||||
if (r_detailmapping)
|
||||
{
|
||||
pthtyp *detailpth = NULL;
|
||||
|
||||
if (usehightile && !drawingskybox && hicfindsubst(globalpicnum, DETAILPAL, 1) &&
|
||||
(detailpth = texcache_fetch(globalpicnum, DETAILPAL, 0, method & ~DAMETH_MASKPROPS)) &&
|
||||
detailpth->hicr && detailpth->hicr->palnum == DETAILPAL)
|
||||
{
|
||||
GLInterface.UseDetailMapping(true);
|
||||
polymost_setupdetailtexture(3, detailpth->glpic);
|
||||
|
||||
texmat.loadIdentity();
|
||||
|
||||
if (pth->hicr && ((pth->hicr->scale.x != 1.0f) || (pth->hicr->scale.y != 1.0f)))
|
||||
texmat.scale(pth->hicr->scale.x, pth->hicr->scale.y, 1.0f);
|
||||
|
||||
if ((detailpth->hicr->scale.x != 1.0f) || (detailpth->hicr->scale.y != 1.0f))
|
||||
texmat.scale(detailpth->hicr->scale.x, detailpth->hicr->scale.y, 1.0f);
|
||||
|
||||
GLInterface.SetMatrix(Matrix_Detail, &texmat);
|
||||
}
|
||||
}
|
||||
|
||||
// glow texture
|
||||
if (r_glowmapping)
|
||||
{
|
||||
pthtyp *glowpth = NULL;
|
||||
|
||||
if (usehightile && !drawingskybox && hicfindsubst(globalpicnum, GLOWPAL, 1) &&
|
||||
(glowpth = texcache_fetch(globalpicnum, GLOWPAL, 0, (method & ~DAMETH_MASKPROPS) | DAMETH_MASK)) &&
|
||||
glowpth->hicr && (glowpth->hicr->palnum == GLOWPAL))
|
||||
{
|
||||
GLInterface.UseGlowMapping(true);
|
||||
polymost_setupglowtexture(4, glowpth->glpic);
|
||||
}
|
||||
}
|
||||
return true; // true if the matrices were changed, false otherwise
|
||||
}
|
||||
|
||||
void GLInstance::RestoreTextureProps()
|
||||
{
|
||||
// todo: reset everything that's needed to ensure proper functionality
|
||||
VSMatrix identity(0);
|
||||
GLInterface.SetMatrix(Matrix_Texture, &identity);
|
||||
GLInterface.SetMatrix(Matrix_Detail, &identity);
|
||||
}
|
||||
|
||||
|
||||
static GLint primtypes[] =
|
||||
{
|
||||
GL_TRIANGLES,
|
||||
GL_TRIANGLE_STRIP,
|
||||
|
@ -213,9 +274,11 @@ static GLint primtypes[] =
|
|||
void GLInstance::Draw(EDrawType type, size_t start, size_t count)
|
||||
{
|
||||
// Todo: Based on the current tinting flags and the texture type (indexed texture and APPLYOVERPALSWAP not set) this may have to reset the palette for the draw call / texture creation.
|
||||
bool applied = false;
|
||||
|
||||
if (activeShader == polymostShader)
|
||||
{
|
||||
applied = ApplyTextureProps();
|
||||
renderState.UsePalette = texv && texv->isIndexed();
|
||||
renderState.Apply(polymostShader);
|
||||
}
|
||||
|
@ -227,6 +290,7 @@ void GLInstance::Draw(EDrawType type, size_t start, size_t count)
|
|||
glVertexAttrib3f(0, p->x, p->y, p->z);
|
||||
}
|
||||
glEnd();
|
||||
if (applied) RestoreTextureProps();
|
||||
}
|
||||
|
||||
int GLInstance::GetTextureID()
|
||||
|
|
|
@ -277,6 +277,7 @@ public:
|
|||
void SetSurfaceShader();
|
||||
void SetVPXShader();
|
||||
void SetPalette(int palette);
|
||||
void ApplyTextureProps();
|
||||
|
||||
void ReadPixels(int w, int h, uint8_t* buffer);
|
||||
|
||||
|
|
Loading…
Reference in a new issue