From 62214a26e10044a53ca796da1d81223e557bdc5e Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 20 Aug 2019 12:57:05 +0200 Subject: [PATCH] fixed the bug with black creatures in 3D --- 3d-models.cpp | 2 -- floorshapes.cpp | 2 ++ geometry.cpp | 8 ++++++++ textures.cpp | 5 ----- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/3d-models.cpp b/3d-models.cpp index 6f0c9273..9f6cf3b6 100644 --- a/3d-models.cpp +++ b/3d-models.cpp @@ -113,8 +113,6 @@ void geometry_information::shift_shape_orthogonally(hpcshape& sh, ld z) { extern renderbuffer *floor_textures; -basic_textureinfo models_texture; - void geometry_information::add_texture(hpcshape& sh) { if(!floor_textures) return; auto& utt = models_texture; diff --git a/floorshapes.cpp b/floorshapes.cpp index 9f4eaae8..94542b6e 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -1045,6 +1045,8 @@ EX void make_floor_textures() { dynamicval vgp(global_projection, 0); check_cgi(); cgi.make_floor_textures_here(); + /* update texture ID in existing cgi's */ + for(auto& c: cgis) c.second.models_texture.texture_id = floor_textures->renderedTexture; } diff --git a/geometry.cpp b/geometry.cpp index 531053ab..609d23ff 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -79,6 +79,11 @@ struct escher_floorshape : floorshape { ld scale; }; +struct basic_textureinfo { + int texture_id; + vector tvertices; + }; + /** basic geometry parameters */ struct geometry_information { @@ -375,6 +380,9 @@ hpcshape int state; int usershape_state; + + /** contains the texture point coordinates for 3D models */ + basic_textureinfo models_texture; geometry_information() { last = NULL; state = usershape_state = 0; gpdata = NULL; } diff --git a/textures.cpp b/textures.cpp index 715fbbb4..0db574a2 100644 --- a/textures.cpp +++ b/textures.cpp @@ -15,11 +15,6 @@ struct texture_triangle { texture_triangle(array _v, array _tv) : v(_v), tv(_tv) {} }; -struct basic_textureinfo { - int texture_id; - vector tvertices; - }; - struct textureinfo : basic_textureinfo { transmatrix M; vector triangles;