Alpha for textures

This commit is contained in:
Tony Garnock-Jones 2023-01-05 16:55:27 +01:00
parent 472a870b71
commit b23a340eb1
4 changed files with 11 additions and 2 deletions

View File

@ -20,6 +20,7 @@ Rotate = @euler <rotate @v Vector3 @shape Shape> / @quaternion <rotate @q Quater
Texture =
/ @simple <texture @path string @shape Shape>
/ @uv <texture @path string @scale Vector2 @offset Vector2 @shape Shape>
/ @uvAlpha <texture @path string @scale Vector2 @offset Vector2 @alpha double @shape Shape>
.
Color =

View File

@ -8,8 +8,13 @@
<floor <ground <v 30.0 30.0>>>>>
<sprite "box"
<move <v 1.0 1.5 3.0>
<texture "textures/grass-256x256.jpg" <floor <box>>>>>
<move <v 6.0 2.5 8.0>
<scale <v 10.0 0.1 10.0>
<texture "textures/oak-herringbone-5e80fb40b00c9-1200.jpg"
<v 0.1 0.1>
<v 0.0 0.0>
0.75
<floor <box>>>>>>
<sprite "box2"
<move <v -1.0 0.5 3.0>

View File

@ -194,6 +194,9 @@ export function build(name: string, scene: Scene, shape: Shapes.Shape, customize
switch (shape.value._variant) {
case "simple":
break;
case "uvAlpha":
mat.alpha = shape.value.alpha;
/* FALL THROUGH */
case "uv": {
const scale = v2(shape.value.scale);
const offset = v2(shape.value.offset);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB