元編程參考文件

高度圖讀寫

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
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
高度圖讀寫
所屬包
程序化生成