mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-08 04:20:14 -05:00
Add a glare to the host star, similar to the sun
This commit is contained in:
@@ -221,9 +221,15 @@ int addExoplanetSystem(lua_State* L) {
|
|||||||
starToSunVec.z
|
starToSunVec.z
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const std::string starIdentifier = createIdentifier(starNameSpeck);
|
||||||
|
|
||||||
// Star renderable globe, if we have a radius
|
// Star renderable globe, if we have a radius
|
||||||
std::string starGlobeRenderableString = "";
|
std::string starGlobeRenderableString = "";
|
||||||
const float starRadius = p.RSTAR;
|
const float starRadius = p.RSTAR;
|
||||||
|
|
||||||
|
const float validRadius = isnan(starRadius) ? 1.f : starRadius;
|
||||||
|
const float starRadiusInMeter = validRadius * distanceconstants::SolarRadius;
|
||||||
|
|
||||||
if (!isnan(starRadius)) {
|
if (!isnan(starRadius)) {
|
||||||
std::ifstream colorMap(
|
std::ifstream colorMap(
|
||||||
absPath("${SYNC}/http/stars_colormap/2/colorbv.cmap"),
|
absPath("${SYNC}/http/stars_colormap/2/colorbv.cmap"),
|
||||||
@@ -235,11 +241,10 @@ int addExoplanetSystem(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::string color = getStarColor(p.BMV, colorMap);
|
const std::string color = getStarColor(p.BMV, colorMap);
|
||||||
const float radiusInMeter = starRadius * distanceconstants::SolarRadius;
|
|
||||||
|
|
||||||
starGlobeRenderableString = "Renderable = {"
|
starGlobeRenderableString = "Renderable = {"
|
||||||
"Type = 'RenderableGlobe',"
|
"Type = 'RenderableGlobe',"
|
||||||
"Radii = " + std::to_string(radiusInMeter) + ","
|
"Radii = " + std::to_string(starRadiusInMeter) + ","
|
||||||
"SegmentsPerPatch = 64,"
|
"SegmentsPerPatch = 64,"
|
||||||
"PerformShading = false,"
|
"PerformShading = false,"
|
||||||
"Layers = {"
|
"Layers = {"
|
||||||
@@ -262,7 +267,6 @@ int addExoplanetSystem(lua_State* L) {
|
|||||||
"},";
|
"},";
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string starIdentifier = createIdentifier(starNameSpeck);
|
|
||||||
|
|
||||||
const std::string starParent = "{"
|
const std::string starParent = "{"
|
||||||
"Identifier = '" + starIdentifier + "',"
|
"Identifier = '" + starIdentifier + "',"
|
||||||
@@ -284,11 +288,36 @@ int addExoplanetSystem(lua_State* L) {
|
|||||||
"}"
|
"}"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
|
|
||||||
openspace::global::scriptEngine.queueScript(
|
openspace::global::scriptEngine.queueScript(
|
||||||
"openspace.addSceneGraphNode(" + starParent + ");",
|
"openspace.addSceneGraphNode(" + starParent + ");",
|
||||||
openspace::scripting::ScriptEngine::RemoteScripting::Yes
|
openspace::scripting::ScriptEngine::RemoteScripting::Yes
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const std::string starGlare = "{"
|
||||||
|
"Identifier = '" + starIdentifier + "_glare',"
|
||||||
|
"Parent = '" + starIdentifier + "',"
|
||||||
|
"Renderable = {"
|
||||||
|
"Type = 'RenderablePlaneImageLocal',"
|
||||||
|
"Size = " + std::to_string(10.f * starRadiusInMeter) + ","
|
||||||
|
"Origin = 'Center',"
|
||||||
|
"Billboard = true,"
|
||||||
|
"Texture = openspace.absPath('${SYNC}/http/sun_textures/4/halo.png'),"
|
||||||
|
"BlendMode = 'Additive',"
|
||||||
|
"Opacity = 0.65,"
|
||||||
|
"RenderableType = 'PreDeferredTransparency'"
|
||||||
|
"},"
|
||||||
|
"GUI = {"
|
||||||
|
"Name = '" + starNameSpeck + " (Star Glare)',"
|
||||||
|
"Path = '" + ExoplanetsGuiPath + starNameSpeck + "',"
|
||||||
|
"}"
|
||||||
|
"}";
|
||||||
|
|
||||||
|
openspace::global::scriptEngine.queueScript(
|
||||||
|
"openspace.addSceneGraphNode(" + starGlare + ");",
|
||||||
|
openspace::scripting::ScriptEngine::RemoteScripting::Yes
|
||||||
|
);
|
||||||
|
|
||||||
for (size_t i = 0; i < planetSystem.size(); i++) {
|
for (size_t i = 0; i < planetSystem.size(); i++) {
|
||||||
Exoplanet planet = planetSystem[i];
|
Exoplanet planet = planetSystem[i];
|
||||||
const std::string planetName = planetNames[i];
|
const std::string planetName = planetNames[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user