Overte C++ Documentation
BloomPropertyGroup.h
1 //
2 // BloomPropertyGroup.h
3 // libraries/entities/src
4 //
5 // Created by Sam Gondelman on 8/7/2018
6 // Copyright 2018 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_BloomPropertyGroup_h
15 #define hifi_BloomPropertyGroup_h
16 
17 #include <stdint.h>
18 #include <glm/glm.hpp>
19 
20 #include "PropertyGroup.h"
21 #include "EntityItemPropertiesMacros.h"
22 
24 class EncodeBitstreamParams;
25 class OctreePacketData;
26 class EntityTreeElementExtraEncodeData;
27 class ReadBitstreamToTreeParams;
28 class ScriptEngine;
29 class ScriptValue;
30 
31 static const float INITIAL_BLOOM_INTENSITY { 0.25f };
32 static const float INITIAL_BLOOM_THRESHOLD { 0.7f };
33 static const float INITIAL_BLOOM_SIZE { 0.9f };
34 
35 /*@jsdoc
36  * Bloom is defined by the following properties:
37  * @typedef {object} Entities.Bloom
38  * @property {number} bloomIntensity=0.25 - The intensity of the bloom effect.
39  * @property {number} bloomThreshold=0.7 - The threshold for the bloom effect.
40  * @property {number} bloomSize=0.9 - The size of the bloom effect.
41  */
42 class BloomPropertyGroup : public PropertyGroup {
43 public:
44  // EntityItemProperty related helpers
45  virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, ScriptValue& properties,
46  ScriptEngine* engine, bool skipDefaults,
47  EntityItemProperties& defaultEntityProperties, bool returnNothingOnEmptyPropertyFlags,
48  bool isMyOwnAvatarEntity) const override;
49  virtual void copyFromScriptValue(const ScriptValue& object, const QSet<QString> &namesSet, bool& _defaultSettings) override;
50 
51  void merge(const BloomPropertyGroup& other);
52 
53  virtual void debugDump() const override;
54  virtual void listChangedProperties(QList<QString>& out) override;
55 
56  virtual bool appendToEditPacket(OctreePacketData* packetData,
57  EntityPropertyFlags& requestedProperties,
58  EntityPropertyFlags& propertyFlags,
59  EntityPropertyFlags& propertiesDidntFit,
60  int& propertyCount,
61  OctreeElement::AppendState& appendState) const override;
62 
63  virtual bool decodeFromEditPacket(EntityPropertyFlags& propertyFlags,
64  const unsigned char*& dataAt, int& processedBytes) override;
65  virtual void markAllChanged() override;
66  virtual EntityPropertyFlags getChangedProperties() const override;
67 
68  // EntityItem related helpers
69  // methods for getting/setting all properties of an entity
70  virtual void getProperties(EntityItemProperties& propertiesOut) const override;
71 
73  virtual bool setProperties(const EntityItemProperties& properties) override;
74 
75  virtual EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const override;
76 
77  virtual void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
78  EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData,
79  EntityPropertyFlags& requestedProperties,
80  EntityPropertyFlags& propertyFlags,
81  EntityPropertyFlags& propertiesDidntFit,
82  int& propertyCount,
83  OctreeElement::AppendState& appendState) const override;
84 
85  virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
86  ReadBitstreamToTreeParams& args,
87  EntityPropertyFlags& propertyFlags, bool overwriteLocalData,
88  bool& somethingChanged) override;
89 
90  DEFINE_PROPERTY(PROP_BLOOM_INTENSITY, BloomIntensity, bloomIntensity, float, INITIAL_BLOOM_INTENSITY);
91  DEFINE_PROPERTY(PROP_BLOOM_THRESHOLD, BloomThreshold, bloomThreshold, float, INITIAL_BLOOM_THRESHOLD);
92  DEFINE_PROPERTY(PROP_BLOOM_SIZE, BloomSize, bloomSize, float, INITIAL_BLOOM_SIZE);
93 
94 };
95 
96 #endif // hifi_BloomPropertyGroup_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