Overte C++ Documentation
RenderableShapeEntityItem.h
1 //
2 // Created by Bradley Austin Davis on 2016/05/09
3 // Copyright 2013 High Fidelity, Inc.
4 //
5 // Distributed under the Apache License, Version 2.0.
6 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
7 //
8 
9 #ifndef hifi_RenderableShapeEntityItem_h
10 #define hifi_RenderableShapeEntityItem_h
11 
12 #include "RenderableEntityItem.h"
13 
14 #include <GeometryCache.h>
15 #include <procedural/Procedural.h>
16 #include <ShapeEntityItem.h>
17 
18 namespace render { namespace entities {
19 
20 class ShapeEntityRenderer : public TypedEntityRenderer<ShapeEntityItem> {
21  using Parent = TypedEntityRenderer<ShapeEntityItem>;
22  using Pointer = std::shared_ptr<ShapeEntityRenderer>;
23 public:
24  ShapeEntityRenderer(const EntityItemPointer& entity);
25 
26  virtual scriptable::ScriptableModelBase getScriptableModel() override;
27 
28 protected:
29  ShapeKey getShapeKey() override;
30  Item::Bound getBound(RenderArgs* args) override;
31 
32 private:
33  virtual void onRemoveFromSceneTyped(const TypedEntityPointer& entity) override;
34  virtual bool needsRenderUpdate() const override;
35  virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
36  virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override;
37  virtual void doRender(RenderArgs* args) override;
38  virtual bool isTransparent() const override;
39 
40  QString _proceduralData;
41  EntityShape _shape { EntityShape::Sphere };
42  float _innerRadius { 0.0f };
43 
44  PulsePropertyGroup _pulseProperties;
45  std::shared_ptr<graphics::ProceduralMaterial> _material { std::make_shared<graphics::ProceduralMaterial>() };
46  glm::vec3 _color { NAN };
47  float _alpha { NAN };
48  bool _unlit { false };
49 
50  gpu::BufferPointer _colorBuffer { std::make_shared<gpu::Buffer>(gpu::Buffer::VertexBuffer) };
51  int _torusID { GeometryCache::UNKNOWN_ID };
52 
53  FadeBuffers _fadeBuffers;
54 };
55 
56 } }
57 #endif // hifi_RenderableShapeEntityItem_h