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.
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.
I have same result now…hm 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?
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.
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.