Temechon Posted April 5, 2015 Share Posted April 5, 2015 Hi, I want to get the texture size I'm loading with the AssetsManager : http://www.babylonjs-playground.com/#28QGCJ#2 In the onSuccess function, this does not work : console.log(task.texture.getBaseSize());But this works : setTimeout(function() { console.log(task.texture.getBaseSize());}, 1);Can you tell me why ? Thanks ! Quote Link to comment Share on other sites More sharing options...
fenomas Posted April 5, 2015 Share Posted April 5, 2015 Looks like it's because the texture's onload is triggered from here, but its _width and _basewidth and so forth aren't populated until a few lines later. Quote Link to comment Share on other sites More sharing options...
Temechon Posted April 5, 2015 Author Share Posted April 5, 2015 @fenomas Thank you. @DK, would it be possible to get these lines : texture._baseWidth = width;texture._baseHeight = height;texture._width = potWidth;texture._height = potHeight;texture.isReady = true;Before the processFunction in prepareWebGLTexture ?It solves my problem. If yes, I can submit a PR for this. Thanks. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 6, 2015 Share Posted April 6, 2015 No problem:) Quote Link to comment Share on other sites More sharing options...
Temechon Posted April 6, 2015 Author Share Posted April 6, 2015 Ok, PR done (very small one ) Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 6, 2015 Share Posted April 6, 2015 Nice find/fix, Temechon! This kind of bug is called a "wife bug". I don't have a wife, but... I know how it works. When a wife is scheduled to go somewhere with her husband... the husband will poll "Are you ready?" Wife: "Yes, I'm ready, I just need to do a couple more little things." So, the return from the isReady() call... ==> .75 BOOLEAN! (3/4 true) This continues for many more isReady() pollings, and eventually the caller forces wife.isReady = true; and then the program counter moves-on, isReady or not. But watch out for try/catch causing a raise(hell) error. jerome, valepu and Temechon 3 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.