WallComponent()

墙组件,用于生成墙体

new WallComponent()

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('墙体加载完成');
})

Extends

  • THING.Component

Methods

load(data) → {Promise}

加载墙体
Parameters:
Name Type Description
data Object 墙体数据 (数据格式参考: https://wiki.uino.com/book/6538d1e88ea0ba892398fdf2/6523a7adae83a4dfb2c2cba4.html)
Returns:
Promise