Browse Source

Add glTF2.0 duck.

Don McCurdy 8 years ago
parent
commit
3b06318cb9

+ 14 - 0
examples/models/gltf/Duck/README.md

@@ -0,0 +1,14 @@
+# Duck
+## Screenshot
+
+![screenshot](screenshot/screenshot.png)
+
+## License Information
+
+Copyright 2006 Sony Computer Entertainment Inc.
+
+Licensed under the SCEA Shared Source License, Version 1.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://research.scea.com/scea_shared_source_license.html
+
+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.

BIN
examples/models/gltf/Duck/glTF-Binary/Duck.glb


File diff suppressed because it is too large
+ 198 - 0
examples/models/gltf/Duck/glTF-Embedded/Duck.gltf


File diff suppressed because it is too large
+ 246 - 0
examples/models/gltf/Duck/glTF-MaterialsCommon/Duck.gltf


BIN
examples/models/gltf/Duck/glTF-MaterialsCommon/Duck0.bin


BIN
examples/models/gltf/Duck/glTF-MaterialsCommon/DuckCM.png


File diff suppressed because it is too large
+ 213 - 0
examples/models/gltf/Duck/glTF-pbrSpecularGlossiness/Duck.gltf


BIN
examples/models/gltf/Duck/glTF-pbrSpecularGlossiness/Duck0.bin


BIN
examples/models/gltf/Duck/glTF-pbrSpecularGlossiness/DuckCM.png


File diff suppressed because it is too large
+ 218 - 0
examples/models/gltf/Duck/glTF-techniqueWebGL/Duck.gltf


BIN
examples/models/gltf/Duck/glTF-techniqueWebGL/Duck0.bin


+ 20 - 0
examples/models/gltf/Duck/glTF-techniqueWebGL/Duck0.vert

@@ -0,0 +1,20 @@
+precision highp float;
+uniform mat4 u_modelViewMatrix;
+uniform mat4 u_projectionMatrix;
+uniform mat3 u_normalMatrix;
+uniform mat4 u_light0Transform;
+attribute vec3 a_position;
+varying vec3 v_position;
+attribute vec3 a_normal;
+varying vec3 v_normal;
+attribute vec2 a_texcoord0;
+varying vec2 v_texcoord0;
+varying vec3 v_light0Direction;
+void main(void) {
+    vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
+    v_position = pos.xyz;
+    gl_Position = u_projectionMatrix * pos;
+    v_normal = u_normalMatrix * a_normal;
+    v_texcoord0 = a_texcoord0;
+    v_light0Direction = mat3(u_light0Transform) * vec3(0., 0., 1.);
+}

+ 38 - 0
examples/models/gltf/Duck/glTF-techniqueWebGL/Duck1.frag

@@ -0,0 +1,38 @@
+precision highp float;
+uniform vec4 u_ambient;
+uniform sampler2D u_diffuse;
+uniform vec4 u_emission;
+uniform vec4 u_specular;
+uniform float u_shininess;
+uniform float u_transparency;
+uniform vec3 u_light0Color;
+varying vec3 v_position;
+varying vec3 v_normal;
+varying vec2 v_texcoord0;
+varying vec3 v_light0Direction;
+void main(void) {
+    vec3 normal = normalize(v_normal);
+    vec4 diffuse = texture2D(u_diffuse, v_texcoord0);
+    vec3 diffuseLight = vec3(0.0, 0.0, 0.0);
+    vec3 specular = u_specular.rgb;
+    vec3 specularLight = vec3(0.0, 0.0, 0.0);
+    vec3 emission = u_emission.rgb;
+    vec3 ambient = u_ambient.rgb;
+    vec3 viewDir = -normalize(v_position);
+    vec3 ambientLight = vec3(0.0, 0.0, 0.0);
+    {
+    vec3 l = normalize(v_light0Direction);
+    float attenuation = 1.0;
+    diffuseLight += u_light0Color * max(dot(normal, l), 0.) * attenuation;
+    vec3 h = normalize(l + viewDir);
+    float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess)) * attenuation;
+    specularLight += u_light0Color * specularIntensity;
+    }
+    ambientLight += vec3(0.2, 0.2, 0.2);
+    vec3 color = vec3(0.0, 0.0, 0.0);
+    color += diffuse.rgb * diffuseLight;
+    color += specular * specularLight;
+    color += emission;
+    color += ambient * ambientLight;
+    gl_FragColor = vec4(color * diffuse.a * u_transparency, diffuse.a * u_transparency);
+}

BIN
examples/models/gltf/Duck/glTF-techniqueWebGL/DuckCM.png


+ 238 - 0
examples/models/gltf/Duck/glTF/Duck.gltf

@@ -0,0 +1,238 @@
+{
+    "asset": {
+        "generator": "COLLADA2GLTF",
+        "version": "2.0"
+    },
+    "scene": 0,
+    "scenes": [
+        {
+            "nodes": [
+                0
+            ]
+        }
+    ],
+    "nodes": [
+        {
+            "children": [
+                3,
+                2,
+                1
+            ],
+            "matrix": [
+                0.009999999776482582,
+                0.0,
+                0.0,
+                0.0,
+                0.0,
+                0.009999999776482582,
+                0.0,
+                0.0,
+                0.0,
+                0.0,
+                0.009999999776482582,
+                0.0,
+                0.0,
+                0.0,
+                0.0,
+                1.0
+            ]
+        },
+        {
+            "matrix": [
+                -0.9546916484832764,
+                0.2181433141231537,
+                -0.2024286538362503,
+                0.0,
+                0.014671952463686468,
+                0.7138853073120117,
+                0.7001089453697205,
+                0.0,
+                0.2972349226474762,
+                0.6654181480407715,
+                -0.6847409009933472,
+                0.0,
+                148.6540069580078,
+                183.6720123291016,
+                -292.1790161132813,
+                1.0
+            ]
+        },
+        {
+            "matrix": [
+                -0.7289686799049377,
+                0.0,
+                -0.6845470666885376,
+                0.0,
+                -0.4252049028873444,
+                0.7836934328079224,
+                0.4527972936630249,
+                0.0,
+                0.5364750623703003,
+                0.6211478114128113,
+                -0.571287989616394,
+                0.0,
+                400.1130065917969,
+                463.2640075683594,
+                -431.0780334472656,
+                1.0
+            ],
+            "camera": 0
+        },
+        {
+            "mesh": 0
+        }
+    ],
+    "cameras": [
+        {
+            "perspective": {
+                "aspectRatio": 1.5,
+                "yfov": 0.6605925559997559,
+                "zfar": 10000.0,
+                "znear": 1.0
+            },
+            "type": "perspective"
+        }
+    ],
+    "meshes": [
+        {
+            "primitives": [
+                {
+                    "attributes": {
+                        "NORMAL": 1,
+                        "POSITION": 2,
+                        "TEXCOORD_0": 3
+                    },
+                    "indices": 0,
+                    "mode": 4,
+                    "material": 0
+                }
+            ],
+            "name": "LOD3spShape"
+        }
+    ],
+    "accessors": [
+        {
+            "bufferView": 0,
+            "byteOffset": 0,
+            "componentType": 5123,
+            "count": 12636,
+            "max": [
+                2398
+            ],
+            "min": [
+                0
+            ],
+            "type": "SCALAR"
+        },
+        {
+            "bufferView": 1,
+            "byteOffset": 0,
+            "componentType": 5126,
+            "count": 2399,
+            "max": [
+                0.9995989799499512,
+                0.999580979347229,
+                0.9984359741210938
+            ],
+            "min": [
+                -0.9990839958190918,
+                -1.0,
+                -0.9998319745063782
+            ],
+            "type": "VEC3"
+        },
+        {
+            "bufferView": 1,
+            "byteOffset": 28788,
+            "componentType": 5126,
+            "count": 2399,
+            "max": [
+                96.17990112304688,
+                163.97000122070313,
+                53.92519760131836
+            ],
+            "min": [
+                -69.29850006103516,
+                9.929369926452637,
+                -61.32819747924805
+            ],
+            "type": "VEC3"
+        },
+        {
+            "bufferView": 2,
+            "byteOffset": 0,
+            "componentType": 5126,
+            "count": 2399,
+            "max": [
+                0.9833459854125976,
+                0.9800369739532472
+            ],
+            "min": [
+                0.026409000158309938,
+                0.01996302604675293
+            ],
+            "type": "VEC2"
+        }
+    ],
+    "materials": [
+        {
+            "pbrMetallicRoughness": {
+                "baseColorTexture": {
+                    "index": 0
+                }
+            },
+            "emissiveFactor": [
+                0.0,
+                0.0,
+                0.0
+            ]
+        }
+    ],
+    "textures": [
+        {
+            "sampler": 0,
+            "source": 0
+        }
+    ],
+    "images": [
+        {
+            "uri": "DuckCM.png"
+        }
+    ],
+    "samplers": [
+        {
+            "magFilter": 9729,
+            "minFilter": 9986,
+            "wrapS": 10497,
+            "wrapT": 10497
+        }
+    ],
+    "bufferViews": [
+        {
+            "buffer": 0,
+            "byteOffset": 76768,
+            "byteLength": 25272,
+            "target": 34963
+        },
+        {
+            "buffer": 0,
+            "byteOffset": 0,
+            "byteLength": 57576,
+            "byteStride": 12,
+            "target": 34962
+        },
+        {
+            "buffer": 0,
+            "byteOffset": 57576,
+            "byteLength": 19192,
+            "byteStride": 8,
+            "target": 34962
+        }
+    ],
+    "buffers": [
+        {
+            "byteLength": 102040,
+            "uri": "Duck0.bin"
+        }
+    ]
+}

BIN
examples/models/gltf/Duck/glTF/Duck0.bin


BIN
examples/models/gltf/Duck/glTF/DuckCM.png


BIN
examples/models/gltf/Duck/screenshot/screenshot.png


Some files were not shown because too many files changed in this diff