diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-05-08 14:38:00 +0300 |
---|---|---|
committer | Mahmoud Badri <mahmoud.badri@qt.io> | 2019-05-08 11:58:37 +0000 |
commit | f699744899fa6d149b21ab4412a2588854ae8dbc (patch) | |
tree | 6710db314a6126ce4bc2bfee76f35021472322c6 /src/Runtime/Source/uipparser | |
parent | 4d81269affaa5369caa4aa0fda2b0523fa3f8ea8 (diff) |
Add missing float4 types to Runtime data model datatypes
Task-number: QT3DS-3400
Change-Id: I17de1c3a1d6ba4a6877a9570ab9821523e345565
Reviewed-by: Jari Karppinen <jari.karppinen@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Runtime/Source/uipparser')
-rw-r--r-- | src/Runtime/Source/uipparser/Qt3DSUIPParserImpl.cpp | 59 | ||||
-rw-r--r-- | src/Runtime/Source/uipparser/Qt3DSUIPParserImpl.h | 3 |
2 files changed, 51 insertions, 11 deletions
diff --git a/src/Runtime/Source/uipparser/Qt3DSUIPParserImpl.cpp b/src/Runtime/Source/uipparser/Qt3DSUIPParserImpl.cpp index 2ddffe3f..e758f0af 100644 --- a/src/Runtime/Source/uipparser/Qt3DSUIPParserImpl.cpp +++ b/src/Runtime/Source/uipparser/Qt3DSUIPParserImpl.cpp @@ -187,6 +187,9 @@ SElementPropertyInfo *SParseElementManager::GetOrCreateProperty(SElementData &in case ERuntimeDataModelDataTypeFloat3: retval.m_Arity = 3; break; + case ERuntimeDataModelDataTypeFloat4: + retval.m_Arity = 4; + break; } if (retval.m_Arity > 1) { if (retval.m_Arity == 2) { @@ -194,7 +197,7 @@ SElementPropertyInfo *SParseElementManager::GetOrCreateProperty(SElementData &in thePropNames, m_StringTable); SetPropertyValueHash(m_Workspace, ".y", thePropHashes, thePeriodPos, thePropNames, m_StringTable); - } else { + } else if (retval.m_Arity == 3) { if (m_MetaData.GetAdditionalType(theData.m_Type, theStr, theData.m_Class) == ERuntimeAdditionalMetaDataTypeColor) { SetPropertyValueHash(m_Workspace, ".r", thePropHashes, thePeriodPos, @@ -211,6 +214,18 @@ SElementPropertyInfo *SParseElementManager::GetOrCreateProperty(SElementData &in SetPropertyValueHash(m_Workspace, ".z", thePropHashes, thePeriodPos, thePropNames, m_StringTable); } + } else if (retval.m_Arity == 4) { + if (m_MetaData.GetAdditionalType(theData.m_Type, theStr, theData.m_Class) + == ERuntimeAdditionalMetaDataTypeColor) { + SetPropertyValueHash(m_Workspace, ".r", thePropHashes, thePeriodPos, + thePropNames, m_StringTable); + SetPropertyValueHash(m_Workspace, ".g", thePropHashes, thePeriodPos, + thePropNames, m_StringTable); + SetPropertyValueHash(m_Workspace, ".b", thePropHashes, thePeriodPos, + thePropNames, m_StringTable); + SetPropertyValueHash(m_Workspace, ".a", thePropHashes, thePeriodPos, + thePropNames, m_StringTable); + } } } else { retval.m_PropertyHashes[0] = Q3DStudio::CHash::HashAttribute(theStr.c_str()); @@ -675,10 +690,6 @@ BOOL CUIPParserImpl::LoadGraph(IPresentation &inPresentation, qt3dsdm::IDOMReade return theLoadResult; } -inline RuntimeVector3 Convert(const QT3DSVec3 &input) -{ - return RuntimeVector3(input.x, input.y, input.z); -} using qt3ds::runtime::element::SPropertyDesc; using qt3ds::runtime::element::TPropertyDescAndValue; @@ -697,21 +708,27 @@ void CUIPParserImpl::GetMetaAttribute(IPresentation &inPresentation, m_MetaData.GetPropertyValueFloat(inType, inName, inClassId)); break; case ERuntimeDataModelDataTypeFloat2: { - RuntimeVector3 theVector3 = - Convert(m_MetaData.GetPropertyValueVector2(inType, inName, inClassId)); - SFloat2 theValue(theVector3.m_X, theVector3.m_Y); + QT3DSVec2 vec2 = m_MetaData.GetPropertyValueVector2(inType, inName, inClassId); + SFloat2 theValue(vec2.x, vec2.y); AddFloat2Attribute(outDescList, inAttStrNames, theValue); break; } case ERuntimeDataModelDataTypeFloat3: { - RuntimeVector3 theVector3 = - Convert(m_MetaData.GetPropertyValueVector3(inType, inName, inClassId)); - SFloat3 theValue(theVector3.m_X, theVector3.m_Y, theVector3.m_Z); + QT3DSVec3 vec3 = m_MetaData.GetPropertyValueVector3(inType, inName, inClassId); + SFloat3 theValue(vec3.x, vec3.y, vec3.z); ERuntimeAdditionalMetaDataType theAdditionalType = m_MetaData.GetAdditionalType(inType, inName, inClassId); AddFloat3Attribute(outDescList, theAdditionalType, inAttStrNames, theValue); break; } + case ERuntimeDataModelDataTypeFloat4: { + QT3DSVec4 vec4 = m_MetaData.GetPropertyValueVector4(inType, inName, inClassId); + SFloat4 theValue(vec4.x, vec4.y, vec4.z, vec4.w); + ERuntimeAdditionalMetaDataType theAdditionalType = + m_MetaData.GetAdditionalType(inType, inName, inClassId); + AddFloat4Attribute(outDescList, theAdditionalType, inAttStrNames, theValue); + break; + } case ERuntimeDataModelDataTypeLong: AddLongAttribute(outDescList, inAttStrNames[0], m_MetaData.GetPropertyValueLong(inType, inName, inClassId)); @@ -798,6 +815,19 @@ void CUIPParserImpl::AddFloat3Attribute(TPropertyDescAndValueList &outDescList, } } +void CUIPParserImpl::AddFloat4Attribute(TPropertyDescAndValueList &outDescList, + ERuntimeAdditionalMetaDataType inAdditionalType, + CRegisteredString *inAttStrNames, SFloat4 &inValue) +{ + for (long i = 0; i < 4; ++i) { + UVariant varVal; + varVal.m_FLOAT = inValue[i]; + outDescList.push_back(eastl::make_pair( + SPropertyDesc(inAttStrNames[i], ATTRIBUTETYPE_FLOAT), varVal)); + } +} + + void CUIPParserImpl::AddStringAttribute(IPresentation &inPresentation, TPropertyDescAndValueList &outDescList, CRegisteredString inAttStrName, const char *inValue) @@ -883,6 +913,13 @@ void CUIPParserImpl::GetAttributeList(IPresentation &inPresentation, AddFloat3Attribute(outDescList, inAdditionalType, inPropNameStrs, theValue); break; } + case ERuntimeDataModelDataTypeFloat4: { + SFloat4 theValue(0); + if (!IsTrivial(inValue)) + theReader.ReadRef(NVDataRef<QT3DSF32>(&theValue[0], 4)); + AddFloat4Attribute(outDescList, inAdditionalType, inPropNameStrs, theValue); + break; + } case ERuntimeDataModelDataTypeBool: { bool theValue = false; if (!IsTrivial(inValue)) diff --git a/src/Runtime/Source/uipparser/Qt3DSUIPParserImpl.h b/src/Runtime/Source/uipparser/Qt3DSUIPParserImpl.h index fd921161..585dd857 100644 --- a/src/Runtime/Source/uipparser/Qt3DSUIPParserImpl.h +++ b/src/Runtime/Source/uipparser/Qt3DSUIPParserImpl.h @@ -644,6 +644,9 @@ protected: void AddFloat3Attribute(TPropertyDescAndValueList &outDescList, ERuntimeAdditionalMetaDataType inAdditionalType, CRegisteredString *inAttStrNames, qt3dsdm::SFloat3 &inValue); + void AddFloat4Attribute(TPropertyDescAndValueList &outDescList, + ERuntimeAdditionalMetaDataType inAdditionalType, + CRegisteredString *inAttStrNames, qt3dsdm::SFloat4 &inValue); void AddStringAttribute(IPresentation &inPresentation, TPropertyDescAndValueList &outDescList, CRegisteredString inAttStrName, const char *inValue); void AddElementRefAttribute(TPropertyDescAndValueList &outDescList, |