mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-06 02:34:50 +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 ParticleEffectEntityItem::getParticleProperties() const {
|
||||||
particle::Properties result;
|
particle::Properties result;
|
||||||
withReadLock([&] {
|
withReadLock([&] {
|
||||||
result = _particleProperties;
|
result = _particleProperties;
|
||||||
|
|
||||||
// Special case the properties that get treated differently if they're unintialized
|
// Special case the properties that get treated differently if they're unintialized
|
||||||
result.color.range.start = getColorStart();
|
if (glm::any(glm::isnan(result.color.range.start))) {
|
||||||
result.color.range.finish = getColorFinish();
|
result.color.range.start = getColor();
|
||||||
result.alpha.range.start = getAlphaStart();
|
}
|
||||||
result.alpha.range.finish = getAlphaFinish();
|
if (glm::any(glm::isnan(result.color.range.finish))) {
|
||||||
result.radius.range.start = getRadiusStart();
|
result.color.range.finish = getColor();
|
||||||
result.radius.range.finish = getRadiusFinish();
|
}
|
||||||
|
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()) {
|
if (!result.valid()) {
|
||||||
|
|
|
@ -224,10 +224,10 @@ public:
|
||||||
void setColor(const xColor& value);
|
void setColor(const xColor& value);
|
||||||
|
|
||||||
void setColorStart(const vec3& colorStart);
|
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);
|
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);
|
void setColorSpread(const xColor& colorSpread);
|
||||||
xColor getColorSpread() const;
|
xColor getColorSpread() const;
|
||||||
|
@ -236,10 +236,10 @@ public:
|
||||||
float getAlpha() const { return _particleProperties.alpha.gradient.target; }
|
float getAlpha() const { return _particleProperties.alpha.gradient.target; }
|
||||||
|
|
||||||
void setAlphaStart(float alphaStart);
|
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);
|
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);
|
void setAlphaSpread(float alphaSpread);
|
||||||
float getAlphaSpread() const { return _particleProperties.alpha.gradient.spread; }
|
float getAlphaSpread() const { return _particleProperties.alpha.gradient.spread; }
|
||||||
|
@ -298,10 +298,10 @@ public:
|
||||||
float getParticleRadius() const { return _particleProperties.radius.gradient.target; }
|
float getParticleRadius() const { return _particleProperties.radius.gradient.target; }
|
||||||
|
|
||||||
void setRadiusStart(float radiusStart);
|
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);
|
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);
|
void setRadiusSpread(float radiusSpread);
|
||||||
float getRadiusSpread() const { return _particleProperties.radius.gradient.spread; }
|
float getRadiusSpread() const { return _particleProperties.radius.gradient.spread; }
|
||||||
|
|
|
@ -243,6 +243,25 @@ HifiEntityUI.prototype = {
|
||||||
if (data.messageType === 'particle_settings') {
|
if (data.messageType === 'particle_settings') {
|
||||||
// Update settings
|
// Update settings
|
||||||
var currentProperties = data.currentProperties;
|
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);
|
self.fillFields(currentProperties);
|
||||||
// Do expected property match with structure;
|
// Do expected property match with structure;
|
||||||
} else if (data.messageType === 'particle_close') {
|
} else if (data.messageType === 'particle_close') {
|
||||||
|
|
Loading…
Reference in a new issue