mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-29 15:29:26 -05:00
2323a8ce50
* Allow changing color map during runtime * Stary building asset with colormaps (currently using local files) * Add option to invert the color maps * Remove final use of local viridis file in example and fix broken cmap update * Use synced resource for colormap files * Update advanced colormapping example * Apply suggestions from code review Co-authored-by: Alexander Bock <alexander.bock@liu.se> * Update data/assets/util/default_colormaps.asset * Capitalize first letter of exported keys, to be more consistent with rest of code base --------- Co-authored-by: Alexander Bock <alexander.bock@liu.se>
70 lines
2.2 KiB
Lua
70 lines
2.2 KiB
Lua
local earthAsset = asset.require("scene/solarsystem/planets/earth/earth")
|
|
local colormaps = asset.require("util/default_colormaps")
|
|
|
|
|
|
|
|
local Example = {
|
|
Identifier = "ExamplePoints_DataMapping",
|
|
Parent = earthAsset.Earth.Identifier,
|
|
Renderable = {
|
|
Type = "RenderablePointCloud",
|
|
File = asset.resource("data/dummydata.csv"),
|
|
DataMapping = {
|
|
-- Using the DataMapping, we can specify the X, Y and Z values of the point
|
|
-- positions to be set by any value in the dataset, without changing the dataset
|
|
-- used for the rendering
|
|
X = "a",
|
|
Y = "b",
|
|
Z = "a",
|
|
-- It is also possible to specify a numeric value that corresponds to missing
|
|
-- values in the dataset. These will be interpreted as NaN values
|
|
MissingDataValue = 29,
|
|
-- And some column that we do not want to include in the loading. Here we can for
|
|
-- example skip the regular position columns
|
|
ExcludeColumns = { "x", "y", "z" }
|
|
},
|
|
-- Interpret values as Parsec rather than meter. The values in the a and b columns
|
|
-- are much smaller than the x, y and z
|
|
Unit = "pc",
|
|
-- To show the values corresponding to missing values, use a color map and show
|
|
-- missing data values in a specific color
|
|
Coloring = {
|
|
ColorMapping = {
|
|
File = colormaps.Uniform.Magma,
|
|
ShowMissingData = true,
|
|
NoDataColor = { 1.0, 0.0, 0.0, 1.0 }
|
|
}
|
|
},
|
|
},
|
|
GUI = {
|
|
Name = "Data Mapping",
|
|
Path = "/Example/Point Clouds",
|
|
Description = [[Example of a point cloud where the X, Y and Z position are mapped to
|
|
other columns in the dataset.]]
|
|
}
|
|
}
|
|
|
|
|
|
asset.onInitialize(function()
|
|
openspace.addSceneGraphNode(Example)
|
|
end)
|
|
|
|
asset.onDeinitialize(function()
|
|
openspace.removeSceneGraphNode(Example)
|
|
end)
|
|
|
|
asset.export(Example)
|
|
|
|
|
|
|
|
asset.meta = {
|
|
Name = "Example - Point Cloud with Custom Data Mapping",
|
|
Version = "1.0",
|
|
Description = [[Example of a point cloud where the X, Y and Z position are mapped to
|
|
other columns in the dataset. The data mapping also includes some settings for
|
|
missing data values and columns to exclude when loading the dataset]],
|
|
Author = "OpenSpace Team",
|
|
URL = "http://openspaceproject.com",
|
|
License = "MIT license"
|
|
}
|