mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-19 19:39:30 -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
199 lines
5.0 KiB
Lua
199 lines
5.0 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 StartTime = "2021 06 01 00:00:00"
|
|
|
|
local AnimationLoop = {
|
|
Identifier = "AnimationLoop",
|
|
Parent = transforms.EarthCenter.Identifier,
|
|
Transform = {
|
|
Translation = {
|
|
Type = "StaticTranslation",
|
|
Position = { 0.0, -11E7, 0.0 }
|
|
}
|
|
},
|
|
Renderable = {
|
|
Type = "RenderableModel",
|
|
GeometryFile = model .. "BoxAnimated.glb",
|
|
EnableAnimation = true,
|
|
AnimationMode = "LoopFromStart",
|
|
AnimationStartTime = StartTime,
|
|
ModelScale = 3E7,
|
|
LightSources = {
|
|
sun.LightSource
|
|
}
|
|
},
|
|
GUI = {
|
|
Name = "Animated Model example (LoopFromStart)",
|
|
Path = "/Example",
|
|
Description = "Simple animated box model with the animation mode 'LoopFromStart'"
|
|
}
|
|
}
|
|
|
|
local AnimationLoopInf = {
|
|
Identifier = "AnimationLoopInf",
|
|
Parent = transforms.EarthCenter.Identifier,
|
|
Transform = {
|
|
Translation = {
|
|
Type = "StaticTranslation",
|
|
Position = { 0.0, 11E7, 0.0 }
|
|
}
|
|
},
|
|
Renderable = {
|
|
Type = "RenderableModel",
|
|
GeometryFile = model .. "BoxAnimated.glb",
|
|
EnableAnimation = true,
|
|
AnimationMode = "LoopInfinitely",
|
|
AnimationStartTime = StartTime,
|
|
ModelScale = 3E7,
|
|
LightSources = {
|
|
sun.LightSource
|
|
}
|
|
},
|
|
GUI = {
|
|
Name = "Animated Model example (LoopInfinitely)",
|
|
Path = "/Example",
|
|
Description = "Simple animated box model with the animation mode 'LoopInfinitely'"
|
|
}
|
|
}
|
|
|
|
local AnimationOnce = {
|
|
Identifier = "AnimationOnce",
|
|
Parent = transforms.EarthCenter.Identifier,
|
|
Transform = {
|
|
Translation = {
|
|
Type = "StaticTranslation",
|
|
Position = { 11E7, 0.0, 0.0 }
|
|
}
|
|
},
|
|
Renderable = {
|
|
Type = "RenderableModel",
|
|
GeometryFile = model .. "BoxAnimated.glb",
|
|
EnableAnimation = true,
|
|
AnimationMode = "Once",
|
|
AnimationStartTime = StartTime,
|
|
ModelScale = 3E7,
|
|
LightSources = {
|
|
sun.LightSource
|
|
}
|
|
},
|
|
GUI = {
|
|
Name = "Animated Model example (Once)",
|
|
Path = "/Example",
|
|
Description = "Simple animated box model with the animation mode 'Once'"
|
|
}
|
|
}
|
|
|
|
local AnimationBounceInf = {
|
|
Identifier = "AnimationBounceInf",
|
|
Parent = transforms.EarthCenter.Identifier,
|
|
Transform = {
|
|
Translation = {
|
|
Type = "StaticTranslation",
|
|
Position = { 0.0, 0.0, 11E7 }
|
|
}
|
|
},
|
|
Renderable = {
|
|
Type = "RenderableModel",
|
|
GeometryFile = model .. "BoxAnimated.glb",
|
|
EnableAnimation = true,
|
|
AnimationMode = "BounceInfinitely",
|
|
AnimationStartTime = StartTime,
|
|
ModelScale = 3E7,
|
|
LightSources = {
|
|
sun.LightSource
|
|
}
|
|
},
|
|
GUI = {
|
|
Name = "Animated Model example (BounceInfinitely)",
|
|
Path = "/Example",
|
|
Description = "Simple animated box model with the animation mode 'BounceInfinitely'"
|
|
}
|
|
}
|
|
|
|
local AnimationBounce = {
|
|
Identifier = "AnimationBounce",
|
|
Parent = transforms.EarthCenter.Identifier,
|
|
Transform = {
|
|
Translation = {
|
|
Type = "StaticTranslation",
|
|
Position = { 0.0, 0.0, -11E7 }
|
|
}
|
|
},
|
|
Renderable = {
|
|
Type = "RenderableModel",
|
|
GeometryFile = model .. "BoxAnimated.glb",
|
|
EnableAnimation = true,
|
|
AnimationMode = "BounceFromStart",
|
|
AnimationStartTime = StartTime,
|
|
ModelScale = 3E7,
|
|
LightSources = {
|
|
sun.LightSource
|
|
}
|
|
},
|
|
GUI = {
|
|
Name = "Animated Model example (BounceFromStart)",
|
|
Path = "/Example",
|
|
Description = "Simple animated box model with the animation mode 'BounceFromStart'"
|
|
}
|
|
}
|
|
|
|
|
|
asset.onInitialize(function()
|
|
openspace.addSceneGraphNode(AnimationLoop)
|
|
openspace.addSceneGraphNode(AnimationLoopInf)
|
|
openspace.addSceneGraphNode(AnimationOnce)
|
|
openspace.addSceneGraphNode(AnimationBounceInf)
|
|
openspace.addSceneGraphNode(AnimationBounce)
|
|
end)
|
|
|
|
asset.onDeinitialize(function()
|
|
openspace.removeSceneGraphNode(AnimationBounce)
|
|
openspace.removeSceneGraphNode(AnimationBounceInf)
|
|
openspace.removeSceneGraphNode(AnimationOnce)
|
|
openspace.removeSceneGraphNode(AnimationLoopInf)
|
|
openspace.removeSceneGraphNode(AnimationLoop)
|
|
end)
|
|
|
|
|
|
asset.export(AnimationLoop)
|
|
asset.export(AnimationLoopInf)
|
|
asset.export(AnimationOnce)
|
|
asset.export(AnimationBounceInf)
|
|
asset.export(AnimationBounce)
|
|
|
|
|
|
|
|
asset.meta = {
|
|
Name = "Animation Example asset",
|
|
Version = "1.0",
|
|
Description = "Simple animation example asset with an animated box model",
|
|
Author = "OpenSpace Team",
|
|
URL = "http://openspaceproject.com",
|
|
License = "MIT license"
|
|
}
|
|
|
|
-- Model
|
|
-- @TODO: At the moment, this overwrites the previous meta description. Probably needs a way to specify multiple meta's per file?
|
|
asset.meta = {
|
|
Name = "Animated Box Model",
|
|
Version = "1.0",
|
|
Description = "Simple animated box model",
|
|
Author = "Cesium, https://cesium.com/",
|
|
URL = "https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoxAnimated",
|
|
License = [[
|
|
Creative Commons Attribution 4.0 International License,
|
|
https://creativecommons.org/licenses/by/4.0/
|
|
]]
|
|
}
|