Overte C++ Documentation
WebEntityItem.h
1 //
2 // Created by Bradley Austin Davis on 2015/05/12
3 // Copyright 2013 High Fidelity, Inc.
4 // Copyright 2020 Vircadia contributors.
5 // Copyright 2023 Overte e.V.
6 //
7 // Distributed under the Apache License, Version 2.0.
8 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
9 // SPDX-License-Identifier: Apache-2.0
10 //
11 
12 #ifndef hifi_WebEntityItem_h
13 #define hifi_WebEntityItem_h
14 
15 #include "EntityItem.h"
16 
17 #include "PulsePropertyGroup.h"
18 
19 class WebEntityItem : public EntityItem {
20 public:
21  static EntityItemPointer factory(const EntityItemID& entityID, const EntityItemProperties& properties);
22 
23  WebEntityItem(const EntityItemID& entityItemID);
24 
25  ALLOW_INSTANTIATION // This class can be instantiated
26 
28  virtual void setUnscaledDimensions(const glm::vec3& value) override;
29  virtual ShapeType getShapeType() const override { return SHAPE_TYPE_BOX; }
30 
31  // methods for getting/setting all properties of an entity
32  virtual EntityItemProperties getProperties(const EntityPropertyFlags& desiredProperties, bool allowEmptyDesiredProperties) const override;
33  virtual bool setSubClassProperties(const EntityItemProperties& properties) override;
34 
35  virtual EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const override;
36 
37  virtual void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
38  EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData,
39  EntityPropertyFlags& requestedProperties,
40  EntityPropertyFlags& propertyFlags,
41  EntityPropertyFlags& propertiesDidntFit,
42  int& propertyCount,
43  OctreeElement::AppendState& appendState) const override;
44 
45  virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
46  ReadBitstreamToTreeParams& args,
47  EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
48  bool& somethingChanged) override;
49 
50  glm::u8vec3 getColor() const;
51  void setColor(const glm::u8vec3& value);
52 
53  float getAlpha() const;
54  void setAlpha(float alpha);
55 
56  static const QString DEFAULT_SOURCE_URL;
57  void setSourceUrl(const QString& value);
58  QString getSourceUrl() const;
59 
60  void setDPI(uint16_t value);
61  uint16_t getDPI() const;
62 
63  void setScriptURL(const QString& value);
64  QString getScriptURL() const;
65 
66  bool getLocalSafeContext() const;
67 
68  static const uint8_t DEFAULT_MAX_FPS;
69  void setMaxFPS(uint8_t value);
70  uint8_t getMaxFPS() const;
71 
72  void setInputMode(const WebInputMode& value);
73  WebInputMode getInputMode() const;
74 
75  bool getShowKeyboardFocusHighlight() const;
76  void setShowKeyboardFocusHighlight(bool value);
77 
78  bool getUseBackground() const;
79  void setUseBackground(bool value);
80 
81  static const QString DEFAULT_USER_AGENT;
82  QString getUserAgent() const;
83  void setUserAgent(const QString& value);
84 
85  PulsePropertyGroup getPulseProperties() const;
86 
87 protected:
88  glm::u8vec3 _color;
89  float _alpha { 1.0f };
90  PulsePropertyGroup _pulseProperties;
91 
92  QString _sourceUrl;
93  uint16_t _dpi;
94  QString _scriptURL;
95  uint8_t _maxFPS;
96  WebInputMode _inputMode;
97  bool _showKeyboardFocusHighlight { false };
98  bool _useBackground { false };
99  QString _userAgent;
100  bool _localSafeContext { false };
101 };
102 
103 #endif // hifi_WebEntityItem_h
Definition: EntityItem.h:82
virtual ShapeType getShapeType() const
return preferred shape type (actual physical shape may differ)
Definition: EntityItem.h:390
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