jigsaw puzzles variants
This commit is contained in:
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
import { Color, Group, EventDispatcher, DoubleSide } from "three"
|
import { Color, Group, EventDispatcher, DoubleSide, RepeatWrapping } from "three"
|
||||||
import { centerOrigin } from "@/lib/MeshUtils";
|
import { centerOrigin } from "@/lib/MeshUtils";
|
||||||
|
|
||||||
class ClassicPuzzle extends EventDispatcher {
|
class ClassicPuzzle extends EventDispatcher {
|
||||||
@@ -8,7 +8,8 @@ class ClassicPuzzle extends EventDispatcher {
|
|||||||
const container = new Group();
|
const container = new Group();
|
||||||
const that = this;
|
const that = this;
|
||||||
return new Promise(async (resolve, reject)=>{
|
return new Promise(async (resolve, reject)=>{
|
||||||
let gltf = await engine.load('puzzle-5x4/puzzle-5x4.gltf', '/static/meshes/');
|
let gltf = await engine.load('puzzle-3x3.glb', '/static/meshes/classic-puzzle/');
|
||||||
|
let map = await engine.loadTexture(data.$go.asset.name);
|
||||||
let dragZone = gltf.scene.getObjectByName('DragZone');
|
let dragZone = gltf.scene.getObjectByName('DragZone');
|
||||||
dragZone.material.side = DoubleSide;
|
dragZone.material.side = DoubleSide;
|
||||||
let eventsFn= {
|
let eventsFn= {
|
||||||
@@ -47,7 +48,14 @@ class ClassicPuzzle extends EventDispatcher {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
let defaultMaterial = container.children[0].material;
|
let defaultMaterial = container.children[0].material;
|
||||||
|
map.wrapS = RepeatWrapping;
|
||||||
|
map.wrapT = RepeatWrapping;
|
||||||
|
map.flipY = false;
|
||||||
|
defaultMaterial.map = map;
|
||||||
|
console.log(map )
|
||||||
|
map.needsUpdate = true;
|
||||||
defaultMaterial.emissiveIntensity=.05
|
defaultMaterial.emissiveIntensity=.05
|
||||||
|
console.log(defaultMaterial);
|
||||||
let doneMaterial = defaultMaterial.clone();
|
let doneMaterial = defaultMaterial.clone();
|
||||||
doneMaterial.emissive = new Color(10,114,10);
|
doneMaterial.emissive = new Color(10,114,10);
|
||||||
defaultMaterial.emissive = new Color(114,10,10);
|
defaultMaterial.emissive = new Color(114,10,10);
|
||||||
|
|||||||
Reference in New Issue
Block a user