动态资产数据加载,用于动态资产请求,游戏引擎内部逻辑请求资产

new AssetLayer(params, messageNeedsUpdate, childNeedsUpdate)
参数说明:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
params |
object | 参数 Properties
|
|||||||||||||||||||||||||||||||||||||||
messageNeedsUpdate |
Boolean | 消息是否变化,只读 |
|||||||||||||||||||||||||||||||||||||||
childNeedsUpdate |
Boolean | 子模型是否变化,只读 |
方法
addChildren(children)
添加子模型
参数说明:
Name | Type | Description |
---|---|---|
children |
Array | 子模型数组 |
child.uuid |
string | 单个子模型的唯一标识符 |
child.id |
id | 单个子模型的id |
removeChild(child)
移除单个子模型
参数说明:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
child |
object | 子模型 Properties
|
removeChildren(children)
移除多个子模型
参数说明:
Name | Type | Description |
---|---|---|
children |
Array | 子模型数组 |
child.uuid |
string | 子模型的唯一标识符 |
child.id |
id | 子模型的id |
updateChild(child)
更新单个子模型
示例代码
child = {
uuid:****,
point_id:****,
params:{
"map": "url",
"color": {"r":,"g":,"b":,"a":},
"metallic": 0,
"roughness": 1,
"brightness": 0,
"brightnessColor": {"r":,"g":,"b":},
"scale": {"x":,"y":,"z":},
"rotation": {"x":,"y":,"z":},
"position": {"x":,"y":,"z":},
}
}
参数说明:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
child |
object | 子模型 Properties
|
||||||||||||
params.color |
object | 更新颜色,{"r":,"g":,"b":,"a":},值0-1 |
||||||||||||
params.brightnessColor |
object | 发光颜色,{"r":,"g":,"b":},值0-1 |
||||||||||||
params.map |
string | 更新贴图,接受url |
||||||||||||
params.metallic |
object | 更新金属度 |
||||||||||||
params.roughness |
object | 更新粗糙度 |
||||||||||||
params.brightness |
object | 更新发光强度 |
||||||||||||
params.position |
object | 更新位置, {"x":,"y":,"z":},经度纬度高度,单位 度 |
||||||||||||
params.scale |
object | 更新缩放, {"x":,"y":,"z":} |
||||||||||||
params.rotation |
object | 更新旋转, {"x":,"y":,"z":},单位 角度 |
||||||||||||
params.text |
string | 文字,不为空时文字贴图优先级最高 |
||||||||||||
params.textStyle |
object | 文本样式,具体参照Utils的drawTextToImage方法的第二个参数 |
||||||||||||
params.scroll |
number | 更新纹理是否沿着横轴滚动,1为正方向滚动,-1为反方向滚动,默认值0不滚动 |
||||||||||||
params.speed |
number | 设置纹理滚动速度,scroll不为0设置才生效,建议值0.5,默认值0,静止 |
updateChildAnimation(child, params)
更新单个子设备的动画类型
参数说明:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
child |
object | 子设备 Properties
|
||||||||||||
params |
object | 更新参数 Properties
|
updateChildren(children)
更新多个子模型
示例代码
child = {
uuid:****,
point_id:****,
params:{
"map": "url",
"color": {"r":,"g":,"b":,"a":},
"metallic": 0,
"roughness": 1,
"brightness": 0,
"brightnessColor": {"r":,"g":,"b":},
"scale": {"x":,"y":,"z":},
"rotation": {"x":,"y":,"z":},
"position": {"x":,"y":,"z":},
}
}
参数说明:
Name | Type | Description |
---|---|---|
children |
Array | 子模型数组 |
child.uuid |
string | 子模型的唯一标识符 |
child.point_id |
string | 子模型的点位id,如果有就赋值,没有可以不给 |
child.params |
object | 更新参数 |
params.color |
object | 更新颜色,{"r":,"g":,"b":,"a":},值0-1 |
params.brightnessColor |
object | 发光颜色,{"r":,"g":,"b":},值0-1 |
params.map |
string | 更新贴图,接受url |
params.metallic |
object | 更新金属度 |
params.roughness |
object | 更新粗糙度 |
params.brightness |
object | 更新发光强度 |
params.position |
object | 更新位置, {"x":,"y":,"z":},经度纬度高度,单位 度 |
params.scale |
object | 更新缩放, {"x":,"y":,"z":} |
params.rotation |
object | 更新旋转, {"x":,"y":,"z":},单位 角度 |
params.text |
string | 文字,不为空时文字贴图优先级最高 |
params.textStyle |
object | 文本样式,具体参照Utils的drawTextToImage方法的第二个参数 |
params.scroll |
number | 更新纹理是否沿着横轴滚动,1为正方向滚动,-1为反方向滚动,默认值0不滚动 |
params.speed |
number | 设置纹理滚动速度,scroll不为0设置才生效,建议值0.5,默认值0,静止 |
updateChildrenAnimation(children, params)
更新多个子设备的动画类型
参数说明:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
children |
Array | 子设备模型 |
||||||||||||
child.uuid |
string | 子模型的唯一标识符 |
||||||||||||
child.point_id |
string | 子模型的点位id,如果有就赋值,没有可以不给 |
||||||||||||
params |
object | 更新参数 Properties
|