mirror of
https://github.com/devZoGok/vb01.git
synced 2026-08-27 03:53:24 +00:00
factored out texture GPU data loading
improved texture buffer and layer retrieval using draw commands 1:1 with meshes
This commit is contained in:
+4
-7
@@ -17,15 +17,12 @@ namespace vb01{
|
||||
|
||||
Asset* ImageReader::readAsset(string path){
|
||||
stbi_set_flip_vertically_on_load(flip);
|
||||
int width, height, numChannels, layerId;
|
||||
int width, height, numChannels, bufferId, layerId;
|
||||
u8 *data = stbi_load(path.c_str(), &width, &height, &numChannels, 0);
|
||||
|
||||
if(loadToGpu){
|
||||
Root *root = Root::getSingleton();
|
||||
u32 *texBuffer = (sceneImage ? root->getMeshTextureBuffer() : root->getGuiTextureBuffer());
|
||||
root->initTextureDataOnGpu(texBuffer, data, width, height, layerId);
|
||||
}
|
||||
if(loadToGpu)
|
||||
Root::getSingleton()->initTextureDataOnGpu(data, width, height, bufferId, layerId, sceneImage);
|
||||
|
||||
return new ImageAsset(path, data, width, height, numChannels, layerId);
|
||||
return new ImageAsset(path, data, width, height, numChannels, bufferId, layerId, loadToGpu);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user