diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-04-16 13:42:13 +0300 |
---|---|---|
committer | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-05-02 10:19:23 +0000 |
commit | 3dc7636713c98ce2748d367f8525fcab85a6c425 (patch) | |
tree | 12411317058e10feae817e25c33f0e5e24577298 | |
parent | 437593e677cd1ed85ef846a3488dc3212fdde54a (diff) |
Support alpha channel initial work
In this initial work, all (almost) color properties are converted into a new type (float4) to
support an alpha channel. Alpha channel option is shown in the color dialog for Layer and Scene
background properties only. The following is remaining:
- Scene background alpha doesn't work in the editor (works in the viewer RT1)
Task-number: QT3DS-3128
Change-Id: Ib5540ebc8e2ff68709473451e4a92bf66ddb8ad2
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
68 files changed, 570 insertions, 480 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp index f22ed07d..aa841091 100644 --- a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp +++ b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.cpp @@ -329,6 +329,19 @@ qt3dsdm::Qt3DSDMPropertyHandle CClientDataModelBridge::getVariantsProperty(int i return 0; } +qt3dsdm::Qt3DSDMPropertyHandle CClientDataModelBridge::getBGColorProperty(int instance) const +{ + EStudioObjectType instanceType = GetObjectType(instance); + + if (instanceType == OBJTYPE_SCENE) + return m_Scene.m_BackgroundColor; + + if (instanceType == OBJTYPE_LAYER) + return m_Layer.m_BackgroundColor; + + return 0; +} + bool CClientDataModelBridge::IsInternalProperty(const TCharStr &inPropertyName) const { return (inPropertyName == L"name" || inPropertyName == L"importid" || inPropertyName == L"type" diff --git a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h index c87d7604..c44fe808 100644 --- a/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h +++ b/src/Authoring/Client/Code/Core/Doc/ClientDataModelBridge/ClientDataModelBridge.h @@ -184,6 +184,7 @@ public: qt3dsdm::Qt3DSDMPropertyHandle GetSourcePathProperty() const; qt3dsdm::Qt3DSDMPropertyHandle getSubpresentationProperty() const; qt3dsdm::Qt3DSDMPropertyHandle getVariantsProperty(int instance) const; + qt3dsdm::Qt3DSDMPropertyHandle getBGColorProperty(int instance) const; qt3dsdm::Qt3DSDMInstanceHandle GetActionInstance(); qt3dsdm::Qt3DSDMPropertyHandle GetActionEyeball(); qt3dsdm::Qt3DSDMPropertyHandle GetImportId(); diff --git a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp index c4f7c960..1b5e09f3 100644 --- a/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp +++ b/src/Authoring/Client/Code/Core/Doc/DocumentEditor.cpp @@ -2439,7 +2439,7 @@ public: } case DataModelDataType::Float2: { - QStringList floats = i.value().split(QStringLiteral(" ")); + QStringList floats = i.value().split(QLatin1Char(' ')); if (floats.length() == 2) { SFloat2 value(floats[0].toFloat(), floats[1].toFloat()); setInstanceValueIfChanged(instance, prop, value); @@ -2448,13 +2448,23 @@ public: } case DataModelDataType::Float3: { - QStringList floats = i.value().split(QStringLiteral(" ")); + QStringList floats = i.value().split(QLatin1Char(' ')); if (floats.length() == 3) { SFloat3 value(floats[0].toFloat(), floats[1].toFloat(), floats[2].toFloat()); setInstanceValueIfChanged(instance, prop, value); } break; } + case DataModelDataType::Float4: + { + QStringList floats = i.value().split(QLatin1Char(' ')); + if (floats.length() == 4) { + SFloat4 value(floats[0].toFloat(), floats[1].toFloat(), floats[2].toFloat(), + floats[3].toFloat()); + setInstanceValueIfChanged(instance, prop, value); + } + break; + } case DataModelDataType::Bool: { if (propString == "True") @@ -2843,8 +2853,8 @@ public: { m_PropertySystem.SetInstancePropertyValue( inInstance, m_Bridge.GetSceneAsset().m_TimebarColor, - qt3dsdm::SFloat3(inColor.GetRed() / 255.0f, inColor.GetGreen() / 255.0f, - inColor.GetBlue() / 255.0f)); + qt3dsdm::SFloat4(inColor.GetRed() / 255.0f, inColor.GetGreen() / 255.0f, + inColor.GetBlue() / 255.0f, 1.0f)); } void SetTimebarText(TInstanceHandle inInstance, const QString &inComment) override diff --git a/src/Authoring/Client/Code/Core/Utility/DataTypesConverter.h b/src/Authoring/Client/Code/Core/Utility/DataTypesConverter.h index 304a44ba..2a8f3d8f 100644 --- a/src/Authoring/Client/Code/Core/Utility/DataTypesConverter.h +++ b/src/Authoring/Client/Code/Core/Utility/DataTypesConverter.h @@ -75,6 +75,11 @@ inline qt3dsdm::SValue ConvertToSValue(float inX, float inY, float inZ) return (qt3dsdm::SValue(qt3dsdm::SFloat3(inX, inY, inZ))); } +inline qt3dsdm::SValue ConvertToSValue(float f1, float f2, float f3, float f4) +{ + return qt3dsdm::SValue(qt3dsdm::SFloat4(f1, f2, f3, f4)); +} + inline qt3dsdm::SValue ConvertToSValue(const qt3ds::QT3DSVec2 &inValue) { qt3dsdm::SFloat2 theFloat2; diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMAnimation.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMAnimation.h index c2a7c3b8..361e522b 100644 --- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMAnimation.h +++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMAnimation.h @@ -519,6 +519,10 @@ struct SAnimatableArityVisitor { return std::tuple<bool, size_t>(true, 3); } + std::tuple<bool, size_t> operator()(const SFloat4 &) const + { + return std::tuple<bool, size_t>(true, 4); + } template <typename TDataType> std::tuple<bool, size_t> operator()(const TDataType &) const { @@ -548,6 +552,8 @@ inline std::tuple<bool, size_t> GetDatatypeAnimatableAndArity(DataModelDataType: return std::make_tuple(true, 2); case DataModelDataType::Float3: return std::make_tuple(true, 3); + case DataModelDataType::Float4: + return std::make_tuple(true, 4); } } diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h index ab92a649..16fb0d14 100644 --- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h +++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMComposerTypeDefinitions.h @@ -99,13 +99,13 @@ class IPropertySystem; HANDLE_COMPOSER_PROPERTY(eyeball, m_Eyeball, bool, true) \ HANDLE_COMPOSER_PROPERTY(shy, m_Shy, bool, false) \ HANDLE_COMPOSER_PROPERTY(locked, m_Locked, bool, false) \ - HANDLE_COMPOSER_PROPERTY_NO_DEFAULT(timebarcolor, m_TimebarColor, SFloat3) \ + HANDLE_COMPOSER_PROPERTY_NO_DEFAULT(timebarcolor, m_TimebarColor, SFloat4) \ HANDLE_COMPOSER_PROPERTY(timebartext, m_TimebarText, TDataStrPtr, L"") \ HANDLE_COMPOSER_PROPERTY(controlledproperty, m_ControlledProperty, TDataStrPtr, L"") #define ITERATE_COMPOSER_SCENE_PROPERTIES \ HANDLE_COMPOSER_PROPERTY(bgcolorenable, m_BgColorEnable, bool, true) \ - HANDLE_COMPOSER_PROPERTY(backgroundcolor, m_BackgroundColor, SFloat3, SFloat3(0, 0, 0)) \ + HANDLE_COMPOSER_PROPERTY(backgroundcolor, m_BackgroundColor, SFloat4, SFloat4(0, 0, 0, 1)) \ HANDLE_COMPOSER_PROPERTY_DUPLICATE(controlledproperty, m_ControlledProperty, TDataStrPtr, L"") #define ITERATE_COMPOSER_COMPONENT_PROPERTIES \ @@ -162,7 +162,7 @@ class IPropertySystem; #define ITERATE_COMPOSER_MATERIAL_PROPERTIES \ HANDLE_COMPOSER_PROPERTY(shaderlighting, m_ShaderLighting, TDataStrPtr, L"Vertex") \ HANDLE_COMPOSER_PROPERTY(blendmode, m_BlendMode, TDataStrPtr, L"Normal") \ - HANDLE_COMPOSER_PROPERTY(diffuse, m_DiffuseColor, SFloat3, SFloat3(1, 1, 1)) \ + HANDLE_COMPOSER_PROPERTY(diffuse, m_DiffuseColor, SFloat4, SFloat4(1, 1, 1, 1)) \ HANDLE_COMPOSER_PROPERTY(diffusemap, m_DiffuseMap1, SLong4, 0) \ HANDLE_COMPOSER_PROPERTY(diffusemap2, m_DiffuseMap2, SLong4, 0) \ HANDLE_COMPOSER_PROPERTY(diffusemap3, m_DiffuseMap3, SLong4, 0) \ @@ -172,7 +172,7 @@ class IPropertySystem; HANDLE_COMPOSER_PROPERTY(roughnessmap, m_RoughnessMap, SLong4, 0) \ HANDLE_COMPOSER_PROPERTY_DUPLICATE(opacity, m_Opacity, float, 100.f) \ HANDLE_COMPOSER_PROPERTY(opacitymap, m_OpacityMap, SLong4, 0) \ - HANDLE_COMPOSER_PROPERTY(emissivecolor, m_EmissiveColor, SFloat3, 0.f) \ + HANDLE_COMPOSER_PROPERTY(emissivecolor, m_EmissiveColor, SFloat4, SFloat4(1, 1, 1, 1)) \ HANDLE_COMPOSER_PROPERTY(emissivepower, m_EmissivePower, float, 0.f) \ HANDLE_COMPOSER_PROPERTY(emissivemap, m_EmissiveMap, SLong4, 0) \ HANDLE_COMPOSER_PROPERTY(emissivemap2, m_EmissiveMap2, SLong4, 0) \ @@ -186,7 +186,7 @@ class IPropertySystem; HANDLE_COMPOSER_PROPERTY(diffuselightwrap, m_DiffuseLightWrap, float, 0.f) \ HANDLE_COMPOSER_PROPERTY(specularmap, m_SpecularMap, SLong4, 0) \ HANDLE_COMPOSER_PROPERTY(specularmodel, m_SpecularModel, TDataStrPtr, L"Default") \ - HANDLE_COMPOSER_PROPERTY(speculartint, m_SpecularTint, SFloat3, SFloat3(1, 1, 1)) \ + HANDLE_COMPOSER_PROPERTY(speculartint, m_SpecularTint, SFloat4, SFloat4(1, 1, 1, 1)) \ HANDLE_COMPOSER_PROPERTY(ior, m_IOR, float, 0) \ HANDLE_COMPOSER_PROPERTY(fresnelPower, m_FresnelPower, float, 0) \ HANDLE_COMPOSER_PROPERTY(vertexcolors, m_VertexColors, bool, false) \ @@ -202,8 +202,8 @@ class IPropertySystem; HANDLE_COMPOSER_PROPERTY(disabledepthtest, m_DisableDepthTest, bool, false) \ HANDLE_COMPOSER_PROPERTY(disabledepthprepass, m_DisableDepthPrepass, bool, false) \ HANDLE_COMPOSER_PROPERTY(background, m_Background, TDataStrPtr, L"Transparent") \ - HANDLE_COMPOSER_PROPERTY_DUPLICATE(backgroundcolor, m_BackgroundColor, SFloat3, \ - SFloat3(0, 0, 0)) \ + HANDLE_COMPOSER_PROPERTY_DUPLICATE(backgroundcolor, m_BackgroundColor, SFloat4, \ + SFloat4(0, 0, 0, 1)) \ HANDLE_COMPOSER_PROPERTY(blendtype, m_BlendType, TDataStrPtr, L"Normal") \ HANDLE_COMPOSER_PROPERTY(horzfields, m_HorizontalFieldValues, TDataStrPtr, L"Left/Width") \ HANDLE_COMPOSER_PROPERTY(left, m_Left, float, 0) \ @@ -247,9 +247,9 @@ class IPropertySystem; #define ITERATE_COMPOSER_LIGHT_PROPERTIES \ HANDLE_COMPOSER_PROPERTY(lighttype, m_LightType, TDataStrPtr, L"Directional") \ HANDLE_COMPOSER_PROPERTY(scope, m_Scope, SObjectRefType, L"") \ - HANDLE_COMPOSER_PROPERTY(lightdiffuse, m_LightColor, SFloat3, SFloat3(1, 1, 1)) \ - HANDLE_COMPOSER_PROPERTY(lightspecular, m_SpecularColor, SFloat3, SFloat3(1, 1, 1)) \ - HANDLE_COMPOSER_PROPERTY(lightambient, m_AmbientColor, SFloat3, SFloat3(0, 0, 0)) \ + HANDLE_COMPOSER_PROPERTY(lightdiffuse, m_LightColor, SFloat4, SFloat4(1, 1, 1, 1)) \ + HANDLE_COMPOSER_PROPERTY(lightspecular, m_SpecularColor, SFloat4, SFloat4(1, 1, 1, 1)) \ + HANDLE_COMPOSER_PROPERTY(lightambient, m_AmbientColor, SFloat4, SFloat4(0, 0, 0, 1)) \ HANDLE_COMPOSER_PROPERTY(brightness, m_Brightness, float, 100.0f) \ HANDLE_COMPOSER_PROPERTY(linearfade, m_LinearFade, float, 0.0f) \ HANDLE_COMPOSER_PROPERTY(expfade, m_ExpFade, float, 0.0f) \ @@ -278,7 +278,7 @@ class IPropertySystem; #define ITERATE_COMPOSER_TEXT_PROPERTIES \ HANDLE_COMPOSER_PROPERTY(textstring, m_TextString, TDataStrPtr, L"Text") \ - HANDLE_COMPOSER_PROPERTY(textcolor, m_TextColor, SFloat3, SFloat3(1, 1, 1)) \ + HANDLE_COMPOSER_PROPERTY(textcolor, m_TextColor, SFloat4, SFloat4(1, 1, 1, 1)) \ HANDLE_COMPOSER_PROPERTY(font, m_Font, TDataStrPtr, L"arial") \ HANDLE_COMPOSER_PROPERTY(size, m_Size, float, 24.f) \ HANDLE_COMPOSER_PROPERTY(horzalign, m_HorzAlign, TDataStrPtr, L"Center") \ @@ -399,6 +399,7 @@ struct DataTypeToTypeMap QT3DSDM_DEFINE_TYPE_TO_DATA_TYPE(DataModelDataType::Float, float) QT3DSDM_DEFINE_TYPE_TO_DATA_TYPE(DataModelDataType::Float2, SFloat2) QT3DSDM_DEFINE_TYPE_TO_DATA_TYPE(DataModelDataType::Float3, SFloat3) +QT3DSDM_DEFINE_TYPE_TO_DATA_TYPE(DataModelDataType::Float4, SFloat4) QT3DSDM_DEFINE_TYPE_TO_DATA_TYPE(DataModelDataType::Long, qt3ds::QT3DSI32) QT3DSDM_DEFINE_TYPE_TO_DATA_TYPE(DataModelDataType::String, TDataStrPtr) QT3DSDM_DEFINE_TYPE_TO_DATA_TYPE(DataModelDataType::Bool, bool) diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMDataTypes.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMDataTypes.h index d8c2673e..7a7157f6 100644 --- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMDataTypes.h +++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMDataTypes.h @@ -291,6 +291,49 @@ struct SFloat3 } }; +struct SFloat4 +{ + float m_Floats[4]; + + SFloat4(float f1 = 0, float f2 = 0, float f3 = 0, float f4 = 1) + { + m_Floats[0] = f1; + m_Floats[1] = f2; + m_Floats[2] = f3; + m_Floats[3] = f4; + } + SFloat4(const SFloat4 &inOther) { operator=(inOther); } + SFloat4 &operator=(const SFloat4 &inOther) + { + m_Floats[0] = inOther.m_Floats[0]; + m_Floats[1] = inOther.m_Floats[1]; + m_Floats[2] = inOther.m_Floats[2]; + m_Floats[3] = inOther.m_Floats[3]; + return *this; + } + + bool operator==(const SFloat4 &other) const + { + return m_Floats[0] == other.m_Floats[0] && m_Floats[1] == other.m_Floats[1] + && m_Floats[2] == other.m_Floats[2] && m_Floats[3] == other.m_Floats[3]; + } + + float &operator[](size_t inIndex) + { + if (inIndex < 4) + return m_Floats[inIndex]; + + throw std::out_of_range(""); + } + const float &operator[](size_t inIndex) const + { + if (inIndex < 4) + return m_Floats[inIndex]; + + throw std::out_of_range(""); + } +}; + struct SLong4 { qt3ds::QT3DSU32 m_Longs[4]; @@ -471,6 +514,11 @@ namespace foundation { void destruct(qt3dsdm::SFloat3 &) {} }; template <> + struct DestructTraits<qt3dsdm::SFloat4> + { + void destruct(qt3dsdm::SFloat4 &) {} + }; + template <> struct DestructTraits<qt3dsdm::SLong4> { void destruct(qt3dsdm::SLong4 &) {} @@ -774,6 +822,7 @@ struct DataModelDataType { Float, Float2, Float3, + Float4, Long, String, Bool, diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp index 02339efc..bc4e905d 100644 --- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp +++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMMetaData.cpp @@ -123,8 +123,8 @@ struct WStrOps<AdditionalMetaDataType::Value> { switch (item) { #define HANDLE_ADDITIONAL_META_DATA_TYPE(name) \ - case AdditionalMetaDataType::name: \ - wcscpy_s(buffer.begin(), buffer.size(), QT3DS_WCHAR_T_##name); \ + case AdditionalMetaDataType::name: \ + wcscpy_s(buffer.begin(), buffer.size(), QT3DS_WCHAR_T_##name); \ return 1; ITERATE_ADDITIONAL_META_DATA_TYPES #undef HANDLE_ADDITIONAL_META_DATA_TYPE @@ -134,9 +134,9 @@ struct WStrOps<AdditionalMetaDataType::Value> bool StrTo(const wchar_t *buffer, AdditionalMetaDataType::Value &item) { #define HANDLE_ADDITIONAL_META_DATA_TYPE(name) \ - if (AreEqual(buffer, QT3DS_WCHAR_T_##name)) { \ - item = AdditionalMetaDataType::name; \ - return true; \ + if (AreEqual(buffer, QT3DS_WCHAR_T_##name)) { \ + item = AdditionalMetaDataType::name; \ + return true; \ } ITERATE_ADDITIONAL_META_DATA_TYPES #undef HANDLE_ADDITIONAL_META_DATA_TYPE @@ -159,8 +159,8 @@ QT3DSU32 WStrOps<HandlerArgumentType::Value>::ToStr(HandlerArgumentType::Value i { switch (item) { #define HANDLE_HANDLER_ARG_TYPE(name) \ - case HandlerArgumentType::name: \ - wcscpy_s(buffer.begin(), buffer.size(), QT3DS_WCHAR_T_##name); \ + case HandlerArgumentType::name: \ + wcscpy_s(buffer.begin(), buffer.size(), QT3DS_WCHAR_T_##name); \ return 1; ITERATE_HANDLER_ARG_TYPES #undef HANDLE_HANDLER_ARG_TYPE @@ -171,9 +171,9 @@ QT3DSU32 WStrOps<HandlerArgumentType::Value>::ToStr(HandlerArgumentType::Value i bool WStrOps<HandlerArgumentType::Value>::StrTo(const wchar_t *buffer, HandlerArgumentType::Value &item) { #define HANDLE_HANDLER_ARG_TYPE(name) \ - if (AreEqual(buffer, QT3DS_WCHAR_T_##name)) { \ + if (AreEqual(buffer, QT3DS_WCHAR_T_##name)) { \ item = HandlerArgumentType::name; \ - return true; \ + return true; \ } ITERATE_HANDLER_ARG_TYPES #undef HANDLE_HANDLER_ARG_TYPE @@ -189,35 +189,35 @@ bool WStrOps<HandlerArgumentType::Value>::StrTo(const wchar_t *buffer, HandlerAr #define QT3DS_WCHAR_T_StringListOrInt L"StringListOrInt" #define QT3DS_WCHAR_T_Scale L"Scale" -#define ITERATE_QT3DSDM_COMPLETE_TYPES \ - HANDLE_QT3DSDM_COMPLETE_NONE_TYPE \ - HANDLE_QT3DSDM_COMPLETE_TYPE(StringList, StringList, DataModelDataType::String) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(FloatRange, Range, DataModelDataType::Float) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(LongRange, Range, DataModelDataType::Long) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Float, None, DataModelDataType::Float) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Long, None, DataModelDataType::Long) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Float2, None, DataModelDataType::Float2) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Vector, None, DataModelDataType::Float3) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Scale, None, DataModelDataType::Float3) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Rotation, Rotation, DataModelDataType::Float3) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Color, Color, DataModelDataType::Float3) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Boolean, None, DataModelDataType::Bool) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Slide, None, DataModelDataType::String) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Font, Font, DataModelDataType::String) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(FontSize, FontSize, DataModelDataType::Float) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(String, String, DataModelDataType::String) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(MultiLineString, MultiLine, DataModelDataType::String) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(ObjectRef, ObjectRef, DataModelDataType::ObjectRef) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Image, Image, DataModelDataType::Long4) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Mesh, Mesh, DataModelDataType::String) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Import, Import, DataModelDataType::String) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Texture, Texture, DataModelDataType::String) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Image2D, Texture, DataModelDataType::String) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Buffer, Texture, DataModelDataType::String) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Guid, None, DataModelDataType::Long4) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(StringListOrInt, StringList, DataModelDataType::StringOrInt) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(Renderable, Renderable, DataModelDataType::String) \ - HANDLE_QT3DSDM_COMPLETE_TYPE(PathBuffer, PathBuffer, DataModelDataType::String) \ +#define ITERATE_QT3DSDM_COMPLETE_TYPES \ + HANDLE_QT3DSDM_COMPLETE_NONE_TYPE \ + HANDLE_QT3DSDM_COMPLETE_TYPE(StringList, StringList, DataModelDataType::String) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(FloatRange, Range, DataModelDataType::Float) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(LongRange, Range, DataModelDataType::Long) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Float, None, DataModelDataType::Float) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Long, None, DataModelDataType::Long) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Float2, None, DataModelDataType::Float2) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Vector, None, DataModelDataType::Float3) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Scale, None, DataModelDataType::Float3) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Rotation, Rotation, DataModelDataType::Float3) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Color, Color, DataModelDataType::Float4) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Boolean, None, DataModelDataType::Bool) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Slide, None, DataModelDataType::String) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Font, Font, DataModelDataType::String) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(FontSize, FontSize, DataModelDataType::Float) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(String, String, DataModelDataType::String) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(MultiLineString, MultiLine, DataModelDataType::String) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(ObjectRef, ObjectRef, DataModelDataType::ObjectRef) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Image, Image, DataModelDataType::Long4) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Mesh, Mesh, DataModelDataType::String) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Import, Import, DataModelDataType::String) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Texture, Texture, DataModelDataType::String) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Image2D, Texture, DataModelDataType::String) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Buffer, Texture, DataModelDataType::String) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Guid, None, DataModelDataType::Long4) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(StringListOrInt, StringList, DataModelDataType::StringOrInt) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(Renderable, Renderable, DataModelDataType::String) \ + HANDLE_QT3DSDM_COMPLETE_TYPE(PathBuffer, PathBuffer, DataModelDataType::String) \ HANDLE_QT3DSDM_COMPLETE_TYPE(ShadowMapResolution, ShadowMapResolution, DataModelDataType::Long) DataModelDataType::Value CompleteMetaDataType::ToDataType(CompleteMetaDataType::Enum inCompleteType) @@ -3145,6 +3145,11 @@ public: = qt3ds::render::NVRenderShaderDataTypes::QT3DSVec3; AppendShaderUniform("vec3", theNewDefinition.m_Name.c_str(), uniforms); break; + case DataModelDataType::Float4: + theNewDefinition.m_DataType + = qt3ds::render::NVRenderShaderDataTypes::QT3DSVec4; + AppendShaderUniform("vec4", theNewDefinition.m_Name.c_str(), uniforms); + break; case DataModelDataType::String: if (theInfo.m_CompleteType == CompleteMetaDataType::Texture) { theNewDefinition.m_DataType = diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMValue.cpp b/src/Authoring/QT3DSDM/Systems/Qt3DSDMValue.cpp index b6077b04..94c5a594 100644 --- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMValue.cpp +++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMValue.cpp @@ -46,7 +46,7 @@ SValue::SValue(const QVariant &inData) case QVariant::Color: { const QColor c = inData.value<QColor>(); - *this = qt3dsdm::SFloat3(c.redF(), c.greenF(), c.blueF()); + *this = qt3dsdm::SFloat4(c.redF(), c.greenF(), c.blueF(), c.alphaF()); break; } case QVariant::String: @@ -110,6 +110,9 @@ QVariant SValue::toQVariant() const case DataModelDataType::Float3: { return QVariant::fromValue(get<QVector3D>(*this)); } + case DataModelDataType::Float4: { + return QVariant::fromValue(get<QVector<float> >(*this)); + } case DataModelDataType::Long: { return QVariant::fromValue(get<qt3ds::QT3DSI32>(*this)); } diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMValue.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMValue.h index 1e6870ee..9e006320 100644 --- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMValue.h +++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMValue.h @@ -66,6 +66,7 @@ struct SEnumToDataTypeMap HANDLE_QT3DSDM_DATA_TYPE(float, DataModelDataType::Float); \ HANDLE_QT3DSDM_DATA_TYPE(SFloat2, DataModelDataType::Float2); \ HANDLE_QT3DSDM_DATA_TYPE(SFloat3, DataModelDataType::Float3); \ + HANDLE_QT3DSDM_DATA_TYPE(SFloat4, DataModelDataType::Float4); \ HANDLE_QT3DSDM_DATA_TYPE(qt3ds::QT3DSI32, DataModelDataType::Long); \ HANDLE_QT3DSDM_DATA_TYPE(TDataStrPtr, DataModelDataType::String); \ HANDLE_QT3DSDM_DATA_TYPE(bool, DataModelDataType::Bool); \ @@ -237,6 +238,9 @@ struct SDefaulter<SValue> case DataModelDataType::Float3: outValue = SValue(SFloat3()); break; + case DataModelDataType::Float4: + outValue = SValue(SFloat4()); + break; case DataModelDataType::Long: outValue = SValue(0); break; @@ -289,11 +293,12 @@ inline SObjectRefType ConvertToObjectRef(const SValue &inValue) template <> inline QColor get<QColor>(const SValue &inType) { - auto f = get<qt3dsdm::SFloat3>(inType); + auto f = get<qt3dsdm::SFloat4>(inType); qreal r = qBound<qreal>(0.0, f.m_Floats[0], 1.0); qreal g = qBound<qreal>(0.0, f.m_Floats[1], 1.0); qreal b = qBound<qreal>(0.0, f.m_Floats[2], 1.0); - return QColor::fromRgbF(r, g, b); + qreal a = qBound<qreal>(0.0, f.m_Floats[3], 1.0); + return QColor::fromRgbF(r, g, b, a); } template <> @@ -316,6 +321,13 @@ inline QVector3D get<QVector3D>(const qt3dsdm::SValue &inType) return QVector3D(f.m_Floats[0], f.m_Floats[1], f.m_Floats[2]); } +template <> +inline QVector<float> get<QVector<float> >(const qt3dsdm::SValue &inType) +{ + auto f = get<qt3dsdm::SFloat4>(inType); + return {f.m_Floats[0], f.m_Floats[1], f.m_Floats[2], f.m_Floats[3]}; +} + // KDAB_TODO Shortcut to not define our own 4 member long structure template <> inline QVector<qt3ds::QT3DSU32> get<QVector<qt3ds::QT3DSU32> >(const qt3dsdm::SValue &inType) diff --git a/src/Authoring/QT3DSDM/Systems/Qt3DSDMWStrOpsImpl.h b/src/Authoring/QT3DSDM/Systems/Qt3DSDMWStrOpsImpl.h index 895e3ff5..9268e6dc 100644 --- a/src/Authoring/QT3DSDM/Systems/Qt3DSDMWStrOpsImpl.h +++ b/src/Authoring/QT3DSDM/Systems/Qt3DSDMWStrOpsImpl.h @@ -209,6 +209,7 @@ struct WStrOps<QT3DSF64> #define QT3DS_WCHAR_T_Float L"Float" #define QT3DS_WCHAR_T_Float2 L"Float2" #define QT3DS_WCHAR_T_Float3 L"Float3" +#define QT3DS_WCHAR_T_Float4 L"Float4" #define QT3DS_WCHAR_T_Long L"Long" #define QT3DS_WCHAR_T_String L"String" #define QT3DS_WCHAR_T_Bool L"Bool" @@ -218,18 +219,19 @@ struct WStrOps<QT3DSF64> #define QT3DS_WCHAR_T_StringOrInt L"StringOrInt" #define QT3DS_WCHAR_T_FloatList L"FloatList" -#define QT3DS_IMPORT_ITERATE_DMTYPE \ - QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::None, None, QT3DSF32) \ - QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Float, Float, QT3DSF32) \ - QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Float2, Float2, SFloat2) \ - QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Float3, Float3, SFloat3) \ - QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Long, Long, QT3DSI32) \ - QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::String, String, TDataStrPtr) \ - QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Bool, Bool, bool) \ - QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Long4, Long4, SLong4) \ - QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::StringRef, StringRef, SStringRef) \ - QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::ObjectRef, ObjectRef, SObjectRefType) \ - QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::StringOrInt, StringOrInt, SStringOrInt) \ +#define QT3DS_IMPORT_ITERATE_DMTYPE \ + QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::None, None, QT3DSF32) \ + QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Float, Float, QT3DSF32) \ + QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Float2, Float2, SFloat2) \ + QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Float3, Float3, SFloat3) \ + QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Float4, Float4, SFloat4) \ + QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Long, Long, QT3DSI32) \ + QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::String, String, TDataStrPtr) \ + QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Bool, Bool, bool) \ + QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::Long4, Long4, SLong4) \ + QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::StringRef, StringRef, SStringRef) \ + QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::ObjectRef, ObjectRef, SObjectRefType) \ + QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::StringOrInt, StringOrInt, SStringOrInt) \ QT3DS_IMPORT_HANDLE_DMTYPE(DataModelDataType::FloatList, FloatList, TFloatList) template <> @@ -239,9 +241,9 @@ struct WStrOps<DataModelDataType::Value> { const wchar_t *data = NULL; switch (item) { -#define QT3DS_IMPORT_HANDLE_DMTYPE(x, y, z) \ +#define QT3DS_IMPORT_HANDLE_DMTYPE(x, y, z) \ case x: \ - data = QT3DS_WCHAR_T_##y; \ + data = QT3DS_WCHAR_T_##y; \ break; QT3DS_IMPORT_ITERATE_DMTYPE #undef QT3DS_IMPORT_HANDLE_DMTYPE @@ -256,9 +258,8 @@ struct WStrOps<DataModelDataType::Value> } bool StrTo(const wchar_t *buffer, DataModelDataType::Value &item) { - -#define QT3DS_IMPORT_HANDLE_DMTYPE(x, y, z) \ - if (AreEqual(buffer, QT3DS_WCHAR_T_##y)) { \ +#define QT3DS_IMPORT_HANDLE_DMTYPE(x, y, z) \ + if (AreEqual(buffer, QT3DS_WCHAR_T_##y)) { \ item = x; \ return true; \ } @@ -280,6 +281,7 @@ struct WStrOpsDMWriter void operator()(float val) { buf.Write(val); } void operator()(const SFloat2 &val) { buf.Write(NVConstDataRef<QT3DSF32>(&val[0], 2)); } void operator()(const SFloat3 &val) { buf.Write(NVConstDataRef<QT3DSF32>(&val[0], 3)); } + void operator()(const SFloat4 &val) { buf.Write(NVConstDataRef<QT3DSF32>(&val[0], 4)); } void operator()(QT3DSI32 val) { buf.Write(val); } void operator()(bool val) { buf.Write(val); } void operator()(const TDataStrPtr &val) @@ -314,7 +316,7 @@ struct WStrOps<SValue> SValue BufTo(DataModelDataType::Value type, TBufferType &inReader) { switch (type) { -#define QT3DS_IMPORT_HANDLE_DMTYPE(x, y, z) \ +#define QT3DS_IMPORT_HANDLE_DMTYPE(x, y, z) \ case x: { \ z retval; \ Read(inReader, retval); \ @@ -344,6 +346,11 @@ struct WStrOps<SValue> reader.ReadRef(NVDataRef<QT3DSF32>(&val[0], 3)); } template <typename TBufferType> + void Read(TBufferType &reader, SFloat4 &val) + { + reader.ReadRef(NVDataRef<QT3DSF32>(&val[0], 4)); + } + template <typename TBufferType> void Read(TBufferType &reader, QT3DSI32 &val) { reader.Read(val); @@ -566,7 +573,6 @@ struct WCharTReader if (m_StartPtr) m_StartPtr = FindNextNonWhitespace(m_StartPtr + 1); } - QT3DS_ASSERT(idx == data.size()); } void ReadBuffer(NVConstDataRef<char8_t> &outBuffer) diff --git a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportColladaSGTranslation.cpp b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportColladaSGTranslation.cpp index 4a3c3a1a..2bf58a85 100644 --- a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportColladaSGTranslation.cpp +++ b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportColladaSGTranslation.cpp @@ -156,7 +156,7 @@ protected: std::function<void(long inMapType, const STextureParameters &inTextureParameters)> SetTexture; std::function<void(double clipstart, double clipend, bool ortho, double fov)> SetCameraProperties; - std::function<void(int type, const SFloat3 &color, double intensity, + std::function<void(int type, const SFloat4 &color, double intensity, double linearfade, double quadfade, bool shadows)> SetLightProperties; std::function<void(const char *, const char *)> SetAnimationTrack; @@ -624,7 +624,8 @@ void ColladaDOMWalker::ProcessNode(const domNodeRef inNode) } // Collada does not seem to have info about casting shadows or light intensity. // We'll use the defaults (intensity 100, no shadows) - SetLightProperties(type, SFloat3(color.get(0), color.get(1), color.get(2)), + SetLightProperties(type, + SFloat4(color.get(0), color.get(1), color.get(2), color.get(3)), 100, linearFade, quadFade, false); } } diff --git a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp index fa2babad..d68df5d7 100644 --- a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp +++ b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportFbxSGTranslation.cpp @@ -484,7 +484,8 @@ void FbxDomWalker::ProcessLight(FbxNode *inFbxNode) ProcessTransform(inFbxNode, true); FbxLight *light = inFbxNode->GetLight(); FbxDouble3 color = light->Color.Get(); - m_Translator->SetLightProperties(light->LightType.Get(), SFloat3(color[0], color[1], color[2]), + m_Translator->SetLightProperties(light->LightType.Get(), + SFloat4(color[0], color[1], color[2], 1.0f), light->Intensity.Get(), 0, 0, light->CastShadows.Get()); ProcessNodeChildren(inFbxNode); m_Translator->PopLight(); diff --git a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.cpp b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.cpp index 0b12ca94..55d23c67 100644 --- a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.cpp +++ b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.cpp @@ -133,11 +133,11 @@ struct SGAnimation static inline qt3dsdm::SValue ToColor(const float p[]) { - return qt3dsdm::SFloat3(p[0], p[1], p[2]); + return qt3dsdm::SFloat4(p[0], p[1], p[2], p[3]); } static inline qt3dsdm::SValue ToColor(const float p[], float inMult) { - return qt3dsdm::SFloat3(p[0] * inMult, p[1] * inMult, p[2] * inMult); + return qt3dsdm::SFloat4(p[0] * inMult, p[1] * inMult, p[2] * inMult, p[3] * inMult); } template <typename TDataType> static inline TDataType GetMin(TDataType a, TDataType b) @@ -488,7 +488,7 @@ public: } void PushLight(const char *inName) override { PushObject(inName, ComposerObjectTypes::Light); } - void SetLightProperties(int type, const SFloat3 &color, double intensity, double linearfade, + void SetLightProperties(int type, const SFloat4 &color, double intensity, double linearfade, double quadfade, bool shadows) override { Q_UNUSED(linearfade) @@ -707,12 +707,13 @@ public: // Set diffuse color to 1.0 if there is diffuse texture because I think diffuse color is // multiplied with diffuse texture to get the final color SetInstancePropertyValue(theMaterial, m_Material.m_DiffuseColor, - qt3dsdm::SFloat3(1.0f, 1.0f, 1.0f)); + qt3dsdm::SFloat4(1.0f, 1.0f, 1.0f, 1.0f)); else SetInstancePropertyValue(theMaterial, m_Material.m_DiffuseColor, - qt3dsdm::SFloat3(inMaterialParameters.m_Diffuse.m_Color[0], - inMaterialParameters.m_Diffuse.m_Color[1], - inMaterialParameters.m_Diffuse.m_Color[2])); + qt3dsdm::SFloat4(inMaterialParameters.m_Diffuse.m_Color[0], + inMaterialParameters.m_Diffuse.m_Color[1], + inMaterialParameters.m_Diffuse.m_Color[2], + inMaterialParameters.m_Diffuse.m_Color[3])); if (inMaterialParameters.m_Extra.m_EmissionLevel.m_Flag) { SetInstancePropertyValue(theMaterial, m_Material.m_EmissivePower, diff --git a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.h b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.h index 4187f626..8935f28b 100644 --- a/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.h +++ b/src/Authoring/QT3DSIMP/Qt3DSImportSGTranslation/Qt3DSImportSceneGraphTranslation.h @@ -359,7 +359,7 @@ public: long inAuthoringToolVersion) = 0; virtual void PushLight(const char *inName) = 0; - virtual void SetLightProperties(int type, const SFloat3 &color, double intensity, + virtual void SetLightProperties(int type, const SFloat4 &color, double intensity, double linearfade, double quadfade, bool shadows) = 0; virtual void PopLight() = 0; virtual void PushCamera(const char *inName) = 0; diff --git a/src/Authoring/Studio/Palettes/Action/ActionView.cpp b/src/Authoring/Studio/Palettes/Action/ActionView.cpp index 92a532f2..ec7c9be4 100644 --- a/src/Authoring/Studio/Palettes/Action/ActionView.cpp +++ b/src/Authoring/Studio/Palettes/Action/ActionView.cpp @@ -1164,16 +1164,6 @@ bool ActionView::toolTipsEnabled() return CStudioPreferences::ShouldShowTooltips(); } -QColor ActionView::showColorDialog(const QColor &color) -{ - m_currentColor = color; - CDialogs *dialogs = g_StudioApp.GetDialogs(); - connect(dialogs, &CDialogs::onColorChanged, this, &ActionView::dialogCurrentColorChanged); - QColor currentColor = dialogs->displayColorDialog(color); - disconnect(dialogs, &CDialogs::onColorChanged, this, &ActionView::dialogCurrentColorChanged); - return currentColor; -} - void ActionView::updateActionStates() { bool hasValidAction = (m_currentActionIndex != -1) && m_itemHandle.Valid(); diff --git a/src/Authoring/Studio/Palettes/Action/ActionView.h b/src/Authoring/Studio/Palettes/Action/ActionView.h index 4cdd2c58..ab2976f3 100644 --- a/src/Authoring/Studio/Palettes/Action/ActionView.h +++ b/src/Authoring/Studio/Palettes/Action/ActionView.h @@ -130,7 +130,6 @@ public: Q_INVOKABLE QStringList slideNames(); Q_INVOKABLE int slideNameToIndex(const QString &name); Q_INVOKABLE bool toolTipsEnabled(); - Q_INVOKABLE QColor showColorDialog(const QColor &color); // CPresentationChangeListener void OnNewPresentation() override; diff --git a/src/Authoring/Studio/Palettes/Action/HandlerGenericBaseColor.qml b/src/Authoring/Studio/Palettes/Action/HandlerGenericBaseColor.qml index 2d2c04f3..b0b9b01f 100644 --- a/src/Authoring/Studio/Palettes/Action/HandlerGenericBaseColor.qml +++ b/src/Authoring/Studio/Palettes/Action/HandlerGenericBaseColor.qml @@ -68,7 +68,7 @@ RowLayout { anchors.fill: parent onClicked: { root.listenToColorChanges = true; - root.selectedColor = _parentView.showColorDialog(rect.color); + root.selectedColor = _parentView.showColorDialog(rect.color, instance, handle); root.listenToColorChanges = false; root.colorSelected(); } diff --git a/src/Authoring/Studio/Palettes/Action/HandlerProperty.qml b/src/Authoring/Studio/Palettes/Action/HandlerProperty.qml index ec618624..a101488e 100644 --- a/src/Authoring/Studio/Palettes/Action/HandlerProperty.qml +++ b/src/Authoring/Studio/Palettes/Action/HandlerProperty.qml @@ -249,13 +249,16 @@ ColumnLayout { case AdditionalMetaDataType.None: case AdditionalMetaDataType.Rotation: return xyzPropertyComponent; - case AdditionalMetaDataType.Color: - return colorBox; default: console.warn("KDAB_TODO implement property handler for additional " + "typeDataModelDataType.Float3: ", actionProperty.additionalType); return xyzPropertyComponent; } + case DataModelDataType.Float4: + if (actionProperty.additionalType === AdditionalMetaDataType.Color) + return colorBox; + break; + case DataModelDataType.String: switch (actionProperty.additionalType) { case AdditionalMetaDataType.StringList: diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp index ee6af48f..de29cdc4 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp @@ -1309,6 +1309,11 @@ void InspectorControlModel::updatePropertyValue(InspectorControlBase *element) c element->m_values = QVariant::fromValue<QList<double> >(float3Values); } break; + case qt3dsdm::DataModelDataType::Float4: + if (element->m_propertyType == qt3dsdm::AdditionalMetaDataType::Color) { + element->m_value = qt3dsdm::get<QColor>(value); + } + break; case qt3dsdm::DataModelDataType::Float2: if (element->m_propertyType == qt3dsdm::AdditionalMetaDataType::None) { const QVector2D theFloat2 = qt3dsdm::get<QVector2D>(value); @@ -1813,7 +1818,6 @@ void InspectorControlModel::setPropertyValue(long instance, int handle, const QV // initialize vertex buffers), so the renderer's OpenGL context must be current Q3DStudio::IStudioRenderer &theRenderer(g_StudioApp.getRenderer()); theRenderer.MakeContextCurrent(); - m_UpdatableEditor.EnsureEditor(QObject::tr("Set Property"), __FILE__, __LINE__) .SetInstancePropertyValue(instance, handle, v); diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp index ad980d36..66f8c868 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp @@ -321,7 +321,8 @@ void InspectorControlView::openInInspector() const auto doc = g_StudioApp.GetCore()->GetDoc(); const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge(); qt3dsdm::SValue value; - doc->GetPropertySystem()->GetInstancePropertyValue(m_instance, m_handle, value); + doc->GetPropertySystem()->GetInstancePropertyValue(m_contextMenuInstance, m_contextMenuHandle, + value); qt3dsdm::SLong4 guid = qt3dsdm::get<qt3dsdm::SLong4>(value); const auto instance = bridge->GetInstanceByGUID(guid); doc->SelectDataModelObject(instance); @@ -474,8 +475,8 @@ void InspectorControlView::setInspectable(CInspectableBase *inInspectable) void InspectorControlView::showContextMenu(int x, int y, int handle, int instance) { - m_instance = instance; - m_handle = handle; + m_contextMenuInstance = instance; + m_contextMenuHandle = handle; QMenu theContextMenu; @@ -497,8 +498,8 @@ void InspectorControlView::showContextMenu(int x, int y, int handle, int instanc } theContextMenu.exec(mapToGlobal({x, y})); - m_instance = 0; - m_handle = 0; + m_contextMenuInstance = 0; + m_contextMenuHandle = 0; } // context menu for the variants tags @@ -584,12 +585,12 @@ void InspectorControlView::toggleMasterLink() { Q3DStudio::ScopedDocumentEditor editor(*g_StudioApp.GetCore()->GetDoc(), QObject::tr("Link Property"), __FILE__, __LINE__); - bool wasLinked = editor->IsPropertyLinked(m_instance, m_handle); + bool wasLinked = editor->IsPropertyLinked(m_contextMenuInstance, m_contextMenuHandle); if (wasLinked) - editor->UnlinkProperty(m_instance, m_handle); + editor->UnlinkProperty(m_contextMenuInstance, m_contextMenuHandle); else - editor->LinkProperty(m_instance, m_handle); + editor->LinkProperty(m_contextMenuInstance, m_contextMenuHandle); } void InspectorControlView::setPropertyValueFromFilename(long instance, int handle, @@ -828,13 +829,20 @@ void InspectorControlView::showDataInputChooser(int handle, int instance, const m_activeBrowser.setData(m_dataInputChooserView, handle, instance); } -QColor InspectorControlView::showColorDialog(const QColor &color) +QColor InspectorControlView::showColorDialog(const QColor &color, int instance, int handle) { + bool showAlpha = false; + if (instance && handle) { + auto bridge = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem() + ->GetClientDataModelBridge(); + showAlpha = bridge->getBGColorProperty(instance).GetHandleValue() == handle; + } + m_currentColor = color; CDialogs *dialogs = g_StudioApp.GetDialogs(); connect(dialogs, &CDialogs::onColorChanged, this, &InspectorControlView::dialogCurrentColorChanged); - QColor currentColor = dialogs->displayColorDialog(color); + QColor currentColor = dialogs->displayColorDialog(color, showAlpha); disconnect(dialogs, &CDialogs::onColorChanged, this, &InspectorControlView::dialogCurrentColorChanged); return currentColor; diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h index 29cff25b..75d07d73 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h @@ -75,7 +75,7 @@ public: VariantsGroupModel *variantsModel() const { return m_variantsGroupModel; } Q_INVOKABLE QColor titleColor(int instance = 0, int handle = 0) const; - Q_INVOKABLE QColor showColorDialog(const QColor &color); + Q_INVOKABLE QColor showColorDialog(const QColor &color, int instance = 0, int handle = 0); Q_INVOKABLE void showContextMenu(int x, int y, int handle, int instance); Q_INVOKABLE void showTagContextMenu(int x, int y, const QString &group, const QString &tag); Q_INVOKABLE void showDataInputChooser(int handle, int instance, const QPoint &point); @@ -147,8 +147,8 @@ private: MouseHelper m_mouseHelper; QmlUtils m_qmlUtils; - int m_instance = 0; - int m_handle = 0; + int m_contextMenuInstance = 0; + int m_contextMenuHandle = 0; QSize m_preferredSize; QColor m_currentColor; diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml index 7d059773..ebb56023 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml @@ -504,8 +504,6 @@ Rectangle { model.modelData.title); return null; case DataModelDataType.Float3: - if (modelData.propertyType === AdditionalMetaDataType.Color) - return colorBox; if (modelData.propertyType === AdditionalMetaDataType.Rotation) return xyzPropertyComponent; if (modelData.propertyType === AdditionalMetaDataType.None) @@ -514,6 +512,10 @@ Rectangle { modelData.propertyType, "text ", model.modelData.title); return null; + case DataModelDataType.Float4: + if (modelData.propertyType === AdditionalMetaDataType.Color) + return colorBox; + return null; case DataModelDataType.StringRef: if (modelData.propertyType === AdditionalMetaDataType.None) return materialTypeDropDown; diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp index 73a7bb7d..d89fcc98 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp @@ -195,7 +195,7 @@ float Qt3DSDMTimelineItemProperty::GetMaximumValue() const { float theRetVal = FLT_MIN; do_all(m_Keyframes, std::bind(CompareAndSet, std::placeholders::_1, std::ref(theRetVal), true)); - if (m_Type.first == DataModelDataType::Float3 && m_Type.second == AdditionalMetaDataType::Color) + if (m_Type.first == DataModelDataType::Float4 && m_Type.second == AdditionalMetaDataType::Color) theRetVal = DataModelToColor(theRetVal); return theRetVal; } @@ -205,7 +205,7 @@ float Qt3DSDMTimelineItemProperty::GetMinimumValue() const { float theRetVal = FLT_MAX; do_all(m_Keyframes, std::bind(CompareAndSet, std::placeholders::_1, std::ref(theRetVal), false)); - if (m_Type.first == DataModelDataType::Float3 && m_Type.second == AdditionalMetaDataType::Color) + if (m_Type.first == DataModelDataType::Float4 && m_Type.second == AdditionalMetaDataType::Color) theRetVal = DataModelToColor(theRetVal); return theRetVal; } @@ -286,18 +286,21 @@ float Qt3DSDMTimelineItemProperty::GetChannelValueAtTime(long inChannelIndex, lo thePropertySystem->GetInstancePropertyValue(theParentBinding->GetInstanceHandle(), m_PropertyHandle, theValue); switch (m_Type.first) { - case DataModelDataType::Float3: { + case DataModelDataType::Float4: { if (m_Type.second == AdditionalMetaDataType::Color) { - SFloat3 theFloat3 = qt3dsdm::get<SFloat3>(theValue); - if (inChannelIndex >= 0 && inChannelIndex < 3) - return DataModelToColor(theFloat3[inChannelIndex]); - } else { - SFloat3 theFloat3 = qt3dsdm::get<SFloat3>(theValue); - if (inChannelIndex >= 0 && inChannelIndex < 3) - return theFloat3[inChannelIndex]; + SFloat4 theFloat4 = qt3dsdm::get<SFloat4>(theValue); + if (inChannelIndex >= 0 && inChannelIndex < 4) + return DataModelToColor(theFloat4[inChannelIndex]); } break; } + case DataModelDataType::Float3: { + + SFloat3 theFloat3 = qt3dsdm::get<SFloat3>(theValue); + if (inChannelIndex >= 0 && inChannelIndex < 3) + return theFloat3[inChannelIndex]; + break; + } case DataModelDataType::Float2: { SFloat2 theFloat2 = qt3dsdm::get<SFloat2>(theValue); if (inChannelIndex >= 0 && inChannelIndex < 2) @@ -317,7 +320,7 @@ float Qt3DSDMTimelineItemProperty::GetChannelValueAtTime(long inChannelIndex, lo && inChannelIndex < (long)m_AnimationHandles.size()) { float theValue = theAnimationCore->EvaluateAnimation( m_AnimationHandles[inChannelIndex], Qt3DSDMTimelineKeyframe::GetTimeInSecs(inTime)); - if (m_Type.first == DataModelDataType::Float3 + if (m_Type.first == DataModelDataType::Float4 && m_Type.second == AdditionalMetaDataType::Color) theValue = DataModelToColor(theValue); diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp index 0cf78a30..0ecefefd 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp @@ -61,7 +61,7 @@ Qt3DSDMTimelineTimebar::Qt3DSDMTimelineTimebar( qt3dsdm::SValue theValue; if (m_PropertySystem->GetInstancePropertyValue( m_DataHandle, theClientDataModelBridge->GetSceneAsset().m_TimebarColor, theValue)) { - qt3dsdm::SFloat3 theTimebarColor = qt3dsdm::get<qt3dsdm::SFloat3>(theValue); + qt3dsdm::SFloat4 theTimebarColor = qt3dsdm::get<qt3dsdm::SFloat4>(theValue); m_Color.SetRGB(static_cast<int>(theTimebarColor.m_Floats[0] * 255.0f), static_cast<int>(theTimebarColor.m_Floats[1] * 255.0f), @@ -90,7 +90,7 @@ void Qt3DSDMTimelineTimebar::OnPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle in if (m_PropertySystem->GetInstancePropertyValue( m_DataHandle, theClientDataModelBridge->GetSceneAsset().m_TimebarColor, theValue)) { - qt3dsdm::SFloat3 theTimebarColor = qt3dsdm::get<qt3dsdm::SFloat3>(theValue); + qt3dsdm::SFloat4 theTimebarColor = qt3dsdm::get<qt3dsdm::SFloat4>(theValue); m_Color.SetRGB(static_cast<int>(theTimebarColor.m_Floats[0] * 255.0f), static_cast<int>(theTimebarColor.m_Floats[1] * 255.0f), diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp index b84d6018..67b4cea8 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp @@ -388,7 +388,7 @@ bool RowTimeline::isColorProperty() const if (propBinding) { qt3dsdm::TDataTypePair type = propBinding->GetType(); if (m_rowTree->isProperty() - && type.first == qt3dsdm::DataModelDataType::Float3 + && type.first == qt3dsdm::DataModelDataType::Float4 && type.second == qt3dsdm::AdditionalMetaDataType::Color) { return true; } diff --git a/src/Authoring/Studio/Qt3DStudio.pro b/src/Authoring/Studio/Qt3DStudio.pro index 9f3cf2cf..160647c9 100644 --- a/src/Authoring/Studio/Qt3DStudio.pro +++ b/src/Authoring/Studio/Qt3DStudio.pro @@ -363,6 +363,7 @@ SOURCES += \ Palettes/TimelineGraphicsView/ui/TimelineToolbar.cpp \ Palettes/TimelineGraphicsView/ui/TreeHeader.cpp \ Palettes/TimelineGraphicsView/ui/TreeHeaderView.cpp \ + Palettes/TimelineGraphicsView/ui/RowTimelineCommentItem.cpp \ PreviewHelper.cpp \ remotedeploymentsender.cpp \ Render/PathWidget.cpp \ @@ -393,7 +394,6 @@ SOURCES += \ Utils/MouseCursor.cpp \ Utils/ResourceCache.cpp \ Utils/StudioUtils.cpp \ - Utils/SystemPreferences.cpp \ Utils/TickTock.cpp \ Workspace/Dialogs.cpp \ Workspace/Views.cpp \ @@ -406,7 +406,6 @@ SOURCES += \ Palettes/scenecamera/scenecameraview.cpp \ Palettes/scenecamera/scenecamerascrollarea.cpp \ Palettes/scenecamera/scenecameraglwidget.cpp \ - Palettes/TimelineGraphicsView/ui/RowTimelineCommentItem.cpp \ Palettes/Inspector/VariantsGroupModel.cpp \ Palettes/Inspector/VariantsTagModel.cpp \ Palettes/Inspector/VariantTagDialog.cpp \ diff --git a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp index 73981d85..7dbe7288 100644 --- a/src/Authoring/Studio/Render/StudioRendererTranslation.cpp +++ b/src/Authoring/Studio/Render/StudioRendererTranslation.cpp @@ -200,6 +200,16 @@ struct STranslatorDataModelParser } return false; } + bool ParseProperty(Qt3DSDMPropertyHandle inProperty, QT3DSVec4 &outValue) + { + Option<SFloat4> theValue = GetPropertyValue<SFloat4>(inProperty); + if (theValue.hasValue()) { + outValue = QT3DSVec4(theValue->m_Floats[0], theValue->m_Floats[1], + theValue->m_Floats[2], theValue->m_Floats[3]); + return true; + } + return false; + } bool ParseProperty(Qt3DSDMPropertyHandle inProperty, qt3ds::render::CRegisteredString &outValue) { Option<qt3dsdm::TDataStrPtr> theValue = GetPropertyValue<qt3dsdm::TDataStrPtr>(inProperty); @@ -1001,6 +1011,11 @@ inline qt3ds::QT3DSVec3 ToRenderType(const qt3dsdm::SFloat3 &inType) { return qt3ds::QT3DSVec3(inType.m_Floats[0], inType.m_Floats[1], inType.m_Floats[2]); } +inline qt3ds::QT3DSVec4 ToRenderType(const qt3dsdm::SFloat4 &inType) +{ + return qt3ds::QT3DSVec4(inType.m_Floats[0], inType.m_Floats[1], inType.m_Floats[2], + inType.m_Floats[3]); +} struct SDynamicObjectTranslator : public SGraphObjectTranslator { @@ -1092,6 +1107,15 @@ struct SDynamicObjectTranslator : public SGraphObjectTranslator QT3DS_ASSERT(false); } break; + case qt3dsdm::DataModelDataType::Float4: + if (theDefinition.m_DataType + == qt3ds::render::NVRenderShaderDataTypes::QT3DSVec4) { + theItem.SetPropertyValue( + theDefinition, ToRenderType(qt3dsdm::get<qt3dsdm::SFloat4>(theValue))); + } else { + QT3DS_ASSERT(false); + } + break; // Could be either an enum or a texture. case qt3dsdm::DataModelDataType::String: { qt3dsdm::TDataStrPtr theData = qt3dsdm::get<qt3dsdm::TDataStrPtr>(theValue); @@ -1293,6 +1317,20 @@ struct SRenderPluginPropertyUpdateFactory ioUpdates.push_back(SRenderPropertyValueUpdate( inClass.GetPropertyValueInfo(theDec.m_StartOffset + 2).first, value.m_Floats[2])); } + + static void Add(eastl::vector<SRenderPropertyValueUpdate> &ioUpdates, + const qt3dsdm::SFloat4 &value, const SRenderPluginPropertyDeclaration &theDec, + IRenderPluginClass &inClass) + { + ioUpdates.push_back(SRenderPropertyValueUpdate( + inClass.GetPropertyValueInfo(theDec.m_StartOffset).first, value.m_Floats[0])); + ioUpdates.push_back(SRenderPropertyValueUpdate( + inClass.GetPropertyValueInfo(theDec.m_StartOffset + 1).first, value.m_Floats[1])); + ioUpdates.push_back(SRenderPropertyValueUpdate( + inClass.GetPropertyValueInfo(theDec.m_StartOffset + 2).first, value.m_Floats[2])); + ioUpdates.push_back(SRenderPropertyValueUpdate( + inClass.GetPropertyValueInfo(theDec.m_StartOffset + 3).first, value.m_Floats[3])); + } }; struct SRenderPluginTranslator : public SGraphObjectTranslator { @@ -1367,6 +1405,12 @@ struct SRenderPluginTranslator : public SGraphObjectTranslator thePropName, qt3ds::render::SRenderPluginPropertyTypes::Color)); } break; + case DataModelDataType::Float4: + if (theMetaType == AdditionalMetaDataType::Color) { + theClass.RegisterProperty(SRenderPluginPropertyDeclaration( + thePropName, qt3ds::render::SRenderPluginPropertyTypes::Color)); + } + break; case DataModelDataType::Long: theClass.RegisterProperty(SRenderPluginPropertyDeclaration( thePropName, qt3ds::render::SRenderPluginPropertyTypes::Long)); @@ -1415,6 +1459,11 @@ struct SRenderPluginTranslator : public SGraphObjectTranslator thePropValue.getData<SFloat3>(), theDeclaration, theClass); break; + case DataModelDataType::Float4: + SRenderPluginPropertyUpdateFactory::Add(m_PropertyUpdates, + thePropValue.getData<SFloat4>(), + theDeclaration, theClass); + break; case DataModelDataType::Long: SRenderPluginPropertyUpdateFactory::Add( m_PropertyUpdates, thePropValue.getData<qt3ds::QT3DSI32>(), theDeclaration, theClass); @@ -2156,12 +2205,12 @@ void STranslation::PreRender(bool scenePreviewPass) SScene &theScene = static_cast<SScene &>(theSceneTranslator->GetGraphObject()); if (scenePreviewPass) { if (theScene.m_UseClearColor) - m_Context.SetMatteColor(QT3DSVec4(theScene.m_ClearColor, 1.0f)); + m_Context.SetMatteColor(theScene.m_ClearColor); else m_Context.SetMatteColor(QT3DSVec4(0.0f, 0.0f, 0.0f, 1.0f)); } else { if (theScene.m_UseClearColor) - m_Context.SetSceneColor(QT3DSVec4(theScene.m_ClearColor, 1.0f)); + m_Context.SetSceneColor(theScene.m_ClearColor); else m_Context.SetSceneColor(QT3DSVec4(QT3DSVec3(0.0f), 1.0f)); } diff --git a/src/Authoring/Studio/Render/StudioSubPresentationRenderer.cpp b/src/Authoring/Studio/Render/StudioSubPresentationRenderer.cpp index 0af8758a..146d0956 100644 --- a/src/Authoring/Studio/Render/StudioSubPresentationRenderer.cpp +++ b/src/Authoring/Studio/Render/StudioSubPresentationRenderer.cpp @@ -321,10 +321,10 @@ void StudioSubpresentationRenderer::RenderWithClear( const SOffscreenRendererEnvironment &inEnvironment, NVRenderContext &inRenderContext, QT3DSVec2 inPresentationScaleFactor, SScene::RenderClearCommand inColorBufferNeedsClear, - QT3DSVec3 inclearColor, + QT3DSVec4 inclearColor, const SRenderInstanceId instanceId) { - inRenderContext.SetClearColor(QT3DSVec4(inclearColor, 1.0)); + inRenderContext.SetClearColor(inclearColor); Render(inEnvironment, inRenderContext, inPresentationScaleFactor, inColorBufferNeedsClear, instanceId); } diff --git a/src/Authoring/Studio/Render/StudioSubPresentationRenderer.h b/src/Authoring/Studio/Render/StudioSubPresentationRenderer.h index 8be062e1..3ff434e6 100644 --- a/src/Authoring/Studio/Render/StudioSubPresentationRenderer.h +++ b/src/Authoring/Studio/Render/StudioSubPresentationRenderer.h @@ -78,7 +78,7 @@ public: qt3ds::render::NVRenderContext &inRenderContext, qt3ds::render::QT3DSVec2 inPresentationScaleFactor, qt3ds::render::SScene::RenderClearCommand inColorBufferNeedsClear, - qt3ds::render::QT3DSVec3 inclearColor, + qt3ds::render::QT3DSVec4 inclearColor, const qt3ds::render::SRenderInstanceId instanceId) override; qt3ds::render::IGraphObjectPickQuery *GetGraphObjectPickQuery( diff --git a/src/Authoring/Studio/Utils/SystemPreferences.cpp b/src/Authoring/Studio/Utils/SystemPreferences.cpp deleted file mode 100644 index 38a7020b..00000000 --- a/src/Authoring/Studio/Utils/SystemPreferences.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "Qt3DSCommonPrecompile.h" -#include "CColor.h" -#include "SystemPreferences.h" - -#include <QtWidgets/qapplication.h> -#include <QtGui/qpalette.h> - -//============================================================================= -/** - * Destructor - */ -CSystemPreferences::~CSystemPreferences() -{ -} - -//============================================================================= -/** - * Retrieves the system preferred background color. Example use would be for - * the fill color of a button. - */ -QColor CSystemPreferences::GetSystemBackgroundColor() -{ - const auto palette = QApplication::palette(); - return palette.color(QPalette::Active, QPalette::Button); -} - -//============================================================================= -/** - * Returns the color used by the system to indicate that an item is selected. - */ -QColor CSystemPreferences::GetSelectedItemColor() -{ - const auto palette = QApplication::palette(); - return palette.color(QPalette::Active, QPalette::Highlight); -} - -//============================================================================= -/** - * Returns the color of selected text to be displayed on top of GetSelectedItemColor(). - */ -QColor CSystemPreferences::GetSelectedTextColor() -{ - const auto palette = QApplication::palette(); - return palette.color(QPalette::Active, QPalette::HighlightedText); -} - -//============================================================================= -/** - * Supposed to get whether or not anti aliasing should be enabled for a specified - * font size, but the Theme does not seem to include any data on it. If the - * theme starts working in a later release of the OS then this should work. - */ -bool CSystemPreferences::IsFontAntiAliasing(float inFontSize) -{ - Q_UNUSED(inFontSize); - return false; -} - -//============================================================================= -/** - * Scroll bars contain two arrows (up/down or left/right). These can be located - * on either end of the scroll bar, or located next to each other at one end. On - * Mac OS X, this is a system preference. - * @return true if the scroll bar arrows should be next to each other, at one end of the scroll bar - */ -bool CSystemPreferences::AreScrollArrowsAdjacent() -{ - return false; -} diff --git a/src/Authoring/Studio/Utils/SystemPreferences.h b/src/Authoring/Studio/Utils/SystemPreferences.h deleted file mode 100644 index 2d72780e..00000000 --- a/src/Authoring/Studio/Utils/SystemPreferences.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_SYSTEM_PREFERENCES_H -#define INCLUDED_SYSTEM_PREFERENCES_H 1 - -#pragma once - -class CColor; - -class CSystemPreferences -{ -public: - CSystemPreferences(); - virtual ~CSystemPreferences(); - static QColor GetSystemBackgroundColor(); - static QColor GetSelectedItemColor(); - static QColor GetSelectedTextColor(); - static bool IsFontAntiAliasing(float inFontSize); - static bool AreScrollArrowsAdjacent(); -}; - -#endif // INCLUDED_SYSTEM_PREFERENCES_H diff --git a/src/Authoring/Studio/Workspace/Dialogs.cpp b/src/Authoring/Studio/Workspace/Dialogs.cpp index b7119c55..7ba791c4 100644 --- a/src/Authoring/Studio/Workspace/Dialogs.cpp +++ b/src/Authoring/Studio/Workspace/Dialogs.cpp @@ -26,32 +26,22 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "Qt3DSCommonPrecompile.h" -#include "qtAuthoring-config.h" #include "Dialogs.h" #include "StudioApp.h" +#include "Core.h" #include "Doc.h" - +#include "MainFrm.h" #include "InterpolationDlg.h" - #include "Qt3DSMessageBox.h" -#include "StringTokenizer.h" -#include "Preferences.h" #include "ProgressView.h" -#include "Views.h" -#include "MasterP.h" #include "TimeEditDlg.h" #include "DurationEditDlg.h" #include "StudioPreferences.h" #include "ResetKeyframeValuesDlg.h" #include "GLVersionDlg.h" -#include "Core.h" #include "Qt3DSMacros.h" -#include "IDocumentEditor.h" -#include "Qt3DSFileTools.h" #include "ImportUtils.h" -#include "MainFrm.h" #include <QtWidgets/qcolordialog.h> #include <QtWidgets/qfiledialog.h> @@ -65,7 +55,6 @@ #include <QtWidgets/qdialogbuttonbox.h> #include <QtWidgets/qlabel.h> #include <QtWidgets/qstyle.h> -#include <iostream> namespace { @@ -199,8 +188,7 @@ int g_NumAllowedFileReferencesTypes = } /** - * Constructor - * @param inShowGUI true if dialogs should be displayed or piped to std:cout instead + * @param inShowGUI true if dialogs should be displayed or piped to std:cout instead */ CDialogs::CDialogs(bool inShowGUI /*= true*/) : m_ProgressPalette(nullptr) @@ -231,15 +219,10 @@ CDialogs::CDialogs(bool inShowGUI /*= true*/) m_defaultDirForSuffixMap.insert(ext, QStringLiteral("presentations")); } -//============================================================================= -/** - * Destructor - */ CDialogs::~CDialogs() { } -//============================================================================= /** * Displays a dialog asking the user to choose the keyframe interpolation. * @@ -268,7 +251,6 @@ bool CDialogs::PromptForKeyframeInterpolation(float &ioEaseIn, float &ioEaseOut) return theReturnValue; } -//============================================================================= /** * Notify the user that the deletion of an asset has failed. */ @@ -286,17 +268,13 @@ void CDialogs::DisplayAssetDeleteFailed() } } -//============================================================================= -/** - * Get the export choice. - */ +// Get the export choice. Qt3DSFile CDialogs::GetExportChoice(const Q3DStudio::CString &, const Q3DStudio::CString &) { // Need to fix this for windows if we decide to use it return Qt3DSFile("", false, false); } -//============================================================================== /** * Notify that we are unable to refresh the resource. */ @@ -318,7 +296,6 @@ void CDialogs::DisplayRefreshResourceFailed(const QString &inResourceName, } } -//============================================================================= /** * Notify the user that the loading of the requested resource failed. * @@ -553,7 +530,6 @@ void CDialogs::DisplayLoadingPresentationFailed(const QFileInfo &loadFileInfo, } } -//============================================================================== /** * Notify the user that the presentation we tried to save has failed. * @@ -573,7 +549,6 @@ void CDialogs::DisplaySavingPresentationFailed() } } -//============================================================================== /** * Display a message box to indicate failure to overwrite a read-only file * @@ -612,7 +587,6 @@ void CDialogs::DisplayObjectRenamed(const QString &origName, const QString &newN } } -//============================================================================== /** * Displays a Qt3DSMessageBox using the specified parameters. The message box * is modal to the main frame. This provides an easy way to place modal dialogs @@ -931,7 +905,6 @@ bool CDialogs::isProjectFileExtension(const wchar_t *inExt) return IsFileExtension(inExt, wideProjectExts); } -//============================================================================== /** * CreateAllowedTypesString: Creates the string used to determine allowable types * for import or for filereferences @@ -972,7 +945,6 @@ QString CDialogs::CreateAllowedTypesString(Q3DStudio::DocumentEditorFileType::En return theReturnString; } -//============================================================================== /** * Display a error dialog box with the given text string that describes the error. */ @@ -990,7 +962,6 @@ void CDialogs::DisplayKnownErrorDialog(const QString &inErrorText) } } -//============================================================================== /** * Prompt the user to save the document before losing their changes. * This is used when closing, loading or newing up a document when the current @@ -1187,7 +1158,6 @@ QString CDialogs::getExportVariantsDlg() return {}; } -//============================================================================== /** * Prompt the user for a file to create. * @param isProject true: new project, false: new presentation @@ -1202,7 +1172,6 @@ QString CDialogs::GetNewDocumentChoice(const QString &inInitialDirectory, bool i return GetSaveAsChoice(title, isProject); } -//============================================================================== /** * Prompt the user for a file to open. * This will return an invalid file if the user cancels the save dialog. @@ -1227,7 +1196,6 @@ QString CDialogs::GetFileOpenChoice(const QString &inInitialDirectory) return theFile.absoluteFilePath(); } -//============================================================================== /** * Prompt the user to make sure they want to revert the current project. * @return true if they do want to continue with the revert. @@ -1256,7 +1224,6 @@ bool CDialogs::ConfirmRevert() return theConfirmation; } -//============================================================================== /** * Displays a progress screen, if there is not one aleady being shown. The * progress screen doesn't get dismissed until you call @@ -1276,7 +1243,6 @@ void CDialogs::DisplayProgressScreen(const QString &inActionText, } } -//============================================================================== /** * If a loading screen is currently being shown, this function destroys it. You * can show the loading screen again with another call to @@ -1290,7 +1256,6 @@ void CDialogs::DestroyProgressScreen() } } -//============================================================================== /** * Inform the user that the environment variables entered does not match the format * expected, listing down all those settings that are wrong. @@ -1311,7 +1276,6 @@ void CDialogs::DisplayEnvironmentVariablesError(const Q3DStudio::CString &inErro } } -//============================================================================== /** * Reset settings. * Typically inCurrentDocPath is only set when Studio is first launched. @@ -1332,7 +1296,6 @@ bool CDialogs::DisplayResetKeyframeValuesDlg() return theDialog.exec() == QDialog::Accepted; } -//============================================================================== /** * User trying to do a pathological paste, such as pasting a component copied from a different *instance @@ -1354,7 +1317,6 @@ void CDialogs::DisplayPasteFailed() } } -//============================================================================== /** * Video card OpenGL version is too low to be supported. */ @@ -1364,7 +1326,6 @@ void CDialogs::DisplayGLVersionError(const Q3DStudio::CString &inGLVersion, DisplayGLVersionDialog(inGLVersion, inMinVersion, true); } -//============================================================================== /** * Video card OpenGL version is outdated, but could be usable. */ @@ -1454,7 +1415,6 @@ void CDialogs::showWidgetBrowser(QWidget *screenWidget, QWidget *browser, const }); } -//============================================================================== /** * Display the error dialog or warning dialog that OpenGL version is lower than what is *expected @@ -1582,10 +1542,14 @@ QStringList CDialogs::qmlStreamExtensions() return exts; } -QColor CDialogs::displayColorDialog(const QColor &color) const +QColor CDialogs::displayColorDialog(const QColor &color, bool showAlpha) const { QColorDialog theColorDlg; - theColorDlg.setOption(QColorDialog::DontUseNativeDialog, true); + theColorDlg.setOption(QColorDialog::DontUseNativeDialog); + + if (showAlpha) + theColorDlg.setOption(QColorDialog::ShowAlphaChannel); + theColorDlg.setCurrentColor(color); connect(&theColorDlg, &QColorDialog::currentColorChanged, this, &CDialogs::onColorChanged); int result = theColorDlg.exec(); diff --git a/src/Authoring/Studio/Workspace/Dialogs.h b/src/Authoring/Studio/Workspace/Dialogs.h index bbac509f..02f0b8d3 100644 --- a/src/Authoring/Studio/Workspace/Dialogs.h +++ b/src/Authoring/Studio/Workspace/Dialogs.h @@ -27,33 +27,18 @@ ** ****************************************************************************/ -//============================================================================= -// Prefix -//============================================================================= #ifndef INCLUDED_DIALOGS_H -#define INCLUDED_DIALOGS_H 1 +#define INCLUDED_DIALOGS_H -#pragma once - -//============================================================================= -// Includes -//============================================================================= #include "Qt3DSFile.h" #include "StudioObjectTypes.h" #include "Qt3DSMessageBox.h" #include "Qt3DSFileTools.h" -#include "CColor.h" #include "DocumentEditorEnumerations.h" #include <QtWidgets/qmessagebox.h> -//============================================================================= -// Forwards -//============================================================================= class IDoc; -class CStudioApp; -class CControl; -class CDialogControl; class CProgressView; class KeyframeManager; class ITimeChangeCallback; @@ -61,6 +46,7 @@ class ITimeChangeCallback; class CDialogs : public QObject { Q_OBJECT + public: enum ESavePromptResult { CANCEL_OPERATION, @@ -156,7 +142,7 @@ public: int displayOverrideAssetBox(const QString &assetPath); int DisplayChoiceBox(const QString &inTitle, const QString &inText, int inIcon); void DisplayKnownErrorDialog(const QString &inErrorText); - QColor displayColorDialog(const QColor &color) const; + QColor displayColorDialog(const QColor &color, bool showAlpha = false) const; ESavePromptResult PromptForSave(); bool PromptForKeyframeInterpolation(float &ioEaseIn, float &ioEaseOut); @@ -208,11 +194,9 @@ protected: const Q3DStudio::CString &inRecommendedVersion, bool inError); - CProgressView *m_ProgressPalette; - bool m_ShowGUI; - - QString m_LastSaveFile; ///< Path to the file was previously saved - + CProgressView *m_ProgressPalette = nullptr; + bool m_ShowGUI = true; + QString m_LastSaveFile; // Path to the file was previously saved QHash<QString, QString> m_defaultDirForSuffixMap; }; #endif // INCLUDED_DIALOGS_H diff --git a/src/Runtime/Source/datamodel/Qt3DSMetadata.cpp b/src/Runtime/Source/datamodel/Qt3DSMetadata.cpp index 99d7cb8e..03c515e0 100644 --- a/src/Runtime/Source/datamodel/Qt3DSMetadata.cpp +++ b/src/Runtime/Source/datamodel/Qt3DSMetadata.cpp @@ -474,6 +474,17 @@ public: return Empty(); } + Option<qt3ds::QT3DSVec4> GetPropertyValueVector4(TStrTableStr inType, TStrTableStr inProperty, + TStrTableStr inId) override + { + SRuntimeMetaDataPropertyInfo &theInfo(FindProperty(inType, inProperty, inId)); + if (theInfo.m_Value.hasValue()) { + SFloat4 theFloat4 = qt3dsdm::get<SFloat4>(*theInfo.m_Value); + return qt3ds::QT3DSVec4(theFloat4[0], theFloat4[1], theFloat4[2], theFloat4[3]); + } + return Empty(); + } + virtual Option<qt3ds::QT3DSI32> GetPropertyValueLong(TStrTableStr inType, TStrTableStr inProperty, TStrTableStr inId) override { diff --git a/src/Runtime/Source/datamodel/Qt3DSMetadata.h b/src/Runtime/Source/datamodel/Qt3DSMetadata.h index a90d4fd6..ea2d4452 100644 --- a/src/Runtime/Source/datamodel/Qt3DSMetadata.h +++ b/src/Runtime/Source/datamodel/Qt3DSMetadata.h @@ -33,6 +33,7 @@ #include "foundation/Qt3DSRefCounted.h" #include "foundation/Qt3DSOption.h" #include "foundation/Qt3DSVec3.h" +#include "foundation/Qt3DSVec4.h" #include <EASTL/string.h> #include <EASTL/vector.h> #include "foundation/StringTable.h" @@ -226,6 +227,9 @@ public: virtual Option<qt3ds::QT3DSVec3> GetPropertyValueVector3(TStrTableStr inType, TStrTableStr inProperty, TStrTableStr inId = TStrTableStr()) = 0; + virtual Option<qt3ds::QT3DSVec4> GetPropertyValueVector4(TStrTableStr inType, + TStrTableStr inProperty, TStrTableStr inId = TStrTableStr()) = 0; + //============================================================================== /** * Get property value as long diff --git a/src/Runtime/Source/engine/Qt3DSRenderRuntimeBinding.cpp b/src/Runtime/Source/engine/Qt3DSRenderRuntimeBinding.cpp index fd00e647..4ef33604 100644 --- a/src/Runtime/Source/engine/Qt3DSRenderRuntimeBinding.cpp +++ b/src/Runtime/Source/engine/Qt3DSRenderRuntimeBinding.cpp @@ -115,7 +115,7 @@ struct Qt3DSRenderSceneSubPresRenderer : public CSubPresentationRenderer const SRenderInstanceId instanceId) override; void RenderWithClear(const SOffscreenRendererEnvironment &inEnvironment, NVRenderContext &inRenderContext, QT3DSVec2 inPresScale, - SScene::RenderClearCommand inClearBuffer, QT3DSVec3 inClearColor, + SScene::RenderClearCommand inClearBuffer, QT3DSVec4 inClearColor, const SRenderInstanceId instanceId) override; }; @@ -805,7 +805,7 @@ void Qt3DSRenderSceneSubPresRenderer::Render(const SOffscreenRendererEnvironment void Qt3DSRenderSceneSubPresRenderer::RenderWithClear( const SOffscreenRendererEnvironment &inEnvironment, NVRenderContext &inRenderContext, QT3DSVec2 inPresScale, - SScene::RenderClearCommand inClearBuffer, QT3DSVec3 inClearColor, + SScene::RenderClearCommand inClearBuffer, QT3DSVec4 inClearColor, const SRenderInstanceId id) { CSubPresentationRenderer::RenderWithClear(inEnvironment, inRenderContext, @@ -1554,7 +1554,7 @@ struct Qt3DSRenderSceneManager : public Q3DStudio::ISceneManager, if (theFirstScene->m_Presentation->m_Scene && theFirstScene->m_Presentation->m_Scene->m_UseClearColor) { m_Context->m_Context->SetSceneColor( - QT3DSVec4(theFirstScene->m_Presentation->m_Scene->m_ClearColor, 1.0f)); + theFirstScene->m_Presentation->m_Scene->m_ClearColor); } else m_Context->m_Context->SetSceneColor(QT3DSVec4(0.0f, 0.0f, 0.0f, 0.0f)); diff --git a/src/Runtime/Source/engine/Qt3DSRenderRuntimeBindingImplTranslation.cpp b/src/Runtime/Source/engine/Qt3DSRenderRuntimeBindingImplTranslation.cpp index daf6c0f1..8b54e5d5 100644 --- a/src/Runtime/Source/engine/Qt3DSRenderRuntimeBindingImplTranslation.cpp +++ b/src/Runtime/Source/engine/Qt3DSRenderRuntimeBindingImplTranslation.cpp @@ -285,6 +285,23 @@ struct SRuntimePropertyParser } return false; } + template <Qt3DSRenderDirtyFlags::Enum TDirtyType> + bool ParseProperty(QT3DSVec4 &outValue) + { + if (m_Type == Q3DStudio::ATTRIBUTETYPE_FLOAT4) { + QT3DSVec4 newValue(m_Value.m_FLOAT4[0], m_Value.m_FLOAT4[1], m_Value.m_FLOAT4[2], + m_Value.m_FLOAT4[3]); + if (outValue != newValue) { + outValue = newValue; + SetDirty<TDirtyType>(); + return true; + } + } else { + QT3DS_ASSERT(false); + } + return false; + } + template <Qt3DSRenderDirtyFlags::Enum TDirtyType> bool ParseProperty(CRegisteredString &outValue) @@ -453,6 +470,7 @@ struct SRuntimePropertyParser #define Scene_ClearColor_R ATTRIBUTE_BACKGROUNDCOLOR_R #define Scene_ClearColor_G ATTRIBUTE_BACKGROUNDCOLOR_G #define Scene_ClearColor_B ATTRIBUTE_BACKGROUNDCOLOR_B +#define Scene_ClearColor_A ATTRIBUTE_BACKGROUNDCOLOR_A #define Scene_UseClearColor ATTRIBUTE_BGCOLORENABLE #define Node_Rotation ATTRIBUTE_ROTATION #define Node_Rotation_X ATTRIBUTE_ROTATION_X @@ -479,6 +497,7 @@ struct SRuntimePropertyParser #define Layer_ClearColor_R ATTRIBUTE_BACKGROUNDCOLOR_R #define Layer_ClearColor_G ATTRIBUTE_BACKGROUNDCOLOR_G #define Layer_ClearColor_B ATTRIBUTE_BACKGROUNDCOLOR_B +#define Layer_ClearColor_A ATTRIBUTE_BACKGROUNDCOLOR_A #define Layer_Background ATTRIBUTE_BACKGROUND #define Layer_BlendType ATTRIBUTE_BLENDTYPE #define Layer_ProgressiveAAMode ATTRIBUTE_PROGRESSIVEAA @@ -537,14 +556,17 @@ struct SRuntimePropertyParser #define Light_DiffuseColor_R ATTRIBUTE_LIGHTDIFFUSE_R #define Light_DiffuseColor_G ATTRIBUTE_LIGHTDIFFUSE_G #define Light_DiffuseColor_B ATTRIBUTE_LIGHTDIFFUSE_B +#define Light_DiffuseColor_A ATTRIBUTE_LIGHTDIFFUSE_A #define Light_SpecularColor ATTRIBUTE_LIGHTSPECULAR #define Light_SpecularColor_R ATTRIBUTE_LIGHTSPECULAR_R #define Light_SpecularColor_G ATTRIBUTE_LIGHTSPECULAR_G #define Light_SpecularColor_B ATTRIBUTE_LIGHTSPECULAR_B +#define Light_SpecularColor_A ATTRIBUTE_LIGHTSPECULAR_A #define Light_AmbientColor ATTRIBUTE_LIGHTAMBIENT #define Light_AmbientColor_R ATTRIBUTE_LIGHTAMBIENT_R #define Light_AmbientColor_G ATTRIBUTE_LIGHTAMBIENT_G #define Light_AmbientColor_B ATTRIBUTE_LIGHTAMBIENT_B +#define Light_AmbientColor_A ATTRIBUTE_LIGHTAMBIENT_A #define Light_Brightness ATTRIBUTE_BRIGHTNESS #define Light_LinearFade ATTRIBUTE_LINEARFADE #define Light_ExponentialFade ATTRIBUTE_EXPFADE @@ -572,6 +594,7 @@ struct SRuntimePropertyParser #define Material_DiffuseColor_R ATTRIBUTE_DIFFUSE_R #define Material_DiffuseColor_G ATTRIBUTE_DIFFUSE_G #define Material_DiffuseColor_B ATTRIBUTE_DIFFUSE_B +#define Material_DiffuseColor_A ATTRIBUTE_DIFFUSE_A #define Material_DiffuseMaps_0 ATTRIBUTE_DIFFUSEMAP #define Material_DiffuseMaps_1 ATTRIBUTE_DIFFUSEMAP2 #define Material_DiffuseMaps_2 ATTRIBUTE_DIFFUSEMAP3 @@ -580,6 +603,7 @@ struct SRuntimePropertyParser #define Material_EmissiveColor_R ATTRIBUTE_EMISSIVECOLOR_R #define Material_EmissiveColor_G ATTRIBUTE_EMISSIVECOLOR_G #define Material_EmissiveColor_B ATTRIBUTE_EMISSIVECOLOR_B +#define Material_EmissiveColor_A ATTRIBUTE_EMISSIVECOLOR_A #define Material_EmissiveMap ATTRIBUTE_EMISSIVEMAP #define Material_EmissiveMap2 ATTRIBUTE_EMISSIVEMAP2 #define Material_SpecularReflection ATTRIBUTE_SPECULARREFLECTION @@ -589,6 +613,7 @@ struct SRuntimePropertyParser #define Material_SpecularTint_R ATTRIBUTE_SPECULARTINT_R #define Material_SpecularTint_G ATTRIBUTE_SPECULARTINT_G #define Material_SpecularTint_B ATTRIBUTE_SPECULARTINT_B +#define Material_SpecularTint_A ATTRIBUTE_SPECULARTINT_A #define Material_IOR ATTRIBUTE_IOR #define Material_FresnelPower ATTRIBUTE_FRESNELPOWER #define Material_SpecularAmount ATTRIBUTE_SPECULARAMOUNT @@ -641,9 +666,11 @@ struct SRuntimePropertyParser #define Text_TextColor_R ATTRIBUTE_TEXTCOLOR_R #define Text_TextColor_G ATTRIBUTE_TEXTCOLOR_G #define Text_TextColor_B ATTRIBUTE_TEXTCOLOR_B +#define Text_TextColor_A ATTRIBUTE_TEXTCOLOR_A #define Text_BackColor_R ATTRIBUTE_BACKCOLOR_R #define Text_BackColor_G ATTRIBUTE_BACKCOLOR_G #define Text_BackColor_B ATTRIBUTE_BACKCOLOR_B +#define Text_BackColor_A ATTRIBUTE_BACKCOLOR_A #define Text_UseBackColor ATTRIBUTE_USEBACKCOLOR #define Text_EnableAcceleratedFont ATTRIBUTE_ENABLEACCELERATEDFONT #define Path_PathType ATTRIBUTE_PATHTYPE @@ -664,121 +691,124 @@ struct SRuntimePropertyParser #define SubPath_Closed ATTRIBUTE_CLOSED // Fill in implementations for the actual parse tables. -#define HANDLE_QT3DS_RENDER_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ break; -#define HANDLE_QT3DS_RENDER_VEC3_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_VEC3_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name##_X: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.x); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.x); \ break; \ case Q3DStudio::type##_##name##_Y: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.y); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.y); \ break; \ case Q3DStudio::type##_##name##_Z: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.z); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.z); \ break; -#define HANDLE_QT3DS_RENDER_REAL_VEC2_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_REAL_VEC2_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name##_X: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.x); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.x); \ break; \ case Q3DStudio::type##_##name##_Y: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.y); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.y); \ break; -#define HANDLE_QT3DS_RENDER_COLOR_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_COLOR_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name##_R: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.x); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.x); \ break; \ case Q3DStudio::type##_##name##_G: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.y); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.y); \ break; \ case Q3DStudio::type##_##name##_B: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.z); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.z); \ + break; \ + case Q3DStudio::type##_##name##_A: \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.w); \ break; -#define HANDLE_QT3DS_RENDER_COLOR_VEC3_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_COLOR_VEC3_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ break; -#define HANDLE_QT3DS_RENDER_TRANSFORM_VEC3_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_TRANSFORM_VEC3_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ break; -#define HANDLE_QT3DS_RENDER_RADIAN_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_RADIAN_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name: \ - inParser.ParseRadianProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ + inParser.ParseRadianProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ break; // The runtime converts rotations for us. -#define HANDLE_QT3DS_RENDER_VEC3_RADIAN_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_VEC3_RADIAN_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name##_X: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.x); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.x); \ break; \ case Q3DStudio::type##_##name##_Y: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.y); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.y); \ break; \ case Q3DStudio::type##_##name##_Z: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.z); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.z); \ break; -#define HANDLE_QT3DS_RENDER_OPACITY_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_OPACITY_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name: \ - inParser.ParseOpacityProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ + inParser.ParseOpacityProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ break; -#define HANDLE_QT3DS_ROTATION_ORDER_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_ROTATION_ORDER_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name: \ - inParser.ParseRotationOrder<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ + inParser.ParseRotationOrder<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ break; -#define HANDLE_QT3DS_NODE_ORIENTATION_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_NODE_ORIENTATION_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name: \ - inParser.ParseOrientation<Qt3DSRenderDirtyFlags::dirty>(theItem.m_Flags); \ + inParser.ParseOrientation<Qt3DSRenderDirtyFlags::dirty>(theItem.m_Flags); \ break; -#define HANDLE_QT3DS_RENDER_DEPTH_TEST_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_DEPTH_TEST_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name: \ - inParser.ParseInverseBoolean<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ + inParser.ParseInverseBoolean<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ break; -#define HANDLE_QT3DS_NODE_FLAGS_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_NODE_FLAGS_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name: \ - inParser.ParseNodeFlagsProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_Flags, \ + inParser.ParseNodeFlagsProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_Flags, \ NodeFlagValues::name); \ break; -#define HANDLE_QT3DS_NODE_FLAGS_INVERSE_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_NODE_FLAGS_INVERSE_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name: \ - inParser.ParseNodeFlagsInverseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_Flags, \ + inParser.ParseNodeFlagsInverseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_Flags, \ NodeFlagValues::name); \ break; -#define HANDLE_QT3DS_RENDER_ENUM_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_ENUM_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name: \ - inParser.ParseEnumProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ + inParser.ParseEnumProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ break; -#define HANDLE_QT3DS_RENDER_SOURCEPATH_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_SOURCEPATH_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name: \ - inParser.ParseAndResolveSourcePath<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ + inParser.ParseAndResolveSourcePath<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name); \ break; -#define HANDLE_QT3DS_RENDER_ARRAY_PROPERTY(type, name, index, dirty) \ +#define HANDLE_QT3DS_RENDER_ARRAY_PROPERTY(type, name, index, dirty) \ case Q3DStudio::type##_##name##_##index: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name[index]); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name[index]); \ break; -#define HANDLE_QT3DS_RENDER_VEC2_PROPERTY(type, name, dirty) \ +#define HANDLE_QT3DS_RENDER_VEC2_PROPERTY(type, name, dirty) \ case Q3DStudio::type##_##name##_X: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.x); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.x); \ break; \ case Q3DStudio::type##_##name##_Y: \ - inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.y); \ + inParser.ParseProperty<Qt3DSRenderDirtyFlags::dirty>(theItem.m_##name.y); \ break; struct SSceneTranslator : public Qt3DSTranslator diff --git a/src/Runtime/Source/runtime/Qt3DSAttributeHashes.cpp b/src/Runtime/Source/runtime/Qt3DSAttributeHashes.cpp index 1409901f..995b5704 100644 --- a/src/Runtime/Source/runtime/Qt3DSAttributeHashes.cpp +++ b/src/Runtime/Source/runtime/Qt3DSAttributeHashes.cpp @@ -96,14 +96,17 @@ const char *GetAttributeString(const EAttribute inAttribute) case ATTRIBUTE_LIGHTDIFFUSE_R: return "lightdiffuse.r"; case ATTRIBUTE_LIGHTDIFFUSE_G: return "lightdiffuse.g"; case ATTRIBUTE_LIGHTDIFFUSE_B: return "lightdiffuse.b"; - case ATTRIBUTE_LIGHTAMBIENT_R: return "lightambient.r"; + case ATTRIBUTE_LIGHTDIFFUSE_A: return "lightdiffuse.a"; case ATTRIBUTE_LIGHTAMBIENT: return "lightambient"; + case ATTRIBUTE_LIGHTAMBIENT_R: return "lightambient.r"; case ATTRIBUTE_LIGHTAMBIENT_G: return "lightambient.g"; case ATTRIBUTE_LIGHTAMBIENT_B: return "lightambient.b"; + case ATTRIBUTE_LIGHTAMBIENT_A: return "lightambient.a"; case ATTRIBUTE_LIGHTSPECULAR: return "lightspecular"; case ATTRIBUTE_LIGHTSPECULAR_R: return "lightspecular.r"; case ATTRIBUTE_LIGHTSPECULAR_G: return "lightspecular.g"; case ATTRIBUTE_LIGHTSPECULAR_B: return "lightspecular.b"; + case ATTRIBUTE_LIGHTSPECULAR_A: return "lightspecular.a"; case ATTRIBUTE_AREAWIDTH: return "areawidth"; case ATTRIBUTE_AREAHEIGHT: return "areaheight"; case ATTRIBUTE_CASTSHADOW: return "castshadow"; @@ -123,16 +126,19 @@ const char *GetAttributeString(const EAttribute inAttribute) case ATTRIBUTE_EMISSIVECOLOR_R: return "emissivecolor.r"; case ATTRIBUTE_EMISSIVECOLOR_G: return "emissivecolor.g"; case ATTRIBUTE_EMISSIVECOLOR_B: return "emissivecolor.b"; + case ATTRIBUTE_EMISSIVECOLOR_A: return "emissivecolor.a"; case ATTRIBUTE_DIFFUSE: return "diffuse"; case ATTRIBUTE_DIFFUSE_R: return "diffuse.r"; case ATTRIBUTE_DIFFUSE_G: return "diffuse.g"; case ATTRIBUTE_DIFFUSE_B: return "diffuse.b"; + case ATTRIBUTE_DIFFUSE_A: return "diffuse.a"; case ATTRIBUTE_SPECULARMAP: return "specularmap"; case ATTRIBUTE_SPECULARMODEL: return "specularmodel"; case ATTRIBUTE_SPECULARTINT: return "speculartint"; case ATTRIBUTE_SPECULARTINT_R: return "speculartint.r"; case ATTRIBUTE_SPECULARTINT_G: return "speculartint.g"; case ATTRIBUTE_SPECULARTINT_B: return "speculartint.b"; + case ATTRIBUTE_SPECULARTINT_A: return "speculartint.a"; case ATTRIBUTE_IOR: return "ior"; case ATTRIBUTE_FRESNELPOWER: return "fresnelPower"; case ATTRIBUTE_SPECULARAMOUNT: return "specularamount"; @@ -215,6 +221,7 @@ const char *GetAttributeString(const EAttribute inAttribute) case ATTRIBUTE_TEXTCOLOR_R: return "textcolor.r"; case ATTRIBUTE_TEXTCOLOR_G: return "textcolor.g"; case ATTRIBUTE_TEXTCOLOR_B: return "textcolor.b"; + case ATTRIBUTE_TEXTCOLOR_A: return "textcolor.a"; case ATTRIBUTE_SIZE: return "size"; case ATTRIBUTE_FONT: return "font"; case ATTRIBUTE_DROPSHADOW: return "dropshadow"; @@ -235,6 +242,7 @@ const char *GetAttributeString(const EAttribute inAttribute) case ATTRIBUTE_BACKCOLOR_R: return "backcolor.r"; case ATTRIBUTE_BACKCOLOR_G: return "backcolor.g"; case ATTRIBUTE_BACKCOLOR_B: return "backcolor.b"; + case ATTRIBUTE_BACKCOLOR_A: return "backcolor.a"; case ATTRIBUTE_TEXTTYPE: return "texttype"; case ATTRIBUTE_USEBACKCOLOR: return "usebackcolor"; case ATTRIBUTE_WORDWRAP: return "wordwrap"; @@ -254,6 +262,7 @@ const char *GetAttributeString(const EAttribute inAttribute) case ATTRIBUTE_BACKGROUNDCOLOR_R: return "backgroundcolor.r"; case ATTRIBUTE_BACKGROUNDCOLOR_G: return "backgroundcolor.g"; case ATTRIBUTE_BACKGROUNDCOLOR_B: return "backgroundcolor.b"; + case ATTRIBUTE_BACKGROUNDCOLOR_A: return "backgroundcolor.a"; case ATTRIBUTE_PATHTYPE: return "pathtype"; case ATTRIBUTE_LINEARERROR: return "linearerror"; case ATTRIBUTE_EDGETESSAMOUNT: return "edgetessamount"; diff --git a/src/Runtime/Source/runtime/Qt3DSAttributeHashes.h b/src/Runtime/Source/runtime/Qt3DSAttributeHashes.h index 02dda069..3cbc165a 100644 --- a/src/Runtime/Source/runtime/Qt3DSAttributeHashes.h +++ b/src/Runtime/Source/runtime/Qt3DSAttributeHashes.h @@ -87,14 +87,17 @@ enum EAttribute { ATTRIBUTE_LIGHTDIFFUSE_R = 0x035AAB10, // lightdiffuse.r ATTRIBUTE_LIGHTDIFFUSE_G = 0x034FA85B, // lightdiffuse.g ATTRIBUTE_LIGHTDIFFUSE_B = 0x034AA720, // lightdiffuse.b - ATTRIBUTE_LIGHTAMBIENT_R = 0x0179AD1A, // lightambient.r + ATTRIBUTE_LIGHTDIFFUSE_A = 0x0349A6E1, // lightdiffuse.a ATTRIBUTE_LIGHTAMBIENT = 0x00DA56DE, // lightambient + ATTRIBUTE_LIGHTAMBIENT_R = 0x0179AD1A, // lightambient.r ATTRIBUTE_LIGHTAMBIENT_G = 0x016EAA65, // lightambient.g ATTRIBUTE_LIGHTAMBIENT_B = 0x0169A92A, // lightambient.b + ATTRIBUTE_LIGHTAMBIENT_A = 0x0168A8EB, // lightambient.a ATTRIBUTE_LIGHTSPECULAR = 0x03E39A07, // lightspecular ATTRIBUTE_LIGHTSPECULAR_R = 0x0241EBC3, // lightspecular.r ATTRIBUTE_LIGHTSPECULAR_G = 0x0236E90E, // lightspecular.g ATTRIBUTE_LIGHTSPECULAR_B = 0x0231E7D3, // lightspecular.b + ATTRIBUTE_LIGHTSPECULAR_A = 0x0230E794, // lightspecular.a ATTRIBUTE_AREAWIDTH = 0x005A8BE7, // areawidth ATTRIBUTE_AREAHEIGHT = 0x00334D2C, // areaheight ATTRIBUTE_CASTSHADOW = 0x0335FD81, // castshadow @@ -114,16 +117,19 @@ enum EAttribute { ATTRIBUTE_EMISSIVECOLOR_R = 0x039B87D0, // emissivecolor.r ATTRIBUTE_EMISSIVECOLOR_G = 0x0390851B, // emissivecolor.g ATTRIBUTE_EMISSIVECOLOR_B = 0x038B83E0, // emissivecolor.b + ATTRIBUTE_EMISSIVECOLOR_A = 0x038A83A1, // emissivecolor.a ATTRIBUTE_DIFFUSE = 0x0105521E, // diffuse ATTRIBUTE_DIFFUSE_R = 0x015B085A, // diffuse.r ATTRIBUTE_DIFFUSE_G = 0x015005A5, // diffuse.g ATTRIBUTE_DIFFUSE_B = 0x014B046A, // diffuse.b + ATTRIBUTE_DIFFUSE_A = 0x014A042B, // diffuse.a ATTRIBUTE_SPECULARMAP = 0x034CD047, // specularmap ATTRIBUTE_SPECULARMODEL = 0x039EBE5A, // specularmodel ATTRIBUTE_SPECULARTINT = 0x03535E02, // speculartint ATTRIBUTE_SPECULARTINT_R = 0x0399623E, // speculartint.r ATTRIBUTE_SPECULARTINT_G = 0x038E5F89, // speculartint.g ATTRIBUTE_SPECULARTINT_B = 0x03895E4E, // speculartint.b + ATTRIBUTE_SPECULARTINT_A = 0x03885E0F, // speculartint.a ATTRIBUTE_IOR = 0x00667354, // ior ATTRIBUTE_FRESNELPOWER = 0x022178B6, // fresnelPower ATTRIBUTE_SPECULARAMOUNT = 0x01144425, // specularamount @@ -206,6 +212,7 @@ enum EAttribute { ATTRIBUTE_TEXTCOLOR_R = 0x00E9F186, // textcolor.r ATTRIBUTE_TEXTCOLOR_G = 0x00DEEED1, // textcolor.g ATTRIBUTE_TEXTCOLOR_B = 0x00D9ED96, // textcolor.b + ATTRIBUTE_TEXTCOLOR_A = 0x00D8ED57, // textcolor.a ATTRIBUTE_SIZE = 0x00F2C81F, // size ATTRIBUTE_FONT = 0x03412331, // font ATTRIBUTE_DROPSHADOW = 0x03E3F231, // dropshadow @@ -226,6 +233,7 @@ enum EAttribute { ATTRIBUTE_BACKCOLOR_R = 0x0290CCE0, // backcolor.r ATTRIBUTE_BACKCOLOR_G = 0x0285CA2B, // backcolor.g ATTRIBUTE_BACKCOLOR_B = 0x0280C8F0, // backcolor.b + ATTRIBUTE_BACKCOLOR_A = 0x027FC8B1, // backcolor.a ATTRIBUTE_TEXTTYPE = 0x0240ADD9, // texttype ATTRIBUTE_USEBACKCOLOR = 0x0243BACB, // usebackcolor ATTRIBUTE_WORDWRAP = 0x0134B04C, // wordwrap @@ -245,6 +253,7 @@ enum EAttribute { ATTRIBUTE_BACKGROUNDCOLOR_R = 0x02AF0767, // backgroundcolor.r ATTRIBUTE_BACKGROUNDCOLOR_G = 0x02A404B2, // backgroundcolor.g ATTRIBUTE_BACKGROUNDCOLOR_B = 0x029F0377, // backgroundcolor.b + ATTRIBUTE_BACKGROUNDCOLOR_A = 0x029E0338, // backgroundcolor.a ATTRIBUTE_PATHTYPE = 0x02D2A5E1, // pathtype ATTRIBUTE_LINEARERROR = 0x0378A51D, // linearerror ATTRIBUTE_EDGETESSAMOUNT = 0x02577E3A, // edgetessamount diff --git a/src/Runtime/Source/runtime/Qt3DSAttributeHashes.txt b/src/Runtime/Source/runtime/Qt3DSAttributeHashes.txt index 7c38c875..8eec133f 100644 --- a/src/Runtime/Source/runtime/Qt3DSAttributeHashes.txt +++ b/src/Runtime/Source/runtime/Qt3DSAttributeHashes.txt @@ -48,14 +48,17 @@ lightdiffuse lightdiffuse.r lightdiffuse.g lightdiffuse.b -lightambient.r +lightdiffuse.a lightambient +lightambient.r lightambient.g lightambient.b +lightambient.a lightspecular lightspecular.r lightspecular.g lightspecular.b +lightspecular.a areawidth areaheight castshadow @@ -78,16 +81,19 @@ emissivecolor emissivecolor.r emissivecolor.g emissivecolor.b +emissivecolor.a diffuse diffuse.r diffuse.g diffuse.b +diffuse.a specularmap specularmodel speculartint speculartint.r speculartint.g speculartint.b +speculartint.a ior fresnelPower specularamount @@ -173,6 +179,7 @@ textcolor textcolor.r textcolor.g textcolor.b +textcolor.a size font dropshadow @@ -193,6 +200,7 @@ textstring backcolor.r backcolor.g backcolor.b +backcolor.a texttype usebackcolor wordwrap @@ -214,6 +222,7 @@ background backgroundcolor.r backgroundcolor.g backgroundcolor.b +backgroundcolor.a pathtype linearerror diff --git a/src/Runtime/Source/runtime/Qt3DSKernelTypes.h b/src/Runtime/Source/runtime/Qt3DSKernelTypes.h index db290996..0ad4ec61 100644 --- a/src/Runtime/Source/runtime/Qt3DSKernelTypes.h +++ b/src/Runtime/Source/runtime/Qt3DSKernelTypes.h @@ -86,6 +86,7 @@ enum EAttributeType { ATTRIBUTETYPE_ELEMENTREF, ATTRIBUTETYPE_DATADRIVEN_PARENT, ATTRIBUTETYPE_DATADRIVEN_CHILD, + ATTRIBUTETYPE_FLOAT4, ATTRIBUTETYPE_FLOAT3, ATTRIBUTETYPE_FLOAT2, ATTRIBUTETYPE_DATAINPUT_TIMELINE, @@ -211,13 +212,14 @@ struct SClone /// Each element has a number of attributes associated with it - This is the value. union UVariant { - INT32 m_INT32; ///< Integer representation - FLOAT m_FLOAT; ///< Float representation - THashValue m_Hash; ///< Explicit hash representation - UINT32 m_StringHandle; ///< Handle into the IStringTable member of the presentation - void *m_VoidPointer; ///< Generic data Pointer - UINT32 m_ElementHandle; ///< Element handle. Resolve using IApplication object. - FLOAT m_FLOAT3[3]; ///< Vector 3 representation + INT32 m_INT32; // Integer representation + FLOAT m_FLOAT; // Float representation + THashValue m_Hash; // Explicit hash representation + UINT32 m_StringHandle; // Handle into the IStringTable member of the presentation + void *m_VoidPointer; // Generic data Pointer + UINT32 m_ElementHandle; // Element handle. Resolve using IApplication object. + FLOAT m_FLOAT3[3]; // Vector 3 representation + FLOAT m_FLOAT4[4]; // Vector 4 representation }; } // namespace Q3DStudio diff --git a/src/Runtime/Source/runtimerender/Qt3DSDistanceFieldRenderer.cpp b/src/Runtime/Source/runtimerender/Qt3DSDistanceFieldRenderer.cpp index 2562ea79..c75c26ee 100644 --- a/src/Runtime/Source/runtimerender/Qt3DSDistanceFieldRenderer.cpp +++ b/src/Runtime/Source/runtimerender/Qt3DSDistanceFieldRenderer.cpp @@ -938,13 +938,11 @@ void Q3DSDistanceFieldRenderer::renderText(SText &text, const QT3DSMat44 &mvp, int(textureDetails.m_Width), int(textureDetails.m_Height), glyphInfo.fontScale * float(m_pixelRatio), QT3DSVec2(glyphInfo.shadowOffsetX, glyphInfo.shadowOffsetY), - QT3DSVec4(text.m_TextColor, 1), - shadowColor); + text.m_TextColor, shadowColor); } else { renderMesh(mesh.inputAssembler, it.key()->texture, mvp, modelView, int(textureDetails.m_Width), int(textureDetails.m_Height), - glyphInfo.fontScale * float(m_pixelRatio), - QT3DSVec4(text.m_TextColor, 1)); + glyphInfo.fontScale * float(m_pixelRatio), text.m_TextColor); } m_renderedGlyphs += glyphHashValue; diff --git a/src/Runtime/Source/runtimerender/Qt3DSOffscreenRenderManager.h b/src/Runtime/Source/runtimerender/Qt3DSOffscreenRenderManager.h index 57dcf430..6d821624 100644 --- a/src/Runtime/Source/runtimerender/Qt3DSOffscreenRenderManager.h +++ b/src/Runtime/Source/runtimerender/Qt3DSOffscreenRenderManager.h @@ -170,7 +170,7 @@ namespace render { virtual void RenderWithClear(const SOffscreenRendererEnvironment &inEnvironment, NVRenderContext &inRenderContext, QT3DSVec2 inPresentationScaleFactor, SScene::RenderClearCommand inColorBufferNeedsClear, - QT3DSVec3 inclearColor, + QT3DSVec4 inclearColor, const SRenderInstanceId instanceId) = 0; // Implementors should implement one of the two interfaces below. diff --git a/src/Runtime/Source/runtimerender/Qt3DSOldNBustedRenderPlugin.h b/src/Runtime/Source/runtimerender/Qt3DSOldNBustedRenderPlugin.h index 86f20a78..2753bac6 100644 --- a/src/Runtime/Source/runtimerender/Qt3DSOldNBustedRenderPlugin.h +++ b/src/Runtime/Source/runtimerender/Qt3DSOldNBustedRenderPlugin.h @@ -74,7 +74,7 @@ namespace render { NVRenderContext &/*inRenderContext*/, QT3DSVec2 /*inPresentationScaleFactor*/, SScene::RenderClearCommand /*inColorBufferNeedsClear*/, - QT3DSVec3 /*inclearColor*/, + QT3DSVec4 /*inclearColor*/, const SRenderInstanceId /*instanceId*/) override {} IGraphObjectPickQuery *GetGraphObjectPickQuery(const SRenderInstanceId instanceId) override { diff --git a/src/Runtime/Source/runtimerender/Qt3DSRenderCustomMaterialShaderGenerator.cpp b/src/Runtime/Source/runtimerender/Qt3DSRenderCustomMaterialShaderGenerator.cpp index fe6a6dc3..065a8383 100644 --- a/src/Runtime/Source/runtimerender/Qt3DSRenderCustomMaterialShaderGenerator.cpp +++ b/src/Runtime/Source/runtimerender/Qt3DSRenderCustomMaterialShaderGenerator.cpp @@ -83,8 +83,10 @@ struct SShaderLightProperties m_LightData.m_direction = QT3DSVec4(dir, 0.0); float normalizedBrightness = inLight->m_Brightness / 100.0f; - m_LightData.m_diffuse = QT3DSVec4(inLight->m_DiffuseColor * normalizedBrightness, 1.0); - m_LightData.m_specular = QT3DSVec4(inLight->m_SpecularColor * normalizedBrightness, 1.0); + m_LightData.m_diffuse = QT3DSVec4(inLight->m_DiffuseColor.getXYZ() * normalizedBrightness, + inLight->m_DiffuseColor.w); + m_LightData.m_specular = QT3DSVec4(inLight->m_SpecularColor.getXYZ() * normalizedBrightness, + inLight->m_DiffuseColor.w); if (inLight->m_LightType == RenderLightTypes::Area) { m_LightData.m_width = inLight->m_AreaWidth; @@ -102,7 +104,7 @@ struct SShaderLightProperties m_LightData.m_up = QT3DSVec4(0.0f); // These components only apply to CG lights - m_LightData.m_ambient = QT3DSVec4(inLight->m_AmbientColor, 1.0); + m_LightData.m_ambient = inLight->m_AmbientColor; m_LightData.m_constantAttenuation = 1.0; m_LightData.m_linearAttenuation = inLight->m_LinearFade; diff --git a/src/Runtime/Source/runtimerender/Qt3DSRenderDefaultMaterialShaderGenerator.cpp b/src/Runtime/Source/runtimerender/Qt3DSRenderDefaultMaterialShaderGenerator.cpp index 4dceaca8..18c71e34 100644 --- a/src/Runtime/Source/runtimerender/Qt3DSRenderDefaultMaterialShaderGenerator.cpp +++ b/src/Runtime/Source/runtimerender/Qt3DSRenderDefaultMaterialShaderGenerator.cpp @@ -103,7 +103,7 @@ struct SShaderTextureProperties struct SShaderLightProperties { // Color of the light - QT3DSVec3 m_LightColor; + QT3DSVec4 m_LightColor; SLightSourceShader m_LightData; SShaderLightProperties() {} @@ -1583,7 +1583,7 @@ struct SShaderGenerator : public IDefaultMaterialShaderGenerator // update the constant buffer shader.m_AoShadowParams.Set(); // We can't cache light properties because they can change per object. - QT3DSVec3 theLightAmbientTotal = QT3DSVec3(0, 0, 0); + QT3DSVec4 theLightAmbientTotal = QT3DSVec4(0, 0, 0, 1); size_t numShaderLights = shader.m_Lights.size(); size_t numShadowLights = shader.m_ShadowMaps.size(); for (QT3DSU32 lightIdx = 0, shadowMapIdx = 0, lightEnd = inLights.size(); @@ -1609,9 +1609,10 @@ struct SShaderGenerator : public IDefaultMaterialShaderGenerator float brightness = TranslateConstantAttenuation(theLight->m_Brightness); // setup light data - theLightProperties.m_LightColor = theLight->m_DiffuseColor * brightness; + theLightProperties.m_LightColor = + QT3DSVec4(theLight->m_DiffuseColor.getXYZ() * brightness, 1.0); theLightProperties.m_LightData.m_specular = - QT3DSVec4(theLight->m_SpecularColor * brightness, 1.0); + QT3DSVec4(theLight->m_SpecularColor.getXYZ() * brightness, 1.0); theLightProperties.m_LightData.m_direction = QT3DSVec4(inLightDirections[lightIdx], 1.0); // TODO : This does potentially mean that we can create more shadow map entries than @@ -1659,7 +1660,7 @@ struct SShaderGenerator : public IDefaultMaterialShaderGenerator } theLightAmbientTotal += theLight->m_AmbientColor; } - shader.m_LightAmbientTotal = theLightAmbientTotal; + shader.m_LightAmbientTotal = theLightAmbientTotal.getXYZ(); } // Also sets the blend function on the render context. @@ -1768,7 +1769,7 @@ struct SShaderGenerator : public IDefaultMaterialShaderGenerator inMaterial.m_EmissiveColor[1] * emissivePower, inMaterial.m_EmissiveColor[2] * emissivePower, inOpacity); shader.m_MaterialDiffuse.Set(material_diffuse); - shader.m_DiffuseColor.Set(inMaterial.m_DiffuseColor); + shader.m_DiffuseColor.Set(inMaterial.m_DiffuseColor.getXYZ()); QT3DSVec4 material_specular = QT3DSVec4(inMaterial.m_SpecularTint[0], inMaterial.m_SpecularTint[1], inMaterial.m_SpecularTint[2], inMaterial.m_IOR); diff --git a/src/Runtime/Source/runtimerender/Qt3DSRenderPlugin.cpp b/src/Runtime/Source/runtimerender/Qt3DSRenderPlugin.cpp index 046f1b1b..f8c11494 100644 --- a/src/Runtime/Source/runtimerender/Qt3DSRenderPlugin.cpp +++ b/src/Runtime/Source/runtimerender/Qt3DSRenderPlugin.cpp @@ -392,7 +392,7 @@ struct InstanceImpl : public IRenderPluginInstance void RenderWithClear(const SOffscreenRendererEnvironment &inEnvironment, NVRenderContext &inRenderContext, QT3DSVec2 inPresScale, - SScene::RenderClearCommand inClearBuffer, QT3DSVec3 inClearColor, + SScene::RenderClearCommand inClearBuffer, QT3DSVec4 inClearColor, const SRenderInstanceId id) { Q_ASSERT(false); diff --git a/src/Runtime/Source/runtimerender/Qt3DSRenderSubpresentation.cpp b/src/Runtime/Source/runtimerender/Qt3DSRenderSubpresentation.cpp index cd83f036..0b9d42d3 100644 --- a/src/Runtime/Source/runtimerender/Qt3DSRenderSubpresentation.cpp +++ b/src/Runtime/Source/runtimerender/Qt3DSRenderSubpresentation.cpp @@ -99,7 +99,7 @@ namespace render { void CSubPresentationRenderer::RenderWithClear( const SOffscreenRendererEnvironment &inEnvironment, NVRenderContext &inRenderContext, QT3DSVec2 inPresScale, - SScene::RenderClearCommand inClearBuffer, QT3DSVec3 inClearColor, + SScene::RenderClearCommand inClearBuffer, QT3DSVec4 inClearColor, const SRenderInstanceId id) { Q_UNUSED(inEnvironment); diff --git a/src/Runtime/Source/runtimerender/Qt3DSRenderSubpresentation.h b/src/Runtime/Source/runtimerender/Qt3DSRenderSubpresentation.h index 9eb51450..4adac84f 100644 --- a/src/Runtime/Source/runtimerender/Qt3DSRenderSubpresentation.h +++ b/src/Runtime/Source/runtimerender/Qt3DSRenderSubpresentation.h @@ -83,7 +83,7 @@ namespace render { void RenderWithClear(const SOffscreenRendererEnvironment &inEnvironment, NVRenderContext &inRenderContext, QT3DSVec2 inPresScale, SScene::RenderClearCommand inClearBuffer, - QT3DSVec3 inClearColor, + QT3DSVec4 inClearColor, const SRenderInstanceId instanceId) override; IGraphObjectPickQuery *GetGraphObjectPickQuery(const SRenderInstanceId) override { return &m_PickQuery; } bool Pick(const QT3DSVec2 & /*inMouseCoords*/, const QT3DSVec2 & /*inViewportDimensions*/, diff --git a/src/Runtime/Source/runtimerender/Qt3DSRenderUIPLoader.cpp b/src/Runtime/Source/runtimerender/Qt3DSRenderUIPLoader.cpp index f64efbcc..61b132ba 100644 --- a/src/Runtime/Source/runtimerender/Qt3DSRenderUIPLoader.cpp +++ b/src/Runtime/Source/runtimerender/Qt3DSRenderUIPLoader.cpp @@ -151,6 +151,21 @@ struct WStrOps<SFloat3> reader.ReadRef(NVDataRef<QT3DSF32>(item.m_Floats, 3)); } }; + +template <> +struct WStrOps<SFloat4> +{ + void StrTo(const char8_t *buffer, SFloat4 &item, nvvector<char8_t> &ioTempBuf) + { + QT3DSU32 len = (QT3DSU32)strlen(buffer); + ioTempBuf.resize(len + 1); + memCopy(ioTempBuf.data(), buffer, (len + 1) * sizeof(char8_t)); + MemoryBuffer<RawAllocator> unused; + qt3dsdm::IStringTable *theTable(NULL); + WCharTReader reader(ioTempBuf.begin(), unused, *theTable); + reader.ReadRef(NVDataRef<QT3DSF32>(item.m_Floats, 4)); + } +}; } namespace { @@ -163,6 +178,7 @@ struct IPropertyParser virtual Option<QT3DSF32> ParseFloat(const char8_t *inName) = 0; virtual Option<QT3DSVec2> ParseVec2(const char8_t *inName) = 0; virtual Option<QT3DSVec3> ParseVec3(const char8_t *inName) = 0; + virtual Option<QT3DSVec4> ParseVec4(const char8_t *inName) = 0; virtual Option<bool> ParseBool(const char8_t *inName) = 0; virtual Option<QT3DSU32> ParseU32(const char8_t *inName) = 0; virtual Option<QT3DSI32> ParseI32(const char8_t *inName) = 0; @@ -222,6 +238,15 @@ struct SMetaPropertyParser : public IPropertyParser } return Empty(); } + Option<QT3DSVec4> ParseVec4(const char8_t *inName) override + { + Option<qt3ds::QT3DSVec4> theProperty = + m_MetaData.GetPropertyValueVector4(m_Type, Register(inName), m_ClassId); + if (theProperty.hasValue()) { + return *theProperty; + } + return Empty(); + } Option<bool> ParseBool(const char8_t *inName) override { return m_MetaData.GetPropertyValueBool(m_Type, Register(inName), m_ClassId); @@ -304,6 +329,17 @@ struct SDomReaderPropertyParser : public IPropertyParser } return Empty(); } + Option<QT3DSVec4> ParseVec4(const char8_t *inName) override + { + qt3dsdm::SFloat4 retval; + const char8_t *tempData; + if (m_Reader.UnregisteredAtt(inName, tempData)) { + qt3dsdm::WStrOps<qt3dsdm::SFloat4>().StrTo(tempData, retval, m_TempBuf); + return QT3DSVec4(retval.m_Floats[0], retval.m_Floats[1], retval.m_Floats[2], + retval.m_Floats[3]); + } + return Empty(); + } Option<bool> ParseBool(const char8_t *inName) override { bool retval; @@ -389,6 +425,14 @@ struct SParserHelper<QT3DSVec3> } }; template <> +struct SParserHelper<QT3DSVec4> +{ + static Option<QT3DSVec4> Parse(const char8_t *inName, IPropertyParser &inParser) + { + return inParser.ParseVec4(inName); + } +}; +template <> struct SParserHelper<bool> { static Option<bool> Parse(const char8_t *inName, IPropertyParser &inParser) diff --git a/src/Runtime/Source/runtimerender/Qt3DSRenderer.h b/src/Runtime/Source/runtimerender/Qt3DSRenderer.h index 69a49942..684d15a9 100644 --- a/src/Runtime/Source/runtimerender/Qt3DSRenderer.h +++ b/src/Runtime/Source/runtimerender/Qt3DSRenderer.h @@ -131,7 +131,7 @@ namespace render { bool inRenderSiblings = true, const SRenderInstanceId id = nullptr) = 0; virtual void RenderLayer(SLayer &inLayer, const QT3DSVec2 &inViewportDimensions, bool clear, - QT3DSVec3 clearColor, bool inRenderSiblings = true, + QT3DSVec4 clearColor, bool inRenderSiblings = true, const SRenderInstanceId id = nullptr) = 0; // Studio option to disable picking against sub renderers. This allows better interaction diff --git a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderDefaultMaterial.cpp b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderDefaultMaterial.cpp index 06f3649a..e18a84d2 100644 --- a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderDefaultMaterial.cpp +++ b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderDefaultMaterial.cpp @@ -36,15 +36,15 @@ SDefaultMaterial::SDefaultMaterial() , m_IblProbe(NULL) , m_Lighting(DefaultMaterialLighting::VertexLighting) , m_BlendMode(DefaultMaterialBlendMode::Normal) - , m_DiffuseColor(1, 1, 1) + , m_DiffuseColor(1, 1, 1, 1) , m_EmissivePower(0) , m_EmissiveMap(NULL) , m_EmissiveMap2(NULL) - , m_EmissiveColor(1, 1, 1) + , m_EmissiveColor(1, 1, 1, 1) , m_SpecularReflection(NULL) , m_SpecularMap(NULL) , m_SpecularModel(DefaultMaterialSpecularModel::Default) - , m_SpecularTint(1, 1, 1) + , m_SpecularTint(1, 1, 1, 1) , m_IOR(.2f) , m_FresnelPower(0.0f) , m_SpecularAmount(0) diff --git a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderDefaultMaterial.h b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderDefaultMaterial.h index 09595236..48c8d0ba 100644 --- a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderDefaultMaterial.h +++ b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderDefaultMaterial.h @@ -80,16 +80,16 @@ namespace render { SImage *m_IblProbe; DefaultMaterialLighting::Enum m_Lighting; // defaults to vertex DefaultMaterialBlendMode::Enum m_BlendMode; // defaults to normal - QT3DSVec3 m_DiffuseColor; // colors are 0-1 normalized + QT3DSVec4 m_DiffuseColor; // colors are 0-1 normalized SImage *m_DiffuseMaps[3]; QT3DSF32 m_EmissivePower; // 0-100, defaults to 0 - QT3DSVec3 m_EmissiveColor; + QT3DSVec4 m_EmissiveColor; SImage *m_EmissiveMap; SImage *m_EmissiveMap2; SImage *m_SpecularReflection; SImage *m_SpecularMap; DefaultMaterialSpecularModel::Enum m_SpecularModel; - QT3DSVec3 m_SpecularTint; + QT3DSVec4 m_SpecularTint; QT3DSF32 m_IOR; QT3DSF32 m_FresnelPower; QT3DSF32 m_SpecularAmount; // 0-??, defaults to 0 diff --git a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLayer.cpp b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLayer.cpp index ee146624..36a826cb 100644 --- a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLayer.cpp +++ b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLayer.cpp @@ -41,7 +41,7 @@ SLayer::SLayer() , m_ProgressiveAAMode(AAModeValues::NoAA) , m_MultisampleAAMode(AAModeValues::NoAA) , m_Background(LayerBackground::Transparent) - , m_ClearColor(0) + , m_ClearColor(0.0f) , m_BlendType(LayerBlendTypes::Normal) , m_HorizontalFieldValues(HorizontalFieldValues::LeftWidth) , m_Left(0) diff --git a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLayer.h b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLayer.h index 3759fe12..5c08e917 100644 --- a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLayer.h +++ b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLayer.h @@ -125,7 +125,7 @@ namespace render { AAModeValues::Enum m_ProgressiveAAMode; AAModeValues::Enum m_MultisampleAAMode; LayerBackground::Enum m_Background; - QT3DSVec3 m_ClearColor; + QT3DSVec4 m_ClearColor; LayerBlendTypes::Enum m_BlendType; diff --git a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLight.cpp b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLight.cpp index 3b45e8c9..5c983243 100644 --- a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLight.cpp +++ b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLight.cpp @@ -35,9 +35,9 @@ SLight::SLight() : SNode(GraphObjectTypes::Light) , m_LightType(RenderLightTypes::Directional) , m_Scope(NULL) - , m_DiffuseColor(1, 1, 1) - , m_SpecularColor(1, 1, 1) - , m_AmbientColor(0, 0, 0) + , m_DiffuseColor(1, 1, 1, 1) + , m_SpecularColor(1, 1, 1, 1) + , m_AmbientColor(0, 0, 0, 1) , m_Brightness(100) , m_LinearFade(0) , m_ExponentialFade(0) diff --git a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLight.h b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLight.h index 549e3e26..10f2b866 100644 --- a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLight.h +++ b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderLight.h @@ -51,9 +51,9 @@ namespace render { { RenderLightTypes::Enum m_LightType; // Directional SNode *m_Scope; - QT3DSVec3 m_DiffuseColor; // colors are 0-1 normalized - QT3DSVec3 m_SpecularColor; // colors are 0-1 normalized - QT3DSVec3 m_AmbientColor; // colors are 0-1 normalized + QT3DSVec4 m_DiffuseColor; // colors are 0-1 normalized + QT3DSVec4 m_SpecularColor; // colors are 0-1 normalized + QT3DSVec4 m_AmbientColor; // colors are 0-1 normalized // The variables below are in the same range as Studio // Only valid if node is a point light diff --git a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderScene.cpp b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderScene.cpp index 8d206e69..7917bd7a 100644 --- a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderScene.cpp +++ b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderScene.cpp @@ -39,7 +39,7 @@ SScene::SScene() : SGraphObject(GraphObjectTypes::Scene) , m_Presentation(NULL) , m_FirstChild(NULL) - , m_ClearColor(0, 0, 0) + , m_ClearColor(0.0f) , m_UseClearColor(true) , m_Dirty(true) { @@ -91,6 +91,7 @@ void SScene::Render(const QT3DSVec2 &inViewportDimensions, IQt3DSRenderContext & clearColor.x = m_ClearColor.x; clearColor.y = m_ClearColor.y; clearColor.z = m_ClearColor.z; + clearColor.w = m_ClearColor.w; } // Maybe clear and reset to previous clear color after we leave. qt3ds::render::NVRenderContextScopedProperty<QT3DSVec4> __clearColor( @@ -106,7 +107,7 @@ void SScene::Render(const QT3DSVec2 &inViewportDimensions, IQt3DSRenderContext & void SScene::RenderWithClear(const QT3DSVec2 &inViewportDimensions, IQt3DSRenderContext &inContext, RenderClearCommand inClearColorBuffer, - QT3DSVec3 inClearColor, + QT3DSVec4 inClearColor, const SRenderInstanceId id) { // If this scene is not using clear color, we set the color diff --git a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderScene.h b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderScene.h index 57887199..8c4d3fec 100644 --- a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderScene.h +++ b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderScene.h @@ -31,7 +31,7 @@ #ifndef QT3DS_RENDER_SCENE_H #define QT3DS_RENDER_SCENE_H #include "Qt3DSRender.h" -#include "foundation/Qt3DSVec3.h" +#include "foundation/Qt3DSVec4.h" #include "Qt3DSRenderGraphObject.h" namespace qt3ds { @@ -44,7 +44,7 @@ namespace render { { SPresentation *m_Presentation; SLayer *m_FirstChild; - QT3DSVec3 m_ClearColor; + QT3DSVec4 m_ClearColor; bool m_UseClearColor; bool m_Dirty; @@ -76,7 +76,7 @@ namespace render { const SRenderInstanceId id = nullptr); void RenderWithClear(const QT3DSVec2 &inViewportDimensions, IQt3DSRenderContext &inContext, RenderClearCommand inClearColorBuffer, - QT3DSVec3 inclearColor, const SRenderInstanceId id = nullptr); + QT3DSVec4 inclearColor, const SRenderInstanceId id = nullptr); }; } } diff --git a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderText.cpp b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderText.cpp index e4694c56..b76240b4 100644 --- a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderText.cpp +++ b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderText.cpp @@ -59,7 +59,7 @@ STextRenderInfo::~STextRenderInfo() SText::SText() : SNode(GraphObjectTypes::Text) - , m_TextColor(1, 1, 1) + , m_TextColor(1, 1, 1, 1) , m_TextTexture(NULL) { m_Bounds.setEmpty(); diff --git a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderText.h b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderText.h index 56a2a9bf..13f5748a 100644 --- a/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderText.h +++ b/src/Runtime/Source/runtimerender/graphobjects/Qt3DSRenderText.h @@ -44,7 +44,7 @@ namespace render { // For these you need to set TextDirty. // These properties can change every frame with no additional cost. - QT3DSVec3 m_TextColor; + QT3DSVec4 m_TextColor; // Setup and utilized by the rendering system NVRenderTexture2D *m_TextTexture; STextTextureDetails m_TextTextureDetails; diff --git a/src/Runtime/Source/runtimerender/q3dsqmlrender.h b/src/Runtime/Source/runtimerender/q3dsqmlrender.h index 12d459cf..99b395de 100644 --- a/src/Runtime/Source/runtimerender/q3dsqmlrender.h +++ b/src/Runtime/Source/runtimerender/q3dsqmlrender.h @@ -65,7 +65,7 @@ public: NVRenderContext &/*inRenderContext*/, QT3DSVec2 /*inPresentationScaleFactor*/, SScene::RenderClearCommand /*inColorBufferNeedsClear*/, - QT3DSVec3 /*inclearColor*/, + QT3DSVec4 /*inclearColor*/, const SRenderInstanceId /*instanceId*/) override {} IGraphObjectPickQuery *GetGraphObjectPickQuery(const SRenderInstanceId instanceId) override diff --git a/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRenderableObjects.cpp b/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRenderableObjects.cpp index 24684861..f2f260fd 100644 --- a/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRenderableObjects.cpp +++ b/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRenderableObjects.cpp @@ -318,7 +318,8 @@ namespace render { context.SetBlendFunction(blendFunc); context.SetBlendEquation(blendEqu); - QT3DSVec4 theColor(m_Text.m_TextColor, m_Text.m_GlobalOpacity); + QT3DSVec4 theColor(m_Text.m_TextColor.x, m_Text.m_TextColor.y, m_Text.m_TextColor.z, + m_Text.m_GlobalOpacity); STextShader &shader(*theInfo.m_Shader); shader.Render(*m_Text.m_TextTexture, *this, theColor, m_ModelViewProjection, @@ -342,8 +343,8 @@ namespace render { context.SetBlendFunction(blendFunc); context.SetBlendEquation(blendEqu); - QT3DSVec4 theColor(m_Text.m_TextColor, m_Text.m_GlobalOpacity); - + QT3DSVec4 theColor(m_Text.m_TextColor.x, m_Text.m_TextColor.y, m_Text.m_TextColor.z, + m_Text.m_GlobalOpacity); STextShader &shader(*theInfo.m_Shader); shader.RenderPath(*m_Text.m_PathFontItem, *m_Text.m_PathFontDetails, *this, theColor, diff --git a/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImpl.cpp b/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImpl.cpp index 7c2603f6..9afb255c 100644 --- a/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImpl.cpp +++ b/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImpl.cpp @@ -221,7 +221,7 @@ namespace render { } void Qt3DSRendererImpl::RenderLayer(SLayer &inLayer, const QT3DSVec2 &inViewportDimensions, - bool clear, QT3DSVec3 clearColor, bool inRenderSiblings, + bool clear, QT3DSVec4 clearColor, bool inRenderSiblings, const SRenderInstanceId id) { (void)inViewportDimensions; @@ -256,13 +256,10 @@ namespace render { m_BlendFB->Attach(NVRenderFrameBufferAttachments::Color0, *m_LayerBlendTexture); theRenderContext.SetRenderTarget(m_BlendFB); theRenderContext.SetScissorTestEnabled(false); - QT3DSVec4 color(0.0f, 0.0f, 0.0f, 0.0f); - if (clear) { - color.x = clearColor.x; - color.y = clearColor.y; - color.z = clearColor.z; - color.w = 1.0f; - } + QT3DSVec4 color(0.0f); + if (clear) + color = clearColor; + QT3DSVec4 origColor = theRenderContext.GetClearColor(); theRenderContext.SetClearColor(color); theRenderContext.Clear(qt3ds::render::NVRenderClearValues::Color); diff --git a/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImpl.h b/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImpl.h index e5b39b84..67130904 100644 --- a/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImpl.h +++ b/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImpl.h @@ -318,7 +318,7 @@ namespace render { bool PrepareLayerForRender(SLayer &inLayer, const QT3DSVec2 &inViewportDimensions, bool inRenderSiblings, const SRenderInstanceId id) override; void RenderLayer(SLayer &inLayer, const QT3DSVec2 &inViewportDimensions, - bool clear, QT3DSVec3 clearColor, bool inRenderSiblings, + bool clear, QT3DSVec4 clearColor, bool inRenderSiblings, const SRenderInstanceId id) override; void ChildrenUpdated(SNode &inParent) override; QT3DSF32 GetTextScale(const SText &inText) override; diff --git a/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImplLayerRenderData.cpp b/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImplLayerRenderData.cpp index 3fb3bc68..eb1563ee 100644 --- a/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImplLayerRenderData.cpp +++ b/src/Runtime/Source/runtimerender/rendererimpl/Qt3DSRendererImplLayerRenderData.cpp @@ -1489,9 +1489,9 @@ namespace render { NVRenderContextScopedProperty<NVRenderRect> __viewport( theRenderContext, &NVRenderContext::GetViewport, &NVRenderContext::SetViewport, theNewViewport); - QT3DSVec4 clearColor(0.0); + QT3DSVec4 clearColor(0.0f); if (m_Layer.m_Background == LayerBackground::Color) - clearColor = QT3DSVec4(m_Layer.m_ClearColor, 1.0); + clearColor = m_Layer.m_ClearColor; NVRenderContextScopedProperty<QT3DSVec4> __clearColor( theRenderContext, &NVRenderContext::GetClearColor, &NVRenderContext::SetClearColor, @@ -1768,7 +1768,7 @@ namespace render { SLayerRenderPreparationResult &thePrepResult(*m_LayerPrepResult); NVRenderRectF theScreenRect(thePrepResult.GetLayerToPresentationViewport()); - bool blendingEnabled = m_Layer.m_Background == LayerBackground::Transparent; + bool blendingEnabled = m_Layer.m_Background != LayerBackground::Unspecified; if (!thePrepResult.m_Flags.ShouldRenderToTexture()) { theContext.SetViewport( m_LayerPrepResult->GetLayerToPresentationViewport().ToIntegerRect()); @@ -1778,7 +1778,7 @@ namespace render { if (m_Layer.m_Background == LayerBackground::Color) { NVRenderContextScopedProperty<QT3DSVec4> __clearColor( theContext, &NVRenderContext::GetClearColor, &NVRenderContext::SetClearColor, - QT3DSVec4(m_Layer.m_ClearColor, 0.0f)); + m_Layer.m_ClearColor); theContext.Clear(NVRenderClearValues::Color); } RenderToViewport(); diff --git a/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml b/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml index 158ca740..1cf9c3e7 100644 --- a/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml +++ b/src/Runtime/res/DataModelMetadata/en-us/MetaData.xml @@ -154,12 +154,12 @@ <Property name="shaderlighting" formalName="Lighting" default="Pixel" category="Material" description="Light model" list="Pixel:None" /> <Property name="blendmode" formalName="Blending Mode" default="Normal" category="Material" description="How this material blends with content\nbehind it. Modes marked with * are\navailable only with HW supporting\nadvanced blending modes." list="Normal:Screen:Multiply:*Overlay:*ColorBurn:*ColorDodge" /> <Property name="vertexcolors" formalName="Enable Vertex Colors" type="Boolean" default="False" category="Material" description="Use vertex colors from the mesh" animatable="False" /> - <Property name="diffuse" formalName="Diffuse Color" type="Color" default="1 1 1" category="Material" description="Color when lit from any direction" /> + <Property name="diffuse" formalName="Diffuse Color" type="Color" default="1 1 1 1" category="Material" description="Color when lit from any direction" /> <Property name="diffusemap" formalName="Diffuse Map" type="Image" category="Material" description="Image to multiply with diffuse color" /> <Property name="diffusemap2" formalName="Diffuse Map 2" type="Image" category="Material" description="Image to multiply with diffuse color" /> <Property name="diffusemap3" formalName="Diffuse Map 3" type="Image" category="Material" description="Image to multiply with diffuse color" /> <Property name="specularreflection" formalName="Specular Reflection" type="Image" category="Material" description="Image to use as a faked reflection" /> - <Property name="speculartint" formalName="Specular Tint" type="Color" default="1 1 1" category="Material" description="Coloration applied to specular reflections" /> + <Property name="speculartint" formalName="Specular Tint" type="Color" default="1 1 1 1" category="Material" description="Coloration applied to specular reflections" /> <Property name="specularamount" formalName="Specular Amount" category="Material" description="Amount of shine/gloss" /> <Property name="specularmap" formalName="Specular Map" type="Image" category="Material" description="Image to vary the specular amount across\nthe material" /> <Property name="specularmodel" formalName="Specular Model" default="Default" category="Material" description="Equation to use when calculating specular\nhighlights for CG lights" list="Default:KGGX:KWard" /> @@ -174,7 +174,7 @@ <Property name="displaceamount" formalName="Displacement Amount" type="float" default="20" category="Material" description="Distance to offset vertices" /> <Property name="opacity" formalName="Opacity" min="0" max="100" default="100" category="Material" description="Visibility of the geometry for this material." /> <Property name="opacitymap" formalName="Opacity Map" type="Image" category="Material" description="Image to vary the opacity across the material" /> - <Property name="emissivecolor" formalName="Emissive Color" type="Color" default="1 1 1" category="Material" description="Color of self-illumination for this material" /> + <Property name="emissivecolor" formalName="Emissive Color" type="Color" default="1 1 1 1" category="Material" description="Color of self-illumination for this material" /> <Property name="emissivepower" formalName="Emissive Power" category="Material" description="Amount of self-illumination for this material\n(will not light other objects)" /> <Property name="emissivemap" formalName="Emissive Map" type="Image" category="Material" description="Image to vary the emissive power across\nthe material" /> <Property name="emissivemap2" formalName="Emissive Map 2" type="Image" category="Material" description="Second image to modulate the emissive power\nacross the material" /> @@ -372,8 +372,8 @@ <!-- Light Properties --> <Property name='scope' formalName="Scope" description="Portion of the scene graph lit by this\nlight; no value results in entire layer\nbeing affected." type='ObjectRef' category="Light Properties" /> <Property name="lighttype" formalName="Light Type" description="Type of illumination to use" list="Directional:Point:Area" default="Directional" category="Light Properties" /> - <Property name="lightdiffuse" formalName="Light Color" description="Color of diffuse lighting effect" type="Color" default="1 1 1" category="Light Properties" /> - <Property name="lightspecular" formalName="Specular Color" description="Color of specular lighting highlights" type="Color" default="1 1 1" category="Light Properties" /> + <Property name="lightdiffuse" formalName="Light Color" description="Color of diffuse lighting effect" type="Color" default="1 1 1 1" category="Light Properties" /> + <Property name="lightspecular" formalName="Specular Color" description="Color of specular lighting highlights" type="Color" default="1 1 1 1" category="Light Properties" /> <Property name="lightambient" formalName="Ambient Color" description="Color of unlit areas (black for none)" type="Color" category="Light Properties" /> <Property name="brightness" formalName="Brightness" description="Strength of the light" default="100" category="Light Properties" /> <Property name="linearfade" formalName="Linear Fade" description="Falloff of the point light" min="0" max="1000" category="Light Properties"> @@ -439,19 +439,19 @@ <!-- Format --> <Property name="textstring" formalName="Text String" type="MultiLineString" default="Text" category="Format" description="Text String" controllable="True" /> - <Property name="textcolor" formalName="Text Color" type="Color" default="1 1 1" category="Format" description="Text Color" controllable="True" /> + <Property name="textcolor" formalName="Text Color" type="Color" default="1 1 1 1" category="Format" description="Text Color" controllable="True" /> <Property name="font" formalName="Font" type="Font" default="TitilliumWeb-Regular" category="Format" description="Font" /> <!-- HW accelerated fonts not supported <Property name="enableacceleratedfont" formalName="Hardware accelerated font" description="Enabled hardware acclerated font" type="Boolean" default="false" category="Format" /> --> - <Property name="size" formalName="Font Size" description="Font Size" type="FontSize" default="36" animatable="False" category="Format" /> - <Property name="horzalign" formalName="Horizontal Alignment" description="Horizontal Alignment" list="Left:Center:Right" default="Center" category="Format" /> - <Property name="vertalign" formalName="Vertical Alignment" description="Vertical Alignment" list="Top:Middle:Bottom" default="Middle" category="Format" /> - <Property name="leading" formalName="Leading" description="Leading" category="Format" /> - <Property name="tracking" formalName="Tracking" description="Tracking" category="Format" /> - <Property name="boundingbox" formalName="Text Area" description="Fixed size text area. If not set,\ntext area grows with text." type="Float2" default="0 0" category="Format" /> - <Property name="wordwrap" formalName="Word Wrapping" description="Word wrapping. Has effect only if fixed size\ntext area is used.\nClip: Cut text if it does not fit.\nWrapWord: Wrap between words, if possible.\nWrapAnywhere: Wrap even in the middle\nof words." list="Clip:WrapWord:WrapAnywhere" default="WrapWord" category="Format" /> - <Property name="elide" formalName="Eliding" description="Elide text that does not fit the\ntext area. Has effect only if\nfixed text area is defined." list="ElideNone:ElideLeft:ElideMiddle:ElideRight" default="ElideNone" category="Format" /> + <Property name="size" formalName="Font Size" description="Font Size" type="FontSize" default="36" animatable="False" category="Format" /> + <Property name="horzalign" formalName="Horizontal Alignment" description="Horizontal Alignment" list="Left:Center:Right" default="Center" category="Format" /> + <Property name="vertalign" formalName="Vertical Alignment" description="Vertical Alignment" list="Top:Middle:Bottom" default="Middle" category="Format" /> + <Property name="leading" formalName="Leading" description="Leading" category="Format" /> + <Property name="tracking" formalName="Tracking" description="Tracking" category="Format" /> + <Property name="boundingbox" formalName="Text Area" description="Fixed size text area. If not set,\ntext area grows with text." type="Float2" default="0 0" category="Format" /> + <Property name="wordwrap" formalName="Word Wrapping" description="Word wrapping. Has effect only if fixed size\ntext area is used.\nClip: Cut text if it does not fit.\nWrapWord: Wrap between words, if possible.\nWrapAnywhere: Wrap even in the middle\nof words." list="Clip:WrapWord:WrapAnywhere" default="WrapWord" category="Format" /> + <Property name="elide" formalName="Eliding" description="Elide text that does not fit the\ntext area. Has effect only if\nfixed text area is defined." list="ElideNone:ElideLeft:ElideMiddle:ElideRight" default="ElideNone" category="Format" /> <!-- Shadow --> <Property name="dropshadow" formalName="Drop-Shadow" description="Add a drop-shadow to the text.\nThe shadow is a darker shade of the given color." type="Boolean" default="False" category="Shadow" /> |