840 三角面0.43 × 0.78 × 0.43 m
在代码中使用
在编辑器中改编clay-pot.js · 65 行
自包含的 ES 模块,仅依赖 three。调用工厂函数,然后把返回的 group 添加到场景中。
/**
* Clay Pot — Codels 3D model library
* License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
* Triangles: 840 · Size (W × H × D): 0.43 × 0.78 × 0.43 m
*
* Usage:
* import { createClayPot } from './clay-pot.js';
*
* const model = createClayPot();
* model.position.set(0, 0, 0);
* scene.add(model);
*/
import * as THREE from 'three';
// 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);
}
// Tube along a smooth curve through the given points.
function tube(path, radius, tubularSegments, radialSegments, closed = false) {
const curve = new THREE.CatmullRomCurve3(path.map(([x, y, z]) => new THREE.Vector3(x, y, z)), closed);
return new THREE.TubeGeometry(curve, tubularSegments, radius, radialSegments, closed);
}
export function createClayPot() {
const root = new THREE.Group();
root.name = 'ClayPot';
// Materials
const clayMat = new THREE.MeshStandardMaterial({ name: 'clay', color: 0xc0643a, roughness: 0.85, flatShading: true });
const innerMat = new THREE.MeshStandardMaterial({ name: 'inner', color: 0x492616, roughness: 1, flatShading: true });
const paintMat = new THREE.MeshStandardMaterial({ name: 'paint', color: 0x2e2220, roughness: 0.7, flatShading: true });
// Parts
const body = new THREE.Mesh(lathe([[0, 0.004], [0.075, 0], [0.078, 0.025], [0.05, 0.05], [0.07, 0.1], [0.15, 0.2], [0.2, 0.32], [0.215, 0.42], [0.2, 0.51], [0.14, 0.59], [0.08, 0.63], [0.068, 0.7], [0.075, 0.74], [0.098, 0.765], [0.09, 0.777], [0.078, 0.769]], 12), clayMat);
body.name = 'body';
root.add(body);
const interior = new THREE.Mesh(lathe([[0.078, 0.769], [0.052, 0.725], [0.048, 0.645], [0, 0.645]], 12), innerMat);
interior.name = 'interior';
root.add(interior);
const band1 = new THREE.Mesh(lathe([[0.1897, 0.3], [0.1957, 0.3], [0.204, 0.32], [0.2048, 0.325], [0.1988, 0.325]], 12), paintMat);
band1.name = 'band1';
root.add(band1);
const band2 = new THREE.Mesh(lathe([[0.2047, 0.47], [0.2107, 0.47], [0.2057, 0.5], [0.1997, 0.5]], 12), paintMat);
band2.name = 'band2';
root.add(band2);
const handleL = new THREE.Mesh(tube([[-0.07, 0.705, 0], [-0.15, 0.715, 0], [-0.19, 0.66, 0], [-0.185, 0.56, 0], [-0.165, 0.54, 0]], 0.017, 12, 5), clayMat);
handleL.name = 'handleL';
root.add(handleL);
const handleR = new THREE.Mesh(tube([[0.07, 0.705, 0], [0.15, 0.715, 0], [0.19, 0.66, 0], [0.185, 0.56, 0], [0.165, 0.54, 0]], 0.017, 12, 5), clayMat);
handleR.name = 'handleR';
root.add(handleR);
root.traverse((o) => {
if (o.isMesh) {
o.castShadow = true;
o.receiveShadow = true;
}
});
return root;
}
export default createClayPot;
评分与评论
0 条评论
暂无评论。分享一下你是如何使用这个模型的,或者有哪些可以改进的地方。
相关模型
同一分类或相似标签









