mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-13 23:08:54 -05:00
Merge branch 'master' of github.com:OpenSpace/OpenSpace
This commit is contained in:
+1
-1
Submodule ext/ghoul updated: 985164e12b...70621b7439
@@ -37,7 +37,7 @@ namespace documentation { struct Documentation; }
|
||||
|
||||
struct Configuration {
|
||||
std::string windowConfiguration = "${CONFIG}/single.xml";
|
||||
std::string asset = "default";
|
||||
std::string asset;
|
||||
std::vector<std::string> globalCustomizationScripts;
|
||||
std::map<std::string, std::string> pathTokens = {
|
||||
{ "CACHE" , "CACHE = \"${BASE}/cache\"" }
|
||||
|
||||
@@ -93,6 +93,7 @@ public:
|
||||
bool mouseActivationCallback(const glm::dvec2& mousePosition) const;
|
||||
|
||||
void renderOverlays(const ShutdownInformation& shutdownInfo);
|
||||
void renderEndscreen();
|
||||
void postDraw();
|
||||
|
||||
// Performance measurements
|
||||
|
||||
@@ -49,7 +49,17 @@ enum class DistanceUnit {
|
||||
Parsec,
|
||||
Kiloparsec,
|
||||
Megaparsec,
|
||||
Gigaparsec
|
||||
Gigaparsec,
|
||||
|
||||
// Weird units
|
||||
Thou,
|
||||
Inch,
|
||||
Foot,
|
||||
Yard,
|
||||
Chain,
|
||||
Furlong,
|
||||
Mile,
|
||||
League
|
||||
};
|
||||
|
||||
// Assumption: Unit names are sequential in memory
|
||||
@@ -67,6 +77,15 @@ constexpr const char* DistanceUnitParsec = "parsec";
|
||||
constexpr const char* DistanceUnitKiloparsec = "kiloparsec";
|
||||
constexpr const char* DistanceUnitMegaparsec = "megaparsec";
|
||||
constexpr const char* DistanceUnitGigaparsec = "gigaparsec";
|
||||
constexpr const char* DistanceUnitThou = "thou";
|
||||
constexpr const char* DistanceUnitInch = "inch";
|
||||
constexpr const char* DistanceUnitFoot = "foot";
|
||||
constexpr const char* DistanceUnitYard = "yard";
|
||||
constexpr const char* DistanceUnitChain = "chain";
|
||||
constexpr const char* DistanceUnitFurlong = "furlong";
|
||||
constexpr const char* DistanceUnitMile = "mile";
|
||||
constexpr const char* DistanceUnitLeague = "league";
|
||||
|
||||
|
||||
// Assumption: Unit names are sequential in memory
|
||||
constexpr const char* DistanceUnitNanometers = "nanometers";
|
||||
@@ -83,32 +102,46 @@ constexpr const char* DistanceUnitParsecs = "parsecs";
|
||||
constexpr const char* DistanceUnitKiloparsecs = "kiloparsecs";
|
||||
constexpr const char* DistanceUnitMegaparsecs = "megaparsecs";
|
||||
constexpr const char* DistanceUnitGigaparsecs = "gigaparsecs";
|
||||
constexpr const char* DistanceUnitThous = "thou";
|
||||
constexpr const char* DistanceUnitInches = "inches";
|
||||
constexpr const char* DistanceUnitFeet = "feet";
|
||||
constexpr const char* DistanceUnitYards = "yards";
|
||||
constexpr const char* DistanceUnitChains = "chains";
|
||||
constexpr const char* DistanceUnitFurlongs = "furlongs";
|
||||
constexpr const char* DistanceUnitMiles = "miles";
|
||||
constexpr const char* DistanceUnitLeagues = "leagues";
|
||||
|
||||
constexpr const std::array<DistanceUnit, static_cast<int>(DistanceUnit::Gigaparsec) + 1>
|
||||
constexpr const std::array<DistanceUnit, static_cast<int>(DistanceUnit::League) + 1>
|
||||
DistanceUnits = {
|
||||
DistanceUnit::Nanometer, DistanceUnit::Micrometer, DistanceUnit::Millimeter,
|
||||
DistanceUnit::Meter, DistanceUnit::Kilometer, DistanceUnit::AU,
|
||||
DistanceUnit::Lighthour, DistanceUnit::Lightday, DistanceUnit::Lightmonth,
|
||||
DistanceUnit::Lightyear, DistanceUnit::Parsec, DistanceUnit::Kiloparsec,
|
||||
DistanceUnit::Megaparsec, DistanceUnit::Gigaparsec
|
||||
DistanceUnit::Megaparsec, DistanceUnit::Gigaparsec, DistanceUnit::Thou,
|
||||
DistanceUnit::Inch, DistanceUnit::Foot, DistanceUnit::Yard, DistanceUnit::Chain,
|
||||
DistanceUnit::Furlong, DistanceUnit::Mile, DistanceUnit::League
|
||||
};
|
||||
|
||||
constexpr const std::array<const char*, static_cast<int>(DistanceUnit::Gigaparsec) + 1>
|
||||
constexpr const std::array<const char*, static_cast<int>(DistanceUnit::League) + 1>
|
||||
DistanceUnitNamesSingular = {
|
||||
DistanceUnitNanometer, DistanceUnitMicrometer, DistanceUnitMillimeter,
|
||||
DistanceUnitMeter, DistanceUnitKilometer, DistanceUnitAU, DistanceUnitLighthour,
|
||||
DistanceUnitLightday, DistanceUnitLightmonth, DistanceUnitLightyear,
|
||||
DistanceUnitParsec, DistanceUnitKiloparsec, DistanceUnitMegaparsec,
|
||||
DistanceUnitGigaparsec
|
||||
DistanceUnitGigaparsec, DistanceUnitThou, DistanceUnitInch, DistanceUnitFoot,
|
||||
DistanceUnitYard, DistanceUnitChain, DistanceUnitFurlong, DistanceUnitMile,
|
||||
DistanceUnitLeague
|
||||
};
|
||||
|
||||
constexpr const std::array<const char*, static_cast<int>(DistanceUnit::Gigaparsec) + 1>
|
||||
constexpr const std::array<const char*, static_cast<int>(DistanceUnit::League) + 1>
|
||||
DistanceUnitNamesPlural = {
|
||||
DistanceUnitNanometers, DistanceUnitMicrometers, DistanceUnitMillimeters,
|
||||
DistanceUnitMeters, DistanceUnitKilometers, DistanceUnitAUs, DistanceUnitLighthours,
|
||||
DistanceUnitLightdays, DistanceUnitLightmonths, DistanceUnitLightyears,
|
||||
DistanceUnitParsecs, DistanceUnitKiloparsecs, DistanceUnitMegaparsecs,
|
||||
DistanceUnitGigaparsecs
|
||||
DistanceUnitGigaparsecs, DistanceUnitThous, DistanceUnitInches, DistanceUnitFeet,
|
||||
DistanceUnitYards, DistanceUnitChains, DistanceUnitFurlongs, DistanceUnitMile,
|
||||
DistanceUnitLeague
|
||||
};
|
||||
|
||||
constexpr bool isValidDistanceUnitName(const char* name) {
|
||||
@@ -132,28 +165,36 @@ constexpr bool isValidDistanceUnitName(const char* name) {
|
||||
|
||||
constexpr const char* nameForDistanceUnit(DistanceUnit unit, bool pluralForm = false) {
|
||||
switch (unit) {
|
||||
case DistanceUnit::Nanometer:
|
||||
case DistanceUnit::Micrometer:
|
||||
case DistanceUnit::Millimeter:
|
||||
case DistanceUnit::Meter:
|
||||
case DistanceUnit::Kilometer:
|
||||
case DistanceUnit::AU:
|
||||
case DistanceUnit::Lighthour:
|
||||
case DistanceUnit::Lightday:
|
||||
case DistanceUnit::Lightmonth:
|
||||
case DistanceUnit::Lightyear:
|
||||
case DistanceUnit::Parsec:
|
||||
case DistanceUnit::Kiloparsec:
|
||||
case DistanceUnit::Megaparsec:
|
||||
case DistanceUnit::Gigaparsec:
|
||||
if (pluralForm) {
|
||||
return DistanceUnitNamesPlural[static_cast<int>(unit)];
|
||||
}
|
||||
else {
|
||||
return DistanceUnitNamesSingular[static_cast<int>(unit)];
|
||||
}
|
||||
default:
|
||||
throw ghoul::MissingCaseException();
|
||||
case DistanceUnit::Nanometer:
|
||||
case DistanceUnit::Micrometer:
|
||||
case DistanceUnit::Millimeter:
|
||||
case DistanceUnit::Meter:
|
||||
case DistanceUnit::Kilometer:
|
||||
case DistanceUnit::AU:
|
||||
case DistanceUnit::Lighthour:
|
||||
case DistanceUnit::Lightday:
|
||||
case DistanceUnit::Lightmonth:
|
||||
case DistanceUnit::Lightyear:
|
||||
case DistanceUnit::Parsec:
|
||||
case DistanceUnit::Kiloparsec:
|
||||
case DistanceUnit::Megaparsec:
|
||||
case DistanceUnit::Gigaparsec:
|
||||
case DistanceUnit::Thou:
|
||||
case DistanceUnit::Inch:
|
||||
case DistanceUnit::Foot:
|
||||
case DistanceUnit::Yard:
|
||||
case DistanceUnit::Chain:
|
||||
case DistanceUnit::Furlong:
|
||||
case DistanceUnit::Mile:
|
||||
case DistanceUnit::League:
|
||||
if (pluralForm) {
|
||||
return DistanceUnitNamesPlural[static_cast<int>(unit)];
|
||||
}
|
||||
else {
|
||||
return DistanceUnitNamesSingular[static_cast<int>(unit)];
|
||||
}
|
||||
default:
|
||||
throw ghoul::MissingCaseException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,6 +262,28 @@ constexpr double convertDistance(double meters, DistanceUnit requestedUnit) {
|
||||
return meters / (1e6 * distanceconstants::Parsec);
|
||||
case DistanceUnit::Gigaparsec:
|
||||
return meters / (1e9 * distanceconstants::Parsec);
|
||||
// Such wow, such coefficients
|
||||
case DistanceUnit::Thou:
|
||||
return (meters * 1000.0 / 25.4) * 1000.0; // m -> mm -> inch -> thou
|
||||
case DistanceUnit::Inch:
|
||||
return (meters * 1000.0 / 25.4); // m -> mm -> inch
|
||||
case DistanceUnit::Foot:
|
||||
return (meters * 1000.0 / 25.4) / 12.0; // m -> mm -> inch -> feet
|
||||
case DistanceUnit::Yard:
|
||||
// m -> mm -> inch -> feet -> yard
|
||||
return (meters * 1000.0 / 25.4) / 12.0 / 3.0;
|
||||
case DistanceUnit::Chain:
|
||||
// m -> mm -> inch -> feet -> yard -> chain
|
||||
return (meters * 1000.0 / 25.4) / 12.0 / 3.0 / 22.0;
|
||||
case DistanceUnit::Furlong:
|
||||
// m -> mm -> inch -> feet -> yard -> chain -> furlong
|
||||
return (meters * 1000.0 / 25.4) / 12.0 / 3.0 / 22.0 / 10.0;
|
||||
case DistanceUnit::Mile:
|
||||
// m -> mm -> inch -> feet -> yard -> chain -> furlong -> mile
|
||||
return (meters * 1000.0 / 25.4) / 12.0 / 3.0 / 22.0 / 10.0 / 8.0;
|
||||
case DistanceUnit::League:
|
||||
// m -> mm -> inch -> feet -> yard -> chain -> furlong -> mile -> league
|
||||
return (meters * 1000.0 / 25.4) / 12.0 / 3.0 / 22.0 / 10.0 / 8.0 / 3.0;
|
||||
default:
|
||||
throw ghoul::MissingCaseException();
|
||||
}
|
||||
|
||||
@@ -84,13 +84,6 @@ namespace {
|
||||
"The path to the texture that should be used as the point sprite."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo TransparencyInfo = {
|
||||
"Transparency",
|
||||
"Transparency",
|
||||
"This value is a multiplicative factor that is applied to the transparency of "
|
||||
"all points."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo ScaleFactorInfo = {
|
||||
"ScaleFactor",
|
||||
"Scale Factor",
|
||||
@@ -267,12 +260,6 @@ documentation::Documentation RenderableBillboardsCloud::Documentation() {
|
||||
Optional::Yes,
|
||||
SpriteTextureInfo.description
|
||||
},
|
||||
{
|
||||
TransparencyInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
Optional::No,
|
||||
TransparencyInfo.description
|
||||
},
|
||||
{
|
||||
ScaleFactorInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
@@ -393,7 +380,6 @@ documentation::Documentation RenderableBillboardsCloud::Documentation() {
|
||||
|
||||
RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _alphaValue(TransparencyInfo, 1.f, 0.f, 1.f)
|
||||
, _scaleFactor(ScaleFactorInfo, 1.f, 0.f, 600.f)
|
||||
, _pointColor(
|
||||
ColorInfo,
|
||||
@@ -536,12 +522,7 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di
|
||||
addProperty(_pointColor);
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(TransparencyInfo.identifier)) {
|
||||
_alphaValue = static_cast<float>(
|
||||
dictionary.value<double>(TransparencyInfo.identifier)
|
||||
);
|
||||
}
|
||||
addProperty(_alphaValue);
|
||||
addProperty(_opacity);
|
||||
|
||||
if (dictionary.hasKey(ScaleFactorInfo.identifier)) {
|
||||
_scaleFactor = static_cast<float>(
|
||||
@@ -783,7 +764,7 @@ void RenderableBillboardsCloud::renderBillboards(const RenderData& data,
|
||||
_program->setUniform(_uniformCache.minBillboardSize, _billboardMinSize); // in pixels
|
||||
_program->setUniform(_uniformCache.maxBillboardSize, _billboardMaxSize); // in pixels
|
||||
_program->setUniform(_uniformCache.color, _pointColor);
|
||||
_program->setUniform(_uniformCache.alphaValue, _alphaValue);
|
||||
_program->setUniform(_uniformCache.alphaValue, _opacity);
|
||||
_program->setUniform(_uniformCache.scaleFactor, _scaleFactor);
|
||||
_program->setUniform(_uniformCache.up, orthoUp);
|
||||
_program->setUniform(_uniformCache.right, orthoRight);
|
||||
@@ -864,6 +845,7 @@ void RenderableBillboardsCloud::renderLabels(const RenderData& data,
|
||||
|
||||
glm::vec4 textColor = _textColor;
|
||||
textColor.a *= fadeInVariable;
|
||||
textColor.a *= _opacity;
|
||||
for (const std::pair<glm::vec3, std::string>& pair : _labelData) {
|
||||
//glm::vec3 scaledPos(_transformationMatrix * glm::dvec4(pair.first, 1.0));
|
||||
glm::vec3 scaledPos(pair.first);
|
||||
|
||||
@@ -110,7 +110,6 @@ private:
|
||||
|
||||
GLuint _pTexture = 0;
|
||||
|
||||
properties::FloatProperty _alphaValue;
|
||||
properties::FloatProperty _scaleFactor;
|
||||
properties::Vec3Property _pointColor;
|
||||
properties::StringProperty _spriteTexturePath;
|
||||
|
||||
@@ -44,7 +44,7 @@ documentation::Documentation Configuration::Documentation = {
|
||||
new StringAnnotationVerifier(
|
||||
"A valid scene file as described in the Scene documentation"
|
||||
),
|
||||
Optional::No,
|
||||
Optional::Yes,
|
||||
"The scene description that is used to populate the application after "
|
||||
"startup. The scene determines which objects are loaded, the startup "
|
||||
"time and other scene-specific settings. More information is provided in "
|
||||
|
||||
@@ -760,6 +760,11 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
|
||||
void OpenSpaceEngine::deinitialize() {
|
||||
LTRACE("OpenSpaceEngine::deinitialize(begin)");
|
||||
|
||||
// We want to render an image informing the user that we are shutting down
|
||||
_renderEngine->renderEndscreen();
|
||||
|
||||
_engine->_windowWrapper->swapBuffer();
|
||||
|
||||
for (const std::function<void()>& func : _engine->_moduleCallbacks.deinitializeGL) {
|
||||
func();
|
||||
}
|
||||
@@ -1193,10 +1198,12 @@ void OpenSpaceEngine::preSynchronization() {
|
||||
_renderEngine->updateScene();
|
||||
//_navigationHandler->updateCamera(dt);
|
||||
|
||||
Camera* camera = _scene->camera();
|
||||
if (camera) {
|
||||
_navigationHandler->updateCamera(dt);
|
||||
camera->invalidateCache();
|
||||
if (_scene) {
|
||||
Camera* camera = _scene->camera();
|
||||
if (camera) {
|
||||
_navigationHandler->updateCamera(dt);
|
||||
camera->invalidateCache();
|
||||
}
|
||||
}
|
||||
_parallelPeer->preSynchronization();
|
||||
}
|
||||
@@ -1233,6 +1240,7 @@ void OpenSpaceEngine::postSynchronizationPreDraw() {
|
||||
if (_shutdown.inShutdown) {
|
||||
if (_shutdown.timer <= 0.f) {
|
||||
_windowWrapper->terminate();
|
||||
return;
|
||||
}
|
||||
_shutdown.timer -= static_cast<float>(_windowWrapper->averageDeltaTime());
|
||||
}
|
||||
|
||||
@@ -639,6 +639,23 @@ void RenderEngine::renderOverlays(const ShutdownInformation& shutdownInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
void RenderEngine::renderEndscreen() {
|
||||
glClearColor(0.f, 0.f, 0.f, 0.25f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
using FR = ghoul::fontrendering::FontRenderer;
|
||||
using BBox = FR::BoundingBoxInformation;
|
||||
BBox size = FR::defaultRenderer().boundingBox(
|
||||
*_fontDate,
|
||||
"Shutting down"
|
||||
);
|
||||
glm::vec2 penPosition = glm::vec2(
|
||||
fontResolution().x / 2 - size.boundingBox.x / 2,
|
||||
fontResolution().y / 2- size.boundingBox.y / 2
|
||||
);
|
||||
RenderFont(*_fontDate, penPosition, "Shutting down");
|
||||
}
|
||||
|
||||
void RenderEngine::renderShutdownInformation(float timer, float fullTime) {
|
||||
timer = std::max(timer, 0.f);
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
|
||||
namespace openspace::luascriptfunctions::asset {
|
||||
|
||||
int add(lua_State* state) {
|
||||
@@ -35,7 +38,16 @@ int add(lua_State* state) {
|
||||
1,
|
||||
ghoul::lua::PopValue::Yes
|
||||
);
|
||||
assetManager->add(assetName);
|
||||
|
||||
if (OsEng.renderEngine().scene()) {
|
||||
assetManager->add(assetName);
|
||||
}
|
||||
else {
|
||||
// The scene might not exist yet if OpenSpace was started without specifying an
|
||||
// initial asset
|
||||
OsEng.scheduleLoadSingleAsset(assetName);
|
||||
}
|
||||
|
||||
|
||||
ghoul_assert(lua_gettop(state) == 0, "Incorrect number of items left on stack");
|
||||
return 0;
|
||||
|
||||
@@ -237,12 +237,12 @@ int property_setValue(lua_State* L) {
|
||||
interpolationDuration = ghoul::lua::value<double>(L, 4);
|
||||
}
|
||||
else {
|
||||
optimization = ghoul::lua::value<std::string>(L, 4);
|
||||
easingMethodName = ghoul::lua::value<std::string>(L, 4);
|
||||
}
|
||||
}
|
||||
|
||||
if (lua_gettop(L) == 5) {
|
||||
easingMethodName = ghoul::lua::value<std::string>(L, 5);
|
||||
optimization = ghoul::lua::value<std::string>(L, 5);
|
||||
}
|
||||
|
||||
// Later functions expect the value to be at the last position on the stack
|
||||
|
||||
Reference in New Issue
Block a user