From bd16e0549e1edd8fafe1b3253981f99d0792460f Mon Sep 17 00:00:00 2001 From: CJSatnarine Date: Mon, 3 Mar 2025 12:31:31 -0500 Subject: [PATCH] colour the wireframe --- dist/assets/{index-BvvhR7ed.js => index-BKnEQclW.js} | 2 +- dist/index.html | 2 +- main.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) rename dist/assets/{index-BvvhR7ed.js => index-BKnEQclW.js} (99%) diff --git a/dist/assets/index-BvvhR7ed.js b/dist/assets/index-BKnEQclW.js similarity index 99% rename from dist/assets/index-BvvhR7ed.js rename to dist/assets/index-BKnEQclW.js index 9cbb8f9..60d7527 100644 --- a/dist/assets/index-BvvhR7ed.js +++ b/dist/assets/index-BKnEQclW.js @@ -3828,4 +3828,4 @@ void main() { `)!==-1&&(e=e.replace(/\r\n/g,` `)),e.indexOf(`\\ `)!==-1&&(e=e.replace(/\\\n/g,""));const n=e.split(` -`);let r=[];for(let o=0,l=n.length;o=7?(Qi.setRGB(parseFloat(h[4]),parseFloat(h[5]),parseFloat(h[6]),bt),t.colors.push(Qi.r,Qi.g,Qi.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));break;case"vt":t.uvs.push(parseFloat(h[1]),parseFloat(h[2]));break}}else if(u==="f"){const d=c.slice(1).trim().split(co),m=[];for(let x=0,p=d.length;x0){const b=f.split("/");m.push(b)}}const g=m[0];for(let x=1,p=m.length-1;x1){const d=r[1].trim().toLowerCase();t.object.smooth=d!=="0"&&d!=="off"}else t.object.smooth=!0;const h=t.object.currentMaterial();h&&(h.smooth=t.object.smooth)}else{if(c==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+c+'"')}}t.finalize();const s=new _i;if(s.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let o=0,l=t.objects.length;o0&&x.setAttribute("normal",new gt(u.normals,3)),u.colors.length>0&&(g=!0,x.setAttribute("color",new gt(u.colors,3))),u.hasUVIndices===!0&&x.setAttribute("uv",new gt(u.uvs,2));const p=[];for(let b=0,T=h.length;b1){for(let b=0,T=h.length;b0){const o=new gi({size:1,sizeAttenuation:!1}),l=new Gt;l.setAttribute("position",new gt(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(l.setAttribute("color",new gt(t.colors,3)),o.vertexColors=!0);const c=new kr(l,o);s.add(c)}return s}}const xp="/assets/head-DD9xLfml.obj",Js=new dc,Wo=new Lt(75,window.innerWidth/window.innerHeight,.1,1e3),mr=new fp;mr.setSize(window.innerWidth,window.innerHeight);mr.setAnimationLoop(Ep);document.body.appendChild(mr.domElement);Wo.position.z=3;const Mp=new Ac(16777147,526368,1);Js.add(Mp);const Sp=new vp;Sp.load(xp,function(i){console.log(i),i.traverse(e=>{e instanceof Dt&&(console.log(e.geometry),console.log("is instance of mesh"),e.material=new gc({color:9842686}),e.material.wireframe=!0)}),Js.add(i)},function(i){console.log(i.loaded/i.total*100+"% loaded")},function(i){console.log("an error happened",i)});function Ep(){mr.render(Js,Wo)} +`);let r=[];for(let o=0,l=n.length;o=7?(Qi.setRGB(parseFloat(h[4]),parseFloat(h[5]),parseFloat(h[6]),bt),t.colors.push(Qi.r,Qi.g,Qi.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]));break;case"vt":t.uvs.push(parseFloat(h[1]),parseFloat(h[2]));break}}else if(u==="f"){const d=c.slice(1).trim().split(co),m=[];for(let x=0,p=d.length;x0){const b=f.split("/");m.push(b)}}const g=m[0];for(let x=1,p=m.length-1;x1){const d=r[1].trim().toLowerCase();t.object.smooth=d!=="0"&&d!=="off"}else t.object.smooth=!0;const h=t.object.currentMaterial();h&&(h.smooth=t.object.smooth)}else{if(c==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+c+'"')}}t.finalize();const s=new _i;if(s.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let o=0,l=t.objects.length;o0&&x.setAttribute("normal",new gt(u.normals,3)),u.colors.length>0&&(g=!0,x.setAttribute("color",new gt(u.colors,3))),u.hasUVIndices===!0&&x.setAttribute("uv",new gt(u.uvs,2));const p=[];for(let b=0,T=h.length;b1){for(let b=0,T=h.length;b0){const o=new gi({size:1,sizeAttenuation:!1}),l=new Gt;l.setAttribute("position",new gt(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(l.setAttribute("color",new gt(t.colors,3)),o.vertexColors=!0);const c=new kr(l,o);s.add(c)}return s}}const xp="/assets/head-DD9xLfml.obj",Js=new dc,Wo=new Lt(75,window.innerWidth/window.innerHeight,.1,1e3),mr=new fp;mr.setSize(window.innerWidth,window.innerHeight);mr.setAnimationLoop(Ep);document.body.appendChild(mr.domElement);Wo.position.z=3;const Mp=new Ac(16777147,526368,1);Js.add(Mp);const Sp=new vp;Sp.load(xp,function(i){console.log(i),i.traverse(e=>{e instanceof Dt&&(e.material=new gc({color:9842686}),e.material.wireframe=!0,e.material.wireframeLinewidth=1,e.material.emissive=new De().setHex(9842686))}),Js.add(i)},function(i){console.log(i.loaded/i.total*100+"% loaded")},function(i){console.log("an error happened",i)});function Ep(){mr.render(Js,Wo)} diff --git a/dist/index.html b/dist/index.html index d119cc0..002ccb1 100644 --- a/dist/index.html +++ b/dist/index.html @@ -11,7 +11,7 @@ } - + diff --git a/main.js b/main.js index 68bfdac..43fec3f 100644 --- a/main.js +++ b/main.js @@ -26,12 +26,12 @@ objectLoader.load( console.log(object); object.traverse((child) => { - // Apparently instanceof is a curse. if (child instanceof THREE.Mesh) { - console.log(child.geometry); - console.log('is instance of mesh'); + // Create material for the mesh. child.material = new THREE.MeshStandardMaterial({color: 0x962FFE}); child.material.wireframe = true; + child.material.wireframeLinewidth = 1; + child.material.emissive = (new THREE.Color().setHex(0x962FFE)); } });