Overte C++ Documentation
ImageEntityItem.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_ImageEntityItem_h
10 #define hifi_ImageEntityItem_h
11 
12 #include "EntityItem.h"
13 
14 #include "PulsePropertyGroup.h"
15 
16 class ImageEntityItem : public EntityItem {
17  using Pointer = std::shared_ptr<ImageEntityItem>;
18 public:
19  static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
20 
21  ImageEntityItem(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  void setImageURL(const QString& imageUrl);
47  QString getImageURL() const;
48 
49  void setEmissive(bool emissive);
50  bool getEmissive() const;
51 
52  void setKeepAspectRatio(bool keepAspectRatio);
53  bool getKeepAspectRatio() const;
54 
55  void setSubImage(const QRect& subImage);
56  QRect getSubImage() const;
57 
58  void setColor(const glm::u8vec3& color);
59  glm::u8vec3 getColor() const;
60 
61  void setAlpha(float alpha);
62  float getAlpha() const;
63 
64  PulsePropertyGroup getPulseProperties() const;
65 
66  void setNaturalDimension(const glm::vec3& naturalDimensions) const;
67 
68 protected:
69  glm::u8vec3 _color;
70  float _alpha;
71  PulsePropertyGroup _pulseProperties;
72 
73  QString _imageURL;
74  bool _emissive { false };
75  bool _keepAspectRatio { true };
76  QRect _subImage;
77 
78  mutable glm::vec3 _naturalDimensions;
79 };
80 
81 #endif // hifi_ImageEntityItem_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