Codels
2,2 k tris7,46 × 5,66 × 5,88 m

Utiliser dans le code

Remixer dans l’éditeur
Module ES autonome — ne dépend que de three. Appelez la fonction factory et ajoutez le groupe à votre scène.
/**
 * Blacksmith Forge — Codels 3D model library
 * License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
 * Triangles: 2,222 · Size (W × H × D): 7.46 × 5.66 × 5.88 m
 *
 * Usage:
 *   import { createBlacksmith } from './blacksmith.js';
 *   
 *   const model = createBlacksmith();
 *   model.position.set(0, 0, 0);
 *   scene.add(model);
 */
import * as THREE from 'three';

const deg = THREE.MathUtils.degToRad;

// Deterministic vertex displacement (organic low-poly look).
function jitter(geometry, amount, seed) {
  const pos = geometry.attributes.position;
  const h = (a, b, c, s) => {
    let x = Math.imul(a, 73856093) ^ Math.imul(b, 19349663) ^ Math.imul(c, 83492791) ^ Math.imul(s, 2654435761);
    x = Math.imul(x ^ (x >>> 16), 2246822507);
    x = Math.imul(x ^ (x >>> 13), 3266489909);
    return ((x ^ (x >>> 16)) >>> 0) / 4294967295 - 0.5;
  };
  for (let i = 0; i < pos.count; i++) {
    const x = pos.getX(i), y = pos.getY(i), z = pos.getZ(i);
    const qx = Math.round(x * 1000), qy = Math.round(y * 1000), qz = Math.round(z * 1000);
    pos.setXYZ(i, x + h(qx, qy, qz, seed) * 2 * amount, y + h(qx, qy, qz, seed + 1) * 2 * amount, z + h(qx, qy, qz, seed + 2) * 2 * amount);
  }
  pos.needsUpdate = true;
  geometry.computeVertexNormals();
  return geometry;
}

// Extrude a 2D outline along Z (centered). bevel = [thickness, size, segments].
function extrude(outline, depth, holes = [], bevel = null) {
  const shape = new THREE.Shape(outline.map(([x, y]) => new THREE.Vector2(x, y)));
  for (const hole of holes) shape.holes.push(new THREE.Path(hole.map(([x, y]) => new THREE.Vector2(x, y))));
  const options = bevel
    ? { depth, bevelEnabled: true, bevelThickness: bevel[0], bevelSize: bevel[1], bevelSegments: bevel[2] }
    : { depth, bevelEnabled: false };
  return new THREE.ExtrudeGeometry(shape, options).translate(0, 0, -depth / 2);
}

export function createBlacksmith() {
  const root = new THREE.Group();
  root.name = 'Blacksmith';

  // Materials
  const stoneMat = new THREE.MeshStandardMaterial({ name: 'stone', color: 0x958c7f, roughness: 0.95, flatShading: true });
  const stone2Mat = new THREE.MeshStandardMaterial({ name: 'stone2', color: 0x766e64, roughness: 0.95, flatShading: true });
  const timberMat = new THREE.MeshStandardMaterial({ name: 'timber', color: 0x5a3c26, roughness: 0.9, flatShading: true });
  const plankMat = new THREE.MeshStandardMaterial({ name: 'plank', color: 0x94673d, roughness: 0.9, flatShading: true });
  const roofMat = new THREE.MeshStandardMaterial({ name: 'roof', color: 0x3e4550, roughness: 0.85, flatShading: true });
  const ironMat = new THREE.MeshStandardMaterial({ name: 'iron', color: 0x35373b, roughness: 0.5, metalness: 0.65, flatShading: true });
  const fireMat = new THREE.MeshStandardMaterial({ name: 'fire', color: 0xff9a45, roughness: 0.6, emissive: 0xff5a1a, emissiveIntensity: 1.4, flatShading: true });
  const waterMat = new THREE.MeshStandardMaterial({ name: 'water', color: 0x2f6a80, roughness: 0.15, metalness: 0.1, flatShading: true });
  const leatherMat = new THREE.MeshStandardMaterial({ name: 'leather', color: 0x6e3f26, roughness: 0.8, flatShading: true });
  const floorMat = new THREE.MeshStandardMaterial({ name: 'floor', color: 0x5e574e, roughness: 1, flatShading: true });

  // Shared geometries
  const boxGeo = new THREE.BoxGeometry(0.22, 2.59, 0.22);
  const boxGeo2 = new THREE.BoxGeometry(0.32, 0.12, 0.32);
  const boxGeo3 = new THREE.BoxGeometry(0.12, 1.7591, 0.14);
  const boxGeo4 = new THREE.BoxGeometry(0.03, 0.5, 0.03);
  const boxGeo5 = new THREE.BoxGeometry(0.03, 0.9133, 0.03);
  const boxGeo6 = new THREE.BoxGeometry(0.03, 1.3267, 0.03);
  const boxGeo7 = new THREE.BoxGeometry(0.13, 1.0928, 0.13);
  const boxGeo8 = new THREE.BoxGeometry(5.8, 0.09, 4.0598);
  const boxGeo9 = new THREE.BoxGeometry(5.82, 0.07, 1.0962);
  const boxGeo10 = new THREE.BoxGeometry(0.07, 0.17, 4.0298);
  const boxGeo11 = new THREE.BoxGeometry(0.95, 0.04, 0.52);
  const cylinderGeo = new THREE.CylinderGeometry(0.31, 0.31, 0.05, 8, 1, true);
  const boxGeo12 = new THREE.BoxGeometry(0.035, 0.42, 0.03);
  const boxGeo13 = new THREE.BoxGeometry(0.16, 0.07, 0.07);
  const boxGeo14 = new THREE.BoxGeometry(0.025, 0.5, 0.025);
  const torusGeo = new THREE.TorusGeometry(0.075, 0.016, 3, 7, 4.3982);
  const boxGeo15 = new THREE.BoxGeometry(0.07, 0.75, 0.07);
  const boxGeo16 = new THREE.BoxGeometry(0.04, 1.3, 0.04);
  const cylinderGeo2 = new THREE.CylinderGeometry(0.008, 0.008, 0.16, 4);

  // Parts
  const floor = new THREE.Mesh(jitter(new THREE.BoxGeometry(6.2, 0.12, 5.2), 0.006, 1), floorMat);
  floor.name = 'floor';
  floor.position.set(0, 0.06, 0);
  root.add(floor);
  const backWall = new THREE.Mesh(new THREE.BoxGeometry(6, 2.83, 0.45), stoneMat);
  backWall.name = 'backWall';
  backWall.position.set(0, 1.535, -2.275);
  root.add(backWall);
  const backGable = new THREE.Mesh(extrude([[-3, 0], [3, 0], [0, 1.83]], 0.45), stoneMat);
  backGable.name = 'backGable';
  backGable.position.set(0, 2.95, -2.275);
  root.add(backGable);
  const leftWall = new THREE.Mesh(new THREE.BoxGeometry(0.45, 2.83, 4.55), stoneMat);
  leftWall.name = 'leftWall';
  leftWall.position.set(-2.775, 1.535, 0.225);
  root.add(leftWall);
  const rightWall = new THREE.Mesh(new THREE.BoxGeometry(0.45, 2.83, 2.1), stoneMat);
  rightWall.name = 'rightWall';
  rightWall.position.set(2.775, 1.535, -1);
  root.add(rightWall);
  const quoin = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.5, 0.4317, 0.32), 0.01, 2), stone2Mat);
  quoin.name = 'quoin';
  quoin.position.set(-2.78, 0.3559, 2.37);
  root.add(quoin);
  const quoin2 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.32, 0.4317, 0.5), 0.01, 3), stone2Mat);
  quoin2.name = 'quoin';
  quoin2.position.set(-2.87, 0.3559, -2.28);
  root.add(quoin2);
  const quoin3 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.5, 0.4317, 0.32), 0.01, 4), stone2Mat);
  quoin3.name = 'quoin';
  quoin3.position.set(2.78, 0.3559, -2.37);
  root.add(quoin3);
  const quoin4 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.51, 0.4317, 0.4), 0.01, 5), stone2Mat);
  quoin4.name = 'quoin';
  quoin4.position.set(2.775, 0.3559, -0.12);
  root.add(quoin4);
  const quoin5 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.32, 0.4317, 0.5), 0.01, 6), stone2Mat);
  quoin5.name = 'quoin';
  quoin5.position.set(-2.87, 0.8275, 2.28);
  root.add(quoin5);
  const quoin6 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.5, 0.4317, 0.32), 0.01, 7), stone2Mat);
  quoin6.name = 'quoin';
  quoin6.position.set(-2.78, 0.8275, -2.37);
  root.add(quoin6);
  const quoin7 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.32, 0.4317, 0.5), 0.01, 8), stone2Mat);
  quoin7.name = 'quoin';
  quoin7.position.set(2.87, 0.8275, -2.28);
  root.add(quoin7);
  const quoin8 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.51, 0.4317, 0.26), 0.01, 9), stone2Mat);
  quoin8.name = 'quoin';
  quoin8.position.set(2.775, 0.8275, -0.05);
  root.add(quoin8);
  const quoin9 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.5, 0.4317, 0.32), 0.01, 10), stone2Mat);
  quoin9.name = 'quoin';
  quoin9.position.set(-2.78, 1.2992, 2.37);
  root.add(quoin9);
  const quoin10 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.32, 0.4317, 0.5), 0.01, 11), stone2Mat);
  quoin10.name = 'quoin';
  quoin10.position.set(-2.87, 1.2992, -2.28);
  root.add(quoin10);
  const quoin11 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.5, 0.4317, 0.32), 0.01, 12), stone2Mat);
  quoin11.name = 'quoin';
  quoin11.position.set(2.78, 1.2992, -2.37);
  root.add(quoin11);
  const quoin12 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.51, 0.4317, 0.4), 0.01, 13), stone2Mat);
  quoin12.name = 'quoin';
  quoin12.position.set(2.775, 1.2992, -0.12);
  root.add(quoin12);
  const quoin13 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.32, 0.4317, 0.5), 0.01, 14), stone2Mat);
  quoin13.name = 'quoin';
  quoin13.position.set(-2.87, 1.7709, 2.28);
  root.add(quoin13);
  const quoin14 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.5, 0.4317, 0.32), 0.01, 15), stone2Mat);
  quoin14.name = 'quoin';
  quoin14.position.set(-2.78, 1.7709, -2.37);
  root.add(quoin14);
  const quoin15 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.32, 0.4317, 0.5), 0.01, 16), stone2Mat);
  quoin15.name = 'quoin';
  quoin15.position.set(2.87, 1.7709, -2.28);
  root.add(quoin15);
  const quoin16 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.51, 0.4317, 0.26), 0.01, 17), stone2Mat);
  quoin16.name = 'quoin';
  quoin16.position.set(2.775, 1.7709, -0.05);
  root.add(quoin16);
  const quoin17 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.5, 0.4317, 0.32), 0.01, 18), stone2Mat);
  quoin17.name = 'quoin';
  quoin17.position.set(-2.78, 2.2425, 2.37);
  root.add(quoin17);
  const quoin18 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.32, 0.4317, 0.5), 0.01, 19), stone2Mat);
  quoin18.name = 'quoin';
  quoin18.position.set(-2.87, 2.2425, -2.28);
  root.add(quoin18);
  const quoin19 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.5, 0.4317, 0.32), 0.01, 20), stone2Mat);
  quoin19.name = 'quoin';
  quoin19.position.set(2.78, 2.2425, -2.37);
  root.add(quoin19);
  const quoin20 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.51, 0.4317, 0.4), 0.01, 21), stone2Mat);
  quoin20.name = 'quoin';
  quoin20.position.set(2.775, 2.2425, -0.12);
  root.add(quoin20);
  const quoin21 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.32, 0.4317, 0.5), 0.01, 22), stone2Mat);
  quoin21.name = 'quoin';
  quoin21.position.set(-2.87, 2.7142, 2.28);
  root.add(quoin21);
  const quoin22 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.5, 0.4317, 0.32), 0.01, 23), stone2Mat);
  quoin22.name = 'quoin';
  quoin22.position.set(-2.78, 2.7142, -2.37);
  root.add(quoin22);
  const quoin23 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.32, 0.4317, 0.5), 0.01, 24), stone2Mat);
  quoin23.name = 'quoin';
  quoin23.position.set(2.87, 2.7142, -2.28);
  root.add(quoin23);
  const quoin24 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.51, 0.4317, 0.26), 0.01, 25), stone2Mat);
  quoin24.name = 'quoin';
  quoin24.position.set(2.775, 2.7142, -0.05);
  root.add(quoin24);
  const wallStone = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.05, 0.22, 0.6991), 0.008, 26), stone2Mat);
  wallStone.name = 'wallStone';
  wallStone.position.set(3.01, 1.5181, -0.8757);
  root.add(wallStone);
  const wallStone2 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.05, 0.22, 0.5765), 0.008, 27), stone2Mat);
  wallStone2.name = 'wallStone';
  wallStone2.position.set(-3.01, 0.8719, 1.5586);
  root.add(wallStone2);
  const wallStone3 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.05, 0.22, 0.5489), 0.008, 28), stoneMat);
  wallStone3.name = 'wallStone';
  wallStone3.position.set(3.01, 1.7673, -0.8063);
  root.add(wallStone3);
  const wallStone4 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.05, 0.22, 0.6234), 0.008, 29), stoneMat);
  wallStone4.name = 'wallStone';
  wallStone4.position.set(-3.01, 0.9222, 1.301);
  root.add(wallStone4);
  const wallStone5 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.05, 0.22, 0.4681), 0.008, 30), stoneMat);
  wallStone5.name = 'wallStone';
  wallStone5.position.set(3.01, 2.4216, -0.8607);
  root.add(wallStone5);
  const wallStone6 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.05, 0.22, 0.5423), 0.008, 31), stone2Mat);
  wallStone6.name = 'wallStone';
  wallStone6.position.set(-3.01, 0.691, 0.5432);
  root.add(wallStone6);
  const wallStone7 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.05, 0.22, 0.6261), 0.008, 32), stone2Mat);
  wallStone7.name = 'wallStone';
  wallStone7.position.set(3.01, 1.0897, -0.9678);
  root.add(wallStone7);
  const wallStone8 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.05, 0.22, 0.5738), 0.008, 33), stoneMat);
  wallStone8.name = 'wallStone';
  wallStone8.position.set(-3.01, 1.4322, -0.4789);
  root.add(wallStone8);
  const wallStone9 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.05, 0.22, 0.5572), 0.008, 34), stone2Mat);
  wallStone9.name = 'wallStone';
  wallStone9.position.set(3.01, 1.2006, -0.6657);
  root.add(wallStone9);
  const wallStone10 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.05, 0.22, 0.4384), 0.008, 35), stone2Mat);
  wallStone10.name = 'wallStone';
  wallStone10.position.set(-3.01, 2.3257, 0.2417);
  root.add(wallStone10);
  const post = new THREE.Mesh(boxGeo, timberMat);
  post.name = 'post';
  post.position.set(-2.88, 1.415, 2.38);
  root.add(post);
  const postPad = new THREE.Mesh(boxGeo2, stone2Mat);
  postPad.name = 'postPad';
  postPad.position.set(-2.88, 0.18, 2.38);
  root.add(postPad);
  const post2 = new THREE.Mesh(boxGeo, timberMat);
  post2.name = 'post';
  post2.position.set(2.88, 1.415, 2.38);
  root.add(post2);
  const postPad2 = new THREE.Mesh(boxGeo2, stone2Mat);
  postPad2.name = 'postPad';
  postPad2.position.set(2.88, 0.18, 2.38);
  root.add(postPad2);
  const tieBeam = new THREE.Mesh(new THREE.BoxGeometry(6.1, 0.26, 0.24), timberMat);
  tieBeam.name = 'tieBeam';
  tieBeam.position.set(0, 2.82, 2.38);
  root.add(tieBeam);
  const sidePlate = new THREE.Mesh(new THREE.BoxGeometry(0.24, 0.26, 2.55), timberMat);
  sidePlate.name = 'sidePlate';
  sidePlate.position.set(2.88, 2.82, 1.215);
  root.add(sidePlate);
  const kingPost = new THREE.Mesh(new THREE.BoxGeometry(0.16, 1.61, 0.16), timberMat);
  kingPost.name = 'kingPost';
  kingPost.position.set(0, 3.755, 2.38);
  root.add(kingPost);
  const gableStrut = new THREE.Mesh(boxGeo3, timberMat);
  gableStrut.name = 'gableStrut';
  gableStrut.position.set(-0.81, 3.3428, 2.38);
  gableStrut.rotation.set(0, 0, deg(67.0614));
  root.add(gableStrut);
  const gableStrut2 = new THREE.Mesh(boxGeo3, timberMat);
  gableStrut2.name = 'gableStrut';
  gableStrut2.position.set(0.81, 3.3428, 2.38);
  gableStrut2.rotation.set(0, 0, deg(-67.0614));
  root.add(gableStrut2);
  const gableBoards = new THREE.Mesh(extrude([[-2.95, 0], [2.95, 0], [0, 1.8]], 0.05), plankMat);
  gableBoards.name = 'gableBoards';
  gableBoards.position.set(0, 2.95, 2.27);
  root.add(gableBoards);
  const batten = new THREE.Mesh(boxGeo4, timberMat);
  batten.name = 'batten';
  batten.position.set(-2, 3.2, 2.3);
  root.add(batten);
  const batten2 = new THREE.Mesh(boxGeo5, timberMat);
  batten2.name = 'batten';
  batten2.position.set(-1.3333, 3.4067, 2.3);
  root.add(batten2);
  const batten3 = new THREE.Mesh(boxGeo6, timberMat);
  batten3.name = 'batten';
  batten3.position.set(-0.6667, 3.6134, 2.3);
  root.add(batten3);
  const batten4 = new THREE.Mesh(boxGeo6, timberMat);
  batten4.name = 'batten';
  batten4.position.set(0.6667, 3.6134, 2.3);
  root.add(batten4);
  const batten5 = new THREE.Mesh(boxGeo5, timberMat);
  batten5.name = 'batten';
  batten5.position.set(1.3333, 3.4067, 2.3);
  root.add(batten5);
  const batten6 = new THREE.Mesh(boxGeo4, timberMat);
  batten6.name = 'batten';
  batten6.position.set(2, 3.2, 2.3);
  root.add(batten6);
  const kneeBrace = new THREE.Mesh(boxGeo7, timberMat);
  kneeBrace.name = 'kneeBrace';
  kneeBrace.position.set(-2.505, 2.355, 2.38);
  kneeBrace.rotation.set(0, 0, deg(-46.5694));
  root.add(kneeBrace);
  const kneeBrace2 = new THREE.Mesh(boxGeo7, timberMat);
  kneeBrace2.name = 'kneeBrace';
  kneeBrace2.position.set(2.505, 2.355, 2.38);
  kneeBrace2.rotation.set(0, 0, deg(46.5694));
  root.add(kneeBrace2);
  const kneeBrace3 = new THREE.Mesh(boxGeo7, timberMat);
  kneeBrace3.name = 'kneeBrace';
  kneeBrace3.position.set(2.88, 2.355, 2.005);
  kneeBrace3.rotation.set(deg(-46.5694), deg(90), 0);
  root.add(kneeBrace3);
  const roof = new THREE.Group();
  roof.name = 'roof';
  roof.rotation.set(0, deg(90), 0);
  root.add(roof);
  const roofSlab = new THREE.Mesh(boxGeo8, roofMat);
  roofSlab.name = 'roofSlab';
  roofSlab.position.set(0, 3.7944, -1.7234);
  roofSlab.rotation.set(deg(-31.7989), 0, 0);
  roof.add(roofSlab);
  const shingles = new THREE.Mesh(boxGeo9, roofMat);
  shingles.name = 'shingles';
  shingles.position.set(0, 4.6646, -0.4717);
  shingles.rotation.set(deg(-37.7989), 0, 0);
  roof.add(shingles);
  const shingles2 = new THREE.Mesh(boxGeo9, roofMat);
  shingles2.name = 'shingles';
  shingles2.position.set(0, 4.1298, -1.3343);
  shingles2.rotation.set(deg(-37.7989), 0, 0);
  roof.add(shingles2);
  const shingles3 = new THREE.Mesh(boxGeo9, roofMat);
  shingles3.name = 'shingles';
  shingles3.position.set(0, 3.595, -2.1969);
  shingles3.rotation.set(deg(-37.7989), 0, 0);
  roof.add(shingles3);
  const shingles4 = new THREE.Mesh(boxGeo9, roofMat);
  shingles4.name = 'shingles';
  shingles4.position.set(0, 3.0602, -3.0595);
  shingles4.rotation.set(deg(-37.7989), 0, 0);
  roof.add(shingles4);
  const roofSlab2 = new THREE.Mesh(boxGeo8, roofMat);
  roofSlab2.name = 'roofSlab';
  roofSlab2.position.set(0, 3.7944, 1.7234);
  roofSlab2.rotation.set(deg(31.7989), 0, 0);
  roof.add(roofSlab2);
  const shingles5 = new THREE.Mesh(boxGeo9, roofMat);
  shingles5.name = 'shingles';
  shingles5.position.set(0, 4.6646, 0.4717);
  shingles5.rotation.set(deg(37.7989), 0, 0);
  roof.add(shingles5);
  const shingles6 = new THREE.Mesh(boxGeo9, roofMat);
  shingles6.name = 'shingles';
  shingles6.position.set(0, 4.1298, 1.3343);
  shingles6.rotation.set(deg(37.7989), 0, 0);
  roof.add(shingles6);
  const shingles7 = new THREE.Mesh(boxGeo9, roofMat);
  shingles7.name = 'shingles';
  shingles7.position.set(0, 3.595, 2.1969);
  shingles7.rotation.set(deg(37.7989), 0, 0);
  roof.add(shingles7);
  const shingles8 = new THREE.Mesh(boxGeo9, roofMat);
  shingles8.name = 'shingles';
  shingles8.position.set(0, 3.0602, 3.0595);
  shingles8.rotation.set(deg(37.7989), 0, 0);
  roof.add(shingles8);
  const ridge = new THREE.Mesh(new THREE.BoxGeometry(5.88, 0.2, 0.2), timberMat);
  ridge.name = 'ridge';
  ridge.position.set(0, 4.9983, 0);
  ridge.rotation.set(deg(45), 0, 0);
  roof.add(ridge);
  const bargeBoard = new THREE.Mesh(boxGeo10, timberMat);
  bargeBoard.name = 'bargeBoard';
  bargeBoard.position.set(-2.86, 3.6983, -1.7125);
  bargeBoard.rotation.set(deg(-31.7989), 0, 0);
  roof.add(bargeBoard);
  const bargeBoard2 = new THREE.Mesh(boxGeo10, timberMat);
  bargeBoard2.name = 'bargeBoard';
  bargeBoard2.position.set(-2.86, 3.6983, 1.7125);
  bargeBoard2.rotation.set(deg(31.7989), 0, 0);
  roof.add(bargeBoard2);
  const bargeBoard3 = new THREE.Mesh(boxGeo10, timberMat);
  bargeBoard3.name = 'bargeBoard';
  bargeBoard3.position.set(2.86, 3.6983, -1.7125);
  bargeBoard3.rotation.set(deg(-31.7989), 0, 0);
  roof.add(bargeBoard3);
  const bargeBoard4 = new THREE.Mesh(boxGeo10, timberMat);
  bargeBoard4.name = 'bargeBoard';
  bargeBoard4.position.set(2.86, 3.6983, 1.7125);
  bargeBoard4.rotation.set(deg(31.7989), 0, 0);
  roof.add(bargeBoard4);
  const hearth = new THREE.Mesh(jitter(new THREE.BoxGeometry(1.2, 0.85, 1.5), 0.01, 36), stone2Mat);
  hearth.name = 'hearth';
  hearth.position.set(-1.95, 0.545, -0.05);
  root.add(hearth);
  const hearthTop = new THREE.Mesh(jitter(new THREE.BoxGeometry(1.3, 0.1, 1.6), 0.008, 37), stoneMat);
  hearthTop.name = 'hearthTop';
  hearthTop.position.set(-1.95, 1.02, -0.05);
  root.add(hearthTop);
  const hearthRim = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.12, 0.14, 1.25), 0.01, 38), stoneMat);
  hearthRim.name = 'hearthRim';
  hearthRim.position.set(-2.43, 1.14, -0.05);
  root.add(hearthRim);
  const hearthRim2 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.84, 0.14, 0.12), 0.01, 39), stoneMat);
  hearthRim2.name = 'hearthRim';
  hearthRim2.position.set(-1.95, 1.14, 0.55);
  root.add(hearthRim2);
  const hearthRim3 = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.84, 0.14, 0.12), 0.01, 40), stoneMat);
  hearthRim3.name = 'hearthRim';
  hearthRim3.position.set(-1.95, 1.14, -0.65);
  root.add(hearthRim3);
  const coalBed = new THREE.Mesh(new THREE.BoxGeometry(0.84, 0.06, 1.05), fireMat);
  coalBed.name = 'coalBed';
  coalBed.position.set(-1.95, 1.1, -0.05);
  root.add(coalBed);
  const coal = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.0948, 0), 0.019, 41), fireMat);
  coal.name = 'coal';
  coal.position.set(-2.0528, 1.14, 0.2338);
  root.add(coal);
  const coal2 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.0689, 0), 0.0138, 42), ironMat);
  coal2.name = 'coal';
  coal2.position.set(-2.1078, 1.14, 0.0852);
  root.add(coal2);
  const coal3 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.0611, 0), 0.0122, 43), ironMat);
  coal3.name = 'coal';
  coal3.position.set(-1.9126, 1.14, 0.3426);
  root.add(coal3);
  const coal4 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.1052, 0), 0.021, 44), fireMat);
  coal4.name = 'coal';
  coal4.position.set(-2.2017, 1.14, -0.2123);
  root.add(coal4);
  const coal5 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.0754, 0), 0.0151, 45), ironMat);
  coal5.name = 'coal';
  coal5.position.set(-1.7311, 1.14, -0.0422);
  root.add(coal5);
  const coal6 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.0806, 0), 0.0161, 46), ironMat);
  coal6.name = 'coal';
  coal6.position.set(-1.7894, 1.14, 0.1453);
  root.add(coal6);
  const coal7 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.0846, 0), 0.0169, 47), fireMat);
  coal7.name = 'coal';
  coal7.position.set(-2.0565, 1.14, -0.0832);
  root.add(coal7);
  const flame = new THREE.Mesh(new THREE.ConeGeometry(0.09, 0.42, 5), fireMat);
  flame.name = 'flame';
  flame.position.set(-1.9, 1.32, 0.07);
  flame.rotation.set(0, deg(24), 0);
  root.add(flame);
  const flame2 = new THREE.Mesh(new THREE.ConeGeometry(0.09, 0.32, 5), fireMat);
  flame2.name = 'flame';
  flame2.position.set(-2.05, 1.27, -0.23);
  flame2.rotation.set(0, deg(-36), 0);
  root.add(flame2);
  const flame3 = new THREE.Mesh(new THREE.ConeGeometry(0.09, 0.26, 5), fireMat);
  flame3.name = 'flame';
  flame3.position.set(-1.81, 1.24, -0.35);
  flame3.rotation.set(0, deg(-60), 0);
  root.add(flame3);
  const flame4 = new THREE.Mesh(new THREE.ConeGeometry(0.09, 0.28, 5), fireMat);
  flame4.name = 'flame';
  flame4.position.set(-2, 1.25, 0.33);
  flame4.rotation.set(0, deg(76), 0);
  root.add(flame4);
  const ashPit = new THREE.Mesh(new THREE.BoxGeometry(0.04, 0.35, 0.6), ironMat);
  ashPit.name = 'ashPit';
  ashPit.position.set(-1.35, 0.42, -0.05);
  root.add(ashPit);
  const hood = new THREE.Mesh(new THREE.CylinderGeometry(0.38, 1, 0.8, 4, 1, false, Math.PI / 4), stoneMat);
  hood.name = 'hood';
  hood.position.set(-2, 2.35, -0.05);
  hood.scale.set(0.82, 1, 1);
  root.add(hood);
  const chimney = new THREE.Mesh(jitter(new THREE.BoxGeometry(0.6, 2.76, 0.6), 0.008, 48), stoneMat);
  chimney.name = 'chimney';
  chimney.position.set(-2.05, 4.13, -0.05);
  root.add(chimney);
  const chimneyCap = new THREE.Mesh(new THREE.BoxGeometry(0.76, 0.14, 0.76), stone2Mat);
  chimneyCap.name = 'chimneyCap';
  chimneyCap.position.set(-2.05, 5.58, -0.05);
  root.add(chimneyCap);
  const bellowsRig = new THREE.Group();
  bellowsRig.name = 'bellowsRig';
  bellowsRig.position.set(-1.95, 0.12, -1.27);
  bellowsRig.rotation.set(0, deg(90), 0);
  root.add(bellowsRig);
  const bellowsStand = new THREE.Mesh(new THREE.BoxGeometry(0.5, 0.52, 0.5), plankMat);
  bellowsStand.name = 'bellowsStand';
  bellowsStand.position.set(0, 0.26, 0);
  bellowsRig.add(bellowsStand);
  const bellows = new THREE.Mesh(extrude([[-0.45, 0], [0.4, 0], [0.4, 0.32], [-0.45, 0.06]], 0.46), leatherMat);
  bellows.name = 'bellows';
  bellows.position.set(0, 0.57, 0);
  bellowsRig.add(bellows);
  const bellowsBoard = new THREE.Mesh(boxGeo11, plankMat);
  bellowsBoard.name = 'bellowsBoard';
  bellowsBoard.position.set(-0.03, 0.77, 0);
  bellowsBoard.rotation.set(0, 0, deg(17));
  bellowsRig.add(bellowsBoard);
  const bellowsBoard2 = new THREE.Mesh(boxGeo11, plankMat);
  bellowsBoard2.name = 'bellowsBoard';
  bellowsBoard2.position.set(-0.03, 0.56, 0);
  bellowsRig.add(bellowsBoard2);
  const tuyere = new THREE.Mesh(new THREE.CylinderGeometry(0.04, 0.05, 0.4, 6), ironMat);
  tuyere.name = 'tuyere';
  tuyere.position.set(-0.6, 0.6, 0);
  tuyere.rotation.set(0, 0, deg(90));
  bellowsRig.add(tuyere);
  const bellowsLever = new THREE.Mesh(new THREE.BoxGeometry(0.05, 0.95, 0.05), timberMat);
  bellowsLever.name = 'bellowsLever';
  bellowsLever.position.set(0.36, 1.38, 0);
  bellowsLever.rotation.set(0, 0, deg(-7));
  bellowsRig.add(bellowsLever);
  const stump = new THREE.Mesh(jitter(new THREE.CylinderGeometry(0.27, 0.32, 0.48, 8), 0.012, 49), plankMat);
  stump.name = 'stump';
  stump.position.set(0.15, 0.36, 0.85);
  root.add(stump);
  const anvil = new THREE.Group();
  anvil.name = 'anvil';
  anvil.position.set(0.15, 0.6, 0.85);
  anvil.rotation.set(0, deg(-25), 0);
  root.add(anvil);
  const anvilFoot = new THREE.Mesh(new THREE.BoxGeometry(0.44, 0.08, 0.3), ironMat);
  anvilFoot.name = 'anvilFoot';
  anvilFoot.position.set(0, 0.04, 0);
  anvil.add(anvilFoot);
  const anvilWaist = new THREE.Mesh(new THREE.CylinderGeometry(0.14, 0.24, 0.17, 4, 1, false, Math.PI / 4), ironMat);
  anvilWaist.name = 'anvilWaist';
  anvilWaist.position.set(0, 0.165, 0);
  anvilWaist.scale.set(1, 1, 0.7);
  anvil.add(anvilWaist);
  const anvilFace = new THREE.Mesh(new THREE.BoxGeometry(0.56, 0.13, 0.2), ironMat);
  anvilFace.name = 'anvilFace';
  anvilFace.position.set(0, 0.315, 0);
  anvil.add(anvilFace);
  const anvilHorn = new THREE.Mesh(new THREE.ConeGeometry(0.1, 0.3, 6), ironMat);
  anvilHorn.name = 'anvilHorn';
  anvilHorn.position.set(0.42, 0.315, 0);
  anvilHorn.rotation.set(0, 0, deg(-90));
  anvil.add(anvilHorn);
  const anvilHeel = new THREE.Mesh(new THREE.BoxGeometry(0.1, 0.09, 0.15), ironMat);
  anvilHeel.name = 'anvilHeel';
  anvilHeel.position.set(-0.31, 0.335, 0);
  anvil.add(anvilHeel);
  const hammerHandle = new THREE.Mesh(new THREE.BoxGeometry(0.3, 0.025, 0.03), timberMat);
  hammerHandle.name = 'hammerHandle';
  hammerHandle.position.set(0.05, 0.3925, 0.04);
  hammerHandle.rotation.set(0, deg(25), 0);
  anvil.add(hammerHandle);
  const hammerHead = new THREE.Mesh(new THREE.BoxGeometry(0.06, 0.06, 0.12), ironMat);
  hammerHead.name = 'hammerHead';
  hammerHead.position.set(-0.09, 0.41, 0);
  hammerHead.rotation.set(0, deg(25), 0);
  anvil.add(hammerHead);
  const quenchBarrel = new THREE.Mesh(new THREE.CylinderGeometry(0.3, 0.27, 0.72, 8), plankMat);
  quenchBarrel.name = 'quenchBarrel';
  quenchBarrel.position.set(1.1, 0.48, 1.15);
  root.add(quenchBarrel);
  const barrelHoop = new THREE.Mesh(cylinderGeo, ironMat);
  barrelHoop.name = 'barrelHoop';
  barrelHoop.position.set(1.1, 0.265, 1.15);
  root.add(barrelHoop);
  const barrelHoop2 = new THREE.Mesh(cylinderGeo, ironMat);
  barrelHoop2.name = 'barrelHoop';
  barrelHoop2.position.set(1.1, 0.725, 1.15);
  root.add(barrelHoop2);
  const water = new THREE.Mesh(new THREE.CircleGeometry(0.27, 8), waterMat);
  water.name = 'water';
  water.position.set(1.1, 0.76, 1.15);
  water.rotation.set(deg(-90), 0, 0);
  root.add(water);
  const tongsInBarrel = new THREE.Mesh(new THREE.BoxGeometry(0.02, 0.5, 0.02), ironMat);
  tongsInBarrel.name = 'tongsInBarrel';
  tongsInBarrel.position.set(1.16, 0.94, 1.1);
  tongsInBarrel.rotation.set(deg(8), 0, deg(-10));
  root.add(tongsInBarrel);
  const toolRack = new THREE.Mesh(new THREE.BoxGeometry(1.5, 0.12, 0.05), plankMat);
  toolRack.name = 'toolRack';
  toolRack.position.set(0.55, 1.85, -2.02);
  root.add(toolRack);
  const hammerHandle2 = new THREE.Mesh(boxGeo12, timberMat);
  hammerHandle2.name = 'hammerHandle';
  hammerHandle2.position.set(-0.05, 1.58, -1.98);
  root.add(hammerHandle2);
  const hammerHead2 = new THREE.Mesh(boxGeo13, ironMat);
  hammerHead2.name = 'hammerHead';
  hammerHead2.position.set(-0.05, 1.38, -1.97);
  root.add(hammerHead2);
  const tongs = new THREE.Mesh(boxGeo14, ironMat);
  tongs.name = 'tongs';
  tongs.position.set(0.22, 1.56, -1.98);
  tongs.rotation.set(0, 0, deg(-4));
  root.add(tongs);
  const tongs2 = new THREE.Mesh(boxGeo14, ironMat);
  tongs2.name = 'tongs';
  tongs2.position.set(0.28, 1.56, -1.98);
  tongs2.rotation.set(0, 0, deg(4));
  root.add(tongs2);
  const hammerHandle3 = new THREE.Mesh(boxGeo12, timberMat);
  hammerHandle3.name = 'hammerHandle';
  hammerHandle3.position.set(0.55, 1.58, -1.98);
  root.add(hammerHandle3);
  const hammerHead3 = new THREE.Mesh(boxGeo13, ironMat);
  hammerHead3.name = 'hammerHead';
  hammerHead3.position.set(0.55, 1.38, -1.97);
  root.add(hammerHead3);
  const tongs3 = new THREE.Mesh(boxGeo14, ironMat);
  tongs3.name = 'tongs';
  tongs3.position.set(0.82, 1.56, -1.98);
  tongs3.rotation.set(0, 0, deg(-4));
  root.add(tongs3);
  const tongs4 = new THREE.Mesh(boxGeo14, ironMat);
  tongs4.name = 'tongs';
  tongs4.position.set(0.88, 1.56, -1.98);
  tongs4.rotation.set(0, 0, deg(4));
  root.add(tongs4);
  const hammerHandle4 = new THREE.Mesh(boxGeo12, timberMat);
  hammerHandle4.name = 'hammerHandle';
  hammerHandle4.position.set(1.15, 1.58, -1.98);
  root.add(hammerHandle4);
  const hammerHead4 = new THREE.Mesh(boxGeo13, ironMat);
  hammerHead4.name = 'hammerHead';
  hammerHead4.position.set(1.15, 1.38, -1.97);
  root.add(hammerHead4);
  const horseshoe = new THREE.Mesh(torusGeo, ironMat);
  horseshoe.name = 'horseshoe';
  horseshoe.position.set(0.1, 2.22, -2);
  horseshoe.rotation.set(0, 0, deg(-72));
  root.add(horseshoe);
  const horseshoe2 = new THREE.Mesh(torusGeo, ironMat);
  horseshoe2.name = 'horseshoe';
  horseshoe2.position.set(0.55, 2.22, -2);
  horseshoe2.rotation.set(0, 0, deg(-72));
  root.add(horseshoe2);
  const horseshoe3 = new THREE.Mesh(torusGeo, ironMat);
  horseshoe3.name = 'horseshoe';
  horseshoe3.position.set(1, 2.22, -2);
  horseshoe3.rotation.set(0, 0, deg(-72));
  root.add(horseshoe3);
  const grindLeg = new THREE.Mesh(boxGeo15, timberMat);
  grindLeg.name = 'grindLeg';
  grindLeg.position.set(1.99, 0.495, 1.6);
  root.add(grindLeg);
  const grindLeg2 = new THREE.Mesh(boxGeo15, timberMat);
  grindLeg2.name = 'grindLeg';
  grindLeg2.position.set(2.31, 0.495, 1.6);
  root.add(grindLeg2);
  const grindTrough = new THREE.Mesh(new THREE.BoxGeometry(0.42, 0.06, 0.6), plankMat);
  grindTrough.name = 'grindTrough';
  grindTrough.position.set(2.15, 0.35, 1.6);
  root.add(grindTrough);
  const grindstone = new THREE.Mesh(new THREE.CylinderGeometry(0.34, 0.34, 0.11, 10), stoneMat);
  grindstone.name = 'grindstone';
  grindstone.position.set(2.15, 0.87, 1.6);
  grindstone.rotation.set(0, 0, deg(90));
  root.add(grindstone);
  const grindAxle = new THREE.Mesh(new THREE.CylinderGeometry(0.02, 0.02, 0.5, 5), ironMat);
  grindAxle.name = 'grindAxle';
  grindAxle.position.set(2.15, 0.87, 1.6);
  grindAxle.rotation.set(0, 0, deg(90));
  root.add(grindAxle);
  const grindCrank = new THREE.Mesh(new THREE.BoxGeometry(0.03, 0.2, 0.03), ironMat);
  grindCrank.name = 'grindCrank';
  grindCrank.position.set(2.4, 0.78, 1.6);
  root.add(grindCrank);
  const coalHeap = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.2389, 0), 0.0358, 50), ironMat);
  coalHeap.name = 'coalHeap';
  coalHeap.position.set(-2.1076, 0.2811, 0.9925);
  coalHeap.scale.set(1.2, 0.7, 1.1);
  root.add(coalHeap);
  const coalHeap2 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.1693, 0), 0.0254, 51), ironMat);
  coalHeap2.name = 'coalHeap';
  coalHeap2.position.set(-2.3006, 0.222, 1.2034);
  coalHeap2.scale.set(1.2, 0.7, 1.1);
  root.add(coalHeap2);
  const coalHeap3 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.1984, 0), 0.0298, 52), ironMat);
  coalHeap3.name = 'coalHeap';
  coalHeap3.position.set(-2.2083, 0.2529, 1.2464);
  coalHeap3.scale.set(1.2, 0.7, 1.1);
  root.add(coalHeap3);
  const coalHeap4 = new THREE.Mesh(jitter(new THREE.DodecahedronGeometry(0.2238, 0), 0.0336, 53), ironMat);
  coalHeap4.name = 'coalHeap';
  coalHeap4.position.set(-2.0028, 0.2804, 1.0823);
  coalHeap4.scale.set(1.2, 0.7, 1.1);
  root.add(coalHeap4);
  const ironBar = new THREE.Mesh(boxGeo16, ironMat);
  ironBar.name = 'ironBar';
  ironBar.position.set(-2.45, 0.75, 1.75);
  ironBar.rotation.set(0, 0, deg(-8));
  root.add(ironBar);
  const ironBar2 = new THREE.Mesh(boxGeo16, ironMat);
  ironBar2.name = 'ironBar';
  ironBar2.position.set(-2.38, 0.75, 1.81);
  ironBar2.rotation.set(0, 0, deg(-11));
  root.add(ironBar2);
  const ironBar3 = new THREE.Mesh(boxGeo16, ironMat);
  ironBar3.name = 'ironBar';
  ironBar3.position.set(-2.31, 0.75, 1.87);
  ironBar3.rotation.set(0, 0, deg(-14));
  root.add(ironBar3);
  const signArm = new THREE.Mesh(new THREE.BoxGeometry(0.95, 0.05, 0.05), ironMat);
  signArm.name = 'signArm';
  signArm.position.set(3.47, 2.4, 2.38);
  root.add(signArm);
  const signStay = new THREE.Mesh(new THREE.BoxGeometry(0.035, 0.6595, 0.035), ironMat);
  signStay.name = 'signStay';
  signStay.position.set(3.27, 2.165, 2.38);
  signStay.rotation.set(deg(-90), deg(-40.6955), deg(-90));
  root.add(signStay);
  const signChain = new THREE.Mesh(cylinderGeo2, ironMat);
  signChain.name = 'signChain';
  signChain.position.set(3.32, 2.3, 2.38);
  root.add(signChain);
  const signChain2 = new THREE.Mesh(cylinderGeo2, ironMat);
  signChain2.name = 'signChain';
  signChain2.position.set(3.77, 2.3, 2.38);
  root.add(signChain2);
  const signBoard = new THREE.Mesh(new THREE.BoxGeometry(0.72, 0.5, 0.05), plankMat);
  signBoard.name = 'signBoard';
  signBoard.position.set(3.54, 1.95, 2.38);
  root.add(signBoard);
  const signIcon = new THREE.Mesh(extrude([[-0.2, -0.16], [0.2, -0.16], [0.1, -0.06], [0.1, 0.02], [0.26, 0.07], [0.28, 0.12], [-0.2, 0.12], [-0.2, 0.03], [-0.1, 0.02], [-0.1, -0.06]], 0.09), ironMat);
  signIcon.name = 'signIcon';
  signIcon.position.set(3.52, 1.94, 2.38);
  root.add(signIcon);

  root.traverse((o) => {
    if (o.isMesh) {
      o.castShadow = true;
      o.receiveShadow = true;
    }
  });
  return root;
}

export default createBlacksmith;

Notes et commentaires

—
Aucune note pour l’instant — soyez le premier.
5
0
4
0
3
0
2
0
1
0

Connectez-vous pour noter et commenter.

0 commentaire

Aucun commentaire pour l’instant. Dites comment vous avez utilisé ce modèle ou ce qui pourrait être amélioré.

Modèles similaires

Même catégorie ou étiquettes proches