mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-06 19:39:56 -05:00
Merge branch 'master' into feature/model-animation
* Resolve conflicts
This commit is contained in:
+1
-1
Submodule apps/OpenSpace/ext/sgct updated: fed1f55a0b...eefd275cce
@@ -1,6 +1,6 @@
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
|
||||
|
||||
local colorLUT = asset.require('./stars_colormap').BvColorLUT
|
||||
|
||||
local textures = asset.syncedResource({
|
||||
Name = "Stars Textures",
|
||||
@@ -23,13 +23,6 @@ local sunspeck = asset.syncedResource({
|
||||
Version = 1
|
||||
})
|
||||
|
||||
local colorLUT = asset.syncedResource({
|
||||
Name = "Stars Color Table",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "stars_colormap",
|
||||
Version = 2
|
||||
})
|
||||
|
||||
local stars = {
|
||||
Identifier = "Stars",
|
||||
Renderable = {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
local assetHelper = asset.require('util/asset_helper')
|
||||
|
||||
local BvColorLUT = asset.syncedResource({
|
||||
Name = "Stars Color Table",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "stars_colormap",
|
||||
Version = 2
|
||||
})
|
||||
|
||||
asset.export("BvColorLUT", BvColorLUT)
|
||||
|
||||
asset.meta = {
|
||||
Name = "Stars B-V Colormap",
|
||||
Version = "2.0",
|
||||
Description = [[A lookup table that maps a B-V color index to an RGB color.
|
||||
The B-V values are in the range (-0.4, 2.0) and each line maps a value
|
||||
in that range to a color]],
|
||||
Author = "OpenSpace Team",
|
||||
URL = "https://www.amnh.org/research/hayden-planetarium/digital-universe",
|
||||
License = "AMNH Digital Universe"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
local bvColorLUT = asset.require('scene/digitaluniverse/stars_colormap').BvColorLUT
|
||||
|
||||
local DataPath = asset.syncedResource({
|
||||
Name = "Exoplanet Data Files",
|
||||
Type = "HttpSynchronization",
|
||||
@@ -7,9 +9,14 @@ local DataPath = asset.syncedResource({
|
||||
|
||||
asset.onInitialize(function ()
|
||||
local p = "Modules.Exoplanets.DataFolder";
|
||||
if(openspace.getPropertyValue(p) == "") then
|
||||
if (openspace.getPropertyValue(p) == "") then
|
||||
openspace.setPropertyValueSingle(p, DataPath)
|
||||
end
|
||||
|
||||
p = "Modules.Exoplanets.BvColormap";
|
||||
if (openspace.getPropertyValue(p) == "") then
|
||||
openspace.setPropertyValueSingle(p, bvColorLUT .. "/colorbv.cmap")
|
||||
end
|
||||
end)
|
||||
|
||||
asset.export("DataPath", DataPath)
|
||||
@@ -22,5 +29,5 @@ asset.meta = {
|
||||
Archive]],
|
||||
Author = "OpenSpace Team",
|
||||
URL = "https://exoplanetarchive.ipac.caltech.edu/docs/data.html",
|
||||
License = "MIT license",
|
||||
License = "MIT license"
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ local models = asset.syncedResource({
|
||||
Name = "ISS Models",
|
||||
Type = "HttpSynchronization",
|
||||
Identifier = "iss_model",
|
||||
Version = 2
|
||||
Version = 3
|
||||
})
|
||||
|
||||
local initializeAndAddNodes = function()
|
||||
@@ -59,37 +59,7 @@ local initializeAndAddNodes = function()
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableModel",
|
||||
GeometryFile = {
|
||||
models .. "/0.obj",
|
||||
models .. "/1.obj",
|
||||
models .. "/2.obj",
|
||||
models .. "/3.obj",
|
||||
models .. "/4.obj",
|
||||
models .. "/5.obj",
|
||||
models .. "/6.obj",
|
||||
models .. "/7.obj",
|
||||
models .. "/8.obj",
|
||||
models .. "/10.obj",
|
||||
models .. "/11.obj",
|
||||
models .. "/13.obj",
|
||||
models .. "/14.obj",
|
||||
models .. "/15.obj",
|
||||
models .. "/16.obj",
|
||||
models .. "/17.obj",
|
||||
models .. "/19.obj",
|
||||
models .. "/21.obj",
|
||||
models .. "/22.obj",
|
||||
models .. "/23.obj",
|
||||
models .. "/24.obj",
|
||||
models .. "/25.obj",
|
||||
models .. "/foilsilver.obj",
|
||||
models .. "/olive.obj",
|
||||
models .. "/basemetal.obj",
|
||||
models .. "/white_20.obj",
|
||||
models .. "/plasticblack.obj",
|
||||
models .. "/ecostresswhite.obj",
|
||||
models .. "/plain.obj"
|
||||
},
|
||||
GeometryFile = models .. "/ISS.fbx",
|
||||
LightSources = {
|
||||
{
|
||||
Type = "SceneGraphLightSource",
|
||||
|
||||
+1
-1
Submodule ext/ghoul updated: 9b2f195271...bb643bb1d5
@@ -24,6 +24,9 @@
|
||||
|
||||
#include <modules/exoplanets/exoplanetshelper.h>
|
||||
|
||||
#include <modules/exoplanets/exoplanetsmodule.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/engine/moduleengine.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/fmt.h>
|
||||
@@ -36,8 +39,6 @@
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "ExoplanetsModule";
|
||||
|
||||
constexpr const char* BvColormapPath = "${SYNC}/http/stars_colormap/2/colorbv.cmap";
|
||||
}
|
||||
|
||||
namespace openspace::exoplanets {
|
||||
@@ -57,19 +58,37 @@ bool hasSufficientData(const ExoplanetDataEntry& p) {
|
||||
}
|
||||
|
||||
glm::vec3 computeStarColor(float bv) {
|
||||
std::ifstream colorMap(absPath(BvColormapPath), std::ios::in);
|
||||
const ExoplanetsModule* module = global::moduleEngine->module<ExoplanetsModule>();
|
||||
const std::string bvColormapPath = module->bvColormapPath();
|
||||
|
||||
std::ifstream colorMap(absPath(bvColormapPath), std::ios::in);
|
||||
|
||||
if (!colorMap.good()) {
|
||||
LERROR(fmt::format(
|
||||
"Failed to open colormap data file: '{}'",
|
||||
absPath(BvColormapPath)
|
||||
absPath(bvColormapPath)
|
||||
));
|
||||
return glm::vec3(0.f, 0.f, 0.f);
|
||||
return glm::vec3(0.f);
|
||||
}
|
||||
|
||||
const int t = static_cast<int>(round(((bv + 0.4) / (2.0 + 0.4)) * 255));
|
||||
// Interpret the colormap cmap file
|
||||
std::string line;
|
||||
while (std::getline(colorMap, line)) {
|
||||
if (line.empty() || (line[0] == '#')) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// The first line is the width of the image, i.e number of values
|
||||
std::istringstream ss(line);
|
||||
int nValues;
|
||||
ss >> nValues;
|
||||
|
||||
// Find the line matching the input B-V value (B-V is in [-0.4,2.0])
|
||||
const int t = static_cast<int>(round(((bv + 0.4) / (2.0 + 0.4)) * (nValues - 1)));
|
||||
std::string color;
|
||||
for (int i = 0; i < t + 12; i++) {
|
||||
for (int i = 0; i < t + 1; i++) {
|
||||
getline(colorMap, color);
|
||||
}
|
||||
colorMap.close();
|
||||
|
||||
@@ -44,6 +44,12 @@ namespace {
|
||||
"The path to the folder containing the exoplanets data and lookup table"
|
||||
};
|
||||
|
||||
constexpr const openspace::properties::Property::PropertyInfo BvColorMapInfo = {
|
||||
"BvColormap",
|
||||
"B-V Colormap",
|
||||
"The path to a cmap file that maps a B-V color index to an RGB color"
|
||||
};
|
||||
|
||||
constexpr const openspace::properties::Property::PropertyInfo StarTextureInfo = {
|
||||
"StarTexture",
|
||||
"Star Texture",
|
||||
@@ -123,6 +129,9 @@ namespace {
|
||||
// [[codegen::verbatim(DataFolderInfo.description)]]
|
||||
std::optional<std::filesystem::path> dataFolder [[codegen::directory()]];
|
||||
|
||||
// [[codegen::verbatim(BvColorMapInfo.description)]]
|
||||
std::optional<std::filesystem::path> bvColormap;
|
||||
|
||||
// [[codegen::verbatim(StarTextureInfo.description)]]
|
||||
std::optional<std::filesystem::path> starTexture;
|
||||
|
||||
@@ -160,6 +169,7 @@ using namespace exoplanets;
|
||||
ExoplanetsModule::ExoplanetsModule()
|
||||
: OpenSpaceModule(Name)
|
||||
, _exoplanetsDataFolder(DataFolderInfo)
|
||||
, _bvColorMapPath(BvColorMapInfo)
|
||||
, _starTexturePath(StarTextureInfo)
|
||||
, _starGlareTexturePath(StarGlareTextureInfo)
|
||||
, _noDataTexturePath(NoDataTextureInfo)
|
||||
@@ -173,6 +183,7 @@ ExoplanetsModule::ExoplanetsModule()
|
||||
_exoplanetsDataFolder.setReadOnly(true);
|
||||
|
||||
addProperty(_exoplanetsDataFolder);
|
||||
addProperty(_bvColorMapPath);
|
||||
addProperty(_starTexturePath);
|
||||
addProperty(_starGlareTexturePath);
|
||||
addProperty(_noDataTexturePath);
|
||||
@@ -198,6 +209,10 @@ std::string ExoplanetsModule::lookUpTablePath() const {
|
||||
);
|
||||
};
|
||||
|
||||
std::string ExoplanetsModule::bvColormapPath() const {
|
||||
return _bvColorMapPath;
|
||||
}
|
||||
|
||||
std::string ExoplanetsModule::starTexturePath() const {
|
||||
return _starTexturePath;
|
||||
}
|
||||
@@ -280,6 +295,10 @@ void ExoplanetsModule::internalInitialize(const ghoul::Dictionary& dict) {
|
||||
_exoplanetsDataFolder = p.dataFolder.value().string();
|
||||
}
|
||||
|
||||
if (p.bvColormap.has_value()) {
|
||||
_bvColorMapPath = p.bvColormap.value().string();
|
||||
}
|
||||
|
||||
if (p.starTexture.has_value()) {
|
||||
_starTexturePath = p.starTexture.value().string();
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
|
||||
std::string exoplanetsDataPath() const;
|
||||
std::string lookUpTablePath() const;
|
||||
std::string bvColormapPath() const;
|
||||
std::string starTexturePath() const;
|
||||
std::string starGlareTexturePath() const;
|
||||
std::string noDataTexturePath() const;
|
||||
@@ -60,6 +61,7 @@ protected:
|
||||
void internalInitialize(const ghoul::Dictionary& dict) override;
|
||||
|
||||
properties::StringProperty _exoplanetsDataFolder;
|
||||
properties::StringProperty _bvColorMapPath;
|
||||
properties::StringProperty _starTexturePath;
|
||||
properties::StringProperty _starGlareTexturePath;
|
||||
properties::StringProperty _noDataTexturePath;
|
||||
|
||||
Reference in New Issue
Block a user