diff --git a/data/assets/examples/discs.asset b/data/assets/examples/discs.asset index 0b15b2115b..e719330586 100644 --- a/data/assets/examples/discs.asset +++ b/data/assets/examples/discs.asset @@ -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 }) diff --git a/data/assets/examples/primitives.asset b/data/assets/examples/primitives.asset new file mode 100644 index 0000000000..e0b9a78098 --- /dev/null +++ b/data/assets/examples/primitives.asset @@ -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 +})