Codels
456 üçgen0,17 × 1,54 × 0,18 m
Bağımsız bir ES modülü — yalnızca three paketine bağımlıdır. Fabrika fonksiyonunu çağırıp dönen grubu sahnene ekle.
/**
 * Parking Meter — Codels 3D model library
 * License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
 * Triangles: 456 · Size (W × H × D): 0.17 × 1.54 × 0.18 m
 *
 * Usage:
 *   import { createParkingMeter } from './parking-meter.js';
 *   
 *   const model = createParkingMeter();
 *   model.position.set(0, 0, 0);
 *   scene.add(model);
 */
import * as THREE from 'three';

const deg = THREE.MathUtils.degToRad;

export function createParkingMeter() {
  const root = new THREE.Group();
  root.name = 'ParkingMeter';

  // Materials
  const housingMat = new THREE.MeshStandardMaterial({ name: 'housing', color: 0x5f7f96, roughness: 0.45, metalness: 0.45, flatShading: true });
  const trimMat = new THREE.MeshStandardMaterial({ name: 'trim', color: 0xc4c8cc, roughness: 0.3, metalness: 0.8, flatShading: true });
  const postMat = new THREE.MeshStandardMaterial({ name: 'post', color: 0x4a5056, roughness: 0.5, metalness: 0.5, flatShading: true });
  const darkMat = new THREE.MeshStandardMaterial({ name: 'dark', color: 0x1d1f22, roughness: 0.6, flatShading: true });
  const dialMat = new THREE.MeshStandardMaterial({ name: 'dial', color: 0xefe9d6, roughness: 0.5, flatShading: true });
  const flagMat = new THREE.MeshStandardMaterial({ name: 'flag', color: 0x6f7a80, roughness: 0.5, flatShading: true });
  const glassMat = new THREE.MeshStandardMaterial({ name: 'glass', color: 0xd8ecf4, roughness: 0.25, transparent: true, opacity: 0.22 });

  // Parts
  const baseFlange = new THREE.Mesh(new THREE.CylinderGeometry(0.08, 0.09, 0.02, 10), postMat);
  baseFlange.name = 'baseFlange';
  baseFlange.position.set(0, 0.01, 0);
  root.add(baseFlange);
  const post = new THREE.Mesh(new THREE.CylinderGeometry(0.032, 0.036, 1.12, 10), postMat);
  post.name = 'post';
  post.position.set(0, 0.58, 0);
  root.add(post);
  const head = new THREE.Group();
  head.name = 'head';
  head.position.set(0, 1.19, 0);
  root.add(head);
  const body = new THREE.Mesh(new THREE.BoxGeometry(0.16, 0.24, 0.13), housingMat);
  body.name = 'body';
  body.position.set(0, 0.12, 0);
  head.add(body);
  const collar = new THREE.Mesh(new THREE.BoxGeometry(0.172, 0.03, 0.142), trimMat);
  collar.name = 'collar';
  collar.position.set(0, 0.25, 0);
  head.add(collar);
  const neck = new THREE.Mesh(new THREE.BoxGeometry(0.12, 0.05, 0.11), housingMat);
  neck.name = 'neck';
  neck.position.set(0, -0.025, 0);
  head.add(neck);
  const dial = new THREE.Mesh(new THREE.CylinderGeometry(0.066, 0.066, 0.008, 12, 1, false, Math.PI / 2, Math.PI), dialMat);
  dial.name = 'dial';
  dial.position.set(0, 0.266, -0.012);
  dial.rotation.set(deg(90), 0, 0);
  head.add(dial);
  const timeFlag = new THREE.Mesh(new THREE.BoxGeometry(0.024, 0.05, 0.006), flagMat);
  timeFlag.name = 'timeFlag';
  timeFlag.position.set(0.015, 0.3, 0.004);
  timeFlag.rotation.set(0, 0, deg(-60));
  head.add(timeFlag);
  const dome = new THREE.Mesh(new THREE.CylinderGeometry(0.075, 0.075, 0.12, 12, 1, false, Math.PI / 2, Math.PI), glassMat);
  dome.name = 'dome';
  dome.position.set(0, 0.265, 0);
  dome.rotation.set(deg(90), 0, 0);
  head.add(dome);
  const domeRim = new THREE.Mesh(new THREE.TorusGeometry(0.076, 0.007, 4, 12, Math.PI), trimMat);
  domeRim.name = 'domeRim';
  domeRim.position.set(0, 0.265, 0.062);
  head.add(domeRim);
  const domeBack = new THREE.Mesh(new THREE.CylinderGeometry(0.08, 0.08, 0.012, 12, 1, false, Math.PI / 2, Math.PI), housingMat);
  domeBack.name = 'domeBack';
  domeBack.position.set(0, 0.265, -0.066);
  domeBack.rotation.set(deg(90), 0, 0);
  head.add(domeBack);
  const coinPlate = new THREE.Mesh(new THREE.BoxGeometry(0.07, 0.05, 0.012), trimMat);
  coinPlate.name = 'coinPlate';
  coinPlate.position.set(0, 0.19, 0.068);
  head.add(coinPlate);
  const coinSlot = new THREE.Mesh(new THREE.BoxGeometry(0.04, 0.007, 0.004), darkMat);
  coinSlot.name = 'coinSlot';
  coinSlot.position.set(0, 0.195, 0.075);
  head.add(coinSlot);
  const handleHub = new THREE.Mesh(new THREE.CylinderGeometry(0.022, 0.022, 0.02, 10), trimMat);
  handleHub.name = 'handleHub';
  handleHub.position.set(0, 0.11, 0.072);
  handleHub.rotation.set(deg(90), 0, 0);
  head.add(handleHub);
  const handle = new THREE.Mesh(new THREE.BoxGeometry(0.09, 0.016, 0.014), trimMat);
  handle.name = 'handle';
  handle.position.set(0, 0.11, 0.084);
  handle.rotation.set(0, 0, deg(20));
  head.add(handle);
  const infoPlate = new THREE.Mesh(new THREE.BoxGeometry(0.1, 0.05, 0.006), dialMat);
  infoPlate.name = 'infoPlate';
  infoPlate.position.set(0, 0.04, 0.067);
  head.add(infoPlate);

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

export default createParkingMeter;

Puanlar ve yorumlar

—
Henüz puan yok — ilk puanı sen ver.
5
0
4
0
3
0
2
0
1
0

Puan vermek ve yorum yapmak için giriş yap.

0 yorum

Henüz yorum yok. Bu modeli nasıl kullandığını ya da neyin daha iyi olabileceğini paylaş.

Benzer modeller

Aynı kategori ya da benzer etiketler