Remove rotation and shift meridian from RenderablePlanetProjection

Unify the property names in RenderablePlanet
Remove MainFrame from RenderableShadowCylinder
Clean up dictionary keys for RenderableModel, RenderableModelProjection, RenderablePlanetProjection
This commit is contained in:
Alexander Bock
2017-07-27 01:12:27 -04:00
parent 8c581fc7d9
commit e794f6ae01
49 changed files with 167 additions and 438 deletions

View File

@@ -40,10 +40,10 @@ return {
},
--Caster2 = { Name = "Independency Day Ship", Radius = 0 }
},
ColorTexture = "textures/earth_bluemarble.jpg",
NightTexture = "textures/earth_night.jpg",
Textures = {
Type = "simple",
Color = "textures/earth_bluemarble.jpg",
Night = "textures/earth_night.jpg",
--Height = "textures/earth_bluemarble_height.jpg",
-- Depth = "textures/earth_depth.png",
Reflectance = "textures/earth_reflectance.png",

View File

@@ -37,17 +37,9 @@ return {
Radius = 6.371E6,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/earth_bluemarble.jpg",
Night = "textures/earth_night.jpg",
Height = "textures/earth_bluemarble_height.jpg"
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/earth_bluemarble.jpg",
HeightTexture = "textures/earth_bluemarble_height.jpg",
NightTexture = "textures/earth_night.jpg",
},
Tag = {"planet_solarSystem", "planet_terrestrial"},
Transform = {

View File

@@ -12,15 +12,7 @@ return {
Radius = 2.631E6,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/callisto.jpg",
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/callisto.jpg",
},
Transform = {
Translation = {

View File

@@ -12,15 +12,7 @@ return {
Radius = 1.561E6,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/europa.jpg",
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/europa.jpg",
},
Transform = {
Translation = {

View File

@@ -12,15 +12,7 @@ return {
Radius = 2.631E6,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/ganymede.jpg",
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/ganymede.jpg",
},
Transform = {
Translation = {

View File

@@ -12,15 +12,7 @@ return {
Radius = 1.8213E6,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/io.jpg",
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/io.jpg",
},
Transform = {
Translation = {

View File

@@ -25,15 +25,7 @@ return {
Radius = 0.71492E8,
Segments = 200
},
Textures = {
Type = "simple",
Color = "textures/jupiter.jpg",
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/jupiter.jpg",
},
Tag = "planet_solarSystem",
Transform = {

View File

@@ -25,15 +25,7 @@ return {
Radius = 6.390E6,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/mars.jpg",
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/mars.jpg",
},
Tag = {"planet_solarSystem", "planet_terrestrial"},
Transform = {

View File

@@ -25,15 +25,7 @@ return {
Radius = 2.4397E6,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/mercury.jpg",
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/mercury.jpg",
},
Tag = {"planet_solarSystem", "planet_terrestrial"},
Transform = {

View File

@@ -13,10 +13,7 @@ return {
Radius = 6.390E5,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/gray.png",
},
ColorTexture = "textures/gray.png",
StartTime = "2010 JAN 01 00:00:00",
EndTime = "2018 JAN 22 12:00:00"
},

View File

@@ -11,10 +11,7 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "${OPENSPACE_DATA}/scene/dawn/obj/mainbodydawn.obj",
},
Textures = {
Type = "simple",
Color = "textures/gray.png",
},
ColorTexture = "textures/gray.png",
Rotation = {
Source = "DAWN_SPACECRAFT",
Destination = "GALACTIC"
@@ -634,10 +631,7 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "${OPENSPACE_DATA}/scene/dawn/obj/solarpanelleft.obj",
},
Textures = {
Type = "simple",
Color = "textures/gray.png",
},
ColorTexture = "textures/gray.png",
Rotation = {
Source = "DAWN_SA-Y",
Destination = "GALACTIC"
@@ -657,10 +651,7 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "${OPENSPACE_DATA}/scene/dawn/obj/solarpanelright.obj",
},
Textures = {
Type = "simple",
Color = "textures/gray.png",
},
ColorTexture = "textures/gray.png",
Rotation = {
Source = "DAWN_SA+Y",
Destination = "GALACTIC"

View File

@@ -11,9 +11,9 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "${OPENSPACE_DATA}/scene/vestaprojection_2/obj/VestaComet_5000.obj",
},
ColorTexture = "textures/dummy.jpg",
Textures = {
Type = "simple",
Color = "textures/dummy.jpg",
Project = "textures/projectMe.png",
Default = "textures/defaultProj_backup.png"
},

View File

@@ -13,10 +13,7 @@ return {
GeometryFile = "Juno.obj",
Magnification = 4,
},
Textures = {
Type = "simple",
Color = "textures/gray.png",
},
ColorTexture = "textures/gray.png",
Rotation = {
Source = "JUNO_SPACECRAFT",
Destination = "GALACTIC",

View File

@@ -15,9 +15,9 @@ return {
Radius = callisto_radius,
Segments = 100
},
ColorTexture = "textures/callisto.jpg",
Textures = {
Type = "simple",
Color = "textures/callisto.jpg",
Project = "textures/defaultProj.png",
Sequencing = "true",
},

View File

@@ -15,9 +15,9 @@ return {
Radius = europa_radius,
Segments = 100
},
ColorTexture = "textures/europa.jpg",
Textures = {
Type = "simple",
Color = "textures/europa.jpg",
Project = "textures/defaultProj.png",
Sequencing = "true",
},

View File

@@ -15,9 +15,9 @@ return {
Radius = ganymede_local,
Segments = 100
},
ColorTexture = "textures/ganymede.jpg",
Textures = {
Type = "simple",
Color = "textures/ganymede.jpg",
Project = "textures/defaultProj.png",
Sequencing = "true",
},

View File

@@ -15,9 +15,9 @@ return {
Radius = io_radius,
Segments = 100
},
ColorTexture = "textures/io.jpg",
Textures = {
Type = "simple",
Color = "textures/io.jpg",
Project = "textures/defaultProj.png",
Sequencing = "true",
},

View File

@@ -28,9 +28,9 @@ return {
Radius = jupiter_local,
Segments = 200,
},
ColorTexture = "textures/jupiterFlipped_low.jpg",
Textures = {
Type = "simple",
Color = "textures/jupiterFlipped_low.jpg",
Project = "textures/lorriTest1.jpg",
Sequencing = "true",
},

View File

@@ -98,10 +98,7 @@ return {
GeometryFile = "models/NewHorizonsCleanModel.obj",
-- Magnification = 4,
},
Textures = {
Type = "simple",
Color = "textures/NHTexture.jpg",
},
ColorTexture = "textures/NHTexture.jpg",
Shading = {
PerformShading = true,
Fadeable = false,
@@ -145,9 +142,9 @@ return {
GeometryFile = "models/Labels.obj",
-- Magnification = 4,
},
ColorTexture = "textures/labels.png",
Textures = {
Type = "simple",
Color = "textures/labels.png",
BumpMap = "textures/goldfoilbump.tif"
},
Rotation = {

View File

@@ -31,10 +31,8 @@ return {
Radius = charon_radius,
Segments = 100
},
Textures = {
Color = ColorTexture,
Height = "textures/cpdem-Mcolor2-MLorriCA-lr-5_ZMfs-cyl.jpg",
},
ColorTexture = ColorTexture,
HeightTexture = "textures/cpdem-Mcolor2-MLorriCA-lr-5_ZMfs-cyl.jpg",
Projection = {
Observer = "NEW HORIZONS",
Target = "CHARON",
@@ -99,7 +97,6 @@ return {
Observer = "NEW HORIZONS",
Body = "CHARON",
BodyFrame = "IAU_CHARON",
MainFrame = "GALACTIC",
Aberration = "NONE",
},
},

View File

@@ -25,10 +25,7 @@ return {
Radius = charon_radius,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/gray.jpg",
}
ColorTexture = "textures/gray.jpg",
},
Transform = {
Translation = {

View File

@@ -25,10 +25,7 @@ return {
Radius = kerberos_radius,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/gray.jpg",
}
ColorTexture = "textures/gray.jpg",
},
Transform = {
Translation = {

View File

@@ -25,10 +25,7 @@ return {
Radius = nix_radius,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/gray.jpg",
}
ColorTexture = "textures/gray.jpg",
},
Transform = {
Translation = {

View File

@@ -44,10 +44,8 @@ return {
Radius = pluto_radius,
Segments = 100
},
Textures = {
Color = ColorTexture,
Height = "textures/pluto_shenk_heightmap.jpg",
},
ColorTexture = ColorTexture,
HeightTexture = "textures/pluto_shenk_heightmap.jpg",
Projection = {
Sequence = "${OPENSPACE_DATA}/scene/missions/newhorizons/pluto/pluto/images",
EventFile = "${OPENSPACE_DATA}/scene/missions/newhorizons/pluto/pluto/assets/core_v9h_obs_getmets_v8_time_fix_nofrcd_mld.txt",
@@ -231,7 +229,6 @@ return {
Observer = "NEW HORIZONS",
Body = "PLUTO",
BodyFrame = "IAU_PLUTO",
MainFrame = "GALACTIC",
Aberration = "NONE",
},
},

View File

@@ -25,10 +25,7 @@ return {
Radius = styx_radius,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/gray.jpg",
}
ColorTexture = "textures/gray.jpg",
},
Transform = {
Translation = {

View File

@@ -169,10 +169,7 @@ return {
GeometryFile = "models/orx_base_resized_12_sep_2016.obj",
Magnification = 0,
},
Textures = {
Type = "simple",
Color = "textures/osirisTex.png",
},
ColorTexture = "textures/osirisTex.png",
Shading = {
PerformShading = true,
Fadeable = false,
@@ -204,10 +201,7 @@ return {
GeometryFile = "models/orx_polycam_resized_12_sep_2016.obj",
Magnification = 0,
},
Textures = {
Type = "simple",
Color = "textures/osirisTex.png",
},
ColorTexture = "textures/osirisTex.png",
Shading = {
PerformShading = true,
Fadeable = false,
@@ -237,10 +231,7 @@ return {
GeometryFile = "models/orx_rexis_resized_12_sep_2016.obj",
Magnification = 0,
},
Textures = {
Type = "simple",
Color = "textures/osirisTex.png",
},
ColorTexture = "textures/osirisTex.png",
Shading = {
PerformShading = true,
Fadeable = false,

View File

@@ -95,10 +95,7 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/black_foil.obj"
},
Textures = {
Type = "simple",
Color = "textures/foil_silver_ramp.png"
},
ColorTexture = "textures/foil_silver_ramp.png",
ModelTransform = RotationMatrix
}
},
@@ -112,10 +109,7 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/black_parts.obj"
},
Textures = {
Type = "simple",
Color = "textures/foil_silver_ramp.png"
},
ColorTexture = "textures/foil_silver_ramp.png",
ModelTransform = RotationMatrix
}
},
@@ -129,20 +123,9 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/dish.obj"
},
Textures = {
Type = "simple",
Color = "textures/dish_AO.png"
},
ColorTexture = "textures/dish_AO.png",
ModelTransform = RotationMatrix
},
-- Transform = {
-- Rotation = {
-- Type = "SpiceRotation",
-- SourceFrame = "-226071", -- ROS_HGA
-- DestinationFrame = "ROS_SPACECRAFT",
-- }
-- }
},
{
Name = "Rosetta_parts",
@@ -154,12 +137,8 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/parts.obj"
},
Textures = {
Type = "simple",
Color = "textures/parts2_AO.png"
},
ColorTexture = "textures/parts2_AO.png",
ModelTransform = RotationMatrix
}
},
{
@@ -172,12 +151,8 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/silver_foil.obj"
},
Textures = {
Type = "simple",
Color = "textures/foil_silver_ramp.png"
},
ColorTexture = "textures/foil_silver_ramp.png",
ModelTransform = RotationMatrix
}
},
{
@@ -190,12 +165,8 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/vents.obj"
},
Textures = {
Type = "simple",
Color = "textures/tex_01.png"
},
ColorTexture = "textures/tex_01.png",
ModelTransform = RotationMatrix
}
},
{
@@ -208,20 +179,9 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/wingA.obj"
},
Textures = {
Type = "simple",
Color = "textures/tex_01.png"
},
ColorTexture = "textures/tex_01.png",
ModelTransform = RotationMatrix
},
-- Transform = {
-- Rotation = {
-- Type = "SpiceRotation",
-- SourceFrame = "-226015", -- ROS_SA
-- DestinationFrame = "ROS_SPACECRAFT",
-- }
-- }
},
{
Name = "Rosetta_wing_b",
@@ -233,12 +193,8 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/wingB.obj"
},
Textures = {
Type = "simple",
Color = "textures/tex_01.png"
},
ColorTexture = "textures/tex_01.png",
ModelTransform = RotationMatrix
},
-- Transform = {
-- Rotation = {
@@ -258,12 +214,8 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/yellow_foil.obj"
},
Textures = {
Type = "simple",
Color = "textures/foil_gold_ramp.png"
},
ColorTexture = "textures/foil_gold_ramp.png",
ModelTransform = RotationMatrix
}
},
{
@@ -300,12 +252,8 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/lander_foil.obj"
},
Textures = {
Type = "simple",
Color = "textures/foil_silver_ramp.png"
},
ColorTexture = "textures/foil_silver_ramp.png",
ModelTransform = RotationMatrix
}
},
{
@@ -318,12 +266,8 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/lander_lids.obj"
},
Textures = {
Type = "simple",
Color = "textures/parts2_AO.png"
},
ColorTexture = "textures/parts2_AO.png",
ModelTransform = RotationMatrix
}
},
{
@@ -336,12 +280,8 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/lander_parts.obj"
},
Textures = {
Type = "simple",
Color = "textures/foil_silver_ramp.png"
},
ColorTexture = "textures/foil_silver_ramp.png",
ModelTransform = RotationMatrix
}
},
{
@@ -354,10 +294,7 @@ return {
Type = "MultiModelGeometry",
GeometryFile = "rosetta/lander_solarp.obj"
},
Textures = {
Type = "simple",
Color = "textures/tex_01.png"
},
ColorTexture = "textures/tex_01.png",
ModelTransform = RotationMatrix
}
},

View File

@@ -22,11 +22,7 @@ return {
Radius = 6.371E6
},
},
Textures = {
Type = "simple",
Color = "textures/Moon16K.dds",
--Color = "textures/moonmap4k.jpg",
},
ColorTexture = "textures/Moon16K.dds",
},
Transform = {
Translation = {

View File

@@ -26,10 +26,7 @@ return {
Radius = 2.4622E7,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/neptune.jpg",
}
ColorTexture = "textures/neptune.jpg",
},
Tag = "planet_solarSystem",
Transform = {

View File

@@ -28,15 +28,7 @@ return {
Radius = 1.173E6,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/pluto.jpg",
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/pluto.jpg",
},
Transformation = {
Translation = {
@@ -64,15 +56,7 @@ return {
Radius = 6.035E5,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/gray.jpg",
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/gray.jpg",
},
Transformation = {
Translation = {

View File

@@ -11,9 +11,7 @@ return {
Radius = 0.563E3,
Segments = 50
},
Textures = {
Color = "textures/dione.jpg"
}
ColorTexture = "textures/dione.jpg"
},
Transform = {
Translation = {

View File

@@ -11,9 +11,7 @@ return {
Radius = 0.257E3,
Segments = 50
},
Textures = {
Color = "textures/enceladus.jpg"
}
ColorTexture = "textures/enceladus.jpg"
},
Transform = {
Translation = {

View File

@@ -11,9 +11,7 @@ return {
Radius = 0.746E3,
Segments = 50
},
Textures = {
Color = "textures/iapetus.jpg"
}
ColorTexture = "textures/iapetus.jpg"
},
Transform = {
Translation = {

View File

@@ -11,9 +11,7 @@ return {
Radius = 0.28E3,
Segments = 50
},
Textures = {
Color = "textures/mimas.jpg"
}
ColorTexture = "textures/mimas.jpg"
},
Transform = {
Translation = {

View File

@@ -11,9 +11,7 @@ return {
Radius = 0.765E3,
Segments = 50
},
Textures = {
Color = "textures/rhea.jpg"
}
ColorTexture = "textures/rhea.jpg"
},
Transform = {
Translation = {

View File

@@ -26,15 +26,7 @@ return {
Radius = 5.8232E7,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/saturn.jpg",
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/saturn.jpg",
},
Tag = "planet_solarSystem",
Transform = {

View File

@@ -11,9 +11,7 @@ return {
Radius = 0.538E3,
Segments = 50
},
Textures = {
Color = "textures/tethys.jpg"
}
ColorTexture = "textures/tethys.jpg"
},
Transform = {
Translation = {

View File

@@ -11,9 +11,7 @@ return {
Radius = 0.2575E4,
Segments = 50
},
Textures = {
Color = "textures/titan.jpg"
}
ColorTexture = "textures/titan.jpg"
},
Transform = {
Translation = {

View File

@@ -24,10 +24,7 @@ return {
Radius = 6.957E8,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/sun.jpg",
},
ColorTexture = "textures/sun.jpg",
PerformShading = false,
},
Transform = {

View File

@@ -26,15 +26,7 @@ return {
Radius = 2.5362E7,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/uranus.jpg",
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/uranus.jpg",
},
Tag = "planet_solarSystem",
Transform = {

View File

@@ -26,15 +26,7 @@ return {
Radius = 3.760E6,
Segments = 100
},
Textures = {
Type = "simple",
Color = "textures/venus.jpg",
},
Atmosphere = {
Type = "Nishita", -- for example, values missing etc etc
MieFactor = 1.0,
MieColor = {1.0, 1.0, 1.0}
}
ColorTexture = "textures/venus.jpg",
},
Tag = {"planet_solarSystem", "planet_terrestrial"},
Transform = {

View File

@@ -44,11 +44,9 @@
namespace {
const char* KeyGeometry = "Geometry";
const char* KeyTexture = "Textures.Color";
const char* KeyModelTransform = "ModelTransform";
static const openspace::properties::Property::PropertyInfo TextureInfo = {
"ColorTexture", // @TODO replace with only "Texture"
"ColorTexture",
"Color Texture",
"This value points to a color texture file that is applied to the geometry "
"rendered in this object."
@@ -84,7 +82,7 @@ documentation::Documentation RenderableModel::Documentation() {
"This specifies the model that is rendered by the Renderable."
},
{
KeyTexture, // @TODO replace with TextureInfo.identifier
TextureInfo.identifier,
new StringVerifier,
Optional::Yes,
TextureInfo.description
@@ -132,12 +130,14 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
_geometry = modelgeometry::ModelGeometry::createFromDictionary(dict);
}
if (dictionary.hasKey(KeyTexture)) {
_colorTexturePath = absPath(dictionary.value<std::string>(KeyTexture));
if (dictionary.hasKey(TextureInfo.identifier)) {
_colorTexturePath = absPath(dictionary.value<std::string>(
TextureInfo.identifier
));
}
if (dictionary.hasKey(KeyModelTransform)) {
_modelTransform = dictionary.value<glm::dmat3>(KeyModelTransform);
if (dictionary.hasKey(ModelTransformInfo.identifier)) {
_modelTransform = dictionary.value<glm::dmat3>(ModelTransformInfo.identifier);
}
if (dictionary.hasKey(ShadingInfo.identifier)) {

View File

@@ -44,21 +44,18 @@
namespace {
const char* _loggerCat = "RenderableModelProjection";
const char* keySource = "Rotation.Source";
const char* keyDestination = "Rotation.Destination";
const char* keyGeometry = "Geometry";
const char* keyProjection = "Projection";
const char* keyBoundingSphereRadius = "BoundingSphereRadius";
const char* keyTextureColor = "Textures.Color";
const char* _destination = "GALACTIC";
const char* DestinationFrame = "GALACTIC";
static const openspace::properties::Property::PropertyInfo ColorTextureInfo = {
"ColorTexture",
"Color Base Texture",
"This is the path to a local image file that is used as the base texture for "
"the model on which the image projections are layered."
"This is the path to a local image file that is used as the base texture for the "
"model on which the image projections are layered."
};
static const openspace::properties::Property::PropertyInfo PerformShadingInfo = {
@@ -82,8 +79,7 @@ documentation::Documentation RenderableModelProjection::Documentation() {
{
"Type",
new StringEqualVerifier("RenderableModelProjection"),
Optional::No,
""
Optional::No
},
{
keyGeometry,
@@ -98,7 +94,7 @@ documentation::Documentation RenderableModelProjection::Documentation() {
"Contains information about projecting onto this planet."
},
{
keyTextureColor, // @TODO Change to ColorTextureInfo.identifier
ColorTextureInfo.identifier,
new StringVerifier,
Optional::No,
ColorTextureInfo.description
@@ -149,7 +145,9 @@ RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& di
ModelGeometry::createFromDictionary(geometryDictionary)
);
_colorTexturePath = absPath(dictionary.value<std::string>(keyTextureColor));
_colorTexturePath = absPath(dictionary.value<std::string>(
ColorTextureInfo.identifier
));
addPropertySubOwner(_geometry.get());
addPropertySubOwner(_projectionComponent);
@@ -172,11 +170,9 @@ RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& di
Renderable::addProperty(_performShading);
}
RenderableModelProjection::~RenderableModelProjection() {
// This empty method needs to be here in order to use forward declaration with
// std::unique_ptr
}
// This empty method needs to be here in order to use forward declaration with
// std::unique_ptr
RenderableModelProjection::~RenderableModelProjection() {}
bool RenderableModelProjection::isReady() const {
bool ready = true;
@@ -218,8 +214,9 @@ bool RenderableModelProjection::initialize() {
}
bool RenderableModelProjection::deinitialize() {
if (_geometry)
if (_geometry) {
_geometry->deinitialize();
}
_geometry = nullptr;
_baseTexture = nullptr;
@@ -237,13 +234,15 @@ ghoul::opengl::Texture& RenderableModelProjection::baseTexture() const {
}
void RenderableModelProjection::render(const RenderData& data, RendererTasks&) {
if (_projectionComponent.needsClearProjection())
if (_projectionComponent.needsClearProjection()) {
_projectionComponent.clearAllProjections();
}
_up = data.camera.lookUpVectorCameraSpace();
if (_capture && _projectionComponent.doesPerformProjection())
if (_capture && _projectionComponent.doesPerformProjection()) {
project();
}
_programObject->activate();
@@ -296,8 +295,9 @@ void RenderableModelProjection::update(const UpdateData& data) {
_projectionComponent.update();
if (_depthFboProgramObject->isDirty())
if (_depthFboProgramObject->isDirty()) {
_depthFboProgramObject->rebuildFromFile();
}
_time = data.time.j2000Seconds();
@@ -368,7 +368,11 @@ void RenderableModelProjection::imageProjectGPU(
void RenderableModelProjection::attitudeParameters(double time) {
try {
_instrumentMatrix = SpiceManager::ref().positionTransformMatrix(_projectionComponent.instrumentId(), _destination, time);
_instrumentMatrix = SpiceManager::ref().positionTransformMatrix(
_projectionComponent.instrumentId(),
DestinationFrame,
time
);
}
catch (const SpiceManager::SpiceException&) {
return;
@@ -381,7 +385,9 @@ void RenderableModelProjection::attitudeParameters(double time) {
}
glm::dvec3 boresight;
try {
SpiceManager::FieldOfViewResult res = SpiceManager::ref().fieldOfView(_projectionComponent.instrumentId());
SpiceManager::FieldOfViewResult res = SpiceManager::ref().fieldOfView(
_projectionComponent.instrumentId()
);
boresight = std::move(res.boresightVector);
} catch (const SpiceManager::SpiceException&) {
return;
@@ -391,7 +397,7 @@ void RenderableModelProjection::attitudeParameters(double time) {
glm::dvec3 p = SpiceManager::ref().targetPosition(
_projectionComponent.projectorId(),
_projectionComponent.projecteeId(),
_destination,
DestinationFrame,
_projectionComponent.aberration(),
time, lightTime
);
@@ -417,7 +423,10 @@ void RenderableModelProjection::attitudeParameters(double time) {
void RenderableModelProjection::project() {
for (auto img : _imageTimes) {
attitudeParameters(img.timeRange.start);
auto projTexture = _projectionComponent.loadProjectionTexture(img.path, img.isPlaceholder);
auto projTexture = _projectionComponent.loadProjectionTexture(
img.path,
img.isPlaceholder
);
imageProjectGPU(projTexture);
}
_capture = false;
@@ -426,8 +435,9 @@ void RenderableModelProjection::project() {
bool RenderableModelProjection::loadTextures() {
_baseTexture = nullptr;
if (_colorTexturePath.value() != "") {
_baseTexture = ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath))
;
_baseTexture = ghoul::io::TextureReader::ref().loadTexture(
absPath(_colorTexturePath)
);
if (_baseTexture) {
LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'");
_baseTexture->uploadTexture();

View File

@@ -54,36 +54,27 @@
namespace {
const char* _loggerCat = "RenderablePlanetProjection";
const char* keyGeometry = "Geometry";
const char* keyProjection = "Projection";
const char* keyMeridianShift = "Textures.MeridianShift";
const char* keyColorTexture = "Textures.Color";
const char* keyHeightTexture = "Textures.Height";
const char* KeyGeometry = "Geometry";
const char* KeyProjection = "Projection";
const char* keyRadius = "Geometry.Radius";
const char* KeyRadius = "Geometry.Radius";
// const char* keyShading = "PerformShading";
const char* _mainFrame = "GALACTIC";
static const openspace::properties::Property::PropertyInfo ColorTextureInfo = {
"PlanetTexture",
"ColorTexture",
"Color Base Texture",
"The path to the base color texture that is used on the planet prior to any "
"image projection."
};
static const openspace::properties::Property::PropertyInfo HeightTextureInfo = {
"HeightMap",
"HeightTexture",
"Heightmap Texture",
"The path to the height map texture that is used for the planet. If no height "
"map is specified the planet does not use a height field."
};
static const openspace::properties::Property::PropertyInfo ShiftMeridianInfo = {
"ShiftMeridian",
"Shift Meridian by 180 deg",
"Shift the position of the meridian by 180 degrees. This value "
};
static const openspace::properties::Property::PropertyInfo HeightExaggerationInfo = {
"HeightExaggeration",
"Height Exaggeration",
@@ -108,32 +99,25 @@ documentation::Documentation RenderablePlanetProjection::Documentation() {
""
},
{
keyGeometry,
KeyGeometry,
new ReferencingVerifier("space_geometry_planet"),
Optional::No,
"The geometry that is used for rendering this planet.",
},
{
keyProjection,
KeyProjection,
new ReferencingVerifier("newhorizons_projectioncomponent"),
Optional::No,
"Contains information about projecting onto this planet.",
},
{
keyMeridianShift,
new BoolVerifier,
Optional::Yes,
"Determines whether the meridian of the planet should be shifted by 180 "
"degrees. The default value is 'false'"
},
{
keyColorTexture, // @TODO This should be ColorTextureInfo.identifier
ColorTextureInfo.identifier,
new StringVerifier,
Optional::No,
ColorTextureInfo.description
},
{
keyHeightTexture, // @TODO This should be HeightTextureInfo.identifier
HeightTextureInfo.identifier,
new StringVerifier,
Optional::Yes,
HeightTextureInfo.description
@@ -152,12 +136,10 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
: Renderable(dictionary)
, _colorTexturePath(ColorTextureInfo)
, _heightMapTexturePath(HeightTextureInfo)
, _rotation({ "Rotation", "Rotation", "" }, 0, 0, 360) // @TODO Missing documentation
, _programObject(nullptr)
, _fboProgramObject(nullptr)
, _baseTexture(nullptr)
, _heightMapTexture(nullptr)
, _shiftMeridianBy180({"asd", "", "" }, false) // @TODO Missing documentation
, _heightExaggeration(HeightExaggerationInfo, 1.f, 0.f, 100.f)
, _capture(false)
{
@@ -172,8 +154,7 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
ghoul_assert(success, "");
ghoul::Dictionary geometryDictionary;
success = dictionary.getValue(
keyGeometry, geometryDictionary);
success = dictionary.getValue(KeyGeometry, geometryDictionary);
if (success) {
geometryDictionary.setValue(SceneGraphNode::KeyName, name);
using planetgeometry::PlanetGeometry;
@@ -182,38 +163,34 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
);
}
_projectionComponent.initialize(dictionary.value<ghoul::Dictionary>(keyProjection));
_projectionComponent.initialize(dictionary.value<ghoul::Dictionary>(KeyProjection));
// TODO: textures need to be replaced by a good system similar to the geometry as soon
// as the requirements are fixed (ab)
std::string texturePath = "";
success = dictionary.getValue("Textures.Color", texturePath);
success = dictionary.getValue(ColorTextureInfo.identifier, texturePath);
if (success) {
_colorTexturePath = absPath(texturePath);
}
std::string heightMapPath = "";
success = dictionary.getValue("Textures.Height", heightMapPath);
success = dictionary.getValue(HeightTextureInfo.identifier, heightMapPath);
if (success) {
_heightMapTexturePath = absPath(heightMapPath);
}
if (dictionary.hasKeyAndValue<bool>(keyMeridianShift)) {
_shiftMeridianBy180 = dictionary.value<bool>(keyMeridianShift);
}
float radius = std::pow(10.f, 9.f);
dictionary.getValue(keyRadius, radius);
dictionary.getValue(KeyRadius, radius);
setBoundingSphere(radius);
addPropertySubOwner(_geometry.get());
addPropertySubOwner(_projectionComponent);
addProperty(_colorTexturePath);
_colorTexturePath.onChange(std::bind(&RenderablePlanetProjection::loadTextures, this));
_colorTexturePath.onChange([&]() { loadTextures(); });
addProperty(_heightMapTexturePath);
_heightMapTexturePath.onChange(std::bind(&RenderablePlanetProjection::loadTextures, this));
_heightMapTexturePath.onChange([&]() { loadTextures(); });
if (dictionary.hasKey(HeightExaggerationInfo.identifier)) {
_heightExaggeration = static_cast<float>(
@@ -222,8 +199,6 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
}
addProperty(_heightExaggeration);
addProperty(_shiftMeridianBy180);
}
RenderablePlanetProjection::~RenderablePlanetProjection() {}
@@ -231,12 +206,14 @@ RenderablePlanetProjection::~RenderablePlanetProjection() {}
bool RenderablePlanetProjection::initialize() {
bool completeSuccess = true;
_programObject = OsEng.renderEngine().buildRenderProgram("projectiveProgram",
_programObject = OsEng.renderEngine().buildRenderProgram(
"projectiveProgram",
"${MODULE_NEWHORIZONS}/shaders/renderablePlanet_vs.glsl",
"${MODULE_NEWHORIZONS}/shaders/renderablePlanet_fs.glsl"
);
_fboProgramObject = ghoul::opengl::ProgramObject::Build("fboPassProgram",
_fboProgramObject = ghoul::opengl::ProgramObject::Build(
"fboPassProgram",
"${MODULE_NEWHORIZONS}/shaders/renderablePlanetProjection_vs.glsl",
"${MODULE_NEWHORIZONS}/shaders/renderablePlanetProjection_fs.glsl"
);
@@ -311,17 +288,17 @@ void RenderablePlanetProjection::imageProjectGPU(
_fboProgramObject->setUniform("_scaling" , _camScaling);
_fboProgramObject->setUniform("boresight" , _boresight);
if (_geometry->hasProperty("radius")){
ghoul::any r = _geometry->property("radius")->get();
if (_geometry->hasProperty("Radius")){
ghoul::any r = _geometry->property("Radius")->get();
if (glm::vec3* radius = ghoul::any_cast<glm::vec3>(&r)){
_fboProgramObject->setUniform("_radius", radius);
}
}else{
} else {
LERROR("Geometry object needs to provide radius");
}
if (_geometry->hasProperty("segments")){
ghoul::any s = _geometry->property("segments")->get();
if (int* segments = ghoul::any_cast<int>(&s)){
if (_geometry->hasProperty("Segments")) {
ghoul::any s = _geometry->property("Segments")->get();
if (int* segments = ghoul::any_cast<int>(&s)) {
_fboProgramObject->setUniform("_segments", segments[0]);
}
}else{
@@ -353,13 +330,8 @@ void RenderablePlanetProjection::attitudeParameters(double time) {
static_cast<float>(M_PI_2),
glm::vec3(0, -1, 0)
);
glm::mat4 rotProp = glm::rotate(
_transform,
static_cast<float>(glm::radians(static_cast<float>(_rotation))),
glm::vec3(0, 1, 0)
);
_transform = glm::mat4(_stateMatrix) * rot * roty * rotProp;
_transform = glm::mat4(_stateMatrix) * rot * roty;
glm::dvec3 bs;
try {
@@ -465,8 +437,6 @@ void RenderablePlanetProjection::render(const RenderData& data, RendererTasks&)
//setPscUniforms(*_programObject.get(), data.camera, data.position);
_programObject->setUniform("shiftMeridian", _shiftMeridianBy180);
ghoul::opengl::TextureUnit unit[3];
unit[0].activate();
_baseTexture->bind();

View File

@@ -67,16 +67,12 @@ private:
properties::StringProperty _colorTexturePath;
properties::StringProperty _heightMapTexturePath;
properties::IntProperty _rotation;
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
std::unique_ptr<ghoul::opengl::ProgramObject> _fboProgramObject;
std::unique_ptr<ghoul::opengl::Texture> _baseTexture;
std::unique_ptr<ghoul::opengl::Texture> _heightMapTexture;
properties::BoolProperty _shiftMeridianBy180;
properties::FloatProperty _heightExaggeration;
std::unique_ptr<planetgeometry::PlanetGeometry> _geometry;

View File

@@ -34,7 +34,7 @@
#include <ghoul/opengl/programobject.h>
namespace {
const char* KeyMainFrame = "MainFrame";
const char* MainFrame = "GALACTIC";
static const openspace::properties::Property::PropertyInfo NumberPointsInfo = {
"AmountOfPoints",
@@ -175,8 +175,7 @@ documentation::Documentation RenderableShadowCylinder::Documentation() {
Optional::No,
AberrationInfo.description
},
},
Exhaustive::Yes
}
};
}
@@ -197,7 +196,6 @@ RenderableShadowCylinder::RenderableShadowCylinder(const ghoul::Dictionary& dict
, _observer(ObserverInfo)
, _body(BodyInfo)
, _bodyFrame(BodyFrameInfo)
, _mainFrame({"mainFrame", "Main Frame", ""}) // @TODO Remove this
, _aberration(AberrationInfo)
, _shader(nullptr)
, _vao(0)
@@ -246,8 +244,6 @@ RenderableShadowCylinder::RenderableShadowCylinder(const ghoul::Dictionary& dict
_observer = dictionary.value<std::string>(ObserverInfo.identifier);
_body = dictionary.value<std::string>(BodyInfo.identifier);
_bodyFrame = dictionary.value<std::string>(BodyFrameInfo.identifier);
_mainFrame = dictionary.value<std::string>(KeyMainFrame);
using T = SpiceManager::AberrationCorrection::Type;
_aberration.addOptions({
@@ -330,7 +326,7 @@ void RenderableShadowCylinder::render(const RenderData& data, RendererTasks&) {
void RenderableShadowCylinder::update(const UpdateData& data) {
_stateMatrix = SpiceManager::ref().positionTransformMatrix(
_bodyFrame,
_mainFrame,
MainFrame,
data.time.j2000Seconds()
);
if (_shader->isDirty()) {
@@ -383,7 +379,7 @@ void RenderableShadowCylinder::createCylinder(double time) {
glm::dvec3 vecLightSource = SpiceManager::ref().targetPosition(
_body,
_lightSource,
_mainFrame,
MainFrame,
{
SpiceManager::AberrationCorrection::Type(_aberration.value()),
SpiceManager::AberrationCorrection::Direction::Reception

View File

@@ -75,7 +75,6 @@ private:
properties::StringProperty _observer;
properties::StringProperty _body;
properties::StringProperty _bodyFrame;
properties::StringProperty _mainFrame;
properties::OptionProperty _aberration;
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;

View File

@@ -40,16 +40,10 @@ uniform mat4 modelViewProjectionTransform;
uniform bool _hasHeightMap;
uniform float _heightExaggeration;
uniform sampler2D heightTexture;
uniform bool shiftMeridian;
void main() {
vs_st = in_st;
vec2 st = in_st;
if (shiftMeridian) {
st.s += 0.5;
}
vec4 tmp = in_position;
// this is wrong for the normal.
@@ -58,7 +52,7 @@ void main() {
if (_hasHeightMap) {
const float height = texture(heightTexture, st).s;
const float height = texture(heightTexture, in_st).s;
const vec3 displacementDirection = (normalize(tmp.xyz));
const float displacementFactor = height * _heightExaggeration / 750.0;
tmp.xyz += displacementDirection * displacementFactor;

View File

@@ -53,10 +53,6 @@
namespace {
const char* KeyGeometry = "Geometry";
const char* KeyRadius = "Radius";
const char* KeyColorTexture = "Textures.Color";
const char* KeyNightTexture = "Textures.Night";
const char* KeyHeightTexture = "Textures.Height";
const char* KeyShading = "PerformShading";
static const char* _loggerCat = "RenderablePlanet";
@@ -67,14 +63,14 @@ namespace {
const char* keyBody = "Body";
static const openspace::properties::Property::PropertyInfo ColorTextureInfo = {
"PlanetTexture",
"ColorTexture",
"Color Base Texture",
"The path to the base color texture that is used on the planet prior to any "
"image projection."
};
static const openspace::properties::Property::PropertyInfo HeightTextureInfo = {
"HeightMap",
"HeightTexture",
"Heightmap Texture",
"The path to the height map texture that is used for the planet. If no height "
"map is specified the planet does not use a height field."
@@ -101,7 +97,8 @@ namespace {
"Perform Shading",
"If this value is enabled, the model will be shaded based on the relative "
"location to the Sun. If this value is disabled, shading is disabled and the "
"entire model is rendered brightly."
"entire model is rendered brightly. If this value is 'false', any existing night "
"texture will not be used."
};
} // namespace
@@ -127,31 +124,28 @@ documentation::Documentation RenderablePlanet::Documentation() {
"will try to query the SPICE library for radius values."
},
{
KeyColorTexture, // @TODO Use ColorTextureInfo.identifier instead
ColorTextureInfo.identifier,
new StringVerifier,
Optional::Yes,
"Specifies the color texture that is used for this RenderablePlanet."
ColorTextureInfo.description
},
{
KeyHeightTexture, // @TODO Use HeightTextureInfo.identifier instead
HeightTextureInfo.identifier,
new StringVerifier,
Optional::Yes,
"Specifies the height texture that is used for this RenderablePlanet."
HeightTextureInfo.description
},
{
KeyNightTexture, // @TODO Use NightTextureInfo.identifier instead
NightTextureInfo.identifier,
new StringVerifier,
Optional::Yes,
"Specifies the texture that is used for the night side of this "
"RenderablePlanet."
NightTextureInfo.description
},
{
KeyShading,
PerformShadingInfo.identifier,
new BoolVerifier,
Optional::Yes,
"Specifies whether the planet should be rendered shaded by the Sun. If "
"this value is 'false', any existing night texture will not be used. "
"This value defaults to 'true'."
PerformShadingInfo.description
},
{
HeightExaggerationInfo.identifier,
@@ -221,27 +215,33 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
_geometry = planetgeometry::PlanetGeometry::createFromDictionary(geomDict);
if (dictionary.hasKey(KeyColorTexture)) {
_colorTexturePath = absPath(dictionary.value<std::string>(KeyColorTexture));
if (dictionary.hasKey(ColorTextureInfo.identifier)) {
_colorTexturePath = absPath(dictionary.value<std::string>(
ColorTextureInfo.identifier
));
}
if (dictionary.hasKey(KeyNightTexture)) {
if (dictionary.hasKey(NightTextureInfo.identifier)) {
_hasNightTexture = true;
_nightTexturePath = absPath(dictionary.value<std::string>(KeyNightTexture));
_nightTexturePath = absPath(dictionary.value<std::string>(
NightTextureInfo.identifier
));
}
if (dictionary.hasKey(KeyHeightTexture)) {
if (dictionary.hasKey(HeightTextureInfo.identifier)) {
_hasHeightTexture = true;
_heightMapTexturePath = absPath(dictionary.value<std::string>(KeyHeightTexture));
_heightMapTexturePath = absPath(dictionary.value<std::string>(
HeightTextureInfo.identifier
));
}
if (dictionary.hasKey(KeyShading)) {
_performShading = dictionary.value<bool>(KeyShading);
if (dictionary.hasKey(PerformShadingInfo.identifier)) {
_performShading = dictionary.value<bool>(PerformShadingInfo.identifier);
}
addPropertySubOwner(_geometry.get());
auto loadTextureCallback = [this]() {loadTexture(); };
auto loadTextureCallback = [this]() { loadTexture(); };
addProperty(_colorTexturePath);
_colorTexturePath.onChange(loadTextureCallback);