Example
// 模拟数据
const points = [[0, 0], [2, 0], [2, 2], [0, 2]]
const materialResource = { map: './images/camera.png' }
// 创建对象作为墙体
const wall = new THING.Object3D({
tags: ['BuildingElement', 'Wall']
});
// 实例化平面组件
const wallComponent = new THING.WallComponent();
wall.addComponent(wallComponent, 'wallComponent');
wallComponent.load({
type: 'TextureWall',
walls: [
{
points: [...points[0], ...points[1]],
leftMaterial: materialResource,
rightMaterial: materialResource,
edgeMaterial: materialResource
},
{
points: [...points[1], ...points[2]],
leftMaterial: materialResource,
rightMaterial: materialResource,
edgeMaterial: materialResource
}, {
points: [...points[2], ...points[3]],
leftMaterial: materialResource,
rightMaterial: materialResource,
edgeMaterial: materialResource
}, {
points: [...points[3], ...points[0]],
leftMaterial: materialResource,
rightMaterial: materialResource,
edgeMaterial: materialResource
}
],
}).then(() => {
console.log('墙体加载完成');
})