Update lodearth and lodmars to new scenegraph structure. Also fix bug in scenegraphnode that caused wrong positioning.

This commit is contained in:
Kalle Bladin
2016-08-17 22:36:32 -04:00
parent d4e61b58f2
commit b072a54a79
4 changed files with 98 additions and 45 deletions
+49 -4
View File
@@ -1,9 +1,23 @@
return {
-- Earth barycenter module
{
Name = "EarthBarycenter",
Parent = "SolarSystemBarycenter",
Static = true,
Ephemeris = {
Type = "Spice",
Body = "EARTH BARYCENTER",
Reference = "ECLIPJ2000",
Observer = "SUN",
Kernels = {
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
}
},
},
-- RenderableGlobe module
{
Name = "DebugGlobe",
Parent = "Root",
Parent = "EarthBarycenter",
Renderable = {
Type = "RenderableGlobe",
Frame = "IAU_EARTH",
@@ -53,7 +67,11 @@ return {
Enabled = true,
},
--[[
{
Name = "Mars Viking Clr",
FilePath = "textures/Mars_Viking_ClrMosaic_global_925m_longlat_full.vrt",
Enabled = true,
},
{
Name = "On Mercury Color",
FilePath = "map_service_configs/mercury/OnMercuryColor.xml",
@@ -68,7 +86,7 @@ return {
{
Name = "CTX Mosaic",
FilePath = "map_service_configs/mars/CTX_Mosaic.xml",
Enabled = true,
Enabled = false,
},
--[[
@@ -111,6 +129,7 @@ return {
},
},
HeightMaps = {
{
Name = "Mola Elevation",
FilePath = "map_service_configs/mars/Mola_Elevation.xml",
@@ -154,4 +173,30 @@ return {
},
GuiName = "/Solar/Planets/DebugGlobe"
},
-- EarthTrail module
{
Name = "EarthTrail",
Parent = "SolarSystemBarycenter",
Renderable = {
Type = "RenderableTrail",
Body = "EARTH",
Frame = "GALACTIC",
Observer = "SUN",
RGB = { 0.5, 0.8, 1.0},
TropicalOrbitPeriod = 365.242,
EarthOrbitRatio = 1,
DayLength = 24
},
GuiName = "/Solar/EarthTrail"
}
--[[,
{
Name = "DebugPlane",
Parent = "DebugGlobe",
Renderable = {
Type = "RenderableDebugPlane",
Texture = 34,
Size = { 1, 7 }
}
}]]
}
+20 -17
View File
@@ -3,9 +3,6 @@ return {
{
Name = "EarthBarycenter",
Parent = "SolarSystemBarycenter",
Ephemeris = {
Type = "Static"
}
},
-- EarthTrail module
{
@@ -27,19 +24,25 @@ return {
{
Name = "LodEarth",
Parent = "EarthBarycenter",
Ephemeris = {
Type = "Spice",
Body = "EARTH",
Reference = "ECLIPJ2000",
Observer = "SUN",
Kernels = {
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
}
},
Rotation = {
Type = "Spice",
Frame = "IAU_EARTH",
Reference = "ECLIPJ2000"
Transform = {
Translation = {
Type = "SpiceEphemeris",
Body = "EARTH",
Reference = "ECLIPJ2000",
Observer = "SUN",
Kernels = {
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
}
},
Rotation = {
Type = "SpiceRotation",
SourceFrame = "IAU_EARTH",
DestinationFrame = "GALACTIC",
},
Scale = {
Type = "StaticScale",
Scale = 1,
},
},
Renderable = {
Type = "RenderableGlobe",
@@ -124,4 +127,4 @@ return {
},
GuiName = "/Solar/Planets/LodEarth"
},
}
}
+20 -16
View File
@@ -3,27 +3,30 @@ return {
{
Name = "MarsBarycenter",
Parent = "SolarSystemBarycenter",
Ephemeris = {
Type = "Static"
}
},
-- RenderableGlobe module
{
Name = "LodMars",
Parent = "MarsBarycenter",
Ephemeris = {
Type = "Spice",
Body = "MARS BARYCENTER",
Reference = "ECLIPJ2000",
Observer = "SUN",
Kernels = {
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
}
},
Rotation = {
Type = "Spice",
Frame = "IAU_MARS",
Reference = "ECLIPJ2000"
Transform = {
Translation = {
Type = "SpiceEphemeris",
Body = "MARS BARYCENTER",
Reference = "ECLIPJ2000",
Observer = "SUN",
Kernels = {
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
}
},
Rotation = {
Type = "SpiceRotation",
SourceFrame = "IAU_MARS",
DestinationFrame = "ECLIPJ2000",
},
Scale = {
Type = "StaticScale",
Scale = 1,
},
},
Renderable = {
Type = "RenderableGlobe",
@@ -48,6 +51,7 @@ return {
{
Name = "MARS_Viking_MDIM21",
FilePath = "map_service_configs/MARS_Viking_MDIM21.xml",
Enabled = true,
},
{
Name = "Mars Viking Clr",
+9 -8
View File
@@ -214,6 +214,7 @@ bool SceneGraphNode::deinitialize() {
void SceneGraphNode::update(const UpdateData& data) {
UpdateData newUpdateData = data;
if (_ephemeris) {
if (data.doPerformanceMeasurement) {
glFinish();
@@ -259,6 +260,14 @@ void SceneGraphNode::update(const UpdateData& data) {
_scale->update(newUpdateData);
}
_worldRotationCached = calculateWorldRotation();
_worldScaleCached = calculateWorldScale();
// Assumes _worldRotationCached and _worldScaleCached have been calculated for parent
_worldPositionCached = calculateWorldPosition();
newUpdateData.position = worldPosition();
if (_renderable && _renderable->isReady()) {
if (data.doPerformanceMeasurement) {
glFinish();
@@ -273,14 +282,6 @@ void SceneGraphNode::update(const UpdateData& data) {
else
_renderable->update(newUpdateData);
}
_worldRotationCached = calculateWorldRotation();
_worldScaleCached = calculateWorldScale();
// Assumes _worldRotationCached and _worldScaleCached have been calculated for parent
_worldPositionCached = calculateWorldPosition();
newUpdateData.position = worldPosition();
}
void SceneGraphNode::evaluate(const Camera* camera, const psc& parentPosition) {