Spaces:
Running
Running
Julien Chaumond
commited on
Commit
•
9e5869b
1
Parent(s):
11526b7
Egg (.gltf)
Browse files
index.html
CHANGED
@@ -14,6 +14,7 @@
|
|
14 |
<script src="node_modules/three/examples/js/controls/OrbitControls.js"></script>
|
15 |
<script src="node_modules/three/examples/js/loaders/MTLLoader.js"></script>
|
16 |
<script src="node_modules/three/examples/js/loaders/OBJLoader.js"></script>
|
|
|
17 |
<script src="node_modules/three/examples/js/loaders/ColladaLoader.js"></script>
|
18 |
<script src="dist/lib/Log.js"></script>
|
19 |
<script src="dist/post/index.js"></script>
|
|
|
14 |
<script src="node_modules/three/examples/js/controls/OrbitControls.js"></script>
|
15 |
<script src="node_modules/three/examples/js/loaders/MTLLoader.js"></script>
|
16 |
<script src="node_modules/three/examples/js/loaders/OBJLoader.js"></script>
|
17 |
+
<script src="node_modules/three/examples/js/loaders/GLTFLoader.js"></script>
|
18 |
<script src="node_modules/three/examples/js/loaders/ColladaLoader.js"></script>
|
19 |
<script src="dist/lib/Log.js"></script>
|
20 |
<script src="dist/post/index.js"></script>
|
models/Egg_gltf/47d62527-e772-4a0a-b04a-d39b80e48cec.jpg
ADDED
Git LFS Details
|
models/Egg_gltf/Egg from Poly uovo copy.gltf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8093868ffa5e3266d1b7b275327344d16e07f64152590140131e052c0e0fa2e5
|
3 |
+
size 8171
|
models/Egg_gltf/Eggfrom Poly uovo copy.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e810b3f353665def47d0f3208b866a97ef85026472873092e273c7ec75a0fdaa
|
3 |
+
size 187920
|
src/index.ts
CHANGED
@@ -53,6 +53,18 @@ class Assets {
|
|
53 |
const materialCreator = await this.loadEggMtl();
|
54 |
return this.loadEggObj(materialCreator);
|
55 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
class Utils {
|
58 |
static boundingBox(o: THREE.Object3D): [THREE.Vector3, THREE.Vector3] {
|
@@ -92,7 +104,17 @@ class Utils {
|
|
92 |
// c.log(eggFace.material);
|
93 |
// (<THREE.MeshPhongMaterial>(eggFace.material)).color.set(0x000000);
|
94 |
}
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
// const geometry = new THREE.CylinderBufferGeometry( 0, 10, 30, 4, 1 );
|
98 |
// const material = new THREE.MeshPhongMaterial( { color: 0xffffff, flatShading: true } );
|
|
|
53 |
const materialCreator = await this.loadEggMtl();
|
54 |
return this.loadEggObj(materialCreator);
|
55 |
}
|
56 |
+
static loadEggGltf(): Promise<THREE.Scene> {
|
57 |
+
return new Promise((resolve, reject) => {
|
58 |
+
const loader: THREE.AnyLoader = new (<any>THREE).GLTFLoader();
|
59 |
+
loader.load(
|
60 |
+
`models/Egg_gltf/Egg from Poly uovo copy.gltf`,
|
61 |
+
(gltf) => {
|
62 |
+
c.log(gltf);
|
63 |
+
resolve(gltf.scene);
|
64 |
+
}
|
65 |
+
);
|
66 |
+
});
|
67 |
+
}
|
68 |
}
|
69 |
class Utils {
|
70 |
static boundingBox(o: THREE.Object3D): [THREE.Vector3, THREE.Vector3] {
|
|
|
104 |
// c.log(eggFace.material);
|
105 |
// (<THREE.MeshPhongMaterial>(eggFace.material)).color.set(0x000000);
|
106 |
}
|
107 |
+
{
|
108 |
+
const egg = await Assets.loadEggGltf();
|
109 |
+
c.log(egg);
|
110 |
+
egg.scale.setScalar(100);
|
111 |
+
egg.position.x = -10;
|
112 |
+
egg.remove(egg.getObjectByName('Camera')!);
|
113 |
+
scene.add(egg);
|
114 |
+
// c.log(Utils.boundingBox(egg));
|
115 |
+
const box = new THREE.BoxHelper(egg, new THREE.Color('red'));
|
116 |
+
scene.add(box);
|
117 |
+
}
|
118 |
|
119 |
// const geometry = new THREE.CylinderBufferGeometry( 0, 10, 30, 4, 1 );
|
120 |
// const material = new THREE.MeshPhongMaterial( { color: 0xffffff, flatShading: true } );
|