Initial commit

This commit is contained in:
2026-01-08 16:37:17 +03:00
commit 4a4a7f0213
10 changed files with 278 additions and 0 deletions

25
js/materials.js Normal file
View File

@@ -0,0 +1,25 @@
// materials.js
import * as THREE from 'three';
/**
* Применяет стандартный матовый материал ко всем мешам объекта
* @param {THREE.Object3D} object - объект сцены или room
* @param {Object} options - {color, roughness, metalness}
*/
export function applyMatteMaterial(object, options = {}) {
const color = options.color !== undefined ? options.color : 0xffffff;
const roughness = options.roughness !== undefined ? options.roughness : 1;
const metalness = options.metalness !== undefined ? options.metalness : 0;
object.traverse((child) => {
if (child.isMesh) {
child.material = new THREE.MeshStandardMaterial({
color,
roughness,
metalness
});
child.castShadow = true;
child.receiveShadow = true;
}
});
}