Overte C++ Documentation
SkyboxPropertyGroup.h
1 //
2 // SkyboxPropertyGroup.h
3 // libraries/entities/src
4 //
5 // Created by Brad Hefta-Gaub on 12/4/13.
6 // Copyright 2013 High Fidelity, Inc.
7 // Copyright 2023 Overte e.V.
8 //
9 // Distributed under the Apache License, Version 2.0.
10 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
11 // SPDX-License-Identifier: Apache-2.0
12 //
13 
14 #ifndef hifi_SkyboxPropertyGroup_h
15 #define hifi_SkyboxPropertyGroup_h
16 
17 #include <stdint.h>
18 
19 #include <glm/glm.hpp>
20 
21 #include <ColorUtils.h>
22 
23 #include "PropertyGroup.h"
24 #include "EntityItemPropertiesMacros.h"
25 
27 class EncodeBitstreamParams;
28 class OctreePacketData;
29 class EntityTreeElementExtraEncodeData;
30 class ReadBitstreamToTreeParams;
31 class ScriptEngine;
32 class ScriptValue;
33 
34 /*@jsdoc
35  * A skybox is defined by the following properties:
36  * @typedef {object} Entities.Skybox
37  * @property {Color} color=0,0,0 - Sets the color of the sky if <code>url</code> is <code>""</code>, otherwise modifies the
38  * color of the cube map image.
39  * @property {string} url="" - A cube map image that is used to render the sky.
40  */
41 class SkyboxPropertyGroup : public PropertyGroup {
42 public:
43  // EntityItemProperty related helpers
44  virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
45  ScriptEngine* engine, bool skipDefaults,
46  EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags,
47  bool isMyOwnAvatarEntity) const override;
48  virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override;
49 
50  void merge(const SkyboxPropertyGroup& other);
51 
52  virtual void debugDump() const override;
53  virtual void listChangedProperties(QList<QString>& out) override;
54 
55  virtual bool appendToEditPacket(OctreePacketData* packetData,
56  EntityPropertyFlags& requestedProperties,
57  EntityPropertyFlags& propertyFlags,
58  EntityPropertyFlags& propertiesDidntFit,
59  int& propertyCount,
60  OctreeElement::AppendState& appendState) const override;
61 
62  virtual bool decodeFromEditPacket(EntityPropertyFlags& propertyFlags,
63  const unsigned char*& dataAt, int& processedBytes) override;
64  virtual void markAllChanged() override;
65  virtual EntityPropertyFlags getChangedProperties() const override;
66 
67  // EntityItem related helpers
68  // methods for getting/setting all properties of an entity
69  virtual void getProperties(EntityItemProperties& propertiesOut) const override;
70 
72  virtual bool setProperties(const EntityItemProperties& properties) override;
73 
74  virtual EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const override;
75 
76  virtual void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
77  EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData,
78  EntityPropertyFlags& requestedProperties,
79  EntityPropertyFlags& propertyFlags,
80  EntityPropertyFlags& propertiesDidntFit,
81  int& propertyCount,
82  OctreeElement::AppendState& appendState) const override;
83 
84  virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
85  ReadBitstreamToTreeParams& args,
86  EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
87  bool& somethingChanged) override;
88 
89  static const glm::u8vec3 DEFAULT_COLOR;
90  DEFINE_PROPERTY_REF(PROP_SKYBOX_COLOR, Color, color, glm::u8vec3, DEFAULT_COLOR);
91  DEFINE_PROPERTY_REF(PROP_SKYBOX_URL, URL, url, QString, "");
92 };
93 
94 #endif // hifi_SkyboxPropertyGroup_h
Definition: EntityItemProperties.h:106
Handles packing of the data portion of PacketType_OCTREE_DATA messages.
Definition: OctreePacketData.h:93
Provides an engine-independent interface for a scripting engine.
Definition: ScriptEngine.h:93
[ScriptInterface] Provides an engine-independent interface for QScriptValue
Definition: ScriptValue.h:40