#include <dali-scene3d/public-api/loader/load-result.h>
#include <dali-scene3d/public-api/loader/resource-bundle.h>
#include <dali-scene3d/public-api/loader/scene-definition.h>
-#include <dali-scene3d/public-api/loader/shader-definition-factory.h>
+#include <dali-scene3d/public-api/loader/shader-manager.h>
#include <dali-test-suite-utils.h>
#include <string_view>
{
Context ctx;
- ShaderDefinitionFactory sdf;
- sdf.SetResources(ctx.resources);
-
DALI_TEST_EQUAL(ctx.loader.LoadModel(TEST_RESOURCE_DIR "/invalid.gltf", ctx.loadResult), false);
DALI_TEST_EQUAL(0, ctx.scene.GetRoots().size());
DALI_TEST_EQUAL(0, ctx.resources.mEnvironmentMaps.size());
DALI_TEST_EQUAL(0, ctx.resources.mMaterials.size());
DALI_TEST_EQUAL(0, ctx.resources.mMeshes.size());
- DALI_TEST_EQUAL(0, ctx.resources.mShaders.size());
DALI_TEST_EQUAL(0, ctx.resources.mSkeletons.size());
DALI_TEST_EQUAL(0, ctx.cameras.size());
nullptr,
MaterialDefinition::ALBEDO | MaterialDefinition::EMISSIVE | MaterialDefinition::OCCLUSION |
MaterialDefinition::NORMAL | MaterialDefinition::SPECULAR | MaterialDefinition::SPECULAR_COLOR |
- (0x80 << MaterialDefinition::ALPHA_CUTOFF_SHIFT),
+ MaterialDefinition::GLTF_CHANNELS | (0x80 << MaterialDefinition::ALPHA_CUTOFF_SHIFT),
0,
Color::WHITE,
1.f,
1.f,
1.f,
Vector3(0.2, 0.1, 0.0),
+ 1.0f,
0.0f,
0.5f,
Vector3(0, 0, 1),
false,
true,
false,
+ Scene3D::Material::AlphaModeType::MASK,
+ true,
true,
true,
{
},
},
},
+ nullptr
},
{
nullptr,
1.f,
1.f,
Vector3(0.2, 0.1, 0.0),
+ -1.0f,
0.04f,
1.0f,
Vector3::ONE,
true,
true,
false,
+ Scene3D::Material::AlphaModeType::OPAQUE,
true,
false,
+ true,
{
{
MaterialDefinition::ALBEDO,
},
},
{
- MaterialDefinition::METALLIC | MaterialDefinition::ROUGHNESS | MaterialDefinition::GLTF_CHANNELS,
+ MaterialDefinition::METALLIC | MaterialDefinition::ROUGHNESS,
{
"AnimatedCube_MetallicRoughness.png",
SamplerFlags::Encode(FilterMode::NEAREST_MIPMAP_LINEAR, FilterMode::NEAREST, WrapMode::CLAMP_TO_EDGE, WrapMode::MIRRORED_REPEAT),
},
},
},
+ nullptr,
},
};
DALI_TEST_EQUAL(md.mNormalScale, m.mNormalScale);
DALI_TEST_EQUAL(md.mOcclusionStrength, m.mOcclusionStrength);
DALI_TEST_EQUAL(md.mEmissiveFactor, m.mEmissiveFactor);
+ DALI_TEST_EQUAL(md.mIor, m.mIor);
DALI_TEST_EQUAL(md.mDielectricSpecular, m.mDielectricSpecular);
DALI_TEST_EQUAL(md.mSpecularFactor, m.mSpecularFactor);
DALI_TEST_EQUAL(md.mSpecularColorFactor, m.mSpecularColorFactor);
DALI_TEST_EQUAL(md.mNeedAlbedoTexture, m.mNeedAlbedoTexture);
DALI_TEST_EQUAL(md.mNeedMetallicRoughnessTexture, m.mNeedMetallicRoughnessTexture);
DALI_TEST_EQUAL(md.mNeedNormalTexture, m.mNeedNormalTexture);
+ DALI_TEST_EQUAL(md.mAlphaModeType, m.mAlphaModeType);
DALI_TEST_EQUAL(md.mIsOpaque, m.mIsOpaque);
DALI_TEST_EQUAL(md.mIsMask, m.mIsMask);
++iMesh;
}
- DALI_TEST_EQUAL(2u, ctx.resources.mShaders.size());
DALI_TEST_EQUAL(0u, ctx.resources.mSkeletons.size());
DALI_TEST_EQUAL(6u, ctx.cameras.size());
int UtcDaliGltfLoaderSuccess2(void)
{
Context ctx;
- ShaderDefinitionFactory sdf;
- sdf.SetResources(ctx.resources);
ctx.loader.LoadModel(TEST_RESOURCE_DIR "/AnimatedCubeStride.gltf", ctx.loadResult);
int UtcDaliGltfLoaderMRendererTest(void)
{
Context ctx;
-
- ShaderDefinitionFactory sdf;
- sdf.SetResources(ctx.resources);
auto& resources = ctx.resources;
ctx.loader.LoadModel(TEST_RESOURCE_DIR "/MRendererTest.gltf", ctx.loadResult);
DALI_TEST_EQUAL(scene.GetNodeCount(), 1u);
+ Scene3D::Loader::ShaderManagerPtr shaderManager = new Scene3D::Loader::ShaderManager();
ViewProjection viewProjection;
Transforms xforms{
MatrixStack{},
NodeDefinition::CreateParams nodeParams{
resources,
xforms,
+ shaderManager,
};
Customization::Choices choices;
ctx.resources.LoadResources(ctx.pathProvider);
if(auto actor = scene.CreateNodes(iRoot, choices, nodeParams))
{
- scene.ConfigureSkeletonJoints(iRoot, resources.mSkeletons, actor);
scene.ConfigureSkinningShaders(resources, actor, std::move(nodeParams.mSkinnables));
scene.ApplyConstraints(actor, std::move(nodeParams.mConstrainables));
root.Add(actor);
DALI_TEST_EQUAL(child.GetProperty(Actor::Property::NAME).Get<std::string>(), "RootNode");
DALI_TEST_EQUAL(child.GetProperty(Actor::Property::SCALE).Get<Vector3>(), Vector3(1.0f, 1.0f, 1.0f));
DALI_TEST_EQUAL(child.GetRendererCount(), 1u);
- DALI_TEST_EQUAL(child.GetRendererAt(0).GetTextures().GetTextureCount(), 4u);
+ DALI_TEST_EQUAL(child.GetRendererAt(0).GetTextures().GetTextureCount(), 5u);
DALI_TEST_EQUAL(child.GetRendererCount(), 1u);
DALI_TEST_EQUAL(child.GetRendererAt(0u).GetProperty<decltype(BlendMode::ON)>(Renderer::Property::BLEND_MODE), BlendMode::ON);
auto& roots = scene.GetRoots();
DALI_TEST_EQUAL(roots.size(), 1u);
+ Scene3D::Loader::ShaderManagerPtr shaderManager = new Scene3D::Loader::ShaderManager();
ViewProjection viewProjection;
Transforms xforms{
MatrixStack{},
NodeDefinition::CreateParams nodeParams{
resources,
xforms,
+ shaderManager,
};
Customization::Choices choices;
resources.LoadResources(ctx.pathProvider);
if(auto actor = scene.CreateNodes(iRoot, choices, nodeParams))
{
- scene.ConfigureSkeletonJoints(iRoot, resources.mSkeletons, actor);
scene.ConfigureSkinningShaders(resources, actor, std::move(nodeParams.mSkinnables));
scene.ApplyConstraints(actor, std::move(nodeParams.mConstrainables));
root.Add(actor);
}
DALI_TEST_EQUAL(ctx.loadResult.mAnimationDefinitions.size(), 1u);
- DALI_TEST_EQUAL(ctx.loadResult.mAnimationDefinitions[0].mProperties.size(), 57u);
+ DALI_TEST_EQUAL(ctx.loadResult.mAnimationDefinitions[0].GetPropertyCount(), 57u);
- uint32_t id = ctx.loadResult.mScene.GetNode(ctx.loadResult.mAnimationDefinitions[0].mProperties[0].mNodeIndex)->mNodeId;
+ uint32_t id = ctx.loadResult.mScene.GetNode(ctx.loadResult.mAnimationDefinitions[0].GetPropertyAt(0).mNodeIndex)->mNodeId;
DALI_TEST_EQUAL(id, root.FindChildByName("Skeleton_torso_joint_1").GetProperty<int32_t>(Dali::Actor::Property::ID));
END_TEST;
{
Context ctx;
- ShaderDefinitionFactory sdf;
- sdf.SetResources(ctx.resources);
auto& resources = ctx.resources;
ctx.loader.LoadModel(TEST_RESOURCE_DIR "/EnvironmentTest_b.gltf", ctx.loadResult);
auto& roots = scene.GetRoots();
DALI_TEST_EQUAL(roots.size(), 1u);
+ Scene3D::Loader::ShaderManagerPtr shaderManager = new Scene3D::Loader::ShaderManager();
ViewProjection viewProjection;
Transforms xforms{
MatrixStack{},
NodeDefinition::CreateParams nodeParams{
resources,
xforms,
+ shaderManager,
};
Customization::Choices choices;
resources.LoadResources(ctx.pathProvider);
if(auto actor = scene.CreateNodes(iRoot, choices, nodeParams))
{
- scene.ConfigureSkeletonJoints(iRoot, resources.mSkeletons, actor);
scene.ConfigureSkinningShaders(resources, actor, std::move(nodeParams.mSkinnables));
scene.ApplyConstraints(actor, std::move(nodeParams.mConstrainables));
root.Add(actor);
auto& roots = scene.GetRoots();
DALI_TEST_EQUAL(roots.size(), 1u);
+ Scene3D::Loader::ShaderManagerPtr shaderManager = new Scene3D::Loader::ShaderManager();
ViewProjection viewProjection;
Transforms xforms{
MatrixStack{},
NodeDefinition::CreateParams nodeParams{
resources,
xforms,
+ shaderManager,
};
Customization::Choices choices;
resources.LoadResources(ctx.pathProvider);
if(auto actor = scene.CreateNodes(iRoot, choices, nodeParams))
{
- scene.ConfigureSkeletonJoints(iRoot, resources.mSkeletons, actor);
scene.ConfigureSkinningShaders(resources, actor, std::move(nodeParams.mSkinnables));
scene.ApplyConstraints(actor, std::move(nodeParams.mConstrainables));
root.Add(actor);