Fixed issues with transparent chara draw

This commit is contained in:
korenkonder
2024-01-06 14:57:31 +03:00
parent e28a557d41
commit 9e9113b7a0
3 changed files with 23 additions and 21 deletions
+15 -14
View File
@@ -764,8 +764,9 @@ namespace rndr {
renderer::DOF3* dof = new renderer::DOF3;
this->dof = renderer__DOF3__DOF3(dof, render_post_width[0], render_post_height[0]);
transparency_tex[0] = texture_load_tex_2d(texture_id(0x25, texture_counter++),
GL_RGBA16F, render_post_width[0], render_post_height[0], 0, 0, 0);
for (int32_t i = 0; i < 1; i++)
transparency_tex[i] = texture_load_tex_2d(texture_id(0x25, texture_counter++),
GL_RGBA16F, render_post_width[0], render_post_height[0], 0, 0, 0);
renderer::Transparency* (FASTCALL * renderer__Transparency__Transparency)(
renderer::Transparency * transparency, GLuint color_texture,
@@ -926,15 +927,17 @@ namespace rndr {
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzle);
for (int32_t i = 0; i < 3; i++) {
texture_id id = taa_tex[i]->id;
texture_free(taa_tex[i]);
taa_tex[i] = texture_load_tex_2d(texture_id(0x25, texture_counter++),
GL_RGBA8, render_post_width[0], render_post_height[0], 0, 0, 0);
taa_tex[i] = texture_load_tex_2d(id, GL_RGBA8,
render_post_width[0], render_post_height[0], 0, 0, 0);
taa_buffer[i].SetColorDepthTextures(taa_tex[i]->tex, 0, rend_texture[0].GetDepthTex());
}
texture_id aet_back_tex_id = aet_back_tex->id;
texture_free(aet_back_tex);
aet_back_tex = texture_load_tex_2d(texture_id(0x25, texture_counter++),
GL_RGBA8, render_post_width[0], render_post_height[0], 0, 0, 0);
aet_back_tex = texture_load_tex_2d(aet_back_tex_id, GL_RGBA8,
render_post_width[0], render_post_height[0], 0, 0, 0);
aet_back_texture.SetColorDepthTextures(aet_back_tex->tex, 0, rend_texture[0].GetDepthTex());
mlaa_buffer.Init(render_post_width[0], render_post_height[0], 0, GL_RGBA8, GL_DEPTH_COMPONENT24);
@@ -953,15 +956,13 @@ namespace rndr {
dof->resize(render_post_width[0], render_post_height[0]);
for (int32_t i = 0; i < 1; i++)
if (transparency_tex[i]) {
texture_free(transparency_tex[i]);
transparency_tex[i] = 0;
texture_counter--;
}
for (int32_t i = 0; i < 1; i++) {
texture_id id = taa_tex[i]->id;
texture_free(transparency_tex[i]);
transparency_tex[i] = texture_load_tex_2d(id, GL_RGBA16F,
render_post_width[0], render_post_height[0], 0, 0, 0);
}
transparency_tex[0] = texture_load_tex_2d(texture_id(0x25, texture_counter++),
GL_RGBA16F, render_post_width[0], render_post_height[0], 0, 0, 0);
transparency->resize(transparency_tex[0]->tex, rend_texture[0].GetDepthTex(),
render_post_width[0], render_post_height[0]);
}
+2 -1
View File
@@ -33,7 +33,7 @@ namespace renderer {
textures[count] = depth_texture;
glGenFramebuffers(1, &buffer);
glBindFramebuffer(GL_FRAMEBUFFER, buffer);
gl_state_bind_framebuffer(buffer, true);
for (int32_t i = 0; i < count; i++)
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, textures[i], 0);
@@ -45,6 +45,7 @@ namespace renderer {
color_attachments[i] = GL_COLOR_ATTACHMENT0 + i;
glDrawBuffers(count, color_attachments);
glCheckFramebufferStatus(GL_FRAMEBUFFER);
gl_state_bind_framebuffer(0);
}
#pragma warning(pop)
+6 -6
View File
@@ -29,27 +29,27 @@ struct texture_id {
};
inline bool operator >(const texture_id& left, const texture_id& right) {
return left.id > right.id && left.index > right.index;
return (((uint32_t)left.id << 24) | left.index) > (((uint32_t)right.id << 24) | right.index);
}
inline bool operator <(const texture_id& left, const texture_id& right) {
return left.id < right.id && left.index < right.index;
return (((uint32_t)left.id << 24) | left.index) < (((uint32_t)right.id << 24) | right.index);
}
inline bool operator >=(const texture_id& left, const texture_id& right) {
return left.id >= right.id && left.index >= right.index;
return (((uint32_t)left.id << 24) | left.index) >= (((uint32_t)right.id << 24) | right.index);
}
inline bool operator <=(const texture_id& left, const texture_id& right) {
return left.id <= right.id && left.index <= right.index;
return (((uint32_t)left.id << 24) | left.index) <= (((uint32_t)right.id << 24) | right.index);
}
inline bool operator ==(const texture_id& left, const texture_id& right) {
return left.id == right.id && left.index == right.index;
return (((uint32_t)left.id << 24) | left.index) == (((uint32_t)right.id << 24) | right.index);
}
inline bool operator !=(const texture_id& left, const texture_id& right) {
return left.id != right.id || left.index != right.index;
return (((uint32_t)left.id << 24) | left.index) != (((uint32_t)right.id << 24) | right.index);
}
static_assert(sizeof(texture_id) == 0x04, "\"texture_id\" struct should have a size of 0x04");