123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- import * as THREE from 'three'
- const defaultMaterial = new THREE.MeshLambertMaterial({
- color: 0xffffff,
- reflectivity: 0.8,
- emissive: 0xffffff,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- });
- let materials = {
- // 贸易大厦
- commercial: new THREE.MeshLambertMaterial({
- color: 0xc1e8e4,
- reflectivity: 0.8,
- emissive: 0xc1e8e4,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- }),
- // 屋顶
- roof: new THREE.MeshLambertMaterial({
- color: 0xdbc315,
- reflectivity: 0.8,
- emissive: 0xdbc315,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- }),
- // 商业
- commercial: new THREE.MeshLambertMaterial({
- color: 0xcc6f3e,
- reflectivity: 0.8,
- emissive: 0xcc6f3e,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- }),
- // 零售业
- retail: new THREE.MeshLambertMaterial({
- color: 0xaeaaa3,
- reflectivity: 0.8,
- emissive: 0xaeaaa3,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- }),
- // 公寓
- apartments: new THREE.MeshLambertMaterial({
- color: 0xba673a,
- reflectivity: 0.8,
- emissive: 0xba673a,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- }),
- // 住宅区
- residential: new THREE.MeshLambertMaterial({
- color: 0xba673a,
- reflectivity: 0.8,
- emissive: 0xba673a,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- }),
- // 温室
- greenhouse: new THREE.MeshLambertMaterial({
- color: 0x750000,
- reflectivity: 0.8,
- emissive: 0x750000,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- }),
- // 医院
- hospital: new THREE.MeshLambertMaterial({
- color: 0xbc6067,
- reflectivity: 0.8,
- emissive: 0xbc6067,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- }),
- // 桥
- bridge: new THREE.MeshLambertMaterial({
- color: 0x3f3f3e,
- reflectivity: 0.8,
- emissive: 0x3f3f3e,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- }),
- // 火车站
- train_station: new THREE.MeshLambertMaterial({
- color: 0x896343,
- reflectivity: 0.8,
- emissive: 0x896343,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- }),
- // 学校
- school: new THREE.MeshLambertMaterial({
- color: 0x668142,
- reflectivity: 0.8,
- emissive: 0x668142,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- }),
- // 建设中
- construction: new THREE.MeshLambertMaterial({
- color: 0xe6cb00,
- reflectivity: 0.8,
- emissive: 0xe6cb00,
- emissiveIntensity: 0.5,
- wireframe: false,
- flatShading: true
- }),
- }
- function grentMesh(geometry, type) {
- console.log(type)
- let mesh = new THREE.Mesh(geometry, materials[type] || defaultMaterial)
- mesh.castShadow = true;
- mesh.receiveShadow = true;
- return mesh
- }
- export default grentMesh
|