Skip to content
导览

围栏管理类 WallManager

围栏管理对象是用于控制云渲染围栏管理对象操作的工具, 该工具的主要功能包括:

  1. 添加围栏对象
  2. 根据图层名删除图层
  3. 清除图层
  4. 根据图层名获取图层对象
  5. 获取所有图层

我们将提供详细的使用指南和功能说明,帮助用户更好地使用该工具。

添加围栏对象 | addWallEffect

  • 说明:添加围栏对象

我们可以调用 WallManager 上面的 addWallEffect 方法来添加围栏对象。

  • 参数说明
NameTypeDescription
argsany[]不定数量的参数

调用示例:

ts
//方式一:
const wallManger = await cloud.getWallManager();
const layerName = 'wall';
const wallAttr: WallEffectAttr = {
diffuse: '0XfFff0000', //围栏颜色
speed: 0,   //纹理流速
isStretch: false, //围栏纹理是否拉伸
isTangentWallEffectDir: true,  //围栏效果运动方向是否是沿着路径的切线方向
diffuseTexture: 'yellow',  //纹理,可选填值:Planarity、Gradient、red、Stroke、yellow
};
const bottons = [];
bottons.push(new Vector3(256.787, 0.6, 356.222));
bottons.push(new Vector3(289.689, 0.681, 355.693));
bottons.push(new Vector3(285.741, 0.7, 331.082));
bottons.push(new Vector3(256.787, 0.6, 356.222));
// bottons.push(new LonLatAlt(0.0023067557, 0.0031999990, 0.6151075792));
// bottons.push(new LonLatAlt(0.0026023211, 0.0031952462, 0.6972457329));
// bottons.push(new LonLatAlt(0.0025668529, 0.0029741609, 0.7148046494));
// bottons.push(new LonLatAlt(0.0023067557, 0.0031999990, 0.6151075792));
const wallGeo: WallGeometry = {
 bottomOutline: bottons,  //围栏底部的顶点
 height: 10,  //围栏高度
};
wallManager.addWallEffect(layerName, wallAttr, wallGeo);

//方式二:
const wallManger = await cloud.getWallManager();
const param = {
  layerName: 'wall', //图层名
  Material: { // 选填
      BumpMode: 0,  //凹凸模式
      MaterialType: 0,  //材质类型
      Metallic: 0.5, // 金属光泽度
      NormalOrBumpScale: 1.0, // 凸起比例
      Roughness: 0.5, // 粗糙度
      Diffuse: '0XFF00FF00', //漫反射颜色
      //可选填值:Planarity、Gradient、red、Stroke、yellow
      DiffuseTexture: 'Planarity',  //纹理
  },
  
  TextureRate: 1.0, //线的纹理率(一般来说不变),选填
  Height: 3,  //围栏高度 选填
  IsStretch: true, //围栏纹理是否拉伸 选填
  Speed: 0.02,  //围栏纹理速度值 选填
  IsTangentWallEffectDir: true, //围栏效果运动方向是否是沿着路径的切线方向  选填
  IsReverseWallEffect:false,  //围栏效果运动是否是逆时针  选填
  IsShow:true,  //围栏是否显示值  选填
  UVRepeatUNum: 6.0,  //表示纹理在u轴重复数 选填
  UVRepeatVNum: 2.0,  //表示纹理在v轴重复数 选填
  BottomOutline: //围栏底部的顶点
  [
      [
      15.625022888183594,
      0.0099849095568060875,
      29.745611190795898,
      ],
      [
      37.157989501953125,
      0.010088586248457432,
      28.169088363647461,
      ],
      [
      36.95220947265625,
      0.010002888739109039,
      16.018711090087891,
      ],
      [
      27.902980804443359,
      0.0099409837275743484,
      14.839985847473145,
      ],
  ],
  type: '.primt',
}
wallManager.addWallEffect(param);
//方式一:
const wallManger = await cloud.getWallManager();
const layerName = 'wall';
const wallAttr: WallEffectAttr = {
diffuse: '0XfFff0000', //围栏颜色
speed: 0,   //纹理流速
isStretch: false, //围栏纹理是否拉伸
isTangentWallEffectDir: true,  //围栏效果运动方向是否是沿着路径的切线方向
diffuseTexture: 'yellow',  //纹理,可选填值:Planarity、Gradient、red、Stroke、yellow
};
const bottons = [];
bottons.push(new Vector3(256.787, 0.6, 356.222));
bottons.push(new Vector3(289.689, 0.681, 355.693));
bottons.push(new Vector3(285.741, 0.7, 331.082));
bottons.push(new Vector3(256.787, 0.6, 356.222));
// bottons.push(new LonLatAlt(0.0023067557, 0.0031999990, 0.6151075792));
// bottons.push(new LonLatAlt(0.0026023211, 0.0031952462, 0.6972457329));
// bottons.push(new LonLatAlt(0.0025668529, 0.0029741609, 0.7148046494));
// bottons.push(new LonLatAlt(0.0023067557, 0.0031999990, 0.6151075792));
const wallGeo: WallGeometry = {
 bottomOutline: bottons,  //围栏底部的顶点
 height: 10,  //围栏高度
};
wallManager.addWallEffect(layerName, wallAttr, wallGeo);

//方式二:
const wallManger = await cloud.getWallManager();
const param = {
  layerName: 'wall', //图层名
  Material: { // 选填
      BumpMode: 0,  //凹凸模式
      MaterialType: 0,  //材质类型
      Metallic: 0.5, // 金属光泽度
      NormalOrBumpScale: 1.0, // 凸起比例
      Roughness: 0.5, // 粗糙度
      Diffuse: '0XFF00FF00', //漫反射颜色
      //可选填值:Planarity、Gradient、red、Stroke、yellow
      DiffuseTexture: 'Planarity',  //纹理
  },
  
  TextureRate: 1.0, //线的纹理率(一般来说不变),选填
  Height: 3,  //围栏高度 选填
  IsStretch: true, //围栏纹理是否拉伸 选填
  Speed: 0.02,  //围栏纹理速度值 选填
  IsTangentWallEffectDir: true, //围栏效果运动方向是否是沿着路径的切线方向  选填
  IsReverseWallEffect:false,  //围栏效果运动是否是逆时针  选填
  IsShow:true,  //围栏是否显示值  选填
  UVRepeatUNum: 6.0,  //表示纹理在u轴重复数 选填
  UVRepeatVNum: 2.0,  //表示纹理在v轴重复数 选填
  BottomOutline: //围栏底部的顶点
  [
      [
      15.625022888183594,
      0.0099849095568060875,
      29.745611190795898,
      ],
      [
      37.157989501953125,
      0.010088586248457432,
      28.169088363647461,
      ],
      [
      36.95220947265625,
      0.010002888739109039,
      16.018711090087891,
      ],
      [
      27.902980804443359,
      0.0099409837275743484,
      14.839985847473145,
      ],
  ],
  type: '.primt',
}
wallManager.addWallEffect(param);

根据图层名删除图层 | removeLayer

  • 说明:根据图层名删除图层

我们可以调用 WallManager 上面的 removeLayer 方法来根据图层名删除图层。

  • 参数说明
NameTypeDescription
layerNamestring图层名

调用示例:

ts
const wallManger = await cloud.getWallManager();
var layers =  await wallManger.getAllLayers();
await wallManager.removeLayer(layers[0].getName());
const wallManger = await cloud.getWallManager();
var layers =  await wallManger.getAllLayers();
await wallManager.removeLayer(layers[0].getName());

清除图层 | clearLayers

  • 说明:清除图层

我们可以调用 WallManager 上面的 clearLayers 方法来清除图层。

调用示例:

ts
const wallManger = await cloud.getWallManager();
vwallManager.clearLayers();
const wallManger = await cloud.getWallManager();
vwallManager.clearLayers();

根据图层名获取图层对象 | getLayer

  • 说明:根据图层名获取图层对象

我们可以调用 WallManager 上面的 getLayer 方法来根据图层名获取图层对象。

  • 参数说明
NameTypeDescription
layerNamestring图层名

调用示例:

ts
const wallManger = await cloud.getWallManager();
wallManager.getLayer("Wall");
const wallManger = await cloud.getWallManager();
wallManager.getLayer("Wall");

获取所有图层对象 | getAllLayers

  • 说明:获取所有图层对象

我们可以调用 WallManager 上面的 getAllLayers 方法来获取所有图层对象。

调用示例:

ts
const wallManger = await cloud.getWallManager();
wallManager.getAllLayers();
const wallManger = await cloud.getWallManager();
wallManager.getAllLayers();