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 <procedural/Procedural.h>
15 #include <ShapeEntityItem.h>
16 
17 namespace render { namespace entities {
18 
19 class ShapeEntityRenderer : public TypedEntityRenderer<ShapeEntityItem> {
20  using Parent = TypedEntityRenderer<ShapeEntityItem>;
21  using Pointer = std::shared_ptr<ShapeEntityRenderer>;
22 public:
23  ShapeEntityRenderer(const EntityItemPointer& entity);
24 
25  virtual scriptable::ScriptableModelBase getScriptableModel() override;
26 
27 protected:
28  ShapeKey getShapeKey() override;
29  Item::Bound getBound(RenderArgs* args) override;
30 
31 private:
32  virtual bool needsRenderUpdate() const override;
33  virtual void doRenderUpdateSynchronousTyped(const ScenePointer& scene, Transaction& transaction, const TypedEntityPointer& entity) override;
34  virtual void doRenderUpdateAsynchronousTyped(const TypedEntityPointer& entity) override;
35  virtual void doRender(RenderArgs* args) override;
36  virtual bool isTransparent() const override;
37 
38  QString _proceduralData;
39  entity::Shape _shape { entity::Sphere };
40 
41  PulsePropertyGroup _pulseProperties;
42  std::shared_ptr<graphics::ProceduralMaterial> _material { std::make_shared<graphics::ProceduralMaterial>() };
43  glm::vec3 _color { NAN };
44  float _alpha { NAN };
45 
46  gpu::BufferPointer _colorBuffer { std::make_shared<gpu::Buffer>() };
47 };
48 
49 } }
50 #endif // hifi_RenderableShapeEntityItem_h