mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
ContentGfxCache
This commit is contained in:
parent
bf4ad5ca58
commit
d92347097e
14 changed files with 86 additions and 51 deletions
26
src/frontend/ContentGfxCache.cpp
Normal file
26
src/frontend/ContentGfxCache.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "ContentGfxCache.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../assets/Assets.h"
|
||||
#include "../content/Content.h"
|
||||
#include "../graphics/Atlas.h"
|
||||
#include "../voxels/Block.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
ContentGfxCache::ContentGfxCache(const Content* content, Assets* assets) {
|
||||
const ContentIndices* contentIds = content->indices;
|
||||
sideregions = new UVRegion[contentIds->countBlockDefs() * 6];
|
||||
Atlas* atlas = assets->getAtlas("blocks");
|
||||
|
||||
for (uint i = 0; i < contentIds->countBlockDefs(); i++) {
|
||||
Block* def = contentIds->getBlockDef(i);
|
||||
for (uint side = 0; side < 6; side++) {
|
||||
string tex = def->textureFaces[side];
|
||||
if (atlas->has(tex)) {
|
||||
sideregions[i * 6 + side] = atlas->get(tex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue