Codels
740 üçgen1,20 × 1,76 × 1,20 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.
/**
 * Trophy Pedestal — Codels 3D model library
 * License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
 * Triangles: 740 · Size (W × H × D): 1.20 × 1.76 × 1.20 m
 *
 * Usage:
 *   import { createTrophyPedestal } from './trophy-pedestal.js';
 *   
 *   const model = createTrophyPedestal();
 *   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);
}

export function createTrophyPedestal() {
  const root = new THREE.Group();
  root.name = 'TrophyPedestal';

  // Materials
  const bodyMat = new THREE.MeshStandardMaterial({ name: 'body', color: 0x2f5fd0, roughness: 0.55, flatShading: true });
  const bodyDarkMat = new THREE.MeshStandardMaterial({ name: 'bodyDark', color: 0x1c397d, roughness: 0.6, flatShading: true });
  const capMat = new THREE.MeshStandardMaterial({ name: 'cap', color: 0x5d82da, roughness: 0.5, flatShading: true });
  const goldMat = new THREE.MeshStandardMaterial({ name: 'gold', color: 0xffc83d, roughness: 0.3, metalness: 0.6, emissive: 0xffb000, emissiveIntensity: 0.2, flatShading: true });
  const glowMat = new THREE.MeshStandardMaterial({ name: 'glow', color: 0xfff6d6, roughness: 0.3, emissive: 0xffe9a0, emissiveIntensity: 1.1, flatShading: true });
  const darkMat = new THREE.MeshStandardMaterial({ name: 'dark', color: 0x2a2e38, roughness: 0.5, flatShading: true });

  // Shared geometries
  const torusGeo = new THREE.TorusGeometry(0.06, 0.014, 4, 8, Math.PI);

  // Parts
  const pedestal = new THREE.Group();
  pedestal.name = 'pedestal';
  root.add(pedestal);
  const plinth = new THREE.Mesh(new THREE.BoxGeometry(1.2, 0.1, 1.2), bodyDarkMat);
  plinth.name = 'plinth';
  plinth.position.set(0, 0.05, 0);
  pedestal.add(plinth);
  const body = new THREE.Mesh(new THREE.BoxGeometry(1.1, 0.82, 1.1), bodyMat);
  body.name = 'body';
  body.position.set(0, 0.51, 0);
  pedestal.add(body);
  const trim = new THREE.Mesh(new THREE.BoxGeometry(1.11, 0.07, 1.11), goldMat);
  trim.name = 'trim';
  trim.position.set(0, 0.865, 0);
  pedestal.add(trim);
  const cap = new THREE.Mesh(new THREE.BoxGeometry(1.16, 0.08, 1.16), capMat);
  cap.name = 'cap';
  cap.position.set(0, 0.94, 0);
  pedestal.add(cap);
  const capInset = new THREE.Mesh(new THREE.BoxGeometry(1.04, 0.02, 1.04), bodyMat);
  capInset.name = 'capInset';
  capInset.position.set(0, 0.99, 0);
  pedestal.add(capInset);
  const box7 = new THREE.Mesh(new THREE.BoxGeometry(0.075, 0.525, 0.03), goldMat);
  box7.position.set(0, 0.485, 0.56);
  pedestal.add(box7);
  const box8 = new THREE.Mesh(new THREE.BoxGeometry(0.075, 0.075, 0.03), goldMat);
  box8.position.set(-0.075, 0.635, 0.56);
  pedestal.add(box8);
  const box9 = new THREE.Mesh(new THREE.BoxGeometry(0.225, 0.075, 0.03), goldMat);
  box9.position.set(0, 0.26, 0.56);
  pedestal.add(box9);
  const slotRim = new THREE.Mesh(new THREE.CylinderGeometry(0.3, 0.3, 0.02, 16), bodyDarkMat);
  slotRim.name = 'slotRim';
  slotRim.position.set(0, 1.01, 0);
  pedestal.add(slotRim);
  const slotRing = new THREE.Mesh(new THREE.TorusGeometry(0.27, 0.025, 4, 18), glowMat);
  slotRing.name = 'slotRing';
  slotRing.position.set(0, 1.02, 0);
  slotRing.rotation.set(deg(90), 0, 0);
  pedestal.add(slotRing);
  const slotGlow = new THREE.Mesh(new THREE.CylinderGeometry(0.22, 0.22, 0.012, 16), glowMat);
  slotGlow.name = 'slotGlow';
  slotGlow.position.set(0, 1.016, 0);
  pedestal.add(slotGlow);
  const trophy = new THREE.Group();
  trophy.name = 'trophy';
  trophy.position.set(0, 1.022, 0);
  trophy.scale.setScalar(1.5);
  pedestal.add(trophy);
  const trophyBase = new THREE.Mesh(new THREE.BoxGeometry(0.22, 0.08, 0.22), darkMat);
  trophyBase.name = 'trophyBase';
  trophyBase.position.set(0, 0.04, 0);
  trophy.add(trophyBase);
  const box15 = new THREE.Mesh(new THREE.BoxGeometry(0.17, 0.05, 0.17), darkMat);
  box15.position.set(0, 0.105, 0);
  trophy.add(box15);
  const box16 = new THREE.Mesh(new THREE.BoxGeometry(0.12, 0.03, 0.005), goldMat);
  box16.position.set(0, 0.04, 0.111);
  trophy.add(box16);
  const cup = new THREE.Mesh(lathe([[0, 0], [0.05, 0], [0.05, 0.02], [0.025, 0.05], [0.02, 0.12], [0.045, 0.15], [0.1, 0.19], [0.125, 0.27], [0.135, 0.35], [0.12, 0.36], [0, 0.36]], 10), goldMat);
  cup.name = 'cup';
  cup.position.set(0, 0.13, 0);
  trophy.add(cup);
  const torus18 = new THREE.Mesh(torusGeo, goldMat);
  torus18.position.set(-0.125, 0.39, 0);
  torus18.rotation.set(0, 0, deg(-90));
  trophy.add(torus18);
  const torus19 = new THREE.Mesh(torusGeo, goldMat);
  torus19.position.set(0.125, 0.39, 0);
  torus19.rotation.set(0, 0, deg(90));
  trophy.add(torus19);
  const star = new THREE.Mesh(new THREE.OctahedronGeometry(0.035, 0), glowMat);
  star.name = 'star';
  star.position.set(0, 0.39, 0.128);
  star.scale.set(1, 1.3, 0.5);
  trophy.add(star);

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

export default createTrophyPedestal;

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