Codels
264 треуг.0,38 × 0,48 × 0,39 m

Использовать в коде

Ремикс в редакторе
Самодостаточный ES-модуль — зависит только от three. Вызовите фабрику и добавьте группу в сцену.
/**
 * Wooden Stool — Codels 3D model library
 * License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
 * Triangles: 264 · Size (W × H × D): 0.38 × 0.48 × 0.39 m
 *
 * Usage:
 *   import { createStool } from './stool.js';
 *   
 *   const model = createStool();
 *   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 createStool() {
  const root = new THREE.Group();
  root.name = 'Stool';

  // Materials
  const seatMat = new THREE.MeshStandardMaterial({ name: 'seat', color: 0xa5693a, roughness: 0.8, flatShading: true });
  const legMat = new THREE.MeshStandardMaterial({ name: 'leg', color: 0x7a4e2b, roughness: 0.9, flatShading: true });

  // Shared geometries
  const cylinderGeo = new THREE.CylinderGeometry(0.0216, 0.024, 0.458, 6);
  const cylinderGeo2 = new THREE.CylinderGeometry(0.012, 0.012, 0.281, 6);

  // Parts
  const seat = new THREE.Mesh(lathe([[0, 0.435], [0.15, 0.435], [0.17, 0.45], [0.17, 0.468], [0.154, 0.48], [0, 0.48]], 12), seatMat);
  seat.name = 'seat';
  root.add(seat);
  const leg1 = new THREE.Group();
  leg1.name = 'leg1';
  leg1.rotation.set(0, deg(180), 0);
  root.add(leg1);
  const leg = new THREE.Mesh(cylinderGeo, legMat);
  leg.name = 'leg';
  leg.position.set(0, 0.2288, 0.1442);
  leg.rotation.set(deg(-12.7462), 0, 0);
  leg1.add(leg);
  const leg2 = new THREE.Group();
  leg2.name = 'leg2';
  leg2.rotation.set(0, deg(300), 0);
  root.add(leg2);
  const leg3 = new THREE.Mesh(cylinderGeo, legMat);
  leg3.name = 'leg';
  leg3.position.set(0, 0.2288, 0.1442);
  leg3.rotation.set(deg(-12.7462), 0, 0);
  leg2.add(leg3);
  const leg32 = new THREE.Group();
  leg32.name = 'leg3';
  leg32.rotation.set(0, deg(420), 0);
  root.add(leg32);
  const leg4 = new THREE.Mesh(cylinderGeo, legMat);
  leg4.name = 'leg';
  leg4.position.set(0, 0.2288, 0.1442);
  leg4.rotation.set(deg(-12.7462), 0, 0);
  leg32.add(leg4);
  const rung1 = new THREE.Group();
  rung1.name = 'rung1';
  rung1.rotation.set(0, deg(240), 0);
  root.add(rung1);
  const rung = new THREE.Mesh(cylinderGeo2, legMat);
  rung.name = 'rung';
  rung.position.set(0, 0.1632, 0.0782);
  rung.rotation.set(0, 0, deg(90));
  rung1.add(rung);
  const rung2 = new THREE.Group();
  rung2.name = 'rung2';
  rung2.rotation.set(0, deg(360), 0);
  root.add(rung2);
  const rung3 = new THREE.Mesh(new THREE.CylinderGeometry(0.012, 0.012, 0.2693, 6), legMat);
  rung3.name = 'rung';
  rung3.position.set(0, 0.1932, 0.0748);
  rung3.rotation.set(0, 0, deg(90));
  rung2.add(rung3);
  const rung32 = new THREE.Group();
  rung32.name = 'rung3';
  rung32.rotation.set(0, deg(480), 0);
  root.add(rung32);
  const rung4 = new THREE.Mesh(cylinderGeo2, legMat);
  rung4.name = 'rung';
  rung4.position.set(0, 0.1632, 0.0782);
  rung4.rotation.set(0, 0, deg(90));
  rung32.add(rung4);

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

export default createStool;

Оценки и комментарии

—
Оценок пока нет — будьте первым.
5
0
4
0
3
0
2
0
1
0

Войдите, чтобы ставить оценки и оставлять комментарии.

0 комментариев

Комментариев пока нет. Расскажите, как вы использовали эту модель или что можно улучшить.

Похожие модели

Та же категория или похожие теги