--- /dev/null
+{\r
+ "accessors": [\r
+ {\r
+ "bufferView": 0,\r
+ "componentType": 5126,\r
+ "count": 24,\r
+ "type": "VEC3"\r
+ },\r
+ {\r
+ "bufferView": 1,\r
+ "componentType": 5126,\r
+ "count": 24,\r
+ "type": "VEC4"\r
+ },\r
+ {\r
+ "bufferView": 2,\r
+ "componentType": 5126,\r
+ "count": 24,\r
+ "type": "VEC3",\r
+ "max": [\r
+ 0.0100000035,\r
+ 0.0100000035,\r
+ 0.01\r
+ ],\r
+ "min": [\r
+ -0.0100000044,\r
+ -0.0100000054,\r
+ -0.01\r
+ ]\r
+ },\r
+ {\r
+ "bufferView": 3,\r
+ "componentType": 5126,\r
+ "count": 24,\r
+ "type": "VEC3",\r
+ "name": "thin"\r
+ },\r
+ {\r
+ "bufferView": 4,\r
+ "componentType": 5126,\r
+ "count": 24,\r
+ "type": "VEC3",\r
+ "max": [\r
+ 0.0,\r
+ 0.01893253,\r
+ 0.0\r
+ ],\r
+ "min": [\r
+ 0.0,\r
+ 0.0,\r
+ 0.0\r
+ ],\r
+ "name": "thin"\r
+ },\r
+ {\r
+ "bufferView": 5,\r
+ "componentType": 5126,\r
+ "count": 24,\r
+ "type": "VEC3",\r
+ "name": "thin"\r
+ },\r
+ {\r
+ "bufferView": 6,\r
+ "componentType": 5126,\r
+ "count": 24,\r
+ "type": "VEC3",\r
+ "name": "angle"\r
+ },\r
+ {\r
+ "bufferView": 7,\r
+ "componentType": 5126,\r
+ "count": 24,\r
+ "type": "VEC3",\r
+ "max": [\r
+ 0.0,\r
+ 0.0198908355,\r
+ 0.0\r
+ ],\r
+ "min": [\r
+ 0.0,\r
+ 0.0,\r
+ 0.0\r
+ ],\r
+ "name": "angle"\r
+ },\r
+ {\r
+ "bufferView": 8,\r
+ "componentType": 5126,\r
+ "count": 24,\r
+ "type": "VEC3",\r
+ "name": "angle"\r
+ },\r
+ {\r
+ "bufferView": 9,\r
+ "componentType": 5123,\r
+ "count": 36,\r
+ "type": "SCALAR"\r
+ },\r
+ {\r
+ "bufferView": 10,\r
+ "componentType": 5126,\r
+ "count": 127,\r
+ "type": "SCALAR",\r
+ "max": [\r
+ 4.19999743\r
+ ],\r
+ "min": [\r
+ 0.03\r
+ ]\r
+ },\r
+ {\r
+ "bufferView": 11,\r
+ "componentType": 5126,\r
+ "count": 254,\r
+ "type": "SCALAR"\r
+ }\r
+ ],\r
+ "animations": [\r
+ {\r
+ "channels": [\r
+ {\r
+ "sampler": 0,\r
+ "target": {\r
+ "node": 0,\r
+ "path": "weights"\r
+ }\r
+ }\r
+ ],\r
+ "samplers": [\r
+ {\r
+ "input": 10,\r
+ "interpolation": "LINEAR",\r
+ "output": 11\r
+ }\r
+ ],\r
+ "name": "Square"\r
+ }\r
+ ],\r
+ "asset": {\r
+ "generator": "glTF Tools for Unity",\r
+ "version": "2.0"\r
+ },\r
+ "bufferViews": [\r
+ {\r
+ "buffer": 0,\r
+ "byteLength": 288\r
+ },\r
+ {\r
+ "buffer": 0,\r
+ "byteOffset": 288,\r
+ "byteLength": 384\r
+ },\r
+ {\r
+ "buffer": 0,\r
+ "byteOffset": 672,\r
+ "byteLength": 288\r
+ },\r
+ {\r
+ "buffer": 0,\r
+ "byteOffset": 960,\r
+ "byteLength": 288\r
+ },\r
+ {\r
+ "buffer": 0,\r
+ "byteOffset": 1248,\r
+ "byteLength": 288\r
+ },\r
+ {\r
+ "buffer": 0,\r
+ "byteOffset": 1536,\r
+ "byteLength": 288\r
+ },\r
+ {\r
+ "buffer": 0,\r
+ "byteOffset": 1824,\r
+ "byteLength": 288\r
+ },\r
+ {\r
+ "buffer": 0,\r
+ "byteOffset": 2112,\r
+ "byteLength": 288\r
+ },\r
+ {\r
+ "buffer": 0,\r
+ "byteOffset": 2400,\r
+ "byteLength": 288\r
+ },\r
+ {\r
+ "buffer": 0,\r
+ "byteOffset": 2688,\r
+ "byteLength": 72\r
+ },\r
+ {\r
+ "buffer": 0,\r
+ "byteOffset": 2760,\r
+ "byteLength": 508\r
+ },\r
+ {\r
+ "buffer": 0,\r
+ "byteOffset": 3268,\r
+ "byteLength": 1016\r
+ }\r
+ ],\r
+ "buffers": [\r
+ {\r
+ "uri": "AnimatedMorphCube.bin",\r
+ "byteLength": 4284\r
+ }\r
+ ],\r
+ "meshes": [\r
+ {\r
+ "primitives": [\r
+ {\r
+ "attributes": {\r
+ "NORMAL": 0,\r
+ "TANGENT": 1,\r
+ "POSITION": 2\r
+ },\r
+ "indices": 9,\r
+ "material": 0,\r
+ "targets": [\r
+ {\r
+ "NORMAL": 3,\r
+ "POSITION": 4,\r
+ "TANGENT": 5\r
+ },\r
+ {\r
+ "NORMAL": 6,\r
+ "POSITION": 7,\r
+ "TANGENT": 8\r
+ }\r
+ ]\r
+ }\r
+ ],\r
+ "weights": [\r
+ 0.0,\r
+ 0.0\r
+ ],\r
+ "name": "Cube"\r
+ }\r
+ ],\r
+ "materials": [\r
+ {\r
+ "pbrMetallicRoughness": {\r
+ "baseColorFactor": [\r
+ 0.6038274,\r
+ 0.6038274,\r
+ 0.6038274,\r
+ 1.0\r
+ ],\r
+ "metallicFactor": 0.0,\r
+ "roughnessFactor": 0.5\r
+ },\r
+ "name": "Material"\r
+ }\r
+ ],\r
+ "nodes": [\r
+ {\r
+ "mesh": 0,\r
+ "rotation": [\r
+ 0.0,\r
+ 0.7071067,\r
+ -0.7071068,\r
+ 0.0\r
+ ],\r
+ "scale": [\r
+ 100.0,\r
+ 100.0,\r
+ 100.0\r
+ ],\r
+ "name": "AnimatedMorphCube"\r
+ }\r
+ ],\r
+ "scene": 0,\r
+ "scenes": [\r
+ {\r
+ "nodes": [\r
+ 0\r
+ ]\r
+ }\r
+ ]\r
+}
\ No newline at end of file
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
{
struct Context
{
- ResourceBundle::PathProvider pathProvider = [](ResourceType::Value type)
- {
+ ResourceBundle::PathProvider pathProvider = [](ResourceType::Value type) {
return TEST_RESOURCE_DIR "/";
};
TestApplication app;
const std::string resourcePath = TEST_RESOURCE_DIR "/";
- auto pathProvider = [resourcePath](ResourceType::Value)
- {
+ auto pathProvider = [resourcePath](ResourceType::Value) {
return resourcePath;
};
for(auto modelName : {
"2CylinderEngine",
"AnimatedMorphCube",
+ "AnimatedMorphCubeAnimateNonZeroFrame",
"AnimatedMorphSphere",
"AnimatedTriangle",
"BoxAnimated",
// Perform a relayout
controller->Relayout(size);
+ // Set the text
+ controller->SetText(text);
+
+ // Set the text size
+ controller->SetDefaultFontSize(10.f, Controller::POINT_SIZE);
+
+ // Tweak some parameters to make the indices to access the text buffer invalid
+ mImpl.mTextUpdateInfo.Clear();
+
+ // Perform a relayout
+ controller->GetHeightForWidth(size.width / 2.f);
+ controller->Relayout(size);
+
tet_result(TET_PASS);
END_TEST;
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
std::string output;
DALI_TEST_CHECK(value.Get(output));
- DALI_TEST_EQUALS(output, "AAAAAAEAAAACAAAAAwAAAAQAAAAFAAAAAAAAAP////8", TEST_LOCATION);
+ DALI_TEST_EQUALS(output, "AAAAAAEAAAACAAAAAwAAAAQAAAAFAAAAAAAAAP////8=", TEST_LOCATION);
+
+ std::cout << "Output data: " << output << std::endl;
+
+ END_TEST;
+}
+
+int UtcDaliBase64EncodingP2(void)
+{
+ std::vector<uint8_t> data = {0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, std::numeric_limits<uint8_t>::min(), std::numeric_limits<uint8_t>::min(), std::numeric_limits<uint8_t>::min(), std::numeric_limits<uint8_t>::min(), std::numeric_limits<uint8_t>::max(), std::numeric_limits<uint8_t>::max(), std::numeric_limits<uint8_t>::max(), std::numeric_limits<uint8_t>::max()};
+
+ Property::Value value;
+ EncodeBase64PropertyData(value, data);
+
+ std::cout << "Input data: ";
+ std::ostream_iterator<uint32_t> out_it(std::cout, ", ");
+ std::copy(data.begin(), data.end(), out_it);
+ std::cout << std::endl;
+
+ std::string output;
+ DALI_TEST_CHECK(value.Get(output));
+ DALI_TEST_EQUALS(output, "AAAAAAEAAAACAAAAAwAAAAQAAAAFAAAAAAAAAP////8=", TEST_LOCATION);
+
+ std::cout << "Output data: " << output << std::endl;
+
+ END_TEST;
+}
+
+int UtcDaliBase64EncodingP3(void)
+{
+ std::string originalData = "Something Longer than 64 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/== length is 106";
+ originalData.push_back(-4);
+ originalData.push_back(-7); // some kind of non-ascii.
+ originalData.push_back(0);
+ originalData.push_back(0);
+ originalData.push_back(2);
+ originalData.push_back(2);
+ originalData.push_back(2);
+
+ std::vector<uint8_t> data(originalData.begin(), originalData.end());
+
+ Dali::Property::Value value;
+ EncodeBase64PropertyData(value, data);
+
+ std::cout << "Input data: ";
+ std::ostream_iterator<uint8_t> out_it(std::cout, ", ");
+ std::copy(data.begin(), data.end(), out_it);
+ std::cout << std::endl;
+
+ std::string output;
+ Dali::Property::Array array;
+ DALI_TEST_CHECK(value.GetArray());
+ array = *value.GetArray();
+ DALI_TEST_EQUALS(array.Count(), 3, TEST_LOCATION);
+ DALI_TEST_CHECK(array[0].Get(output));
+ std::cout << "first string : " << output << std::endl;
+ DALI_TEST_EQUALS(output, "U29tZXRoaW5nIExvbmdlciB0aGFuIDY0IEFCQ0RFRkdISUpLTE1OT1BRUlNUVVZX", TEST_LOCATION);
+ DALI_TEST_CHECK(array[1].Get(output));
+ std::cout << "second string : " << output << std::endl;
+ DALI_TEST_EQUALS(output, "WFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky89PSAgbGVu", TEST_LOCATION);
+ DALI_TEST_CHECK(array[2].Get(output));
+ std::cout << "third string : " << output << std::endl;
+ DALI_TEST_EQUALS(output, "Z3RoIGlzIDEwNvz5AAACAgI=", TEST_LOCATION);
std::cout << "Output data: " << output << std::endl;
DALI_TEST_CHECK(value.Get(output));
DALI_TEST_EQUALS(output.empty(), true, TEST_LOCATION);
+ std::vector<uint8_t> data2;
+ EncodeBase64PropertyData(value, data2);
+
+ DALI_TEST_CHECK(value.Get(output));
+ DALI_TEST_EQUALS(output.empty(), true, TEST_LOCATION);
+
END_TEST;
}
template<typename T>
int b64l(std::vector<T>& data)
{
- auto lengthInBytes = 4 * data.size();
- return ceil(lengthInBytes * 1.33333f);
+ auto lengthInBytes = sizeof(T) * data.size();
+ // base64 encode each 3-byte as 4-byte.
+ // return ceil(lengthInBytes / 3) * 4
+ return (lengthInBytes + 2) / 3 * 4;
}
int UtcDaliBase64EncodingP02(void)
std::vector<uint32_t> outputData;
DecodeBase64PropertyData(value, outputData);
DALI_TEST_EQUALS(outputData.size(), 0, TEST_LOCATION);
+
+ std::vector<uint8_t> outputData2;
+ DecodeBase64PropertyData(value, outputData2);
+ DALI_TEST_EQUALS(outputData2.size(), 0, TEST_LOCATION);
END_TEST;
}
std::vector<uint32_t> outputData;
DecodeBase64PropertyData(value, outputData);
DALI_TEST_EQUALS(outputData.size(), 0, TEST_LOCATION);
+
+ std::vector<uint8_t> outputData2;
+ DecodeBase64PropertyData(value, outputData2);
+ DALI_TEST_EQUALS(outputData2.size(), 0, TEST_LOCATION);
END_TEST;
}
END_TEST;
}
+
+int UtcDaliBase64DecodingP02(void)
+{
+ tet_infoline("Test decoding string of known data gives expected result");
+
+ std::string testInput("//////7+/v4DAgEA");
+ std::vector<uint8_t> expectedResults = {0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0x03, 0x02, 0x01, 0x00};
+
+ std::vector<uint8_t> outputData;
+ DecodeBase64PropertyData(Property::Value(testInput), outputData);
+
+ DALI_TEST_EQUALS(std::equal(expectedResults.begin(), expectedResults.end(), outputData.begin()), true, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliBase64DecodingFromString(void)
+{
+ tet_infoline("Test decoding string of known data gives expected result");
+
+ std::string testInput("//////7+/v4DAgEA");
+ std::vector<uint8_t> expectedResults = {0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0x03, 0x02, 0x01, 0x00};
+
+ std::vector<uint8_t> outputData;
+ DecodeBase64FromString(testInput, outputData);
+
+ DALI_TEST_EQUALS(std::equal(expectedResults.begin(), expectedResults.end(), outputData.begin()), true, TEST_LOCATION);
+
+ END_TEST;
+}
return mHasSucceeded;
}
-Dali::Scene3D::Loader::EnvironmentMapData& EnvironmentMapLoadTask::GetEnvironmentMap()
+Dali::Texture EnvironmentMapLoadTask::GetLoadedTexture()
{
- return mEnvironmentMapData;
+ return (HasSucceeded()) ? mEnvironmentMapData.GetTexture() : Texture();;
}
} // namespace Internal
bool HasSucceeded() const;
/**
- * Retrieves loaded Environment Map
- * @return EnvironmentMapData that is loaded from url.
+ * Retrieves loaded Ibl Texture
+ * @return Texture that is loaded from url.
+ * @note Do not call this method in worker thread.
*/
- Dali::Scene3D::Loader::EnvironmentMapData& GetEnvironmentMap();
+ Dali::Texture GetLoadedTexture();
private:
// Undefined
#include <dali-toolkit/internal/controls/control/control-data-impl.h>
#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/math/math-utils.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/integration-api/adaptor-framework/adaptor.h>
#include <filesystem>
// INTERNAL INCLUDES
Dali::Scene3D::Loader::ResourceBundle& resources, const Dali::Scene3D::Loader::SceneDefinition& scene, Actor root, std::vector<Dali::Scene3D::Loader::BlendshapeShaderConfigurationRequest>&& requests)
{
std::vector<std::string> errors;
- auto onError = [&errors](const std::string& msg) { errors.push_back(msg); };
+ auto onError = [&errors](const std::string& msg)
+ { errors.push_back(msg); };
if(!scene.ConfigureBlendshapeShaders(resources, root, std::move(requests), onError))
{
Dali::Scene3D::Loader::ExceptionFlinger flinger(ASSERT_LOCATION);
void Model::SetImageBasedLightSource(const std::string& diffuseUrl, const std::string& specularUrl, float scaleFactor)
{
bool needIblReset = false;
- bool isOnScene = Self().GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE);
+ bool isOnScene = Self().GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE);
if(mDiffuseIblUrl != diffuseUrl)
{
mDiffuseIblUrl = diffuseUrl;
if(mDiffuseIblUrl.empty())
{
- needIblReset = true;
+ needIblReset = true;
}
else
{
mSpecularIblUrl = specularUrl;
if(mSpecularIblUrl.empty())
{
- needIblReset = true;
+ needIblReset = true;
}
else
{
// we don't need to request to load texture.
if(needIblReset)
{
- if(mIblDiffuseLoadTask)
- {
- Dali::AsyncTaskManager::Get().RemoveTask(mIblDiffuseLoadTask);
- mIblDiffuseLoadTask.Reset();
- }
-
- if(mIblSpecularLoadTask)
- {
- Dali::AsyncTaskManager::Get().RemoveTask(mIblSpecularLoadTask);
- mIblSpecularLoadTask.Reset();
- }
+ ResetResourceTask(mIblDiffuseLoadTask);
+ ResetResourceTask(mIblSpecularLoadTask);
mIblDiffuseDirty = false;
mIblSpecularDirty = false;
{
if(isOnScene && mIblDiffuseDirty)
{
- if(mIblDiffuseLoadTask)
- {
- Dali::AsyncTaskManager::Get().RemoveTask(mIblDiffuseLoadTask);
- mIblDiffuseLoadTask.Reset();
- }
+ ResetResourceTask(mIblDiffuseLoadTask);
mIblDiffuseLoadTask = new EnvironmentMapLoadTask(mDiffuseIblUrl, Scene3D::EnvironmentMapType::CUBEMAP, MakeCallback(this, &Model::OnIblDiffuseLoadComplete));
Dali::AsyncTaskManager::Get().AddTask(mIblDiffuseLoadTask);
mIblDiffuseDirty = false;
if(isOnScene && mIblSpecularDirty)
{
- if(mIblSpecularLoadTask)
- {
- Dali::AsyncTaskManager::Get().RemoveTask(mIblSpecularLoadTask);
- mIblSpecularLoadTask.Reset();
- }
+ ResetResourceTask(mIblSpecularLoadTask);
mIblSpecularLoadTask = new EnvironmentMapLoadTask(mSpecularIblUrl, Scene3D::EnvironmentMapType::CUBEMAP, MakeCallback(this, &Model::OnIblSpecularLoadComplete));
Dali::AsyncTaskManager::Get().AddTask(mIblSpecularLoadTask);
mIblSpecularDirty = false;
}
// If diffuse and specular textures are already loaded, emits resource ready signal here.
- if(IsResourceReady())
- {
- Control::SetResourceReady(false);
- }
+ NotifyResourceReady();
}
void Model::SetImageBasedLightTexture(Dali::Texture diffuseTexture, Dali::Texture specularTexture, float scaleFactor)
void Model::ScaleModel()
{
- if(mModelRoot)
+ if(!mModelRoot)
{
- float scale = 1.0f;
- Vector3 size = Self().GetProperty<Vector3>(Dali::Actor::Property::SIZE);
- if(size.x > 0.0f && size.y > 0.0f)
- {
- scale = MAXFLOAT;
- scale = std::min(size.x / mNaturalSize.x, scale);
- scale = std::min(size.y / mNaturalSize.y, scale);
- }
- // Models in glTF and dli are defined as right hand coordinate system.
- // DALi uses left hand coordinate system. Scaling negative is for change winding order.
- mModelRoot.SetProperty(Dali::Actor::Property::SCALE, Y_DIRECTION * scale);
+ return;
}
+
+ float scale = 1.0f;
+ Vector3 size = Self().GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+ if(size.x > 0.0f && size.y > 0.0f)
+ {
+ scale = MAXFLOAT;
+ scale = std::min(size.x / mNaturalSize.x, scale);
+ scale = std::min(size.y / mNaturalSize.y, scale);
+ }
+ // Models in glTF and dli are defined as right hand coordinate system.
+ // DALi uses left hand coordinate system. Scaling negative is for change winding order.
+ mModelRoot.SetProperty(Dali::Actor::Property::SCALE, Y_DIRECTION * scale);
}
void Model::FitModelPosition()
{
- if(mModelRoot)
+ if(!mModelRoot)
{
- // Loaded model pivot is not the model center.
- mModelRoot.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- mModelRoot.SetProperty(Dali::Actor::Property::ANCHOR_POINT, Vector3::ONE - mModelPivot);
+ return;
}
+ // Loaded model pivot is not the model center.
+ mModelRoot.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ mModelRoot.SetProperty(Dali::Actor::Property::ANCHOR_POINT, Vector3::ONE - mModelPivot);
}
void Model::CollectRenderableActor(Actor actor)
for(auto&& actor : mRenderableActors)
{
Actor renderableActor = actor.GetHandle();
- if(renderableActor)
+ if(!renderableActor)
+ {
+ continue;
+ }
+
+ uint32_t rendererCount = renderableActor.GetRendererCount();
+ for(uint32_t i = 0; i < rendererCount; ++i)
{
- uint32_t rendererCount = renderableActor.GetRendererCount();
- for(uint32_t i = 0; i < rendererCount; ++i)
+ Dali::Renderer renderer = renderableActor.GetRendererAt(i);
+ if(!renderer)
{
- Dali::Renderer renderer = renderableActor.GetRendererAt(i);
- if(renderer)
- {
- Dali::TextureSet textures = renderer.GetTextures();
- if(textures)
- {
- uint32_t textureCount = textures.GetTextureCount();
- // EnvMap requires at least 2 texture, diffuse and specular
- if(textureCount > 2u)
- {
- textures.SetTexture(textureCount - OFFSET_FOR_DIFFUSE_CUBE_TEXTURE, currentDiffuseTexture);
- textures.SetTexture(textureCount - OFFSET_FOR_SPECULAR_CUBE_TEXTURE, currentSpecularTexture);
- }
- }
- }
+ continue;
+ }
+ Dali::TextureSet textures = renderer.GetTextures();
+ if(!textures)
+ {
+ continue;
+ }
+ uint32_t textureCount = textures.GetTextureCount();
+ // EnvMap requires at least 2 texture, diffuse and specular
+ if(textureCount > 2u)
+ {
+ textures.SetTexture(textureCount - OFFSET_FOR_DIFFUSE_CUBE_TEXTURE, currentDiffuseTexture);
+ textures.SetTexture(textureCount - OFFSET_FOR_SPECULAR_CUBE_TEXTURE, currentSpecularTexture);
}
- renderableActor.RegisterProperty(Dali::Scene3D::Loader::NodeDefinition::GetIblScaleFactorUniformName().data(), currentIblScaleFactor);
}
+ renderableActor.RegisterProperty(Dali::Scene3D::Loader::NodeDefinition::GetIblScaleFactorUniformName().data(), currentIblScaleFactor);
}
}
return;
}
- mModelRoot = Actor::New();
- mModelRoot.SetProperty(Actor::Property::COLOR_MODE, ColorMode::USE_OWN_MULTIPLY_PARENT_COLOR);
-
- BoundingVolume AABB;
- auto* resources = &(mModelLoadTask->mResources);
- auto* scene = &(mModelLoadTask->mScene);
- Dali::Scene3D::Loader::Transforms xforms{Dali::Scene3D::Loader::MatrixStack{}, Dali::Scene3D::Loader::ViewProjection{}};
- Dali::Scene3D::Loader::NodeDefinition::CreateParams nodeParams{*resources, xforms, {}, {}, {}};
- uint32_t rootCount = 0u;
- for(auto iRoot : scene->GetRoots())
- {
- resources->GenerateResources(mModelLoadTask->mResourceRefCounts[rootCount]);
-
- if(auto actor = scene->CreateNodes(iRoot, mModelLoadTask->mResourceChoices, 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));
-
- mModelRoot.Add(actor);
- }
-
- AddModelTreeToAABB(AABB, *scene, mModelLoadTask->mResourceChoices, iRoot, nodeParams, Matrix::IDENTITY);
- rootCount++;
- }
+ CreateModel();
+ mRenderableActors.clear();
+ CollectRenderableActor(mModelRoot);
+ auto* resources = &(mModelLoadTask->mResources);
+ auto* scene = &(mModelLoadTask->mScene);
+ CreateAnimations(*scene);
if(!resources->mEnvironmentMaps.empty())
{
mDefaultDiffuseTexture = resources->mEnvironmentMaps.front().second.mDiffuse;
mDefaultSpecularTexture = resources->mEnvironmentMaps.front().second.mSpecular;
}
- if(!mModelLoadTask->mAnimations.empty())
- {
- auto getActor = [&](const Scene3D::Loader::AnimatedProperty& property)
- {
- Dali::Actor actor;
- if(property.mNodeIndex != Scene3D::Loader::INVALID_INDEX)
- {
- auto* node = scene->GetNode(property.mNodeIndex);
- if(node != nullptr)
- {
- actor = mModelRoot.FindChildById(node->mNodeId);
- }
- }
- else
- {
- actor = mModelRoot.FindChildByName(property.mNodeName);
- }
- return actor;
- };
-
- mAnimations.clear();
- for(auto&& animation : mModelLoadTask->mAnimations)
- {
- Dali::Animation anim = animation.ReAnimate(getActor);
-
- mAnimations.push_back({animation.mName, anim});
- }
- }
-
- mRenderableActors.clear();
- CollectRenderableActor(mModelRoot);
-
UpdateImageBasedLightTexture();
UpdateImageBasedLightScaleFactor();
- mNaturalSize = AABB.CalculateSize();
- mModelPivot = AABB.CalculatePivot();
- mModelRoot.SetProperty(Dali::Actor::Property::SIZE, mNaturalSize);
- Vector3 controlSize = Self().GetProperty<Vector3>(Dali::Actor::Property::SIZE);
- if(Dali::EqualsZero(controlSize.x) || Dali::EqualsZero(controlSize.y))
- {
- Self().SetProperty(Dali::Actor::Property::SIZE, mNaturalSize);
- }
-
- FitModelPosition();
- ScaleModel();
-
mModelRoot.SetProperty(Dali::Actor::Property::SENSITIVE, mModelChildrenSensitive);
mModelRoot.SetProperty(Dali::Actor::Property::KEYBOARD_FOCUSABLE, mModelChildrenFocusable);
mModelRoot.SetProperty(Dali::DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, mModelChildrenFocusable);
Self().Add(mModelRoot);
-
Self().SetProperty(Dali::Actor::Property::ANCHOR_POINT, Vector3(mModelPivot.x, 1.0f - mModelPivot.y, mModelPivot.z));
mModelResourceReady = true;
-
- if(IsResourceReady())
- {
- Control::SetResourceReady(false);
- }
- mModelLoadTask.Reset();
+ NotifyResourceReady();
+ ResetResourceTask(mModelLoadTask);
}
void Model::OnIblDiffuseLoadComplete()
{
- mDiffuseTexture = (mIblDiffuseLoadTask->HasSucceeded()) ? mIblDiffuseLoadTask->GetEnvironmentMap().GetTexture() : Texture();
+ mDiffuseTexture = mIblDiffuseLoadTask->GetLoadedTexture();
+ ResetResourceTask(mIblDiffuseLoadTask);
mIblDiffuseResourceReady = true;
if(mIblDiffuseResourceReady && mIblSpecularResourceReady)
{
OnIblLoadComplete();
}
- mIblDiffuseLoadTask.Reset();
}
void Model::OnIblSpecularLoadComplete()
{
- mSpecularTexture = (mIblSpecularLoadTask->HasSucceeded()) ? mIblSpecularLoadTask->GetEnvironmentMap().GetTexture() : Texture();
+ mSpecularTexture = mIblSpecularLoadTask->GetLoadedTexture();
+ ResetResourceTask(mIblSpecularLoadTask);
mIblSpecularResourceReady = true;
if(mIblDiffuseResourceReady && mIblSpecularResourceReady)
{
OnIblLoadComplete();
}
- mIblSpecularLoadTask.Reset();
}
void Model::OnIblLoadComplete()
{
UpdateImageBasedLightTexture();
+ NotifyResourceReady();
+}
- if(IsResourceReady())
+void Model::ResetResourceTasks()
+{
+ if(!Dali::Adaptor::IsAvailable())
{
- Control::SetResourceReady(false);
+ return;
}
+ ResetResourceTask(mModelLoadTask);
+ ResetResourceTask(mIblDiffuseLoadTask);
+ ResetResourceTask(mIblSpecularLoadTask);
}
-void Model::ResetResourceTasks()
+void Model::ResetResourceTask(IntrusivePtr<AsyncTask> asyncTask)
{
- if(Dali::Adaptor::IsAvailable())
+ if(!asyncTask)
{
- if(mModelLoadTask)
+ return;
+ }
+ Dali::AsyncTaskManager::Get().RemoveTask(asyncTask);
+ asyncTask.Reset();
+}
+
+void Model::NotifyResourceReady()
+{
+ if(!IsResourceReady())
+ {
+ return;
+ }
+ Control::SetResourceReady(false);
+}
+
+void Model::CreateModel()
+{
+ mModelRoot = Actor::New();
+ mModelRoot.SetProperty(Actor::Property::COLOR_MODE, ColorMode::USE_OWN_MULTIPLY_PARENT_COLOR);
+
+ BoundingVolume AABB;
+ auto* resources = &(mModelLoadTask->mResources);
+ auto* scene = &(mModelLoadTask->mScene);
+ Dali::Scene3D::Loader::Transforms xforms{Dali::Scene3D::Loader::MatrixStack{}, Dali::Scene3D::Loader::ViewProjection{}};
+ Dali::Scene3D::Loader::NodeDefinition::CreateParams nodeParams{*resources, xforms, {}, {}, {}};
+ uint32_t rootCount = 0u;
+ for(auto iRoot : scene->GetRoots())
+ {
+ resources->GenerateResources(mModelLoadTask->mResourceRefCounts[rootCount]);
+
+ if(auto actor = scene->CreateNodes(iRoot, mModelLoadTask->mResourceChoices, nodeParams))
{
- Dali::AsyncTaskManager::Get().RemoveTask(mModelLoadTask);
- mModelLoadTask.Reset();
+ 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));
+
+ mModelRoot.Add(actor);
}
- if(mIblDiffuseLoadTask)
+
+ AddModelTreeToAABB(AABB, *scene, mModelLoadTask->mResourceChoices, iRoot, nodeParams, Matrix::IDENTITY);
+ rootCount++;
+ }
+
+ mNaturalSize = AABB.CalculateSize();
+ mModelPivot = AABB.CalculatePivot();
+ mModelRoot.SetProperty(Dali::Actor::Property::SIZE, mNaturalSize);
+ Vector3 controlSize = Self().GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+ if(Dali::EqualsZero(controlSize.x) || Dali::EqualsZero(controlSize.y))
+ {
+ Self().SetProperty(Dali::Actor::Property::SIZE, mNaturalSize);
+ }
+ FitModelPosition();
+ ScaleModel();
+}
+
+void Model::CreateAnimations(Dali::Scene3D::Loader::SceneDefinition& scene)
+{
+ if(!mModelLoadTask->mAnimations.empty())
+ {
+ auto getActor = [&](const Scene3D::Loader::AnimatedProperty& property)
{
- Dali::AsyncTaskManager::Get().RemoveTask(mIblDiffuseLoadTask);
- mIblDiffuseLoadTask.Reset();
- }
- if(mIblSpecularLoadTask)
+ if(property.mNodeIndex == Scene3D::Loader::INVALID_INDEX)
+ {
+ return mModelRoot.FindChildByName(property.mNodeName);
+ }
+ auto* node = scene.GetNode(property.mNodeIndex);
+ if(node == nullptr)
+ {
+ return Dali::Actor();
+ }
+ return mModelRoot.FindChildById(node->mNodeId);
+ };
+
+ mAnimations.clear();
+ for(auto&& animation : mModelLoadTask->mAnimations)
{
- Dali::AsyncTaskManager::Get().RemoveTask(mIblSpecularLoadTask);
- mIblSpecularLoadTask.Reset();
+ Dali::Animation anim = animation.ReAnimate(getActor);
+ mAnimations.push_back({animation.mName, anim});
}
}
}
*/
void ResetResourceTasks();
+ /**
+ * @brief Reset a Resource loading task.
+ */
+ void ResetResourceTask(IntrusivePtr<AsyncTask> asyncTask);
+
+ /**
+ * @brief Request to load a Ibl texture asynchronously
+ */
+ void RequestLoadIblTexture(EnvironmentMapLoadTaskPtr asyncLoadTask, const std::string& url);
+
+ /**
+ * @brief Notify Resource Ready signal.
+ */
+ void NotifyResourceReady();
+
+ /**
+ * @brief Create Model from loaded SceneDefinition.
+ */
+ void CreateModel();
+
+ /**
+ * @brief Create Dali::Animation from loaded AnimationDefinitions.
+ */
+ void CreateAnimations(Dali::Scene3D::Loader::SceneDefinition& scene);
+
private:
std::string mModelUrl;
std::string mResourceDirectoryUrl;
mRootLayer.SetProperty(Dali::Actor::Property::INHERIT_SCALE, false);
self.Add(mRootLayer);
- mDefaultCamera = Dali::CameraActor::New();
+ mDefaultCamera = Dali::CameraActor::New3DCamera();
mDefaultCamera.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
mDefaultCamera.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
- mDefaultCamera.SetNearClippingPlane(1.0f);
AddCamera(mDefaultCamera);
UpdateCamera(mDefaultCamera);
}
Control::SetResourceReady(false);
}
- mSkyboxTexture = (mSkyboxLoadTask->HasSucceeded()) ? mSkyboxLoadTask->GetEnvironmentMap().GetTexture() : Texture();
+ mSkyboxTexture = mSkyboxLoadTask->GetLoadedTexture();
Shader skyboxShader;
if(mSkyboxEnvironmentMapType == Scene3D::EnvironmentMapType::CUBEMAP)
{
void SceneView::OnIblDiffuseLoadComplete()
{
- mDiffuseTexture = (mIblDiffuseLoadTask->HasSucceeded()) ? mIblDiffuseLoadTask->GetEnvironmentMap().GetTexture() : Texture();
+ mDiffuseTexture = mIblDiffuseLoadTask->GetLoadedTexture();
mIblDiffuseResourceReady = true;
if(mIblDiffuseResourceReady && mIblSpecularResourceReady)
{
void SceneView::OnIblSpecularLoadComplete()
{
- mSpecularTexture = (mIblSpecularLoadTask->HasSucceeded()) ? mIblSpecularLoadTask->GetEnvironmentMap().GetTexture() : Texture();
+ mSpecularTexture = mIblSpecularLoadTask->GetLoadedTexture();
mIblSpecularResourceReady = true;
if(mIblDiffuseResourceReady && mIblSpecularResourceReady)
{
{
namespace Loader
{
-const std::string BlendShapes::NUMBER_OF_BLEND_SHAPES("uNumberOfBlendShapes");
-const std::string BlendShapes::UNNORMALIZE_FACTOR("uBlendShapeUnnormalizeFactor");
-const std::string BlendShapes::COMPONENT_SIZE("uBlendShapeComponentSize");
+const char* BlendShapes::NUMBER_OF_BLEND_SHAPES("uNumberOfBlendShapes");
+const char* BlendShapes::UNNORMALIZE_FACTOR("uBlendShapeUnnormalizeFactor");
+const char* BlendShapes::COMPONENT_SIZE("uBlendShapeComponentSize");
-const std::string BlendShapes::COMPONENTS("blendShapeComponents");
+const char* BlendShapes::COMPONENTS("blendShapeComponents");
-const std::string BlendShapes::WEIGHTS_UNIFORM("uBlendShapeWeight");
+const char* BlendShapes::WEIGHTS_UNIFORM("uBlendShapeWeight");
void BlendShapes::ConfigureProperties(const std::pair<MeshDefinition, MeshGeometry>& mesh, Shader shader, Actor actor)
{
char weightNameBuffer[32];
char unnormalizeFactorNameBuffer[64];
- char* const pWeightName = weightNameBuffer + snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s", WEIGHTS_UNIFORM.c_str());
- char* const pFactorName = unnormalizeFactorNameBuffer + snprintf(unnormalizeFactorNameBuffer, sizeof(unnormalizeFactorNameBuffer), "%s", UNNORMALIZE_FACTOR.c_str());
+ char* const pWeightName = weightNameBuffer + snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s", WEIGHTS_UNIFORM);
+ char* const pFactorName = unnormalizeFactorNameBuffer + snprintf(unnormalizeFactorNameBuffer, sizeof(unnormalizeFactorNameBuffer), "%s", UNNORMALIZE_FACTOR);
for(const auto& blendShape : mesh.first.mBlendShapes)
{
snprintf(pWeightName, sizeof(weightNameBuffer) - (pWeightName - weightNameBuffer), "[%d]", index);
};
// shader properties - animatable (uniforms)
- static const std::string NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded.
- static const std::string UNNORMALIZE_FACTOR; ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
- static const std::string COMPONENT_SIZE; ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
+ static const char* NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded.
+ static const char* UNNORMALIZE_FACTOR; ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
+ static const char* COMPONENT_SIZE; ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
// shader properties - read-only (not available as uniforms)
- static const std::string COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
+ static const char* COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
// actor property (instance) - animatable (uniforms)
- static const std::string WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array
+ static const char* WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array
/**
* @brief Registers properties based on the mesh definition (and geometry) and identified by the above string constants,
struct BufferDefinition::Impl
{
- std::vector<uint8_t> buffer;
+ std::vector<uint8_t> buffer;
std::shared_ptr<Dali::FileStream> stream;
};
if(position != std::string::npos)
{
position += EMBEDDED_DATA_BASE64_ENCODING_TYPE.length();
- std::string data = mUri.substr(position);
+ std::string_view data = std::string_view(mUri).substr(position);
mImpl.get()->buffer.clear();
- Dali::Toolkit::DecodeBase64PropertyData(data, mImpl.get()->buffer);
+ Dali::Toolkit::DecodeBase64FromString(data, mImpl.get()->buffer);
mImpl.get()->stream = std::make_shared<Dali::FileStream>(reinterpret_cast<uint8_t*>(mImpl.get()->buffer.data()), mByteLength, FileStream::READ | FileStream::BINARY);
mIsEmbedded = true;
}
namespace
{
-const std::string NODES = "nodes";
-const std::string SCENES = "scenes";
-const std::string NODE = "node";
-const std::string URI = "uri";
-const std::string URL = "url";
-const std::string CUSTOMIZATION = "customization";
-const std::string HINTS = "hints";
-const std::string NAME("name");
-const std::string BLEND_SHAPE_HEADER("blendShapeHeader");
-const std::string BLEND_SHAPES("blendShapes");
-const std::string BLEND_SHAPE_VERSION_1_0("1.0");
-const std::string BLEND_SHAPE_VERSION_2_0("2.0");
-const std::string VERSION("version");
+const char* NODES = "nodes";
+const char* SCENES = "scenes";
+const char* NODE = "node";
+const char* URI = "uri";
+const char* URL = "url";
+const char* HINTS = "hints";
+const char* NAME("name");
+const char* BLEND_SHAPE_HEADER("blendShapeHeader");
+const char* BLEND_SHAPES("blendShapes");
+const char* BLEND_SHAPE_VERSION_1_0("1.0");
+const char* BLEND_SHAPE_VERSION_2_0("2.0");
+const char* VERSION("version");
const char* const SHADOW_MAP_SIZE = "shadowMapSize";
const char* const ORTHOGRAPHIC_SIZE = "orthographicSize";
{
namespace
{
-const std::string PRE_COMPUTED_BRDF_TEXTURE_FILE_NAME = "brdfLUT.png";
+const char* PRE_COMPUTED_BRDF_TEXTURE_FILE_NAME = "brdfLUT.png";
}
EnvironmentDefinition::RawData
Dali::Mutex gInitializeMutex;
Dali::Mutex gReadMutex;
-const std::string POSITION_PROPERTY("position");
-const std::string ORIENTATION_PROPERTY("orientation");
-const std::string SCALE_PROPERTY("scale");
-const std::string BLEND_SHAPE_WEIGHTS_UNIFORM("uBlendShapeWeight");
-const std::string MRENDERER_MODEL_IDENTIFICATION("M-Renderer");
-const std::string ROOT_NODE_NAME("RootNode");
+const char* POSITION_PROPERTY("position");
+const char* ORIENTATION_PROPERTY("orientation");
+const char* SCALE_PROPERTY("scale");
+const char* BLEND_SHAPE_WEIGHTS_UNIFORM("uBlendShapeWeight");
+const char* MRENDERER_MODEL_IDENTIFICATION("M-Renderer");
+const char* ROOT_NODE_NAME("RootNode");
const Vector3 SCALE_TO_ADJUST(100.0f, 100.0f, 100.0f);
const Geometry::Type GLTF2_TO_DALI_PRIMITIVES[]{
LoadDataFromAccessor<float>(context, output.mBufferView->mBuffer.GetIndex(), inputDataBuffer, input.mBufferView->mByteOffset + input.mByteOffset, inputDataBufferSize);
LoadDataFromAccessor<T>(context, output.mBufferView->mBuffer.GetIndex(), outputDataBuffer, output.mBufferView->mByteOffset + output.mByteOffset, outputDataBufferSize);
+ ApplyAccessorMinMax(input, reinterpret_cast<float*>(inputDataBuffer.begin()));
ApplyAccessorMinMax(output, reinterpret_cast<float*>(outputDataBuffer.begin()));
return inputDataBuffer[input.mCount - 1u];
const float duration = std::max(LoadDataFromAccessors<T>(context, input, output, inputDataBuffer, outputDataBuffer), AnimationDefinition::MIN_DURATION_SECONDS);
+ // Set first frame value as first keyframe (gltf animation spec)
+ if(input.mCount > 0 && !Dali::EqualsZero(inputDataBuffer[0]))
+ {
+ keyFrames.Add(0.0f, outputDataBuffer[0]);
+ }
+
for(uint32_t i = 0; i < input.mCount; ++i)
{
keyFrames.Add(inputDataBuffer[i] / duration, outputDataBuffer[i]);
Vector<float> inputDataBuffer;
Vector<float> outputDataBuffer;
- const float duration = LoadDataFromAccessors<float>(context, input, output, inputDataBuffer, outputDataBuffer);
+ const float duration = std::max(LoadDataFromAccessors<float>(context, input, output, inputDataBuffer, outputDataBuffer), AnimationDefinition::MIN_DURATION_SECONDS);
char weightNameBuffer[32];
- auto prefixSize = snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s[", BLEND_SHAPE_WEIGHTS_UNIFORM.c_str());
+ auto prefixSize = snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s[", BLEND_SHAPE_WEIGHTS_UNIFORM);
char* const pWeightName = weightNameBuffer + prefixSize;
const auto remainingSize = sizeof(weightNameBuffer) - prefixSize;
for(uint32_t weightIndex = 0u, endWeightIndex = channel.mSampler->mOutput->mCount / channel.mSampler->mInput->mCount; weightIndex < endWeightIndex; ++weightIndex)
animatedProperty.mPropertyName = std::string(weightNameBuffer);
animatedProperty.mKeyFrames = KeyFrames::New();
+
+ // Set first frame value as first keyframe (gltf animation spec)
+ if(input.mCount > 0 && !Dali::EqualsZero(inputDataBuffer[0]))
+ {
+ animatedProperty.mKeyFrames.Add(0.0f, outputDataBuffer[weightIndex]);
+ }
+
for(uint32_t i = 0; i < input.mCount; ++i)
{
animatedProperty.mKeyFrames.Add(inputDataBuffer[i] / duration, outputDataBuffer[i * endWeightIndex + weightIndex]);
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
if(position != std::string::npos)
{
position += EMBEDDED_DATA_BASE64_ENCODING_TYPE.length();
- std::string data = textureDefinition.mImageUri.substr(position);
+ std::string_view data = std::string_view(textureDefinition.mImageUri).substr(position);
std::vector<uint8_t> buffer;
- Dali::Toolkit::DecodeBase64PropertyData(data, buffer);
+ Dali::Toolkit::DecodeBase64FromString(data, buffer);
uint32_t bufferSize = buffer.size();
Dali::Devel::PixelBuffer pixelBuffer = Dali::LoadImageFromBuffer(reinterpret_cast<uint8_t*>(buffer.data()), bufferSize, textureDefinition.mMinImageDimensions, fittingMode, textureDefinition.mSamplingMode, orientationCorrection);
// Load textures
auto iTexture = mTextureStages.begin();
- auto checkStage = [&](uint32_t flags)
- {
+ auto checkStage = [&](uint32_t flags) {
return iTexture != mTextureStages.end() && MaskMatch(iTexture->mSemantic, flags);
};
uint32_t n = 0;
for(auto& tData : raw.mTextures)
{
- auto& pixels = tData.mPixels;
+ auto& pixels = tData.mPixels;
Texture texture;
if(pixels)
{
bool MaterialDefinition::CheckTextures(uint32_t flags) const
{
- return std::find_if(mTextureStages.begin(), mTextureStages.end(), [flags](const TextureStage& ts)
- { return MaskMatch(ts.mSemantic, flags); }) != mTextureStages.end();
+ return std::find_if(mTextureStages.begin(), mTextureStages.end(), [flags](const TextureStage& ts) { return MaskMatch(ts.mSemantic, flags); }) != mTextureStages.end();
}
} // namespace Loader
// EXTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/file-stream.h>
+#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
#include <dali/integration-api/debug.h>
+#include <dali/public-api/math/compile-time-math.h>
#include <cstring>
#include <fstream>
-#include "dali/devel-api/adaptor-framework/pixel-buffer.h"
+#include <type_traits>
namespace Dali
{
uint16_t (*mFunc)(uintptr_t&);
};
-const std::string QUAD("quad");
+const char* QUAD("quad");
///@brief Reads a blob from the given stream @a source into @a target, which must have
/// at least @a descriptor.length bytes.
attribs.push_back({"aNormal", Property::VECTOR3, attribs[0].mNumElements, std::move(buffer)});
}
-void GenerateTangentsWithUvs(MeshDefinition::RawData& raw)
+template<bool useVec3, bool hasUvs, typename T = std::conditional_t<useVec3, Vector3, Vector4>, typename = std::enable_if_t<(std::is_same<T, Vector3>::value || std::is_same<T, Vector4>::value)>>
+bool GenerateTangents(MeshDefinition::RawData& raw)
{
auto& attribs = raw.mAttribs;
- DALI_ASSERT_DEBUG(attribs.size() > 2); // positions, normals, uvs
- IndexProvider getIndex(raw.mIndices.data());
-
- const uint32_t numIndices = raw.mIndices.empty() ? attribs[0].mNumElements : static_cast<uint32_t>(raw.mIndices.size());
-
- auto* positions = reinterpret_cast<const Vector3*>(attribs[0].mData.data());
- auto* uvs = reinterpret_cast<const Vector2*>(attribs[2].mData.data());
-
- std::vector<uint8_t> buffer(attribs[0].mNumElements * sizeof(Vector3));
- auto tangents = reinterpret_cast<Vector3*>(buffer.data());
-
- for(uint32_t i = 0; i < numIndices; i += 3)
+ // Required positions, normals, uvs (if we have). If not, skip generation
+ if(attribs.size() < (2 + static_cast<size_t>(hasUvs)))
{
- uint16_t indices[]{getIndex(), getIndex(), getIndex()};
- Vector3 pos[]{positions[indices[0]], positions[indices[1]], positions[indices[2]]};
- Vector2 uv[]{uvs[indices[0]], uvs[indices[1]], uvs[indices[2]]};
-
- float x0 = pos[1].x - pos[0].x;
- float y0 = pos[1].y - pos[0].y;
- float z0 = pos[1].z - pos[0].z;
+ return false;
+ }
- float x1 = pos[2].x - pos[0].x;
- float y1 = pos[2].y - pos[0].y;
- float z1 = pos[2].z - pos[0].z;
+ std::vector<uint8_t> buffer(attribs[0].mNumElements * sizeof(T));
+ auto tangents = reinterpret_cast<T*>(buffer.data());
- float s0 = uv[1].x - uv[0].x;
- float t0 = uv[1].y - uv[0].y;
+ if constexpr(hasUvs)
+ {
+ IndexProvider getIndex(raw.mIndices.data());
+ const uint32_t numIndices = raw.mIndices.empty() ? attribs[0].mNumElements : static_cast<uint32_t>(raw.mIndices.size());
- float s1 = uv[2].x - uv[0].x;
- float t1 = uv[2].y - uv[0].y;
+ auto* positions = reinterpret_cast<const Vector3*>(attribs[0].mData.data());
+ auto* uvs = reinterpret_cast<const Vector2*>(attribs[2].mData.data());
- float r = 1.f / (s0 * t1 - t0 * s1);
- Vector3 tangent((x0 * t1 - t0 * x1) * r, (y0 * t1 - t0 * y1) * r, (z0 * t1 - t0 * z1) * r);
- tangents[indices[0]] += tangent;
- tangents[indices[1]] += tangent;
- tangents[indices[2]] += tangent;
+ for(uint32_t i = 0; i < numIndices; i += 3)
+ {
+ uint16_t indices[]{getIndex(), getIndex(), getIndex()};
+ Vector3 pos[]{positions[indices[0]], positions[indices[1]], positions[indices[2]]};
+ Vector2 uv[]{uvs[indices[0]], uvs[indices[1]], uvs[indices[2]]};
+
+ float x0 = pos[1].x - pos[0].x;
+ float y0 = pos[1].y - pos[0].y;
+ float z0 = pos[1].z - pos[0].z;
+
+ float x1 = pos[2].x - pos[0].x;
+ float y1 = pos[2].y - pos[0].y;
+ float z1 = pos[2].z - pos[0].z;
+
+ float s0 = uv[1].x - uv[0].x;
+ float t0 = uv[1].y - uv[0].y;
+
+ float s1 = uv[2].x - uv[0].x;
+ float t1 = uv[2].y - uv[0].y;
+
+ float det = (s0 * t1 - t0 * s1);
+ float r = 1.f / ((std::abs(det) < Dali::Epsilon<1000>::value) ? (Dali::Epsilon<1000>::value * (det > 0.0f ? 1.f : -1.f)) : det);
+ Vector3 tangent((x0 * t1 - t0 * x1) * r, (y0 * t1 - t0 * y1) * r, (z0 * t1 - t0 * z1) * r);
+ tangents[indices[0]] += T(tangent);
+ tangents[indices[1]] += T(tangent);
+ tangents[indices[2]] += T(tangent);
+ }
}
auto* normals = reinterpret_cast<const Vector3*>(attribs[1].mData.data());
auto iEnd = normals + attribs[1].mNumElements;
while(normals != iEnd)
{
- *tangents -= *normals * normals->Dot(*tangents);
- tangents->Normalize();
-
- ++tangents;
- ++normals;
- }
- attribs.push_back({"aTangent", Property::VECTOR3, attribs[0].mNumElements, std::move(buffer)});
-}
-
-void GenerateTangents(MeshDefinition::RawData& raw)
-{
- auto& attribs = raw.mAttribs;
- DALI_ASSERT_DEBUG(attribs.size() > 1); // positions, normals
-
- auto* normals = reinterpret_cast<const Vector3*>(attribs[1].mData.data());
-
- std::vector<uint8_t> buffer(attribs[0].mNumElements * sizeof(Vector3));
- auto tangents = reinterpret_cast<Vector3*>(buffer.data());
-
- auto iEnd = normals + attribs[1].mNumElements;
- while(normals != iEnd)
- {
- Vector3 t[]{normals->Cross(Vector3::XAXIS), normals->Cross(Vector3::YAXIS)};
+ Vector3 tangentVec3;
+ if constexpr(hasUvs)
+ {
+ // Calculated by indexs
+ tangentVec3 = Vector3((*tangents).x, (*tangents).y, (*tangents).z);
+ }
+ else
+ {
+ // Only choiced by normal vector. by indexs
+ Vector3 t[]{normals->Cross(Vector3::XAXIS), normals->Cross(Vector3::YAXIS)};
+ tangentVec3 = t[t[1].LengthSquared() > t[0].LengthSquared()];
+ }
- *tangents = t[t[1].LengthSquared() > t[0].LengthSquared()];
- *tangents -= *normals * normals->Dot(*tangents);
- tangents->Normalize();
+ tangentVec3 -= *normals * normals->Dot(tangentVec3);
+ tangentVec3.Normalize();
+ if constexpr(useVec3)
+ {
+ *tangents = tangentVec3;
+ }
+ else
+ {
+ *tangents = Vector4(tangentVec3.x, tangentVec3.y, tangentVec3.z, 1.0f);
+ }
++tangents;
++normals;
}
- attribs.push_back({"aTangent", Property::VECTOR3, attribs[0].mNumElements, std::move(buffer)});
+ attribs.push_back({"aTangent", useVec3 ? Property::VECTOR3 : Property::VECTOR4, attribs[0].mNumElements, std::move(buffer)});
+
+ return true;
}
void CalculateTextureSize(uint32_t totalTextureSize, uint32_t& textureWidth, uint32_t& textureHeight)
else if(mTangents.mBlob.mLength != 0 && hasNormals && isTriangles)
{
DALI_ASSERT_DEBUG(mTangents.mBlob.mLength == mNormals.mBlob.GetBufferSize());
- hasUvs ? GenerateTangentsWithUvs(raw) : GenerateTangents(raw);
+ static const std::function<bool(RawData&)> GenerateTangentsFunction[2][2] =
+ {
+ {
+ GenerateTangents<false, false>,
+ GenerateTangents<false, true>,
+ },
+ {
+ GenerateTangents<true, false>,
+ GenerateTangents<true, true>,
+ },
+ };
+ const bool generateSuccessed = GenerateTangentsFunction[mTangentType == Property::VECTOR3][hasUvs](raw);
+ if(!generateSuccessed)
+ {
+ DALI_LOG_ERROR("Failed to generate tangents\n");
+ }
}
if(mColors.IsDefined())
actor.AddRenderer(renderer);
}
-const std::string NodeDefinition::ORIGINAL_MATRIX_PROPERTY_NAME = "originalMatrix";
+const char* NodeDefinition::ORIGINAL_MATRIX_PROPERTY_NAME = "originalMatrix";
Actor NodeDefinition::CreateActor(CreateParams& params)
{
static std::string_view GetIblYDirectionUniformName();
public: // DATA
- static const std::string ORIGINAL_MATRIX_PROPERTY_NAME;
+ static const char* ORIGINAL_MATRIX_PROPERTY_NAME;
std::string mName;
uint32_t mNodeId = INVALID_INDEX;
{
namespace
{
-const std::string JOINT_MATRIX{"jointMatrix"};
+const char* JOINT_MATRIX{"jointMatrix"};
const std::map<Property::Type, Constraint (*)(Actor&, Property::Index)> sConstraintFactory = {
{Property::Type::BOOLEAN,
{
// Register bone transform on shader.
char propertyNameBuffer[32];
- snprintf(propertyNameBuffer, sizeof(propertyNameBuffer), "%s[%d]", Skinning::BONE_UNIFORM_NAME.c_str(), boneIdx);
+ snprintf(propertyNameBuffer, sizeof(propertyNameBuffer), "%s[%d]", Skinning::BONE_UNIFORM_NAME, boneIdx);
DALI_ASSERT_DEBUG(shader.GetPropertyIndex(propertyNameBuffer) == Property::INVALID_INDEX);
auto propBoneXform = shader.RegisterProperty(propertyNameBuffer, Matrix{false});
{
namespace
{
-const std::string SHADER_HINT_OUTPUT_IS_TRANSPARENT("OUTPUT_IS_TRANSPARENT"); ///< Might generate transparent alpha from opaque inputs.
-const std::string SHADER_HINT_MODIFIES_GEOMETRY("MODIFIES_GEOMETRY"); ///< Might change position of vertices, this option disables any culling optimizations.
-
+const char* SHADER_HINT_OUTPUT_IS_TRANSPARENT("OUTPUT_IS_TRANSPARENT"); ///< Might generate transparent alpha from opaque inputs.
+const char* SHADER_HINT_MODIFIES_GEOMETRY("MODIFIES_GEOMETRY"); ///< Might change position of vertices, this option disables any culling optimizations.
} // namespace
ShaderDefinition::ShaderDefinition(const ShaderDefinition& other)
{
const unsigned int Skinning::MAX_JOINTS = 64;
-const std::string Skinning::BONE_UNIFORM_NAME = "uBone";
-
+const char* Skinning::BONE_UNIFORM_NAME = "uBone";
} // namespace Loader
} // namespace Scene3D
} // namespace Dali
/*
* @brief Name of bone matrix uniform (array).
*/
- static const std::string BONE_UNIFORM_NAME;
+ static const char* BONE_UNIFORM_NAME;
Skinning() = delete;
};
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
if(GetStringFromProperty(value, encodedString))
{
- std::vector<unsigned char> outputTmpData;
- outputTmpData.reserve(ceil(encodedString.size() * 0.75f));
+ std::vector<uint8_t> outputTmpData;
+ // Output required at least ceil(length * 3 / 4)
+ outputData.reserve((encodedString.size() * 3 + 3) / 4);
bn::decode_b64(encodedString.begin(), encodedString.end(), std::back_inserter(outputTmpData));
outputData.clear();
- uint32_t outputSize = outputTmpData.size() / sizeof(uint32_t) + static_cast<uint32_t>(!!(outputTmpData.size() % sizeof(uint32_t)));
+ uint32_t outputSize = (outputTmpData.size() + sizeof(uint32_t) - 1) / sizeof(uint32_t);
outputData.resize(outputSize);
// Treat as a block of data
memcpy(&outputData[0], &outputTmpData[0], outputTmpData.size());
if(GetStringFromProperty(value, encodedString))
{
- outputData.reserve(ceil(encodedString.size() * 0.75f));
+ // Output required at least ceil(length * 3 / 4)
+ outputData.reserve((encodedString.size() * 3 + 3) / 4);
bn::decode_b64(encodedString.begin(), encodedString.end(), std::back_inserter(outputData));
decoded = true;
return decoded;
}
+bool DecodeBase64FromString(const std::string_view& encodedString, std::vector<uint8_t>& outputData)
+{
+ // Output required at least ceil(length * 3 / 4)
+ outputData.reserve((encodedString.size() * 3 + 3) >> 2);
+ bn::decode_b64(encodedString.begin(), encodedString.end(), std::back_inserter(outputData));
+
+ return true; // Always success.
+}
+
void EncodeBase64PropertyData(Property::Value& value, const std::vector<uint32_t>& inputData)
{
std::ostringstream oss;
std::ostream_iterator<unsigned char>(oss, ""));
std::string encodedString = oss.str();
+
+ // Add padding
+ int paddingLength = (4 - (encodedString.length() % 4)) % 4;
+ if(paddingLength > 0)
+ {
+ while(paddingLength--)
+ {
+ oss << '=';
+ }
+ encodedString = oss.str();
+ }
+
+ if(encodedString.length() > MAX_PROPERTY_STRING_LENGTH)
+ {
+ // cut string up into blocks of MAX_PROPERTY_STRING_LENGTH and store to an array
+ auto numStrings = (encodedString.length() + MAX_PROPERTY_STRING_LENGTH - 1) / MAX_PROPERTY_STRING_LENGTH;
+
+ Property::Array array;
+ for(auto i = 0u; i < numStrings; ++i)
+ {
+ array.PushBack(encodedString.substr(i * MAX_PROPERTY_STRING_LENGTH, MAX_PROPERTY_STRING_LENGTH));
+ }
+ value = array;
+ }
+ else
+ {
+ value = encodedString;
+ }
+}
+
+void EncodeBase64PropertyData(Property::Value& value, const std::vector<uint8_t>& inputData)
+{
+ std::ostringstream oss;
+
+ bn::encode_b64(reinterpret_cast<const uint8_t*>(&inputData[0]),
+ reinterpret_cast<const uint8_t*>(&inputData[0] + inputData.size()),
+ std::ostream_iterator<char>(oss, ""));
+
+ std::string encodedString = oss.str();
+
+ // Add padding
+ int paddingLength = (4 - (encodedString.length() % 4)) % 4;
+ if(paddingLength > 0)
+ {
+ while(paddingLength--)
+ {
+ oss << '=';
+ }
+ encodedString = oss.str();
+ }
+
if(encodedString.length() > MAX_PROPERTY_STRING_LENGTH)
{
// cut string up into blocks of MAX_PROPERTY_STRING_LENGTH and store to an array
- auto numStrings = encodedString.length() / MAX_PROPERTY_STRING_LENGTH +
- ((encodedString.length() % MAX_PROPERTY_STRING_LENGTH) != 0);
+ auto numStrings = (encodedString.length() + MAX_PROPERTY_STRING_LENGTH - 1) / MAX_PROPERTY_STRING_LENGTH;
Property::Array array;
for(auto i = 0u; i < numStrings; ++i)
#define DALI_TOOLKIT_BASE64_ENCODING_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
// EXTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/property.h>
+#include <string_view>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/dali-toolkit-common.h>
DALI_TOOLKIT_API bool DecodeBase64PropertyData(const Property::Value& value, std::vector<uint8_t>& outputData);
/**
+ * @brief Parses a std::string_view to retrieve an array of uint8_t data.
+ *
+ * Data can be encoded using the base64 encoding scheme to allow it to be used
+ * in JSON (The property system maps to JSON types).
+ *
+ * @param[in] encodedString The input string to decode
+ * @param[out] outputData The output data block
+ * @return True if a data block was decoded successfully.
+ */
+DALI_TOOLKIT_API bool DecodeBase64FromString(const std::string_view& encodedString, std::vector<uint8_t>& outputData);
+
+/**
* @brief Convert a block of uint32_t data into a Property::STRING or ARRAY of STRINGs
* encoded using base64. This allows the data to be mapped to JSON easily.
*
*/
DALI_TOOLKIT_API void EncodeBase64PropertyData(Property::Value& value, const std::vector<uint32_t>& inputData);
+/**
+ * @brief Convert a block of uint8_t data into a Property::STRING or ARRAY of STRINGs
+ * encoded using base64. This allows the data to be mapped to JSON easily.
+ *
+ * @param[out] value The value to write data into (to avoid copying).
+ * @param[in] inputData The input
+ */
+DALI_TOOLKIT_API void EncodeBase64PropertyData(Property::Value& value, const std::vector<uint8_t>& inputData);
+
} // namespace Toolkit
} // namespace Dali
{
#define TOKEN_STRING(x) #x
-const std::string KEYNAME_ACTORS = "actors";
-const std::string KEYNAME_ENTRY_TRANSITION = "entryTransition";
-const std::string KEYNAME_EXIT_TRANSITION = "exitTransition";
-const std::string KEYNAME_INCLUDES = "includes";
-const std::string KEYNAME_INHERIT = "inherit";
-const std::string KEYNAME_MAPPINGS = "mappings";
-const std::string KEYNAME_NAME = "name";
-const std::string KEYNAME_SIGNALS = "signals";
-const std::string KEYNAME_STATES = "states";
-const std::string KEYNAME_STYLES = "styles";
-const std::string KEYNAME_TEMPLATES = "templates";
-const std::string KEYNAME_TRANSITIONS = "transitions";
-const std::string KEYNAME_TYPE = "type";
-const std::string KEYNAME_VISUALS = "visuals";
-
-const std::string PROPERTIES = "properties";
-const std::string ANIMATABLE_PROPERTIES = "animatableProperties";
+const char* KEYNAME_ACTORS = "actors";
+const char* KEYNAME_ENTRY_TRANSITION = "entryTransition";
+const char* KEYNAME_EXIT_TRANSITION = "exitTransition";
+const char* KEYNAME_INCLUDES = "includes";
+const char* KEYNAME_INHERIT = "inherit";
+const char* KEYNAME_MAPPINGS = "mappings";
+const char* KEYNAME_SIGNALS = "signals";
+const char* KEYNAME_STATES = "states";
+const char* KEYNAME_STYLES = "styles";
+const char* KEYNAME_TEMPLATES = "templates";
+const char* KEYNAME_TRANSITIONS = "transitions";
+const char* KEYNAME_TYPE = "type";
+const char* KEYNAME_VISUALS = "visuals";
+
+const char* PROPERTIES = "properties";
+const char* ANIMATABLE_PROPERTIES = "animatableProperties";
typedef std::vector<const TreeNode*> TreeNodeList;
namespace
{
-const std::string READING_INFO_TYPE_NAME = "name";
-const std::string READING_INFO_TYPE_ROLE = "role";
-const std::string READING_INFO_TYPE_DESCRIPTION = "description";
-const std::string READING_INFO_TYPE_STATE = "state";
-const std::string READING_INFO_TYPE_ATTRIBUTE_NAME = "reading_info_type";
-const std::string READING_INFO_TYPE_SEPARATOR = "|";
+const char* READING_INFO_TYPE_NAME = "name";
+const char* READING_INFO_TYPE_ROLE = "role";
+const char* READING_INFO_TYPE_DESCRIPTION = "description";
+const char* READING_INFO_TYPE_STATE = "state";
+const char* READING_INFO_TYPE_ATTRIBUTE_NAME = "reading_info_type";
+const char* READING_INFO_TYPE_SEPARATOR = "|";
} // namespace
namespace Dali
const char* const IMAGE_BRDF_FILE_NAME = "brdfLUT.png";
// glTF file extension
-const std::string GLTF_EXT(".gltf");
+const char* GLTF_EXT(".gltf");
/**
* cube map face index
* The alignment depends on the alignment value of the text label (Use Text::VerticalAlignment enumerations).
*/
const float VERTICAL_ALIGNMENT_TABLE[Text::VerticalAlignment::BOTTOM + 1] =
- {
+{
0.0f, // VerticalAlignment::TOP
0.5f, // VerticalAlignment::CENTER
1.0f // VerticalAlignment::BOTTOM
};
-const std::string TEXT_FIT_ENABLE_KEY("enable");
-const std::string TEXT_FIT_MIN_SIZE_KEY("minSize");
-const std::string TEXT_FIT_MAX_SIZE_KEY("maxSize");
-const std::string TEXT_FIT_STEP_SIZE_KEY("stepSize");
-const std::string TEXT_FIT_FONT_SIZE_KEY("fontSize");
-const std::string TEXT_FIT_FONT_SIZE_TYPE_KEY("fontSizeType");
+const char* TEXT_FIT_ENABLE_KEY("enable");
+const char* TEXT_FIT_MIN_SIZE_KEY("minSize");
+const char* TEXT_FIT_MAX_SIZE_KEY("maxSize");
+const char* TEXT_FIT_STEP_SIZE_KEY("stepSize");
+const char* TEXT_FIT_FONT_SIZE_KEY("fontSize");
+const char* TEXT_FIT_FONT_SIZE_TYPE_KEY("fontSizeType");
#if defined(DEBUG_ENABLED)
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
#endif
const Scripting::StringEnum AUTO_SCROLL_STOP_MODE_TABLE[] =
- {
+{
{"IMMEDIATE", Toolkit::TextLabel::AutoScrollStopMode::IMMEDIATE},
{"FINISH_LOOP", Toolkit::TextLabel::AutoScrollStopMode::FINISH_LOOP},
};
#define GET_LOCALE_TEXT(string) dgettext("dali-toolkit", string)
#endif
-const std::string TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME("TextSelectionPopupButton");
+const char* TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME("TextSelectionPopupButton");
const Dali::Vector4 DEFAULT_OPTION_PRESSED_COLOR(Dali::Vector4(0.24f, 0.72f, 0.8f, 1.0f));
const float DEFAULT_OPTION_PRESSED_CORNER_RADIUS = 0.0f;
const Dali::Vector4 DEFAULT_LABEL_PADDING(Dali::Vector4(24.0f, 24.0f, 14.0f, 14.0f));
const char* const OPTION_PASTE("optionPaste"); // "Paste" popup option.
const char* const OPTION_CLIPBOARD("optionClipboard"); // "Clipboard" popup option.
-const std::string IDS_LTR("IDS_LTR");
-const std::string RTL_DIRECTION("RTL");
+const char* IDS_LTR("IDS_LTR");
+const char* RTL_DIRECTION("RTL");
BaseHandle Create()
{
// Whether to mirror the list of buttons (for right to left languages)
bool mirror = false;
#if defined(__GLIBC__)
- char* idsLtr = GET_LOCALE_TEXT(IDS_LTR.c_str());
+ char* idsLtr = GET_LOCALE_TEXT(IDS_LTR);
if(NULL != idsLtr)
{
- mirror = (0 == strcmp(idsLtr, RTL_DIRECTION.c_str()));
+ mirror = (0 == strcmp(idsLtr, RTL_DIRECTION));
if(mirror)
{
#include <functional>
#include <memory>
+#include <unordered_map>
namespace Dali
{
DALI_TYPE_REGISTRATION_END()
// clang-format on
+std::unordered_map<Dali::WebEnginePlugin*, Dali::WeakHandle<Toolkit::WebView>>& GetPluginWebViewTable()
+{
+ static std::unordered_map<Dali::WebEnginePlugin*, Dali::WeakHandle<Toolkit::WebView>> pluginWebViewMap;
+ return pluginWebViewMap;
+}
} // namespace
-std::unordered_map<Dali::WebEnginePlugin*, Dali::WeakHandle<Toolkit::WebView>> WebView::mPluginWebViewMap;
-
WebView::WebView(const std::string& locale, const std::string& timezoneId)
: Control(ControlBehaviour(ACTOR_BEHAVIOUR_DEFAULT | DISABLE_STYLE_CHANGE_SIGNALS)),
mVisual(),
{
if(mWebEngine)
{
- auto iter = mPluginWebViewMap.find(mWebEngine.GetPlugin());
- if (iter != mPluginWebViewMap.end())
+ auto iter = GetPluginWebViewTable().find(mWebEngine.GetPlugin());
+ if (iter != GetPluginWebViewTable().end())
{
- mPluginWebViewMap.erase(iter);
+ GetPluginWebViewTable().erase(iter);
}
mWebEngine.Destroy();
}
Toolkit::WebView handle = Toolkit::WebView(*impl);
if (impl->GetPlugin())
{
- mPluginWebViewMap[impl->GetPlugin()] = handle;
+ GetPluginWebViewTable()[impl->GetPlugin()] = handle;
}
impl->Initialize();
return handle;
Toolkit::WebView handle = Toolkit::WebView(*impl);
if (impl->GetPlugin())
{
- mPluginWebViewMap[impl->GetPlugin()] = handle;
+ GetPluginWebViewTable()[impl->GetPlugin()] = handle;
}
impl->Initialize();
return handle;
Toolkit::WebView handle = Toolkit::WebView(*impl);
if (impl->GetPlugin())
{
- mPluginWebViewMap[impl->GetPlugin()] = handle;
+ GetPluginWebViewTable()[impl->GetPlugin()] = handle;
}
impl->Initialize();
return handle;
Toolkit::WebView WebView::FindWebView(Dali::WebEnginePlugin* plugin)
{
- auto iter = mPluginWebViewMap.find(plugin);
- if (iter != mPluginWebViewMap.end())
+ auto iter = GetPluginWebViewTable().find(plugin);
+ if (iter != GetPluginWebViewTable().end())
{
return iter->second.GetHandle();
}
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/object/property-notification.h>
#include <memory>
-#include <unordered_map>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/control-accessible.h>
Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback mScreenshotCapturedCallback;
Dali::WebEnginePlugin::WebEngineFrameRenderedCallback mFrameRenderedCallback;
-
- static std::unordered_map<Dali::WebEnginePlugin*, Dali::WeakHandle<Toolkit::WebView>> mPluginWebViewMap;
};
} // namespace Internal
SignalFeedbackInfoContainer mSignalFeedbackInfoList;
};
-static const FeedbackStyleInfo DEFAULT_FEEDBACK_STYLE_INFO;
-
FeedbackStyle::FeedbackStyle()
{
mFeedback = Dali::FeedbackPlayer::Get();
}
else
{
+ static const FeedbackStyleInfo DEFAULT_FEEDBACK_STYLE_INFO;
return DEFAULT_FEEDBACK_STYLE_INFO;
}
}
{
if(!parent.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN))
{
- DALI_LOG_INFO(gLogFilter, Debug::General, "[%s:%d] Parent Actor has KEYBOARD_FOCUSABLE_CHILDREN false\n", __FUNCTION__, __LINE__);
+ DALI_LOG_DEBUG_INFO("Parent Actor has KEYBOARD_FOCUSABLE_CHILDREN false\n");
return false;
}
parent = parent.GetParent();
// If developer set focus on same actor, doing nothing
Actor currentFocusedActor = GetCurrentFocusActor();
+ DALI_LOG_DEBUG_INFO("current focused actor : [%p] new focused actor : [%p]\n", currentFocusedActor.GetObjectPtr(), actor.GetObjectPtr());
if(actor == currentFocusedActor)
{
return true;
// Get Current Focused Actor from window
Actor currentFocusedActor = GetFocusActorFromCurrentWindow();
- SetCurrentFocusActor(currentFocusedActor);
-
- if(currentFocusedActor && (mEnableFocusIndicator == ENABLE))
+ if(currentFocusedActor)
{
- // Make sure the focused actor is highlighted
- currentFocusedActor.Add(GetFocusIndicatorActor());
- mIsFocusIndicatorShown = SHOW;
+ SetCurrentFocusActor(currentFocusedActor);
+
+ if(mEnableFocusIndicator == ENABLE)
+ {
+ // Make sure the focused actor is highlighted
+ currentFocusedActor.Add(GetFocusIndicatorActor());
+ mIsFocusIndicatorShown = SHOW;
+ }
}
}
}
DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_TEXT_PERFORMANCE_MARKER, false);
-const std::string KEY_C_NAME = "c";
-const std::string KEY_V_NAME = "v";
-const std::string KEY_X_NAME = "x";
-const std::string KEY_A_NAME = "a";
-const std::string KEY_INSERT_NAME = "Insert";
+const char* KEY_C_NAME = "c";
+const char* KEY_V_NAME = "v";
+const char* KEY_X_NAME = "x";
+const char* KEY_A_NAME = "a";
+const char* KEY_INSERT_NAME = "Insert";
} // namespace
constexpr float MAX_FLOAT = std::numeric_limits<float>::max();
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
} // namespace
}
}
-const std::string& Controller::InputFontHandler::GetInputFontFamily(const Controller& controller)
+std::string Controller::InputFontHandler::GetInputFontFamily(const Controller& controller)
{
if(NULL != controller.mImpl->mEventData)
{
struct Controller::InputFontHandler
{
static void SetInputFontFamily(Controller& controller, const std::string& fontFamily);
- static const std::string& GetInputFontFamily(const Controller& controller);
+ static std::string GetInputFontFamily(const Controller& controller);
static void SetInputFontWeight(const Controller& controller, FontWeight weight);
static bool IsInputFontWeightDefined(const Controller& controller);
static FontWeight GetInputFontWeight(const Controller& controller);
namespace
{
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
}
namespace Dali::Toolkit::Text
}
}
-const std::string& Controller::InputProperties::GetInputShadowProperties(const Controller& controller)
+std::string Controller::InputProperties::GetInputShadowProperties(const Controller& controller)
{
return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.shadowProperties : EMPTY_STRING;
}
}
}
-const std::string& Controller::InputProperties::GetInputUnderlineProperties(const Controller& controller)
+std::string Controller::InputProperties::GetInputUnderlineProperties(const Controller& controller)
{
return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.underlineProperties : EMPTY_STRING;
}
}
}
-const std::string& Controller::InputProperties::GetInputEmbossProperties(const Controller& controller)
+std::string Controller::InputProperties::GetInputEmbossProperties(const Controller& controller)
{
return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.embossProperties : controller.GetDefaultEmbossProperties();
}
}
}
-const std::string& Controller::InputProperties::GetInputOutlineProperties(const Controller& controller)
+std::string Controller::InputProperties::GetInputOutlineProperties(const Controller& controller)
{
return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.outlineProperties : controller.GetDefaultOutlineProperties();
}
static void SetInputShadowProperties(Controller& controller, const std::string& shadowProperties);
- static const std::string& GetInputShadowProperties(const Controller& controller);
+ static std::string GetInputShadowProperties(const Controller& controller);
static void SetInputUnderlineProperties(Controller& controller, const std::string& underlineProperties);
- static const std::string& GetInputUnderlineProperties(const Controller& controller);
+ static std::string GetInputUnderlineProperties(const Controller& controller);
static void SetInputEmbossProperties(Controller& controller, const std::string& embossProperties);
- static const std::string& GetInputEmbossProperties(const Controller& controller);
+ static std::string GetInputEmbossProperties(const Controller& controller);
static void SetInputOutlineProperties(Controller& controller, const std::string& outlineProperties);
- static const std::string& GetInputOutlineProperties(const Controller& controller);
+ static std::string GetInputOutlineProperties(const Controller& controller);
static void SetInputModePassword(Controller& controller, bool passwordInput);
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
#endif
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
const char* const PLACEHOLDER_TEXT = "text";
const char* const PLACEHOLDER_TEXT_FOCUSED = "textFocused";
}
}
-const std::string& Controller::PlaceholderHandler::GetPlaceholderFontFamily(const Controller& controller)
+std::string Controller::PlaceholderHandler::GetPlaceholderFontFamily(const Controller& controller)
{
if((NULL != controller.mImpl->mEventData) && (NULL != controller.mImpl->mEventData->mPlaceholderFont))
{
static void SetPlaceholderText(Controller& controller, PlaceholderType type, const std::string& text);
static void GetPlaceholderText(const Controller& controller, PlaceholderType type, std::string& text);
static void SetPlaceholderFontFamily(Controller& controller, const std::string& placeholderTextFontFamily);
- static const std::string& GetPlaceholderFontFamily(const Controller& controller);
+ static std::string GetPlaceholderFontFamily(const Controller& controller);
static void SetPlaceholderTextFontWeight(Controller& controller, FontWeight weight);
static bool IsPlaceholderTextFontWeightDefined(const Controller& controller);
static FontWeight GetPlaceholderTextFontWeight(const Controller& controller);
if(!isEditable)
{
+ if(NO_OPERATION != (VALIDATE_FONTS & operationsPending) &&
+ textUpdateInfo.mCharacterIndex == static_cast<CharacterIndex>(-1))
+ {
+ impl.ClearFontData();
+ updateInfoCharIndexBackup = textUpdateInfo.mCharacterIndex;
+ }
+
impl.UpdateModel(onlyOnceOperations);
// Layout the text for the new width.
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
#endif
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
template<typename Type>
void EnsureCreated(Type*& object)
}
}
-const std::string& Controller::GetDefaultFontFamily() const
+std::string Controller::GetDefaultFontFamily() const
{
return mImpl->mFontDefaults ? mImpl->mFontDefaults->mFontDescription.family : EMPTY_STRING;
}
PlaceholderHandler::SetPlaceholderFontFamily(*this, placeholderTextFontFamily);
}
-const std::string& Controller::GetPlaceholderFontFamily() const
+std::string Controller::GetPlaceholderFontFamily() const
{
return PlaceholderHandler::GetPlaceholderFontFamily(*this);
}
mImpl->mEmbossDefaults->properties = embossProperties;
}
-const std::string& Controller::GetDefaultEmbossProperties() const
+std::string Controller::GetDefaultEmbossProperties() const
{
return mImpl->mEmbossDefaults ? mImpl->mEmbossDefaults->properties : EMPTY_STRING;
}
mImpl->mOutlineDefaults->properties = outlineProperties;
}
-const std::string& Controller::GetDefaultOutlineProperties() const
+std::string Controller::GetDefaultOutlineProperties() const
{
return mImpl->mOutlineDefaults ? mImpl->mOutlineDefaults->properties : EMPTY_STRING;
}
InputFontHandler::SetInputFontFamily(*this, fontFamily);
}
-const std::string& Controller::GetInputFontFamily() const
+std::string Controller::GetInputFontFamily() const
{
return InputFontHandler::GetInputFontFamily(*this);
}
InputProperties::SetInputShadowProperties(*this, shadowProperties);
}
-const std::string& Controller::GetInputShadowProperties() const
+std::string Controller::GetInputShadowProperties() const
{
return InputProperties::GetInputShadowProperties(*this);
}
InputProperties::SetInputUnderlineProperties(*this, underlineProperties);
}
-const std::string& Controller::GetInputUnderlineProperties() const
+std::string Controller::GetInputUnderlineProperties() const
{
return InputProperties::GetInputUnderlineProperties(*this);
}
InputProperties::SetInputEmbossProperties(*this, embossProperties);
}
-const std::string& Controller::GetInputEmbossProperties() const
+std::string Controller::GetInputEmbossProperties() const
{
return InputProperties::GetInputEmbossProperties(*this);
}
InputProperties::SetInputOutlineProperties(*this, outlineProperties);
}
-const std::string& Controller::GetInputOutlineProperties() const
+std::string Controller::GetInputOutlineProperties() const
{
return InputProperties::GetInputOutlineProperties(*this);
}
}
}
-const std::string& Controller::GetInputStrikethroughProperties() const
+std::string Controller::GetInputStrikethroughProperties() const
{
return (NULL != mImpl->mEventData) ? mImpl->mEventData->mInputStyle.strikethroughProperties : EMPTY_STRING;
}
*
* @return The default font family.
*/
- const std::string& GetDefaultFontFamily() const;
+ std::string GetDefaultFontFamily() const;
/**
* @brief Sets the placeholder text font family.
*
* @return The placeholder text font family
*/
- const std::string& GetPlaceholderFontFamily() const;
+ std::string GetPlaceholderFontFamily() const;
/**
* @brief Sets the default font weight.
*
* @return The emboss's properties string.
*/
- const std::string& GetDefaultEmbossProperties() const;
+ std::string GetDefaultEmbossProperties() const;
/**
* @brief Sets the outline's properties string.
*
* @return The outline's properties string.
*/
- const std::string& GetDefaultOutlineProperties() const;
+ std::string GetDefaultOutlineProperties() const;
/**
* @brief Sets the default line spacing.
*
* @return The input text's font family name.
*/
- const std::string& GetInputFontFamily() const;
+ std::string GetInputFontFamily() const;
/**
* @brief Sets the input font's weight.
*
* @return The shadow's properties string.
*/
- const std::string& GetInputShadowProperties() const;
+ std::string GetInputShadowProperties() const;
/**
* @brief Sets the input underline's properties string.
*
* @return The underline's properties string.
*/
- const std::string& GetInputUnderlineProperties() const;
+ std::string GetInputUnderlineProperties() const;
/**
* @brief Sets the input emboss's properties string.
*
* @return The emboss's properties string.
*/
- const std::string& GetInputEmbossProperties() const;
+ std::string GetInputEmbossProperties() const;
/**
* @brief Sets input the outline's properties string.
*
* @return The outline's properties string.
*/
- const std::string& GetInputOutlineProperties() const;
+ std::string GetInputOutlineProperties() const;
/**
* @brief Sets the input strikethrough's properties string.
*
* @return The strikethrough's properties string.
*/
- const std::string& GetInputStrikethroughProperties() const;
+ std::string GetInputStrikethroughProperties() const;
/**
* @brief Set the control's interface.
{
namespace
{
-const std::string NONE("none");
-const std::string MULTIPLY("multiply");
+const char* MULTIPLY = "multiply";
} // namespace
void ProcessEmbeddedItem(const Tag& tag, EmbeddedItem& embeddedItem)
{
namespace
{
-const std::string FONT_PREFIX("font-");
-const unsigned int FONT_PREFIX_LENGTH = 5u;
-const unsigned int MIN_FONT_ATTRIBUTE_SIZE = 4u; ///< The minimum length of any of the possible 'weight', 'width' , 'slant' or 'size' values.
const unsigned int MAX_FONT_ATTRIBUTE_SIZE = 15u; ///< The maximum length of any of the possible 'weight', 'width' or 'slant' values.
const float PIXEL_FORMAT_64_FACTOR = 64.f; ///< 64.f is used to convert from point size to 26.6 pixel format.
} // namespace
const char* const HEX_COLOR_TOKEN("0x");
const char* const ALPHA_ONE("FF");
-const std::string BLACK_COLOR("black");
-const std::string WHITE_COLOR("white");
-const std::string RED_COLOR("red");
-const std::string GREEN_COLOR("green");
-const std::string BLUE_COLOR("blue");
-const std::string YELLOW_COLOR("yellow");
-const std::string MAGENTA_COLOR("magenta");
-const std::string CYAN_COLOR("cyan");
-const std::string TRANSPARENT_COLOR("transparent");
-
-const std::string SOLID_UNDERLINE("solid");
-const std::string DASHED_UNDERLINE("dashed");
-const std::string DOUBLE_UNDERLINE("double");
-
-const std::string BEGIN_HORIZONTAL_ALIGNMENT("begin");
-const std::string CENTER_HORIZONTAL_ALIGNMENT("center");
-const std::string END_HORIZONTAL_ALIGNMENT("end");
+const char* BLACK_COLOR("black");
+const char* WHITE_COLOR("white");
+const char* RED_COLOR("red");
+const char* GREEN_COLOR("green");
+const char* BLUE_COLOR("blue");
+const char* YELLOW_COLOR("yellow");
+const char* MAGENTA_COLOR("magenta");
+const char* CYAN_COLOR("cyan");
+const char* TRANSPARENT_COLOR("transparent");
+
+const char* SOLID_UNDERLINE("solid");
+const char* DASHED_UNDERLINE("dashed");
+const char* DOUBLE_UNDERLINE("double");
+
+const char* BEGIN_HORIZONTAL_ALIGNMENT("begin");
+const char* CENTER_HORIZONTAL_ALIGNMENT("center");
+const char* END_HORIZONTAL_ALIGNMENT("end");
} // namespace
{
namespace Text
{
-namespace
-{
-static const Vector<CharacterSpacingGlyphRun> EMPTY_CHARACTER_SPACING_GLYPH_RUNS;
-}
float GetGlyphCharacterSpacing(const GlyphIndex& index,
const Vector<CharacterSpacingGlyphRun>& characterSpacingGlyphRuns,
const float modelCharacterSpacing)
return characterSpacing;
}
-
-const Vector<CharacterSpacingGlyphRun>& GetEmptyCharacterSpacingGlyphRuns()
-{
- // This is needed to return a common empty vector for CharacterSpacingGlyphRun
- return EMPTY_CHARACTER_SPACING_GLYPH_RUNS;
-}
} // namespace Text
} // namespace Toolkit
-} // namespace Dali
\ No newline at end of file
+} // namespace Dali
float GetGlyphCharacterSpacing(const GlyphIndex& index,
const Vector<CharacterSpacingGlyphRun>& characterSpacingGlyphRuns,
const float modelCharacterSpacing);
-
-/**
- * @brief Create static empty vector and retrun it.
- *
- * @return The reference for the empty character-spacing glyph runs.
- */
-const Vector<CharacterSpacingGlyphRun>& GetEmptyCharacterSpacingGlyphRuns();
-
} // namespace Text
} // namespace Toolkit
} // namespace Dali
-#endif // DALI_TOOLKIT_TEXT_RENDERING_STYLES_CHARACTER_SPACING_HELPER_FUNCTIONS_H
\ No newline at end of file
+#endif // DALI_TOOLKIT_TEXT_RENDERING_STYLES_CHARACTER_SPACING_HELPER_FUNCTIONS_H
{
namespace
{
-const std::string COLOR_KEY("color");
-const std::string OFFSET_KEY("offset");
-const std::string BLUR_RADIUS_KEY("blurRadius");
-const std::string WIDTH_KEY("width");
-const std::string HEIGHT_KEY("height");
-const std::string ENABLE_KEY("enable");
-const std::string TYPE_KEY("type");
-const std::string DASH_WIDTH_KEY("dashWidth");
-const std::string DASH_GAP_KEY("dashGap");
-const std::string TRUE_TOKEN("true");
-const std::string FALSE_TOKEN("false");
+const char* COLOR_KEY = "color";
+const char* OFFSET_KEY = "offset";
+const char* BLUR_RADIUS_KEY = "blurRadius";
+const char* WIDTH_KEY = "width";
+const char* HEIGHT_KEY = "height";
+const char* ENABLE_KEY = "enable";
+const char* TYPE_KEY = "type";
+const char* DASH_WIDTH_KEY = "dashWidth";
+const char* DASH_GAP_KEY = "dashGap";
+const char* TRUE_TOKEN = "true";
} // namespace
bool ParseShadowProperties(const Property::Map& shadowPropertiesMap,
{
namespace
{
-const std::string STYLE_KEY("style");
-const std::string WEIGHT_KEY("weight");
-const std::string WIDTH_KEY("width");
-const std::string SLANT_KEY("slant");
-const std::string FAMILY_KEY("family");
-const std::string TYPE_KEY("type");
-
-const std::string SYSTEM_TOKEN("system");
+const char* WEIGHT_KEY = "weight";
+const char* WIDTH_KEY = "width";
+const char* SLANT_KEY = "slant";
+const char* FAMILY_KEY = "family";
+const char* TYPE_KEY = "type";
+
+const char* SYSTEM_TOKEN = "system";
} // namespace
virtual const Vector<BoundedParagraphRun>& GetBoundedParagraphRuns() const = 0;
/**
- * @brief Retrieves the number of character-spacing glyph runs.
- *
- * @return The number of character-spacing glyph runs.
- */
- virtual Length GetNumberOfCharacterSpacingGlyphRuns() const = 0;
-
- /**
- * @brief Retrieves the reference for character-spacing glyph runs.
- *
- * @return The reference for character-spacing glyph runs.
- */
- virtual const Vector<CharacterSpacingGlyphRun>& GetCharacterSpacingGlyphRuns() const = 0;
-
- /**
* @brief Retrieves the strikethrough runs.
*
* @param[out] strikethroughRuns Pointer to a buffer where the strikethrough runs are copied.
return mImpl->mLogicalModel->GetBoundedParagraphRuns();
}
-Length View::GetNumberOfCharacterSpacingGlyphRuns() const
-{
- return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetNumberOfCharacterSpacingGlyphRuns() : 0u;
-}
-
-const Vector<CharacterSpacingGlyphRun>& View::GetCharacterSpacingGlyphRuns() const
-{
- return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetCharacterSpacingGlyphRuns() : GetEmptyCharacterSpacingGlyphRuns();
-}
-
float View::GetCharacterSpacing() const
{
- return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetCharacterSpacing() : 0.f;
+ return mImpl->mVisualModel->GetCharacterSpacing();
}
const Character* View::GetTextBuffer() const
{
- return (mImpl->mVisualModel) ? mImpl->mLogicalModel->mText.Begin() : nullptr;
+ return mImpl->mLogicalModel->mText.Begin();
}
const Vector<CharacterIndex>& View::GetGlyphsToCharacters() const
virtual const Vector<BoundedParagraphRun>& GetBoundedParagraphRuns() const;
/**
- * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfCharacterSpacingGlyphRuns()
- */
- Length GetNumberOfCharacterSpacingGlyphRuns() const override;
-
- /**
- * @copydoc Dali::Toolkit::Text::ViewInterface::GetCharacterSpacingGlyphRuns()
- */
- const Vector<CharacterSpacingGlyphRun>& GetCharacterSpacingGlyphRuns() const override;
-
- /**
* @copydoc Dali::Toolkit::Text::ViewInterface::GetCharacterSpacing()
*/
float GetCharacterSpacing() const override;
{
namespace
{
-static constexpr float OPACITY_TRANSPARENT = 0.0f;
-
-const Dali::AlphaFunction DEFAULT_ALPHA_FUNCTION(Dali::AlphaFunction::DEFAULT);
-
-const Property::Map PROPERTY_MAP_INDEPENDENT_CONTROL{
- {Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER},
- {Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER},
- {Dali::Actor::Property::POSITION_USES_ANCHOR_POINT, true},
- {Dali::Actor::Property::INHERIT_POSITION, false},
- {Dali::Actor::Property::INHERIT_ORIENTATION, false},
- {Dali::Actor::Property::INHERIT_SCALE, false},
- {Dali::Actor::Property::COLOR_MODE, Dali::ColorMode::USE_OWN_COLOR},
-};
-
Property::Map GetOriginalProperties(Dali::Toolkit::Control control)
{
Property::Map propertyMap;
return propertyMap;
}
-
} // anonymous namespace
TransitionBasePtr TransitionBase::New()
}
TransitionBase::TransitionBase()
-: mAlphaFunction(DEFAULT_ALPHA_FUNCTION),
+: mAlphaFunction(Dali::AlphaFunction::DEFAULT),
mTimePeriod(TimePeriod(0.0f)),
mTransitionWithChild(false),
mMoveTargetChildren(false),
targetWorldTransform.GetTransformComponents(targetPosition, targetOrientation, targetScale);
Vector4 targetColor = DevelActor::GetWorldColor(mTarget);
- mTarget.SetProperties(PROPERTY_MAP_INDEPENDENT_CONTROL);
+ mTarget[Dali::Actor::Property::ANCHOR_POINT] = AnchorPoint::CENTER;
+ mTarget[Dali::Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
+ mTarget[Dali::Actor::Property::POSITION_USES_ANCHOR_POINT] = true;
+ mTarget[Dali::Actor::Property::INHERIT_POSITION] = false;
+ mTarget[Dali::Actor::Property::INHERIT_ORIENTATION] = false;
+ mTarget[Dali::Actor::Property::INHERIT_SCALE] = false;
+ mTarget[Dali::Actor::Property::COLOR_MODE] = Dali::ColorMode::USE_OWN_COLOR;
+
mTarget[Dali::Actor::Property::POSITION] = targetPosition;
mTarget[Dali::Actor::Property::SCALE] = targetScale;
mTarget[Dali::Actor::Property::ORIENTATION] = targetOrientation;
{
namespace Internal
{
-namespace
-{
-const Dali::AlphaFunction DEFAULT_ALPHA_FUNCTION(Dali::AlphaFunction::DEFAULT);
-} // anonymous namespace
-
TransitionPtr Transition::New(Dali::Toolkit::Control source, Dali::Toolkit::Control destination, bool useDestinationTarget, TimePeriod timePeriod)
{
float delaySeconds = timePeriod.delaySeconds;
#else
#define LOG_CACHE
#endif
-
-static constexpr bool ENABLE_ORIENTATION_CORRECTION(true);
-
} // namespace
namespace Dali
{
const Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
-// global string variable to caching complate vertex shader
-static std::string gVertexShader;
-
-// global string variable to caching complate fragment shader (no atlas)
-static std::string gFragmentShaderNoAtlas;
-
const int NATIVE_SHADER_TYPE_OFFSET = VisualFactoryCache::ShaderType::NATIVE_IMAGE_SHADER - VisualFactoryCache::ShaderType::IMAGE_SHADER;
// enum of required list when we select shader
std::string_view ImageVisualShaderFactory::GetVertexShaderSource()
{
+ // static string variable to cache complete vertex shader
+ static std::string gVertexShader;
if(gVertexShader.empty())
{
gVertexShader = Dali::Shader::GetVertexShaderPrefix() + SHADER_IMAGE_VISUAL_SHADER_VERT.data();
std::string_view ImageVisualShaderFactory::GetFragmentShaderSource()
{
+ // static string variable to cache complete fragment shader (no atlas)
+ static std::string gFragmentShaderNoAtlas;
if(gFragmentShaderNoAtlas.empty())
{
gFragmentShaderNoAtlas = Dali::Shader::GetFragmentShaderPrefix() + SHADER_IMAGE_VISUAL_SHADER_FRAG.data();
{
namespace
{
-// global string variable to caching complate vertex shader
-static std::string gVertexShader;
-
-// global string variable to caching complate fragment shader (no atlas)
-static std::string gFragmentShaderNoAtlas;
-
// enum of required list when we select shader
enum class TextVisualRequireFlag : uint32_t
{
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 14;
+const unsigned int TOOLKIT_MICRO_VERSION = 15;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.2.14
+Version: 2.2.15
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT