render changes
parent
15a495ad8d
commit
f47b9dea62
|
@ -17686,6 +17686,7 @@ API float model_animate_blends(model_t m, anim_t *primary, anim_t *secondary,
|
|||
API aabb model_aabb(model_t, mat44 transform);
|
||||
API void model_lod(model_t*, float lo_detail, float hi_detail, float morph);
|
||||
API void model_shading(model_t*, int shading);
|
||||
API void model_shading_custom(model_t*, int shading, const char *vs, const char *fs, const char *defines);
|
||||
API void model_skybox(model_t*, skybox_t sky, bool load_sh);
|
||||
API void model_render(model_t, mat44 proj, mat44 view, mat44 model, int shader);
|
||||
API void model_render_skeleton(model_t, mat44 model);
|
||||
|
@ -386316,7 +386317,7 @@ void model_init_uniforms(model_t *m) {
|
|||
m->uniforms[MODEL_UNIFORM_RESOLUTION] = loc;
|
||||
}
|
||||
|
||||
void model_shading(model_t *m, int shading) {
|
||||
void model_shading_custom(model_t *m, int shading, const char *vs, const char *fs, const char *defines) {
|
||||
m->shading = shading;
|
||||
int flags = m->stored_flags;
|
||||
|
||||
|
@ -386327,18 +386328,30 @@ void model_shading(model_t *m, int shading) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!vs) {
|
||||
vs = vfs_read("shaders/vs_323444143_16_3322_model.glsl");
|
||||
}
|
||||
|
||||
if (!fs) {
|
||||
fs = vfs_read("shaders/fs_32_4_model.glsl");
|
||||
}
|
||||
|
||||
// rebind shader
|
||||
// @fixme: app crashes rn
|
||||
// glUseProgram(0);
|
||||
// glDeleteProgram(m->program);
|
||||
const char *symbols[] = { "{{include-shadowmap}}", vfs_read("shaders/fs_0_0_shadowmap_lit.glsl") }; // #define RIM
|
||||
int shaderprog = shader(strlerp(1,symbols,vfs_read("shaders/vs_323444143_16_3322_model.glsl")), strlerp(1,symbols,vfs_read("shaders/fs_32_4_model.glsl")), //fs,
|
||||
int shaderprog = shader(strlerp(1,symbols,vs), strlerp(1,symbols,fs), //fs,
|
||||
"att_position,att_texcoord,att_normal,att_tangent,att_instanced_matrix,,,,att_indexes,att_weights,att_vertexindex,att_color,att_bitangent,att_texcoord2","fragColor",
|
||||
va("%s,%s", shading == SHADING_PBR ? "SHADING_PBR" : shading == SHADING_VERTEXLIT ? "SHADING_VERTEXLIT" : "SHADING_PHONG", (flags&MODEL_RIMLIGHT)?"RIM":""));
|
||||
va("%s,%s,%s", defines ? defines : "NO_CUSTOM_DEFINES", shading == SHADING_PBR ? "SHADING_PBR" : shading == SHADING_VERTEXLIT ? "SHADING_VERTEXLIT" : "SHADING_PHONG", (flags&MODEL_RIMLIGHT)?"RIM":""));
|
||||
m->program = shaderprog;
|
||||
model_init_uniforms(m);
|
||||
}
|
||||
|
||||
void model_shading(model_t *m, int shading) {
|
||||
model_shading_custom(m, shading, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void model_skybox(model_t *mdl, skybox_t sky, bool load_sh) {
|
||||
if (load_sh) {
|
||||
shader_vec3v("u_coefficients_sh", 9, sky.cubemap.sh);
|
||||
|
|
|
@ -4660,7 +4660,7 @@ void model_init_uniforms(model_t *m) {
|
|||
m->uniforms[MODEL_UNIFORM_RESOLUTION] = loc;
|
||||
}
|
||||
|
||||
void model_shading(model_t *m, int shading) {
|
||||
void model_shading_custom(model_t *m, int shading, const char *vs, const char *fs, const char *defines) {
|
||||
m->shading = shading;
|
||||
int flags = m->stored_flags;
|
||||
|
||||
|
@ -4671,18 +4671,30 @@ void model_shading(model_t *m, int shading) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!vs) {
|
||||
vs = vfs_read("shaders/vs_323444143_16_3322_model.glsl");
|
||||
}
|
||||
|
||||
if (!fs) {
|
||||
fs = vfs_read("shaders/fs_32_4_model.glsl");
|
||||
}
|
||||
|
||||
// rebind shader
|
||||
// @fixme: app crashes rn
|
||||
// glUseProgram(0);
|
||||
// glDeleteProgram(m->program);
|
||||
const char *symbols[] = { "{{include-shadowmap}}", vfs_read("shaders/fs_0_0_shadowmap_lit.glsl") }; // #define RIM
|
||||
int shaderprog = shader(strlerp(1,symbols,vfs_read("shaders/vs_323444143_16_3322_model.glsl")), strlerp(1,symbols,vfs_read("shaders/fs_32_4_model.glsl")), //fs,
|
||||
int shaderprog = shader(strlerp(1,symbols,vs), strlerp(1,symbols,fs), //fs,
|
||||
"att_position,att_texcoord,att_normal,att_tangent,att_instanced_matrix,,,,att_indexes,att_weights,att_vertexindex,att_color,att_bitangent,att_texcoord2","fragColor",
|
||||
va("%s,%s", shading == SHADING_PBR ? "SHADING_PBR" : shading == SHADING_VERTEXLIT ? "SHADING_VERTEXLIT" : "SHADING_PHONG", (flags&MODEL_RIMLIGHT)?"RIM":""));
|
||||
va("%s,%s,%s", defines ? defines : "NO_CUSTOM_DEFINES", shading == SHADING_PBR ? "SHADING_PBR" : shading == SHADING_VERTEXLIT ? "SHADING_VERTEXLIT" : "SHADING_PHONG", (flags&MODEL_RIMLIGHT)?"RIM":""));
|
||||
m->program = shaderprog;
|
||||
model_init_uniforms(m);
|
||||
}
|
||||
|
||||
void model_shading(model_t *m, int shading) {
|
||||
model_shading_custom(m, shading, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void model_skybox(model_t *mdl, skybox_t sky, bool load_sh) {
|
||||
if (load_sh) {
|
||||
shader_vec3v("u_coefficients_sh", 9, sky.cubemap.sh);
|
||||
|
|
|
@ -718,6 +718,7 @@ API float model_animate_blends(model_t m, anim_t *primary, anim_t *secondary,
|
|||
API aabb model_aabb(model_t, mat44 transform);
|
||||
API void model_lod(model_t*, float lo_detail, float hi_detail, float morph);
|
||||
API void model_shading(model_t*, int shading);
|
||||
API void model_shading_custom(model_t*, int shading, const char *vs, const char *fs, const char *defines);
|
||||
API void model_skybox(model_t*, skybox_t sky, bool load_sh);
|
||||
API void model_render(model_t, mat44 proj, mat44 view, mat44 model, int shader);
|
||||
API void model_render_skeleton(model_t, mat44 model);
|
||||
|
|
18
engine/v4k.c
18
engine/v4k.c
|
@ -21459,7 +21459,7 @@ void model_init_uniforms(model_t *m) {
|
|||
m->uniforms[MODEL_UNIFORM_RESOLUTION] = loc;
|
||||
}
|
||||
|
||||
void model_shading(model_t *m, int shading) {
|
||||
void model_shading_custom(model_t *m, int shading, const char *vs, const char *fs, const char *defines) {
|
||||
m->shading = shading;
|
||||
int flags = m->stored_flags;
|
||||
|
||||
|
@ -21470,18 +21470,30 @@ void model_shading(model_t *m, int shading) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!vs) {
|
||||
vs = vfs_read("shaders/vs_323444143_16_3322_model.glsl");
|
||||
}
|
||||
|
||||
if (!fs) {
|
||||
fs = vfs_read("shaders/fs_32_4_model.glsl");
|
||||
}
|
||||
|
||||
// rebind shader
|
||||
// @fixme: app crashes rn
|
||||
// glUseProgram(0);
|
||||
// glDeleteProgram(m->program);
|
||||
const char *symbols[] = { "{{include-shadowmap}}", vfs_read("shaders/fs_0_0_shadowmap_lit.glsl") }; // #define RIM
|
||||
int shaderprog = shader(strlerp(1,symbols,vfs_read("shaders/vs_323444143_16_3322_model.glsl")), strlerp(1,symbols,vfs_read("shaders/fs_32_4_model.glsl")), //fs,
|
||||
int shaderprog = shader(strlerp(1,symbols,vs), strlerp(1,symbols,fs), //fs,
|
||||
"att_position,att_texcoord,att_normal,att_tangent,att_instanced_matrix,,,,att_indexes,att_weights,att_vertexindex,att_color,att_bitangent,att_texcoord2","fragColor",
|
||||
va("%s,%s", shading == SHADING_PBR ? "SHADING_PBR" : shading == SHADING_VERTEXLIT ? "SHADING_VERTEXLIT" : "SHADING_PHONG", (flags&MODEL_RIMLIGHT)?"RIM":""));
|
||||
va("%s,%s,%s", defines ? defines : "NO_CUSTOM_DEFINES", shading == SHADING_PBR ? "SHADING_PBR" : shading == SHADING_VERTEXLIT ? "SHADING_VERTEXLIT" : "SHADING_PHONG", (flags&MODEL_RIMLIGHT)?"RIM":""));
|
||||
m->program = shaderprog;
|
||||
model_init_uniforms(m);
|
||||
}
|
||||
|
||||
void model_shading(model_t *m, int shading) {
|
||||
model_shading_custom(m, shading, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void model_skybox(model_t *mdl, skybox_t sky, bool load_sh) {
|
||||
if (load_sh) {
|
||||
shader_vec3v("u_coefficients_sh", 9, sky.cubemap.sh);
|
||||
|
|
|
@ -3753,6 +3753,7 @@ API float model_animate_blends(model_t m, anim_t *primary, anim_t *secondary,
|
|||
API aabb model_aabb(model_t, mat44 transform);
|
||||
API void model_lod(model_t*, float lo_detail, float hi_detail, float morph);
|
||||
API void model_shading(model_t*, int shading);
|
||||
API void model_shading_custom(model_t*, int shading, const char *vs, const char *fs, const char *defines);
|
||||
API void model_skybox(model_t*, skybox_t sky, bool load_sh);
|
||||
API void model_render(model_t, mat44 proj, mat44 view, mat44 model, int shader);
|
||||
API void model_render_skeleton(model_t, mat44 model);
|
||||
|
|
Loading…
Reference in New Issue