Overte C++ Documentation
GridEntityItem.h
1 //
2 // Created by Sam Gondelman on 11/29/18
3 // Copyright 2018 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_GridEntityItem_h
10 #define hifi_GridEntityItem_h
11 
12 #include "EntityItem.h"
13 
14 #include "PulsePropertyGroup.h"
15 
16 class GridEntityItem : public EntityItem {
17  using Pointer = std::shared_ptr<GridEntityItem>;
18 public:
19  static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
20 
21  GridEntityItem(const EntityItemID& entityItemID);
22 
23  ALLOW_INSTANTIATION // This class can be instantiated
24 
25  virtual void setUnscaledDimensions(const glm::vec3& value) override;
26 
27  // methods for getting/setting all properties of an entity
28  EntityItemProperties getProperties(const EntityPropertyFlags& desiredProperties, bool allowEmptyDesiredProperties) const override;
29  bool setSubClassProperties(const EntityItemProperties& properties) override;
30 
31  EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const override;
32 
33  void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
34  EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData,
35  EntityPropertyFlags& requestedProperties,
36  EntityPropertyFlags& propertyFlags,
37  EntityPropertyFlags& propertiesDidntFit,
38  int& propertyCount,
39  OctreeElement::AppendState& appendState) const override;
40 
41  int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
42  ReadBitstreamToTreeParams& args,
43  EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
44  bool& somethingChanged) override;
45 
46  static const uint32_t DEFAULT_MAJOR_GRID_EVERY;
47  static const float DEFAULT_MINOR_GRID_EVERY;
48 
49  void setColor(const glm::u8vec3& color);
50  glm::u8vec3 getColor() const;
51 
52  void setAlpha(float alpha);
53  float getAlpha() const;
54 
55  void setFollowCamera(bool followCamera);
56  bool getFollowCamera() const;
57 
58  void setMajorGridEvery(uint32_t majorGridEvery);
59  uint32_t getMajorGridEvery() const;
60 
61  void setMinorGridEvery(float minorGridEvery);
62  float getMinorGridEvery() const;
63 
64  PulsePropertyGroup getPulseProperties() const;
65 
66 protected:
67  glm::u8vec3 _color;
68  float _alpha;
69  PulsePropertyGroup _pulseProperties;
70 
71  bool _followCamera { true };
72  uint32_t _majorGridEvery { DEFAULT_MAJOR_GRID_EVERY };
73  float _minorGridEvery { DEFAULT_MINOR_GRID_EVERY };
74 
75 };
76 
77 #endif // hifi_GridEntityItem_h
Definition: EntityItem.h:82
Abstract ID for editing model items. Used in EntityItem JS API.
Definition: EntityItemID.h:28
Definition: EntityItemProperties.h:106
Handles packing of the data portion of PacketType_OCTREE_DATA messages.
Definition: OctreePacketData.h:93