mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2025-12-31 00:10:44 -06:00
Rename Glare->Core and Halo->Glare in RenderableStars
This commit is contained in:
@@ -32,16 +32,16 @@ local Stars = {
|
||||
Renderable = {
|
||||
Type = "RenderableStars",
|
||||
File = speck .. "stars.speck",
|
||||
Halo = {
|
||||
Texture = textures .. "halo.png",
|
||||
Multiplier = 0.65
|
||||
},
|
||||
Glare = {
|
||||
Core = {
|
||||
Texture = textures .. "glare.png",
|
||||
Multiplier = 15.0,
|
||||
Gamma = 1.66,
|
||||
Scale = 0.18
|
||||
},
|
||||
Glare = {
|
||||
Texture = textures .. "halo.png",
|
||||
Multiplier = 0.65
|
||||
},
|
||||
MagnitudeExponent = 6.325,
|
||||
ColorMap = colormaps .. "colorbv.cmap",
|
||||
OtherDataColorMap = colormaps .. "viridis.cmap",
|
||||
@@ -77,17 +77,17 @@ local SunStar = {
|
||||
Renderable = {
|
||||
Type = "RenderableStars",
|
||||
File = sunspeck .. "sunstar.speck",
|
||||
Halo = {
|
||||
Core = {
|
||||
Texture = textures .. "glare.png",
|
||||
Multiplier = 1.0,
|
||||
Scale = 0.1
|
||||
},
|
||||
Glare = {
|
||||
Texture = textures .. "halo.png",
|
||||
Multiplier = 0.55,
|
||||
Gamma = 1.1,
|
||||
Size = 0.95
|
||||
},
|
||||
Glare = {
|
||||
Texture = textures .. "glare.png",
|
||||
Multiplier = 1.0,
|
||||
Scale = 0.1
|
||||
},
|
||||
MagnitudeExponent = 6.25,
|
||||
ColorMap = colormaps .. "colorbv.cmap",
|
||||
SizeComposition = "Distance Modulus",
|
||||
|
||||
@@ -16,7 +16,7 @@ local OrionClusterStars = {
|
||||
Renderable = {
|
||||
Type = "RenderableStars",
|
||||
File = sync .. "oricluster.speck",
|
||||
Halo = {
|
||||
Glare = {
|
||||
Texture = sync .. "halo.png"
|
||||
},
|
||||
ColorMap = sync .. "colorbv.cmap",
|
||||
|
||||
@@ -25,7 +25,7 @@ local Object = {
|
||||
Renderable = {
|
||||
Type = "RenderableStars",
|
||||
File = speck .. "denver_stars.speck",
|
||||
Halo = {
|
||||
Glare = {
|
||||
Texture = textures .. "halo.png"
|
||||
},
|
||||
ColorMap = colorLUT .. "denver_colorbv.cmap",
|
||||
|
||||
@@ -54,9 +54,8 @@ namespace {
|
||||
"modelMatrix", "cameraViewProjectionMatrix", "cameraUp", "eyePosition",
|
||||
"colorOption", "magnitudeExponent", "sizeComposition", "lumCent", "radiusCent",
|
||||
"colorTexture", "opacity", "otherDataTexture", "otherDataRange",
|
||||
"filterOutOfRange", "fixedColor", "haloTexture", "haloMultiplier", "haloGamma",
|
||||
"haloScale", "hasGlare", "glareTexture", "glareMultiplier", "glareGamma",
|
||||
"glareScale"
|
||||
"filterOutOfRange", "fixedColor", "glareTexture", "glareMultiplier", "glareGamma",
|
||||
"glareScale", "hasCore", "coreTexture", "coreMultiplier", "coreGamma", "coreScale"
|
||||
};
|
||||
|
||||
enum SizeComposition {
|
||||
@@ -218,16 +217,16 @@ namespace {
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
const openspace::properties::PropertyOwner::PropertyOwnerInfo HaloOwnerInfo = {
|
||||
"Halo",
|
||||
"Halo",
|
||||
"Settings for the halo portion of the star."
|
||||
const openspace::properties::PropertyOwner::PropertyOwnerInfo CoreOwnerInfo = {
|
||||
"Core",
|
||||
"Core",
|
||||
"Settings for the central core portion of the star."
|
||||
};
|
||||
|
||||
const openspace::properties::PropertyOwner::PropertyOwnerInfo GlareOwnerInfo = {
|
||||
"Glare",
|
||||
"Glare",
|
||||
"Settings for the central glare portion of the star."
|
||||
"Settings for the glare portion of the star."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo TextureInfo = {
|
||||
@@ -364,11 +363,11 @@ namespace {
|
||||
std::optional<float> scale;
|
||||
};
|
||||
|
||||
// [[codegen::verbatim(HaloOwnerInfo.description)]]
|
||||
Texture halo;
|
||||
|
||||
// [[codegen::verbatim(GlareOwnerInfo.description)]]
|
||||
std::optional<Texture> glare;
|
||||
Texture glare;
|
||||
|
||||
// [[codegen::verbatim(CoreOwnerInfo.description)]]
|
||||
std::optional<Texture> core;
|
||||
|
||||
// [[codegen::verbatim(MagnitudeExponentInfo.description)]]
|
||||
std::optional<float> magnitudeExponent;
|
||||
@@ -447,8 +446,8 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
|
||||
)
|
||||
, _fixedColor(FixedColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, _filterOutOfRange(FilterOutOfRangeInfo, false)
|
||||
, _halo{
|
||||
properties::PropertyOwner(HaloOwnerInfo),
|
||||
, _core{
|
||||
properties::PropertyOwner(CoreOwnerInfo),
|
||||
properties::StringProperty(TextureInfo),
|
||||
properties::FloatProperty(MultiplierInfo, 1.f, 0.f, 20.f),
|
||||
properties::FloatProperty(GammaInfo, 1.f, 0.f, 5.f),
|
||||
@@ -589,36 +588,34 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
|
||||
|
||||
auto markTextureAsDirty = [this]() {_pointSpreadFunctionTextureIsDirty = true; };
|
||||
|
||||
_halo.texturePath = absPath(p.halo.texture).string();
|
||||
_halo.texturePath.onChange(markTextureAsDirty);
|
||||
_halo.file = std::make_unique<ghoul::filesystem::File>(_halo.texturePath.value());
|
||||
_halo.file->setCallback(markTextureAsDirty);
|
||||
_halo.container.addProperty(_halo.texturePath);
|
||||
_halo.multiplier = p.halo.multiplier.value_or(_halo.multiplier);
|
||||
_halo.container.addProperty(_halo.multiplier);
|
||||
_halo.gamma = p.halo.gamma.value_or(_halo.gamma);
|
||||
_halo.container.addProperty(_halo.gamma);
|
||||
_halo.scale = p.halo.scale.value_or(_halo.scale);
|
||||
_halo.container.addProperty(_halo.scale);
|
||||
addPropertySubOwner(_halo.container);
|
||||
|
||||
if (p.glare.has_value()) {
|
||||
_glare.texturePath = absPath(p.glare->texture).string();
|
||||
_glare.file =
|
||||
std::make_unique<ghoul::filesystem::File>(_glare.texturePath.value());
|
||||
_glare.file->setCallback(markTextureAsDirty);
|
||||
_glare.multiplier = p.glare->multiplier.value_or(_glare.multiplier);
|
||||
_glare.gamma = p.glare->gamma.value_or(_glare.gamma);
|
||||
_glare.scale = p.glare->scale.value_or(_glare.scale);
|
||||
if (p.core.has_value()) {
|
||||
_core.texturePath = absPath(p.core->texture).string();
|
||||
_core.file = std::make_unique<ghoul::filesystem::File>(_core.texturePath.value());
|
||||
_core.file->setCallback(markTextureAsDirty);
|
||||
_core.multiplier = p.core->multiplier.value_or(_core.multiplier);
|
||||
_core.gamma = p.core->gamma.value_or(_core.gamma);
|
||||
_core.scale = p.core->scale.value_or(_core.scale);
|
||||
}
|
||||
_core.texturePath.onChange(markTextureAsDirty);
|
||||
_core.container.addProperty(_core.texturePath);
|
||||
_core.container.addProperty(_core.multiplier);
|
||||
_core.container.addProperty(_core.gamma);
|
||||
_core.container.addProperty(_core.scale);
|
||||
addPropertySubOwner(_core.container);
|
||||
|
||||
_glare.texturePath = absPath(p.glare.texture).string();
|
||||
_glare.texturePath.onChange(markTextureAsDirty);
|
||||
_glare.file = std::make_unique<ghoul::filesystem::File>(_glare.texturePath.value());
|
||||
_glare.file->setCallback(markTextureAsDirty);
|
||||
_glare.container.addProperty(_glare.texturePath);
|
||||
_glare.multiplier = p.glare.multiplier.value_or(_glare.multiplier);
|
||||
_glare.container.addProperty(_glare.multiplier);
|
||||
_glare.gamma = p.glare.gamma.value_or(_glare.gamma);
|
||||
_glare.container.addProperty(_glare.gamma);
|
||||
_glare.scale = p.glare.scale.value_or(_glare.scale);
|
||||
_glare.container.addProperty(_glare.scale);
|
||||
addPropertySubOwner(_glare.container);
|
||||
|
||||
|
||||
_magnitudeExponent = p.magnitudeExponent.value_or(_magnitudeExponent);
|
||||
addProperty(_magnitudeExponent);
|
||||
|
||||
@@ -655,7 +652,7 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
|
||||
bool RenderableStars::isReady() const {
|
||||
return _program && _halo.texture;
|
||||
return _program && _glare.texture;
|
||||
}
|
||||
|
||||
void RenderableStars::initializeGL() {
|
||||
@@ -739,7 +736,7 @@ void RenderableStars::loadPSFTexture() {
|
||||
component.file->setCallback(markPsfTextureAsDirty);
|
||||
};
|
||||
|
||||
loadTexture(_halo);
|
||||
loadTexture(_core);
|
||||
loadTexture(_glare);
|
||||
|
||||
_pointSpreadFunctionTextureIsDirty = false;
|
||||
@@ -798,24 +795,24 @@ void RenderableStars::render(const RenderData& data, RendererTasks&) {
|
||||
_program->setUniform(_uniformCache.opacity, opacity());
|
||||
}
|
||||
|
||||
ghoul::opengl::TextureUnit haloUnit;
|
||||
haloUnit.activate();
|
||||
_halo.texture->bind();
|
||||
_program->setUniform(_uniformCache.haloTexture, haloUnit);
|
||||
_program->setUniform(_uniformCache.haloMultiplier, _halo.multiplier);
|
||||
_program->setUniform(_uniformCache.haloGamma, _halo.gamma);
|
||||
_program->setUniform(_uniformCache.haloScale, _halo.scale);
|
||||
|
||||
ghoul::opengl::TextureUnit glareUnit;
|
||||
if (_glare.texture) {
|
||||
glareUnit.activate();
|
||||
_glare.texture->bind();
|
||||
_program->setUniform(_uniformCache.glareTexture, glareUnit);
|
||||
_program->setUniform(_uniformCache.glareMultiplier, _glare.multiplier);
|
||||
_program->setUniform(_uniformCache.glareGamma, _glare.gamma);
|
||||
_program->setUniform(_uniformCache.glareScale, _glare.scale);
|
||||
glareUnit.activate();
|
||||
_glare.texture->bind();
|
||||
_program->setUniform(_uniformCache.glareTexture, glareUnit);
|
||||
_program->setUniform(_uniformCache.glareMultiplier, _glare.multiplier);
|
||||
_program->setUniform(_uniformCache.glareGamma, _glare.gamma);
|
||||
_program->setUniform(_uniformCache.glareScale, _glare.scale);
|
||||
|
||||
ghoul::opengl::TextureUnit coreUnit;
|
||||
if (_core.texture) {
|
||||
coreUnit.activate();
|
||||
_core.texture->bind();
|
||||
_program->setUniform(_uniformCache.coreTexture, coreUnit);
|
||||
_program->setUniform(_uniformCache.coreMultiplier, _core.multiplier);
|
||||
_program->setUniform(_uniformCache.coreGamma, _core.gamma);
|
||||
_program->setUniform(_uniformCache.coreScale, _core.scale);
|
||||
}
|
||||
_program->setUniform(_uniformCache.hasGlare, _glare.texture != nullptr);
|
||||
_program->setUniform(_uniformCache.hasCore, _core.texture != nullptr);
|
||||
|
||||
ghoul::opengl::TextureUnit colorUnit;
|
||||
if (_colorTexture) {
|
||||
|
||||
@@ -115,7 +115,7 @@ private:
|
||||
std::unique_ptr<ghoul::filesystem::File> file;
|
||||
};
|
||||
|
||||
TextureComponent _halo;
|
||||
TextureComponent _core;
|
||||
TextureComponent _glare;
|
||||
|
||||
struct {
|
||||
@@ -133,9 +133,9 @@ private:
|
||||
UniformCache(
|
||||
modelMatrix, cameraViewProjectionMatrix, cameraUp, eyePosition, colorOption,
|
||||
magnitudeExponent, sizeComposition, lumCent, radiusCent, colorTexture, opacity,
|
||||
otherDataTexture, otherDataRange, filterOutOfRange, fixedColor, haloTexture,
|
||||
haloMultiplier, haloGamma, haloScale, hasGlare, glareTexture, glareMultiplier,
|
||||
glareGamma, glareScale
|
||||
otherDataTexture, otherDataRange, filterOutOfRange, fixedColor, glareTexture,
|
||||
glareMultiplier, glareGamma, glareScale, hasCore, coreTexture, coreMultiplier,
|
||||
coreGamma, coreScale
|
||||
) _uniformCache;
|
||||
|
||||
bool _speckFileIsDirty = true;
|
||||
|
||||
@@ -32,7 +32,7 @@ flat in float ge_speed;
|
||||
flat in float gs_screenSpaceDepth;
|
||||
|
||||
uniform sampler1D colorTexture;
|
||||
uniform sampler2D haloTexture;
|
||||
uniform sampler2D glareTexture;
|
||||
uniform float opacity;
|
||||
uniform vec3 fixedColor;
|
||||
uniform int colorOption;
|
||||
@@ -40,16 +40,16 @@ uniform sampler1D otherDataTexture;
|
||||
uniform vec2 otherDataRange;
|
||||
uniform bool filterOutOfRange;
|
||||
|
||||
uniform float haloMultiplier;
|
||||
uniform float haloGamma;
|
||||
uniform float haloScale;
|
||||
|
||||
uniform bool hasGlare;
|
||||
uniform sampler2D glareTexture;
|
||||
uniform float glareMultiplier;
|
||||
uniform float glareGamma;
|
||||
uniform float glareScale;
|
||||
|
||||
uniform bool hasCore;
|
||||
uniform sampler2D coreTexture;
|
||||
uniform float coreMultiplier;
|
||||
uniform float coreGamma;
|
||||
uniform float coreScale;
|
||||
|
||||
// keep in sync with renderablestars.h:ColorOption enum
|
||||
const int ColorOptionColor = 0;
|
||||
const int ColorOptionVelocity = 1;
|
||||
@@ -106,16 +106,16 @@ Fragment getFragment() {
|
||||
|
||||
vec2 shiftedCoords = (texCoords - 0.5) * 2;
|
||||
|
||||
vec2 scaledCoordsHalo = shiftedCoords / haloScale;
|
||||
vec2 unshiftedCoordsHalo = (scaledCoordsHalo + 1.0) / 2.0;
|
||||
float haloValue = texture(haloTexture, unshiftedCoordsHalo).a;
|
||||
float alpha = pow(haloValue, haloGamma) * haloMultiplier;
|
||||
if (hasGlare) {
|
||||
vec2 scaledCoordsGlare = shiftedCoords / glareScale;
|
||||
vec2 unshiftedCoordsGlare = (scaledCoordsGlare + 1.0) / 2.0;
|
||||
float glareValue = texture(glareTexture, unshiftedCoordsGlare).a;
|
||||
float glare = pow(glareValue, glareGamma) * glareMultiplier;
|
||||
alpha += glare;
|
||||
vec2 scaledCoordsGlare = shiftedCoords / glareScale;
|
||||
vec2 unshiftedCoordsGlare = (scaledCoordsGlare + 1.0) / 2.0;
|
||||
float glareValue = texture(glareTexture, unshiftedCoordsGlare).a;
|
||||
float alpha = pow(glareValue, glareGamma) * glareMultiplier;
|
||||
if (hasCore) {
|
||||
vec2 scaledCoordsCore = shiftedCoords / coreScale;
|
||||
vec2 unshiftedCoordsCore = (scaledCoordsCore + 1.0) / 2.0;
|
||||
float coreValue = texture(coreTexture, unshiftedCoordsCore).a;
|
||||
float core = pow(coreValue, coreGamma) * coreMultiplier;
|
||||
alpha += core;
|
||||
}
|
||||
|
||||
vec4 fullColor = vec4(color.rgb, alpha * opacity);
|
||||
|
||||
Reference in New Issue
Block a user