Codels
210 üçgen0,20 × 0,05 × 0,03 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.
/**
 * Banana — Codels 3D model library
 * License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
 * Triangles: 210 · Size (W × H × D): 0.20 × 0.05 × 0.03 m
 *
 * Usage:
 *   import { createBanana } from './banana.js';
 *   
 *   const model = createBanana();
 *   model.position.set(0, 0, 0);
 *   scene.add(model);
 */
import * as THREE from 'three';

const deg = THREE.MathUtils.degToRad;

export function createBanana() {
  const root = new THREE.Group();
  root.name = 'Banana';

  // Materials
  const peelMat = new THREE.MeshStandardMaterial({ name: 'peel', color: 0xf6d33a, roughness: 0.55, flatShading: true });
  const neckMat = new THREE.MeshStandardMaterial({ name: 'neck', color: 0xb6b83e, roughness: 0.7, flatShading: true });
  const tipMat = new THREE.MeshStandardMaterial({ name: 'tip', color: 0x3d2a1c, roughness: 0.9, flatShading: true });
  const crownMat = new THREE.MeshStandardMaterial({ name: 'crown', color: 0x7d6a3a, roughness: 0.9, flatShading: true });

  // Shared geometries
  const cylinderGeo = new THREE.CylinderGeometry(0.018, 0.018, 0.0276, 5);

  // Parts
  const banana = new THREE.Group();
  banana.name = 'banana';
  banana.position.set(-0.085, 0.0428, 0);
  root.add(banana);
  const bananaSeg1 = new THREE.Mesh(new THREE.CylinderGeometry(0.0103, 0.0055, 0.0248, 5), neckMat);
  bananaSeg1.name = 'bananaSeg1';
  bananaSeg1.position.set(0.0093, -0.0049, 0);
  bananaSeg1.rotation.set(0, 0, deg(-117.9));
  banana.add(bananaSeg1);
  const bananaSeg2 = new THREE.Mesh(new THREE.CylinderGeometry(0.0148, 0.0103, 0.0265, 5), peelMat);
  bananaSeg2.name = 'bananaSeg2';
  bananaSeg2.position.set(0.0285, -0.0137, 0);
  bananaSeg2.rotation.set(0, 0, deg(-111.0111));
  banana.add(bananaSeg2);
  const bananaSeg3 = new THREE.Mesh(new THREE.CylinderGeometry(0.018, 0.0148, 0.0276, 5), peelMat);
  bananaSeg3.name = 'bananaSeg3';
  bananaSeg3.position.set(0.0486, -0.02, 0);
  bananaSeg3.rotation.set(0, 0, deg(-104.1222));
  banana.add(bananaSeg3);
  const bananaSeg4 = new THREE.Mesh(cylinderGeo, peelMat);
  bananaSeg4.name = 'bananaSeg4';
  bananaSeg4.position.set(0.0693, -0.0239, 0);
  bananaSeg4.rotation.set(0, 0, deg(-97.2333));
  banana.add(bananaSeg4);
  const bananaSeg5 = new THREE.Mesh(cylinderGeo, peelMat);
  bananaSeg5.name = 'bananaSeg5';
  bananaSeg5.position.set(0.0903, -0.0253, 0);
  bananaSeg5.rotation.set(0, 0, deg(-90.3444));
  banana.add(bananaSeg5);
  const bananaSeg6 = new THREE.Mesh(cylinderGeo, peelMat);
  bananaSeg6.name = 'bananaSeg6';
  bananaSeg6.position.set(0.1114, -0.0242, 0);
  bananaSeg6.rotation.set(0, 0, deg(-83.4556));
  banana.add(bananaSeg6);
  const bananaSeg7 = new THREE.Mesh(new THREE.CylinderGeometry(0.0176, 0.018, 0.0274, 5), peelMat);
  bananaSeg7.name = 'bananaSeg7';
  bananaSeg7.position.set(0.1321, -0.0205, 0);
  bananaSeg7.rotation.set(0, 0, deg(-76.5667));
  banana.add(bananaSeg7);
  const bananaSeg8 = new THREE.Mesh(new THREE.CylinderGeometry(0.0127, 0.0176, 0.0257, 5), peelMat);
  bananaSeg8.name = 'bananaSeg8';
  bananaSeg8.position.set(0.1523, -0.0144, 0);
  bananaSeg8.rotation.set(0, 0, deg(-69.6778));
  banana.add(bananaSeg8);
  const bananaSeg9 = new THREE.Mesh(new THREE.CylinderGeometry(0.0045, 0.0127, 0.0227, 5), peelMat);
  bananaSeg9.name = 'bananaSeg9';
  bananaSeg9.position.set(0.1716, -0.0059, 0);
  bananaSeg9.rotation.set(0, 0, deg(-62.7889));
  banana.add(bananaSeg9);
  const bananaStem = new THREE.Mesh(new THREE.CylinderGeometry(0.0068, 0.006, 0.0074, 5), crownMat);
  bananaStem.name = 'bananaStem';
  bananaStem.position.set(-0.0033, 0.0017, 0);
  bananaStem.rotation.set(0, 0, deg(62.1));
  banana.add(bananaStem);
  const bananaTip = new THREE.Mesh(new THREE.ConeGeometry(0.0048, 0.01, 5), tipMat);
  bananaTip.name = 'bananaTip';
  bananaTip.position.set(0.1845, 0.0007, 0);
  bananaTip.rotation.set(0, 0, deg(-62.7889));
  banana.add(bananaTip);

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

export default createBanana;

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