{
if(s)
{
- return (s->mMinFilter < gt::Filter::NEAREST_MIPMAP_NEAREST) ? (s->mMinFilter - gt::Filter::NEAREST) : ((s->mMinFilter - gt::Filter::NEAREST_MIPMAP_NEAREST) + 2) | ((s->mMagFilter - gt::Filter::NEAREST) << SamplerFlags::FILTER_MAG_SHIFT) | (ConvertWrapMode(s->mWrapS) << SamplerFlags::WRAP_S_SHIFT) | (ConvertWrapMode(s->mWrapT) << SamplerFlags::WRAP_T_SHIFT);
+ return ((s->mMinFilter < gt::Filter::NEAREST_MIPMAP_NEAREST) ? (s->mMinFilter - gt::Filter::NEAREST) : ((s->mMinFilter - gt::Filter::NEAREST_MIPMAP_NEAREST) + 2)) |
+ ((s->mMagFilter - gt::Filter::NEAREST) << SamplerFlags::FILTER_MAG_SHIFT) |
+ (ConvertWrapMode(s->mWrapS) << SamplerFlags::WRAP_S_SHIFT) |
+ (ConvertWrapMode(s->mWrapT) << SamplerFlags::WRAP_T_SHIFT);
}
else
{
MaterialDefinition matDef;
auto& pbr = material.mPbrMetallicRoughness;
- if(pbr.mBaseColorFactor.a < 1.f)
+ if(material.mAlphaMode == gt::AlphaMode::BLEND)
{
+ matDef.mIsOpaque = false;
matDef.mFlags |= MaterialDefinition::TRANSPARENCY;
}
-
- if(material.mAlphaMode == gt::AlphaMode::MASK)
+ else if(material.mAlphaMode == gt::AlphaMode::MASK)
{
+ matDef.mIsMask = true;
matDef.SetAlphaCutoff(std::min(1.f, std::max(0.f, material.mAlphaCutoff)));
}
void ConvertNodes(const gt::Document& doc, ConversionContext& context, bool isMRendererModel)
{
- ConvertSceneNodes(*doc.mScene, context, isMRendererModel);
-
- for(uint32_t i = 0, i1 = doc.mScene.GetIndex(); i < i1; ++i)
+ if(!doc.mScenes.empty())
{
- ConvertSceneNodes(doc.mScenes[i], context, isMRendererModel);
- }
+ uint32_t rootSceneIndex = 0u;
+ if(doc.mScene)
+ {
+ rootSceneIndex = doc.mScene.GetIndex();
+ }
+ ConvertSceneNodes(doc.mScenes[rootSceneIndex], context, isMRendererModel);
- for(uint32_t i = doc.mScene.GetIndex() + 1; i < doc.mScenes.size(); ++i)
- {
- ConvertSceneNodes(doc.mScenes[i], context, isMRendererModel);
+ for(uint32_t i = 0, i1 = rootSceneIndex; i < i1; ++i)
+ {
+ ConvertSceneNodes(doc.mScenes[i], context, isMRendererModel);
+ }
+
+ for(uint32_t i = rootSceneIndex + 1; i < doc.mScenes.size(); ++i)
+ {
+ ConvertSceneNodes(doc.mScenes[i], context, isMRendererModel);
+ }
}
}
return duration;
}
-float LoadBlendShapeKeyFrames(const std::string& path, const gt::Animation::Channel& channel, const std::string& nodeName, uint32_t& propertyIndex, std::vector<Dali::Scene3D::Loader::AnimatedProperty>& properties)
+float LoadBlendShapeKeyFrames(const std::string& path, const gt::Animation::Channel& channel, Index nodeIndex, uint32_t& propertyIndex, std::vector<Dali::Scene3D::Loader::AnimatedProperty>& properties)
{
const gltf2::Accessor& input = *channel.mSampler->mInput;
const gltf2::Accessor& output = *channel.mSampler->mOutput;
{
AnimatedProperty& animatedProperty = properties[propertyIndex++];
- animatedProperty.mNodeName = nodeName;
+ animatedProperty.mNodeIndex = nodeIndex;
snprintf(pWeightName, remainingSize, "%d]", weightIndex);
animatedProperty.mPropertyName = std::string(weightNameBuffer);
}
uint32_t numberOfProperties = 0u;
-
for(const auto& channel : animation.mChannels)
{
- numberOfProperties += channel.mSampler->mOutput->mCount;
- }
- animationDef.mProperties.resize(numberOfProperties);
-
- Index propertyIndex = 0u;
- for(const auto& channel : animation.mChannels)
- {
- std::string nodeName;
- if(!channel.mTarget.mNode->mName.empty())
+ if(channel.mTarget.mPath == gt::Animation::Channel::Target::WEIGHTS)
{
- nodeName = channel.mTarget.mNode->mName;
+ numberOfProperties += channel.mSampler->mOutput->mCount / channel.mSampler->mInput->mCount;
}
else
{
- Index index = context.mNodeIndices.GetRuntimeId(channel.mTarget.mNode.GetIndex());
- nodeName = context.mOutput.mScene.GetNode(index)->mName;
+ numberOfProperties++;
}
+ }
+ animationDef.mProperties.resize(numberOfProperties);
+ Index propertyIndex = 0u;
+ for(const auto& channel : animation.mChannels)
+ {
+ Index nodeIndex = context.mNodeIndices.GetRuntimeId(channel.mTarget.mNode.GetIndex());
float duration = 0.f;
switch(channel.mTarget.mPath)
{
AnimatedProperty& animatedProperty = animationDef.mProperties[propertyIndex];
- animatedProperty.mNodeName = nodeName;
+ animatedProperty.mNodeIndex = nodeIndex;
animatedProperty.mPropertyName = POSITION_PROPERTY;
animatedProperty.mKeyFrames = KeyFrames::New();
{
AnimatedProperty& animatedProperty = animationDef.mProperties[propertyIndex];
- animatedProperty.mNodeName = nodeName;
+ animatedProperty.mNodeIndex = nodeIndex;
animatedProperty.mPropertyName = ORIENTATION_PROPERTY;
animatedProperty.mKeyFrames = KeyFrames::New();
{
AnimatedProperty& animatedProperty = animationDef.mProperties[propertyIndex];
- animatedProperty.mNodeName = nodeName;
+ animatedProperty.mNodeIndex = nodeIndex;
animatedProperty.mPropertyName = SCALE_PROPERTY;
animatedProperty.mKeyFrames = KeyFrames::New();
}
case gt::Animation::Channel::Target::WEIGHTS:
{
- duration = LoadBlendShapeKeyFrames(context.mPath, channel, nodeName, propertyIndex, animationDef.mProperties);
+ duration = LoadBlendShapeKeyFrames(context.mPath, channel, nodeIndex, propertyIndex, animationDef.mProperties);
break;
}