Codels
삼각형 2.2천개2.26 × 2.59 × 5.81 m

코드에서 사용하기

에디터에서 리믹스
독립형 ES 모듈이에요 — three에만 의존해요. 팩토리 함수를 호출하고 그룹을 씬에 추가하세요.
/**
 * Delivery Van — Codels 3D model library
 * License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
 * Triangles: 2,176 · Size (W × H × D): 2.26 × 2.59 × 5.81 m
 *
 * Usage:
 *   import { createVan } from './van.js';
 *   
 *   const model = createVan();
 *   model.position.set(0, 0, 0);
 *   scene.add(model);
 */
import * as THREE from 'three';

const deg = THREE.MathUtils.degToRad;

// Revolve a 2D profile [[radius, y], ...] around the Y axis.
function lathe(points, segments, phiStart = 0, phiLength = Math.PI * 2) {
  return new THREE.LatheGeometry(points.map(([x, y]) => new THREE.Vector2(x, y)), segments, phiStart, phiLength);
}

// 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 createVan() {
  const root = new THREE.Group();
  root.name = 'Van';

  // Materials
  const paintMat = new THREE.MeshStandardMaterial({ name: 'paint', color: 0xeeeee8, roughness: 0.5, metalness: 0.1, flatShading: true });
  const stripeMat = new THREE.MeshStandardMaterial({ name: 'stripe', color: 0xe2572b, roughness: 0.5, metalness: 0.05, flatShading: true });
  const glassMat = new THREE.MeshStandardMaterial({ name: 'glass', color: 0x2a3644, roughness: 0.2, metalness: 0.3, flatShading: true });
  const trimMat = new THREE.MeshStandardMaterial({ name: 'trim', color: 0x2a2b30, roughness: 0.85, flatShading: true });
  const steelMat = new THREE.MeshStandardMaterial({ name: 'steel', color: 0x9aa0a7, roughness: 0.45, metalness: 0.5, flatShading: true });
  const headlightMat = new THREE.MeshStandardMaterial({ name: 'headlight', color: 0xfff4d6, roughness: 0.3, emissive: 0xffe2a0, emissiveIntensity: 0.9, flatShading: true });
  const taillightMat = new THREE.MeshStandardMaterial({ name: 'taillight', color: 0xd81e28, roughness: 0.3, emissive: 0xff2020, emissiveIntensity: 0.7, flatShading: true });
  const amberMat = new THREE.MeshStandardMaterial({ name: 'amber', color: 0xf59a23, roughness: 0.3, emissive: 0xff8a10, emissiveIntensity: 0.6, flatShading: true });

  // Shared geometries
  const extrudeGeo = extrude([[1.7427, 1.5], [1.2961, 2.18], [1.02, 2.18], [1.02, 1.5]], 0.02);
  const boxGeo = new THREE.BoxGeometry(0.006, 1.7, 0.014);
  const boxGeo2 = new THREE.BoxGeometry(0.02, 0.035, 0.15);
  const boxGeo3 = new THREE.BoxGeometry(0.06, 0.06, 0.14);
  const boxGeo4 = new THREE.BoxGeometry(0.06, 0.3, 0.16);
  const boxGeo5 = new THREE.BoxGeometry(0.03, 0.1, 1.9);
  const boxGeo6 = new THREE.BoxGeometry(0.12, 0.52, 0.04);
  const boxGeo7 = new THREE.BoxGeometry(0.12, 0.12, 0.04);
  const boxGeo8 = new THREE.BoxGeometry(0.42, 0.22, 0.04);
  const boxGeo9 = new THREE.BoxGeometry(0.34, 0.15, 0.06);
  const boxGeo10 = new THREE.BoxGeometry(0.1, 0.07, 0.06);
  const boxGeo11 = new THREE.BoxGeometry(0.12, 0.035, 0.03);
  const boxGeo12 = new THREE.BoxGeometry(0.006, 1.75, 0.014);
  const boxGeo13 = new THREE.BoxGeometry(0.6, 0.42, 0.02);
  const boxGeo14 = new THREE.BoxGeometry(1.08, 0.03, 0.02);
  const boxGeo15 = new THREE.BoxGeometry(0.4, 0.12, 0.02);
  const boxGeo16 = new THREE.BoxGeometry(0.008, 0.2, 3.58);
  const boxGeo17 = new THREE.BoxGeometry(0.008, 0.05, 3.58);
  const latheGeo = lathe([[0.2232, -0.0912], [0.2232, -0.12], [0.323, -0.12], [0.36, -0.0672], [0.36, 0.0672], [0.323, 0.12], [0.2232, 0.12], [0.2232, 0.0912]], 12, 0, Math.PI * 2);
  const cylinderGeo = new THREE.CylinderGeometry(0.2232, 0.2232, 0.1824, 12);
  const cylinderGeo2 = new THREE.CylinderGeometry(0.183, 0.2187, 0.03, 12);
  const cylinderGeo3 = new THREE.CylinderGeometry(0.0558, 0.0714, 0.03, 8);

  // Parts
  const body = new THREE.Group();
  body.name = 'body';
  root.add(body);
  const shell = new THREE.Mesh(extrude([[2.62, 0.32], [2.72, 0.42], [2.74, 0.88], [2.56, 1.16], [2, 1.3], [1.3, 2.32], [1.05, 2.45], [-2.56, 2.46], [-2.7, 2.38], [-2.72, 0.42], [-2.62, 0.32], [-1.9882, 0.32], [-1.967, 0.5003], [-1.875, 0.6566], [-1.7276, 0.7626], [-1.55, 0.8], [-1.3724, 0.7626], [-1.225, 0.6566], [-1.133, 0.5003], [-1.1118, 0.32], [1.3118, 0.32], [1.333, 0.5003], [1.425, 0.6566], [1.5724, 0.7626], [1.75, 0.8], [1.9276, 0.7626], [2.075, 0.6566], [2.167, 0.5003], [2.1882, 0.32]], 1.9, [], [0.05, 0.05, 2]), paintMat);
  shell.name = 'shell';
  shell.rotation.set(0, deg(-90), 0);
  body.add(shell);
  const chassis = new THREE.Mesh(new THREE.BoxGeometry(1.5, 0.4, 4.9), trimMat);
  chassis.name = 'chassis';
  chassis.position.set(0, 0.5, 0);
  body.add(chassis);
  const windshield = new THREE.Mesh(new THREE.BoxGeometry(1.84, 0.02, 1.043), glassMat);
  windshield.name = 'windshield';
  windshield.position.set(0, 1.8462, 1.7028);
  windshield.rotation.set(deg(-124.4608), 0, 0);
  body.add(windshield);
  const windowL = new THREE.Mesh(extrudeGeo, glassMat);
  windowL.name = 'windowL';
  windowL.position.set(1.005, 0, 0);
  windowL.rotation.set(0, deg(-90), 0);
  body.add(windowL);
  const box6 = new THREE.Mesh(boxGeo, trimMat);
  box6.position.set(1.003, 1.33, 0.95);
  body.add(box6);
  const box7 = new THREE.Mesh(boxGeo2, trimMat);
  box7.position.set(1.01, 1.32, 1.12);
  body.add(box7);
  const box8 = new THREE.Mesh(boxGeo3, trimMat);
  box8.position.set(1.04, 1.62, 1.86);
  body.add(box8);
  const mirrorL = new THREE.Mesh(boxGeo4, trimMat);
  mirrorL.name = 'mirrorL';
  mirrorL.position.set(1.1, 1.66, 1.86);
  body.add(mirrorL);
  const box10 = new THREE.Mesh(boxGeo5, trimMat);
  box10.position.set(1.01, 0.62, -0.6);
  body.add(box10);
  const taillightL = new THREE.Mesh(boxGeo6, taillightMat);
  taillightL.name = 'taillightL';
  taillightL.position.set(0.86, 1.12, -2.78);
  body.add(taillightL);
  const box12 = new THREE.Mesh(boxGeo7, amberMat);
  box12.position.set(0.86, 0.78, -2.78);
  body.add(box12);
  const box13 = new THREE.Mesh(boxGeo8, trimMat);
  box13.position.set(0.68, 0.94, 2.755);
  box13.rotation.set(0, deg(-8), 0);
  body.add(box13);
  const headlightL = new THREE.Mesh(boxGeo9, headlightMat);
  headlightL.name = 'headlightL';
  headlightL.position.set(0.68, 0.96, 2.76);
  headlightL.rotation.set(0, deg(-8), 0);
  body.add(headlightL);
  const box15 = new THREE.Mesh(boxGeo10, amberMat);
  box15.position.set(0.86, 0.74, 2.77);
  body.add(box15);
  const box16 = new THREE.Mesh(boxGeo11, trimMat);
  box16.position.set(0.12, 1.2, -2.785);
  body.add(box16);
  const windowR = new THREE.Mesh(extrudeGeo, glassMat);
  windowR.name = 'windowR';
  windowR.position.set(-1.005, 0, 0);
  windowR.rotation.set(0, deg(-90), 0);
  body.add(windowR);
  const box18 = new THREE.Mesh(boxGeo, trimMat);
  box18.position.set(-1.003, 1.33, 0.95);
  body.add(box18);
  const box19 = new THREE.Mesh(boxGeo2, trimMat);
  box19.position.set(-1.01, 1.32, 1.12);
  body.add(box19);
  const box20 = new THREE.Mesh(boxGeo3, trimMat);
  box20.position.set(-1.04, 1.62, 1.86);
  body.add(box20);
  const mirrorR = new THREE.Mesh(boxGeo4, trimMat);
  mirrorR.name = 'mirrorR';
  mirrorR.position.set(-1.1, 1.66, 1.86);
  body.add(mirrorR);
  const box22 = new THREE.Mesh(boxGeo5, trimMat);
  box22.position.set(-1.01, 0.62, -0.6);
  body.add(box22);
  const taillightR = new THREE.Mesh(boxGeo6, taillightMat);
  taillightR.name = 'taillightR';
  taillightR.position.set(-0.86, 1.12, -2.78);
  body.add(taillightR);
  const box24 = new THREE.Mesh(boxGeo7, amberMat);
  box24.position.set(-0.86, 0.78, -2.78);
  body.add(box24);
  const box25 = new THREE.Mesh(boxGeo8, trimMat);
  box25.position.set(-0.68, 0.94, 2.755);
  box25.rotation.set(0, deg(8), 0);
  body.add(box25);
  const headlightR = new THREE.Mesh(boxGeo9, headlightMat);
  headlightR.name = 'headlightR';
  headlightR.position.set(-0.68, 0.96, 2.76);
  headlightR.rotation.set(0, deg(8), 0);
  body.add(headlightR);
  const box27 = new THREE.Mesh(boxGeo10, amberMat);
  box27.position.set(-0.86, 0.74, 2.77);
  body.add(box27);
  const box28 = new THREE.Mesh(boxGeo11, trimMat);
  box28.position.set(-0.12, 1.2, -2.785);
  body.add(box28);
  const box29 = new THREE.Mesh(boxGeo12, trimMat);
  box29.position.set(-1.003, 1.32, 0.8);
  body.add(box29);
  const box30 = new THREE.Mesh(boxGeo12, trimMat);
  box30.position.set(-1.003, 1.32, -0.55);
  body.add(box30);
  const box31 = new THREE.Mesh(new THREE.BoxGeometry(0.006, 0.014, 1.35), trimMat);
  box31.position.set(-1.003, 2.2, 0.125);
  body.add(box31);
  const box32 = new THREE.Mesh(boxGeo2, trimMat);
  box32.position.set(-1.01, 1.32, 0.66);
  body.add(box32);
  const slideRail = new THREE.Mesh(new THREE.BoxGeometry(0.012, 0.04, 2.05), trimMat);
  slideRail.name = 'slideRail';
  slideRail.position.set(-1.006, 1.9, -1.55);
  body.add(slideRail);
  const box34 = new THREE.Mesh(new THREE.BoxGeometry(0.014, 1.95, 0.006), trimMat);
  box34.position.set(0, 1.38, -2.773);
  body.add(box34);
  const rearWindowL = new THREE.Mesh(boxGeo13, glassMat);
  rearWindowL.name = 'rearWindowL';
  rearWindowL.position.set(0.4, 1.95, -2.776);
  body.add(rearWindowL);
  const rearWindowR = new THREE.Mesh(boxGeo13, glassMat);
  rearWindowR.name = 'rearWindowR';
  rearWindowR.position.set(-0.4, 1.95, -2.776);
  body.add(rearWindowR);
  const grille = new THREE.Mesh(new THREE.BoxGeometry(1.2, 0.26, 0.04), trimMat);
  grille.name = 'grille';
  grille.position.set(0, 0.88, 2.78);
  body.add(grille);
  const box38 = new THREE.Mesh(boxGeo14, steelMat);
  box38.position.set(0, 0.8, 2.805);
  body.add(box38);
  const box39 = new THREE.Mesh(boxGeo14, steelMat);
  box39.position.set(0, 0.88, 2.805);
  body.add(box39);
  const box40 = new THREE.Mesh(boxGeo14, steelMat);
  box40.position.set(0, 0.96, 2.805);
  body.add(box40);
  const bumperFront = new THREE.Mesh(new THREE.BoxGeometry(2.04, 0.24, 0.24), trimMat);
  bumperFront.name = 'bumperFront';
  bumperFront.position.set(0, 0.44, 2.74);
  body.add(bumperFront);
  const bumperRear = new THREE.Mesh(new THREE.BoxGeometry(2.04, 0.2, 0.26), trimMat);
  bumperRear.name = 'bumperRear';
  bumperRear.position.set(0, 0.44, -2.72);
  body.add(bumperRear);
  const rearStep = new THREE.Mesh(new THREE.BoxGeometry(0.8, 0.05, 0.22), steelMat);
  rearStep.name = 'rearStep';
  rearStep.position.set(0, 0.56, -2.82);
  body.add(rearStep);
  const plateFront = new THREE.Mesh(boxGeo15, steelMat);
  plateFront.name = 'plateFront';
  plateFront.position.set(0, 0.44, 2.87);
  body.add(plateFront);
  const plateRear = new THREE.Mesh(boxGeo15, steelMat);
  plateRear.name = 'plateRear';
  plateRear.position.set(0, 0.7, -2.782);
  body.add(plateRear);
  const roofVent = new THREE.Mesh(new THREE.BoxGeometry(0.5, 0.08, 0.5), trimMat);
  roofVent.name = 'roofVent';
  roofVent.position.set(0, 2.55, -0.9);
  body.add(roofVent);
  const brakeLight = new THREE.Mesh(new THREE.BoxGeometry(0.3, 0.05, 0.03), taillightMat);
  brakeLight.name = 'brakeLight';
  brakeLight.position.set(0, 2.42, -2.78);
  body.add(brakeLight);
  const stripeL = new THREE.Mesh(boxGeo16, stripeMat);
  stripeL.name = 'stripeL';
  stripeL.position.set(1.004, 1.18, -0.91);
  body.add(stripeL);
  const box49 = new THREE.Mesh(boxGeo17, stripeMat);
  box49.position.set(1.004, 1.36, -0.91);
  body.add(box49);
  const logoL = new THREE.Mesh(extrude([[0.55, -0.12], [-0.18, -0.12], [-0.18, -0.3], [-0.6, 0.06], [-0.18, 0.42], [-0.18, 0.24], [0.55, 0.24]], 0.012), stripeMat);
  logoL.name = 'logoL';
  logoL.position.set(1.006, 1.72, -0.95);
  logoL.rotation.set(0, deg(90), 0);
  body.add(logoL);
  const stripeR = new THREE.Mesh(boxGeo16, stripeMat);
  stripeR.name = 'stripeR';
  stripeR.position.set(-1.004, 1.18, -0.91);
  body.add(stripeR);
  const box52 = new THREE.Mesh(boxGeo17, stripeMat);
  box52.position.set(-1.004, 1.36, -0.91);
  body.add(box52);
  const logoR = new THREE.Mesh(extrude([[-0.55, -0.12], [0.18, -0.12], [0.18, -0.3], [0.6, 0.06], [0.18, 0.42], [0.18, 0.24], [-0.55, 0.24]], 0.012), stripeMat);
  logoR.name = 'logoR';
  logoR.position.set(-1.006, 1.72, -0.95);
  logoR.rotation.set(0, deg(-90), 0);
  body.add(logoR);
  const stripeRear = new THREE.Mesh(new THREE.BoxGeometry(1.9, 0.2, 0.008), stripeMat);
  stripeRear.name = 'stripeRear';
  stripeRear.position.set(0, 1.18, -2.774);
  body.add(stripeRear);
  const wheels = new THREE.Group();
  wheels.name = 'wheels';
  root.add(wheels);
  const wheelFL = new THREE.Group();
  wheelFL.name = 'wheelFL';
  wheelFL.position.set(0.86, 0.36, 1.75);
  wheels.add(wheelFL);
  const tire = new THREE.Mesh(latheGeo, trimMat);
  tire.name = 'tire';
  tire.rotation.set(0, 0, deg(90));
  wheelFL.add(tire);
  const rim = new THREE.Mesh(cylinderGeo, steelMat);
  rim.name = 'rim';
  rim.rotation.set(0, 0, deg(90));
  wheelFL.add(rim);
  const hubcap = new THREE.Mesh(cylinderGeo2, steelMat);
  hubcap.name = 'hubcap';
  hubcap.position.set(0.1062, 0, 0);
  hubcap.rotation.set(0, 0, deg(-90));
  wheelFL.add(hubcap);
  const centerCap = new THREE.Mesh(cylinderGeo3, trimMat);
  centerCap.name = 'centerCap';
  centerCap.position.set(0.1312, 0, 0);
  centerCap.rotation.set(0, 0, deg(-90));
  wheelFL.add(centerCap);
  const wheelFR = new THREE.Group();
  wheelFR.name = 'wheelFR';
  wheelFR.position.set(-0.86, 0.36, 1.75);
  wheels.add(wheelFR);
  const tire2 = new THREE.Mesh(latheGeo, trimMat);
  tire2.name = 'tire';
  tire2.rotation.set(0, 0, deg(90));
  wheelFR.add(tire2);
  const rim2 = new THREE.Mesh(cylinderGeo, steelMat);
  rim2.name = 'rim';
  rim2.rotation.set(0, 0, deg(90));
  wheelFR.add(rim2);
  const hubcap2 = new THREE.Mesh(cylinderGeo2, steelMat);
  hubcap2.name = 'hubcap';
  hubcap2.position.set(-0.1062, 0, 0);
  hubcap2.rotation.set(0, 0, deg(90));
  wheelFR.add(hubcap2);
  const centerCap2 = new THREE.Mesh(cylinderGeo3, trimMat);
  centerCap2.name = 'centerCap';
  centerCap2.position.set(-0.1312, 0, 0);
  centerCap2.rotation.set(0, 0, deg(90));
  wheelFR.add(centerCap2);
  const wheelRL = new THREE.Group();
  wheelRL.name = 'wheelRL';
  wheelRL.position.set(0.86, 0.36, -1.55);
  wheels.add(wheelRL);
  const tire3 = new THREE.Mesh(latheGeo, trimMat);
  tire3.name = 'tire';
  tire3.rotation.set(0, 0, deg(90));
  wheelRL.add(tire3);
  const rim3 = new THREE.Mesh(cylinderGeo, steelMat);
  rim3.name = 'rim';
  rim3.rotation.set(0, 0, deg(90));
  wheelRL.add(rim3);
  const hubcap3 = new THREE.Mesh(cylinderGeo2, steelMat);
  hubcap3.name = 'hubcap';
  hubcap3.position.set(0.1062, 0, 0);
  hubcap3.rotation.set(0, 0, deg(-90));
  wheelRL.add(hubcap3);
  const centerCap3 = new THREE.Mesh(cylinderGeo3, trimMat);
  centerCap3.name = 'centerCap';
  centerCap3.position.set(0.1312, 0, 0);
  centerCap3.rotation.set(0, 0, deg(-90));
  wheelRL.add(centerCap3);
  const wheelRR = new THREE.Group();
  wheelRR.name = 'wheelRR';
  wheelRR.position.set(-0.86, 0.36, -1.55);
  wheels.add(wheelRR);
  const tire4 = new THREE.Mesh(latheGeo, trimMat);
  tire4.name = 'tire';
  tire4.rotation.set(0, 0, deg(90));
  wheelRR.add(tire4);
  const rim4 = new THREE.Mesh(cylinderGeo, steelMat);
  rim4.name = 'rim';
  rim4.rotation.set(0, 0, deg(90));
  wheelRR.add(rim4);
  const hubcap4 = new THREE.Mesh(cylinderGeo2, steelMat);
  hubcap4.name = 'hubcap';
  hubcap4.position.set(-0.1062, 0, 0);
  hubcap4.rotation.set(0, 0, deg(90));
  wheelRR.add(hubcap4);
  const centerCap4 = new THREE.Mesh(cylinderGeo3, trimMat);
  centerCap4.name = 'centerCap';
  centerCap4.position.set(-0.1312, 0, 0);
  centerCap4.rotation.set(0, 0, deg(90));
  wheelRR.add(centerCap4);

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

export default createVan;

평점 및 댓글

—
아직 평점이 없어요 — 첫 평점을 남겨 보세요.
5
0
4
0
3
0
2
0
1
0

평점과 댓글을 남기려면 로그인하세요.

댓글 0개

아직 댓글이 없어요. 이 모델을 어떻게 사용했는지, 어떤 점이 더 나아질 수 있을지 공유해 주세요.

관련 모델

같은 카테고리 또는 비슷한 태그