Move the primitives example asset into the existing structure

This commit is contained in:
Alexander Bock
2025-09-26 17:46:49 +02:00
parent 117ec147c6
commit f9f61e1fdd
3 changed files with 36 additions and 74 deletions

View File

@@ -1,70 +0,0 @@
local AU = 149597870700 -- 1 AU
local Circle = {
Identifier = "ExampleCircle",
Transform = {
Scale = {
Type = "StaticScale",
Scale = AU
}
},
Renderable = {
Type = "RenderableRadialGrid",
Color = { 0.6, 0.6, 0.8 },
LineWidth = 3.0,
GridSegments = { 1, 1 },
CircleSegments = 64,
Radii = { 0.0, 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,
Radii = { 0.0, AU }
},
GUI = {
Name = "Example Ellipse",
Path = "/Examples/Primitives"
}
}
asset.onInitialize(function()
openspace.addSceneGraphNode(Circle)
openspace.addSceneGraphNode(Ellipse)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(Ellipse)
openspace.removeSceneGraphNode(Circle)
end)
asset.export(Circle)
asset.export(Ellipse)
asset.meta = {
Name = "Primitives Example",
Description = [[Examples of different simple rendered primitives, such as circles
and ellipses.]],
Author = "OpenSpace Team",
URL = "http://openspaceproject.com",
License = "MIT license"
}

View File

@@ -1,16 +1,16 @@
-- Ring
-- The `RenderableRadialGrid` can also be used to create a simple ring. This is done by
-- Circle
-- The `RenderableRadialGrid` can also be used to create a simple circle. This is done by
-- setting the number of segments in each direction to 1 and make sure the inner radius
-- is zero (which is the default).
local Node = {
Identifier = "RenderableRadialGrid_Example_Ring",
Identifier = "RenderableRadialGrid_Example_Circle",
Renderable = {
Type = "RenderableRadialGrid",
GridSegments = { 1, 1 }
},
GUI = {
Name = "RenderableRadialGrid - Ring",
Name = "RenderableRadialGrid - Circle",
Path = "/Examples"
}
}

View File

@@ -0,0 +1,32 @@
-- Ellipse
-- The `RenderableRadialGrid` can also be used to create a simple ellipse. This is done by
-- setting the number of segments in each direction to 1 and make sure the inner radius
-- is zero (which is the default). By then applying a
-- [NonUniformStaticScale](#base_transform_scale_nonuniformstatic) to the scene graph node
-- this circle can be deformed into an ellipse.
local Node = {
Identifier = "RenderableRadialGrid_Example_Ellipse",
Transform = {
Scale = {
Type = "NonUniformStaticScale",
Scale = { 1.5, 1.0, 1.0 }
}
},
Renderable = {
Type = "RenderableRadialGrid",
GridSegments = { 1, 1 }
},
GUI = {
Name = "RenderableRadialGrid - Ellipse",
Path = "/Examples"
}
}
asset.onInitialize(function()
openspace.addSceneGraphNode(Node)
end)
asset.onDeinitialize(function()
openspace.removeSceneGraphNode(Node)
end)