mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-04-28 12:47:58 +03:00
tr1/output/sprites: fix small mistakes
This commit is contained in:
parent
88870ef539
commit
c0ff49461c
4 changed files with 9 additions and 12 deletions
|
@ -26,11 +26,11 @@ bool discardTranslucent(sampler2D tex, vec2 uv)
|
|||
return texel.a == 0.0;
|
||||
}
|
||||
|
||||
bool discardTranslucent(sampler2DArray tex, vec3 uv)
|
||||
bool discardTranslucent(sampler2DArray tex, vec3 uvw)
|
||||
{
|
||||
// do not use smoothing for chroma key
|
||||
ivec2 size = textureSize(tex, 0).xy;
|
||||
ivec3 texCoordsNN = ivec3(ivec2(uv.xy * size.xy) % size.xy, uv.z);
|
||||
ivec3 texCoordsNN = ivec3(ivec2(uvw.xy * size.xy) % size.xy, uvw.z);
|
||||
vec4 texel = texelFetch(tex, texCoordsNN, 0);
|
||||
return texel.a == 0.0;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ layout(location = 1) in vec2 inDisplacement;
|
|||
layout(location = 2) in int inTextureIdx;
|
||||
layout(location = 3) in float inShade;
|
||||
|
||||
out vec3 gUV; // x = u, y = v, z = layer
|
||||
out vec3 gUVW; // x = u, y = v, z = layer
|
||||
out float gShade;
|
||||
|
||||
void main(void) {
|
||||
|
@ -27,7 +27,7 @@ void main(void) {
|
|||
waterWibble(gl_Position, uViewportSize, uWibbleOffset);
|
||||
}
|
||||
|
||||
gUV = texelFetch(uUVW, int(inTextureIdx)).xyz;
|
||||
gUVW = texelFetch(uUVW, int(inTextureIdx)).xyz;
|
||||
gShade = inShade;
|
||||
}
|
||||
|
||||
|
@ -38,13 +38,13 @@ uniform bool uSmoothingEnabled;
|
|||
uniform float uBrightnessMultiplier;
|
||||
uniform vec3 uGlobalTint;
|
||||
|
||||
in vec3 gUV;
|
||||
in vec3 gUVW;
|
||||
in float gShade;
|
||||
out vec4 outColor;
|
||||
|
||||
void main(void) {
|
||||
vec4 texColor = texture(uTexture, gUV);
|
||||
if (uSmoothingEnabled && discardTranslucent(uTexture, gUV)) {
|
||||
vec4 texColor = texture(uTexture, gUVW);
|
||||
if (uSmoothingEnabled && discardTranslucent(uTexture, gUVW)) {
|
||||
discard;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ struct GFX_3D_RENDERER {
|
|||
|
||||
// shader variable locations
|
||||
GLint loc_mat_projection;
|
||||
GLint loc_mat_model_view;
|
||||
GLint loc_texturing_enabled;
|
||||
GLint loc_smoothing_enabled;
|
||||
GLint loc_alpha_point_discard;
|
||||
|
@ -142,8 +141,6 @@ GFX_3D_RENDERER *GFX_3D_Renderer_Create(void)
|
|||
|
||||
renderer->loc_mat_projection =
|
||||
GFX_GL_Program_UniformLocation(&renderer->program, "matProjection");
|
||||
renderer->loc_mat_model_view =
|
||||
GFX_GL_Program_UniformLocation(&renderer->program, "matModelView");
|
||||
renderer->loc_texturing_enabled =
|
||||
GFX_GL_Program_UniformLocation(&renderer->program, "texturingEnabled");
|
||||
renderer->loc_smoothing_enabled =
|
||||
|
|
|
@ -207,7 +207,7 @@ static void M_FillSpriteUVWs(void)
|
|||
|
||||
static void M_UploadSpriteUVWs(void)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_BUFFER, m_LevelData.sprites.tex);
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, m_LevelData.sprites.tbo);
|
||||
GFX_TRACK_DATA(
|
||||
glBufferData, GL_TEXTURE_BUFFER,
|
||||
m_LevelData.sprites.count * sizeof(M_UVW_PACK), m_LevelData.sprites.uvw,
|
||||
|
@ -216,7 +216,7 @@ static void M_UploadSpriteUVWs(void)
|
|||
|
||||
static void M_UploadSpriteAnimatedUVWs(const M_ANIMATION_RANGES *const source)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_BUFFER, m_LevelData.sprites.tex);
|
||||
glBindBuffer(GL_TEXTURE_BUFFER, m_LevelData.sprites.tbo);
|
||||
for (int32_t i = 0; i < source->range_count; i++) {
|
||||
const M_ANIMATION_RANGE *const range = &source->ranges[i];
|
||||
for (int32_t j = 0; j < range->count; j++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue