namespace
{
-static constexpr int32_t NUM_OF_GLTF_MODELS = 7;
+struct ModelInfo
+{
+ const char* name; ///< The name of the model.
+ const Vector2 size; ///< The size of the model
+ const float yPosition; ///< The position of the model in the Y axis.
+};
-const char* gltf_list[7] =
+const ModelInfo gltf_list[] =
{
/**
* For the BoxAnimated.glb
* Donated by Cesium for glTF testing.
* Take from https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoxAnimated
*/
- "BoxAnimated.glb",
+ {"BoxAnimated.glb", Vector2(300.0f, 300.0f), 100.0f},
+ /**
+ * For the quantized Duck.gltf and its Assets
+ * Created by Sony Computer Entertainment Inc.
+ * Licensed under the SCEA Shared Source License, Version 1.0
+ * Take from https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Duck/glTF-Quantized
+ */
+ {"Duck.gltf", Vector2(600.0f, 600.0f), 300.0f},
/**
* For the Lantern.gltf and its Assets
* Donated by Microsoft for glTF testing
* Created by Ryan Martin
* Take from https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Lantern
*/
- "Lantern.gltf",
+ {"Lantern.gltf", Vector2(600.0f, 600.0f), 0.0f},
/**
* For the BoomBox.gltf and its Assets
* Donated by Microsoft for glTF testing
* Created by Ryan Martin
* Take from https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoomBox
*/
- "BoomBox.gltf",
+ {"BoomBox.gltf", Vector2(600.0f, 600.0f), 0.0f},
/**
* For the DamagedHelmet.glb
* Battle Damaged Sci-fi Helmet - PBR by theblueturtle_, published under a
* Creative Commons Attribution-NonCommercial license
* https://sketchfab.com/models/b81008d513954189a063ff901f7abfe4
*/
- "DamagedHelmet.glb",
+ {"DamagedHelmet.glb", Vector2(600.0f, 600.0f), 0.0f},
/**
* For the microphone.gltf and its Assets
* Microphone GXL 066 Bafhcteks by Gistold, published under a
* Creative Commons Attribution-NonCommercial license
* https://sketchfab.com/models/5172dbe9281a45f48cee8c15bdfa1831
*/
- "microphone.gltf",
+ {"microphone.gltf", Vector2(600.0f, 600.0f), 0.0f},
/**
* For the beer_model.dli and its Assets
* This model includes a bottle of beer and cube box.
*/
- "beer_model.dli",
+ {"beer_model.dli", Vector2(600.0f, 600.0f), 0.0f},
/**
* For the exercise_model.dli and its Assets
* This model includes a sportsman
*/
- "exercise_model.dli"};
+ {"exercise_model.dli", Vector2(600.0f, 600.0f), 0.0f},
+};
+
+const int32_t NUM_OF_GLTF_MODELS = sizeof(gltf_list) / sizeof(gltf_list[0]);
/**
* For the diffuse and specular cube map texture.
}
std::string gltfUrl = modeldir;
- gltfUrl += gltf_list[index];
+ gltfUrl += gltf_list[index].name;
mModel = Dali::Scene3D::Model::New(gltfUrl);
- if(index == 0u)
- {
- mModel.SetProperty(Dali::Actor::Property::SIZE, Vector2(300, 300));
- mModel.SetProperty(Dali::Actor::Property::POSITION_Y, 100);
- }
- else
- {
- mModel.SetProperty(Dali::Actor::Property::SIZE, Vector2(600, 600));
- }
+ mModel.SetProperty(Dali::Actor::Property::SIZE, gltf_list[index].size);
+ mModel.SetProperty(Dali::Actor::Property::POSITION_Y, gltf_list[index].yPosition);
mModel.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
mModel.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
mModel.SetImageBasedLightSource(uri_diffuse_texture, uri_specular_texture, 0.6f);
mReadyToLoad = true;
if(mModel.GetAnimationCount() > 0)
{
- Animation animation = (std::string("exercise_model.dli") == gltf_list[mCurrentGlTF]) ? mModel.GetAnimation("idleToSquatClip_0") : mModel.GetAnimation(0u);
+ Animation animation = (std::string("exercise_model.dli") == gltf_list[mCurrentGlTF].name) ? mModel.GetAnimation("idleToSquatClip_0") : mModel.GetAnimation(0u);
animation.Play();
animation.SetLoopCount(0);
}
--- /dev/null
+{\r
+ "buffers":[\r
+ {\r
+ "uri":"Duck.bin",\r
+ "byteLength":63656\r
+ }\r
+ ],\r
+ "asset":{\r
+ "version":"2.0",\r
+ "generator":"gltfpack 0.13"\r
+ },\r
+ "extensionsUsed":[\r
+ "KHR_mesh_quantization",\r
+ "KHR_texture_transform"\r
+ ],\r
+ "extensionsRequired":[\r
+ "KHR_mesh_quantization"\r
+ ],\r
+ "bufferViews":[\r
+ {\r
+ "buffer":0,\r
+ "byteOffset":0,\r
+ "byteLength":9596,\r
+ "byteStride":4,\r
+ "target":34962\r
+ },\r
+ {\r
+ "buffer":0,\r
+ "byteOffset":9596,\r
+ "byteLength":19192,\r
+ "byteStride":8,\r
+ "target":34962\r
+ },\r
+ {\r
+ "buffer":0,\r
+ "byteOffset":28788,\r
+ "byteLength":9596,\r
+ "byteStride":4,\r
+ "target":34962\r
+ },\r
+ {\r
+ "buffer":0,\r
+ "byteOffset":38384,\r
+ "byteLength":25272,\r
+ "target":34963\r
+ }\r
+ ],\r
+ "accessors":[\r
+ {\r
+ "bufferView":0,\r
+ "byteOffset":0,\r
+ "componentType":5120,\r
+ "count":2399,\r
+ "type":"VEC3",\r
+ "normalized":true\r
+ },\r
+ {\r
+ "bufferView":1,\r
+ "byteOffset":0,\r
+ "componentType":5123,\r
+ "count":2399,\r
+ "type":"VEC3",\r
+ "min":[\r
+ 0,\r
+ 0,\r
+ 0\r
+ ],\r
+ "max":[\r
+ 16383,\r
+ 15251,\r
+ 11411\r
+ ]\r
+ },\r
+ {\r
+ "bufferView":2,\r
+ "byteOffset":0,\r
+ "componentType":5123,\r
+ "count":2399,\r
+ "type":"VEC2"\r
+ },\r
+ {\r
+ "bufferView":3,\r
+ "byteOffset":0,\r
+ "componentType":5123,\r
+ "count":12636,\r
+ "type":"SCALAR"\r
+ }\r
+ ],\r
+ "images":[\r
+ {\r
+ "uri":"DuckCM.png"\r
+ }\r
+ ],\r
+ "textures":[\r
+ {\r
+ "source":0\r
+ }\r
+ ],\r
+ "materials":[\r
+ {\r
+ "name":"blinn3-fx",\r
+ "pbrMetallicRoughness":{\r
+ "baseColorTexture":{\r
+ "index":0,\r
+ "texCoord":0,\r
+ "extensions":{\r
+ "KHR_texture_transform":{\r
+ "offset":[\r
+ 0.0264090002,\r
+ 0.019963026\r
+ ],\r
+ "scale":[\r
+ 0.000233684244,\r
+ 0.000234450286\r
+ ]\r
+ }\r
+ }\r
+ },\r
+ "metallicFactor":0\r
+ }\r
+ }\r
+ ],\r
+ "meshes":[\r
+ {\r
+ "primitives":[\r
+ {\r
+ "attributes":{\r
+ "NORMAL":0,\r
+ "POSITION":1,\r
+ "TEXCOORD_0":2\r
+ },\r
+ "mode":4,\r
+ "indices":3,\r
+ "material":0\r
+ }\r
+ ]\r
+ }\r
+ ],\r
+ "nodes":[\r
+ {\r
+ "mesh":0,\r
+ "translation":[\r
+ -0.692984998,\r
+ 0.0992936939,\r
+ -0.613281965\r
+ ],\r
+ "scale":[\r
+ 0.900101006161,\r
+ 0.900101006161,\r
+ 0.900101006161\r
+ ]\r
+ },\r
+ {\r
+ "matrix":[\r
+ 0.00999999978,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ 0.00999999978,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ 0.00999999978,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ 1\r
+ ],\r
+ "children":[\r
+ 2\r
+ ]\r
+ },\r
+ {\r
+ "matrix":[\r
+ -0.72896868,\r
+ 0,\r
+ -0.684547067,\r
+ 0,\r
+ -0.425204903,\r
+ 0.783693433,\r
+ 0.452797294,\r
+ 0,\r
+ 0.536475062,\r
+ 0.621147811,\r
+ -0.57128799,\r
+ 0,\r
+ 400.113007,\r
+ 463.264008,\r
+ -431.078033,\r
+ 1\r
+ ],\r
+ "camera":0\r
+ }\r
+ ],\r
+ "scenes":[\r
+ {\r
+ "nodes":[\r
+ 0,\r
+ 1\r
+ ]\r
+ }\r
+ ],\r
+ "cameras":[\r
+ {\r
+ "type":"perspective",\r
+ "perspective":{\r
+ "yfov":0.660592556,\r
+ "znear":1,\r
+ "aspectRatio":1.5,\r
+ "zfar":10000\r
+ }\r
+ }\r
+ ],\r
+ "scene":0\r
+}
\ No newline at end of file