1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-30 03:50:34 +00:00

more triangles shown in 3D textures

This commit is contained in:
Zeno Rogue 2019-04-13 13:04:41 +02:00
parent 1820919095
commit d7406af1df

View File

@ -461,8 +461,7 @@ void texture_config::finish_mapping() {
tinf3.tvertices.clear(); tinf3.tvertices.clear();
tinf3.texture_id = config.data.textureid; tinf3.texture_id = config.data.textureid;
if(isize(texture_map) && isize(texture_map.begin()->second.triangles)) { if(isize(texture_map) && isize(texture_map.begin()->second.triangles)) {
auto& tri = texture_map.begin()->second.triangles[0]; auto& tris = texture_map.begin()->second.triangles;
auto& tv = tri.tv;
const int STEP = TEXTURE_STEP_3D; const int STEP = TEXTURE_STEP_3D;
using namespace hyperpoint_vec; using namespace hyperpoint_vec;
@ -474,9 +473,10 @@ void texture_config::finish_mapping() {
for(int a=0; a<8; a++) for(int a=0; a<8; a++)
for(int y=0; y<STEP; y++) for(int y=0; y<STEP; y++)
for(int x=0; x<STEP; x++) { for(int x=0; x<STEP; x++) {
hyperpoint center = tv[0]; auto& tri = tris[a % isize(tris)];
hyperpoint v1 = (tv[1] - center) / STEP; hyperpoint center = tri.tv[0];
hyperpoint v2 = (tv[2] - center) / STEP; hyperpoint v1 = (tri.tv[1] - center) / STEP;
hyperpoint v2 = (tri.tv[2] - center) / STEP;
if(x+y < STEP) { if(x+y < STEP) {
at(center + v1 * x + v2 * y, 0); at(center + v1 * x + v2 * y, 0);
at(center + v1 * (x+1) + v2 * y, 1); at(center + v1 * (x+1) + v2 * y, 1);