SealEngine: Implement ZWrite .opr attribute

This commit is contained in:
kichikuou
2026-06-12 15:00:39 +09:00
parent 062713f70e
commit 5c47ad5aae
3 changed files with 14 additions and 0 deletions
+1
View File
@@ -664,6 +664,7 @@ enum mesh_flags {
MESH_NO_HEIGHT_DETECTION = 1 << 7,
MESH_ALPHA = 1 << 8,
MESH_HAS_LIGHT_UV = 1 << 9,
MESH_NO_ZWRITE = 1 << 10,
};
struct pol_mesh {
+9
View File
@@ -620,6 +620,15 @@ void opr_load(uint8_t *data, size_t size, struct pol *pol)
} else {
WARNING("invalid HeightDetection: %s", s);
}
} else if (sscanf(line, "ZWrite = %s", s) == 1) {
if (!strcmp(s, "false")) {
for (int i = 0; i < pol->nr_meshes; i++) {
if (!selected[i]) continue;
pol->meshes[i]->flags |= MESH_NO_ZWRITE;
}
} else if (strcmp(s, "true")) {
WARNING("invalid ZWrite: %s", s);
}
} else if (sscanf(line, "UVScroll = ( %f , %f )", &f1, &f2) == 2) {
for (int i = 0; i < pol->nr_meshes; i++) {
if (!selected[i]) continue;
+4
View File
@@ -506,12 +506,16 @@ static void render_model(struct RE_instance *inst, struct RE_renderer *r, enum d
if (mesh->flags & MESH_BOTH)
glDisable(GL_CULL_FACE);
if (mesh->flags & MESH_NO_ZWRITE)
glDepthMask(GL_FALSE);
if (mesh->nr_indices)
glDrawElements(GL_TRIANGLES, mesh->nr_indices, GL_UNSIGNED_SHORT, NULL);
else
glDrawArrays(GL_TRIANGLES, 0, mesh->nr_vertices);
if (mesh->flags & MESH_NO_ZWRITE)
glDepthMask(GL_TRUE);
if (mesh->flags & MESH_BOTH)
glEnable(GL_CULL_FACE);
glBindVertexArray(0);