fade polylines (needs testing)

This commit is contained in:
SamGondelman 2016-08-03 17:03:52 -07:00
parent d7052f6250
commit d521315475
3 changed files with 7 additions and 4 deletions

View file

@ -204,5 +204,7 @@ void RenderablePolyLineEntityItem::render(RenderArgs* args) {
batch.setInputFormat(_format);
batch.setInputBuffer(0, _verticesBuffer, 0, _format->getChannels().at(0)._stride);
batch._glColor4f(1.0f, 1.0f, 1.0f, Interpolate::calculateFadeRatio(_fadeStartTime));
batch.draw(gpu::TRIANGLE_STRIP, _numVertices, 0);
};

View file

@ -18,6 +18,7 @@
#include <PolyLineEntityItem.h>
#include "RenderableEntityItem.h"
#include <TextureCache.h>
#include <Interpolate.h>
#include <QReadWriteLock>
@ -30,9 +31,9 @@ public:
virtual void render(RenderArgs* args) override;
virtual void update(const quint64& now) override;
virtual bool needsToCallUpdate() const override { return true; };
virtual bool needsToCallUpdate() const override { return true; }
bool isTransparent() override { return true; }
bool isTransparent() override { return Interpolate::calculateFadeRatio(_fadeStartTime) < 1.0f; }
SIMPLE_RENDERABLE();
@ -49,7 +50,7 @@ protected:
gpu::BufferView _uniformBuffer;
unsigned int _numVertices;
QVector<glm::vec3> _vertices;
quint64 _fadeStartTime { usecTimestampNow() };
};

View file

@ -39,7 +39,7 @@ void main(void) {
vec3 color = varColor.rgb;
packDeferredFragmentTranslucent(
interpolatedNormal * frontCondition,
texel.a,
texel.a * varColor.a,
polyline.color * texel.rgb,
vec3(0.01, 0.01, 0.01),
10.0);