mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-07 21:08:33 -06:00
* Updating all assets to new coding style * Cleaning up asset files * Moving default_actions and default_keybindings files * Changing procedural globes to explicitly specified globes * Move Spice loading explicitly to the initialize part and also deinitialize * Removing unused asset files * Removing asset_helper * Removing scale_model_helper asset * Removing script_scheduler_helper * Removing testing_keybindings * Remove procedural_globe
54 lines
1.3 KiB
Lua
54 lines
1.3 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,
|
|
-- (malej 2023-MAY-22) Note that PerformShading should be false in this example,
|
|
-- these example shaders dont't contain any light calculations
|
|
PerformShading = false,
|
|
VertexShader = asset.localResource("model_vs.glsl"),
|
|
FragmentShader = asset.localResource("model_fs.glsl"),
|
|
EnableAnimation = true,
|
|
AnimationStartTime = "2023 05 11 00:00:00",
|
|
AnimationTimeScale = "Second",
|
|
AnimationMode = "LoopInfinitely"
|
|
},
|
|
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)
|