function korpi(collor, laa,lbb,waa,wbb, he, x,y,z) { const a = 0, b = he, la=laa/2, lb=lbb/2, wa=waa/2, wb=wbb/2 const verticesOfCube = [ -la,-wa,a, la,-wa,a, la, wa,a, -la, wa,a, -lb,-wb,b, lb,-wb,b, lb, wb,b, -lb, wb,b, ]; const indicesOfFaces = [ 2,1,0, 0,3,2, 0,4,7, 7,3,0, 0,1,5, 5,4,0, 1,2,6, 6,5,1, 2,3,7, 7,6,2, 4,5,6, 6,7,4 ]; const geometry = new THREE.PolyhedronGeometry( verticesOfCube, indicesOfFaces, 2, 0 ); const material = new THREE.MeshPhongMaterial({ color: collor }); const mesh = new THREE.Mesh(geometry, material); //scene.add(mesh); mesh.position.x = x; mesh.position.y = y; mesh.position.z = z; return mesh; } cubeA=korpi(0xA38951, 17,17,5,5,4,0,0,0); cubeB=korpi(0xA38951, 5,5,17,17,4,0,0,0); cubeC=korpi(0x888888, 17,17,5,0,2,0,0,0.8); cubeD=korpi(0x888888, 5,0,17,17,2,0,0,0.8); function sylinteri(color,x,y,z,r,R,h,n) { const geometry = new THREE.CylinderGeometry( r, R, h, n ); const material = new THREE.MeshPhongMaterial( {color: 0xA38951} ); const cylinder = new THREE.Mesh( geometry, material ); cylinder.rotation.x=1.57; cylinder.position.x = x; cylinder.position.y = z; cylinder.position.z = y+0.5*h; return cylinder; } cyl1=sylinteri(0xA38951,0,0,0,1,1,2,8); cyl2=sylinteri(0xA38951,0,2,0,0.5,1,0.5,8); cyl3=sylinteri(0xA38951,0,2.5,0,0.5,0.5,0.5,8); cyl4=sylinteri(0xA38951,0,3,0,0,0.7,0.5,8); const kirkko = new THREE.Group(); kirkko.add( cubeA ); kirkko.add( cubeB ); kirkko.add( cubeC ); kirkko.add( cubeD ); kirkko.add( cyl1 ); kirkko.add( cyl2 ); kirkko.add( cyl3 ); kirkko.add( cyl4 ); scene.add( kirkko ); group=kirkko;