mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 06:19:57 -05:00
Add examples for circle, ellipse and elliptic disc
This commit is contained in:
@@ -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
|
||||
})
|
||||
|
||||
@@ -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
|
||||
})
|
||||
Reference in New Issue
Block a user