InteriorSpace
大约 2 分钟
InteriorSpace
室内空间对象,继承自Thing对象,拥有一切Thing属性及方法。
构造器
new VT.InteriorSpace({
    // 点位
    points: [],
    // 外墙
    exteriorWall: {
        geometry: {
            height: 3.0,
            width: 0.2,
            openEnded: false,
        },
        material: {
            color: "#ffffff",
            side: 2,
            roughness: 0.6,
            map: {
                image: "sdk:/resources/texture/wall1.jpg",
            },
        }
    },
    // 地板
    floor: {
        geometry: {
            depth: 0.01,
        },
        material: {
            side: 2,
            metalness: 0.1,
            roughness: 0.7,
            map: {
                image: "sdk:/resources/texture/ceramictile.jpg",
            },
        }
    },
    // 天花板
    ceiling: {
        material: {
            transparent: false,
            color: "#ffffff",
            side: 0,
            map: {
                image: "sdk:/resources/texture/ceiling.jpg",
                repeat: [0.15, 0.15],
            },
        }
    },
    // 内墙
    interiorWalls: [],
    // 挖洞部分,门,窗
    // { box:{width, height, depth, rotation, position}, target:{ type:"window", material:{} }}
    csgs: [],
    // 接收阴影,默认是
    receiveShadow: true,
    // 透射阴影,默认否
    castShadow: false,
});
属性成员
type
- 类型:
{String}物体类型InteriorSpace, 不可改 
isInteriorSpace
- 类型:
{Boolean}是否为InteriorSpace,不可更改,默认为true 
length
- 类型:
{Number}墙体长度,不可更改,默认值为0 
points
- 类型:
{Array<Array<Number>>}点位数组,默认值为[] 
exteriorWall
- 类型:
{Wall}外壁对象,默认值为null 
ceiling
{VT.Polygon}天花板对象,默认值为null
floor
{VT.ExtrudePolygon}地板对象,默认值为null
csgs
{Array<CSG>}空间组合对象,默认值为[]
方法
updateFloor
更新点位
- updateFloor(option)
 - 类型:
{Function} - 参数: 
- option 
{Object}详见构建器参数 floor 部分 
 - option 
 - 返回:无
 
updateInteriorWalls
更新外壁
- updateInteriorWalls(option)
 - 类型:
{Function} - 参数: 
- option 
{Object}详见构建器参数 exteriorWall 部分 
 - option 
 - 返回:无
 
updateCeiling
更新天花板
- updateCeiling(option)
 - 类型:
{Function} - 参数: 
- option 
{Object}详见构建器参数 ceiling 部分 
 - option 
 - 返回:无
 
updatePoints
更新点位
- updatePoints(points)
 - 类型:
{Function} - 参数: 
- points 
{Array<Array<Number>>}点位数组 
 - points 
 - 返回:无
 
addCSG
添加空间组合对象,通常用于开洞,添加门、窗等
- addCSG(csg, option, id)
 - 类型:
{Function} - 参数: 
- csg 
{Object}空间组合对象,{ box:{width, height, depth, rotation, position}, target:{ type:"Box", config }} - option 
{Object}空间组合对象,{type }, type 类型为 Box、Door、Model - id 
{String}空间组合对象 id 
 - csg 
 - 返回:无
 
removeCSG
移除空间组合对象
- removeCSG(id)
 - 类型:
{Function} - 参数: 
- id 
{String}空间组合对象 id 
 - id 
 - 返回:无
 
getPoints
获取点位数组
- getPoints()
 - 类型:
{Function} - 参数:无
 - 返回:
{Array<Array<Number>>}点位数组