Browse Source

fix rendered texture side

Falko Schindler 2 years ago
parent
commit
208fcfbdc2
2 changed files with 5 additions and 4 deletions
  1. 3 2
      main.py
  2. 2 2
      nicegui/elements/scene.js

+ 3 - 2
main.py

@@ -284,10 +284,11 @@ with example(ui.scene):
             scene.box(wireframe=True).material('#888888').move(x=2, y=2)
 
         scene.line([-4, 0, 0], [-4, 2, 0]).material('#ff0000')
-        scene.curve([-4, -2, 0], [-4, -1, 0], [-3, -1, 0], [-3, 0, 0]).material('#008800')
+        scene.curve([-4, 0, 0], [-4, -1, 0], [-3, -1, 0], [-3, -2, 0]).material('#008800')
 
         logo = "https://avatars.githubusercontent.com/u/2843826"
-        scene.texture(logo, [[[0, 3, 0], [3, 3, 0]], [[0, 0, 0], [3, 0, 0]]]).move(1, -2)
+        scene.texture(logo, [[[0.5, 2, 0], [2.5, 2, 0]],
+                             [[0.5, 0, 0], [2.5, 0, 0]]]).move(1, -2)
 
         teapot = 'https://upload.wikimedia.org/wikipedia/commons/9/93/Utah_teapot_(solid).stl'
         scene.stl(teapot).scale(0.2).move(-3, 4)

+ 2 - 2
nicegui/elements/scene.js

@@ -32,8 +32,8 @@ function texture_geometry(coords) {
         const idx10 = i + j * nI + 1;
         const idx01 = i + j * nI + nI;
         const idx11 = i + j * nI + 1 + nI;
-        indices.push(idx00, idx10, idx01);
-        indices.push(idx10, idx11, idx01);
+        indices.push(idx10, idx00, idx01);
+        indices.push(idx11, idx10, idx01);
       }
     }
   }