|
|
@ -1,4 +1,4 @@
|
|
|
|
import { DoubleSide, MathUtils, MeshPhongMaterial, MeshPhysicalMaterial, MeshPhysicalMaterial2, RepeatWrapping, Texture } from "three";
|
|
|
|
import { DoubleSide, MathUtils, MeshPhongMaterial, MeshPhysicalMaterial, MeshPhysicalMaterial2, RepeatWrapping, Texture, Vector2 } from "three";
|
|
|
|
import { FBXLoader } from "three/examples/jsm/loaders/FBXLoader";
|
|
|
|
import { FBXLoader } from "three/examples/jsm/loaders/FBXLoader";
|
|
|
|
import { HostApplicationServices } from "../../ApplicationServices/HostApplicationServices";
|
|
|
|
import { HostApplicationServices } from "../../ApplicationServices/HostApplicationServices";
|
|
|
|
import { LoadImageFromUrl } from "../../Loader/ImageLoader";
|
|
|
|
import { LoadImageFromUrl } from "../../Loader/ImageLoader";
|
|
|
@ -147,7 +147,7 @@ export async function ConverMaterial2(m: MeshPhongMaterial, url: string)
|
|
|
|
mtl[U_WORLD_REP] = data[U_WORLD_REP] ?? 1;
|
|
|
|
mtl[U_WORLD_REP] = data[U_WORLD_REP] ?? 1;
|
|
|
|
mtl[V_WORLD_REP] = data[V_WORLD_REP] ?? 1;
|
|
|
|
mtl[V_WORLD_REP] = data[V_WORLD_REP] ?? 1;
|
|
|
|
|
|
|
|
|
|
|
|
mtl[U_WORLD_RO] = MathUtils.DEG2RAD * (data[U_WORLD_RO] ?? data[U_RO] ?? 0);
|
|
|
|
mtl[U_WORLD_RO] = -MathUtils.DEG2RAD * (data[U_WORLD_RO] ?? data[U_RO] ?? 0);
|
|
|
|
|
|
|
|
|
|
|
|
mtl[U_WORLD_MOVE] = data[U_WORLD_MOVE] ?? 0;
|
|
|
|
mtl[U_WORLD_MOVE] = data[U_WORLD_MOVE] ?? 0;
|
|
|
|
mtl[V_WORLD_MOVE] = data[V_WORLD_MOVE] ?? 0;
|
|
|
|
mtl[V_WORLD_MOVE] = data[V_WORLD_MOVE] ?? 0;
|
|
|
@ -155,20 +155,15 @@ export async function ConverMaterial2(m: MeshPhongMaterial, url: string)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
t.repeat.set(data[U_REP] ?? 1, data[V_REP] ?? 1);
|
|
|
|
t.repeat.set(data[U_REP] ?? 1, data[V_REP] ?? 1);
|
|
|
|
t.rotation = MathUtils.DEG2RAD * data[U_RO] ?? 0;
|
|
|
|
t.rotation = -MathUtils.DEG2RAD * data[U_RO] ?? 0;
|
|
|
|
if (data[U_MOVE] !== undefined)
|
|
|
|
//位移到中心0.5,0.5
|
|
|
|
t.offset.set(
|
|
|
|
t.offset.set((1 - t.repeat.x) * 0.5, (1 - t.repeat.y) * 0.5);
|
|
|
|
//1. 0.5 - rep *0.5 位移到中心0.5,0.5
|
|
|
|
if (data[U_MOVE] !== undefined || data[V_MOVE] !== undefined)
|
|
|
|
//2. 后面部分再次位移
|
|
|
|
{
|
|
|
|
0.5 - t.repeat.x * 0.5 + t.repeat.x * data[U_MOVE],
|
|
|
|
let off = new Vector2(t.repeat.x * (data[U_MOVE] ?? 0), -t.repeat.y * (data[V_MOVE] ?? 0));
|
|
|
|
0.5 - t.repeat.y * 0.5 - t.repeat.y * data[V_MOVE],
|
|
|
|
off.rotateAround(new Vector2(0, 0), -t.rotation);
|
|
|
|
);
|
|
|
|
t.offset.add(off);
|
|
|
|
else
|
|
|
|
}
|
|
|
|
t.offset.set(
|
|
|
|
|
|
|
|
//1. 0.5 - rep *0.5 位移到中心0.5,0.5
|
|
|
|
|
|
|
|
0.5 - t.repeat.x * 0.5,
|
|
|
|
|
|
|
|
0.5 - t.repeat.y * 0.5,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|