Add examples for circle, ellipse and elliptic disc

This commit is contained in:
Emma Broman
2021-02-23 10:50:04 +01:00
parent b07320d1da
commit bc719f195c
2 changed files with 79 additions and 6 deletions
+27 -6
View File
@@ -1,16 +1,14 @@
local assetHelper = asset.require('util/asset_helper')
local color = {0.0, 1.0, 1.0}
-- @TODO (emmbr 2020-02-03) Potential threading issue later on? This will run on the main thread
local singeColorTexturePath = openspace.createSingeColorImage("example_ring_color", color)
local cyanTexture = openspace.createSingeColorImage("example_disc_color1", {0.0, 1.0, 1.0})
local purpleTexture = openspace.createSingeColorImage("example_disc_color2", {0.5, 0.0, 0.5})
local BasicDisc = {
Identifier = "BasicDisc",
Parent = "Root",
Renderable = {
Type = "RenderableDisc",
Texture = singeColorTexturePath,
Texture = cyanTexture,
Size = 1e10,
Width = 0.5
},
@@ -20,6 +18,29 @@ local BasicDisc = {
}
}
-- Elliptic discs can be created using a non-uniform scaling
-- For a full disc, use a width of 1.0
local FullEllipticDisc = {
Identifier = "FullEllipticDisc",
Transform = {
Scale = {
Type = "NonUniformStaticScale",
Scale = {2.0, 1.0, 1.0}
}
},
Renderable = {
Type = "RenderableDisc",
Texture = purpleTexture,
Size = 2e10,
Width = 1.0
},
GUI = {
Name = "Full Elliptic Disc",
Path = "/Examples/Discs"
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, {
BasicDisc
BasicDisc,
FullEllipticDisc
})
+52
View File
@@ -0,0 +1,52 @@
local assetHelper = asset.require('util/asset_helper')
local scale = 149597870700 -- 1 AU
local circle = {
Identifier = "ExampleCircle",
Transform = {
Scale = {
Type = "StaticScale",
Scale = scale
}
},
Renderable = {
Type = "RenderableRadialGrid",
Color = { 0.6, 0.6, 0.8 },
LineWidth = 3.0,
GridSegments = { 1, 1 },
CircleSegments = 64,
OuterRadius = 1.0
},
GUI = {
Name = "Example Circle",
Path = "/Examples/Primitives"
}
}
local ellipse = {
Identifier = "ExampleEllipse",
Transform = {
Scale = {
Type = "NonUniformStaticScale",
Scale = {1.5, 1.0, 1.0}
}
},
Renderable = {
Type = "RenderableRadialGrid",
Color = { 0.6, 0.8, 0.6 },
LineWidth = 3.0,
GridSegments = { 1, 1 },
CircleSegments = 64,
OuterRadius = scale
},
GUI = {
Name = "Example Ellipse",
Path = "/Examples/Primitives"
}
}
assetHelper.registerSceneGraphNodesAndExport(asset, {
circle,
ellipse
})