mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-22 03:21:26 +02:00
Adding linear color in Particule system
This commit is contained in:
parent
4e1a812ff3
commit
aef748b894
3 changed files with 12 additions and 7 deletions
|
@ -223,10 +223,10 @@ void RenderableParticleEffectEntityItem::updateRenderItem() {
|
||||||
particleUniforms.radius.middle = getParticleRadius();
|
particleUniforms.radius.middle = getParticleRadius();
|
||||||
particleUniforms.radius.finish = getRadiusFinish();
|
particleUniforms.radius.finish = getRadiusFinish();
|
||||||
particleUniforms.radius.spread = getRadiusSpread();
|
particleUniforms.radius.spread = getRadiusSpread();
|
||||||
particleUniforms.color.start = toGlm(getColorStart(), getAlphaStart());
|
particleUniforms.color.start = glm::vec4(getColorStartRGB(), getAlphaStart());
|
||||||
particleUniforms.color.middle = toGlm(getXColor(), getAlpha());
|
particleUniforms.color.middle = glm::vec4(getColorRGB(), getAlpha());
|
||||||
particleUniforms.color.finish = toGlm(getColorFinish(), getAlphaFinish());
|
particleUniforms.color.finish = glm::vec4(getColorFinishRGB(), getAlphaFinish());
|
||||||
particleUniforms.color.spread = toGlm(getColorSpread(), getAlphaSpread());
|
particleUniforms.color.spread = glm::vec4(getColorSpreadRGB(), getAlphaSpread());
|
||||||
particleUniforms.lifespan = getLifespan();
|
particleUniforms.lifespan = getLifespan();
|
||||||
|
|
||||||
// Build particle primitives
|
// Build particle primitives
|
||||||
|
|
|
@ -9,16 +9,15 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
<@include gpu/Inputs.slh@>
|
<@include gpu/Inputs.slh@>
|
||||||
|
<@include gpu/Color.slh@>
|
||||||
<@include gpu/Transform.slh@>
|
<@include gpu/Transform.slh@>
|
||||||
|
|
||||||
<$declareStandardTransform()$>
|
<$declareStandardTransform()$>
|
||||||
|
|
||||||
out vec4 _color;
|
out vec4 _color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
// pass along the diffuse color
|
// pass along the diffuse color
|
||||||
_color = inColor;
|
_color = colorToLinearRGBA(inColor);
|
||||||
|
|
||||||
TransformCamera cam = getTransformCamera();
|
TransformCamera cam = getTransformCamera();
|
||||||
TransformObject obj = getTransformObject();
|
TransformObject obj = getTransformObject();
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
#include "EntityItem.h"
|
#include "EntityItem.h"
|
||||||
|
|
||||||
|
#include "ColorUtils.h"
|
||||||
|
|
||||||
class ParticleEffectEntityItem : public EntityItem {
|
class ParticleEffectEntityItem : public EntityItem {
|
||||||
public:
|
public:
|
||||||
ALLOW_INSTANTIATION // This class can be instantiated
|
ALLOW_INSTANTIATION // This class can be instantiated
|
||||||
|
@ -47,6 +49,7 @@ public:
|
||||||
|
|
||||||
const rgbColor& getColor() const { return _color; }
|
const rgbColor& getColor() const { return _color; }
|
||||||
xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; }
|
xColor getXColor() const { xColor color = { _color[RED_INDEX], _color[GREEN_INDEX], _color[BLUE_INDEX] }; return color; }
|
||||||
|
glm::vec3 getColorRGB() const { return ColorUtils::toLinearVec3(toGlm(getXColor())); }
|
||||||
|
|
||||||
static const xColor DEFAULT_COLOR;
|
static const xColor DEFAULT_COLOR;
|
||||||
void setColor(const rgbColor& value) { memcpy(_color, value, sizeof(_color)); }
|
void setColor(const rgbColor& value) { memcpy(_color, value, sizeof(_color)); }
|
||||||
|
@ -59,14 +62,17 @@ public:
|
||||||
bool _isColorStartInitialized = false;
|
bool _isColorStartInitialized = false;
|
||||||
void setColorStart(const xColor& colorStart) { _colorStart = colorStart; _isColorStartInitialized = true; }
|
void setColorStart(const xColor& colorStart) { _colorStart = colorStart; _isColorStartInitialized = true; }
|
||||||
xColor getColorStart() const { return _isColorStartInitialized ? _colorStart : getXColor(); }
|
xColor getColorStart() const { return _isColorStartInitialized ? _colorStart : getXColor(); }
|
||||||
|
glm::vec3 getColorStartRGB() const { return _isColorStartInitialized ? ColorUtils::toLinearVec3(toGlm(_colorStart)) : getColorRGB(); }
|
||||||
|
|
||||||
bool _isColorFinishInitialized = false;
|
bool _isColorFinishInitialized = false;
|
||||||
void setColorFinish(const xColor& colorFinish) { _colorFinish = colorFinish; _isColorFinishInitialized = true; }
|
void setColorFinish(const xColor& colorFinish) { _colorFinish = colorFinish; _isColorFinishInitialized = true; }
|
||||||
xColor getColorFinish() const { return _isColorFinishInitialized ? _colorFinish : getXColor(); }
|
xColor getColorFinish() const { return _isColorFinishInitialized ? _colorFinish : getXColor(); }
|
||||||
|
glm::vec3 getColorFinishRGB() const { return _isColorStartInitialized ? ColorUtils::toLinearVec3(toGlm(_colorFinish)) : getColorRGB(); }
|
||||||
|
|
||||||
static const xColor DEFAULT_COLOR_SPREAD;
|
static const xColor DEFAULT_COLOR_SPREAD;
|
||||||
void setColorSpread(const xColor& colorSpread) { _colorSpread = colorSpread; }
|
void setColorSpread(const xColor& colorSpread) { _colorSpread = colorSpread; }
|
||||||
xColor getColorSpread() const { return _colorSpread; }
|
xColor getColorSpread() const { return _colorSpread; }
|
||||||
|
glm::vec3 getColorSpreadRGB() const { return ColorUtils::toLinearVec3(toGlm(_colorSpread)); }
|
||||||
|
|
||||||
static const float MAXIMUM_ALPHA;
|
static const float MAXIMUM_ALPHA;
|
||||||
static const float MINIMUM_ALPHA;
|
static const float MINIMUM_ALPHA;
|
||||||
|
|
Loading…
Reference in a new issue