Simple function PushMaterial.prototyp.isReady

Hi! I ask for advice and clarification about simple isReady function for Materials.

In playground we have simple baypass:

function(e,t){return!0} ,

alltime return true, but in npm-package we have little bit more (cover for isReadyForSubMesh):

PushMaterial.prototype.isReady = function (mesh, useInstances) {
if (!mesh) {
return false;
if (!mesh.subMeshes || mesh.subMeshes.length === 0) {
return true;
return this.isReadyForSubMesh(mesh, mesh.subMeshes[0], useInstances);

who has means only with the parameters.

Question 1: What check isReady, what mean, if i get true?
Question 2: Why is difference between babylon on playground and npm. Perhaps because 4.1 and 4.2 version, but i see this difference and later. And if in modern version (4.2) we have bypass… look on Question 1 )))

Please help - i think it must be usefull function and important to understand how mean she carries.

Thank, for you any answer or advices!

I do get the same function in the Playground than in npm (a bit obfuscated by the packager):

This function returns true when the material is ready to be used to render the submesh passed in parameter. That means all textures are loaded, the shader programs are compiled, etc.

Evgeni, hello, and thanks for trying help!

I have same result now…hm :dizzy_face: but how i get other value yesterday…

Anyway, in my post it function is not obsfucated. Let’s look on code:
if not defined mesh parameter - function return FALSE and not check shaders, loaded and anything else.

let myMaterial = new BABYLON.StandardMaterial('someMat',scene); alert (myMaterial.isReady());

ALWAYS return false and do not any checking operations. Someting wrong i think… No?

It is not ready right away because the shaders are compiled in parallel : try to put the alert in a window.setTimeout call

in this case it dosen’t matter. Take a look, please:

call from callstack or from task queue - function the same
And we can set any waiting time - isReady() without parameters always will return FALSE

Which is expected as a push material can only be ready for a mesh. The effect info in this case are stored on the mesh for cashing purpose and state can change from one mesh to the other.


Thanks for light in dark place! ))

When, perhaps will be cool, rename method to isReadyForMesh.
isReady induce think as i was think and @Evgeni_Popov wrote. Some like readyness shader, textures, somthing else in same material context.
Not conceptual ) Thank you.

Yup it has been kept for mainly backcompat and we internally rely on isReadyForSubMesh :wink: