Codels
1,2 mil tris3,99 × 1,83 × 2,38 m
Módulo ES autocontido — depende apenas do three. Chame a factory e adicione o grupo à sua cena.
/**
 * Wooden Dock — Codels 3D model library
 * License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
 * Triangles: 1,188 · Size (W × H × D): 3.99 × 1.83 × 2.38 m
 *
 * Usage:
 *   import { createDock } from './dock.js';
 *   
 *   const model = createDock();
 *   model.position.set(0, 0, 0);
 *   scene.add(model);
 */
import * as THREE from 'three';

const deg = THREE.MathUtils.degToRad;

export function createDock() {
  const root = new THREE.Group();
  root.name = 'Dock';

  // Materials
  const deckMat = new THREE.MeshStandardMaterial({ name: 'deck', color: 0xa98157, roughness: 0.92, flatShading: true });
  const deck2Mat = new THREE.MeshStandardMaterial({ name: 'deck2', color: 0x94704a, roughness: 0.92, flatShading: true });
  const deck3Mat = new THREE.MeshStandardMaterial({ name: 'deck3', color: 0xb89268, roughness: 0.92, flatShading: true });
  const beamMat = new THREE.MeshStandardMaterial({ name: 'beam', color: 0x5e4430, roughness: 0.95, flatShading: true });
  const pilingMat = new THREE.MeshStandardMaterial({ name: 'piling', color: 0x6f5a46, roughness: 0.95, flatShading: true });
  const algaeMat = new THREE.MeshStandardMaterial({ name: 'algae', color: 0x3d5534, roughness: 1, flatShading: true });
  const ropeMat = new THREE.MeshStandardMaterial({ name: 'rope', color: 0xcbb487, roughness: 1, flatShading: true });
  const ironMat = new THREE.MeshStandardMaterial({ name: 'iron', color: 0x34363a, roughness: 0.5, metalness: 0.6, flatShading: true });

  // Shared geometries
  const cylinderGeo = new THREE.CylinderGeometry(0.1012, 0.11, 0.87, 8);
  const cylinderGeo2 = new THREE.CylinderGeometry(0.122, 0.126, 0.32, 8, 1, true);
  const boxGeo = new THREE.BoxGeometry(0.16, 0.16, 2.16);
  const boxGeo2 = new THREE.BoxGeometry(0.06, 1.9313, 0.12);
  const boxGeo3 = new THREE.BoxGeometry(0.12, 2.05, 0.06);
  const boxGeo4 = new THREE.BoxGeometry(3.98, 0.14, 0.1);
  const boxGeo5 = new THREE.BoxGeometry(3.98, 0.16, 0.04);
  const cylinderGeo3 = new THREE.CylinderGeometry(0.099, 0.11, 1.75, 8);
  const cylinderGeo4 = new THREE.CylinderGeometry(0.066, 0.099, 0.08, 8);
  const torusGeo = new THREE.TorusGeometry(0.122, 0.022, 3, 8);
  const boxGeo6 = new THREE.BoxGeometry(0.05, 1.7, 0.06);
  const cylinderGeo5 = new THREE.CylinderGeometry(0.018, 0.018, 0.48, 5);

  // Parts
  const piling = new THREE.Mesh(cylinderGeo, pilingMat);
  piling.name = 'piling';
  piling.position.set(-0.9866, 0.435, -0.98);
  piling.rotation.set(deg(0.4134), deg(33.7347), 0);
  root.add(piling);
  const waterLine = new THREE.Mesh(cylinderGeo2, algaeMat);
  waterLine.name = 'waterLine';
  waterLine.position.set(-1, 0.16, -0.98);
  root.add(waterLine);
  const piling2 = new THREE.Mesh(cylinderGeo, pilingMat);
  piling2.name = 'piling';
  piling2.position.set(-1.0033, 0.435, 0.98);
  piling2.rotation.set(deg(-1.0826), deg(15.5532), 0);
  root.add(piling2);
  const waterLine2 = new THREE.Mesh(cylinderGeo2, algaeMat);
  waterLine2.name = 'waterLine';
  waterLine2.position.set(-1, 0.16, 0.98);
  root.add(waterLine2);
  const capBeam = new THREE.Mesh(boxGeo, beamMat);
  capBeam.name = 'capBeam';
  capBeam.position.set(-1, 0.93, 0);
  root.add(capBeam);
  const brace = new THREE.Mesh(boxGeo2, beamMat);
  brace.name = 'brace';
  brace.position.set(-0.87, 0.54, 0);
  brace.rotation.set(deg(74.3806), deg(90), 0);
  root.add(brace);
  const piling3 = new THREE.Mesh(cylinderGeo, pilingMat);
  piling3.name = 'piling';
  piling3.position.set(1.0173, 0.435, -0.98);
  piling3.rotation.set(deg(-1.0194), deg(36.5612), 0);
  root.add(piling3);
  const waterLine3 = new THREE.Mesh(cylinderGeo2, algaeMat);
  waterLine3.name = 'waterLine';
  waterLine3.position.set(1, 0.16, -0.98);
  root.add(waterLine3);
  const piling4 = new THREE.Mesh(cylinderGeo, pilingMat);
  piling4.name = 'piling';
  piling4.position.set(0.9928, 0.435, 0.98);
  piling4.rotation.set(deg(0.3926), deg(32.8607), 0);
  root.add(piling4);
  const waterLine4 = new THREE.Mesh(cylinderGeo2, algaeMat);
  waterLine4.name = 'waterLine';
  waterLine4.position.set(1, 0.16, 0.98);
  root.add(waterLine4);
  const capBeam2 = new THREE.Mesh(boxGeo, beamMat);
  capBeam2.name = 'capBeam';
  capBeam2.position.set(1, 0.93, 0);
  root.add(capBeam2);
  const brace2 = new THREE.Mesh(boxGeo2, beamMat);
  brace2.name = 'brace';
  brace2.position.set(1.13, 0.54, 0);
  brace2.rotation.set(deg(-74.3806), deg(90), 0);
  root.add(brace2);
  const brace3 = new THREE.Mesh(boxGeo3, beamMat);
  brace3.name = 'brace';
  brace3.position.set(0, 0.575, -0.83);
  brace3.rotation.set(0, 0, deg(-102.6804));
  root.add(brace3);
  const brace4 = new THREE.Mesh(boxGeo3, beamMat);
  brace4.name = 'brace';
  brace4.position.set(0, 0.575, 0.83);
  brace4.rotation.set(0, 0, deg(-102.6804));
  root.add(brace4);
  const joist = new THREE.Mesh(boxGeo4, beamMat);
  joist.name = 'joist';
  joist.position.set(0, 1.08, -0.88);
  root.add(joist);
  const joist2 = new THREE.Mesh(boxGeo4, beamMat);
  joist2.name = 'joist';
  joist2.position.set(0, 1.08, 0.88);
  root.add(joist2);
  const plank = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.0722), deckMat);
  plank.name = 'plank';
  plank.position.set(-1.8889, 1.1768, -0.0226);
  plank.rotation.set(0, deg(0.3851), 0);
  root.add(plank);
  const plank2 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.1145), deckMat);
  plank2.name = 'plank';
  plank2.position.set(-1.6667, 1.1733, 0.019);
  plank2.rotation.set(0, deg(0.5997), 0);
  root.add(plank2);
  const plank3 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.1104), deckMat);
  plank3.name = 'plank';
  plank3.position.set(-1.4444, 1.1787, 0.0078);
  plank3.rotation.set(0, deg(0.2426), 0);
  root.add(plank3);
  const plank4 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.0473), deck2Mat);
  plank4.name = 'plank';
  plank4.position.set(-1.2222, 1.1724, 0.0102);
  plank4.rotation.set(0, deg(-0.3981), 0);
  root.add(plank4);
  const plank5 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.0974), deck2Mat);
  plank5.name = 'plank';
  plank5.position.set(-1, 1.1762, 0.0242);
  plank5.rotation.set(0, deg(0.5734), 0);
  root.add(plank5);
  const plank6 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.1184), deckMat);
  plank6.name = 'plank';
  plank6.position.set(-0.7778, 1.1736, -0.0058);
  plank6.rotation.set(0, deg(-0.2268), 0);
  root.add(plank6);
  const plank7 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.1135), deck2Mat);
  plank7.name = 'plank';
  plank7.position.set(-0.5556, 1.1711, -0.0047);
  plank7.rotation.set(0, deg(-0.8184), 0);
  root.add(plank7);
  const plank8 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.1187), deck3Mat);
  plank8.name = 'plank';
  plank8.position.set(-0.3333, 1.1788, 0.0078);
  plank8.rotation.set(0, deg(0.5709), 0);
  root.add(plank8);
  const plank9 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.0686), deck3Mat);
  plank9.name = 'plank';
  plank9.position.set(-0.1111, 1.1722, 0.0228);
  plank9.rotation.set(0, deg(0.405), 0);
  root.add(plank9);
  const plank10 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.1116), deckMat);
  plank10.name = 'plank';
  plank10.position.set(0.1111, 1.1732, 0.015);
  plank10.rotation.set(0, deg(-0.1655), 0);
  root.add(plank10);
  const plank11 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.1096), deckMat);
  plank11.name = 'plank';
  plank11.position.set(0.3333, 1.1784, -0.0014);
  plank11.rotation.set(0, deg(-0.2343), 0);
  root.add(plank11);
  const plank12 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.0524), deckMat);
  plank12.name = 'plank';
  plank12.position.set(0.5556, 1.1772, -0.006);
  plank12.rotation.set(0, deg(0.5573), 0);
  root.add(plank12);
  const plank13 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.1227), deck2Mat);
  plank13.name = 'plank';
  plank13.position.set(0.7778, 1.1723, 0.017);
  plank13.rotation.set(0, deg(0.0597), 0);
  root.add(plank13);
  const plank14 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.0782), deckMat);
  plank14.name = 'plank';
  plank14.position.set(1, 1.1747, -0.0009);
  plank14.rotation.set(0, deg(-0.3034), 0);
  root.add(plank14);
  const plank15 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.0902), deck2Mat);
  plank15.name = 'plank';
  plank15.position.set(1.2222, 1.1747, 0.0008);
  plank15.rotation.set(0, deg(0.0035), 0);
  root.add(plank15);
  const plank16 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.0482), deckMat);
  plank16.name = 'plank';
  plank16.position.set(1.4444, 1.1753, 0.0188);
  plank16.rotation.set(0, deg(-0.0636), 0);
  root.add(plank16);
  const plank17 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.1101), deck3Mat);
  plank17.name = 'plank';
  plank17.position.set(1.6667, 1.1757, -0.0192);
  plank17.rotation.set(0, deg(-0.3111), 0);
  root.add(plank17);
  const plank18 = new THREE.Mesh(new THREE.BoxGeometry(0.2002, 0.05, 2.1213), deck2Mat);
  plank18.name = 'plank';
  plank18.position.set(1.8889, 1.1739, -0.0235);
  plank18.rotation.set(0, deg(-0.3014), 0);
  root.add(plank18);
  const fascia = new THREE.Mesh(boxGeo5, beamMat);
  fascia.name = 'fascia';
  fascia.position.set(0, 1.1, -1.06);
  root.add(fascia);
  const fascia2 = new THREE.Mesh(boxGeo5, beamMat);
  fascia2.name = 'fascia';
  fascia2.position.set(0, 1.1, 1.06);
  root.add(fascia2);
  const mooringPile = new THREE.Mesh(cylinderGeo3, pilingMat);
  mooringPile.name = 'mooringPile';
  mooringPile.position.set(-1.84, 0.875, 1.13);
  mooringPile.rotation.set(0, deg(22), 0);
  root.add(mooringPile);
  const pileTop = new THREE.Mesh(cylinderGeo4, pilingMat);
  pileTop.name = 'pileTop';
  pileTop.position.set(-1.84, 1.79, 1.13);
  pileTop.rotation.set(0, deg(22), 0);
  root.add(pileTop);
  const waterLine5 = new THREE.Mesh(cylinderGeo2, algaeMat);
  waterLine5.name = 'waterLine';
  waterLine5.position.set(-1.84, 0.16, 1.13);
  root.add(waterLine5);
  const ropeWrap = new THREE.Mesh(torusGeo, ropeMat);
  ropeWrap.name = 'ropeWrap';
  ropeWrap.position.set(-1.84, 1.38, 1.13);
  ropeWrap.rotation.set(deg(90), 0, 0);
  root.add(ropeWrap);
  const ropeWrap2 = new THREE.Mesh(torusGeo, ropeMat);
  ropeWrap2.name = 'ropeWrap';
  ropeWrap2.position.set(-1.84, 1.5, 1.13);
  ropeWrap2.rotation.set(deg(90), 0, 0);
  root.add(ropeWrap2);
  const mooringPile2 = new THREE.Mesh(cylinderGeo3, pilingMat);
  mooringPile2.name = 'mooringPile';
  mooringPile2.position.set(1.84, 0.875, 1.13);
  mooringPile2.rotation.set(0, deg(22), 0);
  root.add(mooringPile2);
  const pileTop2 = new THREE.Mesh(cylinderGeo4, pilingMat);
  pileTop2.name = 'pileTop';
  pileTop2.position.set(1.84, 1.79, 1.13);
  pileTop2.rotation.set(0, deg(22), 0);
  root.add(pileTop2);
  const waterLine6 = new THREE.Mesh(cylinderGeo2, algaeMat);
  waterLine6.name = 'waterLine';
  waterLine6.position.set(1.84, 0.16, 1.13);
  root.add(waterLine6);
  const ropeWrap3 = new THREE.Mesh(torusGeo, ropeMat);
  ropeWrap3.name = 'ropeWrap';
  ropeWrap3.position.set(1.84, 1.38, 1.13);
  ropeWrap3.rotation.set(deg(90), 0, 0);
  root.add(ropeWrap3);
  const ropeWrap4 = new THREE.Mesh(torusGeo, ropeMat);
  ropeWrap4.name = 'ropeWrap';
  ropeWrap4.position.set(1.84, 1.5, 1.13);
  ropeWrap4.rotation.set(deg(90), 0, 0);
  root.add(ropeWrap4);
  const cleatBase = new THREE.Mesh(new THREE.BoxGeometry(0.08, 0.06, 0.08), ironMat);
  cleatBase.name = 'cleatBase';
  cleatBase.position.set(0.3, 1.23, 0.85);
  root.add(cleatBase);
  const cleatHorn = new THREE.Mesh(new THREE.BoxGeometry(0.34, 0.04, 0.07), ironMat);
  cleatHorn.name = 'cleatHorn';
  cleatHorn.position.set(0.3, 1.28, 0.85);
  root.add(cleatHorn);
  const ropeCoil = new THREE.Mesh(new THREE.TorusGeometry(0.2, 0.028, 3, 10), ropeMat);
  ropeCoil.name = 'ropeCoil';
  ropeCoil.position.set(-0.55, 1.228, -0.36);
  ropeCoil.rotation.set(deg(90), 0, 0);
  root.add(ropeCoil);
  const ropeCoil2 = new THREE.Mesh(new THREE.TorusGeometry(0.155, 0.028, 3, 10), ropeMat);
  ropeCoil2.name = 'ropeCoil';
  ropeCoil2.position.set(-0.55, 1.273, -0.36);
  ropeCoil2.rotation.set(deg(90), 0, 0);
  root.add(ropeCoil2);
  const ropeCoil3 = new THREE.Mesh(new THREE.TorusGeometry(0.11, 0.028, 3, 10), ropeMat);
  ropeCoil3.name = 'ropeCoil';
  ropeCoil3.position.set(-0.55, 1.318, -0.36);
  ropeCoil3.rotation.set(deg(90), 0, 0);
  root.add(ropeCoil3);
  const ladderRail = new THREE.Mesh(boxGeo6, beamMat);
  ladderRail.name = 'ladderRail';
  ladderRail.position.set(0.88, 0.85, 1.1);
  root.add(ladderRail);
  const ladderRail2 = new THREE.Mesh(boxGeo6, beamMat);
  ladderRail2.name = 'ladderRail';
  ladderRail2.position.set(1.32, 0.85, 1.1);
  root.add(ladderRail2);
  const ladderRung = new THREE.Mesh(cylinderGeo5, ironMat);
  ladderRung.name = 'ladderRung';
  ladderRung.position.set(1.1, 0.25, 1.1);
  ladderRung.rotation.set(0, 0, deg(-90));
  root.add(ladderRung);
  const ladderRung2 = new THREE.Mesh(cylinderGeo5, ironMat);
  ladderRung2.name = 'ladderRung';
  ladderRung2.position.set(1.1, 0.55, 1.1);
  ladderRung2.rotation.set(0, 0, deg(-90));
  root.add(ladderRung2);
  const ladderRung3 = new THREE.Mesh(cylinderGeo5, ironMat);
  ladderRung3.name = 'ladderRung';
  ladderRung3.position.set(1.1, 0.85, 1.1);
  ladderRung3.rotation.set(0, 0, deg(-90));
  root.add(ladderRung3);
  const ladderRung4 = new THREE.Mesh(cylinderGeo5, ironMat);
  ladderRung4.name = 'ladderRung';
  ladderRung4.position.set(1.1, 1.15, 1.1);
  ladderRung4.rotation.set(0, 0, deg(-90));
  root.add(ladderRung4);

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

export default createDock;

Avaliações e comentários

—
Nenhuma avaliação ainda — seja o primeiro.
5
0
4
0
3
0
2
0
1
0

Entre para avaliar e comentar.

0 comentário

Nenhum comentário ainda. Conte como você usou este modelo ou o que poderia melhorar.

Modelos relacionados

Mesma categoria ou tags parecidas