MetaCore/build_filament/shaders/minified/surface_instancing.glsl

43 lines
1.5 KiB
GLSL

highp mat4 object_uniforms_worldFromModelMatrix;
highp mat3 object_uniforms_worldFromModelNormalMatrix;
highp int object_uniforms_morphTargetCount;
highp int object_uniforms_flagsChannels;
highp int object_uniforms_objectId;
highp float object_uniforms_userData;
void initObjectUniforms() {
#if defined(FILAMENT_HAS_FEATURE_INSTANCING)
highp int i;
# if defined(MATERIAL_HAS_INSTANCES)
if ((objectUniforms.data[0].flagsChannels & FILAMENT_OBJECT_INSTANCE_BUFFER_BIT) != 0) {
i = logical_instance_index;
} else {
i = 0;
}
# else
i = logical_instance_index;
# endif
#else
const int i = 0;
#endif
object_uniforms_worldFromModelMatrix = objectUniforms.data[i].worldFromModelMatrix;
object_uniforms_worldFromModelNormalMatrix = objectUniforms.data[i].worldFromModelNormalMatrix;
object_uniforms_morphTargetCount = objectUniforms.data[i].morphTargetCount;
object_uniforms_flagsChannels = objectUniforms.data[i].flagsChannels;
object_uniforms_objectId = objectUniforms.data[i].objectId;
object_uniforms_userData = objectUniforms.data[i].userData;
}
#if defined(FILAMENT_HAS_FEATURE_INSTANCING) && defined(MATERIAL_HAS_INSTANCES)
highp int getInstanceIndex() {
return logical_instance_index;
}
#endif
#if CLIENT_MATERIAL_API_LEVEL >= UNSTABLE_MATERIAL_API_LEVEL
highp mat4 getWorldFromModelMatrix() {
return object_uniforms_worldFromModelMatrix;
}
highp mat3 getWorldFromModelNormalMatrix() {
return object_uniforms_worldFromModelNormalMatrix;
}
#endif