diff --git a/bind/v4k.lua b/bind/v4k.lua index 05b793a..547fe29 100644 --- a/bind/v4k.lua +++ b/bind/v4k.lua @@ -1333,6 +1333,7 @@ enum MODEL_FLAGS { MODEL_NO_FILTERING = 8, MODEL_MATCAPS = 16, MODEL_RIMLIGHT = 32, + MODEL_PBR = 64, }; enum SHADING_MODE { SHADING_NONE, diff --git a/demos/06-material.c b/demos/06-material.c index 67aec06..00256c0 100644 --- a/demos/06-material.c +++ b/demos/06-material.c @@ -20,8 +20,7 @@ int main() { // load model model_t m1 = model("suzanne.obj", MODEL_NO_ANIMATIONS); model_t m2 = model("suzanne.obj", MODEL_NO_ANIMATIONS|MODEL_MATCAPS); - model_t m3 = model("damagedhelmet.gltf", MODEL_NO_ANIMATIONS); - model_shading(&m3, SHADING_PBR); + model_t m3 = model("damagedhelmet.gltf", MODEL_NO_ANIMATIONS|MODEL_PBR); // spawn object1 (diffuse) object_t* obj1 = scene_spawn(); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 09c01c9..edcd68d 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -17563,6 +17563,7 @@ enum MODEL_FLAGS { MODEL_NO_FILTERING = 8, MODEL_MATCAPS = 16, MODEL_RIMLIGHT = 32, + MODEL_PBR = 64, }; enum SHADING_MODE { @@ -373565,6 +373566,9 @@ model_t model_from_mem(const void *mem, int len, int flags) { glGenBuffers(1, &m.vao_instanced); model_set_state(m); + if (flags & MODEL_PBR) { + model_shading(&m, SHADING_PBR); + } } return m; } diff --git a/engine/split/v4k_render.c b/engine/split/v4k_render.c index 93cbb41..6940a77 100644 --- a/engine/split/v4k_render.c +++ b/engine/split/v4k_render.c @@ -3538,6 +3538,9 @@ model_t model_from_mem(const void *mem, int len, int flags) { glGenBuffers(1, &m.vao_instanced); model_set_state(m); + if (flags & MODEL_PBR) { + model_shading(&m, SHADING_PBR); + } } return m; } diff --git a/engine/split/v4k_render.h b/engine/split/v4k_render.h index 4ad3f23..9947fec 100644 --- a/engine/split/v4k_render.h +++ b/engine/split/v4k_render.h @@ -541,6 +541,7 @@ enum MODEL_FLAGS { MODEL_NO_FILTERING = 8, MODEL_MATCAPS = 16, MODEL_RIMLIGHT = 32, + MODEL_PBR = 64, }; enum SHADING_MODE { diff --git a/engine/v4k.c b/engine/v4k.c index 3c4a64d..285bc81 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -20712,6 +20712,9 @@ model_t model_from_mem(const void *mem, int len, int flags) { glGenBuffers(1, &m.vao_instanced); model_set_state(m); + if (flags & MODEL_PBR) { + model_shading(&m, SHADING_PBR); + } } return m; } diff --git a/engine/v4k.h b/engine/v4k.h index 04cab9e..ca6d536 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -3630,6 +3630,7 @@ enum MODEL_FLAGS { MODEL_NO_FILTERING = 8, MODEL_MATCAPS = 16, MODEL_RIMLIGHT = 32, + MODEL_PBR = 64, }; enum SHADING_MODE {