Class: WaterMesh

WaterMesh

WaterMesh类
一般通过api.waterMesh调用其方法


<protected> new WaterMesh()

See:

Methods


add(data, fn)

添加一个或多个WaterMesh对象

Parameters:
Name Type Description
data object | array

WaterMesh数据,可以是Object类型或者Array类型,对于每一个WaterMesh,支持以下属性:

  • id (string) 字符串类型的ID

  • groupId (string) 可选,Group分组

  • userData (string) 可选,用户自定义数据

  • coordinateType (number) 坐标系类型,取值范围:0为Projection类型,1为WGS84类型,2为火星坐标系(GCJ02),3为百度坐标系(BD09),默认值:0

  • coordinates (array) 顶点坐标,取值示例

  • indices (array) 顶点坐标的索引,用来绘制三角网格;数组元素类型:(number);数组元素顺序:顶点索引顺序需构成三角网格且同为顺时针或逆时针方向;数组元素取值范围:[0~coordinates.length-1],取值示例:[2, 0, 3, 0, 2, 1]

  • normals (array) 顶点法向,[X,Y,Z],不传则使用默认值

  • waterUVRepeat (number) 水流贴图的重复间隔距离,取值范围:[1,10000],单位:米

  • waterColor (Color) 水流颜色,支持四种格式,取值示例

  • waterSpeed (number) 水流速度,取值范围:[0.01~30],单位:米/秒,默认值:3米/秒

  • waterDirection (number) 水流方向,取值范围:[0~1],单位:度,此值与[0~360]按比例换算,默认值:0度

  • waveScale (number) 波纹强度,取值范围:[0.01~1],单位:米,默认值:0.3米

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


clear(fn)

删除场景中所有的WaterMesh

Parameters:
Name Type Description
fn function

可选的回调函数,请参考二次开发:异步接口调用方式


delete(ids, fn)

删除一个或多个WaterMesh对象

Parameters:
Name Type Description
ids string | array

要删除的WaterMesh对象的ID或者ID数组(可以删除一个或者多个)

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


focus(ids, distance, flyTime, rotation, fn)

自动定位到合适的观察距离

Parameters:
Name Type Description
ids string | array

WaterMesh对象的ID或者ID数组

distance number

可选参数,观察点距离目标点(被拍摄物体)的距离,取值范围:[0.01~任意正数],如果设置为0或者不设置,系统自动计算

flyTime number

可选参数,相机飞行的时间,取值范围:[0~任意正数],单位:秒,默认值2秒

rotation array

可选参数,相机旋转的欧拉角:[Pitch,Yaw,Roll],数组元素类型:(number),取值范围:Pitch[-90~90] Yaw[-180~180] Roll[0]

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


get(ids, fn)

根据ID获取WaterMesh的详细信息

Parameters:
Name Type Description
ids string | array

要获取的WaterMesh对象ID或者ID数组(可以获取一个或者多个)

fn function

可选的回调函数,请参考二次开发:异步接口调用方式

Example
WaterMesh的详细信息
{
            "id":	"",
            "groupId":	"",
            "userData":	"",
            "waterColor":	[0.000000, 0.000000, 1.000000, 1.000000],
            "waterUVRepeat":	1000.000000,
            "waterSpeed":	5.000000,
            "waterDirection":	0.250000,
            "waterWave":	0.500000
        }

hide(ids, fn)

隐藏WaterMesh

Parameters:
Name Type Description
ids string | array

WaterMesh对象的ID或者ID数组

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


hideAll(fn)

隐藏所有WaterMesh

Parameters:
Name Type Description
fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setCoordinates(id, newVal, fn)

设置WaterMesh顶点坐标

Parameters:
Name Type Description
id string

唯一标识符

newVal array

新的顶点坐标,取值示例

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setIndices(id, newVal, fn)

设置WaterMesh顶点坐标索引

Parameters:
Name Type Description
id string

唯一标识符

newVal array

新顶点坐标的索引,数组元素类型:(number),数组元素取值范围:[0~coordinates.length-1],取值示例:[2, 0, 3, 0, 2, 1]

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setNormals(id, newVal, fn)

设置WaterMesh法向

Parameters:
Name Type Description
id string

唯一标识符

newVal array

新法向

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setWaterColor(id, newVal, fn)

设置颜色

Parameters:
Name Type Description
id string

WaterMesh唯一标识符

newVal Color

新颜色值,支持四种格式,取值示例

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setWaterDirection(id, newVal, fn)

设置水流方向

Parameters:
Name Type Description
id string

WaterMesh唯一标识符

newVal number

新的水流方向

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setWaterSpeed(id, newVal, fn)

设置水流速度

Parameters:
Name Type Description
id string

WaterMesh唯一标识符

newVal number

新的水流速度

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setWaterUVRepeat(id, newVal, fn)

设置水流贴图重复间隔距离

Parameters:
Name Type Description
id string

WaterMesh唯一标识符

newVal number

新的水流贴图重复间隔距离

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


setWaterWaveScale(id, newVal, fn)

设置水波纹大小

Parameters:
Name Type Description
id string

WaterMesh唯一标识符

newVal number

新的水波纹大小

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


show(ids, fn)

显示WaterMesh

Parameters:
Name Type Description
ids string | array

WaterMesh对象的ID或者ID数组

fn function

可选的回调函数,请参考二次开发:异步接口调用方式


showAll(fn)

显示所有WaterMesh

Parameters:
Name Type Description
fn function

可选的回调函数,请参考二次开发:异步接口调用方式


update(data, fn)

修改一个或多个WaterMesh对象

Parameters:
Name Type Description
data object | array

WaterMesh数据,参考add方法

fn function

可选的回调函数,请参考二次开发:异步接口调用方式