mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-24 04:59:24 -06:00
48 lines
1.1 KiB
Lua
48 lines
1.1 KiB
Lua
local sun = asset.require("scene/solarsystem/sun/sun")
|
|
local transforms = asset.require("scene/solarsystem/planets/earth/transforms")
|
|
|
|
local model = asset.syncedResource({
|
|
Name = "Animated Box",
|
|
Type = "HttpSynchronization",
|
|
Identifier = "animated_box",
|
|
Version = 1
|
|
})
|
|
|
|
local model = {
|
|
Identifier = "modelshader",
|
|
Parent = transforms.EarthCenter.Identifier,
|
|
Transform = {
|
|
Translation = {
|
|
Type = "StaticTranslation",
|
|
Position = { 11E7, 0.0, 0.0 }
|
|
}
|
|
},
|
|
Renderable = {
|
|
Type = "RenderableModel",
|
|
GeometryFile = model .. "BoxAnimated.glb",
|
|
ModelScale = 3E7,
|
|
LightSources = {
|
|
sun.LightSource
|
|
},
|
|
PerformShading = true,
|
|
DisableFaceCulling = true,
|
|
VertexShader = asset.localResource("model_vs.glsl"),
|
|
FragmentShader = asset.localResource("model_fs.glsl"),
|
|
},
|
|
GUI = {
|
|
Name = "Model Shader",
|
|
Path = "/Example",
|
|
Description = "Simple box model with a custom shader",
|
|
}
|
|
}
|
|
|
|
asset.onInitialize(function()
|
|
openspace.addSceneGraphNode(model)
|
|
end)
|
|
|
|
asset.onDeinitialize(function()
|
|
openspace.removeSceneGraphNode(model)
|
|
end)
|
|
|
|
asset.export(model)
|