// // RenderablePolyLineEntityItem.h // libraries/entities-renderer/src/ // // Created by Eric Levin on 6/22/15. // Copyright 2015 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #ifndef hifi_RenderablePolyLineEntityItem_h #define hifi_RenderablePolyLineEntityItem_h #include "RenderableEntityItem.h" #include #include namespace render { namespace entities { class PolyLineEntityRenderer : public TypedEntityRenderer { using Parent = TypedEntityRenderer; friend class EntityRenderer; public: PolyLineEntityRenderer(const EntityItemPointer& entity); virtual scriptable::ScriptableModelBase getScriptableModel() override; protected: virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override; virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override; virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override; virtual ItemKey getKey() override; virtual ShapeKey getShapeKey() override; virtual void doRender(RenderArgs* args) override; virtual bool isTransparent() const override { return true; } struct Vertex { Vertex() {} Vertex(const vec3& position, const vec3& normal, const vec2& uv, const vec3& color) : position(position), normal(normal), uv(uv), color(color) {} vec3 position; vec3 normal; vec2 uv; vec3 color; }; void updateGeometry(const std::vector& vertices); static std::vector updateVertices(const QVector& points, const QVector& normals, const QVector& strokeWidths, const QVector& strokeColors, const bool isUVModeStretch, const float textureAspectRatio); Transform _polylineTransform; QVector _lastPoints; QVector _lastNormals; QVector _lastStrokeColors; QVector _lastStrokeWidths; gpu::BufferPointer _verticesBuffer; gpu::BufferView _uniformBuffer; uint32_t _numVertices { 0 }; bool _empty{ true }; NetworkTexturePointer _texture; float _textureAspectRatio { 1.0f }; }; } } // namespace #endif // hifi_RenderablePolyLineEntityItem_h