summaryrefslogtreecommitdiffstats
path: root/examples/qt3d
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@theqtcompany.com>2015-07-15 23:39:58 +0200
committerAndy Nichols <andy.nichols@theqtcompany.com>2015-08-08 12:55:31 +0000
commit473bd13ed373c4cc24bdd3211ee90a070a466ce2 (patch)
tree4dbfd0bc5ea908a3feb20fed8ad5242c6cef56bb /examples/qt3d
parenta1a7e3661bce196a633ef3edd7d905c215bf9031 (diff)
Add support for loading scenes from glTF 0.8 files
This patch includes a new scene parser plugin which enables the loading of glTF files (using the 0.8 spec) into Qt3D scenes. The gltf example has been updated to work with the current APIs and the asset files it used have been updated to match the glTF 0.8 spec requrements. Previously an unused copy of the GLTF scene parser was located in render/io. It was being built, but not used as only plugin based sceneloaders were loaded by the renderer. Now it should be usable and always available. Change-Id: Ic2e31e2b63a871559aad9bad90ec2820988a1571 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'examples/qt3d')
-rw-r--r--[-rwxr-xr-x]examples/qt3d/exampleresources/assets/gltf/wine/wine.binbin329004 -> 329088 bytes
-rw-r--r--[-rwxr-xr-x]examples/qt3d/exampleresources/assets/gltf/wine/wine.gltf (renamed from examples/qt3d/exampleresources/assets/gltf/wine/wine.json)1217
-rw-r--r--examples/qt3d/exampleresources/assets/gltf/wine/wine0FS.glsl30
-rw-r--r--examples/qt3d/exampleresources/assets/gltf/wine/wine0VS.glsl23
-rw-r--r--examples/qt3d/exampleresources/assets/gltf/wine/wine1FS.glsl17
-rw-r--r--examples/qt3d/exampleresources/assets/gltf/wine/wine1VS.glsl12
-rw-r--r--examples/qt3d/exampleresources/assets/gltf/wine/wine2FS.glsl25
-rw-r--r--examples/qt3d/exampleresources/assets/gltf/wine/wine2VS.glsl15
-rw-r--r--examples/qt3d/exampleresources/assets/gltf/wine/wine3FS.glsl16
-rw-r--r--examples/qt3d/exampleresources/assets/gltf/wine/wine3VS.glsl12
-rw-r--r--examples/qt3d/exampleresources/assets/gltf/wine/wine4FS.glsl20
-rw-r--r--examples/qt3d/exampleresources/assets/gltf/wine/wine4VS.glsl17
-rw-r--r--examples/qt3d/exampleresources/gltf.qrc8
-rw-r--r--examples/qt3d/gltf/Wine.qml77
-rw-r--r--examples/qt3d/gltf/basic.frag12
-rw-r--r--examples/qt3d/gltf/basic.vert18
-rw-r--r--examples/qt3d/gltf/gltf.pro4
-rw-r--r--examples/qt3d/gltf/gltf_example.qrc3
-rw-r--r--examples/qt3d/gltf/main.qml164
19 files changed, 969 insertions, 721 deletions
diff --git a/examples/qt3d/exampleresources/assets/gltf/wine/wine.bin b/examples/qt3d/exampleresources/assets/gltf/wine/wine.bin
index 7c8093c5a..c43dfb43a 100755..100644
--- a/examples/qt3d/exampleresources/assets/gltf/wine/wine.bin
+++ b/examples/qt3d/exampleresources/assets/gltf/wine/wine.bin
Binary files differ
diff --git a/examples/qt3d/exampleresources/assets/gltf/wine/wine.json b/examples/qt3d/exampleresources/assets/gltf/wine/wine.gltf
index bdff245d5..39e139779 100755..100644
--- a/examples/qt3d/exampleresources/assets/gltf/wine/wine.json
+++ b/examples/qt3d/exampleresources/assets/gltf/wine/wine.gltf
@@ -1,9 +1,140 @@
{
"accessors": {
- "attribute_120": {
- "bufferView": "bufferView_408",
- "byteOffset": 38592,
+ "accessor_10": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 9272,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 2,
+ "type": "SCALAR"
+ },
+ "accessor_101": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 20400,
"byteStride": 12,
+ "componentType": 5126,
+ "count": 720,
+ "max": [
+ 16.8,
+ 19.5,
+ 0.75
+ ],
+ "min": [
+ 1.4,
+ -0,
+ 0
+ ],
+ "type": "VEC3"
+ },
+ "accessor_103": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 29040,
+ "byteStride": 12,
+ "componentType": 5126,
+ "count": 720,
+ "max": [
+ 1,
+ 1,
+ 1
+ ],
+ "min": [
+ -1,
+ -1,
+ -1
+ ],
+ "type": "VEC3"
+ },
+ "accessor_12": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 47344,
+ "byteStride": 12,
+ "componentType": 5126,
+ "count": 2,
+ "max": [
+ 24.7369,
+ 1.5,
+ 3.5
+ ],
+ "min": [
+ 24.7369,
+ 1,
+ 3.5
+ ],
+ "type": "VEC3"
+ },
+ "accessor_124": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 8120,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 48,
+ "type": "SCALAR"
+ },
+ "accessor_126": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 37680,
+ "byteStride": 12,
+ "componentType": 5126,
+ "count": 30,
+ "max": [
+ 0.5,
+ 21,
+ 46.6166
+ ],
+ "min": [
+ -0.5,
+ 0,
+ 2.5
+ ],
+ "type": "VEC3"
+ },
+ "accessor_128": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 38040,
+ "byteStride": 12,
+ "componentType": 5126,
+ "count": 30,
+ "max": [
+ 1,
+ 1,
+ 1
+ ],
+ "min": [
+ -1,
+ -1,
+ -1
+ ],
+ "type": "VEC3"
+ },
+ "accessor_130": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 38400,
+ "byteStride": 8,
+ "componentType": 5126,
+ "count": 30,
+ "max": [
+ 0.291667,
+ 1
+ ],
+ "min": [
+ -0.291667,
+ 0.352547
+ ],
+ "type": "VEC2"
+ },
+ "accessor_151": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 8216,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 360,
+ "type": "SCALAR"
+ },
+ "accessor_153": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 38640,
+ "byteStride": 12,
+ "componentType": 5126,
"count": 176,
"max": [
54,
@@ -15,12 +146,13 @@
0,
0
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_122": {
- "bufferView": "bufferView_408",
- "byteOffset": 40704,
+ "accessor_155": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 40752,
"byteStride": 12,
+ "componentType": 5126,
"count": 176,
"max": [
1,
@@ -32,12 +164,13 @@
-1,
-1
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_124": {
- "bufferView": "bufferView_408",
- "byteOffset": 42816,
+ "accessor_157": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 42864,
"byteStride": 8,
+ "componentType": 5126,
"count": 176,
"max": [
8.17898,
@@ -47,12 +180,21 @@
2.31603,
-0.06428
],
- "type": 35664
+ "type": "VEC2"
+ },
+ "accessor_178": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 8936,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 168,
+ "type": "SCALAR"
},
- "attribute_147": {
- "bufferView": "bufferView_408",
- "byteOffset": 44224,
+ "accessor_180": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 44272,
"byteStride": 12,
+ "componentType": 5126,
"count": 96,
"max": [
2,
@@ -64,12 +206,13 @@
0,
5.5
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_149": {
- "bufferView": "bufferView_408",
- "byteOffset": 45376,
+ "accessor_182": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 45424,
"byteStride": 12,
+ "componentType": 5126,
"count": 96,
"max": [
1,
@@ -81,12 +224,13 @@
-1,
-1
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_151": {
- "bufferView": "bufferView_408",
- "byteOffset": 46528,
+ "accessor_184": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 46576,
"byteStride": 8,
+ "componentType": 5126,
"count": 96,
"max": [
4.15963,
@@ -96,12 +240,21 @@
-1.14777,
-0.08885
],
- "type": 35664
+ "type": "VEC2"
+ },
+ "accessor_205": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 9276,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 4740,
+ "type": "SCALAR"
},
- "attribute_174": {
- "bufferView": "bufferView_408",
- "byteOffset": 47296,
+ "accessor_207": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 47368,
"byteStride": 12,
+ "componentType": 5126,
"count": 1968,
"max": [
117.98,
@@ -113,12 +266,13 @@
0,
0
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_176": {
- "bufferView": "bufferView_408",
- "byteOffset": 70912,
+ "accessor_209": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 70984,
"byteStride": 12,
+ "componentType": 5126,
"count": 1968,
"max": [
0.995313,
@@ -130,12 +284,13 @@
-0.995313,
-0.962469
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_178": {
- "bufferView": "bufferView_408",
- "byteOffset": 94528,
+ "accessor_211": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 94600,
"byteStride": 8,
+ "componentType": 5126,
"count": 1968,
"max": [
0.855532,
@@ -145,12 +300,55 @@
-0.555297,
0.021103
],
- "type": 35664
+ "type": "VEC2"
},
- "attribute_221": {
- "bufferView": "bufferView_408",
- "byteOffset": 110272,
+ "accessor_22": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 0,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 2,
+ "type": "SCALAR"
+ },
+ "accessor_24": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 0,
"byteStride": 12,
+ "componentType": 5126,
+ "count": 2,
+ "max": [
+ 19.7369,
+ 1.5,
+ 3.5
+ ],
+ "min": [
+ 19.7369,
+ 1,
+ 3.5
+ ],
+ "type": "VEC3"
+ },
+ "accessor_249": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 18756,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 66,
+ "type": "SCALAR"
+ },
+ "accessor_252": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 18888,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 66,
+ "type": "SCALAR"
+ },
+ "accessor_254": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 110344,
+ "byteStride": 12,
+ "componentType": 5126,
"count": 48,
"max": [
82.9854,
@@ -162,12 +360,13 @@
34.9944,
0
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_223": {
- "bufferView": "bufferView_408",
- "byteOffset": 110848,
+ "accessor_256": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 110920,
"byteStride": 12,
+ "componentType": 5126,
"count": 48,
"max": [
-0,
@@ -179,12 +378,13 @@
0,
-1
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_225": {
- "bufferView": "bufferView_408",
- "byteOffset": 111424,
+ "accessor_258": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 111496,
"byteStride": 8,
+ "componentType": 5126,
"count": 48,
"max": [
0.642232,
@@ -194,12 +394,21 @@
0.349715,
0.987863
],
- "type": 35664
+ "type": "VEC2"
+ },
+ "accessor_279": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 19020,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 360,
+ "type": "SCALAR"
},
- "attribute_248": {
- "bufferView": "bufferView_408",
- "byteOffset": 111808,
+ "accessor_281": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 111880,
"byteStride": 12,
+ "componentType": 5126,
"count": 176,
"max": [
54,
@@ -211,12 +420,13 @@
0,
0
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_250": {
- "bufferView": "bufferView_408",
- "byteOffset": 113920,
+ "accessor_283": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 113992,
"byteStride": 12,
+ "componentType": 5126,
"count": 176,
"max": [
1,
@@ -228,12 +438,13 @@
-1,
-1
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_252": {
- "bufferView": "bufferView_408",
- "byteOffset": 116032,
+ "accessor_285": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 116104,
"byteStride": 8,
+ "componentType": 5126,
"count": 176,
"max": [
8.17898,
@@ -243,29 +454,21 @@
2.31603,
-0.06428
],
- "type": 35664
+ "type": "VEC2"
},
- "attribute_26": {
- "bufferView": "bufferView_408",
- "byteOffset": 0,
- "byteStride": 12,
- "count": 96,
- "max": [
- 2,
- 21,
- 38
- ],
- "min": [
- 0,
- 0,
- 5.5
- ],
- "type": 35665
+ "accessor_301": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 19740,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 600,
+ "type": "SCALAR"
},
- "attribute_270": {
- "bufferView": "bufferView_408",
- "byteOffset": 117440,
+ "accessor_303": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 117512,
"byteStride": 12,
+ "componentType": 5126,
"count": 224,
"max": [
5,
@@ -277,12 +480,13 @@
0,
0
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_272": {
- "bufferView": "bufferView_408",
- "byteOffset": 120128,
+ "accessor_305": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 120200,
"byteStride": 12,
+ "componentType": 5126,
"count": 224,
"max": [
1,
@@ -294,29 +498,21 @@
-0.97185,
-0.97185
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_28": {
- "bufferView": "bufferView_408",
- "byteOffset": 1152,
- "byteStride": 12,
- "count": 96,
- "max": [
- 1,
- 1,
- 1
- ],
- "min": [
- -1,
- -1,
- -1
- ],
- "type": 35665
+ "accessor_326": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 20940,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 6918,
+ "type": "SCALAR"
},
- "attribute_295": {
- "bufferView": "bufferView_408",
- "byteOffset": 122816,
+ "accessor_328": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 122888,
"byteStride": 12,
+ "componentType": 5126,
"count": 2933,
"max": [
25.9025,
@@ -328,12 +524,13 @@
0,
0
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_297": {
- "bufferView": "bufferView_408",
- "byteOffset": 158012,
+ "accessor_330": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 158084,
"byteStride": 12,
+ "componentType": 5126,
"count": 2933,
"max": [
0.999806,
@@ -345,12 +542,13 @@
-0.999806,
-1
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_299": {
- "bufferView": "bufferView_408",
- "byteOffset": 193208,
+ "accessor_332": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 193280,
"byteStride": 8,
+ "componentType": 5126,
"count": 2933,
"max": [
0.888318,
@@ -360,27 +558,29 @@
-0.595152,
0.013247
],
- "type": 35664
- },
- "attribute_30": {
- "bufferView": "bufferView_408",
- "byteOffset": 2304,
- "byteStride": 8,
- "count": 96,
- "max": [
- 4.15963,
- 1.11374
- ],
- "min": [
- -1.14777,
- -0.08885
- ],
- "type": 35664
+ "type": "VEC2"
+ },
+ "accessor_34": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 4,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 2,
+ "type": "SCALAR"
+ },
+ "accessor_348": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 34776,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 216,
+ "type": "SCALAR"
},
- "attribute_317": {
- "bufferView": "bufferView_408",
- "byteOffset": 216672,
+ "accessor_350": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 216744,
"byteStride": 12,
+ "componentType": 5126,
"count": 120,
"max": [
0,
@@ -392,12 +592,13 @@
-0,
0
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_319": {
- "bufferView": "bufferView_408",
- "byteOffset": 218112,
+ "accessor_352": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 218184,
"byteStride": 12,
+ "componentType": 5126,
"count": 120,
"max": [
1,
@@ -409,12 +610,39 @@
-1,
-1
],
- "type": 35665
+ "type": "VEC3"
+ },
+ "accessor_36": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 24,
+ "byteStride": 12,
+ "componentType": 5126,
+ "count": 2,
+ "max": [
+ 119,
+ -0,
+ 34.625
+ ],
+ "min": [
+ 118,
+ -0,
+ 34.625
+ ],
+ "type": "VEC3"
+ },
+ "accessor_373": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 35208,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 4740,
+ "type": "SCALAR"
},
- "attribute_342": {
- "bufferView": "bufferView_408",
- "byteOffset": 219552,
+ "accessor_375": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 219624,
"byteStride": 12,
+ "componentType": 5126,
"count": 1968,
"max": [
117.98,
@@ -426,12 +654,13 @@
0,
0
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_344": {
- "bufferView": "bufferView_408",
- "byteOffset": 243168,
+ "accessor_377": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 243240,
"byteStride": 12,
+ "componentType": 5126,
"count": 1968,
"max": [
0.995313,
@@ -443,12 +672,13 @@
-0.995313,
-0.962469
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_346": {
- "bufferView": "bufferView_408",
- "byteOffset": 266784,
+ "accessor_379": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 266856,
"byteStride": 8,
+ "componentType": 5126,
"count": 1968,
"max": [
0.855532,
@@ -458,12 +688,29 @@
-0.555297,
0.021103
],
- "type": 35664
+ "type": "VEC2"
},
- "attribute_389": {
- "bufferView": "bufferView_408",
- "byteOffset": 282528,
+ "accessor_417": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 44688,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 66,
+ "type": "SCALAR"
+ },
+ "accessor_420": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 44820,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 66,
+ "type": "SCALAR"
+ },
+ "accessor_422": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 282600,
"byteStride": 12,
+ "componentType": 5126,
"count": 48,
"max": [
82.9854,
@@ -475,12 +722,13 @@
34.9944,
0
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_391": {
- "bufferView": "bufferView_408",
- "byteOffset": 283104,
+ "accessor_424": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 283176,
"byteStride": 12,
+ "componentType": 5126,
"count": 48,
"max": [
-0,
@@ -492,12 +740,13 @@
0,
-1
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_393": {
- "bufferView": "bufferView_408",
- "byteOffset": 283680,
+ "accessor_426": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 283752,
"byteStride": 8,
+ "componentType": 5126,
"count": 48,
"max": [
0.642232,
@@ -507,30 +756,40 @@
0.349715,
0.987863
],
- "type": 35664
+ "type": "VEC2"
+ },
+ "accessor_57": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 8,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 168,
+ "type": "SCALAR"
},
- "attribute_48": {
- "bufferView": "bufferView_408",
- "byteOffset": 3072,
+ "accessor_59": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 48,
"byteStride": 12,
- "count": 720,
+ "componentType": 5126,
+ "count": 96,
"max": [
- 16.8,
- 19.5,
- 0.75
+ 2,
+ 21,
+ 38
],
"min": [
- 1.4,
- -0,
- 0
+ 0,
+ 0,
+ 5.5
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_50": {
- "bufferView": "bufferView_408",
- "byteOffset": 11712,
+ "accessor_61": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 1200,
"byteStride": 12,
- "count": 720,
+ "componentType": 5126,
+ "count": 96,
"max": [
1,
1,
@@ -541,12 +800,37 @@
-1,
-1
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_68": {
- "bufferView": "bufferView_408",
- "byteOffset": 20352,
+ "accessor_63": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 2352,
+ "byteStride": 8,
+ "componentType": 5126,
+ "count": 96,
+ "max": [
+ 4.15963,
+ 1.11374
+ ],
+ "min": [
+ -1.14777,
+ -0.08885
+ ],
+ "type": "VEC2"
+ },
+ "accessor_79": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 344,
+ "byteStride": 0,
+ "componentType": 5123,
+ "count": 1944,
+ "type": "SCALAR"
+ },
+ "accessor_81": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 3120,
"byteStride": 12,
+ "componentType": 5126,
"count": 720,
"max": [
16.8,
@@ -558,12 +842,13 @@
-0,
0
],
- "type": 35665
+ "type": "VEC3"
},
- "attribute_70": {
- "bufferView": "bufferView_408",
- "byteOffset": 28992,
+ "accessor_83": {
+ "bufferView": "bufferView_429",
+ "byteOffset": 11760,
"byteStride": 12,
+ "componentType": 5126,
"count": 720,
"max": [
1,
@@ -575,182 +860,43 @@
-1,
-1
],
- "type": 35665
- },
- "attribute_93": {
- "bufferView": "bufferView_408",
- "byteOffset": 37632,
- "byteStride": 12,
- "count": 30,
- "max": [
- 0.5,
- 21,
- 46.6166
- ],
- "min": [
- -0.5,
- 0,
- 2.5
- ],
- "type": 35665
- },
- "attribute_95": {
- "bufferView": "bufferView_408",
- "byteOffset": 37992,
- "byteStride": 12,
- "count": 30,
- "max": [
- 1,
- 1,
- 1
- ],
- "min": [
- -1,
- -1,
- -1
- ],
- "type": 35665
- },
- "attribute_97": {
- "bufferView": "bufferView_408",
- "byteOffset": 38352,
- "byteStride": 8,
- "count": 30,
- "max": [
- 0.291667,
- 1
- ],
- "min": [
- -0.291667,
- 0.352547
- ],
- "type": 35664
- },
- "indices_118": {
- "bufferView": "bufferView_409",
- "byteOffset": 8208,
- "count": 360,
- "type": 5123
- },
- "indices_145": {
- "bufferView": "bufferView_409",
- "byteOffset": 8928,
- "count": 168,
- "type": 5123
- },
- "indices_172": {
- "bufferView": "bufferView_409",
- "byteOffset": 9264,
- "count": 4740,
- "type": 5123
- },
- "indices_216": {
- "bufferView": "bufferView_409",
- "byteOffset": 18744,
- "count": 66,
- "type": 5123
- },
- "indices_219": {
- "bufferView": "bufferView_409",
- "byteOffset": 18876,
- "count": 66,
- "type": 5123
- },
- "indices_24": {
- "bufferView": "bufferView_409",
- "byteOffset": 0,
- "count": 168,
- "type": 5123
- },
- "indices_246": {
- "bufferView": "bufferView_409",
- "byteOffset": 19008,
- "count": 360,
- "type": 5123
+ "type": "VEC3"
},
- "indices_268": {
- "bufferView": "bufferView_409",
- "byteOffset": 19728,
- "count": 600,
- "type": 5123
- },
- "indices_293": {
- "bufferView": "bufferView_409",
- "byteOffset": 20928,
- "count": 6918,
- "type": 5123
- },
- "indices_315": {
- "bufferView": "bufferView_409",
- "byteOffset": 34764,
- "count": 216,
- "type": 5123
- },
- "indices_340": {
- "bufferView": "bufferView_409",
- "byteOffset": 35196,
- "count": 4740,
- "type": 5123
- },
- "indices_384": {
- "bufferView": "bufferView_409",
- "byteOffset": 44676,
- "count": 66,
- "type": 5123
- },
- "indices_387": {
- "bufferView": "bufferView_409",
- "byteOffset": 44808,
- "count": 66,
- "type": 5123
- },
- "indices_46": {
- "bufferView": "bufferView_409",
- "byteOffset": 336,
+ "accessor_99": {
+ "bufferView": "bufferView_428",
+ "byteOffset": 4232,
+ "byteStride": 0,
+ "componentType": 5123,
"count": 1944,
- "type": 5123
- },
- "indices_66": {
- "bufferView": "bufferView_409",
- "byteOffset": 4224,
- "count": 1944,
- "type": 5123
- },
- "indices_91": {
- "bufferView": "bufferView_409",
- "byteOffset": 8112,
- "count": 48,
- "type": 5123
+ "type": "SCALAR"
}
},
"animations": {},
"asset": {
- "generator": "collada2gltf@75061f683116dc0ffdad48f33c226e933132e98c"
+ "generator": "collada2gltf@f356b99aef8868f74877c7ca545f2cd206b9d3b7",
+ "premultipliedAlpha": true,
+ "profile": "WebGL 1.0.2",
+ "version": 0.8
},
"bufferViews": {
- "bufferView_408": {
+ "bufferView_428": {
"buffer": "wine",
- "byteLength": 284064,
+ "byteLength": 44952,
"byteOffset": 0,
- "target": 34962
- },
- "bufferView_409": {
- "buffer": "wine",
- "byteLength": 44940,
- "byteOffset": 284064,
"target": 34963
},
- "bufferView_410": {
+ "bufferView_429": {
"buffer": "wine",
- "byteLength": 0,
- "byteOffset": 329004
+ "byteLength": 284136,
+ "byteOffset": 44952,
+ "target": 34962
}
},
"buffers": {
"wine": {
- "byteLength": 329004,
- "path": "wine.bin",
- "type": "arraybuffer"
+ "byteLength": 329088,
+ "type": "arraybuffer",
+ "uri": "wine.bin"
}
},
"cameras": {
@@ -764,14 +910,14 @@
}
},
"images": {
- "image_0": {
- "path": "artezin_bottle.jpg"
+ "ID140": {
+ "uri": "artezin_bottle.jpg"
},
- "image_1": {
- "path": "Wood_Cherry_Original_.jpg"
+ "ID7": {
+ "uri": "Wood_Cherry_Original_.jpg"
},
- "image_2": {
- "path": "_2004_old_vine_zinfandel_btl_xlg.jpg"
+ "ID78": {
+ "uri": "_2004_old_vine_zinfandel_btl_xlg.jpg"
}
},
"materials": {
@@ -785,7 +931,7 @@
0.2,
1
],
- "diffuse": "texture_image_0"
+ "diffuse": "texture_ID140"
}
},
"name": "artezin_bottle"
@@ -811,6 +957,20 @@
},
"name": "material_5"
},
+ "ID217": {
+ "instanceTechnique": {
+ "technique": "technique3",
+ "values": {}
+ },
+ "name": "edge_color683818255"
+ },
+ "ID227": {
+ "instanceTechnique": {
+ "technique": "technique3",
+ "values": {}
+ },
+ "name": "edge_color353535255"
+ },
"ID6": {
"instanceTechnique": {
"technique": "technique1",
@@ -821,7 +981,7 @@
0.2,
1
],
- "diffuse": "texture_image_1"
+ "diffuse": "texture_ID7"
}
},
"name": "Wood_Cherry_Original_"
@@ -836,14 +996,14 @@
0.2,
1
],
- "diffuse": "texture_image_2"
+ "diffuse": "texture_ID78"
}
},
"name": "_2004_old_vine_zinfandel_btl_xlg"
},
"ID89": {
"instanceTechnique": {
- "technique": "technique3",
+ "technique": "technique4",
"values": {
"ambient": [
0.2,
@@ -863,16 +1023,42 @@
}
},
"meshes": {
+ "geometry10": {
+ "name": "geometry10",
+ "primitives": [
+ {
+ "attributes": {
+ "POSITION": "accessor_24"
+ },
+ "indices": "accessor_22",
+ "material": "ID217",
+ "primitive": 1
+ }
+ ]
+ },
+ "geometry13": {
+ "name": "geometry13",
+ "primitives": [
+ {
+ "attributes": {
+ "POSITION": "accessor_36"
+ },
+ "indices": "accessor_34",
+ "material": "ID227",
+ "primitive": 1
+ }
+ ]
+ },
"geometry16": {
"name": "geometry16",
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_28",
- "POSITION": "attribute_26",
- "TEXCOORD_0": "attribute_30"
+ "NORMAL": "accessor_61",
+ "POSITION": "accessor_59",
+ "TEXCOORD_0": "accessor_63"
},
- "indices": "indices_24",
+ "indices": "accessor_57",
"material": "ID6",
"primitive": 4
}
@@ -883,10 +1069,10 @@
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_50",
- "POSITION": "attribute_48"
+ "NORMAL": "accessor_83",
+ "POSITION": "accessor_81"
},
- "indices": "indices_46",
+ "indices": "accessor_79",
"material": "ID21",
"primitive": 4
}
@@ -897,10 +1083,10 @@
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_70",
- "POSITION": "attribute_68"
+ "NORMAL": "accessor_103",
+ "POSITION": "accessor_101"
},
- "indices": "indices_66",
+ "indices": "accessor_99",
"material": "ID21",
"primitive": 4
}
@@ -911,11 +1097,11 @@
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_95",
- "POSITION": "attribute_93",
- "TEXCOORD_0": "attribute_97"
+ "NORMAL": "accessor_128",
+ "POSITION": "accessor_126",
+ "TEXCOORD_0": "accessor_130"
},
- "indices": "indices_91",
+ "indices": "accessor_124",
"material": "ID6",
"primitive": 4
}
@@ -926,11 +1112,11 @@
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_122",
- "POSITION": "attribute_120",
- "TEXCOORD_0": "attribute_124"
+ "NORMAL": "accessor_155",
+ "POSITION": "accessor_153",
+ "TEXCOORD_0": "accessor_157"
},
- "indices": "indices_118",
+ "indices": "accessor_151",
"material": "ID6",
"primitive": 4
}
@@ -941,26 +1127,39 @@
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_149",
- "POSITION": "attribute_147",
- "TEXCOORD_0": "attribute_151"
+ "NORMAL": "accessor_182",
+ "POSITION": "accessor_180",
+ "TEXCOORD_0": "accessor_184"
},
- "indices": "indices_145",
+ "indices": "accessor_178",
"material": "ID6",
"primitive": 4
}
]
},
+ "geometry5": {
+ "name": "geometry5",
+ "primitives": [
+ {
+ "attributes": {
+ "POSITION": "accessor_12"
+ },
+ "indices": "accessor_10",
+ "material": "ID217",
+ "primitive": 1
+ }
+ ]
+ },
"geometry51": {
"name": "geometry51",
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_176",
- "POSITION": "attribute_174",
- "TEXCOORD_0": "attribute_178"
+ "NORMAL": "accessor_209",
+ "POSITION": "accessor_207",
+ "TEXCOORD_0": "accessor_211"
},
- "indices": "indices_172",
+ "indices": "accessor_205",
"material": "ID77",
"primitive": 4
}
@@ -971,21 +1170,21 @@
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_223",
- "POSITION": "attribute_221",
- "TEXCOORD_0": "attribute_225"
+ "NORMAL": "accessor_256",
+ "POSITION": "accessor_254",
+ "TEXCOORD_0": "accessor_258"
},
- "indices": "indices_216",
+ "indices": "accessor_249",
"material": "ID89",
"primitive": 4
},
{
"attributes": {
- "NORMAL": "attribute_223",
- "POSITION": "attribute_221",
- "TEXCOORD_0": "attribute_225"
+ "NORMAL": "accessor_256",
+ "POSITION": "accessor_254",
+ "TEXCOORD_0": "accessor_258"
},
- "indices": "indices_219",
+ "indices": "accessor_252",
"material": "ID77",
"primitive": 4
}
@@ -996,11 +1195,11 @@
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_250",
- "POSITION": "attribute_248",
- "TEXCOORD_0": "attribute_252"
+ "NORMAL": "accessor_283",
+ "POSITION": "accessor_281",
+ "TEXCOORD_0": "accessor_285"
},
- "indices": "indices_246",
+ "indices": "accessor_279",
"material": "ID6",
"primitive": 4
}
@@ -1011,10 +1210,10 @@
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_272",
- "POSITION": "attribute_270"
+ "NORMAL": "accessor_305",
+ "POSITION": "accessor_303"
},
- "indices": "indices_268",
+ "indices": "accessor_301",
"material": "ID21",
"primitive": 4
}
@@ -1025,11 +1224,11 @@
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_297",
- "POSITION": "attribute_295",
- "TEXCOORD_0": "attribute_299"
+ "NORMAL": "accessor_330",
+ "POSITION": "accessor_328",
+ "TEXCOORD_0": "accessor_332"
},
- "indices": "indices_293",
+ "indices": "accessor_326",
"material": "ID139",
"primitive": 4
}
@@ -1040,10 +1239,10 @@
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_319",
- "POSITION": "attribute_317"
+ "NORMAL": "accessor_352",
+ "POSITION": "accessor_350"
},
- "indices": "indices_315",
+ "indices": "accessor_348",
"material": "ID21",
"primitive": 4
}
@@ -1054,11 +1253,11 @@
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_344",
- "POSITION": "attribute_342",
- "TEXCOORD_0": "attribute_346"
+ "NORMAL": "accessor_377",
+ "POSITION": "accessor_375",
+ "TEXCOORD_0": "accessor_379"
},
- "indices": "indices_340",
+ "indices": "accessor_373",
"material": "ID77",
"primitive": 4
}
@@ -1069,21 +1268,21 @@
"primitives": [
{
"attributes": {
- "NORMAL": "attribute_391",
- "POSITION": "attribute_389",
- "TEXCOORD_0": "attribute_393"
+ "NORMAL": "accessor_424",
+ "POSITION": "accessor_422",
+ "TEXCOORD_0": "accessor_426"
},
- "indices": "indices_384",
+ "indices": "accessor_417",
"material": "ID89",
"primitive": 4
},
{
"attributes": {
- "NORMAL": "attribute_391",
- "POSITION": "attribute_389",
- "TEXCOORD_0": "attribute_393"
+ "NORMAL": "accessor_424",
+ "POSITION": "accessor_422",
+ "TEXCOORD_0": "accessor_426"
},
- "indices": "indices_387",
+ "indices": "accessor_420",
"material": "ID77",
"primitive": 4
}
@@ -2993,6 +3192,9 @@
0,
1
],
+ "meshes": [
+ "geometry5"
+ ],
"name": "ID215"
},
"ID221": {
@@ -3015,6 +3217,9 @@
0,
1
],
+ "meshes": [
+ "geometry10"
+ ],
"name": "ID221"
},
"ID225": {
@@ -3037,6 +3242,9 @@
0,
1
],
+ "meshes": [
+ "geometry13"
+ ],
"name": "ID225"
},
"ID28": {
@@ -11577,9 +11785,33 @@
"geometry58"
],
"name": "ID88"
+ },
+ "node_424": {
+ "children": [
+ "SketchUp",
+ "default_camera"
+ ],
+ "matrix": [
+ 1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ 0,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 1
+ ],
+ "name": "Y_UP_Transform"
}
},
- "profile": "WebGL 1.0.2",
"programs": {
"program_0": {
"attributes": [
@@ -11595,16 +11827,23 @@
"a_normal",
"a_position"
],
+ "fragmentShader": "wine1FS",
+ "vertexShader": "wine1VS"
+ },
+ "program_2": {
+ "attributes": [
+ "a_position"
+ ],
"fragmentShader": "wine2FS",
"vertexShader": "wine2VS"
},
- "program_2": {
+ "program_3": {
"attributes": [
"a_normal",
"a_position"
],
- "fragmentShader": "wine4FS",
- "vertexShader": "wine4VS"
+ "fragmentShader": "wine3FS",
+ "vertexShader": "wine3VS"
}
},
"samplers": {
@@ -11619,29 +11858,42 @@
"scenes": {
"defaultScene": {
"nodes": [
- "SketchUp",
- "default_camera"
+ "node_424"
]
}
},
"shaders": {
"wine0FS": {
- "path": "wine0FS.glsl"
+ "type": 35632,
+ "uri": "wine0FS.glsl"
},
"wine0VS": {
- "path": "wine0VS.glsl"
+ "type": 35633,
+ "uri": "wine0VS.glsl"
+ },
+ "wine1FS": {
+ "type": 35632,
+ "uri": "wine1FS.glsl"
+ },
+ "wine1VS": {
+ "type": 35633,
+ "uri": "wine1VS.glsl"
},
"wine2FS": {
- "path": "wine2FS.glsl"
+ "type": 35632,
+ "uri": "wine2FS.glsl"
},
"wine2VS": {
- "path": "wine2VS.glsl"
+ "type": 35633,
+ "uri": "wine2VS.glsl"
},
- "wine4FS": {
- "path": "wine4FS.glsl"
+ "wine3FS": {
+ "type": 35632,
+ "uri": "wine3FS.glsl"
},
- "wine4VS": {
- "path": "wine4VS.glsl"
+ "wine3VS": {
+ "type": 35633,
+ "uri": "wine3VS.glsl"
}
},
"skins": {},
@@ -11717,10 +11969,10 @@
}
},
"states": {
- "blendEnable": 0,
- "cullFaceEnable": 1,
- "depthMask": 1,
- "depthTestEnable": 1
+ "enable": [
+ 2884,
+ 2929
+ ]
}
}
}
@@ -11793,21 +12045,79 @@
}
},
"states": {
- "blendEnable": 1,
- "blendEquation": 32774,
- "blendFunc": {
- "dfactor": 771,
- "sfactor": 770
- },
- "cullFaceEnable": 1,
- "depthMask": 0,
- "depthTestEnable": 1
+ "enable": [
+ 2884,
+ 2929,
+ 3042
+ ],
+ "functions": {
+ "blendEquationSeparate": [
+ 32774,
+ 32774
+ ],
+ "blendFuncSeparate": [
+ 1,
+ 771,
+ 1,
+ 771
+ ]
+ }
}
}
}
},
"technique3": {
"parameters": {
+ "modelViewMatrix": {
+ "semantic": "MODELVIEW",
+ "type": 35676
+ },
+ "position": {
+ "semantic": "POSITION",
+ "type": 35665
+ },
+ "projectionMatrix": {
+ "semantic": "PROJECTION",
+ "type": 35676
+ }
+ },
+ "pass": "defaultPass",
+ "passes": {
+ "defaultPass": {
+ "details": {
+ "commonProfile": {
+ "extras": {
+ "doubleSided": false
+ },
+ "lightingModel": "Constant",
+ "parameters": [
+ "modelViewMatrix",
+ "projectionMatrix"
+ ]
+ },
+ "type": "COLLADA-1.4.1/commonProfile"
+ },
+ "instanceProgram": {
+ "attributes": {
+ "a_position": "position"
+ },
+ "program": "program_2",
+ "uniforms": {
+ "u_modelViewMatrix": "modelViewMatrix",
+ "u_projectionMatrix": "projectionMatrix"
+ }
+ },
+ "states": {
+ "enable": [
+ 2884,
+ 2929
+ ]
+ }
+ }
+ }
+ },
+ "technique4": {
+ "parameters": {
"ambient": {
"type": 35666
},
@@ -11859,7 +12169,7 @@
"a_normal": "normal",
"a_position": "position"
},
- "program": "program_2",
+ "program": "program_3",
"uniforms": {
"u_ambient": "ambient",
"u_diffuse": "diffuse",
@@ -11869,36 +12179,39 @@
}
},
"states": {
- "blendEnable": 0,
- "cullFaceEnable": 1,
- "depthMask": 1,
- "depthTestEnable": 1
+ "enable": [
+ 2884,
+ 2929
+ ]
}
}
}
}
},
"textures": {
- "texture_image_0": {
+ "texture_ID140": {
"format": 6408,
"internalFormat": 6408,
"sampler": "sampler_0",
- "source": "image_0",
- "target": 3553
+ "source": "ID140",
+ "target": 3553,
+ "type": 5121
},
- "texture_image_1": {
+ "texture_ID7": {
"format": 6408,
"internalFormat": 6408,
"sampler": "sampler_0",
- "source": "image_1",
- "target": 3553
+ "source": "ID7",
+ "target": 3553,
+ "type": 5121
},
- "texture_image_2": {
+ "texture_ID78": {
"format": 6408,
"internalFormat": 6408,
"sampler": "sampler_0",
- "source": "image_2",
- "target": 3553
+ "source": "ID78",
+ "target": 3553,
+ "type": 5121
}
}
} \ No newline at end of file
diff --git a/examples/qt3d/exampleresources/assets/gltf/wine/wine0FS.glsl b/examples/qt3d/exampleresources/assets/gltf/wine/wine0FS.glsl
index b01fbb1a1..6e4b7e6d1 100644
--- a/examples/qt3d/exampleresources/assets/gltf/wine/wine0FS.glsl
+++ b/examples/qt3d/exampleresources/assets/gltf/wine/wine0FS.glsl
@@ -1,21 +1,17 @@
-#version 150
-//precision highp float;
-
-in vec3 v_normal;
+precision highp float;
+varying vec3 v_normal;
uniform vec4 u_ambient;
-in vec2 v_texcoord0;
+varying vec2 v_texcoord0;
uniform sampler2D u_diffuse;
-out vec4 fragColor;
-
void main(void) {
- vec3 normal = normalize(v_normal);
- vec4 color = vec4(0., 0., 0., 0.);
- vec4 diffuse = vec4(0., 0., 0., 1.);
- vec4 ambient;
- ambient = u_ambient;
- diffuse = texture(u_diffuse, v_texcoord0);
- diffuse.xyz *= max(dot(normal,vec3(0.,0.,1.)), 0.);
- color.xyz += diffuse.xyz;
- color = vec4(color.rgb * diffuse.a, diffuse.a);
- fragColor = color;
+vec3 normal = normalize(v_normal);
+vec4 color = vec4(0., 0., 0., 0.);
+vec4 diffuse = vec4(0., 0., 0., 1.);
+vec4 ambient;
+ambient = u_ambient;
+diffuse = texture2D(u_diffuse, v_texcoord0);
+diffuse.xyz *= max(dot(normal,vec3(0.,0.,1.)), 0.);
+color.xyz += diffuse.xyz;
+color = vec4(color.rgb * diffuse.a, diffuse.a);
+gl_FragColor = color;
}
diff --git a/examples/qt3d/exampleresources/assets/gltf/wine/wine0VS.glsl b/examples/qt3d/exampleresources/assets/gltf/wine/wine0VS.glsl
index f03b74739..cacc9ed99 100644
--- a/examples/qt3d/exampleresources/assets/gltf/wine/wine0VS.glsl
+++ b/examples/qt3d/exampleresources/assets/gltf/wine/wine0VS.glsl
@@ -1,18 +1,15 @@
-#version 150
-//precision highp float;
-
-in vec3 a_position;
-in vec3 a_normal;
-out vec3 v_normal;
+precision highp float;
+attribute vec3 a_position;
+attribute vec3 a_normal;
+varying vec3 v_normal;
uniform mat3 u_normalMatrix;
uniform mat4 u_modelViewMatrix;
uniform mat4 u_projectionMatrix;
-in vec2 a_texcoord0;
-out vec2 v_texcoord0;
-
+attribute vec2 a_texcoord0;
+varying vec2 v_texcoord0;
void main(void) {
- vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
- v_normal = normalize(u_normalMatrix * a_normal);
- v_texcoord0 = a_texcoord0;
- gl_Position = u_projectionMatrix * pos;
+vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
+v_normal = u_normalMatrix * a_normal;
+v_texcoord0 = a_texcoord0;
+gl_Position = u_projectionMatrix * pos;
}
diff --git a/examples/qt3d/exampleresources/assets/gltf/wine/wine1FS.glsl b/examples/qt3d/exampleresources/assets/gltf/wine/wine1FS.glsl
new file mode 100644
index 000000000..d490b4ee7
--- /dev/null
+++ b/examples/qt3d/exampleresources/assets/gltf/wine/wine1FS.glsl
@@ -0,0 +1,17 @@
+precision highp float;
+varying vec3 v_normal;
+uniform vec4 u_ambient;
+uniform vec4 u_diffuse;
+uniform float u_transparency;
+void main(void) {
+vec3 normal = normalize(v_normal);
+vec4 color = vec4(0., 0., 0., 0.);
+vec4 diffuse = vec4(0., 0., 0., 1.);
+vec4 ambient;
+ambient = u_ambient;
+diffuse = u_diffuse;
+diffuse.xyz *= max(dot(normal,vec3(0.,0.,1.)), 0.);
+color.xyz += diffuse.xyz;
+color = vec4(color.rgb * diffuse.a, diffuse.a * u_transparency);
+gl_FragColor = color;
+}
diff --git a/examples/qt3d/exampleresources/assets/gltf/wine/wine1VS.glsl b/examples/qt3d/exampleresources/assets/gltf/wine/wine1VS.glsl
new file mode 100644
index 000000000..9e3592280
--- /dev/null
+++ b/examples/qt3d/exampleresources/assets/gltf/wine/wine1VS.glsl
@@ -0,0 +1,12 @@
+precision highp float;
+attribute vec3 a_position;
+attribute vec3 a_normal;
+varying vec3 v_normal;
+uniform mat3 u_normalMatrix;
+uniform mat4 u_modelViewMatrix;
+uniform mat4 u_projectionMatrix;
+void main(void) {
+vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
+v_normal = u_normalMatrix * a_normal;
+gl_Position = u_projectionMatrix * pos;
+}
diff --git a/examples/qt3d/exampleresources/assets/gltf/wine/wine2FS.glsl b/examples/qt3d/exampleresources/assets/gltf/wine/wine2FS.glsl
index 72192fee4..b41a6d5fc 100644
--- a/examples/qt3d/exampleresources/assets/gltf/wine/wine2FS.glsl
+++ b/examples/qt3d/exampleresources/assets/gltf/wine/wine2FS.glsl
@@ -1,21 +1,8 @@
-#version 150
-//precision highp float;
-
-in vec3 v_normal;
-uniform vec4 u_ambient;
-uniform vec4 u_diffuse;
-uniform float u_transparency;
-out vec4 fragColor;
-
+precision highp float;
void main(void) {
- vec3 normal = normalize(v_normal);
- vec4 color = vec4(0., 0., 0., 0.);
- vec4 diffuse = vec4(0., 0., 0., 1.);
- vec4 ambient;
- ambient = u_ambient;
- diffuse = u_diffuse;
- diffuse.xyz *= max(dot(normal,vec3(0.,0.,1.)), 0.);
- color.xyz += diffuse.xyz;
- color = vec4(color.rgb * diffuse.a, diffuse.a * u_transparency);
- fragColor = color;
+vec4 color = vec4(0., 0., 0., 0.);
+vec4 diffuse = vec4(0., 0., 0., 1.);
+color.xyz += diffuse.xyz;
+color = vec4(color.rgb * diffuse.a, diffuse.a);
+gl_FragColor = color;
}
diff --git a/examples/qt3d/exampleresources/assets/gltf/wine/wine2VS.glsl b/examples/qt3d/exampleresources/assets/gltf/wine/wine2VS.glsl
index 1b5eabce9..17237bfea 100644
--- a/examples/qt3d/exampleresources/assets/gltf/wine/wine2VS.glsl
+++ b/examples/qt3d/exampleresources/assets/gltf/wine/wine2VS.glsl
@@ -1,15 +1,8 @@
-#version 150
-//precision highp float;
-
-in vec3 a_position;
-in vec3 a_normal;
-out vec3 v_normal;
-uniform mat3 u_normalMatrix;
+precision highp float;
+attribute vec3 a_position;
uniform mat4 u_modelViewMatrix;
uniform mat4 u_projectionMatrix;
-
void main(void) {
- vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
- v_normal = normalize(u_normalMatrix * a_normal);
- gl_Position = u_projectionMatrix * pos;
+vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
+gl_Position = u_projectionMatrix * pos;
}
diff --git a/examples/qt3d/exampleresources/assets/gltf/wine/wine3FS.glsl b/examples/qt3d/exampleresources/assets/gltf/wine/wine3FS.glsl
new file mode 100644
index 000000000..79082198c
--- /dev/null
+++ b/examples/qt3d/exampleresources/assets/gltf/wine/wine3FS.glsl
@@ -0,0 +1,16 @@
+precision highp float;
+varying vec3 v_normal;
+uniform vec4 u_ambient;
+uniform vec4 u_diffuse;
+void main(void) {
+vec3 normal = normalize(v_normal);
+vec4 color = vec4(0., 0., 0., 0.);
+vec4 diffuse = vec4(0., 0., 0., 1.);
+vec4 ambient;
+ambient = u_ambient;
+diffuse = u_diffuse;
+diffuse.xyz *= max(dot(normal,vec3(0.,0.,1.)), 0.);
+color.xyz += diffuse.xyz;
+color = vec4(color.rgb * diffuse.a, diffuse.a);
+gl_FragColor = color;
+}
diff --git a/examples/qt3d/exampleresources/assets/gltf/wine/wine3VS.glsl b/examples/qt3d/exampleresources/assets/gltf/wine/wine3VS.glsl
new file mode 100644
index 000000000..9e3592280
--- /dev/null
+++ b/examples/qt3d/exampleresources/assets/gltf/wine/wine3VS.glsl
@@ -0,0 +1,12 @@
+precision highp float;
+attribute vec3 a_position;
+attribute vec3 a_normal;
+varying vec3 v_normal;
+uniform mat3 u_normalMatrix;
+uniform mat4 u_modelViewMatrix;
+uniform mat4 u_projectionMatrix;
+void main(void) {
+vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
+v_normal = u_normalMatrix * a_normal;
+gl_Position = u_projectionMatrix * pos;
+}
diff --git a/examples/qt3d/exampleresources/assets/gltf/wine/wine4FS.glsl b/examples/qt3d/exampleresources/assets/gltf/wine/wine4FS.glsl
deleted file mode 100644
index 99acdb37c..000000000
--- a/examples/qt3d/exampleresources/assets/gltf/wine/wine4FS.glsl
+++ /dev/null
@@ -1,20 +0,0 @@
-#version 150
-//precision highp float;
-
-in vec3 v_normal;
-uniform vec4 u_ambient;
-uniform vec4 u_diffuse;
-out vec4 fragColor;
-
-void main(void) {
- vec3 normal = normalize(v_normal);
- vec4 color = vec4(0., 0., 0., 0.);
- vec4 diffuse = vec4(0., 0., 0., 1.);
- vec4 ambient;
- ambient = u_ambient;
- diffuse = u_diffuse;
- diffuse.xyz *= max(dot(normal,vec3(0.,0.,1.)), 0.);
- color.xyz += diffuse.xyz;
- color = vec4(color.rgb * diffuse.a, diffuse.a);
- fragColor = color;
-}
diff --git a/examples/qt3d/exampleresources/assets/gltf/wine/wine4VS.glsl b/examples/qt3d/exampleresources/assets/gltf/wine/wine4VS.glsl
deleted file mode 100644
index 0e66d42c1..000000000
--- a/examples/qt3d/exampleresources/assets/gltf/wine/wine4VS.glsl
+++ /dev/null
@@ -1,17 +0,0 @@
-#version 150
-//precision highp float;
-
-in vec3 a_position;
-in vec3 a_normal;
-out vec3 v_normal;
-
-uniform mat3 u_normalMatrix;
-uniform mat4 u_modelViewMatrix;
-uniform mat4 u_projectionMatrix;
-
-void main(void) {
- vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
- v_normal = normalize(u_normalMatrix * a_normal);
- gl_Position = u_projectionMatrix * pos;
-}
-
diff --git a/examples/qt3d/exampleresources/gltf.qrc b/examples/qt3d/exampleresources/gltf.qrc
index ecc727504..869fb16dc 100644
--- a/examples/qt3d/exampleresources/gltf.qrc
+++ b/examples/qt3d/exampleresources/gltf.qrc
@@ -4,13 +4,15 @@
<file>assets/gltf/wine/artezin_bottle.jpg</file>
<file>assets/gltf/wine/wine.bin</file>
<file>assets/gltf/wine/wine.dae</file>
- <file>assets/gltf/wine/wine.json</file>
<file>assets/gltf/wine/wine0FS.glsl</file>
<file>assets/gltf/wine/wine0VS.glsl</file>
<file>assets/gltf/wine/wine2FS.glsl</file>
<file>assets/gltf/wine/wine2VS.glsl</file>
- <file>assets/gltf/wine/wine4FS.glsl</file>
- <file>assets/gltf/wine/wine4VS.glsl</file>
<file>assets/gltf/wine/Wood_Cherry_Original_.jpg</file>
+ <file>assets/gltf/wine/wine.gltf</file>
+ <file>assets/gltf/wine/wine1FS.glsl</file>
+ <file>assets/gltf/wine/wine1VS.glsl</file>
+ <file>assets/gltf/wine/wine3FS.glsl</file>
+ <file>assets/gltf/wine/wine3VS.glsl</file>
</qresource>
</RCC>
diff --git a/examples/qt3d/gltf/Wine.qml b/examples/qt3d/gltf/Wine.qml
new file mode 100644
index 000000000..4a61c6584
--- /dev/null
+++ b/examples/qt3d/gltf/Wine.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D 2.0
+import Qt3D.Renderer 2.0
+
+Entity {
+ id: root
+
+ property alias x: wineTranslate.dx
+ property alias y: wineTranslate.dy
+ property alias z: wineTranslate.dz
+ property alias angleX: rotateX.angle
+ property alias angleY: rotateY.angle
+ property alias angleZ: rotateZ.angle
+ property alias scale: wineScale.scale
+
+ components: [
+ Transform {
+ Rotate {
+ id: rotateX
+ axis: Qt.vector3d(1, 0, 0)
+ }
+ Rotate {
+ id: rotateY
+ axis: Qt.vector3d(0, 1, 0)
+ }
+ Rotate {
+ id: rotateZ
+ axis: Qt.vector3d(0, 0, 1)
+ }
+ Translate {
+ id: wineTranslate
+ }
+ Scale {
+ id: wineScale
+ }
+ },
+ SceneLoader
+ {
+ source: "qrc:/assets/gltf/wine/wine.gltf"
+ }
+ ]
+}
diff --git a/examples/qt3d/gltf/basic.frag b/examples/qt3d/gltf/basic.frag
deleted file mode 100644
index 6f83f6b90..000000000
--- a/examples/qt3d/gltf/basic.frag
+++ /dev/null
@@ -1,12 +0,0 @@
-#version 330
-
-in vec3 color;
-
-out vec4 fragColor;
-
-void main()
-{
- // The color variable is interpolated to this fragment's position
- // for us by OpenGL.
- fragColor = vec4( color, 1.0 );
-}
diff --git a/examples/qt3d/gltf/basic.vert b/examples/qt3d/gltf/basic.vert
deleted file mode 100644
index 0e35affd5..000000000
--- a/examples/qt3d/gltf/basic.vert
+++ /dev/null
@@ -1,18 +0,0 @@
-#version 330
-
-in vec3 vertexPosition;
-in vec3 vertexColor;
-
-uniform mat4 u_projection;
-uniform mat4 u_model;
-
-out vec3 color;
-
-void main()
-{
- // Pass through the color to the fragment shader
- color = vertexColor;
-
- // Calculate the vertex position
- gl_Position = u_projection * u_model * vec4( vertexPosition, 1.0 );
-}
diff --git a/examples/qt3d/gltf/gltf.pro b/examples/qt3d/gltf/gltf.pro
index 5b75283ae..7f65358d5 100644
--- a/examples/qt3d/gltf/gltf.pro
+++ b/examples/qt3d/gltf/gltf.pro
@@ -10,9 +10,9 @@ SOURCES += \
main.cpp
OTHER_FILES += \
- main.qml
+ main.qml \
+ Wine.qml
RESOURCES += \
gltf_example.qrc \
../exampleresources/gltf.qrc \
- ../exampleresources/obj.qrc
diff --git a/examples/qt3d/gltf/gltf_example.qrc b/examples/qt3d/gltf/gltf_example.qrc
index c24519313..0da7ea21f 100644
--- a/examples/qt3d/gltf/gltf_example.qrc
+++ b/examples/qt3d/gltf/gltf_example.qrc
@@ -1,7 +1,6 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
- <file>basic.frag</file>
- <file>basic.vert</file>
+ <file>Wine.qml</file>
</qresource>
</RCC>
diff --git a/examples/qt3d/gltf/main.qml b/examples/qt3d/gltf/main.qml
index acce5d7ac..c58aaf5d4 100644
--- a/examples/qt3d/gltf/main.qml
+++ b/examples/qt3d/gltf/main.qml
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt3D module of the Qt Toolkit.
@@ -36,150 +37,43 @@
import Qt3D 2.0
import Qt3D.Renderer 2.0
-import QtQuick 2.1 as QQ2
Entity {
- id: root
- objectName: "root"
-
- Scene {
- id: wineScene
- source: ":/assets/gltf/wine/wine.json"
-
- Entity {
- transforms: [
- Translate {
- dx: 100
- dy: 0
- dz: -100
- }
-
- ]
-
- property Mesh myMesh: ballmesh
- }
-
- Entity {
- property Mesh myMesh: ballmesh
-
- transforms: [
- Translate {
- dx: 0
- dy: 100
- }
-
- ]
-
- property Material mat: greenMaterial
- }
-
- Entity {
- property Shape myShape: sphere1
-
- transforms: [
- Translate {
- dx: 50
- dy: 50
- }
-
- ]
-
- property Material mat: greenMaterial
-
- Shape {
- id: sphere1
- radius: 25
- rings: 32
- slices: 32
- }
- }
-
- Entity {
- property Shape myShape: torus1
-
- transforms: [
- Translate {
- dx: 50
- dy: 120
- }
-
- ]
-
- property Material mat: blueMaterial
-
- Shape {
- id: torus1
- radius: 40
- minorRadius: 15
- type: Shape.ShapeTorus
- }
- }
-
-
- Entity {
- property Mesh myMesh: ballmesh
-
- transforms: [
- Rotate {
- angle: 45
- axis: Qt.vector3d(0, 1, 0)
- },
-
- Translate {
- dx: 40
- dy: 100
- }
- ]
-
- property Material mat: blueMaterial
- }
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 20.0, -120.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
}
- Mesh {
- id: ballmesh
- source: ":/assets/obj/ball.obj"
+ Configuration {
+ controlledCamera: camera
}
- Material {
- id: greenMaterial
-
- parameters: [
- /*
- Tag {
- name: "kd"
- value: Qt.green
- }
- */
-
- Tag {
- name: "kd"
- value: Qt.vector3d( 0.2, 1.0, 0.1 )
-
- QQ2.Vector3dAnimation on value {
- from: Qt.vector3d(0.0, 1.0, 0.1)
- to: Qt.vector3d(1.0, 1.0, 0.1)
- duration: 1000
- loops: QQ2.Animation.Infinite
- }
- },
-
- Tag {
- name: "diffuse"
- value: brick
- }
- ]
+ FrameGraph {
+ id : external_forward_renderer
+ activeFrameGraph : ForwardRenderer {
+ camera: camera
+ clearColor: "black"
+ }
}
- Material {
- id: blueMaterial
+ components: [external_forward_renderer]
- parameters: [
- Tag { name: "kd"; value: Qt.vector3d(0.2, 0.2, 1.0) }
- ]
+ Wine {
+ id: wineRack
+ scale: 1
+ x: -60.0
+ y: -20.0
+ z: 0.0
+ angleX: 180
}
- Texture {
- id: brick
- source: "/Users/jmt/KDAB/Qt3D/qt3d-ng/assets/textures/brick1.jpg"
- }
}