mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 04:51:49 +00:00
update target texture detection
This commit is contained in:
parent
8a05541a9e
commit
908fbc895e
1 changed files with 9 additions and 1 deletions
|
|
@ -30,13 +30,21 @@ void BlockWrapsRenderer::draw(const BlockWrapper& wrapper) {
|
||||||
shader.uniform1i("u_alphaClip", false);
|
shader.uniform1i("u_alphaClip", false);
|
||||||
|
|
||||||
util::TextureRegion texRegions[6] {};
|
util::TextureRegion texRegions[6] {};
|
||||||
|
const Texture* texture = nullptr;
|
||||||
UVRegion uvRegions[6] {};
|
UVRegion uvRegions[6] {};
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
|
if (wrapper.cullingBits & (1 << i) == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
auto texRegion = util::get_texture_region(assets, wrapper.textureFaces[i], "");
|
auto texRegion = util::get_texture_region(assets, wrapper.textureFaces[i], "");
|
||||||
texRegions[i] = texRegion;
|
texRegions[i] = texRegion;
|
||||||
uvRegions[i] = texRegion.region;
|
uvRegions[i] = texRegion.region;
|
||||||
|
|
||||||
|
if (texture == nullptr) {
|
||||||
|
texture = texRegion.texture;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
batch->setTexture(texRegions[0].texture);
|
batch->setTexture(texture);
|
||||||
|
|
||||||
const voxel* vox = chunks.get(wrapper.position);
|
const voxel* vox = chunks.get(wrapper.position);
|
||||||
if (vox == nullptr || vox->id == BLOCK_VOID) {
|
if (vox == nullptr || vox->id == BLOCK_VOID) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue