compile_commands.json
dali-toolkit/internal/graphics/generated/*
dali-toolkit/internal/graphics/builtin-shader-extern-gen.h
-dali-scene-loader/internal/graphics/generated/*
-dali-scene-loader/internal/graphics/builtin-shader-extern-gen.h
+dali-scene3d/internal/graphics/generated/*
+dali-scene3d/internal/graphics/builtin-shader-extern-gen.h
* Build with the Visual Studio project.
* Build with CMake.
* [4. Building for MacOS](#4-building-for-macos)
- * [DALi Scene Loader](#dali-scene-loader)
+ * [DALi Scene3D](#dali-scene3d)
# Build Instructions
% make install -j8
```
-# DALi Scene Loader
+# DALi Scene3D
-For information about the DALi Scene Loader library, refer to dali-scene-loader/README.md.
+For information about the DALi Scene3D library, refer to dali-scene3d/README.md.
$files{$file}->{"patch"} = [@checklines];
$files{$file}->{"b_lines"} = {%b_lines};
- my %filter = map { $_ => $files{$_} } grep {m!^dali(-toolkit|-scene-loader)?/!} (keys(%files));
+ my %filter = map { $_ => $files{$_} } grep {m!^dali(-toolkit|-scene3d)?/!} (keys(%files));
if($pd_debug)
{
--- /dev/null
+{
+ "accessors" : [
+ {
+ "bufferView" : 0,
+ "componentType" : 5126,
+ "count" : 24,
+ "max" : [
+ 1,
+ 1,
+ 1
+ ],
+ "min" : [
+ -1,
+ -1,
+ -1
+ ],
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 1,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 2,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC2"
+ },
+ {
+ "bufferView" : 3,
+ "componentType" : 5121,
+ "count" : 36,
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 4,
+ "componentType" : 5126,
+ "count" : 24,
+ "max" : [
+ 1,
+ 1,
+ 1
+ ],
+ "min" : [
+ -1,
+ -1,
+ -1
+ ],
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 5,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 6,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC2"
+ },
+ {
+ "bufferView" : 7,
+ "componentType" : 5121,
+ "count" : 36,
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 8,
+ "componentType" : 5126,
+ "count" : 24,
+ "max" : [
+ 1,
+ 1,
+ 1
+ ],
+ "min" : [
+ -1,
+ -1,
+ -1
+ ],
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 9,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 10,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC2"
+ },
+ {
+ "bufferView" : 11,
+ "componentType" : 5121,
+ "count" : 36,
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 12,
+ "componentType" : 5126,
+ "count" : 24,
+ "max" : [
+ 1,
+ 1,
+ 1
+ ],
+ "min" : [
+ -1,
+ -1,
+ -1
+ ],
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 13,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 14,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC2"
+ },
+ {
+ "bufferView" : 15,
+ "componentType" : 5121,
+ "count" : 36,
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 16,
+ "componentType" : 5126,
+ "count" : 24,
+ "max" : [
+ 1,
+ 1,
+ 1
+ ],
+ "min" : [
+ -1,
+ -1,
+ -1
+ ],
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 17,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 18,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC2"
+ },
+ {
+ "bufferView" : 19,
+ "componentType" : 5121,
+ "count" : 36,
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 20,
+ "componentType" : 5126,
+ "count" : 24,
+ "max" : [
+ 1,
+ 1,
+ 1
+ ],
+ "min" : [
+ -1,
+ -1,
+ -1
+ ],
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 21,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 22,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC2"
+ },
+ {
+ "bufferView" : 23,
+ "componentType" : 5121,
+ "count" : 36,
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 24,
+ "componentType" : 5126,
+ "count" : 24,
+ "max" : [
+ 1,
+ 1,
+ 1
+ ],
+ "min" : [
+ -1,
+ -1,
+ -1
+ ],
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 25,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 26,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC2"
+ },
+ {
+ "bufferView" : 27,
+ "componentType" : 5121,
+ "count" : 36,
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 28,
+ "componentType" : 5126,
+ "count" : 24,
+ "max" : [
+ 1,
+ 1,
+ 1
+ ],
+ "min" : [
+ -1,
+ -1,
+ -1
+ ],
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 29,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 30,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC2"
+ },
+ {
+ "bufferView" : 31,
+ "componentType" : 5121,
+ "count" : 36,
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 32,
+ "componentType" : 5126,
+ "count" : 24,
+ "max" : [
+ 1,
+ 1,
+ 1
+ ],
+ "min" : [
+ -1,
+ -1,
+ -1
+ ],
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 33,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 34,
+ "componentType" : 5126,
+ "count" : 24,
+ "type" : "VEC2"
+ },
+ {
+ "bufferView" : 35,
+ "componentType" : 5121,
+ "count" : 36,
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 36,
+ "componentType" : 5126,
+ "count" : 4,
+ "max" : [
+ 1,
+ 0,
+ 1
+ ],
+ "min" : [
+ -1,
+ 0,
+ -1
+ ],
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 37,
+ "componentType" : 5126,
+ "count" : 4,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 38,
+ "componentType" : 5126,
+ "count" : 4,
+ "type" : "VEC2"
+ },
+ {
+ "bufferView" : 39,
+ "componentType" : 5121,
+ "count" : 6,
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 40,
+ "componentType" : 5126,
+ "count" : 5,
+ "max" : [
+ 1.6666666666666667
+ ],
+ "min" : [
+ 0.041666666666666664
+ ],
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 41,
+ "componentType" : 5126,
+ "count" : 5,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 42,
+ "componentType" : 5126,
+ "count" : 5,
+ "max" : [
+ 1.6666666666666667
+ ],
+ "min" : [
+ 0.041666666666666664
+ ],
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 43,
+ "componentType" : 5126,
+ "count" : 15,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 44,
+ "componentType" : 5126,
+ "count" : 5,
+ "max" : [
+ 1.6666666666666667
+ ],
+ "min" : [
+ 0.041666666666666664
+ ],
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 45,
+ "componentType" : 5126,
+ "count" : 15,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 46,
+ "componentType" : 5126,
+ "count" : 5,
+ "max" : [
+ 1.7083333333333333
+ ],
+ "min" : [
+ 0
+ ],
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 47,
+ "componentType" : 5126,
+ "count" : 5,
+ "type" : "VEC4"
+ },
+ {
+ "bufferView" : 48,
+ "componentType" : 5126,
+ "count" : 5,
+ "max" : [
+ 1.7083333333333333
+ ],
+ "min" : [
+ 0
+ ],
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 49,
+ "componentType" : 5126,
+ "count" : 15,
+ "type" : "VEC4"
+ },
+ {
+ "bufferView" : 50,
+ "componentType" : 5126,
+ "count" : 5,
+ "max" : [
+ 1.7083333333333333
+ ],
+ "min" : [
+ 0
+ ],
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 51,
+ "componentType" : 5126,
+ "count" : 5,
+ "type" : "VEC4"
+ },
+ {
+ "bufferView" : 52,
+ "componentType" : 5126,
+ "count" : 5,
+ "max" : [
+ 1.7083333333333333
+ ],
+ "min" : [
+ 0
+ ],
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 53,
+ "componentType" : 5126,
+ "count" : 5,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 54,
+ "componentType" : 5126,
+ "count" : 5,
+ "max" : [
+ 1.6666666666666667
+ ],
+ "min" : [
+ 0
+ ],
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 55,
+ "componentType" : 5126,
+ "count" : 15,
+ "type" : "VEC3"
+ },
+ {
+ "bufferView" : 56,
+ "componentType" : 5126,
+ "count" : 5,
+ "max" : [
+ 1.6666666666666667
+ ],
+ "min" : [
+ 0
+ ],
+ "type" : "SCALAR"
+ },
+ {
+ "bufferView" : 57,
+ "componentType" : 5126,
+ "count" : 5,
+ "type" : "VEC3"
+ }
+ ],
+ "animations" : [
+ {
+ "channels" : [
+ {
+ "sampler" : 0,
+ "target" : {
+ "node" : 0,
+ "path" : "scale"
+ }
+ }
+ ],
+ "name" : "Step Scale",
+ "samplers" : [
+ {
+ "input" : 40,
+ "interpolation" : "STEP",
+ "output" : 41
+ }
+ ]
+ },
+ {
+ "channels" : [
+ {
+ "sampler" : 0,
+ "target" : {
+ "node" : 3,
+ "path" : "scale"
+ }
+ }
+ ],
+ "name" : "Linear Scale",
+ "samplers" : [
+ {
+ "input" : 40,
+ "interpolation" : "LINEAR",
+ "output" : 41
+ }
+ ]
+ },
+ {
+ "channels" : [
+ {
+ "sampler" : 0,
+ "target" : {
+ "node" : 4,
+ "path" : "scale"
+ }
+ }
+ ],
+ "name" : "CubicSpline Scale",
+ "samplers" : [
+ {
+ "input" : 44,
+ "interpolation" : "CUBICSPLINE",
+ "output" : 45
+ }
+ ]
+ },
+ {
+ "channels" : [
+ {
+ "sampler" : 0,
+ "target" : {
+ "node" : 5,
+ "path" : "rotation"
+ }
+ }
+ ],
+ "name" : "Step Rotation",
+ "samplers" : [
+ {
+ "input" : 46,
+ "interpolation" : "STEP",
+ "output" : 47
+ }
+ ]
+ },
+ {
+ "channels" : [
+ {
+ "sampler" : 0,
+ "target" : {
+ "node" : 6,
+ "path" : "rotation"
+ }
+ }
+ ],
+ "name" : "CubicSpline Rotation",
+ "samplers" : [
+ {
+ "input" : 48,
+ "interpolation" : "CUBICSPLINE",
+ "output" : 49
+ }
+ ]
+ },
+ {
+ "channels" : [
+ {
+ "sampler" : 0,
+ "target" : {
+ "node" : 7,
+ "path" : "rotation"
+ }
+ }
+ ],
+ "name" : "Linear Rotation",
+ "samplers" : [
+ {
+ "input" : 50,
+ "interpolation" : "LINEAR",
+ "output" : 51
+ }
+ ]
+ },
+ {
+ "channels" : [
+ {
+ "sampler" : 0,
+ "target" : {
+ "node" : 8,
+ "path" : "translation"
+ }
+ }
+ ],
+ "name" : "Step Translation",
+ "samplers" : [
+ {
+ "input" : 52,
+ "interpolation" : "STEP",
+ "output" : 53
+ }
+ ]
+ },
+ {
+ "channels" : [
+ {
+ "sampler" : 0,
+ "target" : {
+ "node" : 9,
+ "path" : "translation"
+ }
+ }
+ ],
+ "name" : "CubicSpline Translation",
+ "samplers" : [
+ {
+ "input" : 54,
+ "interpolation" : "CUBICSPLINE",
+ "output" : 55
+ }
+ ]
+ },
+ {
+ "channels" : [
+ {
+ "sampler" : 0,
+ "target" : {
+ "node" : 10,
+ "path" : "translation"
+ }
+ }
+ ],
+ "name" : "Linear Translation",
+ "samplers" : [
+ {
+ "input" : 56,
+ "interpolation" : "LINEAR",
+ "output" : 57
+ }
+ ]
+ }
+ ],
+ "asset" : {
+ "generator" : "Khronos Blender glTF 2.0 I/O",
+ "version" : "2.0"
+ },
+ "bufferViews" : [
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 0
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 288
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 192,
+ "byteOffset" : 576
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 36,
+ "byteOffset" : 768
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 804
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 1092
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 192,
+ "byteOffset" : 1380
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 36,
+ "byteOffset" : 1572
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 1608
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 1896
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 192,
+ "byteOffset" : 2184
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 36,
+ "byteOffset" : 2376
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 2412
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 2700
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 192,
+ "byteOffset" : 2988
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 36,
+ "byteOffset" : 3180
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 3216
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 3504
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 192,
+ "byteOffset" : 3792
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 36,
+ "byteOffset" : 3984
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 4020
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 4308
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 192,
+ "byteOffset" : 4596
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 36,
+ "byteOffset" : 4788
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 4824
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 5112
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 192,
+ "byteOffset" : 5400
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 36,
+ "byteOffset" : 5592
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 5628
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 5916
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 192,
+ "byteOffset" : 6204
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 36,
+ "byteOffset" : 6396
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 6432
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 288,
+ "byteOffset" : 6720
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 192,
+ "byteOffset" : 7008
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 36,
+ "byteOffset" : 7200
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 48,
+ "byteOffset" : 7236
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 48,
+ "byteOffset" : 7284
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 32,
+ "byteOffset" : 7332
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 6,
+ "byteOffset" : 7364
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 20,
+ "byteOffset" : 7372
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 60,
+ "byteOffset" : 7392
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 20,
+ "byteOffset" : 7452
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 180,
+ "byteOffset" : 7472
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 20,
+ "byteOffset" : 7652
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 180,
+ "byteOffset" : 7672
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 20,
+ "byteOffset" : 7852
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 80,
+ "byteOffset" : 7872
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 20,
+ "byteOffset" : 7952
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 240,
+ "byteOffset" : 7972
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 20,
+ "byteOffset" : 8212
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 80,
+ "byteOffset" : 8232
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 20,
+ "byteOffset" : 8312
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 60,
+ "byteOffset" : 8332
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 20,
+ "byteOffset" : 8392
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 180,
+ "byteOffset" : 8412
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 20,
+ "byteOffset" : 8592
+ },
+ {
+ "buffer" : 0,
+ "byteLength" : 60,
+ "byteOffset" : 8612
+ }
+ ],
+ "buffers" : [
+ {
+ "byteLength" : 8672,
+ "uri" : "interpolation.bin"
+ }
+ ],
+ "extensions" : {},
+ "images" : [
+ {
+ "mimeType" : "image/jpeg",
+ "name" : "l.jpg",
+ "uri" : "l.jpg"
+ }
+ ],
+ "materials" : [
+ {
+ "name" : "Material",
+ "pbrMetallicRoughness" : {
+ "baseColorFactor" : [
+ 0.800000011920929,
+ 0.800000011920929,
+ 0.800000011920929,
+ 1
+ ],
+ "metallicFactor" : 0,
+ "roughnessFactor" : 0.5
+ }
+ },
+ {
+ "name" : "Material.001",
+ "pbrMetallicRoughness" : {
+ "baseColorFactor" : [
+ 0.800000011920929,
+ 0.800000011920929,
+ 0.800000011920929,
+ 1
+ ],
+ "metallicFactor" : 0,
+ "roughnessFactor" : 0.5
+ }
+ },
+ {
+ "name" : "Material.002",
+ "pbrMetallicRoughness" : {
+ "baseColorFactor" : [
+ 0.800000011920929,
+ 0.800000011920929,
+ 0.800000011920929,
+ 1
+ ],
+ "metallicFactor" : 0,
+ "roughnessFactor" : 0.5
+ }
+ },
+ {
+ "name" : "Material.007",
+ "pbrMetallicRoughness" : {
+ "baseColorFactor" : [
+ 0.800000011920929,
+ 0.800000011920929,
+ 0.800000011920929,
+ 1
+ ],
+ "metallicFactor" : 0,
+ "roughnessFactor" : 0.5
+ }
+ },
+ {
+ "name" : "Material.006",
+ "pbrMetallicRoughness" : {
+ "baseColorFactor" : [
+ 0.800000011920929,
+ 0.800000011920929,
+ 0.800000011920929,
+ 1
+ ],
+ "metallicFactor" : 0,
+ "roughnessFactor" : 0.5
+ }
+ },
+ {
+ "name" : "Material.008",
+ "pbrMetallicRoughness" : {
+ "baseColorFactor" : [
+ 0.800000011920929,
+ 0.800000011920929,
+ 0.800000011920929,
+ 1
+ ],
+ "metallicFactor" : 0,
+ "roughnessFactor" : 0.5
+ }
+ },
+ {
+ "name" : "Material.004",
+ "pbrMetallicRoughness" : {
+ "baseColorFactor" : [
+ 0.800000011920929,
+ 0.800000011920929,
+ 0.800000011920929,
+ 1
+ ],
+ "metallicFactor" : 0,
+ "roughnessFactor" : 0.5
+ }
+ },
+ {
+ "name" : "Material.005",
+ "pbrMetallicRoughness" : {
+ "baseColorFactor" : [
+ 0.800000011920929,
+ 0.800000011920929,
+ 0.800000011920929,
+ 1
+ ],
+ "metallicFactor" : 0,
+ "roughnessFactor" : 0.5
+ }
+ },
+ {
+ "name" : "Material.003",
+ "pbrMetallicRoughness" : {
+ "baseColorFactor" : [
+ 0.800000011920929,
+ 0.800000011920929,
+ 0.800000011920929,
+ 1
+ ],
+ "metallicFactor" : 0,
+ "roughnessFactor" : 0.5
+ }
+ },
+ {
+ "name" : "Material.009",
+ "pbrMetallicRoughness" : {
+ "baseColorTexture" : {
+ "index" : 0,
+ "texCoord" : 0
+ },
+ "metallicFactor" : 0,
+ "roughnessFactor" : 0.5
+ }
+ }
+ ],
+ "meshes" : [
+ {
+ "name" : "Cube",
+ "primitives" : [
+ {
+ "attributes" : {
+ "NORMAL" : 1,
+ "POSITION" : 0,
+ "TEXCOORD_0" : 2
+ },
+ "material" : 0
+ }
+ ]
+ },
+ {
+ "name" : "Cube.001",
+ "primitives" : [
+ {
+ "attributes" : {
+ "NORMAL" : 5,
+ "POSITION" : 4,
+ "TEXCOORD_0" : 6
+ },
+ "material" : 1
+ }
+ ]
+ },
+ {
+ "name" : "Cube.002",
+ "primitives" : [
+ {
+ "attributes" : {
+ "NORMAL" : 9,
+ "POSITION" : 8,
+ "TEXCOORD_0" : 10
+ },
+ "material" : 2
+ }
+ ]
+ },
+ {
+ "name" : "Cube.003",
+ "primitives" : [
+ {
+ "attributes" : {
+ "NORMAL" : 13,
+ "POSITION" : 12,
+ "TEXCOORD_0" : 14
+ },
+ "material" : 3
+ }
+ ]
+ },
+ {
+ "name" : "Cube.004",
+ "primitives" : [
+ {
+ "attributes" : {
+ "NORMAL" : 17,
+ "POSITION" : 16,
+ "TEXCOORD_0" : 18
+ },
+ "material" : 4
+ }
+ ]
+ },
+ {
+ "name" : "Cube.005",
+ "primitives" : [
+ {
+ "attributes" : {
+ "NORMAL" : 21,
+ "POSITION" : 20,
+ "TEXCOORD_0" : 22
+ },
+ "material" : 5
+ }
+ ]
+ },
+ {
+ "name" : "Cube.006",
+ "primitives" : [
+ {
+ "attributes" : {
+ "NORMAL" : 25,
+ "POSITION" : 24,
+ "TEXCOORD_0" : 26
+ },
+ "material" : 6
+ }
+ ]
+ },
+ {
+ "name" : "Cube.008",
+ "primitives" : [
+ {
+ "attributes" : {
+ "NORMAL" : 29,
+ "POSITION" : 28,
+ "TEXCOORD_0" : 30
+ },
+ "material" : 7
+ }
+ ]
+ },
+ {
+ "name" : "Cube.009",
+ "primitives" : [
+ {
+ "attributes" : {
+ "NORMAL" : 33,
+ "POSITION" : 32,
+ "TEXCOORD_0" : 34
+ },
+ "material" : 8
+ }
+ ]
+ },
+ {
+ "name" : "Plane.001",
+ "primitives" : [
+ {
+ "attributes" : {
+ "NORMAL" : 37,
+ "POSITION" : 36,
+ "TEXCOORD_0" : 38
+ },
+ "material" : 9
+ }
+ ]
+ }
+ ],
+ "nodes" : [
+ {
+ "name" : "Cube"
+ },
+ {
+ "name" : "Light",
+ "rotation" : [
+ 0.16907575726509094,
+ 0.7558802962303162,
+ -0.27217137813568115,
+ 0.570947527885437
+ ],
+ "scale" : [
+ 1,
+ 1,
+ 0.9999999403953552
+ ],
+ "translation" : [
+ 0.18540644645690918,
+ 5.903861999511719,
+ 8.732584953308105
+ ]
+ },
+ {
+ "name" : "Camera",
+ "rotation" : [
+ 0.6819981932640076,
+ 0,
+ 0,
+ 0.7313538193702698
+ ],
+ "scale" : [
+ 1,
+ 0.39365354180336,
+ 1
+ ],
+ "translation" : [
+ 0.31374117732048035,
+ 4.958309173583984,
+ 29.236623764038086
+ ]
+ },
+ {
+ "name" : "Cube.001",
+ "translation" : [
+ -3.2963297367095947,
+ 0,
+ 6.461143493652344e-05
+ ]
+ },
+ {
+ "name" : "Cube.002",
+ "translation" : [
+ 3.3401193618774414,
+ 0,
+ 0.008944988250732422
+ ]
+ },
+ {
+ "name" : "Cube.003",
+ "translation" : [
+ 0,
+ 3.356412410736084,
+ 0
+ ]
+ },
+ {
+ "name" : "Cube.004",
+ "rotation" : [
+ 0,
+ 0,
+ -0.006683696992695332,
+ 0.9999777674674988
+ ],
+ "translation" : [
+ 3.33506178855896,
+ 3.356412410736084,
+ 0
+ ]
+ },
+ {
+ "name" : "Cube.005",
+ "rotation" : [
+ 0,
+ 0,
+ -0.03925982117652893,
+ 0.9992290735244751
+ ],
+ "scale" : [
+ 0.9999999403953552,
+ 0.9999999403953552,
+ 1
+ ],
+ "translation" : [
+ -3.311399221420288,
+ 3.356412410736084,
+ 0
+ ]
+ },
+ {
+ "name" : "Cube.006",
+ "translation" : [
+ 0,
+ 6.665226459503174,
+ 0
+ ]
+ },
+ {
+ "name" : "Cube.008",
+ "translation" : [
+ 3.3051798343658447,
+ 6.734194278717041,
+ 0
+ ]
+ },
+ {
+ "name" : "Cube.009",
+ "translation" : [
+ -3.2975807189941406,
+ 6.958913326263428,
+ 0
+ ]
+ },
+ {
+ "name" : "Plane",
+ "rotation" : [
+ 0.7071068286895752,
+ 0,
+ 0,
+ 0.7071068286895752
+ ],
+ "scale" : [
+ 4.218648433685303,
+ 1,
+ 0.3652837574481964
+ ],
+ "translation" : [
+ 0,
+ -1.7941787242889404,
+ 1.0036747455596924
+ ]
+ }
+ ],
+ "scene" : 0,
+ "scenes" : [
+ {
+ "name" : "Scene",
+ "nodes" : [
+ 0,
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11
+ ]
+ }
+ ],
+ "textures" : [
+ {
+ "source" : 0
+ }
+ ]
+}
--- /dev/null
+{
+ "asset": { "version": "1.0" },
+ "scene": 0,
+ "scenes": [ { "nodes": [ 0 ] } ],
+ "nodes": [
+ {
+ "name": "Scene",
+ "matrix": [ 1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1 ],
+ "children": [ 1, 2 ]
+ },
+ {
+ "name": "Cube",
+ "matrix": [ 2.5, 0, 0, 0, 0, 2.5, 0, 0, 0, 0, 2.5, 0, 0, 0, 0, 1 ],
+ "model": {
+ "mesh": 0,
+ "material": 0,
+ "shader": 0
+ }
+ },
+ {
+ "name": "bottle",
+ "matrix": [ 0.125, 0, 0, 0, 0, -0, 0.125, 0, 0, -0.125, -0, 0, -0, 0, -1.5, 1 ],
+ "children": [ 3, 4, 5, 6 ]
+ },
+ {
+ "name": "bottle-cap",
+ "model": {
+ "mesh": 3,
+ "material": 2,
+ "shader": 1
+ }
+ },
+ {
+ "name": "bottle-alpha-front",
+ "model": {
+ "mesh": 1,
+ "material": 1,
+ "shader": 2
+ }
+ },
+ {
+ "name": "bottle-alpha-back",
+ "model": {
+ "mesh": 1,
+ "material": 1,
+ "shader": 3
+ }
+ },
+ {
+ "name": "bottle-label",
+ "model": {
+ "mesh": 2,
+ "material": 0,
+ "shader": 4
+ }
+ }
+ ],
+ "meshes": [
+ {
+ "uri": "cube.bin",
+ "attributes": 31,
+ "primitive": "TRIANGLES",
+ "indices": { "byteOffset": 0, "byteLength": 72 },
+ "positions": { "byteOffset": 72, "byteLength": 288 },
+ "normals": { "byteOffset": 360, "byteLength": 288 },
+ "textures": { "byteOffset": 648, "byteLength": 192 },
+ "tangents": { "byteOffset": 840, "byteLength": 288 }
+ },
+ {
+ "uri": "beer.bin",
+ "attributes": 31,
+ "primitive": "TRIANGLES",
+ "indices": { "byteOffset": 0, "byteLength": 19920 },
+ "positions": { "byteOffset": 19920, "byteLength": 54792 },
+ "normals": { "byteOffset": 74712, "byteLength": 54792 },
+ "textures": { "byteOffset": 129504, "byteLength": 36528 },
+ "tangents": { "byteOffset": 166032, "byteLength": 54792 }
+ },
+ {
+ "uri": "beer.bin",
+ "attributes": 31,
+ "primitive": "TRIANGLES",
+ "indices": { "byteOffset": 220824, "byteLength": 13200 },
+ "positions": { "byteOffset": 234024, "byteLength": 14628 },
+ "normals": { "byteOffset": 248652, "byteLength": 14628 },
+ "textures": { "byteOffset": 263280, "byteLength": 9752 },
+ "tangents": { "byteOffset": 273032, "byteLength": 14628 }
+ },
+ {
+ "uri": "beer.bin",
+ "attributes": 31,
+ "primitive": "TRIANGLES",
+ "indices": { "byteOffset": 287660, "byteLength": 31440 },
+ "positions": { "byteOffset": 319100, "byteLength": 121032 },
+ "normals": { "byteOffset": 440132, "byteLength": 121032 },
+ "textures": { "byteOffset": 561164, "byteLength": 80688 },
+ "tangents": { "byteOffset": 641852, "byteLength": 121032 }
+ }
+ ],
+ "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 ]
+ }
+ ],
+ "lights": [
+ ],
+ "materials": [
+ {
+ "color": [ 1.0, 0.95, 0.5 ],
+ "metallic": 0.25,
+ "roughness": 1.0,
+ "environment": 1
+ },
+ {
+ "color": [ 0.1, 0.4, 0.0, 0.6 ],
+ "metallic": 0.4,
+ "roughness": 0.0,
+ "environment": 1
+ },
+ {
+ "color": [ 0.5, 0.5, 0.5 ],
+ "metallic": 1.0,
+ "roughness": 0.0,
+ "environment": 1
+ }
+ ],
+ "environment": [
+ {
+ },
+ {
+ "cubeSpecular": "Studio/Radiance.ktx",
+ "cubeDiffuse": "Studio/Irradiance.ktx",
+ "iblIntensity": 0.75
+ }
+ ],
+ "shaders": [
+ {
+ "vertex": "dli_pbr.vsh",
+ "fragment": "dli_pbr.fsh",
+ "rendererState": "DEPTH_TEST|CULL_FRONT",
+ "uCubeMatrix": [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ],
+ "uMaxLOD": 6
+ },
+ {
+ "vertex": "dli_pbr.vsh",
+ "fragment": "dli_pbr.fsh",
+ "rendererState": "DEPTH_TEST|DEPTH_WRITE",
+ "uCubeMatrix": [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ],
+ "uMaxLOD": 6
+ },
+ {
+ "vertex": "dli_pbr.vsh",
+ "fragment": "dli_pbr.fsh",
+ "defines": [ "THREE_TEX" ],
+ "rendererState": "ALPHA_BLEND|DEPTH_TEST|CULL_FRONT",
+ "uCubeMatrix": [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ],
+ "uMaxLOD": 6
+ },
+ {
+ "vertex": "dli_pbr.vsh",
+ "fragment": "dli_pbr.fsh",
+ "defines": [ "THREE_TEX" ],
+ "rendererState": "ALPHA_BLEND|DEPTH_TEST|CULL_BACK",
+ "uCubeMatrix": [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ],
+ "uMaxLOD": 6
+ },
+ {
+ "vertex": "dli_pbr.vsh",
+ "fragment": "dli_pbr.fsh",
+ "defines": [ "FLIP_V" ],
+ "rendererState": "DEPTH_TEST|DEPTH_WRITE|CULL_BACK",
+ "uCubeMatrix": [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ],
+ "uMaxLOD": 6
+ }
+ ]
+}
--- /dev/null
+HIERARCHY
+ROOT root
+{
+ OFFSET 0.0 -0.948831 1.32574
+ CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation
+ JOINT first
+ {
+ OFFSET -0.0 4.130377 -0.008512
+ CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation
+ End Site
+ {
+ OFFSET 0 0 0
+ }
+ }
+}
+MOTION
+Frames: 2
+Frame Time: 0.3
+0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
+0.0 10.0 0.0 0.0 0.0 0.0 10.0 0.0 0.0 90.0 0.0 0.0
\ No newline at end of file
-SET(PKG_NAME "dali-scene-loader-internal")
+SET(PKG_NAME "dali-scene3d-internal")
SET(EXEC_NAME "tct-${PKG_NAME}-core")
SET(RPM_NAME "core-${PKG_NAME}-tests")
-SET(CAPI_LIB "dali-scene-loader")
+SET(CAPI_LIB "dali-scene3d")
# List of test case sources (Only these get parsed for test cases)
SET(TC_SOURCES
dali2-core
dali2-adaptor
dali2-toolkit
- dali2-scene-loader
+ dali2-scene3d
)
ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror -DDEBUG_ENABLED)
#include <test-harness.h>
-#include "tct-dali-scene-loader-internal-core.h"
+#include "tct-dali-scene3d-internal-core.h"
int main(int argc, char * const argv[])
{
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/internal/gltf2-asset.h"
+#include "dali-scene3d/internal/loader/gltf2-asset.h"
#include <dali-test-suite-utils.h>
#include <string>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliGltf2AssetComponentIsUnsigned(void)
{
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/internal/hash.h"
+#include "dali-scene3d/internal/loader/hash.h"
#include <dali-test-suite-utils.h>
#include <string>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliHash(void)
{
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/internal/json-reader.h"
+#include "dali-scene3d/internal/loader/json-reader.h"
#include <dali-test-suite-utils.h>
#include <string>
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/internal/json-util.h"
+#include "dali-scene3d/internal/loader/json-util.h"
#include "dali-toolkit/devel-api/builder/json-parser.h"
#include <dali-test-suite-utils.h>
#include <string>
using namespace Dali;
using namespace Dali::Toolkit;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
namespace
{
-SET(PKG_NAME "dali-scene-loader")
+SET(PKG_NAME "dali-scene3d")
SET(EXEC_NAME "tct-${PKG_NAME}-core")
SET(RPM_NAME "core-${PKG_NAME}-tests")
-SET(CAPI_LIB "dali-scene-loader")
+SET(CAPI_LIB "dali-scene3d")
# List of test case sources (Only these get parsed for test cases)
SET(TC_SOURCES
utc-Dali-AlphaFunctionHelper.cpp
utc-Dali-AnimationDefinition.cpp
utc-Dali-AnimatedProperty.cpp
+ utc-Dali-BvhLoader.cpp
utc-Dali-CameraParameters.cpp
+ utc-Dali-CubeLoader.cpp
+ utc-Dali-CubeMapLoader.cpp
utc-Dali-DliLoader.cpp
utc-Dali-EnvironmentDefinition.cpp
utc-Dali-FacialAnimation.cpp
utc-Dali-Gltf2Loader.cpp
utc-Dali-KtxLoader.cpp
+ utc-Dali-ModelView.cpp
utc-Dali-MatrixStack.cpp
utc-Dali-MeshDefinition.cpp
utc-Dali-NodeDefinition.cpp
dali2-core
dali2-adaptor
dali2-toolkit
- dali2-scene-loader
+ dali2-scene3d
)
ADD_COMPILE_OPTIONS( -O0 -ggdb --coverage -Wall -Werror -DDEBUG_ENABLED)
#include <test-harness.h>
-#include "tct-dali-scene-loader-core.h"
+#include "tct-dali-scene3d-core.h"
int main(int argc, char * const argv[])
{
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/alpha-function-helper.h"
+#include "dali-scene3d/public-api/loader/alpha-function-helper.h"
#include <dali-test-suite-utils.h>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
#define ALPHA_FN_PAIR(x) { #x, AlphaFunction::x }
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/animated-property.h"
+#include "dali-scene3d/public-api/loader/animated-property.h"
#include <dali-test-suite-utils.h>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliAnimatedPropertyGetPropertyType(void)
{
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/animation-definition.h"
+#include "dali-scene3d/public-api/loader/animation-definition.h"
#include <dali-test-suite-utils.h>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliAnimationDefinitionStopForModification(void)
{
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali-test-suite-utils.h>
+#include <dali-scene3d/public-api/loader/bvh-loader.h>
+
+using namespace Dali;
+using namespace Dali::Scene3D::Loader;
+
+int UtcDaliLoadBvh(void)
+{
+ TestApplication application;
+
+ AnimationDefinition animDef = LoadBvh(TEST_RESOURCE_DIR "/test.bvh", "testBvh");
+
+ DALI_TEST_EQUAL(animDef.mName, "testBvh");
+ DALI_TEST_EQUAL(animDef.mDuration, 0.3f);
+
+ DALI_TEST_EQUAL(animDef.mProperties[0].mNodeName, "root");
+ DALI_TEST_EQUAL(animDef.mProperties[0].mPropertyName, "position");
+ DALI_TEST_EQUAL(animDef.mProperties[0].mKeyFrames.GetType(), Property::Type::VECTOR3);
+ DALI_TEST_EQUAL(animDef.mProperties[0].mTimePeriod.durationSeconds, 0.3f);
+
+ DALI_TEST_EQUAL(animDef.mProperties[1].mNodeName, "root");
+ DALI_TEST_EQUAL(animDef.mProperties[1].mPropertyName, "orientation");
+ DALI_TEST_EQUAL(animDef.mProperties[1].mKeyFrames.GetType(), Property::Type::ROTATION);
+ DALI_TEST_EQUAL(animDef.mProperties[1].mTimePeriod.durationSeconds, 0.3f);
+
+ DALI_TEST_EQUAL(animDef.mProperties[2].mNodeName, "first");
+ DALI_TEST_EQUAL(animDef.mProperties[2].mPropertyName, "position");
+ DALI_TEST_EQUAL(animDef.mProperties[2].mKeyFrames.GetType(), Property::Type::VECTOR3);
+ DALI_TEST_EQUAL(animDef.mProperties[2].mTimePeriod.durationSeconds, 0.3f);
+
+ DALI_TEST_EQUAL(animDef.mProperties[3].mNodeName, "first");
+ DALI_TEST_EQUAL(animDef.mProperties[3].mPropertyName, "orientation");
+ DALI_TEST_EQUAL(animDef.mProperties[3].mKeyFrames.GetType(), Property::Type::ROTATION);
+ DALI_TEST_EQUAL(animDef.mProperties[3].mTimePeriod.durationSeconds, 0.3f);
+
+ Actor root = Actor::New();
+ root.SetProperty(Actor::Property::NAME, "root");
+
+ Actor first = Actor::New();
+ first.SetProperty(Actor::Property::NAME, "first");
+ root.Add(first);
+
+ auto getActor = [&root](const std::string& name) {
+ return root.FindChildByName(name);
+ };
+
+ Animation animation = animDef.ReAnimate(getActor);
+ DALI_TEST_EQUAL(animation.GetDuration(), animDef.mDuration);
+
+ application.GetScene().Add(root);
+
+ application.SendNotification();
+ application.Render(20);
+
+ DALI_TEST_EQUALS(Vector2(0, 0), root.GetProperty<Vector2>(Actor::Property::POSITION), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(0, 0), first.GetProperty<Vector2>(Actor::Property::POSITION), TEST_LOCATION);
+ Vector3 rootWorldPositionBefore = root.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
+ Vector3 firstWorldPositionBefore = first.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
+
+ animation.Play();
+
+ application.SendNotification();
+ application.Render(1000);
+
+ DALI_TEST_EQUALS(Vector2(0, 10), root.GetProperty<Vector2>(Actor::Property::POSITION), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(10, 0), first.GetProperty<Vector2>(Actor::Property::POSITION), TEST_LOCATION);
+
+ Vector3 rootWorldPositionAfter = root.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
+ Vector3 firstWorldPositionAfter = first.GetProperty<Vector3>(Actor::Property::WORLD_POSITION);
+
+ DALI_TEST_EQUALS(Vector3(0, 10, 0), rootWorldPositionAfter - rootWorldPositionBefore, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(10, 10, 0), firstWorldPositionAfter - firstWorldPositionBefore, TEST_LOCATION);
+
+ END_TEST;
+}
+
+
+
+int UtcDaliLoadBvhFailed(void)
+{
+ TestApplication application;
+
+ AnimationDefinition animDef = LoadBvh("/nothing.bvh", "testBvh");
+ DALI_TEST_EQUALS(0u, animDef.mProperties.size(), TEST_LOCATION);
+ END_TEST;
+}
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/camera-parameters.h"
+#include "dali-scene3d/public-api/loader/camera-parameters.h"
#include <dali-test-suite-utils.h>
#include <string_view>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliCameraParameters(void)
{
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// Enable debug log for test coverage
+#define DEBUG_ENABLED 1
+
+#include "dali-scene3d/public-api/loader/cube-loader.h"
+#include <dali-test-suite-utils.h>
+#include <string_view>
+
+#include <fstream>
+
+using namespace Dali;
+using namespace Dali::Scene3D::Loader;
+
+int UtcDaliCubeLoaderFailNonexistent(void)
+{
+ CubeData data;
+ DALI_TEST_CHECK(!LoadCubeData("non-existent.jpg", data));
+ END_TEST;
+}
+
+int UtcDaliCubeLoaderFailInvalid1(void)
+{
+ CubeData data;
+ DALI_TEST_CHECK(!LoadCubeData(TEST_RESOURCE_DIR "/gallery-small-1.jpg", data)); // Wrong sized image
+ END_TEST;
+}
+
+int UtcDaliCubeLoaderSuccess01(void)
+{
+ CubeData cubeData;
+ auto path = TEST_RESOURCE_DIR "/forest_diffuse_cubemap.png"; // cross horizontal
+ DALI_TEST_CHECK(LoadCubeData(path, cubeData));
+
+ DALI_TEST_EQUAL(6u, cubeData.data.size());
+ for (auto& face: cubeData.data)
+ {
+ uint32_t size = 512;
+ DALI_TEST_EQUAL(size, face[0].GetWidth());
+ DALI_TEST_EQUAL(size, face[0].GetHeight());
+ DALI_TEST_EQUAL(Pixel::Format::RGBA8888, face[0].GetPixelFormat());
+ }
+
+ END_TEST;
+}
+
+int UtcDaliCubeLoaderSuccess02(void)
+{
+ CubeData cubeData;
+ auto path = TEST_RESOURCE_DIR "/forest_diffuse_cubemap_cross_vertical.png"; // cross vertical
+ DALI_TEST_CHECK(LoadCubeData(path, cubeData));
+
+ DALI_TEST_EQUAL(6u, cubeData.data.size());
+ for (auto& face: cubeData.data)
+ {
+ uint32_t size = 256;
+ DALI_TEST_EQUAL(size, face[0].GetWidth());
+ DALI_TEST_EQUAL(size, face[0].GetHeight());
+ DALI_TEST_EQUAL(Pixel::Format::RGBA8888, face[0].GetPixelFormat());
+ }
+
+ END_TEST;
+}
+
+int UtcDaliCubeLoaderSuccess03(void)
+{
+ CubeData cubeData;
+ auto path = TEST_RESOURCE_DIR "/cubemap_array_horizontal.png"; // array horizontal
+ DALI_TEST_CHECK(LoadCubeData(path, cubeData));
+
+ DALI_TEST_EQUAL(6u, cubeData.data.size());
+ for (auto& face: cubeData.data)
+ {
+ uint32_t size = 100;
+ DALI_TEST_EQUAL(size, face[0].GetWidth());
+ DALI_TEST_EQUAL(size, face[0].GetHeight());
+ DALI_TEST_EQUAL(Pixel::Format::RGB888, face[0].GetPixelFormat());
+ }
+
+ END_TEST;
+}
+
+int UtcDaliCubeLoaderSuccess04(void)
+{
+ CubeData cubeData;
+ auto path = TEST_RESOURCE_DIR "/cubemap_array_vertical.png"; // array horizontal
+ DALI_TEST_CHECK(LoadCubeData(path, cubeData));
+
+ DALI_TEST_EQUAL(6u, cubeData.data.size());
+ for (auto& face: cubeData.data)
+ {
+ uint32_t size = 100;
+ DALI_TEST_EQUAL(size, face[0].GetWidth());
+ DALI_TEST_EQUAL(size, face[0].GetHeight());
+ DALI_TEST_EQUAL(Pixel::Format::RGB888, face[0].GetPixelFormat());
+ }
+
+ END_TEST;
+}
+
+int UtcDaliCubeLoaderCubeDataCreateTexture(void)
+{
+ CubeData cubeData;
+ auto path = TEST_RESOURCE_DIR "/forest_diffuse_cubemap.png";
+ DALI_TEST_CHECK(LoadCubeData(path, cubeData));
+
+ TestApplication app;
+ auto texture = cubeData.CreateTexture();
+
+ DALI_TEST_CHECK(texture);
+ DALI_TEST_EQUAL(512u, texture.GetWidth());
+ DALI_TEST_EQUAL(512u, texture.GetHeight());
+
+ END_TEST;
+}
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// Enable debug log for test coverage
+#define DEBUG_ENABLED 1
+
+#include "dali-scene3d/public-api/loader/cube-map-loader.h"
+#include <dali-test-suite-utils.h>
+#include <string_view>
+
+#include <fstream>
+
+using namespace Dali;
+using namespace Dali::Scene3D::Loader;
+
+int UtcDaliCubeMapLoaderFailNonexistent(void)
+{
+ CubeData data;
+ DALI_TEST_CHECK(!LoadCubeMapData("non-existent.jpg", data));
+ END_TEST;
+}
+
+int UtcDaliCubeMapLoaderFailInvalid1(void)
+{
+ CubeData data;
+ DALI_TEST_CHECK(!LoadCubeMapData(TEST_RESOURCE_DIR "/gallery-small-1.jpg", data)); // Wrong sized image
+ END_TEST;
+}
+
+int UtcDaliCubeMapLoaderSuccess01(void)
+{
+ CubeData cubeData;
+ auto path = TEST_RESOURCE_DIR "/forest_radiance.ktx";
+ DALI_TEST_CHECK(LoadCubeMapData(path, cubeData));
+
+ DALI_TEST_EQUAL(6u, cubeData.data.size());
+ for (auto& face: cubeData.data)
+ {
+ uint32_t size = 64;
+ for (auto& mipData: face)
+ {
+ DALI_TEST_EQUAL(size, mipData.GetWidth());
+ DALI_TEST_EQUAL(size, mipData.GetHeight());
+ DALI_TEST_EQUAL(Pixel::Format::RGB888, mipData.GetPixelFormat());
+ size /= 2;
+ }
+ }
+
+ END_TEST;
+}
+
+int UtcDaliCubeMapLoaderSuccess02(void)
+{
+ CubeData cubeData;
+ auto path = TEST_RESOURCE_DIR "/forest_diffuse_cubemap.png"; // cross horizontal
+ DALI_TEST_CHECK(LoadCubeMapData(path, cubeData));
+
+ DALI_TEST_EQUAL(6u, cubeData.data.size());
+ for (auto& face: cubeData.data)
+ {
+ uint32_t size = 512;
+ DALI_TEST_EQUAL(size, face[0].GetWidth());
+ DALI_TEST_EQUAL(size, face[0].GetHeight());
+ DALI_TEST_EQUAL(Pixel::Format::RGBA8888, face[0].GetPixelFormat());
+ }
+
+ END_TEST;
+}
+
+int UtcDaliCubeMapLoaderCubeDataCreateTexture01(void)
+{
+ CubeData cubeData;
+ auto path = TEST_RESOURCE_DIR "/forest_radiance.ktx";
+ DALI_TEST_CHECK(LoadCubeMapData(path, cubeData));
+
+ TestApplication app;
+ auto texture = cubeData.CreateTexture();
+
+ DALI_TEST_CHECK(texture);
+ DALI_TEST_EQUAL(64u, texture.GetWidth());
+ DALI_TEST_EQUAL(64u, texture.GetHeight());
+
+ END_TEST;
+}
+
+int UtcDaliCubeMapLoaderCubeDataCreateTexture02(void)
+{
+ CubeData cubeData;
+ auto path = TEST_RESOURCE_DIR "/forest_diffuse_cubemap.png";
+ DALI_TEST_CHECK(LoadCubeMapData(path, cubeData));
+
+ TestApplication app;
+ auto texture = cubeData.CreateTexture();
+
+ DALI_TEST_CHECK(texture);
+ DALI_TEST_EQUAL(512u, texture.GetWidth());
+ DALI_TEST_EQUAL(512u, texture.GetHeight());
+
+ END_TEST;
+}
#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-scene3d/internal/loader/json-util.h"
+#include "dali-scene3d/public-api/loader/dli-loader.h"
+#include "dali-scene3d/public-api/loader/load-result.h"
+#include "dali-scene3d/public-api/loader/resource-bundle.h"
+#include "dali-scene3d/public-api/loader/scene-definition.h"
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
namespace
{
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/environment-definition.h"
+#include "dali-scene3d/public-api/loader/environment-definition.h"
#include <dali-test-suite-utils.h>
#include <string_view>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliEnvironmentDefinitionLoadRawDefault(void)
{
*/
#include <dali-test-suite-utils.h>
-#include <dali-scene-loader/public-api/animation-definition.h>
-#include <dali-scene-loader/public-api/facial-animation-loader.h>
+#include <dali-scene3d/public-api/loader/animation-definition.h>
+#include <dali-scene3d/public-api/loader/facial-animation-loader.h>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliLoadFacialAnimation(void)
{
#include <dali-test-suite-utils.h>
#include <string_view>
-#include "dali-scene-loader/public-api/gltf2-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/shader-definition-factory.h"
+#include "dali-scene3d/public-api/loader/gltf2-loader.h"
+#include "dali-scene3d/public-api/loader/load-result.h"
+#include "dali-scene3d/public-api/loader/resource-bundle.h"
+#include "dali-scene3d/public-api/loader/scene-definition.h"
+#include "dali-scene3d/public-api/loader/shader-definition-factory.h"
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
#define DALI_TEST_THROW(expression, exception, predicate) \
{ \
/*
- * 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.
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/ktx-loader.h"
+#include "dali-scene3d/public-api/loader/ktx-loader.h"
#include <dali-test-suite-utils.h>
#include <string_view>
#include <fstream>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliKtxLoaderFailNonexistent(void)
{
CubeData data;
- DALI_TEST_CHECK(!LoadCubeMapData("non-existent.ktx", data));
+ DALI_TEST_CHECK(!LoadKtxData("non-existent.ktx", data));
END_TEST;
}
int UtcDaliKtxLoaderFailInvalid1(void)
{
CubeData data;
- DALI_TEST_CHECK(!LoadCubeMapData(TEST_RESOURCE_DIR "/invalid.svg", data)); // file smaller than KTX header
+ DALI_TEST_CHECK(!LoadKtxData(TEST_RESOURCE_DIR "/invalid.svg", data)); // file smaller than KTX header
END_TEST;
}
int UtcDaliKtxLoaderFailInvalid2(void)
{
CubeData data;
- DALI_TEST_CHECK(!LoadCubeMapData(TEST_RESOURCE_DIR "/anim.gif", data)); // not a KTX
+ DALI_TEST_CHECK(!LoadKtxData(TEST_RESOURCE_DIR "/anim.gif", data)); // not a KTX
END_TEST;
}
int UtcDaliKtxLoaderFailTruncated(void)
{
CubeData data;
- DALI_TEST_CHECK(!LoadCubeMapData(TEST_RESOURCE_DIR "/truncated.ktx", data));
+ DALI_TEST_CHECK(!LoadKtxData(TEST_RESOURCE_DIR "/truncated.ktx", data));
END_TEST;
}
{
CubeData cubeData;
auto path = TEST_RESOURCE_DIR "/forest_radiance.ktx";
- DALI_TEST_CHECK(LoadCubeMapData(path, cubeData));
+ DALI_TEST_CHECK(LoadKtxData(path, cubeData));
DALI_TEST_EQUAL(6u, cubeData.data.size());
for (auto& face: cubeData.data)
for (auto i : pathFormats)
{
CubeData cubeData;
- DALI_TEST_CHECK(LoadCubeMapData(resPath + i.first + ".ktx", cubeData));
+ DALI_TEST_CHECK(LoadKtxData(resPath + i.first + ".ktx", cubeData));
DALI_TEST_EQUAL(cubeData.data[0][0].GetPixelFormat(), i.second);
}
{
CubeData cubeData;
auto path = TEST_RESOURCE_DIR "/forest_radiance.ktx";
- DALI_TEST_CHECK(LoadCubeMapData(path, cubeData));
+ DALI_TEST_CHECK(LoadKtxData(path, cubeData));
TestApplication app;
auto texture = cubeData.CreateTexture();
{
CubeData cubeData;
auto path = TEST_RESOURCE_DIR "/papermill_E_diffuse-64.ktx";
- DALI_TEST_CHECK(LoadCubeMapData(path, cubeData));
+ DALI_TEST_CHECK(LoadKtxData(path, cubeData));
TestApplication app;
auto texture = cubeData.CreateTexture();
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/matrix-stack.h"
+#include "dali-scene3d/public-api/loader/matrix-stack.h"
#include <dali-test-suite-utils.h>
#include <string_view>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliMatrixStack(void)
{
/*
- * 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.
#include <vector>
-#include "dali-scene-loader/public-api/mesh-definition.h"
+#include "dali-scene3d/public-api/loader/mesh-definition.h"
#include <dali-test-suite-utils.h>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliMeshDefinitionBlobApplyMinMaxBothMinMaxApplied(void)
{
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <stdlib.h>
+#include <iostream>
+
+#include <dali-scene3d/public-api/controls/model-view/model-view.h>
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void model_view_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void model_view_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+/**
+ * For the AnimatedCube.gltf and its Assets
+ * Donated by Norbert Nopper for glTF testing.
+ * Take from https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/AnimatedCube
+ */
+const char* TEST_GLTF_FILE_NAME = TEST_RESOURCE_DIR "/AnimatedCube.gltf";
+const char* TEST_GLTF_TRIANGLE_FILE_NAME = TEST_RESOURCE_DIR "/AnimatedTriangle.gltf";
+const char* TEST_GLTF_ANIMATION_TEST_FILE_NAME = TEST_RESOURCE_DIR "/animationTest.gltf";
+const char* TEST_DLI_FILE_NAME = TEST_RESOURCE_DIR "/arc.dli";
+const char* TEST_DLI_BEER_FILE_NAME = TEST_RESOURCE_DIR "/beer_modelViewTest.dli";
+/**
+ * For the diffuse and specular cube map texture.
+ * These textures are based off version of Wave engine sample
+ * Take from https://github.com/WaveEngine/Samples
+ *
+ * Copyright (c) 2022 Wave Coorporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+const char* TEST_DIFFUSE_TEXTURE = TEST_RESOURCE_DIR "/forest_irradiance.ktx";
+const char* TEST_SPECULAR_TEXTURE = TEST_RESOURCE_DIR "/forest_radiance.ktx";
+} // namespace
+
+// Negative test case for a method
+int UtcDaliModelViewUninitialized(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliModelViewUninitialized");
+
+ Scene3D::ModelView view;
+
+ try
+ {
+ // New() must be called to create a ModelView or it wont be valid.
+ Actor a = Actor::New();
+ view.Add(a);
+ DALI_TEST_CHECK(false);
+ }
+ catch(Dali::DaliException& e)
+ {
+ // Tests that a negative test of an assertion succeeds
+ DALI_TEST_PRINT_ASSERT(e);
+ DALI_TEST_CHECK(!view);
+ }
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliModelViewNew(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliModelViewNew");
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+ DALI_TEST_CHECK(view);
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliModelViewDownCast(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliModelViewDownCast");
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+ BaseHandle handle(view);
+
+ Scene3D::ModelView modelView = Scene3D::ModelView::DownCast(handle);
+ DALI_TEST_CHECK(view);
+ DALI_TEST_CHECK(modelView);
+ DALI_TEST_CHECK(modelView == view);
+ END_TEST;
+}
+
+int UtcDaliModelViewTypeRegistry(void)
+{
+ ToolkitTestApplication application;
+
+ TypeRegistry typeRegistry = TypeRegistry::Get();
+ DALI_TEST_CHECK(typeRegistry);
+
+ TypeInfo typeInfo = typeRegistry.GetTypeInfo("ModelView");
+ DALI_TEST_CHECK(typeInfo);
+
+ BaseHandle handle = typeInfo.CreateInstance();
+ DALI_TEST_CHECK(handle);
+
+ Scene3D::ModelView modelView = Scene3D::ModelView::DownCast(handle);
+ DALI_TEST_CHECK(modelView);
+
+ END_TEST;
+}
+
+// Positive test case for a method
+int UtcDaliModelViewAddRemove(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliModelViewAddRemove");
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+ DALI_TEST_CHECK(view);
+
+ Actor actor = Actor::New();
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
+
+ view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ view.SetProperty(Actor::Property::SIZE, application.GetScene().GetSize());
+ view.Add(actor);
+ application.GetScene().Add(view);
+
+ DALI_TEST_CHECK(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
+
+ view.Remove(actor);
+
+ DALI_TEST_CHECK(!actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE));
+ END_TEST;
+}
+
+int UtcDaliModelViewCopyAndAssignment(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+ DALI_TEST_CHECK(view);
+
+ Scene3D::ModelView copy(view);
+ DALI_TEST_CHECK(view == copy);
+
+ Scene3D::ModelView assign;
+ DALI_TEST_CHECK(!assign);
+
+ assign = copy;
+ DALI_TEST_CHECK(assign == view);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewMoveConstructor(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+ DALI_TEST_EQUALS(1, view.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ view.SetProperty(Actor::Property::SENSITIVE, false);
+ DALI_TEST_CHECK(false == view.GetProperty<bool>(Actor::Property::SENSITIVE));
+
+ Scene3D::ModelView moved = std::move(view);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(false == moved.GetProperty<bool>(Actor::Property::SENSITIVE));
+ DALI_TEST_CHECK(!view);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewMoveAssignment(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+ DALI_TEST_EQUALS(1, view.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ view.SetProperty(Actor::Property::SENSITIVE, false);
+ DALI_TEST_CHECK(false == view.GetProperty<bool>(Actor::Property::SENSITIVE));
+
+ Scene3D::ModelView moved;
+ moved = std::move(view);
+ DALI_TEST_CHECK(moved);
+ DALI_TEST_EQUALS(1, moved.GetBaseObject().ReferenceCount(), TEST_LOCATION);
+ DALI_TEST_CHECK(false == moved.GetProperty<bool>(Actor::Property::SENSITIVE));
+ DALI_TEST_CHECK(!view);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewOnScene01(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ uint32_t modelCount = view.GetModelRoot().GetChildCount();
+ DALI_TEST_EQUALS(1, modelCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewOnScene02(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_DLI_FILE_NAME);
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ uint32_t modelCount = view.GetModelRoot().GetChildCount();
+ DALI_TEST_EQUALS(1, modelCount, TEST_LOCATION);
+
+ Actor rootActor = view.GetModelRoot();
+ Vector3 rootSize = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+ DALI_TEST_EQUALS(Vector3(2, 2, 1), rootSize, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewOnSizeSet(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ Vector2 size(200.0f, 300.0f);
+ view.SetProperty(Actor::Property::SIZE, size);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(view.GetCurrentProperty<Vector2>(Actor::Property::SIZE), size, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewGetNaturalSize(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+
+ Vector3 naturalSize = view.GetNaturalSize();
+
+ DALI_TEST_EQUALS(Vector3(2, 2, 2), naturalSize, TEST_LOCATION);
+
+ Actor root = view.GetModelRoot();
+ DALI_TEST_CHECK(root);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewSetImageBasedLightSource01(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ Actor meshActor = view.FindChildByName("AnimatedCube");
+ DALI_TEST_CHECK(meshActor);
+
+ Renderer renderer = meshActor.GetRendererAt(0u);
+ DALI_TEST_CHECK(renderer);
+
+ TextureSet textureSet = renderer.GetTextures();
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 7u, TEST_LOCATION);
+
+ Texture diffuseTexture = textureSet.GetTexture(5u);
+ Texture specularTexture = textureSet.GetTexture(6u);
+
+ view.SetImageBasedLightSource(TEST_DIFFUSE_TEXTURE, TEST_SPECULAR_TEXTURE);
+
+ Texture newDiffuseTexture = textureSet.GetTexture(5u);
+ Texture newSpecularTexture = textureSet.GetTexture(6u);
+
+ DALI_TEST_NOT_EQUALS(diffuseTexture, newDiffuseTexture, 0.0f, TEST_LOCATION);
+ DALI_TEST_NOT_EQUALS(specularTexture, newSpecularTexture, 0.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewSetImageBasedLightSource02(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ Actor meshActor = view.FindChildByName("AnimatedCube");
+ DALI_TEST_CHECK(meshActor);
+
+ Renderer renderer = meshActor.GetRendererAt(0u);
+ DALI_TEST_CHECK(renderer);
+
+ TextureSet textureSet = renderer.GetTextures();
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 7u, TEST_LOCATION);
+
+ Texture diffuseTexture = textureSet.GetTexture(5u);
+ Texture specularTexture = textureSet.GetTexture(6u);
+
+ view.SetImageBasedLightSource("", "");
+
+ Texture newDiffuseTexture = textureSet.GetTexture(5u);
+ Texture newSpecularTexture = textureSet.GetTexture(6u);
+
+ DALI_TEST_EQUALS(diffuseTexture, newDiffuseTexture, TEST_LOCATION);
+ DALI_TEST_EQUALS(specularTexture, newSpecularTexture, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewSetImageBasedLightSource03(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ Actor meshActor = view.FindChildByName("AnimatedCube");
+ DALI_TEST_CHECK(meshActor);
+
+ Renderer renderer = meshActor.GetRendererAt(0u);
+ DALI_TEST_CHECK(renderer);
+
+ TextureSet textureSet = renderer.GetTextures();
+ DALI_TEST_EQUALS(textureSet.GetTextureCount(), 7u, TEST_LOCATION);
+
+ Texture diffuseTexture = textureSet.GetTexture(5u);
+ Texture specularTexture = textureSet.GetTexture(6u);
+
+ view.SetImageBasedLightSource("dummy.ktx", "dummy.ktx");
+
+ Texture newDiffuseTexture = textureSet.GetTexture(5u);
+ Texture newSpecularTexture = textureSet.GetTexture(6u);
+
+ DALI_TEST_EQUALS(diffuseTexture, newDiffuseTexture, TEST_LOCATION);
+ DALI_TEST_EQUALS(specularTexture, newSpecularTexture, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewFitSize01(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+ view.SetProperty(Dali::Actor::Property::SIZE, Vector2(50, 50));
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ Actor rootActor = view.GetModelRoot();
+ Vector3 rootSize = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+ DALI_TEST_EQUALS(Vector3(2, 2, 2), rootSize, TEST_LOCATION);
+
+ Vector3 rootScale = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SCALE);
+ DALI_TEST_EQUALS(Vector3(1, 1, 1), rootScale, TEST_LOCATION);
+
+ view.FitSize(true);
+ rootSize = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+ DALI_TEST_EQUALS(Vector3(2, 2, 2), rootSize, TEST_LOCATION);
+
+ rootScale = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SCALE);
+ DALI_TEST_EQUALS(Vector3(25, 25, 25), rootScale, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewFitSize02(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_DLI_BEER_FILE_NAME);
+ view.SetProperty(Dali::Actor::Property::SIZE, Vector2(50, 50));
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ Actor rootActor = view.GetModelRoot();
+ Vector3 rootSize = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+ DALI_TEST_EQUALS(Vector3(5, 5, 5), rootSize, TEST_LOCATION);
+
+ Vector3 rootScale = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SCALE);
+ DALI_TEST_EQUALS(Vector3(1, 1, 1), rootScale, TEST_LOCATION);
+
+ view.FitSize(true);
+ rootSize = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+ DALI_TEST_EQUALS(Vector3(5, 5, 5), rootSize, TEST_LOCATION);
+
+ rootScale = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SCALE);
+ DALI_TEST_EQUALS(Vector3(10, 10, 10), rootScale, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewFitSize03(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+ view.SetProperty(Dali::Actor::Property::SIZE, Vector2(0, 0));
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ Actor rootActor = view.GetModelRoot();
+ Vector3 rootSize = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+ DALI_TEST_EQUALS(Vector3(2, 2, 2), rootSize, TEST_LOCATION);
+
+ Vector3 rootScale = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SCALE);
+ DALI_TEST_EQUALS(Vector3(1, 1, 1), rootScale, TEST_LOCATION);
+
+ view.FitSize(true);
+ rootSize = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+ DALI_TEST_EQUALS(Vector3(2, 2, 2), rootSize, TEST_LOCATION);
+
+ rootScale = rootActor.GetProperty<Vector3>(Dali::Actor::Property::SCALE);
+ DALI_TEST_EQUALS(Vector3(1, 1, 1), rootScale, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewFitCenter(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_TRIANGLE_FILE_NAME);
+ view.SetProperty(Dali::Actor::Property::SIZE, Vector2(50, 50));
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ Vector3 naturalSize = view.GetNaturalSize();
+ DALI_TEST_EQUALS(Vector3(1, 1, 0), naturalSize, TEST_LOCATION);
+
+ Actor rootActor = view.GetModelRoot();
+ Vector3 anchorPoint = rootActor.GetProperty<Vector3>(Dali::Actor::Property::ANCHOR_POINT);
+ DALI_TEST_EQUALS(Vector3(0.5, 0.5, 0.5), anchorPoint, TEST_LOCATION);
+
+ view.FitCenter(true);
+ anchorPoint = rootActor.GetProperty<Vector3>(Dali::Actor::Property::ANCHOR_POINT);
+ DALI_TEST_EQUALS(Vector3(1.0, 1.0, 0.5), anchorPoint, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewAnimation01(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_FILE_NAME);
+ view.SetProperty(Dali::Actor::Property::SIZE, Vector2(50, 50));
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ uint32_t animationCount = view.GetAnimationCount();
+ DALI_TEST_EQUALS(1, animationCount, TEST_LOCATION);
+
+ Animation animationByIndex = view.GetAnimation(0u);
+ DALI_TEST_CHECK(animationByIndex);
+
+ Animation animationByName = view.GetAnimation("animation_AnimatedCube");
+ DALI_TEST_CHECK(animationByName);
+ DALI_TEST_EQUALS(animationByIndex, animationByName, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliModelViewAnimation02(void)
+{
+ ToolkitTestApplication application;
+
+ Scene3D::ModelView view = Scene3D::ModelView::New(TEST_GLTF_ANIMATION_TEST_FILE_NAME);
+ view.SetProperty(Dali::Actor::Property::SIZE, Vector2(50, 50));
+
+ application.GetScene().Add(view);
+
+ application.SendNotification();
+ application.Render();
+
+ uint32_t animationCount = view.GetAnimationCount();
+ DALI_TEST_EQUALS(9, animationCount, TEST_LOCATION);
+
+ Animation animation1 = view.GetAnimation("Step Scale");
+ DALI_TEST_CHECK(animation1);
+ DALI_TEST_EQUALS(1.66667f, animation1.GetDuration(), 0.001f, TEST_LOCATION);
+
+ Animation animation2 = view.GetAnimation("CubicSpline Scale");
+ DALI_TEST_CHECK(animation2);
+ DALI_TEST_EQUALS(1.66667f, animation2.GetDuration(), 0.001f, TEST_LOCATION);
+
+ DALI_TEST_NOT_EQUALS(animation1, animation2, 0.0f, TEST_LOCATION);
+
+ END_TEST;
+}
\ No newline at end of file
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/node-definition.h"
-#include "dali-scene-loader/public-api/view-projection.h"
+#include "dali-scene3d/public-api/loader/node-definition.h"
+#include "dali-scene3d/public-api/loader/view-projection.h"
#include <toolkit-test-application.h>
#include <dali-test-suite-utils.h>
#include <string_view>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
namespace
{
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/renderer-state.h"
-#include "dali-scene-loader/public-api/parse-renderer-state.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/loader/renderer-state.h"
+#include "dali-scene3d/public-api/loader/parse-renderer-state.h"
+#include "dali-scene3d/public-api/loader/utils.h"
#include <dali-test-suite-utils.h>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
-namespace sl = SceneLoader;
+namespace sl = Dali::Scene3D::Loader;
namespace rs = RendererState;
int UtcDaliRendererStateFromBlendFactors(void)
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/resource-bundle.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/loader/resource-bundle.h"
+#include "dali-scene3d/public-api/loader/utils.h"
#include <dali-test-suite-utils.h>
#include <string_view>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliResourceRefCounts(void)
{
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/scene-definition.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/loader/scene-definition.h"
+#include "dali-scene3d/public-api/loader/utils.h"
#include <dali-test-suite-utils.h>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliSceneDefinitionAddNode(void)
{
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/shader-definition.h"
+#include "dali-scene3d/public-api/loader/shader-definition.h"
#include <dali-test-suite-utils.h>
#include <string_view>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
int UtcDaliShaderDefinitionFailedToLoad(void)
{
#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/node-definition.h"
-#include "dali-scene-loader/public-api/resource-bundle.h"
-#include "dali-scene-loader/public-api/shader-definition-factory.h"
+#include "dali-scene3d/public-api/loader/gltf2-loader.h"
+#include "dali-scene3d/public-api/loader/node-definition.h"
+#include "dali-scene3d/public-api/loader/resource-bundle.h"
+#include "dali-scene3d/public-api/loader/shader-definition-factory.h"
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
namespace
{
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/string-callback.h"
+#include "dali-scene3d/public-api/loader/string-callback.h"
#include <dali-test-suite-utils.h>
#include <string_view>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
namespace
{
{
InstallLogFunction(TestLogFunction);
DefaultErrorCallback("Hello world!");
- DALI_TEST_EQUAL(std::string(sBuffer), "2: string-callback.cpp: DefaultErrorCallback(26) > Hello world!");
+ DALI_TEST_EQUAL(std::string(sBuffer), "2: string-callback.cpp: DefaultErrorCallback(28) > Hello world!");
END_TEST;
}
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/loader/utils.h"
#include <dali-test-suite-utils.h>
#include <string_view>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
namespace
{
// Enable debug log for test coverage
#define DEBUG_ENABLED 1
-#include "dali-scene-loader/public-api/view-projection.h"
+#include "dali-scene3d/public-api/loader/view-projection.h"
#include <dali-test-suite-utils.h>
using namespace Dali;
-using namespace Dali::SceneLoader;
+using namespace Dali::Scene3D::Loader;
namespace
{
END_TEST;
}
+
+int utcDaliAutomationId(void)
+{
+ ToolkitTestApplication application;
+ Dali::Property::Index automationIdIndex = Toolkit::DevelControl::Property::AUTOMATION_ID;
+ std::string automationIdKey = "automationId";
+ std::string automationIdValue = "test123";
+
+ auto control = Toolkit::Control::New();
+ auto* controlAccessible = Accessibility::Accessible::Get(control);
+
+ // Check that there is no automationId initially
+ DALI_TEST_CHECK(control.GetProperty<std::string>(automationIdIndex).empty());
+ auto attributes = controlAccessible->GetAttributes();
+ DALI_TEST_CHECK(attributes.find(automationIdKey) == attributes.end());
+
+ // Set automationId
+ control.SetProperty(automationIdIndex, automationIdValue);
+
+ // Check that automationId is set
+ DALI_TEST_EQUALS(control.GetProperty<std::string>(automationIdIndex), automationIdValue, TEST_LOCATION);
+ attributes = controlAccessible->GetAttributes();
+ DALI_TEST_CHECK(attributes.find(automationIdKey) != attributes.end());
+ DALI_TEST_EQUALS(attributes[automationIdKey], automationIdValue, TEST_LOCATION);
+
+ // Unset automationId
+ control.SetProperty(automationIdIndex, "");
+
+ // Check that there is no automationId
+ DALI_TEST_CHECK(control.GetProperty<std::string>(automationIdIndex).empty());
+ attributes = controlAccessible->GetAttributes();
+ DALI_TEST_CHECK(attributes.find(automationIdKey) == attributes.end());
+
+ END_TEST;
+}
struct GlyphInfoData glyphsVS15[] =
{
{1u, 3842u, 0.f, 0.f, 0.f, 0.f, 14.0f, 0.f, false, false},
- {1u, 8203u, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, false, false},
+ {1u, 3u, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, false, false},
};
CharacterIndex characterIndicesVS15[] = {0u, 0u};
Length charactersPerGlyphVS15[] = {0u, 2u};
class WebEngine;
class MockWebEngineContext;
+class MockWebEngineCookieManager;
namespace
{
-
// Generally only one WebEngine instance exists.
// If > 1, a new web engine has been created by CreateWindowSignal.
-static WebEngine* gInstance = nullptr;
-static int gInstanceCount = 0;
-static MockWebEngineContext* gWebEngineContextInstance = nullptr;
+WebEngine* gInstance = nullptr;
+int gInstanceCount = 0;
+MockWebEngineContext* gWebEngineContextInstance = nullptr;
+MockWebEngineCookieManager* gMockWebEngineCookieManager = nullptr;
bool OnGoBack();
bool OnGoForward();
float mockZoomFactor;
};
+Dali::WebEngineContext* GetContext()
+{
+ if (!gWebEngineContextInstance)
+ {
+ gWebEngineContextInstance = new MockWebEngineContext();
+ }
+ return gWebEngineContextInstance;
+}
+
class MockWebEngineCookieManager : public Dali::WebEngineCookieManager
{
public:
Dali::WebEngineCookieManager::CookieAcceptPolicy mockCookieAcceptPolicy;
};
+Dali::WebEngineCookieManager* GetCookieManager()
+{
+ if (!gMockWebEngineCookieManager)
+ {
+ gMockWebEngineCookieManager = new MockWebEngineCookieManager();
+ }
+ return gMockWebEngineCookieManager;
+}
+
class MockWebEngineBackForwardListItem : public Dali::WebEngineBackForwardListItem
{
public:
}
mockWebEngineSettings = new MockWebEngineSettings();
- MockWebEngineContext* engineContext = new MockWebEngineContext();
- mockWebEngineContext = engineContext;
- if ( gInstanceCount == 1 )
- {
- gWebEngineContextInstance = engineContext;
- }
- mockWebEngineCookieManager = new MockWebEngineCookieManager();
mockWebEngineBackForwardList = new MockWebEngineBackForwardList();
}
gInstanceCount--;
if( !gInstanceCount )
{
- gInstance = 0;
- gWebEngineContextInstance = 0;
+ gInstance = nullptr;
}
delete mockWebEngineSettings;
- delete mockWebEngineContext;
- delete mockWebEngineCookieManager;
delete mockWebEngineBackForwardList;
}
return *mockWebEngineSettings;
}
- Dali::WebEngineContext& GetContext() const
- {
- return *mockWebEngineContext;
- }
-
- Dali::WebEngineCookieManager& GetCookieManager() const
- {
- return *mockWebEngineCookieManager;
- }
-
Dali::WebEngineBackForwardList& GetBackForwardList() const
{
return *mockWebEngineBackForwardList;
Dali::Vector2 mScrollSize;
Dali::Vector2 mContentSize;
WebEngineBackForwardList* mockWebEngineBackForwardList;
- WebEngineContext* mockWebEngineContext;
- WebEngineCookieManager* mockWebEngineCookieManager;
WebEngineSettings* mockWebEngineSettings;
std::vector<Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback> mResultCallbacks;
bool OnChangesWatch()
{
- DisconnectFromGlobalSignal( &OnChangesWatch );
-
- if ( gInstance )
+ DisconnectFromGlobalSignal(&OnChangesWatch);
+ if (gMockWebEngineCookieManager)
{
- MockWebEngineCookieManager* temp = (MockWebEngineCookieManager *)(&(gInstance->GetCookieManager()));
- if ( temp )
- {
- temp->mChangesWatchCallback();
- }
+ gMockWebEngineCookieManager->mChangesWatchCallback();
}
-
return false;
}
return WebEngine( baseObject );
}
+Dali::WebEngineContext* WebEngine::GetContext()
+{
+ return Internal::Adaptor::GetContext();
+}
+
+Dali::WebEngineCookieManager* WebEngine::GetCookieManager()
+{
+ return Internal::Adaptor::GetCookieManager();
+}
+
WebEngine::WebEngine( const WebEngine& WebEngine )
: BaseHandle( WebEngine )
{
return Internal::Adaptor::GetImplementation( *this ).GetSettings();
}
-WebEngineContext& WebEngine::GetContext() const
-{
- return Internal::Adaptor::GetImplementation( *this ).GetContext();
-}
-
-WebEngineCookieManager& WebEngine::GetCookieManager() const
-{
- return Internal::Adaptor::GetImplementation( *this ).GetCookieManager();
-}
-
WebEngineBackForwardList& WebEngine::GetBackForwardList() const
{
return Internal::Adaptor::GetImplementation( *this ).GetBackForwardList();
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;
-}
-
int UtcDaliKeyboardFocusManagerFocusFinderRootActor(void)
{
ToolkitTestApplication application;
using namespace Dali;
using namespace Dali::Toolkit;
-void model_view_startup(void)
+void model3d_view_startup(void)
{
test_return_value = TET_UNDEF;
}
-void model_view_cleanup(void)
+void model3d_view_cleanup(void)
{
test_return_value = TET_PASS;
}
} // namespace
// Negative test case for a method
-int UtcDaliModelViewUninitialized(void)
+int UtcDaliModel3dViewUninitialized(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliModel3dViewUninitialized");
}
// Positive test case for a method
-int UtcDaliModelViewNew(void)
+int UtcDaliModel3dViewNew(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliModel3dViewNew");
}
// Positive test case for a method
-int UtcDaliModelViewDownCast(void)
+int UtcDaliModel3dViewDownCast(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliModelViewDownCast");
}
// Positive test case for a method
-int UtcDaliModelViewPropertyNames(void)
+int UtcDaliModel3dViewPropertyNames(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliModel3dViewPropertyNames");
}
// Positive test case for a method
-int UtcDaliModelViewAddRemove(void)
+int UtcDaliModel3dViewAddRemove(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliModel3dViewAddRemove");
END_TEST;
}
-int UtcDaliModelCopyAndAssignment(void)
+int UtcDaliModel3dViewCopyAndAssignment(void)
{
ToolkitTestApplication application;
END_TEST;
}
-int UtcDaliModelMoveConstructor(void)
+int UtcDaliModel3dViewMoveConstructor(void)
{
ToolkitTestApplication application;
END_TEST;
}
-int UtcDaliModelMoveAssignment(void)
+int UtcDaliModel3dViewMoveAssignment(void)
{
ToolkitTestApplication application;
END_TEST;
}
-int UtcDaliModelTypeRegistry(void)
+int UtcDaliModel3dViewTypeRegistry(void)
{
ToolkitTestApplication application;
END_TEST;
}
-int UtcDaliModelOnSizeSet(void)
+int UtcDaliModel3dViewOnSizeSet(void)
{
ToolkitTestApplication application;
application.Render();
// Tap first to get the focus.
- TestGenerateTap(application, 3.0f, 25.0f);
+ TestGenerateTap(application, 3.0f, 25.0f, 100);
// Render and notify
application.SendNotification();
application.Render();
// Double tap to select a word.
- TestGenerateTap(application, 3.0f, 25.0f);
+ TestGenerateTap(application, 3.0f, 25.0f, 200);
// Render and notify
application.SendNotification();
// EMOJI Sequences case for coverage.
std::string emojiSequences =
+ "Glyphs not included in the font \n" //case for coverage when glyph is not included in the font
"Text VS15 ☪︎\n" //text presentation sequence and selector
"Color VS16 ☪️\n" //emoji presentation sequence and selector
"Default ☪ \n" //default presentation
"FamilyManWomanGirlBoy 👨‍👩‍👧‍👦\n" // emoji multi zwj sequence
"WomanScientist 👩‍🔬\n" // emoji zwj sequence
- "WomanScientistLightSkinTone👩🏻‍🔬 \n" //emoji modifier sequence: skin tone & JWZ
- "LeftRightArrowText↔︎\n" //text presentation sequence and selector
- "LeftRightArrowEmoji↔️\n" //emoji presentation sequence and selector
- "SouthKoreaFlag🇰🇷\n" //emoji flag sequence
+ "WomanScientistLightSkinTone👩🏻‍🔬 \n" // emoji modifier sequence: skin tone & JWZ
+ "LeftRightArrowText↔︎\n" // text presentation sequence and selector
+ "LeftRightArrowEmoji↔️\n" // emoji presentation sequence and selector
+ "SouthKoreaFlag🇰🇷\n" // emoji flag sequence
"JordanFlag🇯🇴\n" // emoji flag sequence
- "EnglandFlag🏴󠁧󠁢󠁥󠁮󠁧󠁿\n" //emoji tag sequence like England flag
+ "EnglandFlag🏴󠁧󠁢󠁥󠁮󠁧󠁿\n" // emoji tag sequence like England flag
"Runner 🏃‍➡️ \n"
- "VictoryHandMediumLightSkinTone:✌️🏼\n" //emoji modifier sequence: skin tone
- "RainbowFlag:🏳️‍🌈 \n" //emoji zwj sequence: Rainbow Flag
- "keycap# #️⃣ \n" // fully-qualified emoji keycap sequence
- "keycap#_text #⃣ \n" // unqualified emoji keycap sequence
- "keycap3 3️⃣ \n" // fully-qualified emoji keycap sequence
- "keycap3_text 3⃣ \n" // unqualified emoji keycap sequence
- "two adjacent glyphs ☪️️️☪️\n" //This line should be rendered as two adjacent glyphs
- "Digit 8️ 8︎ 8\n" // should be rendered according to selector
- "Surfing Medium Skin Female: 🏄🏼‍♀️"; // Person Surfing + Medium Skin Tone +? Zero Width Joiner + Female Sign
+ "VictoryHandMediumLightSkinTone:✌️🏼\n" // emoji modifier sequence: skin tone
+ "RainbowFlag:🏳️‍🌈 \n" // emoji zwj sequence: Rainbow Flag
+ "keycap# #️⃣ \n" // fully-qualified emoji keycap sequence
+ "keycap#_text #⃣ \n" // unqualified emoji keycap sequence
+ "keycap3 3️⃣ \n" // fully-qualified emoji keycap sequence
+ "keycap3_text 3⃣ \n" // unqualified emoji keycap sequence
+ "two adjacent glyphs ☪️️️☪️\n" // This line should be rendered as two adjacent glyphs
+ "Digit 8️ 8︎ 8\n" // should be rendered according to selector
+ "Surfing Medium Skin Female: 🏄🏼‍♀️\n" // Person Surfing + Medium Skin Tone +? Zero Width Joiner + Female Sign
+ "SYMBOLS_NSLCL variation selector: 🅰️🅱️🅲︎🅳︎🅴︎\n" // 1F170 ~ 1F174 with variation selector, text vs emoji
+ "SYMBOLS_NSLCL with VS15: 🅰︎🅱︎🅲︎🅳︎🅴︎\n" // 1F170 ~ 1F174 with VS15
+ "SYMBOLS_NSLCL with VS16: 🅰️🅱️🅲️🅳️🅴️\n" // 1F170 ~ 1F174 with VS16
+
+ ;
label.SetProperty(TextLabel::Property::TEXT, emojiSequences);
label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
#include "dali-toolkit-test-utils/toolkit-timer.h"
#include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
-#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
-#include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
#include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
#include <dali-toolkit/devel-api/controls/web-view/web-view.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-certificate.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-console-message.h>
+#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context-menu-item.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context-menu.h>
-#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context.h>
+#include <dali/devel-api/adaptor-framework/web-engine/web-engine-cookie-manager.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-form-repost-decision.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-frame.h>
#include <dali/devel-api/adaptor-framework/web-engine/web-engine-hit-test.h>
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebContext* context = view.GetContext();
+ Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0);
END_TEST;
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ Dali::WebEngineCookieManager* cookieManager = WebView::GetCookieManager();
DALI_TEST_CHECK(cookieManager != 0);
END_TEST;
// test cases for web context.
-int UtcDaliWebContextGetSetCacheModel(void)
+int UtcDaliWebContextGetSetCacheModelEtc(void)
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebContext* context = view.GetContext();
+ Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0)
std::string kDefaultValue;
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebContext* context = view.GetContext();
+ Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0)
std::string kDefaultValue;
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebContext* context = view.GetContext();
+ Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0)
// load url.
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ Dali::WebEngineCookieManager* cookieManager = WebView::GetCookieManager();
DALI_TEST_CHECK(cookieManager != 0)
const std::string kDefaultValue;
{
ToolkitTestApplication application;
- WebView view = WebView::New();
- DALI_TEST_CHECK(view);
-
- Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ Dali::WebEngineCookieManager* cookieManager = WebView::GetCookieManager();
DALI_TEST_CHECK(cookieManager != 0)
cookieManager->ChangesWatch(&OnChangesWatch);
dali.info
*.dylib
dali2-*-config.cmake
-libdali2-scene-loader.so*
+libdali2-scene3d.so*
dali-shader-generator
OPTION(INSTALL_DOXYGEN_DOC "Install doxygen doc" ON)
OPTION(CONFIGURE_AUTOMATED_TESTS "Configure automated tests" ON)
OPTION(USE_DEFAULT_RESOURCE_DIR "Whether to use the default resource folders. Otherwise set environment variables for DALI_IMAGE_DIR, DALI_SOUND_DIR, DALI_STYLE_DIR, DALI_STYLE_IMAGE_DIR and DALI_DATA_READ_ONLY_DIR" ON)
-OPTION(BUILD_SCENE_LOADER "Whether to build dali-scene-loader." ON)
+OPTION(BUILD_SCENE3D "Whether to build dali-scene3d." ON)
IF( ENABLE_PKG_CONFIGURE )
FIND_PACKAGE( PkgConfig REQUIRED )
ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}rename_cov_data ./rename-cov-data )
ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}cov_data ${LCOV_BIN} ${LCOV_OPTS} --base-directory . --directory . -c -o dali.info
- COMMAND ${LCOV_BIN} ${LCOV_OPTS} --remove dali.info \"*/dali-env/*\" \"/usr/include/*\" \"*/dali-env/*\" \"*solid-color-actor*\" \"*/dali-toolkit/third-party/*\" \"*/dali-scene-loader/third-party/*\" -o dali.info )
+ COMMAND ${LCOV_BIN} ${LCOV_OPTS} --remove dali.info \"*/dali-env/*\" \"/usr/include/*\" \"*/dali-env/*\" \"*solid-color-actor*\" \"*/dali-toolkit/third-party/*\" \"*/dali-scene3d/third-party/*\" -o dali.info )
ADD_CUSTOM_TARGET( ${DALI_TOOLKIT_PREFIX}coverage genhtml -p ${ROOT_SRC_DIR} ${LCOV_OPTS} -o ${COVERAGE_OUTPUT_DIR} dali.info
DEPENDS cov_data )
ENDIF( LCOV_BIN )
ENDIF()
-IF ( BUILD_SCENE_LOADER )
- ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/dali-scene-loader )
+IF ( BUILD_SCENE3D )
+ ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/dali-scene3d )
ENDIF()
CONFIGURE_FILE( ${DOXYGEN_SRC_DIR}/dali.doxy.in ${DOXYGEN_SRC_DIR}/dali.doxy @ONLY )
CONFIGURE_FILE( ${DOXYGEN_INTERNAL_SRC_DIR}/dali-internal.doxy.in ${DOXYGEN_INTERNAL_SRC_DIR}/dali-internal.doxy @ONLY )
- IF ( BUILD_SCENE_LOADER )
+ IF ( BUILD_SCENE3D )
ADD_CUSTOM_TARGET( doc_doxygen ALL
- DEPENDS ${name} dali2-scene-loader
+ DEPENDS ${name} dali2-scene3d
COMMAND ${DOXYGEN_EXECUTABLE} -u ${DOXYGEN_SRC_DIR}/dali.doxy
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_SRC_DIR}/dali.doxy
COMMAND ${CMAKE_COMMAND} -P ${DOXYGEN_SRC_DIR}/check_for_errors.cmake
MESSAGE( STATUS "Vector Based Text Rendering: " ${ENABLE_VECTOR_BASED_TEXT_RENDERING} )
MESSAGE( STATUS "Enable link test: " ${ENABLE_LINK_TEST} )
MESSAGE( STATUS "Configure automated tests: " ${CONFIGURE_AUTOMATED_TESTS} )
-MESSAGE( STATUS "Build Dali Scene Loader: " ${BUILD_SCENE_LOADER} )
+MESSAGE( STATUS "Build Dali Scene3D: " ${BUILD_SCENE3D} )
MESSAGE( STATUS "CXXFLAGS: " ${CMAKE_CXX_FLAGS} )
MESSAGE( STATUS "LDFLAGS: " ${CMAKE_SHARED_LINKER_FLAGS_INIT}${CMAKE_SHARED_LINKER_FLAGS} )
CMAKE_MINIMUM_REQUIRED(VERSION 3.8.2)
-set(name "dali2-scene-loader")
+set(name "dali2-scene3d")
project(${name} CXX)
set(${name}_VERSION_PATCH 0)
set(${name}_VERSION ${${name}_VERSION_MAJOR}.${${name}_VERSION_MINOR}.${${name}_VERSION_PATCH} )
-SET(DALI_SCENE_LOADER_VERSION ${${name}_VERSION} )
+SET(DALI_SCENE3D_VERSION ${${name}_VERSION} )
if(CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions("-DDEBUG_ENABLED")
endif()
-ADD_DEFINITIONS( "-DBUILDING_DALI_SCENE_LOADER" )
+ADD_DEFINITIONS( "-DBUILDING_DALI_SCENE3D" )
foreach(flag ${PKGS_CFLAGS})
set(extra_flags "${extra_flags} ${flag}")
set(prefix ${CMAKE_INSTALL_PREFIX})
set(repo_root_dir "${CMAKE_CURRENT_LIST_DIR}/../../../")
-set(scene_loader_dir "${repo_root_dir}/dali-scene-loader")
+set(scene3d_dir "${repo_root_dir}/dali-scene3d")
option(ENABLE_PKG_CONFIGURE "Use pkgconfig" ON)
option(ENABLE_COVERAGE "Coverage" OFF)
set(EXEC_PREFIX ${CMAKE_INSTALL_PREFIX})
set(DEV_INCLUDE_PATH ${INCLUDE_DIR})
- set(core_pkg_cfg_file dali2-scene-loader.pc)
+ set(core_pkg_cfg_file dali2-scene3d.pc)
configure_file(${CMAKE_CURRENT_LIST_DIR}/${core_pkg_cfg_file}.in ${core_pkg_cfg_file} @ONLY)
endif()
-set(scene_loader_src_files "")
-include("${scene_loader_dir}/internal/file.list")
-include("${scene_loader_dir}/public-api/file.list")
+set(scene3d_src_files "")
+include("${scene3d_dir}/internal/file.list")
+include("${scene3d_dir}/public-api/file.list")
set(prefix_include_dir "${prefix}/include")
include_directories(${repo_root_dir}
)
# Generate source files for shaders
-SET(SHADER_SOURCE_DIR "${scene_loader_dir}/internal/graphics/shaders/")
-SET(SHADER_GENERATED_DIR "${scene_loader_dir}/internal/graphics/generated")
+SET(SHADER_SOURCE_DIR "${scene3d_dir}/internal/graphics/shaders/")
+SET(SHADER_GENERATED_DIR "${scene3d_dir}/internal/graphics/generated")
-SET(GENERATED_SHADER_DIR ${scene_loader_dir}/internal/graphics/)
+SET(GENERATED_SHADER_DIR ${scene3d_dir}/internal/graphics/)
SET_PROPERTY(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
"${GENERATED_SHADER_DIR}/generated/"
"${GENERATED_SHADER_DIR}/builtin-shader-extern-gen.h")
DEPENDS ${SHADER_GENERATOR_BINARY}
COMMAND ${SHADER_GENERATOR_BINARY} ${SHADER_SOURCE_DIR} ${SHADER_GENERATED_DIR})
-SET( scene_loader_src_files ${scene_loader_src_files} ${BUILT_IN_SHADER_GEN_CPP} )
+SET( scene3d_src_files ${scene3d_src_files} ${BUILT_IN_SHADER_GEN_CPP} )
-add_library(${name} SHARED ${scene_loader_src_files})
+add_library(${name} SHARED ${scene3d_src_files})
target_link_libraries(${name} ${DALICORE_LDFLAGS} ${DALIADAPTOR_LDFLAGS}
dali2-toolkit
IF( INSTALL_CMAKE_MODULES )
SET_TARGET_PROPERTIES( ${name}
PROPERTIES
- VERSION ${DALI_SCENE_LOADER_VERSION}
+ VERSION ${DALI_SCENE3D_VERSION}
SOVERSION ${${name}_VERSION_MAJOR}
CLEAN_DIRECT_OUPUT 1
)
INSTALL( TARGETS ${name} DESTINATION ${LIB_DIR} )
ENDIF()
-file(GLOB scene_loader_include_files ${scene_loader_public_api_dir})
-install(DIRECTORY ${scene_loader_include_files}
- DESTINATION "${prefix_include_dir}/dali-scene-loader"
+file(GLOB scene3d_include_files ${scene3d_public_api_dir})
+install(DIRECTORY ${scene3d_include_files}
+ DESTINATION "${prefix_include_dir}/dali-scene3d"
FILES_MATCHING PATTERN "*.h"
)
prefix=@PREFIX@
exec_prefix=@EXEC_PREFIX@
-apiversion=@DALI_SCENE_LOADER_VERSION@
+apiversion=@DALI_SCENE3D_VERSION@
libdir=@LIB_DIR@
includedir=@DEV_INCLUDE_PATH@
-Name: Dali 3D Engine Scene Loader
-Description: Dali Scene Loader library
+Name: Dali 3D Engine Scene3D
+Description: Dali Scene3D library
Version: ${apiversion}
Requires: dali2-toolkit
-Libs: -L${libdir} -ldali2-scene-loader
+Libs: -L${libdir} -ldali2-scene3d
Cflags: -I${includedir}
PREDEFINED = DALI_CORE_API \
DALI_ADAPTOR_API \
DALI_TOOLKIT_API \
- DALI_SCENE_LOADER_API \
+ DALI_SCENE3D_API \
DALI_INTERNAL \
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
@prefix@/include/dali/devel-api \
../../../dali-toolkit/public-api \
../../../dali-toolkit/devel-api \
- ../../../dali-scene-loader/public-api \
+ ../../../dali-scene3d/public-api \
../../../automated-tests/README.md
# This tag can be used to specify the character encoding of the source files
PREDEFINED = DALI_CORE_API \
DALI_ADAPTOR_API \
DALI_TOOLKIT_API \
- DALI_SCENE_LOADER_API \
+ DALI_SCENE3D_API \
DALI_INTERNAL \
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+++ /dev/null
-set(scene_loader_internal_dir "${scene_loader_dir}/internal")
-
-set(scene_loader_src_files ${scene_loader_src_files}
- ${scene_loader_internal_dir}/gltf2-asset.cpp
- ${scene_loader_internal_dir}/hash.cpp
- ${scene_loader_internal_dir}/json-reader.cpp
- ${scene_loader_internal_dir}/json-util.cpp
-)
+++ /dev/null
-set(scene_loader_public_api_dir "${scene_loader_dir}/public-api")
-
-set(scene_loader_src_files ${scene_loader_src_files}
- ${scene_loader_public_api_dir}/alpha-function-helper.cpp
- ${scene_loader_public_api_dir}/animated-property.cpp
- ${scene_loader_public_api_dir}/animation-definition.cpp
- ${scene_loader_public_api_dir}/blend-shape-details.cpp
- ${scene_loader_public_api_dir}/camera-parameters.cpp
- ${scene_loader_public_api_dir}/customization.cpp
- ${scene_loader_public_api_dir}/dli-loader.cpp
- ${scene_loader_public_api_dir}/environment-definition.cpp
- ${scene_loader_public_api_dir}/facial-animation-loader.cpp
- ${scene_loader_public_api_dir}/gltf2-loader.cpp
- ${scene_loader_public_api_dir}/ktx-loader.cpp
- ${scene_loader_public_api_dir}/material-definition.cpp
- ${scene_loader_public_api_dir}/matrix-stack.cpp
- ${scene_loader_public_api_dir}/mesh-definition.cpp
- ${scene_loader_public_api_dir}/node-definition.cpp
- ${scene_loader_public_api_dir}/parse-renderer-state.cpp
- ${scene_loader_public_api_dir}/renderer-state.cpp
- ${scene_loader_public_api_dir}/resource-bundle.cpp
- ${scene_loader_public_api_dir}/scene-definition.cpp
- ${scene_loader_public_api_dir}/shader-definition.cpp
- ${scene_loader_public_api_dir}/shader-definition-factory.cpp
- ${scene_loader_public_api_dir}/skinning-details.cpp
- ${scene_loader_public_api_dir}/string-callback.cpp
- ${scene_loader_public_api_dir}/utils.cpp
- ${scene_loader_public_api_dir}/view-projection.cpp
-)
* `joints0` and `weights0` attributes, as above.
* A [`skeleton`](#skeletons) ID, to specify which (joint) nodes' transformations affect the mesh.
-:warning: The maximum number of bones supported by DALi Scene Loader is `64`.
+:warning: The maximum number of bones supported by DALi Scene3D is `64`.
## Blend shapes
Blend shapes provide alternate configurations of vertex `positions`, `normals` and/or `tangents` that may be blended with the same attributes of the base mesh, controlled by an animatable `weight`.
```
A `blendShapesHeader`, if present, must define:
* the `version` of the blend shapes; supported values are `1.0` and `2.0`. The difference between the versions is that v1.0 requires a per-blend shape definition of an un-normalization factor.
- * the `byteOffset` and `byteLength` of a buffer in the binary which defines the width (2 bytes) and height (2 bytes) of the texture that dali-scene-loader creates for blend shape data.
+ * the `byteOffset` and `byteLength` of a buffer in the binary which defines the width (2 bytes) and height (2 bytes) of the texture that dali-scene3d creates for blend shape data.
The `blendShapes` array then defines the shapes that are available to blend between, comprising of:
* An initial `weight` numerical, the default is 0;
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "model-view-impl.h"
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/internal/controls/control/control-data-impl.h>
+#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/public-api/object/type-registry.h>
+#include <filesystem>
+
+// INTERNAL INCLUDES
+#include <dali-scene3d/public-api/controls/model-view/model-view.h>
+#include <dali-scene3d/public-api/loader/animation-definition.h>
+#include <dali-scene3d/public-api/loader/camera-parameters.h>
+#include <dali-scene3d/public-api/loader/cube-data.h>
+#include <dali-scene3d/public-api/loader/cube-map-loader.h>
+#include <dali-scene3d/public-api/loader/dli-loader.h>
+#include <dali-scene3d/public-api/loader/gltf2-loader.h>
+#include <dali-scene3d/public-api/loader/light-parameters.h>
+#include <dali-scene3d/public-api/loader/load-result.h>
+#include <dali-scene3d/public-api/loader/node-definition.h>
+#include <dali-scene3d/public-api/loader/scene-definition.h>
+#include <dali-scene3d/public-api/loader/shader-definition-factory.h>
+
+using namespace Dali;
+
+namespace Dali
+{
+namespace Scene3D
+{
+namespace Internal
+{
+namespace
+{
+BaseHandle Create()
+{
+ return Scene3D::ModelView::New(std::string());
+}
+
+// Setup properties, signals and actions using the type-registry.
+DALI_TYPE_REGISTRATION_BEGIN(Scene3D::ModelView, Toolkit::Control, Create);
+DALI_TYPE_REGISTRATION_END()
+
+static constexpr uint32_t OFFSET_FOR_DIFFUSE_CUBE_TEXTURE = 2u;
+static constexpr uint32_t OFFSET_FOR_SPECULAR_CUBE_TEXTURE = 1u;
+
+static constexpr Vector3 Y_DIRECTION(1.0f, -1.0f, 1.0f);
+
+static constexpr std::string_view KTX_EXTENSION = ".ktx";
+static constexpr std::string_view OBJ_EXTENSION = ".obj";
+static constexpr std::string_view GLTF_EXTENSION = ".gltf";
+static constexpr std::string_view DLI_EXTENSION = ".dli";
+
+struct BoundingVolume
+{
+ void Init()
+ {
+ pointMin = Vector3(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
+ pointMax = Vector3(std::numeric_limits<float>::min(), std::numeric_limits<float>::min(), std::numeric_limits<float>::min());
+ }
+
+ void ConsiderNewPointInVolume(const Vector3& position)
+ {
+ pointMin.x = std::min(position.x, pointMin.x);
+ pointMin.y = std::min(position.y, pointMin.y);
+ pointMin.z = std::min(position.z, pointMin.z);
+
+ pointMax.x = std::max(position.x, pointMax.x);
+ pointMax.y = std::max(position.y, pointMax.y);
+ pointMax.z = std::max(position.z, pointMax.z);
+ }
+
+ Vector3 CalculateSize()
+ {
+ return pointMax - pointMin;
+ }
+
+ Vector3 CalculatePivot()
+ {
+ Vector3 pivot = pointMin / (pointMin - pointMax);
+ for(uint32_t i = 0; i < 3; ++i)
+ {
+ // To avoid divid by zero
+ if(pointMin[i] == pointMax[i])
+ {
+ pivot[i] = 0.5f;
+ }
+ }
+ return pivot;
+ }
+
+ Vector3 pointMin;
+ Vector3 pointMax;
+};
+
+Texture LoadCubeMap(const std::string& cubeMapPath)
+{
+ Texture cubeTexture;
+ Dali::Scene3D::Loader::CubeData cubeData;
+ if(Dali::Scene3D::Loader::LoadCubeMapData(cubeMapPath, cubeData))
+ {
+ cubeTexture = cubeData.CreateTexture();
+ }
+ else
+ {
+ DALI_LOG_ERROR("Fail to load cube map, %s\n", cubeMapPath.c_str());
+ }
+
+ return cubeTexture;
+}
+
+void ConfigureBlendShapeShaders(
+ 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); };
+ if(!scene.ConfigureBlendshapeShaders(resources, root, std::move(requests), onError))
+ {
+ Dali::Scene3D::Loader::ExceptionFlinger flinger(ASSERT_LOCATION);
+ for(auto& msg : errors)
+ {
+ flinger << msg << '\n';
+ }
+ }
+}
+
+void AddModelTreeToAABB(BoundingVolume& AABB, const Dali::Scene3D::Loader::SceneDefinition& scene, const Dali::Scene3D::Loader::Customization::Choices& choices, Dali::Scene3D::Loader::Index iNode, Dali::Scene3D::Loader::NodeDefinition::CreateParams& nodeParams, Matrix parentMatrix)
+{
+ static constexpr uint32_t BOX_POINT_COUNT = 8;
+ static uint32_t BBIndex[BOX_POINT_COUNT][3] = {{0, 0, 0}, {0, 1, 0}, {1, 0, 0}, {1, 1, 0}, {0, 0, 1}, {0, 1, 1}, {1, 0, 1}, {1, 1, 1}};
+
+ Matrix nodeMatrix;
+ const Dali::Scene3D::Loader::NodeDefinition* node = scene.GetNode(iNode);
+ Matrix localMatrix = node->GetLocalSpace();
+ Matrix::Multiply(nodeMatrix, localMatrix, parentMatrix);
+
+ Vector3 volume[2];
+ if(node->GetExtents(nodeParams.mResources, volume[0], volume[1]))
+ {
+ for(uint32_t i = 0; i < BOX_POINT_COUNT; ++i)
+ {
+ Vector4 position = Vector4(volume[BBIndex[i][0]].x, volume[BBIndex[i][1]].y, volume[BBIndex[i][2]].z, 1.0f);
+ Vector4 objectPosition = nodeMatrix * position;
+ objectPosition /= objectPosition.w;
+
+ AABB.ConsiderNewPointInVolume(Vector3(objectPosition));
+ }
+ }
+
+ if(node->mCustomization)
+ {
+ if(!node->mChildren.empty())
+ {
+ auto choice = choices.Get(node->mCustomization->mTag);
+ Dali::Scene3D::Loader::Index i = std::min(choice != Dali::Scene3D::Loader::Customization::NONE ? choice : 0, static_cast<Dali::Scene3D::Loader::Index>(node->mChildren.size() - 1));
+
+ AddModelTreeToAABB(AABB, scene, choices, node->mChildren[i], nodeParams, nodeMatrix);
+ }
+ }
+ else
+ {
+ for(auto i : node->mChildren)
+ {
+ AddModelTreeToAABB(AABB, scene, choices, i, nodeParams, nodeMatrix);
+ }
+ }
+}
+
+} // anonymous namespace
+
+ModelView::ModelView(const std::string& modelPath, const std::string& resourcePath)
+: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)),
+ mModelPath(modelPath),
+ mResourcePath(resourcePath),
+ mModelLayer(),
+ mModelRoot(),
+ mNaturalSize(Vector3::ZERO),
+ mModelPivot(AnchorPoint::CENTER),
+ mIblScaleFactor(1.0f),
+ mFitSize(false),
+ mFitCenter(false)
+{
+}
+
+ModelView::~ModelView()
+{
+}
+
+Dali::Scene3D::ModelView ModelView::New(const std::string& modelPath, const std::string& resourcePath)
+{
+ ModelView* impl = new ModelView(modelPath, resourcePath);
+
+ Dali::Scene3D::ModelView handle = Dali::Scene3D::ModelView(*impl);
+
+ // Second-phase init of the implementation
+ // This can only be done after the CustomActor connection has been made...
+ impl->Initialize();
+
+ return handle;
+}
+
+const Actor ModelView::GetModelRoot()
+{
+ return mModelRoot;
+}
+
+void ModelView::FitSize(bool fit)
+{
+ mFitSize = fit;
+ ScaleModel();
+}
+
+void ModelView::FitCenter(bool fit)
+{
+ mFitCenter = fit;
+ FitModelPosition();
+}
+
+void ModelView::SetImageBasedLightSource(const std::string& diffuse, const std::string& specular, float scaleFactor)
+{
+ Texture diffuseTexture = LoadCubeMap(diffuse);
+ if(diffuseTexture)
+ {
+ Texture specularTexture = LoadCubeMap(specular);
+ if(specularTexture)
+ {
+ mDiffuseTexture = diffuseTexture;
+ mSpecularTexture = specularTexture;
+ mIblScaleFactor = scaleFactor;
+
+ SetImageBasedLight(mModelRoot);
+ }
+ }
+}
+
+uint32_t ModelView::GetAnimationCount()
+{
+ return mAnimations.size();
+}
+
+Dali::Animation ModelView::GetAnimation(uint32_t index)
+{
+ Dali::Animation animation;
+ if(mAnimations.size() > index)
+ {
+ animation = mAnimations[index].second;
+ }
+ return animation;
+}
+
+Dali::Animation ModelView::GetAnimation(const std::string& name)
+{
+ Dali::Animation animation;
+ if(!name.empty())
+ {
+ for(auto&& animationData : mAnimations)
+ {
+ if(animationData.first == name)
+ {
+ animation = animationData.second;
+ break;
+ }
+ }
+ }
+ return animation;
+}
+
+///////////////////////////////////////////////////////////
+//
+// Private methods
+//
+
+void ModelView::OnSceneConnection(int depth)
+{
+ if(!mModelRoot)
+ {
+ LoadModel();
+ }
+
+ Control::OnSceneConnection(depth);
+}
+
+void ModelView::OnInitialize()
+{
+ Actor self = Self();
+ mModelLayer = Layer::New();
+ mModelLayer.SetProperty(Layer::Property::BEHAVIOR, Layer::LAYER_3D);
+ mModelLayer.SetProperty(Layer::Property::DEPTH_TEST, true);
+ mModelLayer.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ mModelLayer.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ mModelLayer.SetResizePolicy(ResizePolicy::FILL_TO_PARENT,
+ Dimension::ALL_DIMENSIONS);
+
+ // 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.
+ mModelLayer.SetProperty(Dali::Actor::Property::SCALE_Y, -1.0f);
+ self.Add(mModelLayer);
+}
+
+Vector3 ModelView::GetNaturalSize()
+{
+ if(!mModelRoot)
+ {
+ LoadModel();
+ }
+
+ return mNaturalSize;
+}
+
+float ModelView::GetHeightForWidth(float width)
+{
+ Extents padding;
+ padding = Self().GetProperty<Extents>(Toolkit::Control::Property::PADDING);
+ return Control::GetHeightForWidth(width) + padding.top + padding.bottom;
+}
+
+float ModelView::GetWidthForHeight(float height)
+{
+ Extents padding;
+ padding = Self().GetProperty<Extents>(Toolkit::Control::Property::PADDING);
+ return Control::GetWidthForHeight(height) + padding.start + padding.end;
+}
+
+void ModelView::OnRelayout(const Vector2& size, RelayoutContainer& container)
+{
+ Control::OnRelayout(size, container);
+ ScaleModel();
+}
+
+void ModelView::LoadModel()
+{
+ std::filesystem::path modelPath(mModelPath);
+ if(mResourcePath.empty())
+ {
+ mResourcePath = std::string(modelPath.parent_path()) + "/";
+ }
+ std::string extension = modelPath.extension();
+ std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
+
+ Dali::Scene3D::Loader::ResourceBundle::PathProvider pathProvider = [&](Dali::Scene3D::Loader::ResourceType::Value type) {
+ return mResourcePath;
+ };
+
+ Dali::Scene3D::Loader::ResourceBundle resources;
+ Dali::Scene3D::Loader::SceneDefinition scene;
+ std::vector<Dali::Scene3D::Loader::AnimationGroupDefinition> animGroups;
+ std::vector<Dali::Scene3D::Loader::CameraParameters> cameraParameters;
+ std::vector<Dali::Scene3D::Loader::LightParameters> lights;
+
+ std::vector<Dali::Scene3D::Loader::AnimationDefinition> animations;
+ animations.clear();
+
+ Dali::Scene3D::Loader::LoadResult output{resources, scene, animations, animGroups, cameraParameters, lights};
+
+ if(extension == DLI_EXTENSION)
+ {
+ Dali::Scene3D::Loader::DliLoader loader;
+ Dali::Scene3D::Loader::DliLoader::InputParams input{
+ pathProvider(Dali::Scene3D::Loader::ResourceType::Mesh),
+ nullptr,
+ {},
+ {},
+ nullptr,
+ {}};
+ Dali::Scene3D::Loader::DliLoader::LoadParams loadParams{input, output};
+ if(!loader.LoadScene(mModelPath, loadParams))
+ {
+ Dali::Scene3D::Loader::ExceptionFlinger(ASSERT_LOCATION) << "Failed to load scene from '" << mModelPath << "': " << loader.GetParseError();
+ }
+ }
+ else if(extension == GLTF_EXTENSION)
+ {
+ Dali::Scene3D::Loader::ShaderDefinitionFactory sdf;
+ sdf.SetResources(resources);
+ Dali::Scene3D::Loader::LoadGltfScene(mModelPath, sdf, output);
+
+ resources.mEnvironmentMaps.push_back({});
+ }
+ else
+ {
+ DALI_LOG_ERROR("Unsupported model type.\n");
+ }
+
+ Dali::Scene3D::Loader::Transforms xforms{Dali::Scene3D::Loader::MatrixStack{}, Dali::Scene3D::Loader::ViewProjection{}};
+ Dali::Scene3D::Loader::NodeDefinition::CreateParams nodeParams{resources, xforms, {}, {}, {}};
+ Dali::Scene3D::Loader::Customization::Choices choices;
+
+ mModelRoot = Actor::New();
+
+ BoundingVolume AABB;
+ for(auto iRoot : scene.GetRoots())
+ {
+ auto resourceRefs = resources.CreateRefCounter();
+ scene.CountResourceRefs(iRoot, choices, resourceRefs);
+ resources.CountEnvironmentReferences(resourceRefs);
+
+ resources.LoadResources(resourceRefs, pathProvider);
+
+ // glTF Mesh is defined in right hand coordinate system, with positive Y for Up direction.
+ // Because DALi uses left hand system, Y direciton will be flipped for environment map sampling.
+ for(auto&& env : resources.mEnvironmentMaps)
+ {
+ env.first.mYDirection = Y_DIRECTION;
+ }
+
+ 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));
+
+ mModelRoot.Add(actor);
+ }
+
+ AddModelTreeToAABB(AABB, scene, choices, iRoot, nodeParams, Matrix::IDENTITY);
+ }
+
+ if(!animations.empty())
+ {
+ auto getActor = [&](const std::string& name) {
+ return mModelRoot.FindChildByName(name);
+ };
+
+ mAnimations.clear();
+ for(auto&& animation : animations)
+ {
+ Dali::Animation anim = animation.ReAnimate(getActor);
+
+ mAnimations.push_back({animation.mName, anim});
+ }
+ }
+
+ SetImageBasedLight(mModelRoot);
+
+ mNaturalSize = AABB.CalculateSize();
+ mModelPivot = AABB.CalculatePivot();
+ mModelRoot.SetProperty(Dali::Actor::Property::SIZE, mNaturalSize);
+
+ FitModelPosition();
+ ScaleModel();
+
+ mModelLayer.Add(mModelRoot);
+}
+
+void ModelView::ScaleModel()
+{
+ if(mModelRoot)
+ {
+ if(mFitSize)
+ {
+ Vector3 size = Self().GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+ if(size.x > 0.0f && size.y > 0.0f)
+ {
+ float scaleFactor = MAXFLOAT;
+ scaleFactor = std::min(size.x / mNaturalSize.x, scaleFactor);
+ scaleFactor = std::min(size.y / mNaturalSize.y, scaleFactor);
+ mModelRoot.SetProperty(Dali::Actor::Property::SCALE, scaleFactor);
+ }
+ else
+ {
+ DALI_LOG_ERROR("ModelView size is wrong.");
+ }
+ }
+ else
+ {
+ mModelRoot.SetProperty(Dali::Actor::Property::SCALE, 1.0f);
+ }
+ }
+}
+
+void ModelView::FitModelPosition()
+{
+ if(mModelRoot)
+ {
+ if(mFitCenter)
+ {
+ // 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);
+ }
+ else
+ {
+ mModelRoot.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ mModelRoot.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ }
+ }
+}
+
+void ModelView::SetImageBasedLight(Actor node)
+{
+ if(!mDiffuseTexture || !mSpecularTexture || !node)
+ {
+ return;
+ }
+
+ uint32_t rendererCount = node.GetRendererCount();
+ if(rendererCount)
+ {
+ node.RegisterProperty(Dali::Scene3D::Loader::NodeDefinition::GetIblScaleFactorUniformName().data(), mIblScaleFactor);
+ }
+
+ for(uint32_t i = 0; i < rendererCount; ++i)
+ {
+ Dali::Renderer renderer = node.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, mDiffuseTexture);
+ textures.SetTexture(textureCount - OFFSET_FOR_SPECULAR_CUBE_TEXTURE, mSpecularTexture);
+ }
+ }
+ }
+ }
+
+ uint32_t childrenCount = node.GetChildCount();
+ for(uint32_t i = 0; i < childrenCount; ++i)
+ {
+ SetImageBasedLight(node.GetChildAt(i));
+ }
+}
+
+} // namespace Internal
+} // namespace Scene3D
+} // namespace Dali
--- /dev/null
+#ifndef DALI_SCENE3D_INTERNAL_MODEL_VIEW_H
+#define DALI_SCENE3D_INTERNAL_MODEL_VIEW_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/animation/animation.h>
+#include <dali/public-api/rendering/texture.h>
+
+// INTERNAL INCLUDES
+#include <dali-scene3d/public-api/controls/model-view/model-view.h>
+
+namespace Dali
+{
+namespace Scene3D
+{
+class ModelView;
+
+namespace Internal
+{
+/**
+ * @brief Impl class for ModelView.
+ */
+class ModelView : public Dali::Toolkit::Internal::Control
+{
+public:
+ using AnimationData = std::pair<std::string, Dali::Animation>;
+
+ /**
+ * @brief Creates a new ModelView.
+ *
+ * @return A public handle to the newly allocated ModelView.
+ */
+ static Dali::Scene3D::ModelView New(const std::string& modelPath, const std::string& resourcePath);
+
+ /**
+ * @copydoc ModelView::GetModelRoot()
+ */
+ const Actor GetModelRoot();
+
+ /**
+ * @copydoc ModelView::FitModel()
+ */
+ void FitSize(bool fit);
+
+ /**
+ * @copydoc ModelView::FitCenter()
+ */
+ void FitCenter(bool fit);
+
+ /**
+ * @copydoc ModelView::SetImageBasedLightSource()
+ */
+ void SetImageBasedLightSource(const std::string& diffuse, const std::string& specular, float scaleFactor);
+
+ /**
+ * @copydoc ModelView::GetAnimationCount()
+ */
+ uint32_t GetAnimationCount();
+
+ /**
+ * @copydoc ModelView::GetAnimation()
+ */
+ Dali::Animation GetAnimation(uint32_t index);
+
+ /**
+ * @copydoc ModelView::GetAnimation()
+ */
+ Dali::Animation GetAnimation(const std::string& name);
+
+protected:
+ /**
+ * @brief Constructs a new ModelView.
+ */
+ ModelView(const std::string& modelPath, const std::string& resourcePath);
+
+ /**
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~ModelView();
+
+private:
+ /**
+ * @copydoc CustomActorImpl::OnSceneConnection()
+ */
+ void OnSceneConnection(int depth) override;
+
+ /**
+ * @copydoc Toolkit::Control::OnInitialize()
+ */
+ void OnInitialize() override;
+
+ /**
+ * @copydoc Toolkit::Control::GetNaturalSize
+ */
+ Vector3 GetNaturalSize() override;
+
+ /**
+ * @copydoc Toolkit::Control::GetHeightForWidth()
+ */
+ float GetHeightForWidth(float width) override;
+
+ /**
+ * @copydoc Toolkit::Control::GetWidthForHeight()
+ */
+ float GetWidthForHeight(float height) override;
+
+ /**
+ * @copydoc Toolkit::Control::OnRelayout()
+ */
+ void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
+
+ /**
+ * @brief Loads a model from file
+ */
+ void LoadModel();
+
+ /**
+ * @brief Scales the model to fit the control or to return to original size.
+ */
+ void ScaleModel();
+
+ /**
+ * @brief Changes model anchor point to set the model at center or returns to the original model pivot.
+ */
+ void FitModelPosition();
+
+ /**
+ * @brief Changes IBL information of the input node.
+ */
+ void SetImageBasedLight(Actor node);
+
+private:
+ std::string mModelPath;
+ std::string mResourcePath;
+ Dali::Layer mModelLayer;
+ Dali::Actor mModelRoot;
+ std::vector<AnimationData> mAnimations;
+
+ Dali::Texture mSpecularTexture;
+ Dali::Texture mDiffuseTexture;
+ Vector3 mNaturalSize;
+ Vector3 mModelPivot;
+ float mIblScaleFactor;
+ bool mFitSize;
+ bool mFitCenter;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+inline Dali::Scene3D::Internal::ModelView& GetImpl(Dali::Scene3D::ModelView& obj)
+{
+ DALI_ASSERT_ALWAYS(obj);
+ Dali::RefObject& handle = obj.GetImplementation();
+ return static_cast<Dali::Scene3D::Internal::ModelView&>(handle);
+}
+
+inline const Dali::Scene3D::Internal::ModelView& GetImpl(const Dali::Scene3D::ModelView& obj)
+{
+ DALI_ASSERT_ALWAYS(obj);
+ const Dali::RefObject& handle = obj.GetImplementation();
+ return static_cast<const Dali::Scene3D::Internal::ModelView&>(handle);
+}
+
+} // namespace Scene3D
+
+} // namespace Dali
+
+#endif // DALI_SCENE3D_INTERNAL_MODEL_VIEW_H
--- /dev/null
+set(scene3d_internal_dir "${scene3d_dir}/internal")
+
+set(scene3d_src_files ${scene3d_src_files}
+ ${scene3d_internal_dir}/loader/gltf2-asset.cpp
+ ${scene3d_internal_dir}/loader/hash.cpp
+ ${scene3d_internal_dir}/loader/json-reader.cpp
+ ${scene3d_internal_dir}/loader/json-util.cpp
+ ${scene3d_internal_dir}/controls/model-view/model-view-impl.cpp
+)
#endif
//// For IBL
+uniform sampler2D sbrdfLUT;
uniform samplerCube sDiffuseEnvSampler;
uniform samplerCube sSpecularEnvSampler;
-uniform sampler2D sbrdfLUT;
uniform float uIblIntensity;
+uniform vec3 uYDirection;
// For Alpha Mode.
uniform lowp float uOpaque;
mediump vec3 reflection = -normalize(reflect(v, n));
lowp vec3 color = vec3(0.0);
- lowp vec3 diffuseLight = linear(texture(sDiffuseEnvSampler, n).rgb);
- lowp vec3 specularLight = linear(texture(sSpecularEnvSampler, reflection).rgb);
+ lowp vec3 diffuseLight = linear(texture(sDiffuseEnvSampler, n * uYDirection).rgb);
+ lowp vec3 specularLight = linear(texture(sSpecularEnvSampler, reflection * uYDirection).rgb);
// retrieve a scale and bias to F0. See [1], Figure 3
lowp vec3 brdf = linear(texture(sbrdfLUT, vec2(NdotV, 1.0 - perceptualRoughness)).rgb);
/*
-* 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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/internal/gltf2-asset.h"
+#include "dali-scene3d/internal/loader/gltf2-asset.h"
#include <algorithm>
#include <map>
#include "dali/public-api/math/matrix.h"
-#ifndef DALI_SCENE_LOADER_GLTF2_ASSET_H_
-#define DALI_SCENE_LOADER_GLTF2_ASSET_H_
+#ifndef DALI_SCENE3D_LOADER_GLTF2_ASSET_H_
+#define DALI_SCENE3D_LOADER_GLTF2_ASSET_H_
/*
* Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/internal/json-reader.h"
-#include "dali-scene-loader/public-api/index.h"
+#include "dali-scene3d/internal/loader/json-reader.h"
+#include "dali-scene3d/public-api/loader/index.h"
// EXTERNAL INCLUDES
#include <cstdint>
namespace gltf2
{
-using Index = Dali::SceneLoader::Index;
+using Index = Dali::Scene3D::Loader::Index;
template<typename T>
class Ref
private:
std::vector<T>* mVector = nullptr;
- Index mIndex = Dali::SceneLoader::INVALID_INDEX;
+ Index mIndex = Dali::Scene3D::Loader::INVALID_INDEX;
};
struct Asset
} // namespace gltf2
-#endif //DALI_SCENE_LOADER_GLTF2_ASSET_H_
+#endif //DALI_SCENE3D_LOADER_GLTF2_ASSET_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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/internal/hash.h"
+#include "dali-scene3d/internal/loader/hash.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
Hash::Hash(uint64_t initial)
: mValue(initial)
return mValue * 31 + value;
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_HASH_H_
-#define DALI_SCENE_LOADER_HASH_H_
+#ifndef DALI_SCENE3D_LOADER_HASH_H_
+#define DALI_SCENE3D_LOADER_HASH_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.
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/**
* @brief Rudimentary hash generator that follows a builder pattern.
return *this;
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif // DALI_SCENE_LOADER_HASH_H_
+#endif // DALI_SCENE3D_LOADER_HASH_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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/internal/json-reader.h"
+#include "dali-scene3d/internal/loader/json-reader.h"
#include <algorithm>
#include <cstring>
-#ifndef DALI_SCENE_LOADER_JSON_READER_H_
-#define DALI_SCENE_LOADER_JSON_READER_H_
+#ifndef DALI_SCENE3D_LOADER_JSON_READER_H_
+#define DALI_SCENE3D_LOADER_JSON_READER_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/third-party/json.h"
+#include "dali-scene3d/third-party/json.h"
// EXTERNAL INCLUDES
#include <algorithm>
} // namespace json
-#endif //DALI_SCENE_LOADER_JSON_READER_H_
+#endif //DALI_SCENE3D_LOADER_JSON_READER_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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/internal/json-util.h"
+#include "dali-scene3d/internal/loader/json-util.h"
// EXTERNAL INCLUDES
#include <array>
{
using namespace Toolkit;
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
return propValue;
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_JSON_UTIL_H_
-#define DALI_SCENE_LOADER_JSON_UTIL_H_
+#ifndef DALI_SCENE3D_LOADER_JSON_UTIL_H_
+#define DALI_SCENE3D_LOADER_JSON_UTIL_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/index.h"
+#include "dali-scene3d/public-api/loader/index.h"
// EXTERNAL INCLUDES
#include "dali-toolkit/devel-api/builder/tree-node.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
bool ReadBool(const Toolkit::TreeNode* node, bool& num);
*/
Property::Value ReadPropertyValue(const Toolkit::TreeNode& tn);
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_JSON_UTIL_H_
+#endif //DALI_SCENE3D_LOADER_JSON_UTIL_H_
-#ifndef DALI_SCENE_LOADER_API_H
-#define DALI_SCENE_LOADER_API_H
+#ifndef DALI_SCENE3D_API_H
+#define DALI_SCENE3D_API_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.
*/
#if __GNUC__ >= 4
-#define DALI_SCENE_LOADER_API __attribute__((visibility("default")))
+#define DALI_SCENE3D_API __attribute__((visibility("default")))
#elif defined(WIN32)
-#ifdef BUILDING_DALI_SCENE_LOADER
-#define DALI_SCENE_LOADER_API __declspec(dllexport)
+#ifdef BUILDING_DALI_SCENE3D
+#define DALI_SCENE3D_API __declspec(dllexport)
#else
-#define DALI_SCENE_LOADER_API __declspec(dllimport)
-#endif // BUILDING_DALI_SCENE_LOADER
+#define DALI_SCENE3D_API __declspec(dllimport)
+#endif // BUILDING_DALI_SCENE3D
#endif
-#endif //DALI_SCENE_LOADER_API_H
+#endif //DALI_SCENE3D_API_H
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-scene3d/public-api/controls/model-view/model-view.h>
+
+// INTERNAL INCLUDES
+#include <dali-scene3d/internal/controls/model-view/model-view-impl.h>
+
+namespace Dali
+{
+namespace Scene3D
+{
+ModelView::ModelView()
+{
+}
+
+ModelView::ModelView(const ModelView& modelView) = default;
+
+ModelView::ModelView(ModelView&& rhs) = default;
+
+ModelView& ModelView::operator=(const ModelView& modelView) = default;
+
+ModelView& ModelView::operator=(ModelView&& rhs) = default;
+
+ModelView::~ModelView()
+{
+}
+
+ModelView ModelView::New(const std::string& modelPath, const std::string& resourcePath)
+{
+ return Internal::ModelView::New(modelPath, resourcePath);
+}
+
+ModelView ModelView::DownCast(BaseHandle handle)
+{
+ return Control::DownCast<ModelView, Internal::ModelView>(handle);
+}
+
+ModelView::ModelView(Internal::ModelView& implementation)
+: Control(implementation)
+{
+}
+
+ModelView::ModelView(Dali::Internal::CustomActor* internal)
+: Control(internal)
+{
+ VerifyCustomActorPointer<Internal::ModelView>(internal);
+}
+
+const Actor ModelView::GetModelRoot()
+{
+ return GetImpl(*this).GetModelRoot();
+}
+
+void ModelView::FitSize(bool fit)
+{
+ GetImpl(*this).FitSize(fit);
+}
+
+void ModelView::FitCenter(bool fit)
+{
+ GetImpl(*this).FitCenter(fit);
+}
+
+void ModelView::SetImageBasedLightSource(const std::string& diffuse, const std::string& specular, float scaleFactor)
+{
+ GetImpl(*this).SetImageBasedLightSource(diffuse, specular, scaleFactor);
+}
+
+uint32_t ModelView::GetAnimationCount()
+{
+ return GetImpl(*this).GetAnimationCount();
+}
+
+Dali::Animation ModelView::GetAnimation(uint32_t index)
+{
+ return GetImpl(*this).GetAnimation(index);
+}
+
+Dali::Animation ModelView::GetAnimation(const std::string& name)
+{
+ return GetImpl(*this).GetAnimation(name);
+}
+
+} // namespace Scene3D
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_SCENE3D_MODEL_VIEW_H
+#define DALI_SCENE3D_MODEL_VIEW_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-scene3d/public-api/api.h>
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control.h>
+#include <dali/public-api/common/dali-common.h>
+
+namespace Dali
+{
+namespace Scene3D
+{
+namespace Internal DALI_INTERNAL
+{
+class ModelView;
+}
+
+/**
+ * @addtogroup dali_toolkit_controls_model_view
+ * @{
+ */
+
+/**
+ * @brief ModelView is a control to show 3D model objects.
+ * ModelView supports to load glTF 2.0 and DLI models for the input format
+ * and also supports Physically Based Rendering with Image Based Lighting.
+ *
+ * The Animations defined in the glTF or DLI models are also loaded and can be retrieved by using GetAnimation() method.
+ * The number of animation is also retrieved by GetAnimationCount() method.
+ *
+ * By default, The loaded model has it's own position and size which are defined in vertex buffer regardless of the Control size.
+ * The model can be resized and repositioned to fit to the ModelView Control with FitSize() and FitCenter() methods.
+ *
+ * @code
+ *
+ * ModelView modelView = ModelView::New(modelUrl);
+ * modelView.SetProperty(Dali::Actor::Property::SIZE, Vector2(width, height));
+ * modelView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
+ * modelView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
+ * modelView.SetImageBasedLightSource(diffuseUrl, specularUrl, scaleFactor);
+ * modelView.FitSize(true);
+ * modelView.FitCenter(true);
+ * window.Add(modelView);
+ * uint32_t animationCount = modelView.GetAnimationCount();
+ * Dali::Animation animation = modelView.GetAnimation(0);
+ * animation.Play();
+ *
+ * @endcode
+ */
+class DALI_SCENE3D_API ModelView : public Dali::Toolkit::Control
+{
+public:
+ /**
+ * @brief Create an initialized ModelView.
+ * @param[in] modelPath model file path.(e.g., glTF, and DLI).
+ * @param[in] resourcePath resource file path that includes binary, image etc.
+ * @note If resourcePath is empty, the parent directory path of modelPath is used for resource path.
+ * @return A handle to a newly allocated Dali resource
+ */
+ static ModelView New(const std::string& modelPath, const std::string& resourcePath = std::string());
+
+ /**
+ * @brief Creates an uninitialized ModelView.
+ *
+ * Only derived versions can be instantiated. Calling member
+ * functions with an uninitialized Dali::Object is not allowed.
+ */
+ ModelView();
+
+ /**
+ * @brief Destructor.
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~ModelView();
+
+ /**
+ * @brief Copy constructor.
+ * @param[in] modelView Handle to an object
+ */
+ ModelView(const ModelView& modelView);
+
+ /**
+ * @brief Move constructor
+ *
+ * @param[in] rhs A reference to the moved handle
+ */
+ ModelView(ModelView&& rhs);
+
+ /**
+ * @brief Assignment operator.
+ * @param[in] modelView Handle to an object
+ * @return reference to this
+ */
+ ModelView& operator=(const ModelView& modelView);
+
+ /**
+ * @brief Move assignment
+ *
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this
+ */
+ ModelView& operator=(ModelView&& rhs);
+
+ /**
+ * @brief Downcasts an Object handle to ModelView.
+ *
+ * If handle points to a ModelView, the downcast produces valid handle.
+ * If not, the returned handle is left uninitialized.
+ *
+ * @param[in] handle Handle to an object
+ * @return Handle to a ModelView or an uninitialized handle
+ */
+ static ModelView DownCast(BaseHandle handle);
+
+ /**
+ * @brief Retrieves model root Actor.
+ * @return Root Actor of the model.
+ */
+ const Actor GetModelRoot();
+
+ /**
+ * @brief Fits the model to the Control size.
+ * @param[in] fit true to fit model size to control.
+ * @note This method makes model fit to the Control size by keeping original model ratio.
+ * It means If model size is (2, 2, 2) and ModelView size is (10, 8), then the model become looks (8, 8, 8).
+ * If ModelView Size x or y is 0, this method don't work anything.
+ * If ModelView Size z is 0, this method considers only x and y values of ModelView Size.
+ */
+ void FitSize(bool fit);
+
+ /**
+ * @brief Moves the model to the center of control.
+ * @param[in] fit true to fit model to center of control.
+ * @note This method doesn't changes size of model.
+ */
+ void FitCenter(bool fit);
+
+ /**
+ * @brief Changes Image Based Light as the input textures.
+ * @param[in] diffuse cube map that can be used as a diffuse IBL source.
+ * @param[in] specular cube map that can be used as a specular IBL source.
+ * @param[in] scaleFactor scale factor that controls light source intensity in [0.0f, 1.0f]. Default value is 1.0f.
+ */
+ void SetImageBasedLightSource(const std::string& diffuse, const std::string& specular, float scaleFactor = 1.0f);
+
+ /**
+ * @brief Gets number of animations those loaded from model file.
+ * @return The number of loaded animations.
+ * @note This method should be called after Model load finished.
+ */
+ uint32_t GetAnimationCount();
+
+ /**
+ * @brief Gets animation at the index.
+ * @param[in] index Index of animation to be retrieved.
+ * @return Animation at the index.
+ * @note This method should be called after Model load finished.
+ */
+ Dali::Animation GetAnimation(uint32_t index);
+
+ /**
+ * @brief Retrieves animation with the given name.
+ * @param[in] name string name of animation to be retrieved.
+ * @return Animation that has the given name.
+ * @note This method should be called after Model load finished.
+ */
+ Dali::Animation GetAnimation(const std::string& name);
+
+public: // Not intended for application developers
+ /// @cond internal
+ /**
+ * @brief Creates a handle using the Toolkit::Internal implementation.
+ *
+ * @param[in] implementation The Control implementation
+ */
+ DALI_INTERNAL ModelView(Internal::ModelView& implementation);
+
+ /**
+ * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
+ *
+ * @param[in] internal A pointer to the internal CustomActor
+ */
+ DALI_INTERNAL ModelView(Dali::Internal::CustomActor* internal);
+ /// @endcond
+};
+
+/**
+ * @}
+ */
+} // namespace Scene3D
+
+} // namespace Dali
+
+#endif // DALI_SCENE3D_MODEL_VIEW_H
--- /dev/null
+set(scene3d_public_api_dir "${scene3d_dir}/public-api")
+
+set(scene3d_src_files ${scene3d_src_files}
+ ${scene3d_public_api_dir}/controls/model-view/model-view.cpp
+ ${scene3d_public_api_dir}/loader/alpha-function-helper.cpp
+ ${scene3d_public_api_dir}/loader/animated-property.cpp
+ ${scene3d_public_api_dir}/loader/animation-definition.cpp
+ ${scene3d_public_api_dir}/loader/blend-shape-details.cpp
+ ${scene3d_public_api_dir}/loader/bvh-loader.cpp
+ ${scene3d_public_api_dir}/loader/camera-parameters.cpp
+ ${scene3d_public_api_dir}/loader/cube-data.cpp
+ ${scene3d_public_api_dir}/loader/cube-loader.cpp
+ ${scene3d_public_api_dir}/loader/cube-map-loader.cpp
+ ${scene3d_public_api_dir}/loader/customization.cpp
+ ${scene3d_public_api_dir}/loader/dli-loader.cpp
+ ${scene3d_public_api_dir}/loader/environment-definition.cpp
+ ${scene3d_public_api_dir}/loader/facial-animation-loader.cpp
+ ${scene3d_public_api_dir}/loader/gltf2-loader.cpp
+ ${scene3d_public_api_dir}/loader/ktx-loader.cpp
+ ${scene3d_public_api_dir}/loader/material-definition.cpp
+ ${scene3d_public_api_dir}/loader/matrix-stack.cpp
+ ${scene3d_public_api_dir}/loader/mesh-definition.cpp
+ ${scene3d_public_api_dir}/loader/node-definition.cpp
+ ${scene3d_public_api_dir}/loader/parse-renderer-state.cpp
+ ${scene3d_public_api_dir}/loader/renderer-state.cpp
+ ${scene3d_public_api_dir}/loader/resource-bundle.cpp
+ ${scene3d_public_api_dir}/loader/scene-definition.cpp
+ ${scene3d_public_api_dir}/loader/shader-definition.cpp
+ ${scene3d_public_api_dir}/loader/shader-definition-factory.cpp
+ ${scene3d_public_api_dir}/loader/skinning-details.cpp
+ ${scene3d_public_api_dir}/loader/string-callback.cpp
+ ${scene3d_public_api_dir}/loader/utils.cpp
+ ${scene3d_public_api_dir}/loader/view-projection.cpp
+)
\ No newline at end of file
/*
- * 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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/public-api/alpha-function-helper.h"
+#include "dali-scene3d/public-api/loader/alpha-function-helper.h"
#include <unordered_map>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
"Function with given key already exists.");
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_ALPHA_FUNCTION_HELPER_H_
-#define DALI_SCENE_LOADER_ALPHA_FUNCTION_HELPER_H_
+#ifndef DALI_SCENE3D_LOADER_ALPHA_FUNCTION_HELPER_H_
+#define DALI_SCENE3D_LOADER_ALPHA_FUNCTION_HELPER_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.
*
*/
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
#include <string>
#include "dali/public-api/animation/alpha-function.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/**
* @return Given a name, provide a AlphaFunction; if the name was not
* recognised, get the default one.
*/
-AlphaFunction DALI_SCENE_LOADER_API GetAlphaFunction(const std::string& name, bool* found = nullptr);
+AlphaFunction DALI_SCENE3D_API GetAlphaFunction(const std::string& name, bool* found = nullptr);
/**
* @brief Registers an alpha function only if one with the same @a name has
* not yet been registered. Throws Exception the name isn't unique.
*/
-void DALI_SCENE_LOADER_API RegisterAlphaFunction(const std::string& name, AlphaFunction alphaFn) noexcept(false);
+void DALI_SCENE3D_API RegisterAlphaFunction(const std::string& name, AlphaFunction alphaFn) noexcept(false);
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_ALPHA_FUNCTION_HELPER_H_
+#endif //DALI_SCENE3D_LOADER_ALPHA_FUNCTION_HELPER_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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/public-api/animated-property.h"
+#include "dali-scene3d/public-api/loader/animated-property.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
void AnimatedProperty::Animate(Animation& anim, GetActor getActor)
{
}
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_ANIMATED_PROPERTY_H
-#define DALI_SCENE_LOADER_ANIMATED_PROPERTY_H
+#ifndef DALI_SCENE3D_LOADER_ANIMATED_PROPERTY_H
+#define DALI_SCENE3D_LOADER_ANIMATED_PROPERTY_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include <functional>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/**
* @brief Intermediate representation for a property that's given to
* changing properties (e.g. from the SDK) requires the whole Animation
* object to be recreated with all of its properties (incl. modifications).
*/
-struct DALI_SCENE_LOADER_API AnimatedProperty
+struct DALI_SCENE3D_API AnimatedProperty
{
public: // METHODS
/**
TimePeriod mTimePeriod = TimePeriod(0.f);
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_ANIMATED_PROPERTY_H
+#endif //DALI_SCENE3D_LOADER_ANIMATED_PROPERTY_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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/public-api/animation-definition.h"
+#include "dali-scene3d/public-api/loader/animation-definition.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
const float AnimationDefinition::DEFAULT_DURATION_SECONDS = 1.f;
const float AnimationDefinition::MIN_DURATION_SECONDS = 1e-2f;
return *this;
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_ANIMATION_DEFINITION_H
-#define DALI_SCENE_LOADER_ANIMATION_DEFINITION_H
+#ifndef DALI_SCENE3D_LOADER_ANIMATION_DEFINITION_H
+#define DALI_SCENE3D_LOADER_ANIMATION_DEFINITION_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.
*
*/
-#include "dali-scene-loader/public-api/animated-property.h"
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
+#include "dali-scene3d/public-api/loader/animated-property.h"
#include "dali/public-api/common/vector-wrapper.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/**
* @brief Animation handle + name + definition of properties.
*/
-class DALI_SCENE_LOADER_API AnimationDefinition
+class DALI_SCENE3D_API AnimationDefinition
{
public: // STATIC
// For Animations created in the SDK.
std::vector<std::string> mAnimations;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_ANIMATION_DEFINITION_H
+#endif //DALI_SCENE3D_LOADER_ANIMATION_DEFINITION_H
*/
// FILE HEADER
-#include <dali-scene-loader/public-api/blend-shape-details.h>
+#include <dali-scene3d/public-api/loader/blend-shape-details.h>
// EXTERNAL INCLUDES
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/object/property.h>
// INTERNAL INCLUDES
-#include <dali-scene-loader/public-api/resource-bundle.h>
+#include <dali-scene3d/public-api/loader/resource-bundle.h>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
const std::string BlendShapes::NUMBER_OF_BLEND_SHAPES("uNumberOfBlendShapes");
const std::string BlendShapes::UNNORMALIZE_FACTOR("uBlendShapeUnnormalizeFactor");
}
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H
-#define DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H
+#ifndef DALI_SCENE3D_LOADER_BLEND_SHAPE_DETAILS_H
+#define DALI_SCENE3D_LOADER_BLEND_SHAPE_DETAILS_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include <string>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
struct MeshDefinition;
struct MeshGeometry;
-struct DALI_SCENE_LOADER_API BlendShapes
+struct DALI_SCENE3D_API BlendShapes
{
enum class Version
{
BlendShapes() = delete;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif // DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H
+#endif // DALI_SCENE3D_LOADER_BLEND_SHAPE_DETAILS_H
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// FILE HEADER
+#include <dali-scene3d/public-api/loader/bvh-loader.h>
+
+// EXTERNAL INCLUDES
+#include <fstream>
+#include <iostream>
+#include <memory>
+#include <sstream>
+#include <string_view>
+
+namespace Dali
+{
+namespace Scene3D
+{
+namespace Loader
+{
+namespace
+{
+static constexpr std::string_view TOKEN_OFFSET = "OFFSET";
+static constexpr std::string_view TOKEN_CHANNELS = "CHANNELS";
+static constexpr std::string_view TOKEN_XPOSITION = "Xposition";
+static constexpr std::string_view TOKEN_YPOSITION = "Yposition";
+static constexpr std::string_view TOKEN_ZPOSITION = "Zposition";
+static constexpr std::string_view TOKEN_XROTATION = "Xrotation";
+static constexpr std::string_view TOKEN_YROTATION = "Yrotation";
+static constexpr std::string_view TOKEN_ZROTATION = "Zrotation";
+static constexpr std::string_view TOKEN_JOINT = "JOINT";
+static constexpr std::string_view TOKEN_END_SITE = "End Site";
+static constexpr std::string_view TOKEN_FRAMES = "Frames";
+static constexpr std::string_view TOKEN_FRAME_TIME = "Frame Time";
+static constexpr std::string_view TOKEN_HIERARCHY = "HIERARCHY";
+static constexpr std::string_view TOKEN_ROOT = "ROOT";
+static constexpr std::string_view TOKEN_MOTION = "MOTION";
+static constexpr std::string_view PROPERTY_NAME_POSITION = "position";
+static constexpr std::string_view PROPERTY_NAME_ORIENTATION = "orientation";
+static constexpr std::string_view TOKEN_CLOSING_BRACE = "}";
+
+enum class Channel
+{
+ XPOSITION = 0,
+ YPOSITION,
+ ZPOSITION,
+ XROTATION,
+ YROTATION,
+ ZROTATION
+};
+
+struct Frame
+{
+ std::vector<float> values;
+};
+
+struct Joint
+{
+ std::string name;
+ Vector3 offset;
+ std::vector<Vector3> translations;
+ std::vector<Quaternion> rotations;
+ std::vector<Channel> channels;
+ std::vector<std::shared_ptr<Joint>> children;
+};
+
+void trim(std::string& s)
+{
+ s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int ch) {
+ return !std::isspace(ch);
+ }));
+ s.erase(std::find_if(s.rbegin(), s.rend(), [](int ch) {
+ return !std::isspace(ch);
+ }).base(),
+ s.end());
+}
+
+void ParseHierarchy(std::ifstream& file, std::shared_ptr<Joint>& joint)
+{
+ std::string line;
+ while(std::getline(file, line))
+ {
+ trim(line);
+ std::istringstream stream(line);
+ std::string token;
+ std::getline(stream, token, ' ');
+
+ if(token == TOKEN_OFFSET.data())
+ {
+ stream >> joint->offset.x >> joint->offset.y >> joint->offset.z;
+ }
+ else if(token == TOKEN_CHANNELS.data())
+ {
+ uint32_t channelCount = 0;
+ std::getline(stream, token, ' ');
+ channelCount = static_cast<uint32_t>(std::atoi(token.c_str()));
+ for(uint32_t i = 0; i < channelCount; ++i)
+ {
+ std::getline(stream, token, ' ');
+ trim(token);
+ if(token == TOKEN_XPOSITION.data())
+ {
+ joint->channels.push_back(Channel::XPOSITION);
+ }
+ else if(token == TOKEN_YPOSITION.data())
+ {
+ joint->channels.push_back(Channel::YPOSITION);
+ }
+ else if(token == TOKEN_ZPOSITION.data())
+ {
+ joint->channels.push_back(Channel::ZPOSITION);
+ }
+ else if(token == TOKEN_XROTATION.data())
+ {
+ joint->channels.push_back(Channel::XROTATION);
+ }
+ else if(token == TOKEN_YROTATION.data())
+ {
+ joint->channels.push_back(Channel::YROTATION);
+ }
+ else if(token == TOKEN_ZROTATION.data())
+ {
+ joint->channels.push_back(Channel::ZROTATION);
+ }
+ }
+ }
+ else if(token == TOKEN_JOINT.data())
+ {
+ std::shared_ptr<Joint> child(new Joint);
+ joint->children.push_back(child);
+ std::getline(stream, token, ' ');
+ child->name = token;
+ ParseHierarchy(file, child);
+ }
+ else if(line == TOKEN_END_SITE.data())
+ {
+ while(std::getline(file, line))
+ {
+ trim(line);
+ if(line == TOKEN_CLOSING_BRACE.data())
+ {
+ break;
+ }
+ }
+ }
+ else if(token == TOKEN_CLOSING_BRACE.data())
+ {
+ break;
+ }
+ }
+}
+
+void MakeList(std::shared_ptr<Joint>& joint, std::vector<std::shared_ptr<Joint>>& jointList)
+{
+ jointList.push_back(joint);
+ for(uint32_t i = 0; i < joint->children.size(); ++i)
+ {
+ MakeList(joint->children[i], jointList);
+ }
+}
+
+void ParseMotion(std::ifstream& file, std::shared_ptr<Joint>& hierarchy, uint32_t& frameCount, float& frameTime)
+{
+ std::vector<std::shared_ptr<Joint>> jointList;
+ MakeList(hierarchy, jointList);
+
+ bool frameCountLoaded = false;
+ bool frameTimeLoaded = false;
+ std::string line;
+ while((!frameCountLoaded || !frameTimeLoaded) && std::getline(file, line))
+ {
+ trim(line);
+ std::istringstream stream(line);
+ std::string token;
+ std::getline(stream, token, ':');
+ trim(token);
+ if(token == TOKEN_FRAMES.data())
+ {
+ stream >> frameCount;
+ frameCountLoaded = true;
+ }
+ else if(token == TOKEN_FRAME_TIME.data())
+ {
+ stream >> frameTime;
+ frameTimeLoaded = true;
+ }
+ }
+
+ while(getline(file, line))
+ {
+ trim(line);
+ std::istringstream stream(line);
+ for(auto&& joint : jointList)
+ {
+ Vector3 translation;
+ Quaternion rotation[3];
+ for(uint32_t i = 0; i < joint->channels.size(); ++i)
+ {
+ if(joint->channels[i] == Channel::XPOSITION)
+ {
+ stream >> translation.x;
+ }
+ else if(joint->channels[i] == Channel::YPOSITION)
+ {
+ stream >> translation.y;
+ }
+ else if(joint->channels[i] == Channel::ZPOSITION)
+ {
+ stream >> translation.z;
+ }
+ else if(joint->channels[i] == Channel::XROTATION)
+ {
+ float radian;
+ stream >> radian;
+ rotation[0] = Quaternion(Radian(Degree(radian)), Vector3::XAXIS);
+ }
+ else if(joint->channels[i] == Channel::YROTATION)
+ {
+ float radian;
+ stream >> radian;
+ rotation[1] = Quaternion(Radian(Degree(radian)), Vector3::YAXIS);
+ }
+ else if(joint->channels[i] == Channel::ZROTATION)
+ {
+ float radian;
+ stream >> radian;
+ rotation[2] = Quaternion(Radian(Degree(radian)), Vector3::ZAXIS);
+ }
+ }
+ joint->translations.push_back(translation);
+ joint->rotations.push_back(rotation[2] * rotation[0] * rotation[1]);
+ }
+ }
+}
+
+bool ParseBvh(const std::string& path, uint32_t& frameCount, float& frameTime, std::shared_ptr<Joint>& rootJoint)
+{
+ std::ifstream file(path.data());
+ if(!file.is_open())
+ {
+ return false;
+ }
+
+ std::string line;
+ while(getline(file, line))
+ {
+ trim(line);
+ std::istringstream stream(line);
+ std::string token;
+ std::getline(stream, token, ' ');
+ if(token == TOKEN_HIERARCHY.data())
+ {
+ std::string line;
+ while(getline(file, line))
+ {
+ trim(line);
+ std::istringstream stream(line);
+ std::string token;
+ std::getline(stream, token, ' ');
+ if(token == TOKEN_ROOT.data())
+ {
+ std::getline(stream, token, ' ');
+ rootJoint->name = token;
+ ParseHierarchy(file, rootJoint);
+ break;
+ }
+ }
+ }
+ if(token == TOKEN_MOTION.data())
+ {
+ ParseMotion(file, rootJoint, frameCount, frameTime);
+ }
+ }
+ return true;
+}
+
+AnimationDefinition GenerateAnimation(const std::string& animationName, std::shared_ptr<Joint>& hierarchy, uint32_t frameCount, float frameTime, const Vector3& scale)
+{
+ AnimationDefinition animationDefinition;
+
+ animationDefinition.mName = animationName;
+ animationDefinition.mDuration = frameTime * (frameCount - 1);
+ float keyFrameInterval = (frameCount > 1u) ? 1.0f / static_cast<float>(frameCount - 1u) : Dali::Math::MACHINE_EPSILON_10;
+
+ std::vector<std::shared_ptr<Joint>> jointList;
+ MakeList(hierarchy, jointList);
+
+ if(!jointList.empty())
+ {
+ animationDefinition.mProperties.resize(jointList.size() * 2u); // translation and rotation
+ for(uint32_t i = 0; i < jointList.size(); ++i)
+ {
+ AnimatedProperty& translationProperty = animationDefinition.mProperties[i * 2u];
+ translationProperty.mTimePeriod = Dali::TimePeriod(animationDefinition.mDuration);
+ translationProperty.mNodeName = jointList[i]->name;
+ translationProperty.mPropertyName = PROPERTY_NAME_POSITION.data();
+
+ AnimatedProperty& rotationProperty = animationDefinition.mProperties[i * 2u + 1];
+ rotationProperty.mTimePeriod = Dali::TimePeriod(animationDefinition.mDuration);
+ rotationProperty.mNodeName = jointList[i]->name;
+ rotationProperty.mPropertyName = PROPERTY_NAME_ORIENTATION.data();
+
+ translationProperty.mKeyFrames = Dali::KeyFrames::New();
+ rotationProperty.mKeyFrames = Dali::KeyFrames::New();
+ for(uint32_t j = 0; j < frameCount; ++j)
+ {
+ translationProperty.mKeyFrames.Add(static_cast<float>(j) * keyFrameInterval, (jointList[i]->translations[j] / scale));
+ rotationProperty.mKeyFrames.Add(static_cast<float>(j) * keyFrameInterval, jointList[i]->rotations[j]);
+ }
+ }
+ }
+
+ return animationDefinition;
+}
+} // namespace
+
+AnimationDefinition LoadBvh(const std::string& path, const std::string& animationName, const Vector3& scale)
+{
+ uint32_t frameCount = 0;
+ float frameTime = 0.0f;
+ std::shared_ptr<Joint> rootJoint(new Joint);
+ if(!ParseBvh(path, frameCount, frameTime, rootJoint))
+ {
+ AnimationDefinition animationDefinition;
+ return animationDefinition;
+ }
+
+ return GenerateAnimation(animationName, rootJoint, frameCount, frameTime, scale);
+}
+} // namespace Loader
+} // namespace Scene3D
+} // namespace Dali
\ No newline at end of file
--- /dev/null
+#ifndef DALI_SCENE3D_LOADER_BVH_LOADER_H
+#define DALI_SCENE3D_LOADER_BVH_LOADER_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-scene3d/public-api/loader/animation-definition.h>
+
+namespace Dali
+{
+namespace Scene3D
+{
+namespace Loader
+{
+
+/**
+ * @brief Loads motion capture data from bvh file format.
+ *
+ * @param[in] path The file path.
+ * @param[in] animationName Name of the motion capture animation
+ * @param[in] scale The scale factor to set on the position property manually.
+ * @return AnimationDefinition that includes joint animation information.
+ */
+DALI_SCENE3D_API AnimationDefinition LoadBvh(const std::string& path, const std::string& animationName, const Vector3& scale = Vector3::ONE);
+
+} // namespace Loader
+} // namespace Scene3D
+} // namespace Dali
+
+#endif // DALI_SCENE3D_LOADER_BVH_LOADER_H
\ No newline at end of file
/*
- * 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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/public-api/camera-parameters.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/loader/camera-parameters.h"
+#include "dali-scene3d/public-api/loader/utils.h"
#include "dali/integration-api/debug.h"
#include "dali/public-api/actors/camera-actor.h"
#include "dali/public-api/math/quaternion.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
camera.SetProperty(Actor::Property::SCALE, camScale);
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_CAMERA_PARAMETERS_H
-#define DALI_SCENE_LOADER_CAMERA_PARAMETERS_H
+#ifndef DALI_SCENE3D_LOADER_CAMERA_PARAMETERS_H
+#define DALI_SCENE3D_LOADER_CAMERA_PARAMETERS_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
-#include "dali-scene-loader/public-api/view-projection.h"
+#include "dali-scene3d/public-api/api.h"
+#include "dali-scene3d/public-api/loader/view-projection.h"
// EXTERNAL INCLUDES
#include "dali/public-api/math/matrix.h"
{
class CameraActor;
-namespace SceneLoader
+namespace Scene3D
{
-struct DALI_SCENE_LOADER_API CameraParameters
+namespace Loader
+{
+struct DALI_SCENE3D_API CameraParameters
{
Matrix matrix = Matrix::IDENTITY;
Vector4 orthographicSize = Vector4{-1.f, 1.f, 1.f, -1.f};
/**
* @brief Configures the camera in the way that it is supposed to be used with
- * scene-loader scenes. This means inverted Y and a rotation of 180 degrees
+ * scene3d scenes. This means inverted Y and a rotation of 180 degrees
* along the Y axis, plus whatever the parameters define.
*/
void ConfigureCamera(CameraActor& camera) const;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif // DALI_SCENE_LOADER_CAMERA_PARAMETERS_H
+#endif // DALI_SCENE3D_LOADER_CAMERA_PARAMETERS_H
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// FILE HEADER
+#include "dali-scene3d/public-api/loader/cube-data.h"
+
+// EXTERNAL INCLUDES
+#include "dali/public-api/rendering/texture.h"
+
+namespace Dali
+{
+namespace Scene3D
+{
+namespace Loader
+{
+Texture CubeData::CreateTexture() const
+{
+ Texture texture = Texture::New(TextureType::TEXTURE_CUBE, data[0][0].GetPixelFormat(), data[0][0].GetWidth(), data[0][0].GetHeight());
+ for(size_t iSide = 0u, iEndSize = data.size(); iSide < iEndSize; ++iSide)
+ {
+ auto& side = data[iSide];
+ for(size_t iMipLevel = 0u, iEndMipLevel = data[0].size(); iMipLevel < iEndMipLevel; ++iMipLevel)
+ {
+ texture.Upload(side[iMipLevel], CubeMapLayer::POSITIVE_X + iSide, iMipLevel, 0u, 0u, side[iMipLevel].GetWidth(), side[iMipLevel].GetHeight());
+ }
+ }
+
+ // If mipmap is not defined explicitly, use GenerateMipmaps.
+ // TODO: Maybe we can use better way to know it already has mipmap or not.
+ if(data.size() > 0u && data[0].size() == 1u)
+ {
+ texture.GenerateMipmaps();
+ }
+
+ return texture;
+}
+
+} // namespace Loader
+} // namespace Scene3D
+} // namespace Dali
-#ifndef DALI_SCENE_LOADER_KTX_LOADER_H
-#define DALI_SCENE_LOADER_KTX_LOADER_H
+#ifndef DALI_SCENE3D_LOADER_CUBE_DATA_H
+#define DALI_SCENE3D_LOADER_CUBE_DATA_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include "dali/public-api/common/vector-wrapper.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/**
* @brief Stores the pixel data objects for each face of the cube texture and their mipmaps.
*/
-struct DALI_SCENE_LOADER_API CubeData
+class DALI_SCENE3D_API CubeData
{
- std::vector<std::vector<PixelData> > data;
-
+public:
+ /**
+ * @brief Create cube texture from image file
+ * @return Texture loaded cube texture.
+ */
Texture CreateTexture() const;
-};
-/**
- * @brief Loads cube map data texture from a ktx file.
- *
- * @param[in] path The file path.
- * @param[out] cubedata The data structure with all pixel data objects.
- */
-DALI_SCENE_LOADER_API bool LoadCubeMapData(const std::string& path, CubeData& cubedata);
+public:
+ std::vector<std::vector<PixelData> > data;
+};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif // DALI_SCENE_LOADER_KTX_LOADER_H
+#endif // DALI_SCENE3D_LOADER_CUBE_DATA_H
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// FILE HEADER
+#include <dali-scene3d/public-api/loader/cube-loader.h>
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/image-loading.h>
+#include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/rendering/texture.h>
+#include <dali/integration-api/debug.h>
+#include <string.h>
+
+namespace Dali
+{
+namespace
+{
+/**
+ * @brief cube map face index
+ * Cube map layer order is as fallows:
+ * POSITIVE_X, NEGATIVE_X, POSITIVE_Y, NEGATIVE_Y, POSITIVE_Z, NEGATIVE_Z. @see CubeMapLayer
+ * The indices are for 4 kind of environment cube map. Cross_horizontal, Array_horizontal, Cross_vertical, and Array_vertical.
+ */
+const uint32_t CUBEMAP_INDEX_X[4][6] = {{2, 0, 1, 1, 1, 3}, {0, 1, 2, 3, 4, 5}, {1, 1, 1, 1, 0, 2}, {0, 0, 0, 0, 0, 0}};
+const uint32_t CUBEMAP_INDEX_Y[4][6] = {{1, 1, 0, 2, 1, 1}, {0, 0, 0, 0, 0, 0}, {1, 3, 0, 2, 1, 1}, {0, 1, 2, 3, 4, 5}};
+
+enum CubeType
+{
+ CROSS_HORIZONTAL = 0, // Cross horizontal style cube map
+ ARRAY_HORIZONTAL, // array horizontal style cube map
+ CROSS_VERTICAL, // Cross vertical style cube map
+ ARRAY_VERTICAL, // array vertical style cube map
+ NONE
+};
+
+uint8_t* GetCroppedBuffer(uint8_t* sourceBuffer, uint32_t bytesPerPixel, uint32_t width, uint32_t height, uint32_t xOffset, uint32_t yOffset, uint32_t xFaceSize, uint32_t yFaceSize)
+{
+ uint32_t byteSize = bytesPerPixel * xFaceSize * yFaceSize;
+ uint8_t* destBuffer = reinterpret_cast<uint8_t*>(malloc(byteSize + 4u));
+
+ int32_t srcStride = width * bytesPerPixel;
+ int32_t destStride = xFaceSize * bytesPerPixel;
+ int32_t srcOffset = xOffset * bytesPerPixel + yOffset * srcStride;
+ int32_t destOffset = 0;
+ for(uint16_t row = yOffset; row < yOffset + yFaceSize; ++row)
+ {
+ memcpy(destBuffer + destOffset, sourceBuffer + srcOffset, destStride);
+ srcOffset += srcStride;
+ destOffset += destStride;
+ }
+
+ return destBuffer;
+}
+
+PixelData GetCubeFace(Devel::PixelBuffer pixelBuffer, uint32_t faceIndex, CubeType cubeType, uint32_t faceSize)
+{
+ PixelData pixelData;
+ if(cubeType != NONE)
+ {
+ uint8_t* imageBuffer = pixelBuffer.GetBuffer();
+ uint32_t bytesPerPixel = Pixel::GetBytesPerPixel(pixelBuffer.GetPixelFormat());
+ uint32_t imageWidth = pixelBuffer.GetWidth();
+ uint32_t imageHeight = pixelBuffer.GetHeight();
+
+ uint32_t xOffset = CUBEMAP_INDEX_X[cubeType][faceIndex] * faceSize;
+ uint32_t yOffset = CUBEMAP_INDEX_Y[cubeType][faceIndex] * faceSize;
+
+ uint8_t* tempImageBuffer = GetCroppedBuffer(imageBuffer, bytesPerPixel, imageWidth, imageHeight, xOffset, yOffset, faceSize, faceSize);
+ pixelData = PixelData::New(tempImageBuffer, faceSize * faceSize * bytesPerPixel, faceSize, faceSize, pixelBuffer.GetPixelFormat(), PixelData::FREE);
+ }
+ return pixelData;
+}
+} // namespace
+
+namespace Scene3D
+{
+namespace Loader
+{
+bool LoadCubeData(const std::string& path, CubeData& cubedata)
+{
+ Texture cubeTexture;
+ // Diffuse Cube Map
+ if(path.empty())
+ {
+ return false;
+ }
+
+ Devel::PixelBuffer pixelBuffer = LoadImageFromFile(path);
+ if(pixelBuffer)
+ {
+ uint32_t imageWidth = pixelBuffer.GetWidth();
+ uint32_t imageHeight = pixelBuffer.GetHeight();
+
+ uint32_t faceSize = 0;
+ CubeType cubeType = NONE;
+ if(imageWidth / 4 == imageHeight / 3)
+ {
+ cubeType = CROSS_HORIZONTAL;
+ faceSize = imageWidth / 4;
+ }
+ else if(imageWidth / 6 == imageHeight)
+ {
+ cubeType = ARRAY_HORIZONTAL;
+ faceSize = imageHeight;
+ }
+ else if(imageWidth / 3 == imageHeight / 4)
+ {
+ cubeType = CROSS_VERTICAL;
+ faceSize = imageHeight / 4;
+ }
+ else if(imageWidth == imageHeight / 6)
+ {
+ cubeType = ARRAY_VERTICAL;
+ faceSize = imageWidth;
+ }
+ else
+ {
+ DALI_LOG_ERROR("The image is not a cube map\n");
+ return false;
+ }
+
+ cubedata.data.resize(6);
+ for(uint32_t i = 0; i < 6; ++i)
+ {
+ cubedata.data[i].resize(1);
+ }
+ for(uint32_t i = 0; i < 6; ++i)
+ {
+ cubedata.data[i][0] = GetCubeFace(pixelBuffer, i, cubeType, faceSize);
+ }
+
+ return true;
+ }
+ return false;
+}
+
+} // namespace Loader
+} // namespace Scene3D
+} // namespace Dali
--- /dev/null
+#ifndef DALI_SCENE3D_LOADER_CUBE_LOADER_H
+#define DALI_SCENE3D_LOADER_CUBE_LOADER_H
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-scene3d/public-api/api.h>
+#include <dali-scene3d/public-api/loader/cube-data.h>
+
+namespace Dali
+{
+namespace Scene3D
+{
+namespace Loader
+{
+/**
+ * @brief Loads cube map data texture from a cube style image file.
+ *
+ * @param[in] path The file path.
+ * @param[out] cubedata The data structure with all pixel data objects.
+ * @return bool True if the loading is succeded.
+ */
+bool LoadCubeData(const std::string& path, CubeData& cubedata);
+
+} // namespace Loader
+} // namespace Scene3D
+} // namespace Dali
+
+#endif // DALI_SCENE3D_LOADER_CUBE_LOADER_H
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// FILE HEADER
+#include <dali-scene3d/public-api/loader/cube-map-loader.h>
+
+// INTERNAL INCLUDES
+#include <dali-scene3d/public-api/loader/cube-loader.h>
+#include <dali-scene3d/public-api/loader/ktx-loader.h>
+
+// EXTERNAL INCLUDES
+#include <filesystem>
+
+namespace Dali
+{
+namespace
+{
+const std::string_view KTX_EXTENSION = ".ktx";
+}
+
+namespace Scene3D
+{
+namespace Loader
+{
+bool LoadCubeMapData(const std::string& path, CubeData& cubedata)
+{
+ std::filesystem::path modelPath(path);
+ std::string extension = modelPath.extension();
+ std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
+
+ return (extension == KTX_EXTENSION) ? Dali::Scene3D::Loader::LoadKtxData(path, cubedata) : Dali::Scene3D::Loader::LoadCubeData(path, cubedata);
+}
+
+} // namespace Loader
+} // namespace Scene3D
+} // namespace Dali
--- /dev/null
+#ifndef DALI_SCENE3D_LOADER_CUBE_MAP_LOADER_H
+#define DALI_SCENE3D_LOADER_CUBE_MAP_LOADER_H
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-scene3d/public-api/api.h>
+#include <dali-scene3d/public-api/loader/cube-data.h>
+
+namespace Dali
+{
+namespace Scene3D
+{
+namespace Loader
+{
+/**
+ * @brief Loads cube map data texture from a cube map file.
+ *
+ * @param[in] path The file path.
+ * @param[out] cubedata The data structure with all pixel data objects.
+ * @return bool True if the loading is succeded.
+ */
+bool LoadCubeMapData(const std::string& path, CubeData& cubedata);
+
+} // namespace Loader
+} // namespace Scene3D
+} // namespace Dali
+
+#endif // DALI_SCENE3D_LOADER_CUBE_MAP_LOADER_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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/public-api/customization.h"
+#include "dali-scene3d/public-api/loader/customization.h"
#include "dali/devel-api/common/map-wrapper.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
struct Customization::Map::Impl
{
mImpl->mOptions.clear();
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_
-#define DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_
+#ifndef DALI_SCENE3D_LOADER_CUSTOMIZATION_STATE_H_
+#define DALI_SCENE3D_LOADER_CUSTOMIZATION_STATE_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include <memory>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/**
* @brief Offers a description of an aspect of the scene that can be customized:
* the number of options, and the name of the nodes that are registered
* for the tag, whose children will be shown / hidden based on selection.
*/
-struct DALI_SCENE_LOADER_API Customization
+struct DALI_SCENE3D_API Customization
{
using Tag = std::string;
using OptionType = uint32_t;
/**
* @brief A mapping of customizations to tags.
*/
- struct DALI_SCENE_LOADER_API Map
+ struct DALI_SCENE3D_API Map
{
Map();
~Map();
/**
* @brief A mapping of choices - indices of children of customization nodes to use - to tags.
*/
- struct DALI_SCENE_LOADER_API Choices
+ struct DALI_SCENE3D_API Choices
{
Choices();
~Choices();
std::vector<std::string> nodes; // to apply option to.
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_CUSTOMIZATION_STATE_H_
+#endif //DALI_SCENE3D_LOADER_CUSTOMIZATION_STATE_H_
*/
// CLASS HEADER
-#include "dali-scene-loader/public-api/dli-loader.h"
+#include "dali-scene3d/public-api/loader/dli-loader.h"
// EXTERNAL INCLUDES
#include <algorithm>
#include "dali/public-api/object/property-array.h"
// INTERNAL INCLUDES
-#include "dali-scene-loader/internal/json-util.h"
-#include "dali-scene-loader/public-api/alpha-function-helper.h"
-#include "dali-scene-loader/public-api/animation-definition.h"
-#include "dali-scene-loader/public-api/blend-shape-details.h"
-#include "dali-scene-loader/public-api/camera-parameters.h"
-#include "dali-scene-loader/public-api/ktx-loader.h"
-#include "dali-scene-loader/public-api/light-parameters.h"
-#include "dali-scene-loader/public-api/load-result.h"
-#include "dali-scene-loader/public-api/parse-renderer-state.h"
-#include "dali-scene-loader/public-api/scene-definition.h"
-#include "dali-scene-loader/public-api/skinning-details.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/internal/loader/json-util.h"
+#include "dali-scene3d/public-api/loader/alpha-function-helper.h"
+#include "dali-scene3d/public-api/loader/animation-definition.h"
+#include "dali-scene3d/public-api/loader/blend-shape-details.h"
+#include "dali-scene3d/public-api/loader/camera-parameters.h"
+#include "dali-scene3d/public-api/loader/ktx-loader.h"
+#include "dali-scene3d/public-api/loader/light-parameters.h"
+#include "dali-scene3d/public-api/loader/load-result.h"
+#include "dali-scene3d/public-api/loader/parse-renderer-state.h"
+#include "dali-scene3d/public-api/loader/scene-definition.h"
+#include "dali-scene3d/public-api/loader/skinning-details.h"
+#include "dali-scene3d/public-api/loader/utils.h"
#define DLI_0_1_COMPATIBILITY
{
using namespace Toolkit;
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace rs = RendererState;
// get index of root node.
auto docRoot = mParser.GetRoot();
-
- // Process resources first - these are shared
- if(auto environments = docRoot->GetChild("environment"))
+ if(docRoot)
{
- ParseEnvironments(environments, output.mResources); // NOTE: must precede parsing of materials
- }
+ // Process resources first - these are shared
+ if(auto environments = docRoot->GetChild("environment"))
+ {
+ ParseEnvironments(environments, output.mResources); // NOTE: must precede parsing of materials
+ }
- if(auto meshes = docRoot->GetChild("meshes"))
- {
- ParseMeshes(meshes, output.mResources);
- }
+ if(auto meshes = docRoot->GetChild("meshes"))
+ {
+ ParseMeshes(meshes, output.mResources);
+ }
- if(auto shaders = docRoot->GetChild("shaders"))
- {
- ParseShaders(shaders, output.mResources);
- }
+ if(auto shaders = docRoot->GetChild("shaders"))
+ {
+ ParseShaders(shaders, output.mResources);
+ }
- if(auto materials = docRoot->GetChild("materials"))
- {
- ParseMaterials(materials, input.mConvertColorCode, output.mResources);
- }
+ if(auto materials = docRoot->GetChild("materials"))
+ {
+ ParseMaterials(materials, input.mConvertColorCode, output.mResources);
+ }
- for(auto& c : input.mPreNodeCategoryProcessors)
- {
- if(auto node = docRoot->GetChild(c.first))
+ for(auto& c : input.mPreNodeCategoryProcessors)
{
- Property::Array array;
- ParseProperties(*node, array);
- c.second(std::move(array), mOnError);
+ if(auto node = docRoot->GetChild(c.first))
+ {
+ Property::Array array;
+ ParseProperties(*node, array);
+ c.second(std::move(array), mOnError);
+ }
}
- }
- // Process scenes
- Index iScene = 0; // default scene
- ReadIndex(docRoot->GetChild("scene"), iScene);
+ // Process scenes
+ Index iScene = 0; // default scene
+ ReadIndex(docRoot->GetChild("scene"), iScene);
- auto tnScenes = RequireChild(docRoot, "scenes");
- auto tnNodes = RequireChild(docRoot, "nodes");
- ParseSceneInternal(iScene, tnScenes, tnNodes, params);
+ auto tnScenes = RequireChild(docRoot, "scenes");
+ auto tnNodes = RequireChild(docRoot, "nodes");
+ ParseSceneInternal(iScene, tnScenes, tnNodes, params);
- ParseSkeletons(docRoot->GetChild("skeletons"), output.mScene, output.mResources);
+ ParseSkeletons(docRoot->GetChild("skeletons"), output.mScene, output.mResources);
- output.mScene.EnsureUniqueSkinningShaderInstances(output.mResources);
- output.mScene.EnsureUniqueBlendShapeShaderInstances(output.mResources);
+ output.mScene.EnsureUniqueSkinningShaderInstances(output.mResources);
+ output.mScene.EnsureUniqueBlendShapeShaderInstances(output.mResources);
- // Ger cameras and lights
- GetCameraParameters(output.mCameraParameters);
- GetLightParameters(output.mLightParameters);
+ // Ger cameras and lights
+ GetCameraParameters(output.mCameraParameters);
+ GetLightParameters(output.mLightParameters);
- // Post-node processors and animations last
- for(auto& c : input.mPostNodeCategoryProcessors)
- {
- if(auto node = docRoot->GetChild(c.first))
+ // Post-node processors and animations last
+ for(auto& c : input.mPostNodeCategoryProcessors)
{
- Property::Array array;
- ParseProperties(*node, array);
- c.second(std::move(array), mOnError);
+ if(auto node = docRoot->GetChild(c.first))
+ {
+ Property::Array array;
+ ParseProperties(*node, array);
+ c.second(std::move(array), mOnError);
+ }
}
- }
- if(auto animations = docRoot->GetChild("animations"))
- {
- ParseAnimations(animations, params);
- }
+ if(auto animations = docRoot->GetChild("animations"))
+ {
+ ParseAnimations(animations, params);
+ }
- if(!output.mAnimationDefinitions.empty())
- {
- if(auto animationGroups = docRoot->GetChild("animationGroups"))
+ if(!output.mAnimationDefinitions.empty())
{
- ParseAnimationGroups(animationGroups, params);
+ if(auto animationGroups = docRoot->GetChild("animationGroups"))
+ {
+ ParseAnimationGroups(animationGroups, params);
+ }
}
}
}
void DliLoader::Impl::ParseSceneInternal(Index iScene, const Toolkit::TreeNode* tnScenes, const Toolkit::TreeNode* tnNodes, LoadParams& params)
{
- auto getSceneRootIdx = [tnScenes, tnNodes](Index iScene) {
+ auto getSceneRootIdx = [tnScenes, tnNodes](Index iScene)
+ {
auto tn = GetNthChild(tnScenes, iScene); // now a "scene" object
if(!tn)
{
void DliLoader::Impl::GetCameraParameters(std::vector<CameraParameters>& cameras) const
{
- if(const TreeNode* jsonCameras = mParser.GetRoot()->GetChild("cameras"))
+ if(mParser.GetRoot())
{
- cameras.resize(jsonCameras->Size());
- auto iCamera = cameras.begin();
- for(auto i0 = jsonCameras->CBegin(), i1 = jsonCameras->CEnd(); i0 != i1; ++i0)
+ if(const TreeNode* jsonCameras = mParser.GetRoot()->GetChild("cameras"))
{
- auto& jsonCamera = (*i0).second;
-
- ReadFloat(jsonCamera.GetChild("fov"), iCamera->yFov);
- ReadFloat(jsonCamera.GetChild("near"), iCamera->zNear);
- ReadFloat(jsonCamera.GetChild("far"), iCamera->zFar);
- if(ReadVector(jsonCamera.GetChild("orthographic"), iCamera->orthographicSize.AsFloat(), 4u))
+ cameras.resize(jsonCameras->Size());
+ auto iCamera = cameras.begin();
+ for(auto i0 = jsonCameras->CBegin(), i1 = jsonCameras->CEnd(); i0 != i1; ++i0)
{
- iCamera->isPerspective = false;
- }
+ auto& jsonCamera = (*i0).second;
- if(auto jsonMatrix = jsonCamera.GetChild("matrix"))
- {
- ReadVector(jsonMatrix, iCamera->matrix.AsFloat(), 16u);
- }
+ ReadFloat(jsonCamera.GetChild("fov"), iCamera->yFov);
+ ReadFloat(jsonCamera.GetChild("near"), iCamera->zNear);
+ ReadFloat(jsonCamera.GetChild("far"), iCamera->zFar);
+ if(ReadVector(jsonCamera.GetChild("orthographic"), iCamera->orthographicSize.AsFloat(), 4u))
+ {
+ iCamera->isPerspective = false;
+ }
+
+ if(auto jsonMatrix = jsonCamera.GetChild("matrix"))
+ {
+ ReadVector(jsonMatrix, iCamera->matrix.AsFloat(), 16u);
+ }
- ++iCamera;
+ ++iCamera;
+ }
}
}
}
void DliLoader::Impl::GetLightParameters(std::vector<LightParameters>& lights) const
{
- if(const TreeNode* jsonLights = mParser.GetRoot()->GetChild("lights"))
+ if(mParser.GetRoot())
{
- lights.resize(jsonLights->Size());
- auto iLight = lights.begin();
- for(auto i0 = jsonLights->CBegin(), i1 = jsonLights->CEnd(); i0 != i1; ++i0)
+ if(const TreeNode* jsonLights = mParser.GetRoot()->GetChild("lights"))
{
- auto& jsonLight = (*i0).second;
- if(!ReadVector(jsonLight.GetChild("matrix"), iLight->transform.AsFloat(), 16))
+ lights.resize(jsonLights->Size());
+ auto iLight = lights.begin();
+ for(auto i0 = jsonLights->CBegin(), i1 = jsonLights->CEnd(); i0 != i1; ++i0)
{
- mOnError(
- FormatString("Failed to parse light %d - \"matrix\" child with 16 floats expected.\n",
- std::distance(jsonLights->CBegin(), i0)));
- continue;
- }
+ auto& jsonLight = (*i0).second;
+ if(!ReadVector(jsonLight.GetChild("matrix"), iLight->transform.AsFloat(), 16))
+ {
+ mOnError(
+ FormatString("Failed to parse light %d - \"matrix\" child with 16 floats expected.\n",
+ std::distance(jsonLights->CBegin(), i0)));
+ continue;
+ }
- int shadowMapSize = 0;
- if(ReadInt(jsonLight.GetChild(SHADOW_MAP_SIZE), shadowMapSize) && shadowMapSize < 0)
- {
- mOnError(
- FormatString("Failed to parse light %d - %s has an invalid value.",
- std::distance(jsonLights->CBegin(), i0),
- SHADOW_MAP_SIZE));
- continue;
- }
- iLight->shadowMapSize = shadowMapSize;
+ int shadowMapSize = 0;
+ if(ReadInt(jsonLight.GetChild(SHADOW_MAP_SIZE), shadowMapSize) && shadowMapSize < 0)
+ {
+ mOnError(
+ FormatString("Failed to parse light %d - %s has an invalid value.",
+ std::distance(jsonLights->CBegin(), i0),
+ SHADOW_MAP_SIZE));
+ continue;
+ }
+ iLight->shadowMapSize = shadowMapSize;
- float orthoSize = 0.f;
- if(ReadFloat(jsonLight.GetChild(ORTHOGRAPHIC_SIZE), orthoSize) &&
- (orthoSize < .0f || std::isnan(orthoSize) || std::isinf(orthoSize)))
- {
- mOnError(
- FormatString("Failed to parse light %d - %s has an invalid value.",
- std::distance(jsonLights->CBegin(), i0),
- ORTHOGRAPHIC_SIZE));
- continue;
- }
- iLight->orthographicSize = orthoSize;
+ float orthoSize = 0.f;
+ if(ReadFloat(jsonLight.GetChild(ORTHOGRAPHIC_SIZE), orthoSize) &&
+ (orthoSize < .0f || std::isnan(orthoSize) || std::isinf(orthoSize)))
+ {
+ mOnError(
+ FormatString("Failed to parse light %d - %s has an invalid value.",
+ std::distance(jsonLights->CBegin(), i0),
+ ORTHOGRAPHIC_SIZE));
+ continue;
+ }
+ iLight->orthographicSize = orthoSize;
- if((iLight->shadowMapSize > 0) != (iLight->orthographicSize > .0f))
- {
- mOnError(FormatString(
- "Light %d: Both shadow map size and orthographic size must be set for shadows to work.",
- std::distance(jsonLights->CBegin(), i0)));
- }
+ if((iLight->shadowMapSize > 0) != (iLight->orthographicSize > .0f))
+ {
+ mOnError(FormatString(
+ "Light %d: Both shadow map size and orthographic size must be set for shadows to work.",
+ std::distance(jsonLights->CBegin(), i0)));
+ }
- if(!ReadVector(jsonLight.GetChild("color"), iLight->color.AsFloat(), 3)) // color is optional
- {
- iLight->color = Vector3::ONE; // default to white
- }
+ if(!ReadVector(jsonLight.GetChild("color"), iLight->color.AsFloat(), 3)) // color is optional
+ {
+ iLight->color = Vector3::ONE; // default to white
+ }
- if(!ReadFloat(jsonLight.GetChild("intensity"), iLight->intensity)) // intensity is optional
- {
- iLight->intensity = 1.0f; // default to 1.0
- }
+ if(!ReadFloat(jsonLight.GetChild("intensity"), iLight->intensity)) // intensity is optional
+ {
+ iLight->intensity = 1.0f; // default to 1.0
+ }
- if(!ReadFloat(jsonLight.GetChild("shadowIntensity"), iLight->shadowIntensity)) // intensity is optional
- {
- iLight->shadowIntensity = 1.0f; // default to 1.0
- }
+ if(!ReadFloat(jsonLight.GetChild("shadowIntensity"), iLight->shadowIntensity)) // intensity is optional
+ {
+ iLight->shadowIntensity = 1.0f; // default to 1.0
+ }
- ++iLight;
+ ++iLight;
+ }
}
}
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_DLI_LOADER_H
-#define DALI_SCENE_LOADER_DLI_LOADER_H
+#ifndef DALI_SCENE3D_LOADER_DLI_LOADER_H
+#define DALI_SCENE3D_LOADER_DLI_LOADER_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/animation-definition.h"
-#include "dali-scene-loader/public-api/api.h"
-#include "dali-scene-loader/public-api/customization.h"
-#include "dali-scene-loader/public-api/index.h"
-#include "dali-scene-loader/public-api/string-callback.h"
+#include "dali-scene3d/public-api/api.h"
+#include "dali-scene3d/public-api/loader/animation-definition.h"
+#include "dali-scene3d/public-api/loader/customization.h"
+#include "dali-scene3d/public-api/loader/index.h"
+#include "dali-scene3d/public-api/loader/string-callback.h"
// EXTERNAL INCLUDES
#include "dali/public-api/common/vector-wrapper.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
typedef std::pair<std::string, std::string> Metadata;
struct NodeDefinition;
class SceneDefinition;
-class DALI_SCENE_LOADER_API DliLoader
+class DALI_SCENE3D_API DliLoader
{
public:
using ConvertFontCode = void (*)(const std::string& code, std::string& fontFamily, std::string& slant, std::string& weight, float& size);
const std::unique_ptr<Impl> mImpl;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif // DALI_SCENE_LOADER_DLI_LOADER_H
+#endif // DALI_SCENE3D_LOADER_DLI_LOADER_H
#include <dali/devel-api/adaptor-framework/image-loading.h>
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/environment-definition.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/loader/cube-map-loader.h"
+#include "dali-scene3d/public-api/loader/environment-definition.h"
+#include "dali-scene3d/public-api/loader/utils.h"
namespace
{
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
return textures;
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H
-#define DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H
+#ifndef DALI_SCENE3D_LOADER_ENVIRONMENT_DEFINITION_H
+#define DALI_SCENE3D_LOADER_ENVIRONMENT_DEFINITION_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
-#include "dali-scene-loader/public-api/ktx-loader.h"
+#include "dali-scene3d/public-api/api.h"
+#include "dali-scene3d/public-api/loader/cube-data.h"
// EXTERNAL INCLUDES
#include "dali/public-api/math/quaternion.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/**
* @brief Defines an environment map with either or both of radiance
* and irradiance maps.
*/
-struct DALI_SCENE_LOADER_API EnvironmentDefinition
+struct DALI_SCENE3D_API EnvironmentDefinition
{
struct Textures
{
std::string mDiffuseMapPath;
std::string mSpecularMapPath;
Quaternion mCubeOrientation = Quaternion::IDENTITY;
+ Vector3 mYDirection = Vector3::ONE;
float mIblIntensity = 1.0f;
bool mUseBrdfTexture = false;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_ENVIRONMENT_DEFINITION_H
+#endif //DALI_SCENE3D_LOADER_ENVIRONMENT_DEFINITION_H
*/\r
\r
// FILE HEADER\r
-#include <dali-scene-loader/public-api/facial-animation-loader.h>\r
+#include <dali-scene3d/public-api/loader/facial-animation-loader.h>\r
\r
// EXTERNAL INCLUDES\r
#include <sstream>\r
\r
// INTERNAL INCLUDES\r
-#include <dali-scene-loader/internal/json-reader.h>\r
-#include <dali-scene-loader/public-api/blend-shape-details.h>\r
-#include <dali-scene-loader/public-api/utils.h>\r
+#include <dali-scene3d/internal/loader/json-reader.h>\r
+#include <dali-scene3d/public-api/loader/blend-shape-details.h>\r
+#include <dali-scene3d/public-api/loader/utils.h>\r
\r
namespace js = json;\r
\r
\r
} // unnamed namespace\r
\r
-namespace SceneLoader\r
+namespace Scene3D\r
+{\r
+namespace Loader\r
{\r
AnimationDefinition LoadFacialAnimation(const std::string& url)\r
{\r
return animationDefinition;\r
}\r
\r
-} // namespace SceneLoader\r
+} // namespace Loader\r
+} // namespace Scene3D\r
} // namespace Dali\r
-#ifndef DALI_SCENE_LOADER_FACIAL_ANIMATION_LOADER_H\r
-#define DALI_SCENE_LOADER_FACIAL_ANIMATION_LOADER_H\r
+#ifndef DALI_SCENE3D_LOADER_FACIAL_ANIMATION_LOADER_H\r
+#define DALI_SCENE3D_LOADER_FACIAL_ANIMATION_LOADER_H\r
\r
/*\r
* Copyright (c) 2022 Samsung Electronics Co., Ltd.\r
*/\r
\r
// INTERNAL INCLUDES\r
-#include <dali-scene-loader/public-api/animation-definition.h>\r
+#include <dali-scene3d/public-api/loader/animation-definition.h>\r
\r
-namespace Dali::SceneLoader\r
+namespace Dali::Scene3D::Loader\r
{\r
/**\r
* @brief Loads a facial animation encoded in a json file in the given @p url.\r
*\r
* @return An animation definition.\r
*/\r
-DALI_SCENE_LOADER_API AnimationDefinition LoadFacialAnimation(const std::string& url);\r
-} // namespace Dali::SceneLoader\r
+DALI_SCENE3D_API AnimationDefinition LoadFacialAnimation(const std::string& url);\r
+} // namespace Dali::Scene3D::Loader\r
\r
-#endif // DALI_SCENE_LOADER_FACIAL_ANIMATION_LOADER_H\r
+#endif // DALI_SCENE3D_LOADER_FACIAL_ANIMATION_LOADER_H\r
* limitations under the License.
*
*/
-#include "dali-scene-loader/public-api/gltf2-loader.h"
+#include "dali-scene3d/public-api/loader/gltf2-loader.h"
#include <fstream>
-#include "dali-scene-loader/internal/gltf2-asset.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/shader-definition-factory.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/internal/loader/gltf2-asset.h"
+#include "dali-scene3d/public-api/loader/load-result.h"
+#include "dali-scene3d/public-api/loader/resource-bundle.h"
+#include "dali-scene3d/public-api/loader/scene-definition.h"
+#include "dali-scene3d/public-api/loader/shader-definition-factory.h"
+#include "dali-scene3d/public-api/loader/utils.h"
#include "dali/public-api/math/quaternion.h"
#define ENUM_STRING_MAPPING(t, x) \
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
return duration;
}
-float LoadBlendShapeKeyFrames(const std::string& path, const gt::Animation::Channel& channel, const std::string& nodeName, uint32_t& propertyIndex, std::vector<SceneLoader::AnimatedProperty>& properties)
+float LoadBlendShapeKeyFrames(const std::string& path, const gt::Animation::Channel& channel, const std::string& nodeName, uint32_t& propertyIndex, std::vector<Dali::Scene3D::Loader::AnimatedProperty>& properties)
{
const gltf2::Accessor& input = *channel.mSampler->mInput;
const gltf2::Accessor& output = *channel.mSampler->mOutput;
{
EnvironmentDefinition envDef;
envDef.mUseBrdfTexture = true;
- envDef.mIblIntensity = DEFAULT_INTENSITY;
+ envDef.mIblIntensity = DEFAULT_INTENSITY;
cctx.mOutput.mResources.mEnvironmentMaps.push_back({std::move(envDef), EnvironmentDefinition::Textures()});
}
isMRendererModel = (doc.mAsset.mGenerator.find(MRENDERER_MODEL_IDENTIFICATION) != std::string_view::npos);
}
-
gt::SetRefReaderObject(doc);
DOCUMENT_READER.Read(rootObj, doc);
SetDefaultEnvironmentMap(doc, cctx);
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_GLTF2_LOADER_H
-#define DALI_SCENE_LOADER_GLTF2_LOADER_H
+#ifndef DALI_SCENE3D_LOADER_GLTF2_LOADER_H
+#define DALI_SCENE3D_LOADER_GLTF2_LOADER_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include <string>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
struct CameraParameters;
struct LoadResult;
* @note Will throw std::runtime_error for JSON entities with types mismatching expectations, carrying
* invalid values, or I/O errors.
*/
-DALI_SCENE_LOADER_API void LoadGltfScene(const std::string& url, ShaderDefinitionFactory& shaderFactory, LoadResult& params);
+DALI_SCENE3D_API void LoadGltfScene(const std::string& url, ShaderDefinitionFactory& shaderFactory, LoadResult& params);
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_GLTF2_LOADER_H
+#endif //DALI_SCENE3D_LOADER_GLTF2_LOADER_H
-#ifndef DALI_SCENE_LOADER_INDEX_H_
-#define DALI_SCENE_LOADER_INDEX_H_
+#ifndef DALI_SCENE3D_LOADER_INDEX_H_
+#define DALI_SCENE3D_LOADER_INDEX_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include <cstdint>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
using Index = uint32_t;
constexpr Index INVALID_INDEX = static_cast<Index>(-1);
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_INDEX_H_
+#endif //DALI_SCENE3D_LOADER_INDEX_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.
*/
// FILE HEADER
-#include "dali-scene-loader/public-api/ktx-loader.h"
+#include <dali-scene3d/public-api/loader/ktx-loader.h>
// EXTERNAL INCLUDES
+#include <dali/public-api/rendering/texture.h>
#include <fstream>
#include <memory>
-#include "dali/public-api/rendering/texture.h"
namespace Dali
{
}
} // namespace
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
struct KtxFileHeader
{
return true;
}
-Texture CubeData::CreateTexture() const
-{
- Texture texture = Texture::New(TextureType::TEXTURE_CUBE, data[0][0].GetPixelFormat(), data[0][0].GetWidth(), data[0][0].GetHeight());
- for(size_t iSide = 0u, iEndSize = data.size(); iSide < iEndSize; ++iSide)
- {
- auto& side = data[iSide];
- for(size_t iMipLevel = 0u, iEndMipLevel = data[0].size(); iMipLevel < iEndMipLevel; ++iMipLevel)
- {
- texture.Upload(side[iMipLevel], CubeMapLayer::POSITIVE_X + iSide, iMipLevel, 0u, 0u, side[iMipLevel].GetWidth(), side[iMipLevel].GetHeight());
- }
- }
-
- return texture;
-}
-
-bool LoadCubeMapData(const std::string& path, CubeData& cubedata)
+bool LoadKtxData(const std::string& path, CubeData& cubedata)
{
std::fstream fp(path, std::ios::in | std::ios::binary);
if(fp.is_open() == false)
return true;
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
--- /dev/null
+#ifndef DALI_SCENE3D_LOADER_KTX_LOADER_H
+#define DALI_SCENE3D_LOADER_KTX_LOADER_H
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-scene3d/public-api/api.h>
+#include <dali-scene3d/public-api/loader/cube-data.h>
+
+namespace Dali
+{
+namespace Scene3D
+{
+namespace Loader
+{
+/**
+ * @brief Loads cube map data texture from a ktx file.
+ *
+ * @param[in] path The file path.
+ * @param[out] cubedata The data structure with all pixel data objects.
+ * @return bool True if the loading is succeded.
+ */
+bool LoadKtxData(const std::string& path, CubeData& cubedata);
+
+} // namespace Loader
+} // namespace Scene3D
+} // namespace Dali
+
+#endif // DALI_SCENE3D_LOADER_KTX_LOADER_H
-#ifndef DALI_SCENE_LOADER_LIGHT_PARAMETERS_H
-#define DALI_SCENE_LOADER_LIGHT_PARAMETERS_H
+#ifndef DALI_SCENE3D_LOADER_LIGHT_PARAMETERS_H
+#define DALI_SCENE3D_LOADER_LIGHT_PARAMETERS_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include <stdint.h>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
{
-struct DALI_SCENE_LOADER_API LightParameters
+namespace Loader
+{
+struct DALI_SCENE3D_API LightParameters
{
Matrix transform;
float orthographicSize;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif // DALI_SCENE_LOADER_LIGHT_PARAMETERS_H
+#endif // DALI_SCENE3D_LOADER_LIGHT_PARAMETERS_H
-#ifndef DALI_SCENE_LOADER_OUTPUT_H
-#define DALI_SCENE_LOADER_OUTPUT_H
+#ifndef DALI_SCENE3D_LOADER_OUTPUT_H
+#define DALI_SCENE3D_LOADER_OUTPUT_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/animation-definition.h"
-#include "dali-scene-loader/public-api/api.h"
-#include "dali-scene-loader/public-api/camera-parameters.h"
-#include "dali-scene-loader/public-api/light-parameters.h"
+#include "dali-scene3d/public-api/api.h"
+#include "dali-scene3d/public-api/loader/animation-definition.h"
+#include "dali-scene3d/public-api/loader/camera-parameters.h"
+#include "dali-scene3d/public-api/loader/light-parameters.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
class ResourceBundle;
class SceneDefinition;
/**
* @brief The outputs from loading and processing a scene.
*/
-struct DALI_SCENE_LOADER_API LoadResult
+struct DALI_SCENE3D_API LoadResult
{
/**
* @brief The bundle to store resources in.
std::vector<LightParameters>& mLightParameters;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_OUTPUT_H
+#endif //DALI_SCENE3D_LOADER_OUTPUT_H
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/material-definition.h"
+#include "dali-scene3d/public-api/loader/material-definition.h"
// EXTERNAL INCLUDES
#include "dali-toolkit/public-api/image-loader/sync-image-loader.h"
{
using namespace Toolkit;
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
if(mEnvironmentIdx < environments.size())
{
auto& envTextures = environments[mEnvironmentIdx].second;
+ // If pre-computed brdf texture is defined, set the texture.
+ if(envTextures.mBrdf)
+ {
+ textureSet.SetTexture(n, envTextures.mBrdf);
+ ++n;
+ }
+
if(envTextures.mDiffuse)
{
textureSet.SetTexture(n, envTextures.mDiffuse);
textureSet.SetSampler(n, specularSampler);
++n;
}
-
- // If pre-computed brdf texture is defined, set the texture.
- if(envTextures.mBrdf)
- {
- textureSet.SetTexture(n, envTextures.mBrdf);
- }
}
else
{
}) != mTextureStages.end();
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_MATERIAL_DEFINITION_H
-#define DALI_SCENE_LOADER_MATERIAL_DEFINITION_H
+#ifndef DALI_SCENE3D_LOADER_MATERIAL_DEFINITION_H
+#define DALI_SCENE3D_LOADER_MATERIAL_DEFINITION_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
-#include "dali-scene-loader/public-api/environment-definition.h"
-#include "dali-scene-loader/public-api/index.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/api.h"
+#include "dali-scene3d/public-api/loader/environment-definition.h"
+#include "dali-scene3d/public-api/loader/index.h"
+#include "dali-scene3d/public-api/loader/utils.h"
// EXTERNAL INCLUDES
#include <cmath>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/**
* @brief Helper enum for encoding and decoding sampler states.
*/
-struct DALI_SCENE_LOADER_API SamplerFlags
+struct DALI_SCENE3D_API SamplerFlags
{
using Type = uint8_t;
/**
* @brief Defines a texture from a combination of an image URI and its sampler definition.
*/
-struct DALI_SCENE_LOADER_API TextureDefinition
+struct DALI_SCENE3D_API TextureDefinition
{
std::string mImageUri;
SamplerFlags::Type mSamplerFlags;
* scene). Textures from the environment are added last when the DALi TextureSet
* is being created.
*/
-struct DALI_SCENE_LOADER_API MaterialDefinition
+struct DALI_SCENE3D_API MaterialDefinition
{
enum Flags : uint32_t
{
std::vector<TextureStage> mTextureStages;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_MATERIAL_DEFINITION_H
+#endif //DALI_SCENE3D_LOADER_MATERIAL_DEFINITION_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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/public-api/matrix-stack.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/loader/matrix-stack.h"
+#include "dali-scene3d/public-api/loader/utils.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
MatrixStack::MatrixStack()
{
mStack.clear();
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_MATRIX_STACK_H_
-#define DALI_SCENE_LOADER_MATRIX_STACK_H_
+#ifndef DALI_SCENE3D_LOADERER_MATRIX_STACK_H_
+#define DALI_SCENE3D_LOADERER_MATRIX_STACK_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include "dali/public-api/common/vector-wrapper.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/**
* @brief A stack of matrices whereby each newly pushed matrix is stored
* after being multiplied by the previous one (if any).
* @note Current implementation reserves space for 16 matrices.
*/
-class DALI_SCENE_LOADER_API MatrixStack
+class DALI_SCENE3D_API MatrixStack
{
public:
MatrixStack();
std::vector<Matrix> mStack;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_MATRIX_STACK_H_
+#endif //DALI_SCENE3D_LOADERER_MATRIX_STACK_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/mesh-definition.h"
+#include "dali-scene3d/public-api/loader/mesh-definition.h"
// EXTERNAL INCLUDES
#include <cstring>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
{
}
+void MeshDefinition::Blob::ComputeMinMax(std::vector<float>& min, std::vector<float>& max, uint32_t numComponents, uint32_t count, const float* values)
+{
+ min.assign(numComponents, MAXFLOAT);
+ max.assign(numComponents, -MAXFLOAT);
+ for(uint32_t i = 0; i < count; ++i)
+ {
+ for(uint32_t j = 0; j < numComponents; ++j)
+ {
+ min[j] = std::min(min[j], *values);
+ max[j] = std::max(max[j], *values);
+ values++;
+ }
+ }
+}
+
void MeshDefinition::Blob::ApplyMinMax(const std::vector<float>& min, const std::vector<float>& max, uint32_t count, float* values)
{
DALI_ASSERT_DEBUG(max.size() == min.size() || max.size() * min.size() == 0);
return IsConsecutive() ? mLength : (mLength * mElementSizeHint / mStride);
}
+void MeshDefinition::Blob::ComputeMinMax(uint32_t numComponents, uint32_t count, float* values)
+{
+ ComputeMinMax(mMin, mMax, numComponents, count, values);
+}
+
void MeshDefinition::Blob::ApplyMinMax(uint32_t count, float* values) const
{
ApplyMinMax(mMin, mMax, count, values);
}
MeshDefinition::RawData
-MeshDefinition::LoadRaw(const std::string& modelsPath) const
+MeshDefinition::LoadRaw(const std::string& modelsPath)
{
RawData raw;
if(IsQuad())
}
uint32_t numVector3 = bufferSize / sizeof(Vector3);
- mPositions.mBlob.ApplyMinMax(numVector3, reinterpret_cast<float*>(buffer.data()));
+ if(mPositions.mBlob.mMin.size() != 3u || mPositions.mBlob.mMax.size() != 3u)
+ {
+ mPositions.mBlob.ComputeMinMax(3u, numVector3, reinterpret_cast<float*>(buffer.data()));
+ }
+ else
+ {
+ mPositions.mBlob.ApplyMinMax(numVector3, reinterpret_cast<float*>(buffer.data()));
+ }
if(HasBlendShapes())
{
if(mColors.IsDefined())
{
- uint32_t propertySize = mColors.mBlob.mElementSizeHint;
+ uint32_t propertySize = mColors.mBlob.mElementSizeHint;
Property::Type propertyType = (propertySize == sizeof(Vector4)) ? Property::VECTOR4 : ((propertySize == sizeof(Vector3)) ? Property::VECTOR3 : Property::NONE);
if(propertyType != Property::NONE)
{
return meshGeometry;
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_MESH_DEFINITION_H
-#define DALI_SCENE_LOADER_MESH_DEFINITION_H
+#ifndef DALI_SCENE3D_LOADER_MESH_DEFINITION_H
+#define DALI_SCENE3D_LOADER_MESH_DEFINITION_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
-#include "dali-scene-loader/public-api/blend-shape-details.h"
-#include "dali-scene-loader/public-api/index.h"
-#include "dali-scene-loader/public-api/mesh-geometry.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/api.h"
+#include "dali-scene3d/public-api/loader/blend-shape-details.h"
+#include "dali-scene3d/public-api/loader/index.h"
+#include "dali-scene3d/public-api/loader/mesh-geometry.h"
+#include "dali-scene3d/public-api/loader/utils.h"
// EXTERNAL INCLUDES
#include <memory>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/**
* @brief Defines a mesh with its attributes, the primitive type to render it as,
* and the file to load it from with the offset and length information for the
* individual attribute buffers.
*/
-struct DALI_SCENE_LOADER_API MeshDefinition
+struct DALI_SCENE3D_API MeshDefinition
{
using Vector = std::vector<std::pair<MeshDefinition, MeshGeometry>>;
std::vector<float> mMin;
std::vector<float> mMax;
+ static void ComputeMinMax(std::vector<float>& min, std::vector<float>& max, uint32_t numComponents, uint32_t count, const float* values);
+
static void ApplyMinMax(const std::vector<float>& min, const std::vector<float>& max, uint32_t count, float* values);
Blob() = default;
}
/**
- * @brief Applies the min / max values, if they're defined.
+ * @brief Computes the min / max of the input value data.
+ * The min and max are stored in mMin and mMax.
+ *
+ * @param[in] numComponents number of components of data type. e.g., 3 for Vector3.
+ * @param[in] count The number of data.
+ * @param[in] values Data for the mesh.
+ */
+ void ComputeMinMax(uint32_t numComponents, uint32_t count, float* values);
+
+ /**
+ * @brief Applies the min / max values, if they're defined in the model
+ *
+ * @param[in] count The number of data.
+ * @param[in] values Data for the mesh that min / max values will be applied.
*/
void ApplyMinMax(uint32_t count, float* values) const;
};
* attribute buffers, as well as blend shape data. This is then returned.
* @note This can be done on any thread.
*/
- RawData LoadRaw(const std::string& modelsPath) const;
+ RawData LoadRaw(const std::string& modelsPath);
/**
* @brief Creates a MeshGeometry based firstly on the value of the uri member:
Index mSkeletonIdx = INVALID_INDEX;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_MESH_DEFINITION_H
+#endif //DALI_SCENE3D_LOADER_MESH_DEFINITION_H
-#ifndef DALI_SCENE_LOADER_MESH_GEOMETRY_H
-#define DALI_SCENE_LOADER_MESH_GEOMETRY_H
+#ifndef DALI_SCENE3D_LOADERER_MESH_GEOMETRY_H
+#define DALI_SCENE3D_LOADERER_MESH_GEOMETRY_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include "dali/public-api/rendering/geometry.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
{
-struct DALI_SCENE_LOADER_API MeshGeometry
+namespace Loader
+{
+struct DALI_SCENE3D_API MeshGeometry
{
Geometry geometry; ///< The array of vertices.
Texture blendShapeGeometry; ///< The array of vertices of the different blend shapes encoded inside a texture with power of two dimensions.
unsigned int blendShapeBufferOffset{0}; ///< Offset used to calculate the start of each blend shape.
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif // DALI_SCENE_LOADER_MESH_GEOMETRY_H
+#endif // DALI_SCENE3D_LOADERER_MESH_GEOMETRY_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.
*/
// INTERNAL
-#include "dali-scene-loader/public-api/node-definition.h"
-#include "dali-scene-loader/public-api/renderer-state.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/loader/node-definition.h"
+#include "dali-scene3d/public-api/loader/renderer-state.h"
+#include "dali-scene3d/public-api/loader/utils.h"
namespace Dali
{
-namespace SceneLoader
+namespace
{
+constexpr std::string_view IBL_INTENSITY_STRING("uIblIntensity");
+constexpr std::string_view IBL_Y_DIRECTION("uYDirection");
+} // namespace
+
+namespace Scene3D
+{
+namespace Loader
+{
+bool NodeDefinition::Renderable::GetExtents(const ResourceBundle& resources, Vector3& min, Vector3& max) const
+{
+ return false;
+}
+
void NodeDefinition::Renderable::RegisterResources(IResourceReceiver& receiver) const
{
receiver.Register(ResourceType::Shader, mShaderIdx);
return localSpace;
}
+std::string_view NodeDefinition::GetIblScaleFactorUniformName()
+{
+ return IBL_INTENSITY_STRING;
+}
+
+std::string_view NodeDefinition::GetIblYDirectionUniformName()
+{
+ return IBL_Y_DIRECTION;
+}
+
+bool NodeDefinition::GetExtents(const ResourceBundle& resources, Vector3& min, Vector3& max) const
+{
+ if(mRenderable)
+ {
+ if(!mRenderable->GetExtents(resources, min, max))
+ {
+ // If the renderable node don't have mesh accessor, use size to compute extents.
+ min = -mSize / 2.0f;
+ max = mSize / 2.0f;
+ }
+ return true;
+ }
+ return false;
+}
+
+bool ModelNode::GetExtents(const ResourceBundle& resources, Vector3& min, Vector3& max) const
+{
+ auto& mesh = resources.mMeshes[mMeshIdx];
+ uint32_t minSize = mesh.first.mPositions.mBlob.mMin.size();
+ uint32_t maxSize = mesh.first.mPositions.mBlob.mMax.size();
+ if(minSize == maxSize && minSize >= 2u && maxSize >= 2u)
+ {
+ min = Vector3(mesh.first.mPositions.mBlob.mMin[0], mesh.first.mPositions.mBlob.mMin[1], 0.0f);
+ max = Vector3(mesh.first.mPositions.mBlob.mMax[0], mesh.first.mPositions.mBlob.mMax[1], 0.0f);
+ if(minSize == 3u)
+ {
+ min.z = mesh.first.mPositions.mBlob.mMin[2];
+ max.z = mesh.first.mPositions.mBlob.mMax[2];
+ }
+ return true;
+ }
+ return false;
+}
+
void ModelNode::RegisterResources(IResourceReceiver& receiver) const
{
Renderable::RegisterResources(receiver);
}
Index envIdx = matDef.mEnvironmentIdx;
- actor.RegisterProperty("uIblIntensity", resources.mEnvironmentMaps[envIdx].first.mIblIntensity);
+ actor.RegisterProperty(IBL_INTENSITY_STRING.data(), resources.mEnvironmentMaps[envIdx].first.mIblIntensity);
+ actor.RegisterProperty(IBL_Y_DIRECTION.data(), resources.mEnvironmentMaps[envIdx].first.mYDirection);
- float opaque = 0.0f;
- float mask = 0.0f;
+ float opaque = 0.0f;
+ float mask = 0.0f;
float alphaCutoff = matDef.GetAlphaCutoff();
if(!MaskMatch(matDef.mFlags, MaterialDefinition::TRANSPARENCY))
{
endVector.y = sinf(endAngle * Math::PI_OVER_180);
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_NODE_DEFINITION_H_
-#define DALI_SCENE_LOADER_NODE_DEFINITION_H_
+#ifndef DALI_SCENE3D_LOADER_NODE_DEFINITION_H_
+#define DALI_SCENE3D_LOADER_NODE_DEFINITION_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/customization.h"
-#include "dali-scene-loader/public-api/matrix-stack.h"
-#include "dali-scene-loader/public-api/resource-bundle.h"
+#include "dali-scene3d/public-api/loader/customization.h"
+#include "dali-scene3d/public-api/loader/matrix-stack.h"
+#include "dali-scene3d/public-api/loader/resource-bundle.h"
// EXTERNAL INCLUDES
#include <functional>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
class ViewProjection;
/**
* @brief Interface to report (const) resource ids to.
*/
-class DALI_SCENE_LOADER_API IResourceReceiver
+class DALI_SCENE3D_API IResourceReceiver
{
public:
virtual ~IResourceReceiver() = default;
* @note These are supposed to be transient. Obviously, the references collected
* this way must not outlive the objects that they came from.
*/
-class DALI_SCENE_LOADER_API IResourceReflector
+class DALI_SCENE3D_API IResourceReflector
{
public:
virtual ~IResourceReflector() = default;
* set up after the Actors were created. The target of the constraint
* is the node definition that carries it.
*/
-struct DALI_SCENE_LOADER_API ConstraintDefinition
+struct DALI_SCENE3D_API ConstraintDefinition
{
std::string mProperty; ///< name of the property to constrain.
Index mSourceIdx; ///< index of the node to serve as the source of the constraint.
}
};
-struct DALI_SCENE_LOADER_API Transforms
+struct DALI_SCENE3D_API Transforms
{
MatrixStack modelStack;
const ViewProjection& viewProjection;
* @brief Information about a skeleton and the shader that needs to be configured with it.
* @note Multiple skeletons shalt not share the same shader.
*/
-struct DALI_SCENE_LOADER_API SkinningShaderConfigurationRequest
+struct DALI_SCENE3D_API SkinningShaderConfigurationRequest
{
Index mSkeletonIdx;
Shader mShader;
/**
* @brief Needed to configure blend shape properties.
*/
-struct DALI_SCENE_LOADER_API BlendshapeShaderConfigurationRequest
+struct DALI_SCENE3D_API BlendshapeShaderConfigurationRequest
{
std::string mNodeName;
Index mMeshIdx;
/**
* @brief Request for creating a constraint, output from NodeDefinition::OnCreate.
*/
-struct DALI_SCENE_LOADER_API ConstraintRequest
+struct DALI_SCENE3D_API ConstraintRequest
{
const ConstraintDefinition* const mConstraint; ///< Definition of the constraint to create.
Actor mTarget; ///< Target of the constraint.
* and slots for customization and rendering logic, which are mutually exclusive in the
* current implementation.
*/
-struct DALI_SCENE_LOADER_API NodeDefinition
+struct DALI_SCENE3D_API NodeDefinition
{
public: // TYPES
using Vector = std::vector<NodeDefinition>;
std::vector<BlendshapeShaderConfigurationRequest> mBlendshapeRequests;
};
- class DALI_SCENE_LOADER_API Renderable
+ class DALI_SCENE3D_API Renderable
{
public: // DATA
Index mShaderIdx = INVALID_INDEX;
public: // METHODS
virtual ~Renderable() = default;
+ virtual bool GetExtents(const ResourceBundle& resources, Vector3& min, Vector3& max) const;
virtual void RegisterResources(IResourceReceiver& receiver) const;
virtual void ReflectResources(IResourceReflector& reflector);
virtual void OnCreate(const NodeDefinition& node, CreateParams& params, Actor& actor) const;
*/
Actor CreateActor(CreateParams& params) const;
+ /**
+ * @brief Gets local space matrix of this node
+ * @return Matrix of local space.
+ */
Matrix GetLocalSpace() const;
+ /**
+ * @brief Retrieves minimum and maximum position of this node in local space.
+ * @param[in] resources ResourceBundle that contains mesh information of this node.
+ * @param[out] min Minimum position of the mesh of this node.
+ * @param[out] max Maximum position of the mesh of this node.
+ * @return true If the node has mesh.
+ */
+ bool GetExtents(const ResourceBundle& resources, Vector3& min, Vector3& max) const;
+
+ /**
+ * @brief Retrieves Scale Factor uniform name.
+ * This uniform name can be used to change scale factor for ibl.
+ * @return std::string_view of the scale factor uniform name.
+ */
+ static std::string_view GetIblScaleFactorUniformName();
+
+ /**
+ * @brief Retrieves ibl Ydirection uniform name.
+ * This uniform name can be used to flip y direction of ibl in shader.
+ * @return std::string_view of the YDirection uniform name.
+ */
+ static std::string_view GetIblYDirectionUniformName();
+
public: // DATA
static const std::string ORIGINAL_MATRIX_PROPERTY_NAME;
Index mParentIdx = INVALID_INDEX;
};
-class DALI_SCENE_LOADER_API ModelNode : public NodeDefinition::Renderable
+class DALI_SCENE3D_API ModelNode : public NodeDefinition::Renderable
{
public: // DATA
Vector4 mColor = Color::WHITE;
Index mMaterialIdx = INVALID_INDEX;
public: // METHODS
+ bool GetExtents(const ResourceBundle& resources, Vector3& min, Vector3& max) const override;
void RegisterResources(IResourceReceiver& receiver) const override;
void ReflectResources(IResourceReflector& reflector) override;
void OnCreate(const NodeDefinition& node, NodeDefinition::CreateParams& params, Actor& actor) const override;
/**
* @brief Parameters for an Arc node.
*/
-class DALI_SCENE_LOADER_API ArcNode : public ModelNode
+class DALI_SCENE3D_API ArcNode : public ModelNode
{
public: // DATA
bool mAntiAliasing = true;
void OnCreate(const NodeDefinition& node, NodeDefinition::CreateParams& params, Actor& actor) const override;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_NODE_DEFINITION_H_
+#endif //DALI_SCENE3D_LOADER_NODE_DEFINITION_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.
*
*/
-#include "dali-scene-loader/public-api/parse-renderer-state.h"
+#include "dali-scene3d/public-api/loader/parse-renderer-state.h"
#include <cstring>
#include "dali/devel-api/common/map-wrapper.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace RendererState
{
}
std::map<std::string_view, Type> BLEND_FACTORS{
-#define DECL_BLEND_FACTOR(x) {#x, SceneLoader::BlendFactor::x}
+#define DECL_BLEND_FACTOR(x) {#x, Dali::Scene3D::Loader::BlendFactor::x}
DECL_BLEND_FACTOR(ZERO),
DECL_BLEND_FACTOR(ONE),
DECL_BLEND_FACTOR(SRC_COLOR),
}
} // namespace RendererState
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_INTERPRET_RENDERER_STATE_H
-#define DALI_SCENE_LOADER_INTERPRET_RENDERER_STATE_H
+#ifndef DALI_SCENE3D_LOADERERER_INTERPRET_RENDERER_STATE_H
+#define DALI_SCENE3D_LOADERERER_INTERPRET_RENDERER_STATE_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.
*
*/
-#include "dali-scene-loader/public-api/renderer-state.h"
-#include "dali-scene-loader/public-api/string-callback.h"
+#include "dali-scene3d/public-api/loader/renderer-state.h"
+#include "dali-scene3d/public-api/loader/string-callback.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace RendererState
{
* @param onError The callback to call when an error occurred.
* @note No other characters are allowed.
*/
-DALI_SCENE_LOADER_API Type Parse(const char* string, size_t length = 0, StringCallback onError = DefaultErrorCallback);
+DALI_SCENE3D_API Type Parse(const char* string, size_t length = 0, StringCallback onError = DefaultErrorCallback);
} // namespace RendererState
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_INTERPRET_RENDERER_STATE_H
+#endif //DALI_SCENE3D_LOADERERER_INTERPRET_RENDERER_STATE_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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/public-api/renderer-state.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/loader/renderer-state.h"
+#include "dali-scene3d/public-api/loader/utils.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
} // namespace RendererState
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_RENDERER_STATE_H
-#define DALI_SCENE_LOADER_RENDERER_STATE_H
+#ifndef DALI_SCENE3D_LOADER_RENDERER_STATE_H
+#define DALI_SCENE3D_LOADER_RENDERER_STATE_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.
*/
// INTERAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include "dali/public-api/rendering/renderer.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/*
* @brief Contains values for comparison functions used in depth and stencil testing.
* @note Relative order of members must match DepthFunction::Type and StencilFunction::Type.
*/
-struct DALI_SCENE_LOADER_API Comparison
+struct DALI_SCENE3D_API Comparison
{
enum Type
{
* @brief Determines the blend factor used.
* @note Relative order of members must match BlendFactor::Type.
*/
-struct DALI_SCENE_LOADER_API BlendFactor
+struct DALI_SCENE3D_API BlendFactor
{
enum Type
{
* @brief Determines which buffers shall the Renderer write into.
* @note Relative order of members must match RenderMode::Type.
*/
-struct DALI_SCENE_LOADER_API BufferMode
+struct DALI_SCENE3D_API BufferMode
{
enum Type
{
{
using Type = uint32_t; // 8 bits reserved for flags, 4 * 4 bit for blend factors, 4 bits for depth function
-enum DALI_SCENE_LOADER_API Value : Type
+enum DALI_SCENE3D_API Value : Type
{
NONE = 0x0,
* @brief Encodes the given blend factors into a RenderMode value, maskable into other options,
* passable into ApplyRenderMode().
*/
-inline DALI_SCENE_LOADER_API constexpr uint32_t FromBlendFactors(BlendFactor::Type srcRgb, BlendFactor::Type destRgb, BlendFactor::Type srcAlpha, BlendFactor::Type destAlpha)
+inline DALI_SCENE3D_API constexpr uint32_t FromBlendFactors(BlendFactor::Type srcRgb, BlendFactor::Type destRgb, BlendFactor::Type srcAlpha, BlendFactor::Type destAlpha)
{
return (srcRgb | (destRgb << BLEND_FACTOR_ITEM_BITS) | (srcAlpha << (BLEND_FACTOR_ITEM_BITS * 2)) |
(destAlpha << (BLEND_FACTOR_ITEM_BITS * 3)))
* @note Blend factors are only set if not BlendFactor::OMIT.
* @note Buffer mode is only set is not BufferMode::OMIT.
*/
-DALI_SCENE_LOADER_API void Apply(Type rendererState, Renderer& renderer);
+DALI_SCENE3D_API void Apply(Type rendererState, Renderer& renderer);
} // namespace RendererState
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_RENDERER_STATE_H
+#endif //DALI_SCENE3D_LOADER_RENDERER_STATE_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.
*/
// FILE HEADER
-#include "dali-scene-loader/public-api/resource-bundle.h"
+#include "dali-scene3d/public-api/loader/resource-bundle.h"
// EXTERNAL
#include <cstring>
{
using namespace Toolkit;
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
}
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_RESOURCE_BUNDLE_H_
-#define DALI_SCENE_LOADER_RESOURCE_BUNDLE_H_
+#ifndef DALI_SCENE3D_LOADERERERERER_RESOURCE_BUNDLE_H_
+#define DALI_SCENE3D_LOADERERERERER_RESOURCE_BUNDLE_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.
*/
// INTERNAL
-#include "dali-scene-loader/public-api/environment-definition.h"
-#include "dali-scene-loader/public-api/material-definition.h"
-#include "dali-scene-loader/public-api/mesh-definition.h"
-#include "dali-scene-loader/public-api/shader-definition.h"
-#include "dali-scene-loader/public-api/skeleton-definition.h"
+#include "dali-scene3d/public-api/loader/environment-definition.h"
+#include "dali-scene3d/public-api/loader/material-definition.h"
+#include "dali-scene3d/public-api/loader/mesh-definition.h"
+#include "dali-scene3d/public-api/loader/shader-definition.h"
+#include "dali-scene3d/public-api/loader/skeleton-definition.h"
// EXTERNAL
#include <functional>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/*
* @brief The types of resources that .dli may define.
*/
-struct DALI_SCENE_LOADER_API ResourceType
+struct DALI_SCENE3D_API ResourceType
{
enum Value
{
/*
* @return The string value corresponding to the given resource @a type.
*/
-DALI_SCENE_LOADER_API const char* GetResourceTypeName(ResourceType::Value type);
+DALI_SCENE3D_API const char* GetResourceTypeName(ResourceType::Value type);
using ResourceRefCounts = std::vector<Vector<uint32_t>>;
* could be created from them, directly indexible into with values from a dli
* document.
*/
-class DALI_SCENE_LOADER_API ResourceBundle
+class DALI_SCENE3D_API ResourceBundle
{
public:
struct Options
SkeletonDefinition::Vector mSkeletons;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_RESOURCE_BUNDLE_H_
+#endif //DALI_SCENE3D_LOADERERERERER_RESOURCE_BUNDLE_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.
#include "dali/public-api/animation/constraints.h"
// INTERNAL
-#include "dali-scene-loader/internal/graphics/builtin-shader-extern-gen.h"
-#include "dali-scene-loader/public-api/blend-shape-details.h"
-#include "dali-scene-loader/public-api/scene-definition.h"
-#include "dali-scene-loader/public-api/skinning-details.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/internal/graphics/builtin-shader-extern-gen.h"
+#include "dali-scene3d/public-api/loader/blend-shape-details.h"
+#include "dali-scene3d/public-api/loader/scene-definition.h"
+#include "dali-scene3d/public-api/loader/skinning-details.h"
+#include "dali-scene3d/public-api/loader/utils.h"
//#define DEBUG_SCENE_DEFINITION
//#define DEBUG_JOINTS
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
{
if(0 == sNumScenes)
{
- sJointDebugShader = Shader::New(SHADER_SCENE_LOADER_JOINT_DEBUG_VERT, SHADER_SCENE_LOADER_JOINT_DEBUG_FRAG);
+ sJointDebugShader = Shader::New(SHADER_SCENE3D_JOINT_DEBUG_VERT, SHADER_SCENE3D_JOINT_DEBUG_FRAG);
}
++sNumScenes;
}
#endif
}
-uint32_t SceneLoader::SceneDefinition::AddRootNode(Index iNode)
+uint32_t Dali::Scene3D::Loader::SceneDefinition::AddRootNode(Index iNode)
{
if(iNode < mNodes.size())
{
return success;
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_SCENE_DEFINITION_H_
-#define DALI_SCENE_LOADER_SCENE_DEFINITION_H_
+#ifndef DALI_SCENE3D_LOADERER_SCENE_DEFINITION_H_
+#define DALI_SCENE3D_LOADERER_SCENE_DEFINITION_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/customization.h"
-#include "dali-scene-loader/public-api/node-definition.h"
-#include "dali-scene-loader/public-api/string-callback.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/loader/customization.h"
+#include "dali-scene3d/public-api/loader/node-definition.h"
+#include "dali-scene3d/public-api/loader/string-callback.h"
+#include "dali-scene3d/public-api/loader/utils.h"
// EXTERNAL INCLUDES
#include <memory>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
class MatrixStack;
* @brief Intermediate representation of a scene with functionality required to
* create DALi objects (Actors, Renderers) from it.
*/
-class DALI_SCENE_LOADER_API SceneDefinition
+class DALI_SCENE3D_API SceneDefinition
{
public: // TYPES
using NodePredicate = std::function<bool(const NodeDefinition&)>;
std::vector<Index> mRootNodeIds;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_SCENE_DEFINITION_H_
+#endif //DALI_SCENE3D_LOADERER_SCENE_DEFINITION_H_
* limitations under the License.
*
*/
-#include "dali-scene-loader/public-api/shader-definition-factory.h"
+#include "dali-scene3d/public-api/loader/shader-definition-factory.h"
#include <cstring>
-#include "dali-scene-loader/internal/hash.h"
-#include "dali-scene-loader/public-api/blend-shape-details.h"
-#include "dali-scene-loader/public-api/node-definition.h"
+#include "dali-scene3d/internal/loader/hash.h"
+#include "dali-scene3d/public-api/loader/blend-shape-details.h"
+#include "dali-scene3d/public-api/loader/node-definition.h"
#include "dali/devel-api/common/map-wrapper.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
ShaderDefinition shaderDef;
shaderDef.mUseBuiltInShader = true;
- shaderDef.mRendererState = RendererState::DEPTH_TEST | RendererState::DEPTH_WRITE | RendererState::CULL_BACK;
+ shaderDef.mRendererState = RendererState::DEPTH_TEST | RendererState::DEPTH_WRITE | RendererState::CULL_BACK;
auto& materialDef = *receiver.mMaterialDef;
const bool hasTransparency = MaskMatch(materialDef.mFlags, MaterialDefinition::TRANSPARENCY);
return result;
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_
-#define DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_
+#ifndef DALI_SCENE3D_LOADER_SHADER_DEFINITION_FACTORY_H_
+#define DALI_SCENE3D_LOADER_SHADER_DEFINITION_FACTORY_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
-#include "dali-scene-loader/public-api/index.h"
+#include "dali-scene3d/public-api/api.h"
+#include "dali-scene3d/public-api/loader/index.h"
// EXTERNAL INCLUDER
#include <memory>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
struct NodeDefinition;
class ResourceBundle;
-class DALI_SCENE_LOADER_API ShaderDefinitionFactory
+class DALI_SCENE3D_API ShaderDefinitionFactory
{
public:
ShaderDefinitionFactory();
const std::unique_ptr<Impl> mImpl;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_
+#endif //DALI_SCENE3D_LOADER_SHADER_DEFINITION_FACTORY_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/shader-definition.h"
-#include "dali-scene-loader/public-api/utils.h"
-#include <dali-scene-loader/internal/graphics/builtin-shader-extern-gen.h>
+#include "dali-scene3d/public-api/loader/shader-definition.h"
+#include <dali-scene3d/internal/graphics/builtin-shader-extern-gen.h>
+#include "dali-scene3d/public-api/loader/utils.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
return shader;
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_SHADER_DEFINITION_H
-#define DALI_SCENE_LOADER_SHADER_DEFINITION_H
+#ifndef DALI_SCENE3D_LOADER_SHADER_DEFINITION_H
+#define DALI_SCENE3D_LOADER_SHADER_DEFINITION_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/renderer-state.h"
+#include "dali-scene3d/public-api/loader/renderer-state.h"
// EXTERNAL INCLUDES
#include <memory>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/*
* @brief Defines a shader with paths to the files which define its
* vertex and fragment components, and a mapping of uniform names (which are
* used to refer to them in GLSL) to data.
*/
-struct DALI_SCENE_LOADER_API ShaderDefinition
+struct DALI_SCENE3D_API ShaderDefinition
{
using Vector = std::vector<std::pair<ShaderDefinition, Shader>>;
bool mUseBuiltInShader{false};
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_SHADER_DEFINITION_H
+#endif //DALI_SCENE3D_LOADER_SHADER_DEFINITION_H
-#ifndef DALI_SCENE_LOADER_SKELETON_H
-#define DALI_SCENE_LOADER_SKELETON_H
+#ifndef DALI_SCENE3D_LOADERER_SKELETON_H
+#define DALI_SCENE3D_LOADERER_SKELETON_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/index.h"
+#include "dali-scene3d/public-api/loader/index.h"
// EXTERNAL INCLUDES
#include "dali/public-api/common/vector-wrapper.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/*
* @brief A set of joints (stored as node indices), and an optional root node index.
* @note Client code should not change the order of joints, as they are indexed by mesh vertex data.
* @note Client code should make no assumption about the relation of the joint IDs.
*/
-struct DALI_SCENE_LOADER_API SkeletonDefinition
+struct DALI_SCENE3D_API SkeletonDefinition
{
struct Joint
{
std::vector<Joint> mJoints;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_SKELETON_H
+#endif //DALI_SCENE3D_LOADERER_SKELETON_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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/public-api/skinning-details.h"
+#include "dali-scene3d/public-api/loader/skinning-details.h"
#include "dali/public-api/animation/constraints.h"
#include "dali/public-api/object/property.h"
#include "dali/public-api/rendering/shader.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
const unsigned int Skinning::MAX_JOINTS = 64;
const std::string Skinning::BONE_UNIFORM_NAME = "uBone";
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_SKINNING_DETAILS_H_
-#define DALI_SCENE_LOADER_SKINNING_DETAILS_H_
+#ifndef DALI_SCENE3D_LOADER_SKINNING_DETAILS_H_
+#define DALI_SCENE3D_LOADER_SKINNING_DETAILS_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include <string>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
{
-struct DALI_SCENE_LOADER_API Skinning
+namespace Loader
+{
+struct DALI_SCENE3D_API Skinning
{
/*
* @brief Upper limit on the number of joints supported.
Skinning() = delete;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif // DALI_SCENE_LOADER_SKINNING_DETAILS_H_
+#endif // DALI_SCENE3D_LOADER_SKINNING_DETAILS_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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/public-api/string-callback.h"
+#include "dali-scene3d/public-api/loader/string-callback.h"
#include "dali/integration-api/debug.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
void DefaultErrorCallback(const std::string& message)
{
DALI_LOG_ERROR("%s", message.c_str());
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_STRING_CALLBACK_H
-#define DALI_SCENE_LOADER_STRING_CALLBACK_H
+#ifndef DALI_SCENE3D_LOADER_STRING_CALLBACK_H
+#define DALI_SCENE3D_LOADER_STRING_CALLBACK_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include <functional>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/*
* @brief A callback to post strings to.
/*
* @brief Simply passes the formatted message to LOGE().
*/
-DALI_SCENE_LOADER_API void DefaultErrorCallback(const std::string& message);
+DALI_SCENE3D_API void DefaultErrorCallback(const std::string& message);
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_STRING_CALLBACK_H
+#endif //DALI_SCENE3D_LOADER_STRING_CALLBACK_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.
*/
// INTERNAL
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/loader/utils.h"
// EXTERNAL
#include <stdarg.h>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
namespace
{
std::replace(path.begin(), path.end(), '\\', '/');
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_UTILS_H_
-#define DALI_SCENE_LOADER_UTILS_H_
+#ifndef DALI_SCENE3D_LOADER_UTILS_H_
+#define DALI_SCENE3D_LOADER_UTILS_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include <cctype>
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/*
* @brief Fixed size backing buffer to use with std::ostreams where control over
* @note All stream insertions that would overflow the buffer that StreamBuffer
* was created with, will fail.
*/
-class DALI_SCENE_LOADER_API StreamBuffer : public std::basic_streambuf<char>
+class DALI_SCENE3D_API StreamBuffer : public std::basic_streambuf<char>
{
public:
StreamBuffer(char* buffer, size_t size) noexcept(true);
* which a message can be formatted into. Upon destruction, it throws a
* DaliException with the message.
*/
-class DALI_SCENE_LOADER_API ExceptionFlinger
+class DALI_SCENE3D_API ExceptionFlinger
{
public:
enum
/*
* @brief Formats the given printf-style varargs into a std::string.
*/
-DALI_SCENE_LOADER_API std::string FormatString(const char* format, ...);
+DALI_SCENE3D_API std::string FormatString(const char* format, ...);
/*
* @return The @n th bit in a bitmask.
*/
-DALI_SCENE_LOADER_API constexpr size_t NthBit(size_t n)
+DALI_SCENE3D_API constexpr size_t NthBit(size_t n)
{
return 1 << n;
}
/*
* @return Whether all of @a mask 's bits are set on @a value.
*/
-inline DALI_SCENE_LOADER_API bool MaskMatch(uint32_t value, uint32_t mask)
+inline DALI_SCENE3D_API bool MaskMatch(uint32_t value, uint32_t mask)
{
return (value & mask) == mask;
}
/*
* @brief Convert a four-letter(, null-terminated) string literal into a uint32_t.
*/
-inline DALI_SCENE_LOADER_API constexpr uint32_t FourCC(const char (&fourCC)[5])
+inline DALI_SCENE3D_API constexpr uint32_t FourCC(const char (&fourCC)[5])
{
return (fourCC[3] << 24) | (fourCC[2] << 16) | (fourCC[1] << 8) | fourCC[0];
}
* @param[in] b, compare string
* @return true if strings are equal
*/
-inline DALI_SCENE_LOADER_API bool CaseInsensitiveCharacterCompare(unsigned char a, unsigned char b)
+inline DALI_SCENE3D_API bool CaseInsensitiveCharacterCompare(unsigned char a, unsigned char b)
{
// Converts to lower case in the current locale.
return std::tolower(a) == std::tolower(b);
* @param[in] a, compare string
* @param[in] b, compare string
*/
-inline DALI_SCENE_LOADER_API bool CaseInsensitiveStringCompare(const std::string& a, const std::string& b)
+inline DALI_SCENE3D_API bool CaseInsensitiveStringCompare(const std::string& a, const std::string& b)
{
bool result = false;
if(a.length() == b.length())
* to true in case of failure (should only be checked if the returned string
* was empty()).
*/
-DALI_SCENE_LOADER_API std::string LoadTextFile(const char* path, bool* fail = nullptr);
+DALI_SCENE3D_API std::string LoadTextFile(const char* path, bool* fail = nullptr);
/*
* @brief Makes a number of calls to @a fn, passing to each one the given
* for performance and stability reasons.
*/
template<typename Func>
-inline DALI_SCENE_LOADER_API void VisitActor(Actor a, Func fn)
+inline DALI_SCENE3D_API void VisitActor(Actor a, Func fn)
{
fn(a);
* @brief Convenience function to set the given actor @a 's anchor point
* and parent origin to center.
*/
-inline DALI_SCENE_LOADER_API void SetActorCentered(Actor a)
+inline DALI_SCENE3D_API void SetActorCentered(Actor a)
{
a.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
a.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
{
using Type = uint32_t;
-enum DALI_SCENE_LOADER_API Values : Type
+enum DALI_SCENE3D_API Values : Type
{
NONE = 0x00,
FLIP_VERTICAL = 0x01,
/*
* @brief Makes... geometry for a textured quad.
*/
-DALI_SCENE_LOADER_API Geometry MakeTexturedQuadGeometry(TexturedQuadOptions::Type options = TexturedQuadOptions::NONE);
+DALI_SCENE3D_API Geometry MakeTexturedQuadGeometry(TexturedQuadOptions::Type options = TexturedQuadOptions::NONE);
/*
* @brief Fixes the path of a file. Replaces the '\\' separator by the '/' one.
* @param[in,out] path The path to be fixed.
*/
-DALI_SCENE_LOADER_API void ToUnixFileSeparators(std::string& path);
+DALI_SCENE3D_API void ToUnixFileSeparators(std::string& path);
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif /* DALI_SCENE_LOADER_UTILS_H_ */
+#endif /* DALI_SCENE3D_LOADER_UTILS_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.
* limitations under the License.
*
*/
-#include "dali-scene-loader/public-api/view-projection.h"
-#include "dali-scene-loader/public-api/utils.h"
+#include "dali-scene3d/public-api/loader/view-projection.h"
+#include "dali-scene3d/public-api/loader/utils.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
void ViewProjection::Update()
{
}
}
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#ifndef DALI_SCENE_LOADER_VIEW_PROJECTION_H_
-#define DALI_SCENE_LOADER_VIEW_PROJECTION_H_
+#ifndef DALI_SCENE3D_LOADER_VIEW_PROJECTION_H_
+#define DALI_SCENE3D_LOADER_VIEW_PROJECTION_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.
*/
// INTERNAL INCLUDES
-#include "dali-scene-loader/public-api/api.h"
+#include "dali-scene3d/public-api/api.h"
// EXTERNAL INCLUDES
#include "dali/public-api/math/matrix.h"
namespace Dali
{
-namespace SceneLoader
+namespace Scene3D
+{
+namespace Loader
{
/**
* @brief Contains view and projection matrices, also caching the view-projection
Matrix mViewProjection;
};
-} // namespace SceneLoader
+} // namespace Loader
+} // namespace Scene3D
} // namespace Dali
-#endif //DALI_SCENE_LOADER_VIEW_PROJECTION_H_
+#endif //DALI_SCENE3D_LOADER_VIEW_PROJECTION_H_
}
}
+ auto automationId = control.GetProperty<std::string>(Dali::Toolkit::DevelControl::Property::AUTOMATION_ID);
+ if(!automationId.empty())
+ {
+ attributeMap.emplace("automationId", std::move(automationId));
+ }
+
return attributeMap;
}
*
*/
COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID,
+
+ /**
+ * @brief Identifier that allows the automation framework to find and interact with this element.
+ * @details Name "automationId", type Property::STRING.
+ * @note This is a string identifier (compared to @c Actor::Property::ID which is an integer).
+ * It will also appear in the AT-SPI tree under the key "automationId".
+ */
+ AUTOMATION_ID,
};
} // namespace Property
+++ /dev/null
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
-
-// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/web-engine/web-engine-security-origin.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-WebContext::WebContext(Dali::WebEngineContext& context)
-: mWebEngineContext(context)
-{
-}
-
-WebContext::~WebContext()
-{
-}
-
-Dali::WebEngineContext::CacheModel WebContext::GetCacheModel() const
-{
- return mWebEngineContext.GetCacheModel();
-}
-
-void WebContext::SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel)
-{
- mWebEngineContext.SetCacheModel(cacheModel);
-}
-
-void WebContext::SetProxyUri(const std::string& uri)
-{
- mWebEngineContext.SetProxyUri(uri);
-}
-
-std::string WebContext::GetProxyUri() const
-{
- return mWebEngineContext.GetProxyUri();
-}
-
-void WebContext::SetProxyBypassRule(const std::string& proxy, const std::string& bypass)
-{
- mWebEngineContext.SetProxyBypassRule(proxy, bypass);
-}
-
-std::string WebContext::GetProxyBypassRule() const
-{
- return mWebEngineContext.GetProxyBypassRule();
-}
-
-void WebContext::SetCertificateFilePath(const std::string& certificatePath)
-{
- mWebEngineContext.SetCertificateFilePath(certificatePath);
-}
-
-std::string WebContext::GetCertificateFilePath() const
-{
- return mWebEngineContext.GetCertificateFilePath();
-}
-
-void WebContext::SetDefaultProxyAuth(const std::string& username, const std::string& password)
-{
- mWebEngineContext.SetDefaultProxyAuth(username, password);
-}
-
-void WebContext::DeleteAllWebDatabase()
-{
- mWebEngineContext.DeleteAllWebDatabase();
-}
-
-bool WebContext::GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
-{
- return mWebEngineContext.GetWebDatabaseOrigins(callback);
-}
-
-bool WebContext::DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin)
-{
- return mWebEngineContext.DeleteWebDatabase(origin);
-}
-
-bool WebContext::GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback)
-{
- return mWebEngineContext.GetWebStorageOrigins(callback);
-}
-
-bool WebContext::GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback)
-{
- return mWebEngineContext.GetWebStorageUsageForOrigin(origin, callback);
-}
-
-void WebContext::DeleteAllWebStorage()
-{
- mWebEngineContext.DeleteAllWebStorage();
-}
-
-bool WebContext::DeleteWebStorage(Dali::WebEngineSecurityOrigin& origin)
-{
- return mWebEngineContext.DeleteWebStorage(origin);
-}
-
-void WebContext::DeleteLocalFileSystem()
-{
- mWebEngineContext.DeleteLocalFileSystem();
-}
-
-void WebContext::ClearCache()
-{
- mWebEngineContext.ClearCache();
-}
-
-bool WebContext::DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin)
-{
- return mWebEngineContext.DeleteApplicationCache(origin);
-}
-
-void WebContext::GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback)
-{
- mWebEngineContext.GetFormPasswordList(callback);
-}
-
-void WebContext::RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback)
-{
- mWebEngineContext.RegisterDownloadStartedCallback(callback);
-}
-
-void WebContext::RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback)
-{
- mWebEngineContext.RegisterMimeOverriddenCallback(callback);
-}
-
-void WebContext::RegisterRequestInterceptedCallback(Dali::WebEngineContext::WebEngineRequestInterceptedCallback callback)
-{
- mWebEngineContext.RegisterRequestInterceptedCallback(callback);
-}
-
-void WebContext::EnableCache(bool cacheEnabled)
-{
- mWebEngineContext.EnableCache(cacheEnabled);
-}
-
-bool WebContext::IsCacheEnabled() const
-{
- return mWebEngineContext.IsCacheEnabled();
-}
-
-void WebContext::SetAppId(const std::string& appId)
-{
- mWebEngineContext.SetAppId(appId);
-}
-
-bool WebContext::SetAppVersion(const std::string& appVersion)
-{
- return mWebEngineContext.SetAppVersion(appVersion);
-}
-
-void WebContext::SetApplicationType(const Dali::WebEngineContext::ApplicationType applicationType)
-{
- mWebEngineContext.SetApplicationType(applicationType);
-}
-
-void WebContext::SetTimeOffset(float timeOffset)
-{
- mWebEngineContext.SetTimeOffset(timeOffset);
-}
-
-void WebContext::SetTimeZoneOffset(float timeZoneOffset, float daylightSavingTime)
-{
- mWebEngineContext.SetTimeZoneOffset(timeZoneOffset, daylightSavingTime);
-}
-
-void WebContext::SetDefaultZoomFactor(float zoomFactor)
-{
- mWebEngineContext.SetDefaultZoomFactor(zoomFactor);
-}
-
-float WebContext::GetDefaultZoomFactor() const
-{
- return mWebEngineContext.GetDefaultZoomFactor();
-}
-
-void WebContext::RegisterUrlSchemesAsCorsEnabled(const std::vector<std::string>& schemes)
-{
- mWebEngineContext.RegisterUrlSchemesAsCorsEnabled(schemes);
-}
-
-void WebContext::RegisterJsPluginMimeTypes(const std::vector<std::string>& mimeTypes)
-{
- mWebEngineContext.RegisterJsPluginMimeTypes(mimeTypes);
-}
-
-bool WebContext::DeleteAllApplicationCache()
-{
- return mWebEngineContext.DeleteAllApplicationCache();
-}
-
-bool WebContext::DeleteAllWebIndexedDatabase()
-{
- return mWebEngineContext.DeleteAllWebIndexedDatabase();
-}
-
-void WebContext::DeleteFormPasswordDataList(const std::vector<std::string>& list)
-{
- mWebEngineContext.DeleteFormPasswordDataList(list);
-}
-
-void WebContext::DeleteAllFormPasswordData()
-{
- mWebEngineContext.DeleteAllFormPasswordData();
-}
-
-void WebContext::DeleteAllFormCandidateData()
-{
- mWebEngineContext.DeleteAllFormCandidateData();
-}
-
-bool WebContext::FreeUnusedMemory()
-{
- return mWebEngineContext.FreeUnusedMemory();
-}
-
-} // namespace Toolkit
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_TOOLKIT_WEB_CONTEXT_H
-#define DALI_TOOLKIT_WEB_CONTEXT_H
-
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/web-engine/web-engine-context.h>
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/dali-toolkit-common.h>
-
-namespace Dali
-{
-class WebEngineSecurityOrigin;
-
-namespace Toolkit
-{
-/**
- * @addtogroup dali_toolkit_controls_web_view
- * @{
- */
-
-/**
- * @brief WebContext is a control for context of WebView.
- *
- * For working WebContext, a WebEngineContext should be provided.
- *
- */
-class DALI_TOOLKIT_API WebContext
-{
-public:
- /**
- * @brief Create a WebContext.
- *
- * @param[in] context The context of web engine.
- */
- WebContext(Dali::WebEngineContext& context);
-
- /**
- * @brief Destructor.
- */
- virtual ~WebContext() final;
-
- /**
- * @brief Return the cache model type.
- *
- * @return #Dali::WebEngineContext::CacheModel
- */
- Dali::WebEngineContext::CacheModel GetCacheModel() const;
-
- /**
- * @brief Request to set the cache model.
- *
- * @param[in] cacheModel The cache model
- */
- void SetCacheModel(Dali::WebEngineContext::CacheModel cacheModel);
-
- /**
- * @brief Set the given proxy URI to network backend of specific context.
- *
- * @param[in] uri The proxy URI to set
- */
- void SetProxyUri(const std::string& uri);
-
- /**
- * @brief Get the proxy URI from the network backend of specific context.
- *
- * @return current proxy URI or null string if it's not set
- */
- std::string GetProxyUri() const;
-
- /**
- * @brief Set the given proxy to network backend of specific context.
- *
- * @param[in] proxy URI to set
- * @param[in] bypass rule to set
- */
- void SetProxyBypassRule(const std::string& proxy, const std::string& bypass);
-
- /**
- * @brief Get the proxy bypass rule from the network backend of specific context.
- *
- * @return current proxy bypass rule or null string if it's not set
- */
- std::string GetProxyBypassRule() const;
-
- /**
- * @brief Add CA certificates to persistent NSS certificate database
- *
- * Function accepts a path to a CA certificate file, a path to a directory
- * containing CA certificate files, or a colon-seprarated list of those.
- * Certificate files should have *.crt extension.
- * Directories are traversed recursively.
- *
- * @param[in] certificatePath path to a CA certificate file(s), see above for details
- */
- void SetCertificateFilePath(const std::string& certificatePath);
-
- /**
- * @brief Get CA certifcate file path
- *
- * It returns an internal string and should not be modified.
- *
- * @return certificate_file path which is set during ewk_context_certificate_file_set or null string otherwise
- */
- std::string GetCertificateFilePath() const;
-
- /**
- * @brief Set a proxy auth credential to network backend of specific context.
- *
- * @param[in] username username to set
- * @param[in] password password to set
- */
- void SetDefaultProxyAuth(const std::string& username, const std::string& password);
-
- /**
- * @brief Requests for deleting all web databases.
- */
- void DeleteAllWebDatabase();
-
- /**
- * @brief Request for getting web database origins.
- *
- * @param[in] callback callback called after getting web database origins
- *
- * @return true if succeeded, false otherwise
- */
- bool GetWebDatabaseOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback);
-
- /**
- * @brief Request for deleting web databases for origin.
- *
- * @param[in] origin database origin
- *
- * @return true if succeeded, false otherwise
- */
- bool DeleteWebDatabase(Dali::WebEngineSecurityOrigin& origin);
-
- /**
- * @brief Gets list of origins that is stored in web storage db.
- *
- * @param[in] callback callback called after getting web storage origins
- *
- * @return true if succeeded, false otherwise
- */
- bool GetWebStorageOrigins(Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback callback);
-
- /**
- * @brief Get list of origins that is stored in web storage db.
- *
- * @param[in] origin storage origin
- * @param[in] callback callback called after getting web storage origins
- *
- * @return true if succeeded, false otherwise
- */
- bool GetWebStorageUsageForOrigin(Dali::WebEngineSecurityOrigin& origin, Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback callback);
-
- /**
- * @brief Delete all web storage.
- *
- * @details This function does not ensure that all data will be removed.
- * Should be used to extend free physical memory.
- */
- void DeleteAllWebStorage();
-
- /**
- * @brief Delete web storage db.
- *
- * @param[in] origin origin of db
- *
- * @return true if succeeded, false otherwise
- */
- bool DeleteWebStorage(Dali::WebEngineSecurityOrigin& origin);
-
- /**
- * @brief Request for deleting all local file systems.
- */
- void DeleteLocalFileSystem();
-
- /**
- * @brief Requests to clear cache
- */
- void ClearCache();
-
- /**
- * @brief Request for deleting web application cache for origin.
- *
- * @param[in] origin application cache origin
- *
- * @return true if succeeded, false otherwise
- */
- bool DeleteApplicationCache(Dali::WebEngineSecurityOrigin& origin);
-
- /**
- * @brief Asynchronous request to get list of all password data.
- *
- * @param[in] callback callback called after getting form password
- */
- void GetFormPasswordList(Dali::WebEngineContext::WebEngineFormPasswordAcquiredCallback callback);
-
- /**
- * @brief Register callback for download started.
- *
- * @param[in] callback callback for download started
- */
- void RegisterDownloadStartedCallback(Dali::WebEngineContext::WebEngineDownloadStartedCallback callback);
-
- /**
- * @brief Register callback for mime overridden.
- *
- * @param[in] callback callback for mime overridden
- */
- void RegisterMimeOverriddenCallback(Dali::WebEngineContext::WebEngineMimeOverriddenCallback callback);
-
- /**
- * @brief Callback to be called when http request need be intercepted.
- *
- * @param[in] callback
- */
- void RegisterRequestInterceptedCallback(Dali::WebEngineContext::WebEngineRequestInterceptedCallback callback);
-
- /**
- * @brief Toggle the cache to be enabled or disabled
- *
- * @param[in] cacheEnabled enable or disable cache
- */
- void EnableCache(bool cacheEnabled);
-
- /**
- * @brief Query if the cache is enabled
- *
- * @return true is cache is enabled or false otherwise
- */
- bool IsCacheEnabled() const;
-
- /**
- * @brief Set application id for context.
- *
- * @param[in] appId application id
- */
- void SetAppId(const std::string& appId);
-
- /**
- * @brief Set application version for context.
- *
- * @param[in] appVersion application version
- *
- * @return true if successful, false otherwise
- */
- bool SetAppVersion(const std::string& appVersion);
-
- /**
- * @brief To declare application type
- *
- * @param[in] applicationType The Application_Type enum
- *
- */
- void SetApplicationType(const Dali::WebEngineContext::ApplicationType applicationType);
-
- /**
- * @brief Set time offset
- *
- * @param[in] timeOffset The value will be added to system time as offset
- */
- void SetTimeOffset(float timeOffset);
-
- /**
- * @brief Set timezone offset
- *
- * @param[in] timeZoneOffset offset for time zone.
- * @param[in] daylightSavingTime The value is for daylight saving time use.
- */
- void SetTimeZoneOffset(float timeZoneOffset, float daylightSavingTime);
-
- /**
- * @brief Set default zoom factor
- *
- * @param[in] zoomFactor default zoom factor
- */
- void SetDefaultZoomFactor(float zoomFactor);
-
- /**
- * @brief Get default zoom factor
- *
- * Gets default zoom factor for all pages opened with this context.
- *
- * @return default zoom factor or negative value on error
- */
- float GetDefaultZoomFactor() const;
-
- /**
- * @brief Register url schemes as CORS enabled
- *
- * @param[in] schemes The URL schemes list which will be added to web security policy
- *
- */
- void RegisterUrlSchemesAsCorsEnabled(const std::vector<std::string>& schemes);
-
- /**
- * @brief Register JS plugin mime types.
- *
- * @param[in] mimeTypes The MIME types will be checked by the renderer frame loader
- * to skip creating default frame for the object tags with the registered MIME type.
- */
- void RegisterJsPluginMimeTypes(const std::vector<std::string>& mimeTypes);
-
- /**
- * @brief Request for deleting all web application caches.
- *
- * @return @c true on success, otherwise @c false
- */
- bool DeleteAllApplicationCache();
-
- /**
- * @brief Request for deleting all web indexed databases.
- *
- * @return @c true on success, otherwise @c false
- */
- bool DeleteAllWebIndexedDatabase();
-
- /**
- * @brief Delete a given password data list
- *
- * @param[in] list List with Ewk_Password_Data
- */
- void DeleteFormPasswordDataList(const std::vector<std::string>& list);
-
- /**
- * @brief Delete whole password data from DB
- */
- void DeleteAllFormPasswordData();
-
- /**
- * @brief Delete all candidate form data from DB
- */
- void DeleteAllFormCandidateData();
-
- /**
- * @brief Notify low memory to free unused memory.
- *
- * @return @c true on success or @c false otherwise.
- */
- bool FreeUnusedMemory();
-
-private:
- Dali::WebEngineContext& mWebEngineContext;
-};
-
-/**
- * @}
- */
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_WEB_CONTEXT_H
+++ /dev/null
-/*
- * Copyright (c) 2021 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
-
-namespace Dali
-{
-namespace Toolkit
-{
-WebCookieManager::WebCookieManager(Dali::WebEngineCookieManager& manager)
-: mWebEngineCookieManager(manager)
-{
-}
-
-WebCookieManager::~WebCookieManager()
-{
-}
-
-void WebCookieManager::SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy cookieAcceptPolicy)
-{
- mWebEngineCookieManager.SetCookieAcceptPolicy(cookieAcceptPolicy);
-}
-
-Dali::WebEngineCookieManager::CookieAcceptPolicy WebCookieManager::GetCookieAcceptPolicy() const
-{
- return mWebEngineCookieManager.GetCookieAcceptPolicy();
-}
-
-void WebCookieManager::ClearCookies()
-{
- mWebEngineCookieManager.ClearCookies();
-}
-
-void WebCookieManager::SetPersistentStorage(const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage)
-{
- mWebEngineCookieManager.SetPersistentStorage(path, storage);
-}
-
-void WebCookieManager::ChangesWatch(Dali::WebEngineCookieManager::WebEngineCookieManagerChangesWatchCallback callback)
-{
- mWebEngineCookieManager.ChangesWatch(callback);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
-#define DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
-
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/web-engine/web-engine-cookie-manager.h>
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/dali-toolkit-common.h>
-
-namespace Dali
-{
-class WebEngineCookieManager;
-
-namespace Toolkit
-{
-/**
- * @addtogroup dali_toolkit_controls_web_view
- * @{
- */
-
-/**
- * @brief WebCookieManager is a control for cookie manager of WebView.
- *
- *
- * For working WebCookieManager, a WebView should be provided.
- *
- */
-class DALI_TOOLKIT_API WebCookieManager
-{
-public:
- /**
- * @brief Creates a WebCookieManager.
- * @param[in] manager A #Dali::WebEngineCookieManager
- */
- WebCookieManager(Dali::WebEngineCookieManager& manager);
-
- /**
- * @brief Destructor.
- */
- virtual ~WebCookieManager() final;
-
- /**
- * @brief Sets @a policy as the cookie acceptance policy for @a manager.
- *
- * @details By default, only cookies set by the main document loaded are
- * accepted.
- *
- * @param[in] policy A #Dali::WebEngineCookieManager::CookieAcceptPolicy
- */
- void SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy policy);
-
- /**
- * @brief Gets the cookie acceptance policy. The default is Toolkit::WebCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY.
- * @see Dali::WebEngineCookieManager::CookieAcceptPolicy
- */
- Dali::WebEngineCookieManager::CookieAcceptPolicy GetCookieAcceptPolicy() const;
-
- /**
- * @brief Deletes all the cookies of @a manager.
- */
- void ClearCookies();
-
- /**
- * @brief Sets the @a path where non-session cookies are stored persistently using
- * @a storage as the format to read/write the cookies.
- *
- * @details Cookies are initially read from @a path/Cookies to create an initial
- * set of cookies. Then, non-session cookies will be written to @a path/Cookies.
- * By default, @a manager doesn't store the cookies persistently, so you need to
- * call this method to keep cookies saved across sessions.
- * If @a path does not exist it will be created.
- *
- * @param[in] path The path where to read/write Cookies
- * @param[in] storage The type of storage
- */
- void SetPersistentStorage(const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage);
-
- /**
- * @brief Watch for cookies' changes in @a manager.
- *
- * @param[in] callback cookies are added, removed or modified.
- */
- void ChangesWatch(Dali::WebEngineCookieManager::WebEngineCookieManagerChangesWatchCallback callback);
-
-private:
- Dali::WebEngineCookieManager& mWebEngineCookieManager;
-};
-
-/**
- * @}
- */
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_WEB_COOKIE_MANAGER_H
return Internal::WebView::New(argc, argv);
}
-WebView WebView::DownCast(BaseHandle handle)
+Dali::WebEngineContext* WebView::GetContext()
{
- return Control::DownCast<WebView, Internal::WebView>(handle);
+ return Internal::WebView::GetContext();
}
-Dali::Toolkit::WebSettings* WebView::GetSettings() const
+Dali::WebEngineCookieManager* WebView::GetCookieManager()
{
- return Dali::Toolkit::GetImpl(*this).GetSettings();
+ return Internal::WebView::GetCookieManager();
}
-Dali::Toolkit::WebContext* WebView::GetContext() const
+WebView WebView::DownCast(BaseHandle handle)
{
- return Dali::Toolkit::GetImpl(*this).GetContext();
+ return Control::DownCast<WebView, Internal::WebView>(handle);
}
-Dali::Toolkit::WebCookieManager* WebView::GetCookieManager() const
+Dali::Toolkit::WebSettings* WebView::GetSettings() const
{
- return Dali::Toolkit::GetImpl(*this).GetCookieManager();
+ return Dali::Toolkit::GetImpl(*this).GetSettings();
}
Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
static WebView New(uint32_t argc, char** argv);
/**
+ * @brief Get context of web engine.
+ */
+ static Dali::WebEngineContext* GetContext();
+
+ /**
+ * @brief Get cookie manager of web engine.
+ */
+ static Dali::WebEngineCookieManager* GetCookieManager();
+
+ /**
* @brief Create an uninitialized WebView.
*/
WebView();
Dali::Toolkit::WebSettings* GetSettings() const;
/**
- * @brief Get WebContext of WebEngine.
- */
- Dali::Toolkit::WebContext* GetContext() const;
-
- /**
- * @brief Get CookieManager of WebEngine.
- */
- Dali::Toolkit::WebCookieManager* GetCookieManager() const;
-
- /**
* @brief Get WebBackForwardList of WebEngine.
*/
Dali::Toolkit::WebBackForwardList* GetBackForwardList() const;
${devel_api_src_dir}/controls/tool-bar/tool-bar.cpp
${devel_api_src_dir}/controls/video-view/video-view-devel.cpp
${devel_api_src_dir}/controls/web-view/web-back-forward-list.cpp
- ${devel_api_src_dir}/controls/web-view/web-context.cpp
- ${devel_api_src_dir}/controls/web-view/web-cookie-manager.cpp
${devel_api_src_dir}/controls/web-view/web-settings.cpp
${devel_api_src_dir}/controls/web-view/web-view.cpp
${devel_api_src_dir}/focus-manager/keyinput-focus-manager.cpp
SET( devel_api_web_view_header_files
${devel_api_src_dir}/controls/web-view/web-back-forward-list.h
- ${devel_api_src_dir}/controls/web-view/web-context.h
- ${devel_api_src_dir}/controls/web-view/web-cookie-manager.h
${devel_api_src_dir}/controls/web-view/web-settings.h
${devel_api_src_dir}/controls/web-view/web-view.h
)
const PropertyRegistration Control::Impl::PROPERTY_23(typeRegistration, "accessibilityHidden", Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
const PropertyRegistration Control::Impl::PROPERTY_24(typeRegistration, "clockwiseFocusableActorId", Toolkit::DevelControl::Property::CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
const PropertyRegistration Control::Impl::PROPERTY_25(typeRegistration, "counterClockwiseFocusableActorId", Toolkit::DevelControl::Property::COUNTER_CLOCKWISE_FOCUSABLE_ACTOR_ID, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
+const PropertyRegistration Control::Impl::PROPERTY_26(typeRegistration, "automationId", Toolkit::DevelControl::Property::AUTOMATION_ID, Property::STRING, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
// clang-format on
}
break;
}
+
+ case Toolkit::DevelControl::Property::AUTOMATION_ID:
+ {
+ std::string automationId;
+ if(value.Get(automationId))
+ {
+ controlImpl.mImpl->mAutomationId = automationId;
+ }
+ break;
+ }
}
}
}
value = controlImpl.mImpl->mCounterClockwiseFocusableActorId;
break;
}
+
+ case Toolkit::DevelControl::Property::AUTOMATION_ID:
+ {
+ value = controlImpl.mImpl->mAutomationId;
+ break;
+ }
}
}
std::string mAccessibilityName;
std::string mAccessibilityDescription;
std::string mAccessibilityTranslationDomain;
+ std::string mAutomationId;
bool mAccessibilityHighlightable = false;
bool mAccessibilityHidden = false;
static const PropertyRegistration PROPERTY_23;
static const PropertyRegistration PROPERTY_24;
static const PropertyRegistration PROPERTY_25;
+ static const PropertyRegistration PROPERTY_26;
private:
// Accessibility - notification for highlighted object to check if it is showing.
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
-#include <dali-toolkit/devel-api/controls/web-view/web-context.h>
-#include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
#include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/public-api/image-loader/image.h>
return handle;
}
+Dali::WebEngineContext* WebView::GetContext()
+{
+ return Dali::WebEngine::GetContext();
+}
+
+Dali::WebEngineCookieManager* WebView::GetCookieManager()
+{
+ return Dali::WebEngine::GetCookieManager();
+}
+
void WebView::OnInitialize()
{
Actor self = Self();
if(mWebEngine)
{
mWebEngine.FrameRenderedSignal().Connect(this, &WebView::OnFrameRendered);
- mWebContext = std::unique_ptr<Dali::Toolkit::WebContext>(new WebContext(mWebEngine.GetContext()));
- mWebCookieManager = std::unique_ptr<Dali::Toolkit::WebCookieManager>(new WebCookieManager(mWebEngine.GetCookieManager()));
mWebSettings = std::unique_ptr<Dali::Toolkit::WebSettings>(new WebSettings(mWebEngine.GetSettings()));
mWebBackForwardList = std::unique_ptr<Dali::Toolkit::WebBackForwardList>(new WebBackForwardList(mWebEngine.GetBackForwardList()));
}
return mWebSettings.get();
}
-Dali::Toolkit::WebContext* WebView::GetContext() const
-{
- return mWebContext.get();
-}
-
-Dali::Toolkit::WebCookieManager* WebView::GetCookieManager() const
-{
- return mWebCookieManager.get();
-}
-
Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
{
return mWebBackForwardList.get();
class KeyEvent;
class TouchEvent;
class WebBackForwardList;
-class WebContext;
-class WebCookieManager;
class WebSettings;
class WebView;
static Toolkit::WebView New(uint32_t argc, char** argv);
/**
- * @copydoc Dali::Toolkit::WebView::GetSettings()
+ * @copydoc Dali::Toolkit::WebView::GetContext()
*/
- Dali::Toolkit::WebSettings* GetSettings() const;
+ static Dali::WebEngineContext* GetContext();
/**
- * @copydoc Dali::Toolkit::WebView::GetContext()
+ * @copydoc Dali::Toolkit::WebView::GetCookieManager()
*/
- Dali::Toolkit::WebContext* GetContext() const;
+ static Dali::WebEngineCookieManager* GetCookieManager();
/**
- * @copydoc Dali::Toolkit::WebView::GetCookieManager()
+ * @copydoc Dali::Toolkit::WebView::GetSettings()
*/
- Dali::Toolkit::WebCookieManager* GetCookieManager() const;
+ Dali::Toolkit::WebSettings* GetSettings() const;
/**
* @copydoc Dali::Toolkit::WebView::GetBackForwardList()
Dali::Size mWebViewSize;
Dali::WebEngine mWebEngine;
- std::unique_ptr<Dali::Toolkit::WebContext> mWebContext;
- std::unique_ptr<Dali::Toolkit::WebCookieManager> mWebCookieManager;
std::unique_ptr<Dali::Toolkit::WebSettings> mWebSettings;
std::unique_ptr<Dali::Toolkit::WebBackForwardList> mWebBackForwardList;
if(actor &&
actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) &&
actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED) &&
- actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE) &&
- actor.GetProperty<bool>(Actor::Property::VISIBLE))
+ actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
{
// If the parent's KEYBOARD_FOCUSABLE_CHILDREN is false, it cannot have focus.
Actor parent = actor.GetParent();
const TextAbstraction::Character& character,
const TextAbstraction::Script& characterScript)
{
- return (IsOneOfEmojiScripts(currentRunScript) &&
- (IsOneOfEmojiScripts(characterScript) ||
- TextAbstraction::IsZeroWidthJoiner(character) ||
- TextAbstraction::IsZeroWidthNonJoiner(character) ||
- TextAbstraction::IsEmojiItem(character) ||
- TextAbstraction::IsMiscellaneousSymbolsAndArrowsEmoji(character) ||
- TextAbstraction::IsDingbatsEmoji(character)));
+ return (!(TextAbstraction::IsNegativeSquaredLatinCapitalLetter(character)) &&
+ (IsOneOfEmojiScripts(currentRunScript) &&
+ (IsOneOfEmojiScripts(characterScript) ||
+ TextAbstraction::IsZeroWidthJoiner(character) ||
+ TextAbstraction::IsZeroWidthNonJoiner(character) ||
+ TextAbstraction::IsEmojiItem(character) ||
+ TextAbstraction::IsMiscellaneousSymbolsAndArrowsEmoji(character) ||
+ TextAbstraction::IsDingbatsEmoji(character))));
}
bool IsNewSequence(const Character* const textBuffer,
}
bool isCommonScript = false;
- bool isEmojiScript = TextAbstraction::IsEmojiScript(script) || TextAbstraction::IsEmojiColorScript(script) || TextAbstraction::IsEmojiTextScript(script);
+ bool isEmojiScript = TextAbstraction::IsOneOfEmojiScripts(script);
if(isEmojiScript && (previousScript == script))
{
{
// Use the cached default font for the script if there is one.
fontId = cachedDefaultFontId;
+ isValidFont = true;
}
else
{
}
}
defaultFontsPerScript->Cache(currentFontDescription, fontId);
+ isValidFont = true;
}
}
} // !isValidFont (3)
description.path.c_str());
}
#endif
+ if(!isValidFont && !isCommonScript)
+ {
+ Dali::TextAbstraction::FontDescription descriptionForLog;
+ fontClient.GetDescription(fontId, descriptionForLog);
+ DALI_LOG_RELEASE_INFO("Validated font set fail : Character : %x, Script : %s, Font : %s \n",
+ character,
+ Dali::TextAbstraction::ScriptName[script],
+ descriptionForLog.path.c_str());
+ }
// Whether bols style is required.
isBoldRequired = (currentFontDescription.weight >= TextAbstraction::FontWeight::BOLD);
}
case 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();
- }
- }
+ GetAccessibleObject()->EmitVisible(Self().GetProperty<bool>(Actor::Property::VISIBLE));
break;
}
case DevelActor::Property::USER_INTERACTION_ENABLED:
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 31;
+const unsigned int TOOLKIT_MICRO_VERSION = 32;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.1.31
+Version: 2.1.32
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT
Application development package for Dali 3D engine toolkit - headers and package config
##############################
-# dali-scene-loader
+# dali-scene3d
##############################
-%define dali2_scene_loader dali2-scene-loader
-%package -n %{dali2_scene_loader}
+%define dali2_scene3d dali2-scene3d
+%package -n %{dali2_scene3d}
Summary: DLI scene loading library
Group: System/Libraries
License: Apache-2.0
Requires: dali2-toolkit
-%description -n %{dali2_scene_loader}
+%description -n %{dali2_scene3d}
Provides functionality for loading and displaying DLI format scenes. See README.md for more details.
-%package -n %{dali2_scene_loader}-devel
-Summary: Development components for dali-scene-loader
+%package -n %{dali2_scene3d}-devel
+Summary: Development components for dali-scene3d
Group: Development/Building
-Requires: %{dali2_scene_loader} = %{version}-%{release}
+Requires: %{dali2_scene3d} = %{version}-%{release}
-%description -n %{dali2_scene_loader}-devel
-Development components for dali-scene-loader.
+%description -n %{dali2_scene3d}-devel
+Development components for dali-scene3d.
%define dali_data_rw_dir %TZ_SYS_SHARE/dali/
%define dali_data_ro_dir %TZ_SYS_RO_SHARE/dali/
%{dali_toolkit_style_files}/default-feedback-theme.json
%{_datadir}/locale/*/LC_MESSAGES/*
-%files -n %{dali2_scene_loader}
+%files -n %{dali2_scene3d}
%if 0%{?enable_dali_smack_rules}
-%manifest dali-scene-loader.manifest-smack
+%manifest dali-scene3d.manifest-smack
%else
-%manifest dali-scene-loader.manifest
+%manifest dali-scene3d.manifest
%endif
%defattr(-,root,root,-)
-%{_libdir}/lib%{dali2_scene_loader}.so
+%{_libdir}/lib%{dali2_scene3d}.so
%license LICENSE
-%files -n %{dali2_scene_loader}-devel
+%files -n %{dali2_scene3d}-devel
%defattr(-,root,root,-)
-%{_includedir}/dali-scene-loader/public-api/*
-%{_libdir}/pkgconfig/dali2-scene-loader.pc
+%{_includedir}/dali-scene3d/public-api/*
+%{_libdir}/pkgconfig/dali2-scene3d.pc