// // SkyboxPropertyGroup.h // libraries/entities/src // // Created by Brad Hefta-Gaub on 12/4/13. // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #ifndef hifi_SkyboxPropertyGroup_h #define hifi_SkyboxPropertyGroup_h #include #include #include #include "PropertyGroup.h" #include "EntityItemPropertiesMacros.h" class EntityItemProperties; class EncodeBitstreamParams; class OctreePacketData; class EntityTreeElementExtraEncodeData; class ReadBitstreamToTreeParams; /**jsdoc * A skybox is defined by the following properties. * @typedef {object} Entities.Skybox * @property {Color} color=0,0,0 - Sets the color of the sky if url is "", otherwise modifies the * color of the cube map image. * @property {string} url="" - A cube map image that is used to render the sky. */ class SkyboxPropertyGroup : public PropertyGroup { public: // EntityItemProperty related helpers virtual void copyToScriptValue(const EntityPropertyFlags& desiredProperties, QScriptValue& properties, QScriptEngine* engine, bool skipDefaults, EntityItemProperties& defaultEntityProperties) const override; virtual void copyFromScriptValue(const QScriptValue& object, bool& _defaultSettings) override; void merge(const SkyboxPropertyGroup& other); virtual void debugDump() const override; virtual void listChangedProperties(QList& out) override; virtual bool appendToEditPacket(OctreePacketData* packetData, EntityPropertyFlags& requestedProperties, EntityPropertyFlags& propertyFlags, EntityPropertyFlags& propertiesDidntFit, int& propertyCount, OctreeElement::AppendState& appendState) const override; virtual bool decodeFromEditPacket(EntityPropertyFlags& propertyFlags, const unsigned char*& dataAt, int& processedBytes) override; virtual void markAllChanged() override; virtual EntityPropertyFlags getChangedProperties() const override; // EntityItem related helpers // methods for getting/setting all properties of an entity virtual void getProperties(EntityItemProperties& propertiesOut) const override; /// returns true if something changed virtual bool setProperties(const EntityItemProperties& properties) override; virtual EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const override; virtual void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params, EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData, EntityPropertyFlags& requestedProperties, EntityPropertyFlags& propertyFlags, EntityPropertyFlags& propertiesDidntFit, int& propertyCount, OctreeElement::AppendState& appendState) const override; virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead, ReadBitstreamToTreeParams& args, EntityPropertyFlags& propertyFlags, bool overwriteLocalData, bool& somethingChanged) override; glm::vec3 getColorVec3() const { const quint8 MAX_COLOR = 255; glm::vec3 color = { (float)_color.red / (float)MAX_COLOR, (float)_color.green / (float)MAX_COLOR, (float)_color.blue / (float)MAX_COLOR }; return color; } static const xColor DEFAULT_COLOR; DEFINE_PROPERTY_REF(PROP_SKYBOX_COLOR, Color, color, xColor, DEFAULT_COLOR); DEFINE_PROPERTY_REF(PROP_SKYBOX_URL, URL, url, QString, ""); }; #endif // hifi_SkyboxPropertyGroup_h