Overte C++ Documentation
AmbientLightPropertyGroup.h
1 //
2 // AmbientLightPropertyGroup.h
3 // libraries/entities/src
4 //
5 // Created by Nissim Hadar on 2017/12/24.
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 
15 #ifndef hifi_AmbientLightPropertyGroup_h
16 #define hifi_AmbientLightPropertyGroup_h
17 
18 #include <stdint.h>
19 
20 #include <glm/glm.hpp>
21 
22 #include "EntityItemPropertiesMacros.h"
23 #include "PropertyGroup.h"
24 
26 class EncodeBitstreamParams;
27 class OctreePacketData;
28 class EntityTreeElementExtraEncodeData;
29 class ReadBitstreamToTreeParams;
30 class ScriptEngine;
31 class ScriptValue;
32 
33 /*@jsdoc
34  * Ambient light is defined by the following properties:
35  * @typedef {object} Entities.AmbientLight
36  * @property {number} ambientIntensity=0.5 - The intensity of the light.
37  * @property {string} ambientURL="" - A cube map image that defines the color of the light coming from each direction. If
38  * <code>""</code> then the entity's {@link Entities.Skybox|Skybox} <code>url</code> property value is used, unless that also is <code>""</code> in which
39  * case the entity's <code>ambientLightMode</code> property is set to <code>"inherit"</code>.
40  */
41 class AmbientLightPropertyGroup : 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 AmbientLightPropertyGroup& 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 float DEFAULT_AMBIENT_LIGHT_INTENSITY;
90 
91  DEFINE_PROPERTY(PROP_AMBIENT_LIGHT_INTENSITY, AmbientIntensity, ambientIntensity, float, DEFAULT_AMBIENT_LIGHT_INTENSITY);
92  DEFINE_PROPERTY_REF(PROP_AMBIENT_LIGHT_URL, AmbientURL, ambientURL, QString, "");
93 };
94 
95 #endif // hifi_AmbientLightPropertyGroup_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