Fix transform of polylines with high update rates

This commit is contained in:
Brad Davis 2017-09-06 23:38:02 -07:00
parent 75e7146c5b
commit 501eee8b10
2 changed files with 6 additions and 1 deletions

View file

@ -141,6 +141,10 @@ void PolyLineEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo
auto normalsChanged = entity->normalsChanged();
entity->resetPolyLineChanged();
_polylineTransform = Transform();
_polylineTransform.setTranslation(entity->getPosition());
_polylineTransform.setRotation(entity->getRotation());
if (pointsChanged) {
_lastPoints = entity->getLinePoints();
}
@ -218,7 +222,7 @@ void PolyLineEntityRenderer::doRender(RenderArgs* args) {
Q_ASSERT(args->_batch);
gpu::Batch& batch = *args->_batch;
batch.setModelTransform(Transform{ _modelTransform }.setScale(vec3(1)));
batch.setModelTransform(_polylineTransform);
batch.setUniformBuffer(PAINTSTROKE_UNIFORM_SLOT, _uniformBuffer);
if (_texture && _texture->isLoaded()) {

View file

@ -47,6 +47,7 @@ protected:
void updateGeometry(const std::vector<Vertex>& vertices);
static std::vector<Vertex> updateVertices(const QVector<glm::vec3>& points, const QVector<glm::vec3>& normals, const QVector<float>& strokeWidths);
Transform _polylineTransform;
QVector<glm::vec3> _lastPoints;
QVector<glm::vec3> _lastNormals;
QVector<float> _lastStrokeWidths;