gfx changes
parent
f7abcc036c
commit
4cec1b55e3
|
@ -1320,6 +1320,7 @@ enum MODEL_FLAGS {
|
||||||
MODEL_MATCAPS = 16,
|
MODEL_MATCAPS = 16,
|
||||||
MODEL_RIMLIGHT = 32,
|
MODEL_RIMLIGHT = 32,
|
||||||
MODEL_PBR = 64,
|
MODEL_PBR = 64,
|
||||||
|
MODEL_TRANSPARENT = 128,
|
||||||
};
|
};
|
||||||
enum SHADING_MODE {
|
enum SHADING_MODE {
|
||||||
SHADING_NONE,
|
SHADING_NONE,
|
||||||
|
|
|
@ -17565,6 +17565,7 @@ enum MODEL_FLAGS {
|
||||||
MODEL_MATCAPS = 16,
|
MODEL_MATCAPS = 16,
|
||||||
MODEL_RIMLIGHT = 32,
|
MODEL_RIMLIGHT = 32,
|
||||||
MODEL_PBR = 64,
|
MODEL_PBR = 64,
|
||||||
|
MODEL_TRANSPARENT = 128,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SHADING_MODE {
|
enum SHADING_MODE {
|
||||||
|
@ -385540,7 +385541,13 @@ void model_set_renderstates(model_t *m) {
|
||||||
// Opaque pass
|
// Opaque pass
|
||||||
renderstate_t *opaque_rs = &m->rs[RENDER_PASS_OPAQUE];
|
renderstate_t *opaque_rs = &m->rs[RENDER_PASS_OPAQUE];
|
||||||
{
|
{
|
||||||
|
#if 0 // @todo: we should keep blend_enabled=0, however our transparency detection still needs work
|
||||||
opaque_rs->blend_enabled = 0;
|
opaque_rs->blend_enabled = 0;
|
||||||
|
#else
|
||||||
|
opaque_rs->blend_enabled = 1;
|
||||||
|
opaque_rs->blend_src = GL_SRC_ALPHA;
|
||||||
|
opaque_rs->blend_dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||||
|
#endif
|
||||||
opaque_rs->cull_face_mode = GL_BACK;
|
opaque_rs->cull_face_mode = GL_BACK;
|
||||||
opaque_rs->front_face = GL_CW;
|
opaque_rs->front_face = GL_CW;
|
||||||
}
|
}
|
||||||
|
@ -385851,7 +385858,6 @@ void shader_colormap_model_internal(const char *col_name, const char *bool_name,
|
||||||
|
|
||||||
|
|
||||||
typedef struct drawcall_t {
|
typedef struct drawcall_t {
|
||||||
model_t *m;
|
|
||||||
int mesh;
|
int mesh;
|
||||||
union {
|
union {
|
||||||
uint64_t order;
|
uint64_t order;
|
||||||
|
@ -385889,6 +385895,9 @@ void model_draw_call(model_t m, int shader, int pass, vec3 cam_pos, mat44 model_
|
||||||
required_rs[i] = rs_idx;
|
required_rs[i] = rs_idx;
|
||||||
|
|
||||||
if (required_rs[i] < RENDER_PASS_OVERRIDES_BEGIN) {
|
if (required_rs[i] < RENDER_PASS_OVERRIDES_BEGIN) {
|
||||||
|
if (m.flags & MODEL_TRANSPARENT) {
|
||||||
|
required_rs[i] = RENDER_PASS_TRANSPARENT;
|
||||||
|
}
|
||||||
if (m.materials[i].layer[0].map.color.a < 1 || (m.materials[i].layer[0].map.texture && m.materials[i].layer[0].map.texture->transparent)) {
|
if (m.materials[i].layer[0].map.color.a < 1 || (m.materials[i].layer[0].map.texture && m.materials[i].layer[0].map.texture->transparent)) {
|
||||||
required_rs[i] = RENDER_PASS_TRANSPARENT;
|
required_rs[i] = RENDER_PASS_TRANSPARENT;
|
||||||
}
|
}
|
||||||
|
@ -385913,7 +385922,7 @@ void model_draw_call(model_t m, int shader, int pass, vec3 cam_pos, mat44 model_
|
||||||
drawcall_t call;
|
drawcall_t call;
|
||||||
call.mesh = i;
|
call.mesh = i;
|
||||||
call.tex = m.textures[i];
|
call.tex = m.textures[i];
|
||||||
call.distance = -1;
|
call.distance = 0;
|
||||||
if (m.shading == SHADING_PBR)
|
if (m.shading == SHADING_PBR)
|
||||||
call.tex = m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture->id : m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture->id : texture_checker().id;
|
call.tex = m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture->id : m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture->id : texture_checker().id;
|
||||||
array_push(drawcalls, call);
|
array_push(drawcalls, call);
|
||||||
|
|
|
@ -3901,7 +3901,13 @@ void model_set_renderstates(model_t *m) {
|
||||||
// Opaque pass
|
// Opaque pass
|
||||||
renderstate_t *opaque_rs = &m->rs[RENDER_PASS_OPAQUE];
|
renderstate_t *opaque_rs = &m->rs[RENDER_PASS_OPAQUE];
|
||||||
{
|
{
|
||||||
|
#if 0 // @todo: we should keep blend_enabled=0, however our transparency detection still needs work
|
||||||
opaque_rs->blend_enabled = 0;
|
opaque_rs->blend_enabled = 0;
|
||||||
|
#else
|
||||||
|
opaque_rs->blend_enabled = 1;
|
||||||
|
opaque_rs->blend_src = GL_SRC_ALPHA;
|
||||||
|
opaque_rs->blend_dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||||
|
#endif
|
||||||
opaque_rs->cull_face_mode = GL_BACK;
|
opaque_rs->cull_face_mode = GL_BACK;
|
||||||
opaque_rs->front_face = GL_CW;
|
opaque_rs->front_face = GL_CW;
|
||||||
}
|
}
|
||||||
|
@ -4212,7 +4218,6 @@ void shader_colormap_model_internal(const char *col_name, const char *bool_name,
|
||||||
|
|
||||||
|
|
||||||
typedef struct drawcall_t {
|
typedef struct drawcall_t {
|
||||||
model_t *m;
|
|
||||||
int mesh;
|
int mesh;
|
||||||
union {
|
union {
|
||||||
uint64_t order;
|
uint64_t order;
|
||||||
|
@ -4250,6 +4255,9 @@ void model_draw_call(model_t m, int shader, int pass, vec3 cam_pos, mat44 model_
|
||||||
required_rs[i] = rs_idx;
|
required_rs[i] = rs_idx;
|
||||||
|
|
||||||
if (required_rs[i] < RENDER_PASS_OVERRIDES_BEGIN) {
|
if (required_rs[i] < RENDER_PASS_OVERRIDES_BEGIN) {
|
||||||
|
if (m.flags & MODEL_TRANSPARENT) {
|
||||||
|
required_rs[i] = RENDER_PASS_TRANSPARENT;
|
||||||
|
}
|
||||||
if (m.materials[i].layer[0].map.color.a < 1 || (m.materials[i].layer[0].map.texture && m.materials[i].layer[0].map.texture->transparent)) {
|
if (m.materials[i].layer[0].map.color.a < 1 || (m.materials[i].layer[0].map.texture && m.materials[i].layer[0].map.texture->transparent)) {
|
||||||
required_rs[i] = RENDER_PASS_TRANSPARENT;
|
required_rs[i] = RENDER_PASS_TRANSPARENT;
|
||||||
}
|
}
|
||||||
|
@ -4274,7 +4282,7 @@ void model_draw_call(model_t m, int shader, int pass, vec3 cam_pos, mat44 model_
|
||||||
drawcall_t call;
|
drawcall_t call;
|
||||||
call.mesh = i;
|
call.mesh = i;
|
||||||
call.tex = m.textures[i];
|
call.tex = m.textures[i];
|
||||||
call.distance = -1;
|
call.distance = 0;
|
||||||
if (m.shading == SHADING_PBR)
|
if (m.shading == SHADING_PBR)
|
||||||
call.tex = m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture->id : m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture->id : texture_checker().id;
|
call.tex = m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture->id : m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture->id : texture_checker().id;
|
||||||
array_push(drawcalls, call);
|
array_push(drawcalls, call);
|
||||||
|
|
|
@ -597,6 +597,7 @@ enum MODEL_FLAGS {
|
||||||
MODEL_MATCAPS = 16,
|
MODEL_MATCAPS = 16,
|
||||||
MODEL_RIMLIGHT = 32,
|
MODEL_RIMLIGHT = 32,
|
||||||
MODEL_PBR = 64,
|
MODEL_PBR = 64,
|
||||||
|
MODEL_TRANSPARENT = 128,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SHADING_MODE {
|
enum SHADING_MODE {
|
||||||
|
|
12
engine/v4k.c
12
engine/v4k.c
|
@ -20700,7 +20700,13 @@ void model_set_renderstates(model_t *m) {
|
||||||
// Opaque pass
|
// Opaque pass
|
||||||
renderstate_t *opaque_rs = &m->rs[RENDER_PASS_OPAQUE];
|
renderstate_t *opaque_rs = &m->rs[RENDER_PASS_OPAQUE];
|
||||||
{
|
{
|
||||||
|
#if 0 // @todo: we should keep blend_enabled=0, however our transparency detection still needs work
|
||||||
opaque_rs->blend_enabled = 0;
|
opaque_rs->blend_enabled = 0;
|
||||||
|
#else
|
||||||
|
opaque_rs->blend_enabled = 1;
|
||||||
|
opaque_rs->blend_src = GL_SRC_ALPHA;
|
||||||
|
opaque_rs->blend_dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||||
|
#endif
|
||||||
opaque_rs->cull_face_mode = GL_BACK;
|
opaque_rs->cull_face_mode = GL_BACK;
|
||||||
opaque_rs->front_face = GL_CW;
|
opaque_rs->front_face = GL_CW;
|
||||||
}
|
}
|
||||||
|
@ -21011,7 +21017,6 @@ void shader_colormap_model_internal(const char *col_name, const char *bool_name,
|
||||||
|
|
||||||
|
|
||||||
typedef struct drawcall_t {
|
typedef struct drawcall_t {
|
||||||
model_t *m;
|
|
||||||
int mesh;
|
int mesh;
|
||||||
union {
|
union {
|
||||||
uint64_t order;
|
uint64_t order;
|
||||||
|
@ -21049,6 +21054,9 @@ void model_draw_call(model_t m, int shader, int pass, vec3 cam_pos, mat44 model_
|
||||||
required_rs[i] = rs_idx;
|
required_rs[i] = rs_idx;
|
||||||
|
|
||||||
if (required_rs[i] < RENDER_PASS_OVERRIDES_BEGIN) {
|
if (required_rs[i] < RENDER_PASS_OVERRIDES_BEGIN) {
|
||||||
|
if (m.flags & MODEL_TRANSPARENT) {
|
||||||
|
required_rs[i] = RENDER_PASS_TRANSPARENT;
|
||||||
|
}
|
||||||
if (m.materials[i].layer[0].map.color.a < 1 || (m.materials[i].layer[0].map.texture && m.materials[i].layer[0].map.texture->transparent)) {
|
if (m.materials[i].layer[0].map.color.a < 1 || (m.materials[i].layer[0].map.texture && m.materials[i].layer[0].map.texture->transparent)) {
|
||||||
required_rs[i] = RENDER_PASS_TRANSPARENT;
|
required_rs[i] = RENDER_PASS_TRANSPARENT;
|
||||||
}
|
}
|
||||||
|
@ -21073,7 +21081,7 @@ void model_draw_call(model_t m, int shader, int pass, vec3 cam_pos, mat44 model_
|
||||||
drawcall_t call;
|
drawcall_t call;
|
||||||
call.mesh = i;
|
call.mesh = i;
|
||||||
call.tex = m.textures[i];
|
call.tex = m.textures[i];
|
||||||
call.distance = -1;
|
call.distance = 0;
|
||||||
if (m.shading == SHADING_PBR)
|
if (m.shading == SHADING_PBR)
|
||||||
call.tex = m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture->id : m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture->id : texture_checker().id;
|
call.tex = m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_ALBEDO].map.texture->id : m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture ? m.materials[i].layer[MATERIAL_CHANNEL_DIFFUSE].map.texture->id : texture_checker().id;
|
||||||
array_push(drawcalls, call);
|
array_push(drawcalls, call);
|
||||||
|
|
|
@ -3632,6 +3632,7 @@ enum MODEL_FLAGS {
|
||||||
MODEL_MATCAPS = 16,
|
MODEL_MATCAPS = 16,
|
||||||
MODEL_RIMLIGHT = 32,
|
MODEL_RIMLIGHT = 32,
|
||||||
MODEL_PBR = 64,
|
MODEL_PBR = 64,
|
||||||
|
MODEL_TRANSPARENT = 128,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SHADING_MODE {
|
enum SHADING_MODE {
|
||||||
|
|
Loading…
Reference in New Issue