mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-03 17:30:04 -05:00
da2c2df3a6
Did not have the updates for the color map helper asset
97 lines
3.3 KiB
Lua
97 lines
3.3 KiB
Lua
local colormaps = asset.require("util/default_colormaps")
|
|
|
|
|
|
|
|
local Points = {
|
|
Identifier = "Example_InterpolatedPoints_ColorMapped",
|
|
Renderable = {
|
|
Type = "RenderableInterpolatedPoints",
|
|
-- The dataset here is just a linearly expanding dataset, where the points move in
|
|
-- a straight line
|
|
File = asset.resource("data/interpolation_expand.csv"),
|
|
-- Specify how many objects the rows in the dataset represent. Here, the dataset is
|
|
-- consists of 10 objects with positions at 6 different time steps. This information
|
|
-- is required
|
|
NumberOfObjects = 10,
|
|
-- Both the position and data values will be interpolated, so use a color map
|
|
Coloring = {
|
|
ColorMapping = {
|
|
File = colormaps.Uniform.Viridis
|
|
}
|
|
},
|
|
-- Reduce the scale of the points a bit compared to default, so we see them more clearly
|
|
SizeSettings = {
|
|
ScaleExponent = 3.5
|
|
}
|
|
},
|
|
GUI = {
|
|
Name = "Interpolating Points with Color Map",
|
|
Path = "/Example/Interpolated Point Clouds",
|
|
Description = [[Example of interpolating points with a color map. The data value
|
|
used for the coloring will also be inteprolated, leading to the points changing
|
|
color throughout the interpolation.]]
|
|
}
|
|
}
|
|
|
|
local Points_Smoothed = {
|
|
Identifier = "Example_InterpolatedPoints_Spline",
|
|
Renderable = {
|
|
Type = "RenderableInterpolatedPoints",
|
|
-- Using a random walk dataset, to get movement in some different directions
|
|
File = asset.resource("data/interpolation_randomwalk.csv"),
|
|
-- Same number of objects as above - 10 objects with positions at 6 different
|
|
-- time steps
|
|
NumberOfObjects = 10,
|
|
Interpolation = {
|
|
-- Smoothen transitions between two different sets of points, by
|
|
-- using a spline based interpolation of the points
|
|
UseSplineInterpolation = true
|
|
},
|
|
-- Just use a fixed coloring here, no color mapping
|
|
Coloring = {
|
|
FixedColor = { 0.0, 0.5, 0.0 }
|
|
},
|
|
-- Reduce the scale of the points a bit compared to default, so we see them more clearly
|
|
SizeSettings = {
|
|
ScaleExponent = 3.0
|
|
}
|
|
},
|
|
GUI = {
|
|
Name = "Interpolating Points (Spline)",
|
|
Path = "/Example/Interpolated Point Clouds",
|
|
Description = [[Example of interpolating points with spline-based interpolation
|
|
for the position. This leads to smoother transitions at the nodes of the
|
|
interpolation. Try disabling the spline interpolation in the GUI (under
|
|
Renderable->Interpolation) to see the difference.]]
|
|
}
|
|
}
|
|
|
|
|
|
asset.onInitialize(function()
|
|
openspace.addSceneGraphNode(Points)
|
|
openspace.addSceneGraphNode(Points_Smoothed)
|
|
end)
|
|
|
|
asset.onDeinitialize(function()
|
|
openspace.removeSceneGraphNode(Points_Smoothed)
|
|
openspace.removeSceneGraphNode(Points)
|
|
end)
|
|
|
|
asset.export(Points)
|
|
asset.export(Points_Smoothed)
|
|
|
|
|
|
|
|
asset.meta = {
|
|
Name = "Example - Interpolated Point Clouds",
|
|
Version = "1.0",
|
|
Description = [[Example of point clouds that support interpolation. One uses a linear
|
|
motion and color mapping. The other example uses a spline interpolation for the
|
|
approximation of the positions, to result in smoother transitions between the sets
|
|
of positions. The interpolation can be triggered using the properties under
|
|
Renderable->Interpolation in the Scene menu.]],
|
|
Author = "OpenSpace Team",
|
|
URL = "http://openspaceproject.com",
|
|
License = "MIT license"
|
|
}
|