3Dlove Posted May 20, 2015 Share Posted May 20, 2015 Hi guys =D With Material, we can create a Materail and don't add it to scene.materials due to that : new BABYLON.Material(name, scene, doNotAdd)the 3rd arg is used for that. Is it possible to do the same with textures (and scene.textures) ?the same with StandardMaterial and MultiMaterial ?the same with StandardMaterial.clone(name) ? Thank you Quote Link to comment Share on other sites More sharing options...
RaananW Posted May 20, 2015 Share Posted May 20, 2015 Looking at the source code, it is not used anywhere. I wonder why it is actually there. If I may ask - Why would you want to create a texture and not add it to the scene? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted May 20, 2015 Share Posted May 20, 2015 I guess it's only for it to be created in memory for future use. Quote Link to comment Share on other sites More sharing options...
3Dlove Posted May 20, 2015 Author Share Posted May 20, 2015 I don't understand RaananW :there are these code lines here : if (!doNotAdd) { scene.materials.push(this); }Good question :I've notice that sometimes I create and use Textures and they are in the array "scene.textures" ; and sometimes they don't ;whereas they are showed at screen (I don't why they aren't in the array),I ask this question because it take may be less RAM memory if the texture isn't in this array. I think dad72 has right : it is added to the array in the unique aim to access it later Quote Link to comment Share on other sites More sharing options...
RaananW Posted May 20, 2015 Share Posted May 20, 2015 What I meant was that this parameter is not used by any class that extends the material class. The material class is never used directly. Much like an abstract class. Check the constructor of the extended classes, they never call the full constructor of the material class.JavaScript uses references when storing objects in arrays, so no ram will be saved as well... dsman 1 Quote Link to comment Share on other sites More sharing options...
3Dlove Posted July 15, 2015 Author Share Posted July 15, 2015 Ok, so that is useless to implement it (doNotAdd) for textures Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.