Steps toward improved textures in turtle

This commit is contained in:
Tony Garnock-Jones 2023-02-14 22:02:32 +01:00
parent 4c618250fe
commit 1d30f3fc13
2 changed files with 82 additions and 80 deletions

View File

@ -38,6 +38,7 @@
<sprite "house" []
<move <v 0.0 0.0 10.0>
<rotate <v 0.0 0.0 0.0>
<texture ["textures/oak-herringbone-5e80fb40b00c9-1200.jpg"]
<turtle [
[
to [f]
@ -123,6 +124,6 @@
1.6 B [90 L [0.2 F [1 F] iDoor 1 F] draw] saved
1.4 B [90 R [2.3 F [0.7 F] iDoor 6.2 F [0.9 F] iDoor 1 F] draw] saved
]>
>>>
>>>>
[]

View File

@ -1,6 +1,5 @@
import {
Mesh,
MeshBuilder,
Plane,
Quaternion,
Ray,
@ -166,9 +165,11 @@ export class TurtleVM extends Cat.VM<TurtleVM> {
function pushPoint(pathIndex: number, stepIndex: number): number {
const pointIndex = positions.length / 3;
positions.push(... paths[pathIndex][stepIndex].asArray());
uvs.push(us[pathIndex][stepIndex] / uTotal[pathIndex],
vs[stepIndex][pathIndex] / vTotal[stepIndex]);
const p = paths[pathIndex][stepIndex];
positions.push(... p.asArray());
uvs.push((p.x - p.z) / 1.2, (p.y) / 0.9);
// uvs.push(us[pathIndex][stepIndex] / uTotal[pathIndex],
// vs[stepIndex][pathIndex] / vTotal[stepIndex]);
return pointIndex;
}