344 üçgen0,39 × 0,43 × 0,53 m
Kodda kullan
Editörde remix’ledog.js · 204 satır
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.
/**
* Dog — Codels 3D model library
* License: CC0-1.0 · Units: meters · Y-up · Front: +Z · Origin: center of the base (y = 0)
* Triangles: 344 · Size (W × H × D): 0.39 × 0.43 × 0.53 m
*
* Usage:
* import { createDog } from './dog.js';
*
* const model = createDog();
* model.position.set(0, 0, 0);
* scene.add(model);
*/
import * as THREE from 'three';
const deg = THREE.MathUtils.degToRad;
export function createDog() {
const root = new THREE.Group();
root.name = 'Dog';
// Materials
const furMat = new THREE.MeshStandardMaterial({ name: 'fur', color: 0xdb9b4f, roughness: 0.9, flatShading: true });
const lightMat = new THREE.MeshStandardMaterial({ name: 'light', color: 0xf6e2bd, roughness: 0.95, flatShading: true });
const earMat = new THREE.MeshStandardMaterial({ name: 'ear', color: 0xc98a3f, roughness: 0.9, flatShading: true });
const darkMat = new THREE.MeshStandardMaterial({ name: 'dark', color: 0x1c1718, roughness: 0.3, flatShading: true });
const shineMat = new THREE.MeshStandardMaterial({ name: 'shine', color: 0xffffff, roughness: 0.3, flatShading: true });
const tongueMat = new THREE.MeshStandardMaterial({ name: 'tongue', color: 0xef7d8c, roughness: 0.5, flatShading: true });
const collarMat = new THREE.MeshStandardMaterial({ name: 'collar', color: 0x2f7fd8, roughness: 0.6, flatShading: true });
const goldMat = new THREE.MeshStandardMaterial({ name: 'gold', color: 0xf2c14c, roughness: 0.3, metalness: 0.65, flatShading: true });
// Shared geometries
const boxGeo = new THREE.BoxGeometry(0.065, 0.11, 0.065);
const boxGeo2 = new THREE.BoxGeometry(0.072, 0.03, 0.078);
const boxGeo3 = new THREE.BoxGeometry(0.04, 0.048, 0.01);
const boxGeo4 = new THREE.BoxGeometry(0.015, 0.015, 0.006);
const boxGeo5 = new THREE.BoxGeometry(0.04, 0.15, 0.1);
// Parts
const legFL = new THREE.Group();
legFL.name = 'legFL';
legFL.position.set(0.055, 0.13, 0.09);
root.add(legFL);
const legFLLeg = new THREE.Mesh(boxGeo, furMat);
legFLLeg.name = 'legFLLeg';
legFLLeg.position.set(0, -0.055, 0);
legFL.add(legFLLeg);
const legFLPaw = new THREE.Mesh(boxGeo2, furMat);
legFLPaw.name = 'legFLPaw';
legFLPaw.position.set(0, -0.115, 0.008);
legFL.add(legFLPaw);
const legFR = new THREE.Group();
legFR.name = 'legFR';
legFR.position.set(-0.055, 0.13, 0.09);
root.add(legFR);
const legFRLeg = new THREE.Mesh(boxGeo, furMat);
legFRLeg.name = 'legFRLeg';
legFRLeg.position.set(0, -0.055, 0);
legFR.add(legFRLeg);
const legFRPaw = new THREE.Mesh(boxGeo2, furMat);
legFRPaw.name = 'legFRPaw';
legFRPaw.position.set(0, -0.115, 0.008);
legFR.add(legFRPaw);
const legBL = new THREE.Group();
legBL.name = 'legBL';
legBL.position.set(0.055, 0.13, -0.09);
root.add(legBL);
const legBLLeg = new THREE.Mesh(boxGeo, furMat);
legBLLeg.name = 'legBLLeg';
legBLLeg.position.set(0, -0.055, 0);
legBL.add(legBLLeg);
const legBLPaw = new THREE.Mesh(boxGeo2, furMat);
legBLPaw.name = 'legBLPaw';
legBLPaw.position.set(0, -0.115, 0.008);
legBL.add(legBLPaw);
const legBR = new THREE.Group();
legBR.name = 'legBR';
legBR.position.set(-0.055, 0.13, -0.09);
root.add(legBR);
const legBRLeg = new THREE.Mesh(boxGeo, furMat);
legBRLeg.name = 'legBRLeg';
legBRLeg.position.set(0, -0.055, 0);
legBR.add(legBRLeg);
const legBRPaw = new THREE.Mesh(boxGeo2, furMat);
legBRPaw.name = 'legBRPaw';
legBRPaw.position.set(0, -0.115, 0.008);
legBR.add(legBRPaw);
const body = new THREE.Group();
body.name = 'body';
root.add(body);
const torso = new THREE.Mesh(new THREE.BoxGeometry(0.18, 0.15, 0.27), furMat);
torso.name = 'torso';
torso.position.set(0, 0.175, 0);
body.add(torso);
const chest = new THREE.Mesh(new THREE.BoxGeometry(0.12, 0.1, 0.012), lightMat);
chest.name = 'chest';
chest.position.set(0, 0.16, 0.138);
body.add(chest);
const belly = new THREE.Mesh(new THREE.BoxGeometry(0.13, 0.01, 0.19), lightMat);
belly.name = 'belly';
belly.position.set(0, 0.097, 0.01);
body.add(belly);
const tail = new THREE.Group();
tail.name = 'tail';
tail.position.set(0, 0.22, -0.125);
tail.rotation.set(0, 0, deg(14));
root.add(tail);
const tailBase = new THREE.Mesh(new THREE.BoxGeometry(0.04, 0.1021, 0.04), furMat);
tailBase.name = 'tailBase';
tailBase.position.set(0, 0.03, -0.025);
tailBase.rotation.set(deg(-39.8056), 0, 0);
tail.add(tailBase);
const tailTip = new THREE.Mesh(new THREE.BoxGeometry(0.036, 0.0907, 0.036), furMat);
tailTip.name = 'tailTip';
tailTip.position.set(0, 0.095, -0.055);
tailTip.rotation.set(deg(-8.1301), 0, 0);
tail.add(tailTip);
const collar = new THREE.Group();
collar.name = 'collar';
collar.position.set(0, 0.215, 0.1);
collar.rotation.set(deg(-15), 0, 0);
root.add(collar);
const collarBand = new THREE.Mesh(new THREE.BoxGeometry(0.195, 0.035, 0.13), collarMat);
collarBand.name = 'collarBand';
collar.add(collarBand);
const nameTag = new THREE.Mesh(new THREE.CylinderGeometry(0.022, 0.022, 0.008, 8), goldMat);
nameTag.name = 'nameTag';
nameTag.position.set(0, -0.035, 0.07);
nameTag.rotation.set(deg(90), 0, 0);
collar.add(nameTag);
const head = new THREE.Group();
head.name = 'head';
head.position.set(0, 0.23, 0.105);
root.add(head);
const skull = new THREE.Mesh(new THREE.BoxGeometry(0.23, 0.19, 0.19), furMat);
skull.name = 'skull';
skull.position.set(0, 0.09, 0.035);
head.add(skull);
const snout = new THREE.Mesh(new THREE.BoxGeometry(0.12, 0.08, 0.08), lightMat);
snout.name = 'snout';
snout.position.set(0, 0.045, 0.17);
head.add(snout);
const nose = new THREE.Mesh(new THREE.BoxGeometry(0.05, 0.035, 0.03), darkMat);
nose.name = 'nose';
nose.position.set(0, 0.075, 0.205);
head.add(nose);
const mouthLine = new THREE.Mesh(new THREE.BoxGeometry(0.008, 0.03, 0.006), darkMat);
mouthLine.name = 'mouthLine';
mouthLine.position.set(0, 0.04, 0.213);
head.add(mouthLine);
const mouth = new THREE.Mesh(new THREE.BoxGeometry(0.04, 0.012, 0.03), darkMat);
mouth.name = 'mouth';
mouth.position.set(0, 0.005, 0.2);
head.add(mouth);
const tongue = new THREE.Mesh(new THREE.BoxGeometry(0.034, 0.05, 0.012), tongueMat);
tongue.name = 'tongue';
tongue.position.set(0.004, -0.015, 0.204);
tongue.rotation.set(deg(-10), 0, deg(5));
head.add(tongue);
const eyeL = new THREE.Mesh(boxGeo3, darkMat);
eyeL.name = 'eyeL';
eyeL.position.set(0.06, 0.115, 0.135);
head.add(eyeL);
const eyeShineL = new THREE.Mesh(boxGeo4, shineMat);
eyeShineL.name = 'eyeShineL';
eyeShineL.position.set(0.069, 0.126, 0.141);
head.add(eyeShineL);
const eyeR = new THREE.Mesh(boxGeo3, darkMat);
eyeR.name = 'eyeR';
eyeR.position.set(-0.06, 0.115, 0.135);
head.add(eyeR);
const eyeShineR = new THREE.Mesh(boxGeo4, shineMat);
eyeShineR.name = 'eyeShineR';
eyeShineR.position.set(-0.051, 0.126, 0.141);
head.add(eyeShineR);
const earL = new THREE.Group();
earL.name = 'earL';
earL.position.set(0.115, 0.17, 0.025);
earL.rotation.set(0, 0, deg(18));
head.add(earL);
const earFlapL = new THREE.Mesh(boxGeo5, earMat);
earFlapL.name = 'earFlapL';
earFlapL.position.set(0.02, -0.06, 0);
earL.add(earFlapL);
const earR = new THREE.Group();
earR.name = 'earR';
earR.position.set(-0.115, 0.17, 0.025);
earR.rotation.set(0, 0, deg(-18));
head.add(earR);
const earFlapR = new THREE.Mesh(boxGeo5, earMat);
earFlapR.name = 'earFlapR';
earFlapR.position.set(-0.02, -0.06, 0);
earR.add(earFlapR);
root.traverse((o) => {
if (o.isMesh) {
o.castShadow = true;
o.receiveShadow = true;
}
});
return root;
}
export default createDog;
Puanlar ve yorumlar
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









