--- /dev/null
+{
+ "asset": { "version": "1.0" },
+ "scene": 0,
+ "scenes": [ { "nodes": [ 0 ] } ],
+ "nodes": [
+ {
+ "name": "root",
+ "matrix": [ 0.2, 0, 0, 0, 0, -0, 0.2, 0, 0, -0.2, -0, 0, 0, 0, 0, 1 ],
+ "model": {
+ "mesh": 0,
+ "material": 0
+ }
+ }
+ ],
+ "meshes": [
+ {
+ "uri": "coverageTest.bin",
+ "attributes": 31,
+ "primitive": "TRIANGLES",
+ "indices": { "byteOffset": 0, "byteLength": 600 },
+ "positions": { "byteOffset": 600, "byteLength": 2364 },
+ "normals": { "byteOffset": 2964, "byteLength": 2364 },
+ "textures": { "byteOffset": 5328, "byteLength": 1576 },
+ "tangents": { "byteOffset": 6904, "byteLength": 2364 }
+ }
+ ],
+ "skeletons": [
+ ],
+ "cameras": [
+ {
+ "fov": 60,
+ "near": 0.1,
+ "far": 100,
+ "matrix": [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 3.5, 1 ]
+ }
+ ],
+ "materials": [
+ {
+ "name": "material1",
+ "color": [ 1, 1, 0, 1 ],
+ "roughness": 0.4,
+ "metallic": 0,
+ "occlusionMap": "exercise/Icons/Icon_Idle.png",
+ "mipmap": true,
+ "environment" : 1
+ },
+ {
+ "name": "",
+ "color": [ 1, 1, 1, 1 ],
+ "roughness": 1,
+ "metallic": 1,
+ "mipmap": true
+ }
+ ],
+ "lights" : [ {
+ "matrix" : [ 0.8950600624084473, 0.0914330929517746, 0.4364715814590454, 0.0, 0.3676385283470154, 0.4026888310909271, -0.8382623195648193, 0.0, -0.25240713357925415, 0.9107588529586792, 0.3268163800239563, 0.0, 0.0, 0.0, -1.0, 1.0 ],
+ "color" : [ 0.8, 0.8, 0.8 ],
+ "intensity" : 1.0,
+ "shadowMapSize" : 256,
+ "orthographicSize" : 4.2760005,
+ "shadowIntensity" : 1.0
+ } ],
+ "environment" : [ {
+ "cubeInitialOrientation" : [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ],
+ "iblIntensity" : 1.0
+ }, {
+ "cubeSpecular" : "Studio/Radiance.ktx",
+ "cubeDiffuse" : "Studio/Irradiance.ktx",
+ "cubeInitialOrientation" : [ 0.6716271638870239, 0.07979151606559753, -0.7365801334381104, 0.0, 0.07979151606559753, 0.9806114435195923, 0.17898204922676086, 0.0, 0.7365801334381104, -0.17898204922676086, 0.6522386074066162, 0.0, 0.0, 0.0, 0.0, 1.0 ],
+ "iblIntensity" : 0.75
+ } ],
+ "shaders": [
+ {
+ "vertex": "dli_pbr.vsh",
+ "fragment": "dli_pbr.fsh",
+ "defines" : [ "OCCLUSION", "DISPLACEMENT" ],
+ "rendererState": "DEPTH_TEST|DEPTH_WRITE|CULL_BACK|DEPTH_FUNC:LESS_EQUAL",
+ "uCubeMatrix": [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ],
+ "uMaxLOD": 6
+ }
+ ]
+}
uniform sampler2D sNormalRoughness;\r
#endif\r
\r
+#ifdef OCCLUSION\r
+ uniform sampler2D sAmbientOcclusion;\r
+#endif //OCCLUSION\r
+\r
uniform samplerCube sDiffuse;\r
uniform samplerCube sSpecular;\r
\r
vec3 finalColor = diffuseColor + specColor;\r
\r
finalColor = sqrt( finalColor ) * uIblIntensity;\r
+\r
+#ifdef OCCLUSION\r
+ finalColor *= texture(sAmbientOcclusion, vUV.st).r;\r
+#endif //OCCLUSION\r
+\r
#ifdef THREE_TEX\r
FragColor = vec4( finalColor, alpha );\r
#else //THREE_TEX\r
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
+#include <dali-test-suite-utils.h>
+#include <string_view>
+#include "dali-scene-loader/internal/json-util.h"
#include "dali-scene-loader/public-api/dli-loader.h"
+#include "dali-scene-loader/public-api/load-result.h"
#include "dali-scene-loader/public-api/resource-bundle.h"
#include "dali-scene-loader/public-api/scene-definition.h"
-#include "dali-scene-loader/public-api/load-result.h"
-#include "dali-scene-loader/internal/json-util.h"
-#include <dali-test-suite-utils.h>
-#include <string_view>
using namespace Dali;
using namespace Dali::SceneLoader;
namespace
{
-
-void ConfigureBlendShapeShaders(ResourceBundle& resources, const SceneDefinition& scene, Actor root,
- std::vector<BlendshapeShaderConfigurationRequest>&& requests)
+void ConfigureBlendShapeShaders(ResourceBundle& resources, const SceneDefinition& scene, Actor root, std::vector<BlendshapeShaderConfigurationRequest>&& requests)
{
std::vector<std::string> errors;
- auto onError = [&errors](const std::string& msg) {
+ auto onError = [&errors](const std::string& msg) {
errors.push_back(msg);
};
- if (!scene.ConfigureBlendshapeShaders(resources, root, std::move(requests), onError))
+ if(!scene.ConfigureBlendshapeShaders(resources, root, std::move(requests), onError))
{
ExceptionFlinger flinger(ASSERT_LOCATION);
- for (auto& msg : errors)
+ for(auto& msg : errors)
{
flinger << msg << '\n';
}
return TEST_RESOURCE_DIR "/";
};
- ResourceBundle resources;
- SceneDefinition scene;
- std::vector<CameraParameters> cameraParameters;
- std::vector<LightParameters> lights;
- std::vector<AnimationDefinition> animations;
+ ResourceBundle resources;
+ SceneDefinition scene;
+ std::vector<CameraParameters> cameraParameters;
+ std::vector<LightParameters> lights;
+ std::vector<AnimationDefinition> animations;
std::vector<AnimationGroupDefinition> animGroups;
- LoadResult output {
+ LoadResult output{
resources,
scene,
animations,
animGroups,
cameraParameters,
- lights
- };
+ lights};
- DliLoader::InputParams input {
+ DliLoader::InputParams input{
pathProvider(ResourceType::Mesh),
nullptr,
{},
{},
nullptr,
};
- DliLoader::LoadParams loadParams{ input, output };
+ DliLoader::LoadParams loadParams{input, output};
std::vector<std::string> errors;
- DliLoader loader;
+ DliLoader loader;
StringCallback onError = [this](const std::string& error) {
errors.push_back(error);
bool StringHasTokens(const char* string, const std::vector<const char*>& tokens)
{
- for (auto& token: tokens)
+ for(auto& token : tokens)
{
auto result = strstr(string, token);
if(nullptr == result)
return true;
}
-}
+} // namespace
int UtcDaliDliLoaderLoadSceneNotFound(void)
{
DALI_TEST_EQUAL(ctx.loader.LoadScene("does_not_exist.dli", ctx.loadParams), false);
auto error = ctx.loader.GetParseError();
- DALI_TEST_CHECK(StringHasTokens(error.c_str(), { "Empty source buffer to parse." }));
+ DALI_TEST_CHECK(StringHasTokens(error.c_str(), {"Empty source buffer to parse."}));
END_TEST;
}
DALI_TEST_EQUAL(ctx.loader.LoadScene(path, ctx.loadParams), false);
auto error = ctx.loader.GetParseError();
- DALI_TEST_CHECK(StringHasTokens(error.c_str(), { "Unexpected character." }));
+ DALI_TEST_CHECK(StringHasTokens(error.c_str(), {"Unexpected character."}));
END_TEST;
}
int UtcDaliDliLoaderLoadSceneAssertions(void)
{
- const std::pair<std::string, std::string> pathExceptionPairs[] {
- // from RequireChild()
- { "scenes-nodes-missing", "Failed to find child node" },
- { "scenes-missing", "Failed to find child node" },
- { "nodes-missing", "Failed to find child node" },
+ const std::pair<std::string, std::string> pathExceptionPairs[]{
+ // from RequireChild()
+ {"scenes-nodes-missing", "Failed to find child node"},
+ {"scenes-missing", "Failed to find child node"},
+ {"nodes-missing", "Failed to find child node"},
// from ParseSceneInternal()
- { "scene-out-of-bounds", "out of bounds" },
- { "nodes-invalid-type", "invalid type; array required" },
- { "nodes-array-empty", "must define a node id" },
- { "root-id-invalid", "invalid value for root node index" },
- { "root-id-out-of-bounds", "out of bounds" },
- { "root-node-invalid-type", "invalid JSON type; object required" },
+ {"scene-out-of-bounds", "out of bounds"},
+ {"nodes-invalid-type", "invalid type; array required"},
+ {"nodes-array-empty", "must define a node id"},
+ {"root-id-invalid", "invalid value for root node index"},
+ {"root-id-out-of-bounds", "out of bounds"},
+ {"root-node-invalid-type", "invalid JSON type; object required"},
// from ParseSkeletons()
- { "skeleton-node-missing", "Missing required attribute" },
- { "skeleton-root-not-found", "not defined" },
+ {"skeleton-node-missing", "Missing required attribute"},
+ {"skeleton-root-not-found", "not defined"},
// from ParseShaders()
- { "shader-vertex-missing", "Missing vertex / fragment shader" },
- { "shader-fragment-missing", "Missing vertex / fragment shader" },
+ {"shader-vertex-missing", "Missing vertex / fragment shader"},
+ {"shader-fragment-missing", "Missing vertex / fragment shader"},
// from ParseMeshes()
- { "mesh-uri-missing", "Missing required attribute" },
- { "mesh-indices-read-fail", "Failed to read indices" },
- { "mesh-positions-read-fail", "Failed to read positions" },
+ {"mesh-uri-missing", "Missing required attribute"},
+ {"mesh-indices-read-fail", "Failed to read indices"},
+ {"mesh-positions-read-fail", "Failed to read positions"},
// from ParseMaterials()
- { "material-environment-out-of-bounds", "out of bounds" },
+ {"material-environment-out-of-bounds", "out of bounds"},
// from ParseNodes()
- { "node-model-mesh-missing", "Missing mesh" },
- { "node-arc-mesh-missing", "Missing mesh" },
- { "node-animated-image-mesh-missing", "Missing mesh" },
- { "node-renderable-mesh-invalid-type", "Invalid Mesh index type" },
- { "node-renderable-mesh-out-of-bounds", "out of bounds" },
- { "node-child-invalid-type", "invalid index type" },
- { "node-name-already-used", "name already used" },
+ {"node-model-mesh-missing", "Missing mesh"},
+ {"node-arc-mesh-missing", "Missing mesh"},
+ {"node-animated-image-mesh-missing", "Missing mesh"},
+ {"node-renderable-mesh-invalid-type", "Invalid Mesh index type"},
+ {"node-renderable-mesh-out-of-bounds", "out of bounds"},
+ {"node-child-invalid-type", "invalid index type"},
+ {"node-name-already-used", "name already used"},
// from ParseAnimations()
- { "animation-failed-to-open", "Failed to open animation data" }
- };
- for (auto& i: pathExceptionPairs)
+ {"animation-failed-to-open", "Failed to open animation data"}};
+ for(auto& i : pathExceptionPairs)
{
Context ctx;
DALI_TEST_EQUAL(ctx.animGroups.size(), 16u);
ViewProjection viewProjection;
- Transforms xforms {
+ Transforms xforms{
MatrixStack{},
- viewProjection
- };
+ viewProjection};
NodeDefinition::CreateParams nodeParams{
resources,
xforms,
Actor root = Actor::New();
SetActorCentered(root);
- for (auto iRoot : scene.GetRoots())
+ for(auto iRoot : scene.GetRoots())
{
auto resourceRefs = resources.CreateRefCounter();
scene.CountResourceRefs(iRoot, choices, resourceRefs);
resources.CountEnvironmentReferences(resourceRefs);
resources.LoadResources(resourceRefs, ctx.pathProvider);
- if (auto actor = scene.CreateNodes(iRoot, choices, nodeParams))
+ if(auto actor = scene.CreateNodes(iRoot, choices, nodeParams))
{
scene.ConfigureSkeletonJoints(iRoot, resources.mSkeletons, actor);
scene.ConfigureSkinningShaders(resources, actor, std::move(nodeParams.mSkinnables));
Context ctx;
std::vector<std::string> metadata;
- uint32_t metadataCount = 0;
- ctx.input.mPreNodeCategoryProcessors.push_back({ "metadata",
- [&](const Property::Array& array, StringCallback) {
- std::string key, value;
- for (uint32_t i0 = 0, i1 = array.Count(); i0 < i1; ++i0)
- {
- auto& data = array.GetElementAt(i0);
- DALI_TEST_EQUAL(data.GetType(), Property::MAP);
-
- auto map = data.GetMap();
- auto key = map->Find("key");
- auto value = map->Find("value");
- DALI_TEST_EQUAL(key->GetType(), Property::STRING);
- DALI_TEST_EQUAL(value->GetType(), Property::STRING);
- metadata.push_back(key->Get<std::string>() + ":" + value->Get<std::string>());
-
- ++metadataCount;
- }
- }
- });
+ uint32_t metadataCount = 0;
+ ctx.input.mPreNodeCategoryProcessors.push_back({"metadata",
+ [&](const Property::Array& array, StringCallback) {
+ std::string key, value;
+ for(uint32_t i0 = 0, i1 = array.Count(); i0 < i1; ++i0)
+ {
+ auto& data = array.GetElementAt(i0);
+ DALI_TEST_EQUAL(data.GetType(), Property::MAP);
+
+ auto map = data.GetMap();
+ auto key = map->Find("key");
+ auto value = map->Find("value");
+ DALI_TEST_EQUAL(key->GetType(), Property::STRING);
+ DALI_TEST_EQUAL(value->GetType(), Property::STRING);
+ metadata.push_back(key->Get<std::string>() + ":" + value->Get<std::string>());
+
+ ++metadataCount;
+ }
+ }});
std::vector<std::string> behaviors;
- uint32_t behaviorCount = 0;
- ctx.input.mPostNodeCategoryProcessors.push_back({ "behaviors",
- [&](const Property::Array& array, StringCallback) {
- for (uint32_t i0 = 0, i1 = array.Count(); i0 < i1; ++i0)
- {
- auto& data = array.GetElementAt(i0);
- DALI_TEST_EQUAL(data.GetType(), Property::MAP);
-
- auto map = data.GetMap();
- auto event = map->Find("event");
- auto url = map->Find("url");
- DALI_TEST_EQUAL(event->GetType(), Property::STRING);
- DALI_TEST_EQUAL(url->GetType(), Property::STRING);
- behaviors.push_back(event->Get<std::string>() + ":" + url->Get<std::string>());
-
- ++behaviorCount;
- }
- }
- });
-
- size_t numNodes = 0;
+ uint32_t behaviorCount = 0;
+ ctx.input.mPostNodeCategoryProcessors.push_back({"behaviors",
+ [&](const Property::Array& array, StringCallback) {
+ for(uint32_t i0 = 0, i1 = array.Count(); i0 < i1; ++i0)
+ {
+ auto& data = array.GetElementAt(i0);
+ DALI_TEST_EQUAL(data.GetType(), Property::MAP);
+
+ auto map = data.GetMap();
+ auto event = map->Find("event");
+ auto url = map->Find("url");
+ DALI_TEST_EQUAL(event->GetType(), Property::STRING);
+ DALI_TEST_EQUAL(url->GetType(), Property::STRING);
+ behaviors.push_back(event->Get<std::string>() + ":" + url->Get<std::string>());
+
+ ++behaviorCount;
+ }
+ }});
+
+ size_t numNodes = 0;
ctx.input.mNodePropertyProcessor = [&](const NodeDefinition&, const Property::Map&, StringCallback) {
++numNodes;
};
DALI_TEST_EQUAL(behaviors.size(), 1u);
ViewProjection viewProjection;
- Transforms xforms {
+ Transforms xforms{
MatrixStack{},
- viewProjection
- };
+ viewProjection};
NodeDefinition::CreateParams nodeParams{
resources,
xforms,
Actor root = Actor::New();
SetActorCentered(root);
- for (auto iRoot : scene.GetRoots())
+ for(auto iRoot : scene.GetRoots())
{
auto resourceRefs = resources.CreateRefCounter();
scene.CountResourceRefs(iRoot, choices, resourceRefs);
resources.CountEnvironmentReferences(resourceRefs);
resources.LoadResources(resourceRefs, ctx.pathProvider);
- if (auto actor = scene.CreateNodes(iRoot, choices, nodeParams))
+ if(auto actor = scene.CreateNodes(iRoot, choices, nodeParams))
{
scene.ConfigureSkeletonJoints(iRoot, resources.mSkeletons, actor);
scene.ConfigureSkinningShaders(resources, actor, std::move(nodeParams.mSkinnables));
DALI_TEST_EQUAL(ctx.animGroups.size(), 0u);
ViewProjection viewProjection;
- Transforms xforms {
+ Transforms xforms{
MatrixStack{},
- viewProjection
- };
+ viewProjection};
NodeDefinition::CreateParams nodeParams{
resources,
xforms,
Actor root = Actor::New();
SetActorCentered(root);
- for (auto iRoot : scene.GetRoots())
+ for(auto iRoot : scene.GetRoots())
{
auto resourceRefs = resources.CreateRefCounter();
scene.CountResourceRefs(iRoot, choices, resourceRefs);
resources.CountEnvironmentReferences(resourceRefs);
resources.LoadResources(resourceRefs, ctx.pathProvider);
- if (auto actor = scene.CreateNodes(iRoot, choices, nodeParams))
+ if(auto actor = scene.CreateNodes(iRoot, choices, nodeParams))
{
scene.ConfigureSkeletonJoints(iRoot, resources.mSkeletons, actor);
scene.ConfigureSkinningShaders(resources, actor, std::move(nodeParams.mSkinnables));
DALI_TEST_EQUAL(scene.GetNodeCount(), 1u);
ViewProjection viewProjection;
- Transforms xforms {
+ Transforms xforms{
MatrixStack{},
- viewProjection
- };
- auto& resources = ctx.resources;
+ viewProjection};
+ auto& resources = ctx.resources;
NodeDefinition::CreateParams nodeParams{
resources,
xforms,
Customization::Choices choices;
TestApplication app;
- Actor actor = scene.CreateNodes(0, choices, nodeParams);
+ Actor actor = scene.CreateNodes(0, choices, nodeParams);
DALI_TEST_EQUAL(actor.GetProperty(actor.GetPropertyIndex("fudgeFactor")).Get<float>(), 9000.1f);
DALI_TEST_EQUAL(actor.GetProperty(actor.GetPropertyIndex("fudgeVector")).Get<Vector2>(), Vector2(-.25f, 17.f));
DALI_TEST_EQUAL(scene.GetNodeCount(), 4u);
ViewProjection viewProjection;
- Transforms xforms {
+ Transforms xforms{
MatrixStack{},
- viewProjection
- };
- auto& resources = ctx.resources;
+ viewProjection};
+ auto& resources = ctx.resources;
NodeDefinition::CreateParams nodeParams{
resources,
xforms,
TestApplication app;
- Actor root = scene.CreateNodes(0, choices, nodeParams);
- Actor alice = root.FindChildByName("Alice");
- Actor bob = root.FindChildByName("Bob");
+ Actor root = scene.CreateNodes(0, choices, nodeParams);
+ Actor alice = root.FindChildByName("Alice");
+ Actor bob = root.FindChildByName("Bob");
Actor charlie = root.FindChildByName("Charlie");
DALI_TEST_EQUAL(nodeParams.mConstrainables.size(), 3u);
END_TEST;
}
+
+int UtcDaliDliLoaderLoadCoverageTest(void)
+{
+ Context ctx;
+
+ auto path = ctx.pathProvider(ResourceType::Mesh) + "coverageTest.dli";
+ DALI_TEST_CHECK(ctx.loader.LoadScene(path, ctx.loadParams));
+ DALI_TEST_CHECK(ctx.errors.empty());
+
+ auto& scene = ctx.scene;
+ auto& roots = scene.GetRoots();
+ DALI_TEST_EQUAL(roots.size(), 1u);
+ DALI_TEST_EQUAL(scene.GetNode(roots[0])->mName, "root");
+
+ DALI_TEST_EQUAL(scene.GetNodeCount(), 1u);
+
+ auto& resources = ctx.resources;
+ DALI_TEST_EQUAL(resources.mMeshes.size(), 1u);
+ DALI_TEST_EQUAL(resources.mShaders.size(), 1u);
+ DALI_TEST_EQUAL(resources.mEnvironmentMaps.size(), 2u);
+ DALI_TEST_EQUAL(resources.mSkeletons.size(), 0u);
+
+ auto& materials = ctx.resources.mMaterials;
+ DALI_TEST_EQUAL(2u, materials.size());
+
+ auto iMaterial = materials.begin();
+ auto& md = iMaterial->first;
+ DALI_TEST_EQUAL(md.mTextureStages.size(), 1u);
+
+ auto iTexture = md.mTextureStages.begin();
+ DALI_TEST_CHECK(MaskMatch(iTexture->mSemantic, MaterialDefinition::OCCLUSION));
+ DALI_TEST_EQUAL(iTexture->mTexture.mImageUri, "exercise/Icons/Icon_Idle.png");
+ ++iTexture;
+
+ DALI_TEST_EQUAL(ctx.cameraParameters.size(), 1u);
+ DALI_TEST_EQUAL(ctx.lights.size(), 1u);
+ DALI_TEST_EQUAL(ctx.animations.size(), 0u);
+ DALI_TEST_EQUAL(ctx.animGroups.size(), 0u);
+
+ ViewProjection viewProjection;
+ Transforms xforms{
+ MatrixStack{},
+ viewProjection};
+ NodeDefinition::CreateParams nodeParams{
+ resources,
+ xforms,
+ };
+
+ Customization::Choices choices;
+
+ TestApplication app;
+
+ Actor root = Actor::New();
+ SetActorCentered(root);
+ for(auto iRoot : scene.GetRoots())
+ {
+ auto resourceRefs = resources.CreateRefCounter();
+ scene.CountResourceRefs(iRoot, choices, resourceRefs);
+ resources.CountEnvironmentReferences(resourceRefs);
+ resources.LoadResources(resourceRefs, ctx.pathProvider);
+ if(auto actor = scene.CreateNodes(iRoot, choices, nodeParams))
+ {
+ scene.ConfigureSkeletonJoints(iRoot, resources.mSkeletons, actor);
+ scene.ConfigureSkinningShaders(resources, actor, std::move(nodeParams.mSkinnables));
+ ConfigureBlendShapeShaders(resources, scene, actor, std::move(nodeParams.mBlendshapeRequests));
+ scene.ApplyConstraints(actor, std::move(nodeParams.mConstrainables));
+ root.Add(actor);
+ }
+ }
+
+ DALI_TEST_EQUAL(root.GetChildCount(), 1u);
+ DALI_TEST_EQUAL(root.GetChildAt(0).GetProperty(Actor::Property::NAME).Get<std::string>(), "root");
+
+ END_TEST;
+}
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
+#include <dali-test-suite-utils.h>
+#include <set>
+#include <string_view>
#include "dali-scene-loader/public-api/gltf2-loader.h"
-#include "dali-scene-loader/public-api/shader-definition-factory.h"
#include "dali-scene-loader/public-api/node-definition.h"
#include "dali-scene-loader/public-api/resource-bundle.h"
-#include <dali-test-suite-utils.h>
-#include <string_view>
-#include <set>
+#include "dali-scene-loader/public-api/shader-definition-factory.h"
using namespace Dali;
using namespace Dali::SceneLoader;
namespace
{
-
bool EndsWith(const std::string& str, const std::string& suffix) // ends_width() is C++20
{
return str.size() >= suffix.size() && str.substr(str.size() - suffix.size()).compare(suffix) == 0;
struct Context
{
- ResourceBundle resources;
+ ResourceBundle resources;
ShaderDefinitionFactory factory;
Context()
struct ShaderParameters
{
- MeshDefinition& meshDef;
+ MeshDefinition& meshDef;
MaterialDefinition& materialDef;
- NodeDefinition& nodeDef;
+ NodeDefinition& nodeDef;
};
struct Permutation
{
- using ConfigureFn = void(*)(ShaderParameters&);
+ using ConfigureFn = void (*)(ShaderParameters&);
ConfigureFn configureFn;
std::set<std::string> defines;
- RendererState::Type rendererStateSet = 0;
- RendererState::Type rendererStateClear = 0;
+ RendererState::Type rendererStateSet = 0;
+ RendererState::Type rendererStateClear = 0;
};
struct PermutationSet
{
std::vector<const Permutation*> permutations;
- Index shaderIdx;
+ Index shaderIdx;
};
-}
+} // namespace
int UtcDaliShaderDefinitionFactoryProduceShaderInvalid(void)
{
[](ShaderParameters& p) {
p.materialDef.mFlags |= MaterialDefinition::TRANSPARENCY;
},
- { "THREE_TEX" },
+ {"THREE_TEX"},
RendererState::ALPHA_BLEND,
RendererState::DEPTH_WRITE,
},
- {
- [](ShaderParameters& p) {
- p.materialDef.mTextureStages.push_back({ MaterialDefinition::ALBEDO, {} });
- },
- { "THREE_TEX" }
- },
- {
- [](ShaderParameters& p) {
- p.materialDef.mTextureStages.push_back({ MaterialDefinition::METALLIC | MaterialDefinition::ROUGHNESS, {} });
- },
- { "THREE_TEX" }
- },
- {
- [](ShaderParameters& p) {
- p.materialDef.mTextureStages.push_back({ MaterialDefinition::NORMAL, {} });
- },
- { "THREE_TEX" }
- },
- {
- [](ShaderParameters& p) {
- p.materialDef.mFlags |= MaterialDefinition::SUBSURFACE;
- },
- { "SSS" }
- },
- {
- [](ShaderParameters& p) {
- p.materialDef.SetAlphaCutoff(.5f);
- },
- { "ALPHA_TEST" }
- },
- {
- [](ShaderParameters& p) {
- p.materialDef.SetAlphaCutoff(1.f);
- },
- { "ALPHA_TEST" }
- },
- {
- [](ShaderParameters& p) {
- p.materialDef.mFlags |= MaterialDefinition::GLTF_CHANNELS;
- },
- { "GLTF_CHANNELS" }
- },
- {
- [](ShaderParameters& p) {
- p.meshDef.mJoints0.mBlob.mOffset = 0;
- p.meshDef.mWeights0.mBlob.mOffset = 0;
- },
- { "SKINNING" }
- },
- {
- [](ShaderParameters& p) {
- p.meshDef.mFlags |= MeshDefinition::FLIP_UVS_VERTICAL;
- },
- { "FLIP_V" }
- },
+ {[](ShaderParameters& p) {
+ p.materialDef.mTextureStages.push_back({MaterialDefinition::ALBEDO, {}});
+ },
+ {"THREE_TEX"}},
+ {[](ShaderParameters& p) {
+ p.materialDef.mTextureStages.push_back({MaterialDefinition::METALLIC | MaterialDefinition::ROUGHNESS, {}});
+ },
+ {"THREE_TEX"}},
+ {[](ShaderParameters& p) {
+ p.materialDef.mTextureStages.push_back({MaterialDefinition::NORMAL, {}});
+ },
+ {"THREE_TEX"}},
+ {[](ShaderParameters& p) {
+ p.materialDef.mFlags |= MaterialDefinition::SUBSURFACE;
+ },
+ {"SSS"}},
+ {[](ShaderParameters& p) {
+ p.materialDef.SetAlphaCutoff(.5f);
+ },
+ {"ALPHA_TEST"}},
+ {[](ShaderParameters& p) {
+ p.materialDef.SetAlphaCutoff(1.f);
+ },
+ {"ALPHA_TEST"}},
+ {[](ShaderParameters& p) {
+ p.materialDef.mFlags |= MaterialDefinition::GLTF_CHANNELS;
+ },
+ {"GLTF_CHANNELS"}},
+ {[](ShaderParameters& p) {
+ p.meshDef.mJoints0.mBlob.mOffset = 0;
+ p.meshDef.mWeights0.mBlob.mOffset = 0;
+ },
+ {"SKINNING"}},
+ {[](ShaderParameters& p) {
+ p.meshDef.mFlags |= MeshDefinition::FLIP_UVS_VERTICAL;
+ },
+ {"FLIP_V"}},
{
[](ShaderParameters& p) {
p.meshDef.mBlendShapes.push_back({});
},
},
- {
- [](ShaderParameters& p) {
- p.meshDef.mBlendShapes.back().deltas.mBlob.mOffset = 0;
- },
- { "MORPH_POSITION", "MORPH" }
- },
- {
- [](ShaderParameters& p) {
- p.meshDef.mBlendShapes.back().normals.mBlob.mOffset = 0;
- },
- { "MORPH_NORMAL", "MORPH" }
- },
- {
- [](ShaderParameters& p) {
- p.meshDef.mBlendShapes.back().tangents.mBlob.mOffset = 0;
- },
- { "MORPH_TANGENT", "MORPH" }
- },
- {
- [](ShaderParameters& p) {
- auto& blendShapes = p.meshDef.mBlendShapes;
- DALI_ASSERT_ALWAYS(!blendShapes.empty() &&
- (blendShapes.back().deltas.mBlob.mOffset != MeshDefinition::INVALID ||
- blendShapes.back().normals.mBlob.mOffset != MeshDefinition::INVALID ||
- blendShapes.back().tangents.mBlob.mOffset != MeshDefinition::INVALID));
- p.meshDef.mBlendShapeVersion = BlendShapes::Version::VERSION_2_0;
- },
- { "MORPH_VERSION_2_0" }
- },
+ {[](ShaderParameters& p) {
+ p.meshDef.mBlendShapes.back().deltas.mBlob.mOffset = 0;
+ },
+ {"MORPH_POSITION", "MORPH"}},
+ {[](ShaderParameters& p) {
+ p.meshDef.mBlendShapes.back().normals.mBlob.mOffset = 0;
+ },
+ {"MORPH_NORMAL", "MORPH"}},
+ {[](ShaderParameters& p) {
+ p.meshDef.mBlendShapes.back().tangents.mBlob.mOffset = 0;
+ },
+ {"MORPH_TANGENT", "MORPH"}},
+ {[](ShaderParameters& p) {
+ auto& blendShapes = p.meshDef.mBlendShapes;
+ DALI_ASSERT_ALWAYS(!blendShapes.empty() &&
+ (blendShapes.back().deltas.mBlob.mOffset != MeshDefinition::INVALID ||
+ blendShapes.back().normals.mBlob.mOffset != MeshDefinition::INVALID ||
+ blendShapes.back().tangents.mBlob.mOffset != MeshDefinition::INVALID));
+ p.meshDef.mBlendShapeVersion = BlendShapes::Version::VERSION_2_0;
+ },
+ {"MORPH_VERSION_2_0"}},
+
+ {[](ShaderParameters& p) {
+ p.materialDef.mFlags |= MaterialDefinition::OCCLUSION;
+ },
+
+ {"OCCLUSION"}},
};
- PermutationSet permSets[] {
+ PermutationSet permSets[]{
// default
- { { &permutations[0] }, 0 },
+ {{&permutations[0]}, 0},
// alpha
- { { &permutations[0], &permutations[1] }, 1 },
+ {{&permutations[0], &permutations[1]}, 1},
// three-texture setups
- { { &permutations[0], &permutations[2] }, 2 },
- { { &permutations[0], &permutations[3] }, 2 },
- { { &permutations[0], &permutations[4] }, 2 },
- { { &permutations[0], &permutations[2], &permutations[3] }, 2 },
- { { &permutations[0], &permutations[3], &permutations[4] }, 2 },
- { { &permutations[0], &permutations[4], &permutations[2] }, 2 },
- { { &permutations[0], &permutations[2], &permutations[3], &permutations[4] }, 2 },
+ {{&permutations[0], &permutations[2]}, 2},
+ {{&permutations[0], &permutations[3]}, 2},
+ {{&permutations[0], &permutations[4]}, 2},
+ {{&permutations[0], &permutations[2], &permutations[3]}, 2},
+ {{&permutations[0], &permutations[3], &permutations[4]}, 2},
+ {{&permutations[0], &permutations[4], &permutations[2]}, 2},
+ {{&permutations[0], &permutations[2], &permutations[3], &permutations[4]}, 2},
// subsurface scattering
- { { &permutations[0], &permutations[5] }, 3 },
+ {{&permutations[0], &permutations[5]}, 3},
// alpha test
- { { &permutations[0], &permutations[6] }, 4 },
- { { &permutations[0], &permutations[7] }, 4 },
+ {{&permutations[0], &permutations[6]}, 4},
+ {{&permutations[0], &permutations[7]}, 4},
// glTF channels
- { { &permutations[0], &permutations[8] }, 5 },
+ {{&permutations[0], &permutations[8]}, 5},
// skinning
- { { &permutations[0], &permutations[9] }, 6 },
+ {{&permutations[0], &permutations[9]}, 6},
// flip uvs
- { { &permutations[0], &permutations[10] }, 7 },
+ {{&permutations[0], &permutations[10]}, 7},
// morphing
- { { &permutations[0], &permutations[11], &permutations[12] }, 8 },
- { { &permutations[0], &permutations[11], &permutations[13] }, 9 },
- { { &permutations[0], &permutations[11], &permutations[14] }, 10 },
- { { &permutations[0], &permutations[11], &permutations[12], &permutations[13] }, 11 },
- { { &permutations[0], &permutations[11], &permutations[13], &permutations[14] }, 12 },
- { { &permutations[0], &permutations[11], &permutations[14], &permutations[12] }, 13 },
- { { &permutations[0], &permutations[11], &permutations[12], &permutations[13], &permutations[14] }, 14 },
-
- { { &permutations[0], &permutations[11], &permutations[12], &permutations[15] }, 15 },
- { { &permutations[0], &permutations[11], &permutations[13], &permutations[15] }, 16 },
- { { &permutations[0], &permutations[11], &permutations[14], &permutations[15] }, 17 },
- { { &permutations[0], &permutations[11], &permutations[12], &permutations[13], &permutations[15] }, 18 },
- { { &permutations[0], &permutations[11], &permutations[13], &permutations[14], &permutations[15] }, 19 },
- { { &permutations[0], &permutations[11], &permutations[14], &permutations[12], &permutations[15] }, 20 },
- { { &permutations[0], &permutations[11], &permutations[12], &permutations[13], &permutations[14], &permutations[15] }, 21 },
+ {{&permutations[0], &permutations[11], &permutations[12]}, 8},
+ {{&permutations[0], &permutations[11], &permutations[13]}, 9},
+ {{&permutations[0], &permutations[11], &permutations[14]}, 10},
+ {{&permutations[0], &permutations[11], &permutations[12], &permutations[13]}, 11},
+ {{&permutations[0], &permutations[11], &permutations[13], &permutations[14]}, 12},
+ {{&permutations[0], &permutations[11], &permutations[14], &permutations[12]}, 13},
+ {{&permutations[0], &permutations[11], &permutations[12], &permutations[13], &permutations[14]}, 14},
+
+ {{&permutations[0], &permutations[11], &permutations[12], &permutations[15]}, 15},
+ {{&permutations[0], &permutations[11], &permutations[13], &permutations[15]}, 16},
+ {{&permutations[0], &permutations[11], &permutations[14], &permutations[15]}, 17},
+ {{&permutations[0], &permutations[11], &permutations[12], &permutations[13], &permutations[15]}, 18},
+ {{&permutations[0], &permutations[11], &permutations[13], &permutations[14], &permutations[15]}, 19},
+ {{&permutations[0], &permutations[11], &permutations[14], &permutations[12], &permutations[15]}, 20},
+ {{&permutations[0], &permutations[11], &permutations[12], &permutations[13], &permutations[14], &permutations[15]}, 21},
// etc.
- { { &permutations[0], &permutations[1], &permutations[2] }, 1 },
- { { &permutations[0], &permutations[1], &permutations[3] }, 1 },
- { { &permutations[0], &permutations[1], &permutations[2], &permutations[3] }, 1 },
+ {{&permutations[0], &permutations[1], &permutations[2]}, 1},
+ {{&permutations[0], &permutations[1], &permutations[3]}, 1},
+ {{&permutations[0], &permutations[1], &permutations[2], &permutations[3]}, 1},
+
+ // occlusion
+ {{&permutations[0], &permutations[16]}, 22},
};
- for(auto& ps: permSets)
+
+ for(auto& ps : permSets)
{
printf("%ld\n", &ps - permSets);
- auto modelNode = new ModelNode();
- modelNode->mMeshIdx = 0;
+ auto modelNode = new ModelNode();
+ modelNode->mMeshIdx = 0;
modelNode->mMaterialIdx = 0;
NodeDefinition nodeDef;
nodeDef.mRenderable.reset(modelNode);
- auto& meshDef = NewMeshDefinition(ctx.resources);
- auto& materialDef = NewMaterialDefinition(ctx.resources);
- ShaderParameters sp{ meshDef, materialDef, nodeDef };
+ auto& meshDef = NewMeshDefinition(ctx.resources);
+ auto& materialDef = NewMaterialDefinition(ctx.resources);
+ ShaderParameters sp{meshDef, materialDef, nodeDef};
std::set<std::string> defines;
- RendererState::Type rendererState = 0;
- for (auto p : ps.permutations)
+ RendererState::Type rendererState = 0;
+ for(auto p : ps.permutations)
{
p->configureFn(sp);
defines.insert(p->defines.begin(), p->defines.end());
DALI_TEST_EQUAL(shaderDef.mRendererState, rendererState);
uint32_t definesUnmatched = shaderDef.mDefines.size();
- for (auto& d: shaderDef.mDefines)
+ for(auto& d : shaderDef.mDefines)
{
auto iFind = defines.find(d);
- if (iFind != defines.end())
+ if(iFind != defines.end())
{
defines.erase(iFind);
--definesUnmatched;
DALI_TEST_EQUALS(children.size(), 1u, TEST_LOCATION);
- auto address = children[0]->GetAddress();
+ auto* child = children[0];
+
+ DALI_TEST_CHECK(child);
+ DALI_TEST_CHECK(child->IsProxy());
+ DALI_TEST_EQUALS(child->GetParent(), webViewAccessible, TEST_LOCATION);
+
+ auto address = child->GetAddress();
DALI_TEST_CHECK(address);
DALI_TEST_NOT_EQUALS(address.GetBus(), webViewAccessible->GetAddress().GetBus(), 0.0f, TEST_LOCATION);
mCore->ProcessEvents();
}
-void TestApplication::DoUpdate(uint32_t intervalMilliseconds, const char* location)
+void TestApplication::DoUpdate(uint32_t intervalMilliseconds, const char* location, bool uploadOnly)
{
if(GetUpdateStatus() == 0 &&
mRenderStatus.NeedsUpdate() == false &&
uint32_t nextVSyncTime = mLastVSyncTime + intervalMilliseconds;
float elapsedSeconds = static_cast<float>(intervalMilliseconds) * 0.001f;
- mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false);
+ mCore->Update(elapsedSeconds, mLastVSyncTime, nextVSyncTime, mStatus, false, false, uploadOnly);
GetRenderController().Initialize();
mLastVSyncTime = nextVSyncTime;
}
-bool TestApplication::Render(uint32_t intervalMilliseconds, const char* location)
+bool TestApplication::Render(uint32_t intervalMilliseconds, const char* location, bool uploadOnly)
{
- DoUpdate(intervalMilliseconds, location);
+ DoUpdate(intervalMilliseconds, location, uploadOnly);
// Reset the status
mRenderStatus.SetNeedsUpdate(false);
mRenderStatus.SetNeedsPostRender(false);
- mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
- mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
- mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
- mCore->PostRender(false /*do not skip rendering*/);
+ mCore->PreRender(mRenderStatus, false /*do not force clear*/);
+ if(!uploadOnly)
+ {
+ mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
+ mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
+ }
+ mCore->PostRender();
mFrame++;
{
DoUpdate(intervalMilliseconds, location);
- mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
+ mCore->PreRender(mRenderStatus, false /*do not force clear*/);
mCore->PreRender(mScene, damagedRects);
return mStatus.KeepUpdating() || mRenderStatus.NeedsUpdate();
{
mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/, clippingRect);
- mCore->PostRender(false /*do not skip rendering*/);
+ mCore->PostRender();
mFrame++;
bool TestApplication::RenderOnly()
{
// Update Time values
- mCore->PreRender(mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/);
+ mCore->PreRender(mRenderStatus, false /*do not force clear*/);
mCore->RenderScene(mRenderStatus, mScene, true /*render the off-screen buffers*/);
mCore->RenderScene(mRenderStatus, mScene, false /*render the surface*/);
- mCore->PostRender(false /*do not skip rendering*/);
+ mCore->PostRender();
mFrame++;
void ProcessEvent(const Integration::Event& event);
void SendNotification();
- bool Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL);
+ bool Render(uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location = NULL, bool uploadOnly = false);
bool PreRenderWithPartialUpdate(uint32_t intervalMilliseconds, const char* location, std::vector<Rect<int>>& damagedRects);
bool RenderWithPartialUpdate(std::vector<Rect<int>>& damagedRects, Rect<int>& clippingRect);
uint32_t GetUpdateStatus();
}
private:
- void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL);
+ void DoUpdate(uint32_t intervalMilliseconds, const char* location = NULL, bool uploadOnly = false);
protected:
TestPlatformAbstraction mPlatformAbstraction;
KeyboardFocusManager manager = KeyboardFocusManager::Get();
DALI_TEST_CHECK(manager);
- // Create the first actor and add it to the stage
- Actor first = Actor::New();
+ // Create the first control and add it to the stage
+ Control first = Control::New();
first.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
application.GetScene().Add(first);
- // Create the second actor and add it to the first actor.
- Actor second = Actor::New();
+ // Create the second control and add it to the first control.
+ Control second = Control::New();
second.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
first.Add(second);
DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+ // If the currently focused actor becomes USER_INTERACTION_ENABLED false, it loses focus.
+ second.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, false);
+
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+
+ END_TEST;
+}
+
+
+int UtcDaliKeyboardFocusManagerWithHide(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline(" UtcDaliKeyboardFocusManagerWithHide");
+
+ KeyboardFocusManager manager = KeyboardFocusManager::Get();
+ DALI_TEST_CHECK(manager);
+
+ // Create the first control and add it to the stage
+ Control first = Control::New();
+ first.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
+ application.GetScene().Add(first);
+
+ // Create the second control and add it to the first control.
+ Control second = Control::New();
+ second.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
+ first.Add(second);
+
+
+ // flush the queue and render once
+ application.SendNotification();
+ application.Render();
+
+ // Check that no actor is being focused yet.
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ // Check that the focus is set on the actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(first) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == first);
+
+ // If the currently focused actor becomes VISIBLE false, it loses focus.
+ first.SetProperty(Actor::Property::VISIBLE, false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+ first.SetProperty(Actor::Property::VISIBLE, true);
+ // Check that the focus is set on the actor
+ DALI_TEST_CHECK(manager.SetCurrentFocusActor(second) == true);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == second);
+
+ // If the currently focused actor becomes VISIBLE false, When the parent is hidden, the child also loses focus.
+ first.SetProperty(Actor::Property::VISIBLE, false);
+ DALI_TEST_CHECK(manager.GetCurrentFocusActor() == Actor());
+
+
END_TEST;
}
\ No newline at end of file
DALI_TEST_CHECK(sizeValue);
DALI_TEST_CHECK(sizeValue->Get<float>() == 10.f);
- // Get default value of borderline values here
-
- sizeValue = resultMap.Find(DevelVisual::Property::BORDERLINE_WIDTH, Property::FLOAT);
- DALI_TEST_CHECK(sizeValue);
- DALI_TEST_CHECK(sizeValue->Get<float>() == 0.0f);
-
- colorValue = resultMap.Find(DevelVisual::Property::BORDERLINE_COLOR, Property::VECTOR4);
- DALI_TEST_CHECK(colorValue);
- DALI_TEST_CHECK(colorValue->Get<Vector4>() == Color::BLACK);
-
- sizeValue = resultMap.Find(DevelVisual::Property::BORDERLINE_OFFSET, Property::FLOAT);
- DALI_TEST_CHECK(sizeValue);
- DALI_TEST_CHECK(sizeValue->Get<float>() == 0.0f);
-
END_TEST;
}
DALI_TEST_EQUALS(actor.GetRendererCount(), 1u, TEST_LOCATION);
- Renderer renderer = actor.GetRendererAt(0);
+ Renderer renderer = actor.GetRendererAt(0);
const Vector4 INITIAL_MIX_COLOR(1.0f, 0.0f, 1.0f, 0.5f); // Magenta with half alpha
const Vector4 TARGET_MIX_COLOR(Color::RED);
DALI_TEST_EQUALS(value->Get<bool>(), false, TEST_LOCATION);
}
- // svg visual ( premultiplied alpha by default is true )
+ // svg visual ( premultiplied alpha by default is true, and cannot change value )
{
Visual::Base imageVisual = factory.CreateVisual(
Property::Map()
DALI_TEST_CHECK(value);
DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
}
+ {
+ Visual::Base imageVisual = factory.CreateVisual(
+ Property::Map()
+ .Add(Toolkit::Visual::Property::TYPE, Visual::IMAGE)
+ .Add(ImageVisual::Property::URL, TEST_SVG_FILE_NAME)
+ .Add(Visual::Property::PREMULTIPLIED_ALPHA, false));
+
+ Dali::Property::Map visualMap;
+ imageVisual.CreatePropertyMap(visualMap);
+ Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+ // test values
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+ }
+
+ // animated vector visual ( premultiplied alpha by default is true, and cannot change value )
+ {
+ Visual::Base imageVisual = factory.CreateVisual(
+ Property::Map()
+ .Add(Toolkit::Visual::Property::TYPE, Visual::IMAGE)
+ .Add(ImageVisual::Property::URL, "something.json"));
+
+ Dali::Property::Map visualMap;
+ imageVisual.CreatePropertyMap(visualMap);
+ Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+ // test values
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+ }
+ {
+ Visual::Base imageVisual = factory.CreateVisual(
+ Property::Map()
+ .Add(Toolkit::Visual::Property::TYPE, Visual::IMAGE)
+ .Add(ImageVisual::Property::URL, "something.json")
+ .Add(Visual::Property::PREMULTIPLIED_ALPHA, false));
+
+ Dali::Property::Map visualMap;
+ imageVisual.CreatePropertyMap(visualMap);
+ Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+ // test values
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+ }
+
+ // text visual ( premultiplied alpha by default is true, and cannot change value )
+ {
+ Visual::Base textVisual = factory.CreateVisual(
+ Property::Map()
+ .Add(Toolkit::Visual::Property::TYPE, Visual::TEXT)
+ .Add(TextVisual::Property::TEXT, "Text"));
+
+ Dali::Property::Map visualMap;
+ textVisual.CreatePropertyMap(visualMap);
+ Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+ // test values
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+ }
+ {
+ Visual::Base textVisual = factory.CreateVisual(
+ Property::Map()
+ .Add(Toolkit::Visual::Property::TYPE, Visual::TEXT)
+ .Add(TextVisual::Property::TEXT, "Text")
+ .Add(Visual::Property::PREMULTIPLIED_ALPHA, false));
+
+ Dali::Property::Map visualMap;
+ textVisual.CreatePropertyMap(visualMap);
+ Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+ // test values
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+ }
+
+ // gradient visual ( premultiplied alpha by default is true, and cannot change value )
+ {
+ Visual::Base gradientVisual = factory.CreateVisual(
+ Property::Map()
+ .Add(Toolkit::Visual::Property::TYPE, Visual::GRADIENT)
+ .Add(GradientVisual::Property::START_POSITION, Vector2(-0.5f, -0.5f))
+ .Add(GradientVisual::Property::END_POSITION, Vector2(0.5f, 0.5f))
+ .Add(GradientVisual::Property::STOP_COLOR, Property::Array().Add(Color::RED).Add(Vector4(1.0f, 1.0f, 1.0f, 0.5f))));
+
+ Dali::Property::Map visualMap;
+ gradientVisual.CreatePropertyMap(visualMap);
+ Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+ // test values
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+ }
+ {
+ Visual::Base gradientVisual = factory.CreateVisual(
+ Property::Map()
+ .Add(Toolkit::Visual::Property::TYPE, Visual::GRADIENT)
+ .Add(GradientVisual::Property::START_POSITION, Vector2(-0.5f, -0.5f))
+ .Add(GradientVisual::Property::END_POSITION, Vector2(0.5f, 0.5f))
+ .Add(GradientVisual::Property::STOP_COLOR, Property::Array().Add(Color::RED).Add(Vector4(1.0f, 1.0f, 1.0f, 0.5f)))
+ .Add(Visual::Property::PREMULTIPLIED_ALPHA, false));
+
+ Dali::Property::Map visualMap;
+ gradientVisual.CreatePropertyMap(visualMap);
+ Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+ // test values
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS(value->Get<bool>(), true, TEST_LOCATION);
+ }
+
+ // color visual ( premultiplied alpha by default is false, and cannot change value )
+ {
+ Visual::Base colorVisual = factory.CreateVisual(
+ Property::Map()
+ .Add(Toolkit::Visual::Property::TYPE, Visual::COLOR)
+ .Add(ColorVisual::Property::MIX_COLOR, Color::AQUA));
+
+ Dali::Property::Map visualMap;
+ colorVisual.CreatePropertyMap(visualMap);
+ Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+ // test values
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS(value->Get<bool>(), false, TEST_LOCATION);
+ }
+ {
+ Visual::Base colorVisual = factory.CreateVisual(
+ Property::Map()
+ .Add(Toolkit::Visual::Property::TYPE, Visual::COLOR)
+ .Add(ColorVisual::Property::MIX_COLOR, Color::AQUA)
+ .Add(Visual::Property::PREMULTIPLIED_ALPHA, true));
+
+ Dali::Property::Map visualMap;
+ colorVisual.CreatePropertyMap(visualMap);
+ Property::Value* value = visualMap.Find(Visual::Property::PREMULTIPLIED_ALPHA);
+
+ // test values
+ DALI_TEST_CHECK(value);
+ DALI_TEST_EQUALS(value->Get<bool>(), false, TEST_LOCATION);
+ }
END_TEST;
}
UniformData("blurRadius", Property::Type::FLOAT),
UniformData("borderlineWidth", Property::Type::FLOAT),
UniformData("borderlineColor", Property::Type::VECTOR4),
- UniformData("borderlineOffset", Property::Type::FLOAT),
- UniformData("preMultipliedAlpha", Property::Type::FLOAT)};
+ UniformData("borderlineOffset", Property::Type::FLOAT)};
TestGraphicsController& graphics = application.GetGraphicsController();
graphics.AddCustomUniforms(customUniforms);
propertyMap.Insert(DevelVisual::Property::BORDERLINE_WIDTH, 20.0f);
propertyMap.Insert(DevelVisual::Property::BORDERLINE_COLOR, Color::RED);
propertyMap.Insert(DevelVisual::Property::BORDERLINE_OFFSET, 1.0f);
- propertyMap.Insert(Visual::Property::PREMULTIPLIED_ALPHA, true);
Visual::Base colorVisual = factory.CreateVisual(propertyMap);
DummyControl dummyControl = DummyControl::New(true);
float targetBlurRadius = 10.0f;
float targetBorderlineWidth = 25.0f;
Vector4 targetBorderlineColor(1.0f, 1.0f, 1.0f, 1.0f);
- float targetBorderlineOffset = -1.0f;
- float targetPreMultipliedAlpha = 1.0f;
+ float targetBorderlineOffset = -1.0f;
Animation animation = Animation::New(1.0f);
animation.AnimateTo(DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL, Visual::Property::MIX_COLOR), targetColor);
DALI_TEST_CHECK(borderlineOffsetValue);
DALI_TEST_EQUALS(borderlineOffsetValue->Get<float>(), targetBorderlineOffset, TEST_LOCATION);
- Property::Value* preMultAlphaValue = resultMap.Find(Visual::Property::PREMULTIPLIED_ALPHA, Property::BOOLEAN);
- DALI_TEST_CHECK(preMultAlphaValue);
- DALI_TEST_EQUALS(preMultAlphaValue->Get<bool>(), bool(targetPreMultipliedAlpha), TEST_LOCATION);
-
// Test uniform values
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector3>("mixColor", targetColor), true, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector2>("offset", targetOffset), true, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("borderlineWidth", targetBorderlineWidth), true, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<Vector4>("borderlineColor", targetBorderlineColor), true, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("borderlineOffset", targetBorderlineOffset), true, TEST_LOCATION);
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckUniformValue<float>("preMultipliedAlpha", targetPreMultipliedAlpha), true, TEST_LOCATION);
// Test unregistered visual
Property property3 = DevelControl::GetVisualProperty(dummyControl, DummyControl::Property::TEST_VISUAL2, Visual::Property::MIX_COLOR);
materialDef.mFlags |= semantic;
}
+ if(ReadString(node.GetChild("occlusionMap"), texturePath))
+ {
+ ToUnixFileSeparators(texturePath);
+ const auto semantic = MaterialDefinition::OCCLUSION;
+ materialDef.mTextureStages.push_back({semantic, TextureDefinition{std::move(texturePath)}});
+ materialDef.mFlags |= semantic;
+ }
+
if(ReadColorCodeOrColor(&node, materialDef.mColor, convertColorCode) &&
materialDef.mColor.a < 1.0f)
{
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
++iTexture;
}
+ if(checkStage(OCCLUSION))
+ {
+ raw.mTextures.push_back({SyncImageLoader::Load(imagesPath + iTexture->mTexture.mImageUri), iTexture->mTexture.mSamplerFlags});
+ ++iTexture;
+ }
+
return raw;
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
hash.Add("SSS");
}
+ if(MaskMatch(materialDef.mFlags, MaterialDefinition::OCCLUSION))
+ {
+ hash.Add("OCCL" /*USION*/);
+ }
+
if(MaskMatch(materialDef.mFlags, MaterialDefinition::GLTF_CHANNELS))
{
hash.Add("GLTF" /*_CHANNELS*/);
shaderDef.mDefines.push_back("SSS");
}
+ if(MaskMatch(receiver.mMaterialDef->mFlags, MaterialDefinition::OCCLUSION))
+ {
+ shaderDef.mDefines.push_back("OCCLUSION");
+ }
+
if(MaskMatch(receiver.mMaterialDef->mFlags, MaterialDefinition::GLTF_CHANNELS))
{
shaderDef.mDefines.push_back("GLTF_CHANNELS");
/*
-* Copyright (c) 2021 Samsung Electronics Co., Ltd.
+* Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
case Dali::Pixel::DEPTH_FLOAT:
case Dali::Pixel::DEPTH_STENCIL:
case Dali::Pixel::R11G11B10F:
+ case Dali::Pixel::CHROMINANCE_U:
+ case Dali::Pixel::CHROMINANCE_V:
{
DALI_LOG_ERROR("Pixel format not compatible.\n");
byteOffset = 0;
WebView::WebViewAccessible::WebViewAccessible(Dali::Actor self, Dali::WebEngine& webEngine)
: ControlAccessible(self), mRemoteChild{}, mWebEngine{webEngine}
{
+ mRemoteChild.SetParent(this);
+
Dali::Accessibility::Bridge::EnabledSignal().Connect(this, &WebViewAccessible::OnAccessibilityEnabled);
Dali::Accessibility::Bridge::DisabledSignal().Connect(this, &WebViewAccessible::OnAccessibilityDisabled);
SHAPE_TEXT |
GET_GLYPH_METRICS);
+ const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT | ALIGN | REORDER);
+
// Set the update info to relayout the whole text.
TextUpdateInfo& textUpdateInfo = impl.mTextUpdateInfo;
if((0 == textUpdateInfo.mNumberOfCharactersToAdd) &&
textUpdateInfo.mParagraphCharacterIndex = 0u;
textUpdateInfo.mRequestedNumberOfCharacters = model->mLogicalModel->mText.Count();
- // This is to keep Index to the first character to be updated.
- // Then restore it after calling Clear method.
- auto updateInfoCharIndexBackup = textUpdateInfo.mCharacterIndex;
-
// Get a reference to the pending operations member
OperationsMask& operationsPending = impl.mOperationsPending;
- // Layout the text for the new width.
- // Apply the pending operations, requested operations and the only once operations.
- // Then remove onlyOnceOperations
- operationsPending = static_cast<OperationsMask>(operationsPending | requestedOperationsMask | onlyOnceOperations);
-
- // Make sure the model is up-to-date before layouting
- impl.UpdateModel(static_cast<OperationsMask>(operationsPending & ~UPDATE_LAYOUT_SIZE));
-
// Store the actual control's size to restore later.
const Size actualControlSize = visualModel->mControlSize;
- DoRelayout(impl,
- requestedControllerSize,
- static_cast<OperationsMask>(operationsPending & ~UPDATE_LAYOUT_SIZE),
- calculatedLayoutSize);
+ // Whether the text control is editable
+ const bool isEditable = NULL != impl.mEventData;
- // Clear the update info. This info will be set the next time the text is updated.
- textUpdateInfo.Clear();
+ if(!isEditable)
+ {
+ impl.UpdateModel(onlyOnceOperations);
- //TODO: Refactor "DoRelayout" and extract common code of size calculation without modifying attributes of mVisualModel,
- //TODO: then calculate GlyphPositions. Lines, Size, Layout for Natural-Size
- //TODO: and utilize the values in OperationsPending and TextUpdateInfo without changing the original one.
- //TODO: Also it will improve performance because there is no need todo FullRelyout on the next need for layouting.
+ DoRelayout(impl,
+ requestedControllerSize,
+ static_cast<OperationsMask>(onlyOnceOperations | requestedOperationsMask),
+ calculatedLayoutSize);
- // FullRelayoutNeeded should be true because DoRelayout is MAX_FLOAT, MAX_FLOAT.
- // By this no need to take backup and restore it.
- textUpdateInfo.mFullRelayoutNeeded = true;
+ textUpdateInfo.Clear();
+ textUpdateInfo.mClearAll = true;
- // Restore mCharacterIndex. Because "Clear" set it to the maximum integer.
- // The "CalculateTextUpdateIndices" does not work proprely because the mCharacterIndex will be greater than mPreviousNumberOfCharacters.
- // Which apply an assumption to update only the last paragraph. That could cause many of out of index crashes.
- textUpdateInfo.mCharacterIndex = updateInfoCharIndexBackup;
+ // Do not do again the only once operations.
+ operationsPending = static_cast<OperationsMask>(operationsPending & ~onlyOnceOperations);
+ }
+ else
+ {
+ // This is to keep Index to the first character to be updated.
+ // Then restore it after calling Clear method.
+ auto updateInfoCharIndexBackup = textUpdateInfo.mCharacterIndex;
- // Do not do again the only once operations.
- operationsPending = static_cast<OperationsMask>(operationsPending & ~onlyOnceOperations);
+ // Layout the text for the new width.
+ // Apply the pending operations, requested operations and the only once operations.
+ // Then remove onlyOnceOperations
+ operationsPending = static_cast<OperationsMask>(operationsPending | requestedOperationsMask | onlyOnceOperations);
- // Do the size related operations again.
+ // Make sure the model is up-to-date before layouting
+ impl.UpdateModel(static_cast<OperationsMask>(operationsPending & ~UPDATE_LAYOUT_SIZE));
- const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT |
- ALIGN |
- REORDER);
+ DoRelayout(impl,
+ requestedControllerSize,
+ static_cast<OperationsMask>(operationsPending & ~UPDATE_LAYOUT_SIZE),
+ calculatedLayoutSize);
+
+ // Clear the update info. This info will be set the next time the text is updated.
+ textUpdateInfo.Clear();
+ //TODO: Refactor "DoRelayout" and extract common code of size calculation without modifying attributes of mVisualModel,
+ //TODO: then calculate GlyphPositions. Lines, Size, Layout for Natural-Size
+ //TODO: and utilize the values in OperationsPending and TextUpdateInfo without changing the original one.
+ //TODO: Also it will improve performance because there is no need todo FullRelyout on the next need for layouting.
+
+ // FullRelayoutNeeded should be true because DoRelayout is MAX_FLOAT, MAX_FLOAT.
+ // By this no need to take backup and restore it.
+ textUpdateInfo.mFullRelayoutNeeded = true;
+
+ // Restore mCharacterIndex. Because "Clear" set it to the maximum integer.
+ // The "CalculateTextUpdateIndices" does not work proprely because the mCharacterIndex will be greater than mPreviousNumberOfCharacters.
+ // Which apply an assumption to update only the last paragraph. That could cause many of out of index crashes.
+ textUpdateInfo.mCharacterIndex = updateInfoCharIndexBackup;
+ }
+
+ // Do the size related operations again.
operationsPending = static_cast<OperationsMask>(operationsPending | sizeOperations);
// Restore the actual control's size.
selectionBoxInfo->maxX = MIN_FLOAT;
// Update the line's vertical offset.
- selectionBoxInfo->lineOffset = currentLineOffset + currentLineHeight;
-
- if(currentLineSpacing < 0)
- {
- selectionBoxInfo->lineOffset += currentLineSpacing;
- }
+ selectionBoxInfo->lineOffset = currentLineOffset + currentLineHeight + currentLineSpacing;
// The line height is the addition of the line ascender and the line descender.
// However, the line descender has a negative value, hence the subtraction also line spacing should not be included in selection height.
// Do nothing
}
+void AnimatedVectorImageVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+ // Make always enable pre multiplied alpha whether preMultiplied value is false.
+ if(!preMultiplied)
+ {
+ DALI_LOG_WARNING("Note : AnimatedVectorVisual cannot disable PreMultipliedAlpha\n");
+ }
+}
+
void AnimatedVectorImageVisual::DoSetProperties(const Property::Map& propertyMap)
{
// url already passed in from constructor
#define DALI_TOOLKIT_INTERNAL_ANIMATED_VECTOR_IMAGE_VISUAL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
void DoCreateInstancePropertyMap(Property::Map& map) const override;
+ /**
+ * @copydoc Visual::Base::EnablePreMultipliedAlpha
+ */
+ void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
protected: // From VectorAnimationManager::LifecycleObserver:
/**
* @copydoc VectorAnimationManager::LifecycleObserver::VectorAnimationManagerDestroyed()
// Do nothing
}
+void ColorVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+ // Make always disable pre multiplied alpha whether preMultiplied value is true.
+ if(preMultiplied)
+ {
+ DALI_LOG_WARNING("Note : ColorVisual cannot enable PreMultipliedAlpha\n");
+ }
+}
+
void ColorVisual::OnSetTransform()
{
if(mImpl->mRenderer)
#define DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
void DoCreateInstancePropertyMap(Property::Map& map) const override;
+ /**
+ * @copydoc Visual::Base::EnablePreMultipliedAlpha
+ */
+ void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
protected:
/**
* @brief Constructor.
// Do nothing
}
+void GradientVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+ // Make always enable pre multiplied alpha whether preMultiplied value is false.
+ if(!preMultiplied)
+ {
+ DALI_LOG_WARNING("Note : GradientVisual cannot disable PreMultipliedAlpha\n");
+ }
+}
+
void GradientVisual::OnInitialize()
{
Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
#define DALI_TOOLKIT_INTERNAL_GRADIENT_VISUAL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
void DoCreateInstancePropertyMap(Property::Map& map) const override;
+ /**
+ * @copydoc Visual::Base::EnablePreMultipliedAlpha
+ */
+ void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
protected:
/**
* @brief Constructor.
// Do nothing
}
+void SvgVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+ // Make always enable pre multiplied alpha whether preMultiplied value is false.
+ if(!preMultiplied)
+ {
+ DALI_LOG_WARNING("Note : SvgVisual cannot disable PreMultipliedAlpha\n");
+ }
+}
+
void SvgVisual::Load()
{
// load remote resource on svg rasterize thread.
*/
void DoCreateInstancePropertyMap(Property::Map& map) const override;
+ /**
+ * @copydoc Visual::Base::EnablePreMultipliedAlpha
+ */
+ void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
protected:
/**
* @brief Constructor.
#include <dali/devel-api/images/pixel-data-devel.h>
#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
+#include <dali/integration-api/debug.h>
#include <string.h>
// INTERNAL HEADER
map.Insert(Toolkit::TextVisual::Property::TEXT, text);
}
+void TextVisual::EnablePreMultipliedAlpha(bool preMultiplied)
+{
+ // Make always enable pre multiplied alpha whether preMultiplied value is false.
+ if(!preMultiplied)
+ {
+ DALI_LOG_WARNING("Note : TextVisual cannot disable PreMultipliedAlpha\n");
+ }
+}
+
TextVisual::TextVisual(VisualFactoryCache& factoryCache)
: Visual::Base(factoryCache, Visual::FittingMode::FIT_KEEP_ASPECT_RATIO, Toolkit::Visual::TEXT),
mController(Text::Controller::New()),
mTextColorAnimatableIndex(Property::INVALID_INDEX),
mRendererUpdateNeeded(false)
{
+ // Enable the pre-multiplied alpha to improve the text quality
+ mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
}
TextVisual::~TextVisual()
mImpl->mRenderer.SetProperty(Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::CONTENT);
- // Enable the pre-multiplied alpha to improve the text quality
- EnablePreMultipliedAlpha(true);
-
const Vector4& defaultColor = mController->GetTextModel()->GetDefaultColor();
if(mTextColorAnimatableIndex == Property::INVALID_INDEX)
{
*/
void DoCreateInstancePropertyMap(Property::Map& map) const override;
+ /**
+ * @copydoc Visual::Base::EnablePreMultipliedAlpha
+ */
+ void EnablePreMultipliedAlpha(bool preMultiplied) override;
+
protected:
/**
* @brief Constructor.
mImpl->mFittingMode, VISUAL_FITTING_MODE_TABLE, VISUAL_FITTING_MODE_TABLE_COUNT);
map.Insert(Toolkit::DevelVisual::Property::VISUAL_FITTING_MODE, fittingModeString);
- map.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
- map.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, mImpl->mBorderlineColor);
- map.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
+ if(IsTypeAvailableForBorderline(mImpl->mType))
+ {
+ map.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
+ map.Insert(Toolkit::DevelVisual::Property::BORDERLINE_COLOR, mImpl->mBorderlineColor);
+ map.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
+ }
- map.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, mImpl->mCornerRadius);
- map.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, static_cast<int>(mImpl->mCornerRadiusPolicy));
+ if(IsTypeAvailableForCornerRadius(mImpl->mType))
+ {
+ map.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, mImpl->mCornerRadius);
+ map.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY, static_cast<int>(mImpl->mCornerRadiusPolicy));
+ }
}
void Visual::Base::CreateInstancePropertyMap(Property::Map& map) const
*
* @param[in] preMultiplied whether alpha is pre-multiplied.
*/
- void EnablePreMultipliedAlpha(bool preMultiplied);
+ virtual void EnablePreMultipliedAlpha(bool preMultiplied);
/**
* @brief Query whether alpha is pre-multiplied.
}
case Actor::Property::VISIBLE:
{
- GetAccessibleObject()->EmitVisible(Self().GetProperty<bool>(Actor::Property::VISIBLE));
+ const bool visible = propertyValue.Get<bool>();
+ GetAccessibleObject()->EmitVisible(visible);
+ if(!visible)
+ {
+ Dali::Actor self = Self();
+ Dali::Actor actor = Dali::Toolkit::KeyboardFocusManager::Get().GetCurrentFocusActor();
+ while(actor)
+ {
+ if(self == actor)
+ {
+ Dali::Toolkit::KeyboardFocusManager::Get().ClearFocus();
+ break;
+ }
+ actor = actor.GetParent();
+ }
+ }
+ break;
+ }
+ case DevelActor::Property::USER_INTERACTION_ENABLED:
+ {
+ const bool enabled = propertyValue.Get<bool>();
+ if (!enabled && Self() == Dali::Toolkit::KeyboardFocusManager::Get().GetCurrentFocusActor())
+ {
+ Dali::Toolkit::KeyboardFocusManager::Get().ClearFocus();
+ }
break;
}
}
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 18;
+const unsigned int TOOLKIT_MICRO_VERSION = 19;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
},
"TextSelectionPopup":
{
- "popupMaxSize":[656,36],
- "optionDividerSize":[1,0],
- "optionDividerPadding":[0.0,0.0,6.0,6.0],
- "popupDividerColor":[1.0,1.0,1.0,1.0],
+ "popupMaxSize":[656,40],
+ "optionDividerSize":[0,0],
+ "optionDividerPadding":[0.0,0.0,0.0,0.0],
+ "popupDividerColor":[0.0,0.0,0.0,1.0],
"popupIconColor":[1.0,1.0,1.0,1.0],
"popupPressedColor":[0.24,0.72,0.8,0.11],
"background": {
"visualType": "IMAGE",
- "url": "{DALI_IMAGE_DIR}IoT-selection-popup-background.9.png",
- "mixColor":[0.0,0.05,0.17,0.9]
+ "url": "{DALI_IMAGE_DIR}IoT-selection-popup-background.9.png"
},
"backgroundBorder": {
"visualType": "IMAGE",
- "url": "{DALI_IMAGE_DIR}selection-popup-border.9.png",
- "mixColor":[0.0,0.0,0.0,0.0]
+ "url": "{DALI_IMAGE_DIR}IoT-selection-popup-border.9.png",
+ "mixColor":[1.0,1.0,1.0,1.0]
},
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
},
"TextSelectionPopupButton":
{
- "minimumSize":[0,36],
- "labelPadding":[0.0,0.0,0.0,0.0],
+ "minimumSize":[0,40],
+ "labelPadding":[-4.0,-4.0,0.0,0.0],
"label":
{
"visualType":"TEXT",
- "pointSize":18,
- "textColor":[1.0,1.0,1.0,1.0],
- "fontFamily":"BreezeSans",
- "fontStyle" : {"weight":"light"}
+ "pointSize":6.0,
+ "textColor":[0.04,0.06,0.13,1.0],
+ "fontFamily":"SamsungOneUI",
+ "fontStyle" : {"weight":"regular"}
},
"unselectedBackgroundVisual":
{
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.1.18
+Version: 2.1.19
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT