mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
proper reporting of nan values in get
This commit is contained in:
parent
12a5d8b550
commit
de5fcccc7b
3 changed files with 45 additions and 14 deletions
|
@ -667,16 +667,28 @@ void ParticleEffectEntityItem::setEmitterShouldTrail(bool emitterShouldTrail) {
|
|||
|
||||
particle::Properties ParticleEffectEntityItem::getParticleProperties() const {
|
||||
particle::Properties result;
|
||||
withReadLock([&] {
|
||||
result = _particleProperties;
|
||||
withReadLock([&] {
|
||||
result = _particleProperties;
|
||||
|
||||
// Special case the properties that get treated differently if they're unintialized
|
||||
result.color.range.start = getColorStart();
|
||||
result.color.range.finish = getColorFinish();
|
||||
result.alpha.range.start = getAlphaStart();
|
||||
result.alpha.range.finish = getAlphaFinish();
|
||||
result.radius.range.start = getRadiusStart();
|
||||
result.radius.range.finish = getRadiusFinish();
|
||||
if (glm::any(glm::isnan(result.color.range.start))) {
|
||||
result.color.range.start = getColor();
|
||||
}
|
||||
if (glm::any(glm::isnan(result.color.range.finish))) {
|
||||
result.color.range.finish = getColor();
|
||||
}
|
||||
if (glm::isnan(result.alpha.range.start)) {
|
||||
result.alpha.range.start = getAlpha();
|
||||
}
|
||||
if (glm::isnan(result.alpha.range.finish)) {
|
||||
result.alpha.range.finish = getAlpha();
|
||||
}
|
||||
if (glm::isnan(result.radius.range.start)) {
|
||||
result.radius.range.start = getParticleRadius();
|
||||
}
|
||||
if (glm::isnan(result.radius.range.finish)) {
|
||||
result.radius.range.finish = getParticleRadius();
|
||||
}
|
||||
});
|
||||
|
||||
if (!result.valid()) {
|
||||
|
|
|
@ -224,10 +224,10 @@ public:
|
|||
void setColor(const xColor& value);
|
||||
|
||||
void setColorStart(const vec3& colorStart);
|
||||
vec3 getColorStart() const { return glm::any(glm::isnan(_particleProperties.color.range.start)) ? getColor() : _particleProperties.color.range.start; }
|
||||
vec3 getColorStart() const { return _particleProperties.color.range.start; }
|
||||
|
||||
void setColorFinish(const vec3& colorFinish);
|
||||
vec3 getColorFinish() const { return glm::any(glm::isnan(_particleProperties.color.range.finish)) ? getColor() : _particleProperties.color.range.finish; }
|
||||
vec3 getColorFinish() const { return _particleProperties.color.range.finish; }
|
||||
|
||||
void setColorSpread(const xColor& colorSpread);
|
||||
xColor getColorSpread() const;
|
||||
|
@ -236,10 +236,10 @@ public:
|
|||
float getAlpha() const { return _particleProperties.alpha.gradient.target; }
|
||||
|
||||
void setAlphaStart(float alphaStart);
|
||||
float getAlphaStart() const { return glm::isnan(_particleProperties.alpha.range.start) ? _particleProperties.alpha.gradient.target : _particleProperties.alpha.range.start; }
|
||||
float getAlphaStart() const { return _particleProperties.alpha.range.start; }
|
||||
|
||||
void setAlphaFinish(float alphaFinish);
|
||||
float getAlphaFinish() const { return glm::isnan(_particleProperties.alpha.range.finish) ? _particleProperties.alpha.gradient.target : _particleProperties.alpha.range.finish; }
|
||||
float getAlphaFinish() const { return _particleProperties.alpha.range.finish; }
|
||||
|
||||
void setAlphaSpread(float alphaSpread);
|
||||
float getAlphaSpread() const { return _particleProperties.alpha.gradient.spread; }
|
||||
|
@ -298,10 +298,10 @@ public:
|
|||
float getParticleRadius() const { return _particleProperties.radius.gradient.target; }
|
||||
|
||||
void setRadiusStart(float radiusStart);
|
||||
float getRadiusStart() const { return glm::isnan(_particleProperties.radius.range.start) ? _particleProperties.radius.gradient.target : _particleProperties.radius.range.start; }
|
||||
float getRadiusStart() const { return _particleProperties.radius.range.start; }
|
||||
|
||||
void setRadiusFinish(float radiusFinish);
|
||||
float getRadiusFinish() const { return glm::isnan(_particleProperties.radius.range.finish) ? _particleProperties.radius.gradient.target : _particleProperties.radius.range.finish; }
|
||||
float getRadiusFinish() const { return _particleProperties.radius.range.finish; }
|
||||
|
||||
void setRadiusSpread(float radiusSpread);
|
||||
float getRadiusSpread() const { return _particleProperties.radius.gradient.spread; }
|
||||
|
|
|
@ -243,6 +243,25 @@ HifiEntityUI.prototype = {
|
|||
if (data.messageType === 'particle_settings') {
|
||||
// Update settings
|
||||
var currentProperties = data.currentProperties;
|
||||
// Update uninitialized variables
|
||||
if (!currentProperties.alphaStart) {
|
||||
currentProperties.alphaStart = currentProperties.alpha;
|
||||
}
|
||||
if (!currentProperties.alphaFinish) {
|
||||
currentProperties.alphaFinish = currentProperties.alpha;
|
||||
}
|
||||
if (!currentProperties.radiusStart) {
|
||||
currentProperties.radiusStart = currentProperties.particleRadius;
|
||||
}
|
||||
if (!currentProperties.radiusFinish) {
|
||||
currentProperties.radiusFinish = currentProperties.particleRadius;
|
||||
}
|
||||
if (!currentProperties.colorStart.red) {
|
||||
currentProperties.colorStart = currentProperties.color;
|
||||
}
|
||||
if (!currentProperties.colorFinish.red) {
|
||||
currentProperties.colorFinish = currentProperties.color;
|
||||
}
|
||||
self.fillFields(currentProperties);
|
||||
// Do expected property match with structure;
|
||||
} else if (data.messageType === 'particle_close') {
|
||||
|
|
Loading…
Reference in a new issue