Flip scale interpretation for textures

This commit is contained in:
Tony Garnock-Jones 2023-01-09 15:44:43 +01:00
parent 732242bfb6
commit fac2a32cc4
4 changed files with 6 additions and 6 deletions

2
TODO
View File

@ -3,7 +3,7 @@ portals to other scenes
✓ touch events/interactions
✓ motion with xr without a controller
make texture scaling divide instead of multiply. multiply is more sensible for thinking about
make texture scaling divide instead of multiply. multiply is more sensible for thinking about
scaling, but divide makes sense in terms of scaling the *object* the texture is applied to. a
1mx1m texture on a 10mx10m surface is easier to scale if you say "10x10", like "10 repeats x 10
repeats" rather than "0.1x0.1" i.e. "make one repeat a tenth of the size of the surface"

View File

@ -4,7 +4,7 @@
<sprite "ground"
<texture ["textures/grass-256x256.jpg"
<v 0.01 0.01>
<v 100.0 100.0>
<v 0.0 0.0>]
<floor <ground <v 300.0 300.0>>>>>
@ -12,7 +12,7 @@
<move <v -6.0 1.0 8.0>
<scale <v 10.0 0.1 10.0>
<texture ["textures/oak-herringbone-5e80fb40b00c9-1200.jpg"
<v 0.1 0.1>
<v 10.0 10.0>
<v 0.0 0.0>
0.75]
<floor <box>>>>>>

View File

@ -3,7 +3,7 @@
<sprite "ground2"
<texture ["textures/oak-herringbone-5e80fb40b00c9-1200.jpg"
<v 0.01 0.01>
<v 100.0 100.0>
<v 0.0 0.0>]
<floor <ground <v 300.0 300.0>>>>>

View File

@ -149,8 +149,8 @@ function buildTexture(name: string, scene: Scene, spec: Shapes.TextureSpec): Cac
case "uv": {
const scale = v2(spec.scale);
const offset = v2(spec.offset);
tex.uScale = 1 / scale.x;
tex.vScale = 1 / scale.y;
tex.uScale = scale.x;
tex.vScale = scale.y;
tex.uOffset = offset.x;
tex.vOffset = offset.y;
break;