Overte C++ Documentation
RenderablePolyLineEntityItem.h
1 //
2 // RenderablePolyLineEntityItem.h
3 // libraries/entities-renderer/src/
4 //
5 // Created by Eric Levin on 6/22/15.
6 // Copyright 2015 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_RenderablePolyLineEntityItem_h
13 #define hifi_RenderablePolyLineEntityItem_h
14 
15 #include "RenderableEntityItem.h"
16 #include <PolyLineEntityItem.h>
17 #include <TextureCache.h>
18 
19 namespace render { namespace entities {
20 
21 class PolyLineEntityRenderer : public TypedEntityRenderer<PolyLineEntityItem> {
22  using Parent = TypedEntityRenderer<PolyLineEntityItem>;
23  friend class EntityRenderer;
24 
25 public:
26  PolyLineEntityRenderer(const EntityItemPointer& entity);
27 
28  void updateModelTransformAndBound(const EntityItemPointer& entity) override;
29 
30  virtual bool isTransparent() const override;
31 
32 protected:
33  virtual bool needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const override;
34  virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
35  virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override;
36 
37  virtual ItemKey getKey() override;
38  virtual ShapeKey getShapeKey() override;
39  virtual void doRender(RenderArgs* args) override;
40 
41  static void buildPipelines();
42  void updateGeometry();
43  void updateData();
44 
45  QVector<glm::vec3> _points;
46  QVector<glm::vec3> _normals;
47  QVector<glm::vec3> _colors;
48  glm::vec3 _color;
49  QVector<float> _widths;
50 
51  NetworkTexturePointer _texture;
52  float _textureAspectRatio { 1.0f };
53  bool _textureLoaded { false };
54 
55  bool _isUVModeStretch { false };
56  bool _faceCamera { false };
57  bool _glow { false };
58 
59  size_t _numVertices { 0 };
60  gpu::BufferPointer _polylineDataBuffer;
61  gpu::BufferPointer _polylineGeometryBuffer;
62  static std::map<std::pair<render::Args::RenderMethod, bool>, gpu::PipelinePointer> _pipelines;
63 };
64 
65 } } // namespace
66 
67 #endif // hifi_RenderablePolyLineEntityItem_h