元编程参考文档

高度图读写

5 个节点

本页内容 5

导出 OBJ

函数

Exports the heightmap to an OBJ 3D file.

签名
导出 OBJ
    高度图: Scalar Field
    文件路径: 文本
    使用四边形: 真否
    包括法线: 真否
    包括纹理坐标: 真否
    顶点模式: 真否
void ExportObj(
    ScalarField2D heightmap,
    string filePath,
    bool useQuads = false,
    bool includeNormals = false,
    bool includeTextureCoords = false,
    bool vertexMode = false)

参数

名称类型默认值说明
高度图Scalar Field—
文件路径文本—The path to the OBJ file to be created.
使用四边形真否FalseIf true, exports using quads; otherwise, uses triangles.
包括法线真否False
包括纹理坐标真否False
顶点模式真否FalseIf true, consider each vertex in the data array as center of each pixel, we need to create new vertices based on the center.
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图读写
所属包
程序化生成

加载高度图

函数

从文件读取以米为单位的高度图:带像元大小的 GeoTIFF 高程栅格、16 位或 8 位图像,或引擎使用的 16 位原始网格(.r16、.raw)。

签名
加载高度图 -> Scalar Field
    路径: 文本
    像元大小(米): 数字
    最低(米): 数字
    最高(米): 数字
ScalarField2D LoadHeightmap(
    string path,
    double cellSizeMetres = 0,
    double lowestMetres = 0,
    double highestMetres = 0)

参数

名称类型默认值说明
路径文本—The file.
像元大小(米)数字0Ground metres one cell covers. A GeoTIFF says this itself and 0 takes its word; an image or raw grid needs it, and is laid at a metre a cell when it is 0.
最低(米)数字0For an image or raw grid, the elevation its darkest value stands for. A TIFF's values are already metres.
最高(米)数字0For an image or raw grid, the elevation its brightest value stands for; no higher than the lowest leaves its values 0..1.

返回

高度图Scalar Field
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图读写
所属包
程序化生成

保存为 OBJ 网格

函数

Save the terrrain into .obj 3D grid mesh format.

签名
保存为 OBJ 网格(地形: Scalar Field, 输出路径: 文本, 优化: 真否)
void SaveAsObjMesh(
    ScalarField2D terrain,
    string outputPath,
    bool optimized = false)

参数

名称类型默认值说明
地形Scalar Field—
输出路径文本—
优化真否False
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图读写
所属包
程序化生成

保存高度图

函数

保存高度图:.tif 保留米制高度与像元大小,.png 为 16 位灰度图像,.r16 为 16 位原始网格。

签名
保存高度图 -> 文本
    高度图: Scalar Field
    路径: 文本
    精度(米): 数字
string SaveHeightmap(
    ScalarField2D heightmap,
    string path,
    double precisionMetres = 0.01)

参数

名称类型默认值说明
高度图Scalar Field—Heights in metres.
路径文本—Where to save it: .tif, .png or .r16.
精度(米)数字0.01For a .tif, the step heights are stored to, metres: 0.01 keeps them to a centimetre. 0 stores 32-bit floats.

返回

已保存文本
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图读写
所属包
程序化生成

设置像元大小

函数

同样的高度铺在更大或更小的地面上:给生成的高度图一个应有的大小。

签名
设置像元大小 -> Scalar Field
    高度图: Scalar Field
    像元大小(米): 数字
ScalarField2D SetCellSize(
    ScalarField2D heightmap,
    double cellSizeMetres = 2)

参数

名称类型默认值说明
高度图Scalar Field—Heights in metres.
像元大小(米)数字2Ground metres one cell covers.

返回

高度图Scalar Field
所属发行版
元编程(教育版)元编程(专业版)
可用的图种类
数据流 函数 事件 例程 蓝图 状态机状态
声明于
高度图读写
所属包
程序化生成