wireframe works now, was traversing scene instead of object
This commit is contained in:
File diff suppressed because one or more lines are too long
2
dist/index.html
vendored
2
dist/index.html
vendored
@@ -11,7 +11,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script type="module" crossorigin src="/assets/index-C_ucNTj8.js"></script>
|
<script type="module" crossorigin src="/assets/index-BvvhR7ed.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
33
main.js
33
main.js
@@ -25,13 +25,13 @@ objectLoader.load(
|
|||||||
function(object) {
|
function(object) {
|
||||||
console.log(object);
|
console.log(object);
|
||||||
|
|
||||||
scene.traverse((object) => {
|
object.traverse((child) => {
|
||||||
if (object instanceof THREE.Mesh) {
|
// Apparently instanceof is a curse.
|
||||||
|
if (child instanceof THREE.Mesh) {
|
||||||
|
console.log(child.geometry);
|
||||||
console.log('is instance of mesh');
|
console.log('is instance of mesh');
|
||||||
object.material = new THREE.MeshStandardMaterial({color: 0x962FFE});
|
child.material = new THREE.MeshStandardMaterial({color: 0x962FFE});
|
||||||
object.material.wireframe = true;
|
child.material.wireframe = true;
|
||||||
} else {
|
|
||||||
console.log('not instance of mesh');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -41,10 +41,29 @@ objectLoader.load(
|
|||||||
console.log((xhr.loaded / xhr.total * 100) + '% loaded');
|
console.log((xhr.loaded / xhr.total * 100) + '% loaded');
|
||||||
},
|
},
|
||||||
function(error) {
|
function(error) {
|
||||||
console.log('an error happened');
|
console.log('an error happened', error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
renderer.render(scene, camera);
|
renderer.render(scene, camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user