OnGe Posted October 10, 2015 Share Posted October 10, 2015 Im learning how Loader and TextureCache works in order to figure out some optimal way to load resources. Unfortunaly, cant find much useful info about this topic. Anybody know where to look? Or care to give little insight? Quote Link to comment Share on other sites More sharing options...
xerver Posted October 10, 2015 Share Posted October 10, 2015 Here is the loader: https://github.com/englercj/resource-loader The code is really well documented, and there are examples on the readme. The pixi examples also use the loader a few times: http://pixijs.github.io/examples/ The TextureCache is an internal mechanism, there is rarely any reason you should even know it exists. Quote Link to comment Share on other sites More sharing options...
OnGe Posted October 11, 2015 Author Share Posted October 11, 2015 Thanks, but Im not looking for API docs or simple use cases, what I need is some wider context. Like what is for what and why, how it works and so on - stuff that may seem obvious, if you already know it, but is not quite obvious if you dont. TextureCache is good example - first I think it may help me with performance. Now it looks like its transparent and I can hardly make some more with it. Quote Link to comment Share on other sites More sharing options...
xerver Posted October 11, 2015 Share Posted October 11, 2015 Thanks, but Im not looking for API docs or simple use cases, what I need is some wider context. Like what is for what and why, how it works and so on - stuff that may seem obvious, if you already know it, but is not quite obvious if you dont. TextureCache is good example - first I think it may help me with performance. Now it looks like its transparent and I can hardly make some more with it. I'm honestly not sure what you are looking for, there aren't really "complex" usages of the loader. You add resources to it, and then you load them, and then you use them. Thats really all there is to it. What are you trying to do that you are having trouble with? As for texture cache, it is a place where textures are placed internally when you use convience methods (.fromImage()) and loader methods, so that next time you do a convience method (.fromImage()) it pulls from cache and doesn't make a request. Thats all its for as well. I'm not sure what to say, because I'm not sure what you want. Aside from writing custom middleware, I don't know what else there is to show off besides what is in the examples. Quote Link to comment Share on other sites More sharing options...
OnGe Posted October 11, 2015 Author Share Posted October 11, 2015 What Im trying to get here is some deeper understanding of how this stuff works, because (besides that deeper understanding is always good thing) I had some problems with my experiments (involving relatively big images, color matrix and other funny things) like crushing mobile browsers, cropping parts of images that are out of screen initialy and many other wtf things that I atribute to some internal optimization. But Im not sure if it is on pixi, browser, WebGL or whatever else. And maybe Im totally wrong at all. And to figure it out, I seek some deeper insight. Anyway, I was looking at TextureCache because I got idea to somehow turn scene made of many sprites into one static cached image to save resources. And maybe save that composed image to localStorage and load it instead of parts next time. Meanwhile I have found that this may make things even worse. And, as you say, TextureCache is something completely different than what I want. If it is really that simple, then Im looking to wrong things...and also there is not much deeper understanding to get on this Thanks for clarifying. Quote Link to comment Share on other sites More sharing options...
xerver Posted October 11, 2015 Share Posted October 11, 2015 Yeah the loader just sends a network request, parses the result, and then gives it to you. That's all. The code is super simple, and very well documented. If you want a deep understanding of how anything works, the best way to do it is to read the code. Pixi and the modules it uses are all open source. Just crack them open and start reading. Feel free to ask any questions you have here. 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.