diff --git a/Cargo.toml b/Cargo.toml index 9123716..fb7b02c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,7 @@ bytemuck = "1" noise = "0.6" ddsfile = "0.4" wgpu-subscriber = "0.1.0" +tobj = "2.0.3" diff --git a/resources/Tree_01.mtl b/resources/Tree_01.mtl new file mode 100755 index 0000000..954f31b --- /dev/null +++ b/resources/Tree_01.mtl @@ -0,0 +1,14 @@ +# +## Alias OBJ Material File +# Exported from SketchUp, (c) 2000-2012 Trimble Navigation Limited + +newmtl Leafs +Ka 0.000000 0.000000 0.000000 +Kd 0.270588 0.407843 0.400000 +Ks 0.330000 0.330000 0.330000 + +newmtl Wood +Ka 0.000000 0.000000 0.000000 +Kd 0.666667 0.545098 0.356863 +Ks 0.330000 0.330000 0.330000 + diff --git a/resources/Tree_01.mtl.meta b/resources/Tree_01.mtl.meta new file mode 100644 index 0000000..1fc7185 --- /dev/null +++ b/resources/Tree_01.mtl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b6f6049ee83f1b2a99865cbd2ad3eef7 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/resources/Tree_01.obj b/resources/Tree_01.obj new file mode 100755 index 0000000..5dddfea --- /dev/null +++ b/resources/Tree_01.obj @@ -0,0 +1,229 @@ +# Alias OBJ Model File +# Exported from SketchUp, (c) 2000-2012 Trimble Navigation Limited +# File units = meters + +mtllib Tree_01.mtl + +g Mesh1 Tree Model + +usemtl Leafs +v 0 0 -1.2957 +vt -3.67031e-018 -0.258226 +vn -5.60096e-018 0.438447 -0.898757 +v 0.177 0.6 -1.003 +vt -0.0804545 0.0452234 +v 1.003 0.6 -1.003 +vt -0.455909 0.0452234 +v 1.18 0 -1.2957 +vt -0.536364 -0.258226 +f 1/1/1 2/2/1 3/3/1 4/4/1 + +v 0.177 0.6 -0.177 +vt -0.0804545 0.284347 +vn -0.959136 0.282945 7.971e-018 +vt -0.455909 0.284347 +vt -0.588956 1.3849e-018 +v 0 0 -0 +vt 0 0 +f 5/5/2 2/6/2 1/7/2 6/8/2 + +vt -0.0804545 0.0804545 +vn 0 -1 -0 +v -0.0969352 0.6 -0.0826 +vt 0.0440615 0.0375455 +vt -0.0804545 0.455909 +f 5/9/3 7/10/3 2/11/3 + +v 1.0974 0.6 -0.0826 +vt -0.498818 0.0375455 +f 7/10/3 5/9/3 8/12/3 + +v 1.003 0.6 -0.177 +vt -0.455909 0.0804545 +f 8/12/3 5/9/3 9/13/3 + +v 1.18 0 -0 +vt 0.536364 -1.26083e-018 +vn 7.96848e-018 0.282945 0.959136 +vt 0.455909 0.284347 +vt 0.0804545 0.284347 +f 10/14/4 9/15/4 5/16/4 6/8/4 + +vt 8.91502e-019 -0.151761 +vn 0.959136 0.282945 1.5942e-018 +vt 0.588956 -0.151761 +vt 0.455909 0.132585 +vt 0.0804545 0.132585 +f 10/17/5 4/18/5 3/19/5 9/20/5 + +vt -0.536364 0 +v 0.786697 0 -0.393303 +vt -0.35759 0.178774 +vt -0.536364 0.588956 +f 10/21/3 11/22/3 4/23/3 + +v 0.393303 0 -0.393303 +vt -0.178774 0.178774 +f 10/21/3 12/24/3 11/22/3 + +f 6/8/3 12/24/3 10/21/3 + +v 0.393303 0 -0.786697 +vt -0.178774 0.35759 +f 12/24/3 6/8/3 13/25/3 + +vt 0 0.588956 +f 1/26/3 13/25/3 6/8/3 + +f 13/25/3 1/26/3 4/23/3 + +v 0.786697 0 -0.786697 +vt -0.35759 0.35759 +f 13/25/3 4/23/3 14/27/3 + +f 14/27/3 4/23/3 11/22/3 + +usemtl Wood +v 0.837838 -0.495868 -0.342162 +vt 0.155528 -0.263275 +vn 0.994724 0.102591 6.0893e-019 +v 0.837838 -0.495868 -0.837838 +vt 0.380836 -0.263275 +vt 0.35759 -0.0366853 +vt 0.178774 -0.0366853 +f 15/28/6 16/29/6 14/30/6 11/31/6 + +v 0.342162 -0.495868 -0.342162 +vt -0.155528 0.155528 +v 0.342162 -0.495868 -0.837838 +vt -0.155528 0.380836 +vt -0.380836 0.380836 +vt -0.380836 0.155528 +f 17/32/3 18/33/3 16/34/3 15/35/3 + +vt -0.178774 0.0183405 +vn -0.994724 0.102591 -5.80807e-018 +vt -0.35759 0.0183405 +vt -0.380836 -0.208249 +vt -0.155528 -0.208249 +f 12/36/7 13/37/7 18/38/7 17/39/7 + +usemtl Leafs +f 12/24/3 13/25/3 14/27/3 11/22/3 + +usemtl Wood +vt -0.155528 -0.263275 +vn 9.37084e-019 0.102591 -0.994724 +vt -0.178774 -0.0366853 +vt -0.35759 -0.0366853 +vt -0.380836 -0.263275 +f 18/40/8 13/41/8 14/42/8 16/43/8 + +vt 0.380836 -0.208249 +vn 7.35408e-018 0.102591 0.994724 +vt 0.35759 0.0183405 +vt 0.178774 0.0183405 +vt 0.155528 -0.208249 +f 15/44/9 11/45/9 12/46/9 17/47/9 + +usemtl Leafs +vt -0.455909 0.455909 +v 1.0974 0.6 -1.0974 +vt -0.498818 0.498818 +f 3/48/3 19/49/3 9/13/3 + +f 2/11/3 19/49/3 3/48/3 + +v -0.0969352 0.6 -1.0974 +vt 0.0440615 0.498818 +f 2/11/3 20/50/3 19/49/3 + +f 20/50/3 2/11/3 7/10/3 + +v 0.23482 1.34304 -0.23482 +vt -0.106736 0.60095 +vn -0.913119 0.407693 2.16966e-017 +v 0.23482 1.34304 -0.94518 +vt -0.429627 0.60095 +vt -0.498818 0.231069 +vt -0.0375455 0.231069 +f 21/51/10 22/52/10 20/53/10 7/54/10 + +vt -0.106736 0.106736 +v 0.153636 1.34304 -0.153636 +vt -0.0698345 0.0698345 +vt -0.106736 0.429627 +f 21/55/3 23/56/3 22/57/3 + +v 1.14207 1.34304 -0.153636 +vt -0.519121 0.0698345 +f 23/56/3 21/55/3 24/58/3 + +v 0.94518 1.34304 -0.23482 +vt -0.429627 0.106736 +f 24/58/3 21/55/3 25/59/3 + +vt 0.498818 0.274714 +vn 5.19277e-018 0.200693 0.979654 +vt 0.429627 0.619473 +vt 0.106736 0.619473 +vt -0.0440615 0.274714 +f 8/60/11 25/61/11 21/62/11 7/63/11 + +vt 0.0375455 0.167069 +vn 0.979654 0.200693 -1.44372e-018 +vt 0.498818 0.167069 +v 0.94518 1.34304 -0.94518 +vt 0.429627 0.511829 +vt 0.106736 0.511829 +f 8/64/12 19/65/12 26/66/12 25/67/12 + +f 8/12/3 9/13/3 19/49/3 + +vt 0.0440615 0.167069 +vn -2.59638e-018 0.200693 -0.979654 +vt -0.106736 0.511829 +vt -0.429627 0.511829 +vt -0.498818 0.167069 +f 20/68/13 22/69/13 26/70/13 19/71/13 + +v 1.14207 1.34304 -1.02636 +vt -0.519121 0.466529 +vt -0.429627 0.429627 +f 22/57/3 27/72/3 26/73/3 + +v 0.153636 1.34304 -1.02636 +vt -0.0698345 0.466529 +f 22/57/3 28/74/3 27/72/3 + +f 28/74/3 22/57/3 23/56/3 + +v 0.383388 3.21676 -0.59 +vt -0.268182 1.4725 +vn -0.992566 0.121707 7.00107e-018 +vt -0.466529 0.614434 +vt -0.0698345 0.614434 +f 29/75/14 28/76/14 23/77/14 + +vt -0.174267 1.36323 +vn 1.92555e-017 0.226817 -0.973937 +vt -0.519121 0.488746 +vt -0.0698345 0.488746 +f 29/78/15 27/79/15 28/80/15 + +vt 0.466529 0.371018 +vn 0.926901 0.375307 -4.48545e-017 +vt 0.268182 1.28988 +vt 0.0698345 0.371018 +f 27/81/16 29/82/16 24/83/16 + +vt 0.519121 0.610402 +vn -3.8511e-017 0.226817 0.973937 +vt 0.174267 1.48488 +vt 0.0698345 0.610402 +f 24/84/17 29/85/17 23/86/17 + +f 24/58/3 25/59/3 27/72/3 + +f 26/73/3 27/72/3 25/59/3 + diff --git a/resources/Tree_01.obj.meta b/resources/Tree_01.obj.meta new file mode 100644 index 0000000..d90e553 --- /dev/null +++ b/resources/Tree_01.obj.meta @@ -0,0 +1,102 @@ +fileFormatVersion: 2 +guid: 30e3f3599a28f38b790ba48419797464 +ModelImporter: + serializedVersion: 20200 + internalIDToNameTable: [] + externalObjects: {} + materials: + materialImportMode: 2 + materialName: 0 + materialSearch: 1 + materialLocation: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + importConstraints: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + isReadable: 0 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + useSRGBMaterialColor: 1 + sortHierarchyByName: 1 + importVisibility: 1 + importBlendShapes: 1 + importCameras: 1 + importLights: 1 + fileIdsGeneration: 2 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + keepQuads: 0 + weldVertices: 1 + bakeAxisConversion: 0 + preserveHierarchy: 0 + skinWeightsMode: 0 + maxBonesPerVertex: 4 + minBoneWeight: 0.001 + meshOptimizationFlags: -1 + indexFormat: 0 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVMarginMethod: 1 + secondaryUVMinLightmapResolution: 40 + secondaryUVMinObjectScale: 1 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 4 + legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 + blendShapeNormalImportMode: 1 + normalSmoothingSource: 0 + referencedClips: [] + importAnimation: 1 + humanDescription: + serializedVersion: 3 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + globalScale: 1 + rootMotionBoneName: + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + autoGenerateAvatarMappingIfUnspecified: 1 + animationType: 2 + humanoidOversampling: 1 + avatarSetup: 0 + addHumanoidExtraRootOnlyWhenUsingAvatar: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/resources/Tree_02.mtl b/resources/Tree_02.mtl new file mode 100755 index 0000000..954f31b --- /dev/null +++ b/resources/Tree_02.mtl @@ -0,0 +1,14 @@ +# +## Alias OBJ Material File +# Exported from SketchUp, (c) 2000-2012 Trimble Navigation Limited + +newmtl Leafs +Ka 0.000000 0.000000 0.000000 +Kd 0.270588 0.407843 0.400000 +Ks 0.330000 0.330000 0.330000 + +newmtl Wood +Ka 0.000000 0.000000 0.000000 +Kd 0.666667 0.545098 0.356863 +Ks 0.330000 0.330000 0.330000 + diff --git a/resources/Tree_02.mtl.meta b/resources/Tree_02.mtl.meta new file mode 100644 index 0000000..cbb3758 --- /dev/null +++ b/resources/Tree_02.mtl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c7674ea23439a8e6d8c5d537866bcd90 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/resources/Tree_02.obj b/resources/Tree_02.obj new file mode 100755 index 0000000..bc5dbed --- /dev/null +++ b/resources/Tree_02.obj @@ -0,0 +1,229 @@ +# Alias OBJ Model File +# Exported from SketchUp, (c) 2000-2012 Trimble Navigation Limited +# File units = meters + +mtllib Tree_02.mtl + +g Mesh1 Tree Model + +usemtl Leafs +v 0 0 -1.18 +vt 4.4561e-018 -0.151761 +vn 7.96848e-018 0.282945 -0.959136 +v 0.177 0.6 -1.003 +vt -0.0804545 0.132585 +v 1.003 0.6 -1.003 +vt -0.455909 0.132585 +v 1.18 0 -1.18 +vt -0.536364 -0.151761 +f 1/1/1 2/2/1 3/3/1 4/4/1 + +v 0.177 0.6 -0.177 +vt -0.0804545 0.284347 +vn -0.959136 0.282945 6.61214e-018 +vt -0.455909 0.284347 +vt -0.536364 1.04622e-018 +v 0 0 -0 +vt 0 0 +f 5/5/2 2/6/2 1/7/2 6/8/2 + +vt -0.0804545 0.0804545 +vn 0 -1 -0 +v 0.0826 0.6 -0.0826 +vt -0.0375455 0.0375455 +vt -0.0804545 0.455909 +f 5/9/3 7/10/3 2/11/3 + +v 1.0974 0.6 -0.0826 +vt -0.498818 0.0375455 +f 7/10/3 5/9/3 8/12/3 + +v 1.003 0.6 -0.177 +vt -0.455909 0.0804545 +f 8/12/3 5/9/3 9/13/3 + +v 1.18 0 -0 +vt 0.536364 -1.26083e-018 +vn 7.96848e-018 0.282945 0.959136 +vt 0.455909 0.284347 +vt 0.0804545 0.284347 +f 10/14/4 9/15/4 5/16/4 6/8/4 + +vt 9.007e-019 -0.151761 +vn 0.959136 0.282945 1.61065e-018 +vt 0.536364 -0.151761 +vt 0.455909 0.132585 +vt 0.0804545 0.132585 +f 10/17/5 4/18/5 3/19/5 9/20/5 + +vt -0.536364 0 +v 0.786697 0 -0.393303 +vt -0.35759 0.178774 +vt -0.536364 0.536364 +f 10/21/3 11/22/3 4/23/3 + +v 0.393303 0 -0.393303 +vt -0.178774 0.178774 +f 10/21/3 12/24/3 11/22/3 + +f 6/8/3 12/24/3 10/21/3 + +v 0.393303 0 -0.786697 +vt -0.178774 0.35759 +f 12/24/3 6/8/3 13/25/3 + +vt 0 0.536364 +f 1/26/3 13/25/3 6/8/3 + +f 13/25/3 1/26/3 4/23/3 + +v 0.786697 0 -0.786697 +vt -0.35759 0.35759 +f 13/25/3 4/23/3 14/27/3 + +f 14/27/3 4/23/3 11/22/3 + +usemtl Wood +v 0.837838 -0.495868 -0.342162 +vt 0.155528 -0.263275 +vn 0.994724 0.102591 6.0893e-019 +v 0.837838 -0.495868 -0.837838 +vt 0.380836 -0.263275 +vt 0.35759 -0.0366853 +vt 0.178774 -0.0366853 +f 15/28/6 16/29/6 14/30/6 11/31/6 + +v 0.342162 -0.495868 -0.342162 +vt -0.155528 0.155528 +v 0.342162 -0.495868 -0.837838 +vt -0.155528 0.380836 +vt -0.380836 0.380836 +vt -0.380836 0.155528 +f 17/32/3 18/33/3 16/34/3 15/35/3 + +vt -0.178774 0.0183405 +vn -0.994724 0.102591 -5.80807e-018 +vt -0.35759 0.0183405 +vt -0.380836 -0.208249 +vt -0.155528 -0.208249 +f 12/36/7 13/37/7 18/38/7 17/39/7 + +usemtl Leafs +f 12/24/3 13/25/3 14/27/3 11/22/3 + +usemtl Wood +vt -0.155528 -0.263275 +vn 9.37084e-019 0.102591 -0.994724 +vt -0.178774 -0.0366853 +vt -0.35759 -0.0366853 +vt -0.380836 -0.263275 +f 18/40/8 13/41/8 14/42/8 16/43/8 + +vt 0.380836 -0.208249 +vn 7.35408e-018 0.102591 0.994724 +vt 0.35759 0.0183405 +vt 0.178774 0.0183405 +vt 0.155528 -0.208249 +f 15/44/9 11/45/9 12/46/9 17/47/9 + +usemtl Leafs +vt -0.455909 0.455909 +v 1.0974 0.6 -1.0974 +vt -0.498818 0.498818 +f 3/48/3 19/49/3 9/13/3 + +f 2/11/3 19/49/3 3/48/3 + +v 0.0826 0.6 -1.0974 +vt -0.0375455 0.498818 +f 2/11/3 20/50/3 19/49/3 + +f 20/50/3 2/11/3 7/10/3 + +v 0.23482 1.34304 -0.23482 +vt -0.106736 0.619473 +vn -0.979654 0.200693 -1.44372e-018 +v 0.23482 1.34304 -0.94518 +vt -0.429627 0.619473 +vt -0.498818 0.274714 +vt -0.0375455 0.274714 +f 21/51/10 22/52/10 20/53/10 7/54/10 + +vt -0.106736 0.106736 +v 0.153636 1.34304 -0.153636 +vt -0.0698345 0.0698345 +vt -0.106736 0.429627 +f 21/55/3 23/56/3 22/57/3 + +v 1.02636 1.34304 -0.153636 +vt -0.466529 0.0698345 +f 23/56/3 21/55/3 24/58/3 + +v 0.94518 1.34304 -0.23482 +vt -0.429627 0.106736 +f 24/58/3 21/55/3 25/59/3 + +vt 0.498818 0.274714 +vn -3.998e-018 0.200693 0.979654 +vt 0.429627 0.619473 +vt 0.106736 0.619473 +vt 0.0375455 0.274714 +f 8/60/11 25/61/11 21/62/11 7/63/11 + +vt 0.0375455 0.167069 +vn 0.979654 0.200693 -1.44372e-018 +vt 0.498818 0.167069 +v 0.94518 1.34304 -0.94518 +vt 0.429627 0.511829 +vt 0.106736 0.511829 +f 8/64/12 19/65/12 26/66/12 25/67/12 + +f 8/12/3 9/13/3 19/49/3 + +vt -0.0375455 0.167069 +vn -3.998e-018 0.200693 -0.979654 +vt -0.106736 0.511829 +vt -0.429627 0.511829 +vt -0.498818 0.167069 +f 20/68/13 22/69/13 26/70/13 19/71/13 + +v 1.02636 1.34304 -1.02636 +vt -0.466529 0.466529 +vt -0.429627 0.429627 +f 22/57/3 27/72/3 26/73/3 + +v 0.153636 1.34304 -1.02636 +vt -0.0698345 0.466529 +f 22/57/3 28/74/3 27/72/3 + +f 28/74/3 22/57/3 23/56/3 + +v 0.59 2.66304 -0.59 +vt -0.268182 1.23348 +vn -0.949465 0.313873 -0 +vt -0.466529 0.601542 +vt -0.0698345 0.601542 +f 29/75/14 28/76/14 23/77/14 + +vt -0.268182 1.06513 +vn -2.05913e-017 0.313873 -0.949465 +vt -0.466529 0.433192 +vt -0.0698345 0.433192 +f 29/78/15 27/79/15 28/80/15 + +vt 0.466529 0.433192 +vn 0.949465 0.313873 -0 +vt 0.268182 1.06513 +vt 0.0698345 0.433192 +f 27/81/16 29/82/16 24/83/16 + +vt 0.466529 0.601542 +vn -2.05913e-017 0.313873 0.949465 +vt 0.268182 1.23348 +vt 0.0698345 0.601542 +f 24/84/17 29/85/17 23/86/17 + +f 24/58/3 25/59/3 27/72/3 + +f 26/73/3 27/72/3 25/59/3 + diff --git a/resources/Tree_02.obj.meta b/resources/Tree_02.obj.meta new file mode 100644 index 0000000..7c31235 --- /dev/null +++ b/resources/Tree_02.obj.meta @@ -0,0 +1,102 @@ +fileFormatVersion: 2 +guid: 9b67280016de8aa3d876883a26aeb0f4 +ModelImporter: + serializedVersion: 20200 + internalIDToNameTable: [] + externalObjects: {} + materials: + materialImportMode: 2 + materialName: 0 + materialSearch: 1 + materialLocation: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + importAnimatedCustomProperties: 0 + importConstraints: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + extraUserProperties: [] + clipAnimations: [] + isReadable: 0 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + useSRGBMaterialColor: 1 + sortHierarchyByName: 1 + importVisibility: 1 + importBlendShapes: 1 + importCameras: 1 + importLights: 1 + fileIdsGeneration: 2 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + keepQuads: 0 + weldVertices: 1 + bakeAxisConversion: 0 + preserveHierarchy: 0 + skinWeightsMode: 0 + maxBonesPerVertex: 4 + minBoneWeight: 0.001 + meshOptimizationFlags: -1 + indexFormat: 0 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVMarginMethod: 1 + secondaryUVMinLightmapResolution: 40 + secondaryUVMinObjectScale: 1 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + normalCalculationMode: 4 + legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 + blendShapeNormalImportMode: 1 + normalSmoothingSource: 0 + referencedClips: [] + importAnimation: 1 + humanDescription: + serializedVersion: 3 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + globalScale: 1 + rootMotionBoneName: + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + autoGenerateAvatarMappingIfUnspecified: 1 + animationType: 2 + humanoidOversampling: 1 + avatarSetup: 0 + addHumanoidExtraRootOnlyWhenUsingAvatar: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/resources/bake.frag.spv b/resources/bake.frag.spv index dbd2938..7079ce3 100644 Binary files a/resources/bake.frag.spv and b/resources/bake.frag.spv differ diff --git a/resources/bake.vert b/resources/bake.vert index e4426b7..c4c4145 100644 --- a/resources/bake.vert +++ b/resources/bake.vert @@ -1,6 +1,6 @@ #version 450 -layout(location = 0) in ivec4 a_Pos; +layout(location = 0) in vec4 a_Pos; layout(set = 0, binding = 0) uniform Globals { mat4 u_ViewProj; diff --git a/resources/bake.vert.spv b/resources/bake.vert.spv index 26f1000..a46fcf2 100644 Binary files a/resources/bake.vert.spv and b/resources/bake.vert.spv differ diff --git a/resources/cube.obj b/resources/cube.obj new file mode 100644 index 0000000..3ac1444 --- /dev/null +++ b/resources/cube.obj @@ -0,0 +1,43 @@ +o cube + +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v -0.500000 0.500000 0.500000 +v 0.500000 0.500000 0.500000 +v -0.500000 0.500000 -0.500000 +v 0.500000 0.500000 -0.500000 +v -0.500000 -0.500000 -0.500000 +v 0.500000 -0.500000 -0.500000 + +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 0.000000 1.000000 +vt 1.000000 1.000000 + +vn 0.000000 0.000000 1.000000 +vn 0.000000 1.000000 0.000000 +vn 0.000000 0.000000 -1.000000 +vn 0.000000 -1.000000 0.000000 +vn 1.000000 0.000000 0.000000 +vn -1.000000 0.000000 0.000000 + +g cube +usemtl cube +s 1 +f 1/1/1 2/2/1 3/3/1 +f 3/3/1 2/2/1 4/4/1 +s 2 +f 3/1/2 4/2/2 5/3/2 +f 5/3/2 4/2/2 6/4/2 +s 3 +f 5/4/3 6/3/3 7/2/3 +f 7/2/3 6/3/3 8/1/3 +s 4 +f 7/1/4 8/2/4 1/3/4 +f 1/3/4 8/2/4 2/4/4 +s 5 +f 2/1/5 8/2/5 4/3/5 +f 4/3/5 8/2/5 6/4/5 +s 6 +f 7/1/6 1/2/6 5/3/6 +f 5/3/6 1/2/6 3/4/6 \ No newline at end of file diff --git a/resources/forward.frag.spv b/resources/forward.frag.spv index bc571bb..b3fad0c 100644 Binary files a/resources/forward.frag.spv and b/resources/forward.frag.spv differ diff --git a/resources/forward.vert b/resources/forward.vert index 5e02939..4cada40 100644 --- a/resources/forward.vert +++ b/resources/forward.vert @@ -1,7 +1,7 @@ #version 450 -layout(location = 0) in ivec4 a_Pos; -layout(location = 1) in ivec4 a_Normal; +layout(location = 0) in vec4 a_Pos; +layout(location = 1) in vec4 a_Normal; layout(location = 0) out vec3 v_Normal; layout(location = 1) out vec4 v_Position; diff --git a/resources/forward.vert.spv b/resources/forward.vert.spv index 9bd02df..fea2df5 100644 Binary files a/resources/forward.vert.spv and b/resources/forward.vert.spv differ diff --git a/resources/monkey.mtl b/resources/monkey.mtl new file mode 100644 index 0000000..70d3ba1 --- /dev/null +++ b/resources/monkey.mtl @@ -0,0 +1,10 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 0 +Ka 0.000000 0.000000 0.000000 +Kd 0.8 0.8 0.8 +Ks 0.8 0.8 0.8 +d 1 +illum 2 diff --git a/resources/monkey.obj b/resources/monkey.obj new file mode 100644 index 0000000..61d469d --- /dev/null +++ b/resources/monkey.obj @@ -0,0 +1,2423 @@ +# Blender v2.79 (sub 0) OBJ File: '' +# www.blender.org +mtllib monkey.mtl +o Suzanne +v 0.437500 0.164062 0.765625 +v -0.437500 0.164062 0.765625 +v 0.500000 0.093750 0.687500 +v -0.500000 0.093750 0.687500 +v 0.546875 0.054688 0.578125 +v -0.546875 0.054688 0.578125 +v 0.351562 -0.023438 0.617188 +v -0.351562 -0.023438 0.617188 +v 0.351562 0.031250 0.718750 +v -0.351562 0.031250 0.718750 +v 0.351562 0.132812 0.781250 +v -0.351562 0.132812 0.781250 +v 0.273438 0.164062 0.796875 +v -0.273438 0.164062 0.796875 +v 0.203125 0.093750 0.742188 +v -0.203125 0.093750 0.742188 +v 0.156250 0.054688 0.648438 +v -0.156250 0.054688 0.648438 +v 0.078125 0.242188 0.656250 +v -0.078125 0.242188 0.656250 +v 0.140625 0.242188 0.742188 +v -0.140625 0.242188 0.742188 +v 0.242188 0.242188 0.796875 +v -0.242188 0.242188 0.796875 +v 0.273438 0.328125 0.796875 +v -0.273438 0.328125 0.796875 +v 0.203125 0.390625 0.742188 +v -0.203125 0.390625 0.742188 +v 0.156250 0.437500 0.648438 +v -0.156250 0.437500 0.648438 +v 0.351562 0.515625 0.617188 +v -0.351562 0.515625 0.617188 +v 0.351562 0.453125 0.718750 +v -0.351562 0.453125 0.718750 +v 0.351562 0.359375 0.781250 +v -0.351562 0.359375 0.781250 +v 0.437500 0.328125 0.765625 +v -0.437500 0.328125 0.765625 +v 0.500000 0.390625 0.687500 +v -0.500000 0.390625 0.687500 +v 0.546875 0.437500 0.578125 +v -0.546875 0.437500 0.578125 +v 0.625000 0.242188 0.562500 +v -0.625000 0.242188 0.562500 +v 0.562500 0.242188 0.671875 +v -0.562500 0.242188 0.671875 +v 0.468750 0.242188 0.757812 +v -0.468750 0.242188 0.757812 +v 0.476562 0.242188 0.773438 +v -0.476562 0.242188 0.773438 +v 0.445312 0.335938 0.781250 +v -0.445312 0.335938 0.781250 +v 0.351562 0.375000 0.804688 +v -0.351562 0.375000 0.804688 +v 0.265625 0.335938 0.820312 +v -0.265625 0.335938 0.820312 +v 0.226562 0.242188 0.820312 +v -0.226562 0.242188 0.820312 +v 0.265625 0.156250 0.820312 +v -0.265625 0.156250 0.820312 +v 0.351562 0.242188 0.828125 +v -0.351562 0.242188 0.828125 +v 0.351562 0.117188 0.804688 +v -0.351562 0.117188 0.804688 +v 0.445312 0.156250 0.781250 +v -0.445312 0.156250 0.781250 +v 0.000000 0.429688 0.742188 +v 0.000000 0.351562 0.820312 +v 0.000000 -0.679688 0.734375 +v 0.000000 -0.320312 0.781250 +v 0.000000 -0.187500 0.796875 +v 0.000000 -0.773438 0.718750 +v 0.000000 0.406250 0.601562 +v 0.000000 0.570312 0.570312 +v 0.000000 0.898438 -0.546875 +v 0.000000 0.562500 -0.851562 +v 0.000000 0.070312 -0.828125 +v 0.000000 -0.382812 -0.351562 +v 0.203125 -0.187500 0.562500 +v -0.203125 -0.187500 0.562500 +v 0.312500 -0.437500 0.570312 +v -0.312500 -0.437500 0.570312 +v 0.351562 -0.695312 0.570312 +v -0.351562 -0.695312 0.570312 +v 0.367188 -0.890625 0.531250 +v -0.367188 -0.890625 0.531250 +v 0.328125 -0.945312 0.523438 +v -0.328125 -0.945312 0.523438 +v 0.179688 -0.968750 0.554688 +v -0.179688 -0.968750 0.554688 +v 0.000000 -0.984375 0.578125 +v 0.437500 -0.140625 0.531250 +v -0.437500 -0.140625 0.531250 +v 0.632812 -0.039062 0.539062 +v -0.632812 -0.039062 0.539062 +v 0.828125 0.148438 0.445312 +v -0.828125 0.148438 0.445312 +v 0.859375 0.429688 0.593750 +v -0.859375 0.429688 0.593750 +v 0.710938 0.484375 0.625000 +v -0.710938 0.484375 0.625000 +v 0.492188 0.601562 0.687500 +v -0.492188 0.601562 0.687500 +v 0.320312 0.757812 0.734375 +v -0.320312 0.757812 0.734375 +v 0.156250 0.718750 0.757812 +v -0.156250 0.718750 0.757812 +v 0.062500 0.492188 0.750000 +v -0.062500 0.492188 0.750000 +v 0.164062 0.414062 0.773438 +v -0.164062 0.414062 0.773438 +v 0.125000 0.304688 0.765625 +v -0.125000 0.304688 0.765625 +v 0.203125 0.093750 0.742188 +v -0.203125 0.093750 0.742188 +v 0.375000 0.015625 0.703125 +v -0.375000 0.015625 0.703125 +v 0.492188 0.062500 0.671875 +v -0.492188 0.062500 0.671875 +v 0.625000 0.187500 0.648438 +v -0.625000 0.187500 0.648438 +v 0.640625 0.296875 0.648438 +v -0.640625 0.296875 0.648438 +v 0.601562 0.375000 0.664062 +v -0.601562 0.375000 0.664062 +v 0.429688 0.437500 0.718750 +v -0.429688 0.437500 0.718750 +v 0.250000 0.468750 0.757812 +v -0.250000 0.468750 0.757812 +v 0.000000 -0.765625 0.734375 +v 0.109375 -0.718750 0.734375 +v -0.109375 -0.718750 0.734375 +v 0.117188 -0.835938 0.710938 +v -0.117188 -0.835938 0.710938 +v 0.062500 -0.882812 0.695312 +v -0.062500 -0.882812 0.695312 +v 0.000000 -0.890625 0.687500 +v 0.000000 -0.195312 0.750000 +v 0.000000 -0.140625 0.742188 +v 0.101562 -0.148438 0.742188 +v -0.101562 -0.148438 0.742188 +v 0.125000 -0.226562 0.750000 +v -0.125000 -0.226562 0.750000 +v 0.085938 -0.289062 0.742188 +v -0.085938 -0.289062 0.742188 +v 0.398438 -0.046875 0.671875 +v -0.398438 -0.046875 0.671875 +v 0.617188 0.054688 0.625000 +v -0.617188 0.054688 0.625000 +v 0.726562 0.203125 0.601562 +v -0.726562 0.203125 0.601562 +v 0.742188 0.375000 0.656250 +v -0.742188 0.375000 0.656250 +v 0.687500 0.414062 0.726562 +v -0.687500 0.414062 0.726562 +v 0.437500 0.546875 0.796875 +v -0.437500 0.546875 0.796875 +v 0.312500 0.640625 0.835938 +v -0.312500 0.640625 0.835938 +v 0.203125 0.617188 0.851562 +v -0.203125 0.617188 0.851562 +v 0.101562 0.429688 0.843750 +v -0.101562 0.429688 0.843750 +v 0.125000 -0.101562 0.812500 +v -0.125000 -0.101562 0.812500 +v 0.210938 -0.445312 0.710938 +v -0.210938 -0.445312 0.710938 +v 0.250000 -0.703125 0.687500 +v -0.250000 -0.703125 0.687500 +v 0.265625 -0.820312 0.664062 +v -0.265625 -0.820312 0.664062 +v 0.234375 -0.914062 0.632812 +v -0.234375 -0.914062 0.632812 +v 0.164062 -0.929688 0.632812 +v -0.164062 -0.929688 0.632812 +v 0.000000 -0.945312 0.640625 +v 0.000000 0.046875 0.726562 +v 0.000000 0.210938 0.765625 +v 0.328125 0.476562 0.742188 +v -0.328125 0.476562 0.742188 +v 0.164062 0.140625 0.750000 +v -0.164062 0.140625 0.750000 +v 0.132812 0.210938 0.757812 +v -0.132812 0.210938 0.757812 +v 0.117188 -0.687500 0.734375 +v -0.117188 -0.687500 0.734375 +v 0.078125 -0.445312 0.750000 +v -0.078125 -0.445312 0.750000 +v 0.000000 -0.445312 0.750000 +v 0.000000 -0.328125 0.742188 +v 0.093750 -0.273438 0.781250 +v -0.093750 -0.273438 0.781250 +v 0.132812 -0.226562 0.796875 +v -0.132812 -0.226562 0.796875 +v 0.109375 -0.132812 0.781250 +v -0.109375 -0.132812 0.781250 +v 0.039062 -0.125000 0.781250 +v -0.039062 -0.125000 0.781250 +v 0.000000 -0.203125 0.828125 +v 0.046875 -0.148438 0.812500 +v -0.046875 -0.148438 0.812500 +v 0.093750 -0.156250 0.812500 +v -0.093750 -0.156250 0.812500 +v 0.109375 -0.226562 0.828125 +v -0.109375 -0.226562 0.828125 +v 0.078125 -0.250000 0.804688 +v -0.078125 -0.250000 0.804688 +v 0.000000 -0.289062 0.804688 +v 0.257812 -0.312500 0.554688 +v -0.257812 -0.312500 0.554688 +v 0.164062 -0.242188 0.710938 +v -0.164062 -0.242188 0.710938 +v 0.179688 -0.312500 0.710938 +v -0.179688 -0.312500 0.710938 +v 0.234375 -0.250000 0.554688 +v -0.234375 -0.250000 0.554688 +v 0.000000 -0.875000 0.687500 +v 0.046875 -0.867188 0.687500 +v -0.046875 -0.867188 0.687500 +v 0.093750 -0.820312 0.710938 +v -0.093750 -0.820312 0.710938 +v 0.093750 -0.742188 0.726562 +v -0.093750 -0.742188 0.726562 +v 0.000000 -0.781250 0.656250 +v 0.093750 -0.750000 0.664062 +v -0.093750 -0.750000 0.664062 +v 0.093750 -0.812500 0.640625 +v -0.093750 -0.812500 0.640625 +v 0.046875 -0.851562 0.632812 +v -0.046875 -0.851562 0.632812 +v 0.000000 -0.859375 0.632812 +v 0.171875 0.218750 0.781250 +v -0.171875 0.218750 0.781250 +v 0.187500 0.156250 0.773438 +v -0.187500 0.156250 0.773438 +v 0.335938 0.429688 0.757812 +v -0.335938 0.429688 0.757812 +v 0.273438 0.421875 0.773438 +v -0.273438 0.421875 0.773438 +v 0.421875 0.398438 0.773438 +v -0.421875 0.398438 0.773438 +v 0.562500 0.351562 0.695312 +v -0.562500 0.351562 0.695312 +v 0.585938 0.289062 0.687500 +v -0.585938 0.289062 0.687500 +v 0.578125 0.195312 0.679688 +v -0.578125 0.195312 0.679688 +v 0.476562 0.101562 0.718750 +v -0.476562 0.101562 0.718750 +v 0.375000 0.062500 0.742188 +v -0.375000 0.062500 0.742188 +v 0.226562 0.109375 0.781250 +v -0.226562 0.109375 0.781250 +v 0.179688 0.296875 0.781250 +v -0.179688 0.296875 0.781250 +v 0.210938 0.375000 0.781250 +v -0.210938 0.375000 0.781250 +v 0.234375 0.359375 0.757812 +v -0.234375 0.359375 0.757812 +v 0.195312 0.296875 0.757812 +v -0.195312 0.296875 0.757812 +v 0.242188 0.125000 0.757812 +v -0.242188 0.125000 0.757812 +v 0.375000 0.085938 0.726562 +v -0.375000 0.085938 0.726562 +v 0.460938 0.117188 0.703125 +v -0.460938 0.117188 0.703125 +v 0.546875 0.210938 0.671875 +v -0.546875 0.210938 0.671875 +v 0.554688 0.281250 0.671875 +v -0.554688 0.281250 0.671875 +v 0.531250 0.335938 0.679688 +v -0.531250 0.335938 0.679688 +v 0.414062 0.390625 0.750000 +v -0.414062 0.390625 0.750000 +v 0.281250 0.398438 0.765625 +v -0.281250 0.398438 0.765625 +v 0.335938 0.406250 0.750000 +v -0.335938 0.406250 0.750000 +v 0.203125 0.171875 0.750000 +v -0.203125 0.171875 0.750000 +v 0.195312 0.226562 0.750000 +v -0.195312 0.226562 0.750000 +v 0.109375 0.460938 0.609375 +v -0.109375 0.460938 0.609375 +v 0.195312 0.664062 0.617188 +v -0.195312 0.664062 0.617188 +v 0.335938 0.687500 0.593750 +v -0.335938 0.687500 0.593750 +v 0.484375 0.554688 0.554688 +v -0.484375 0.554688 0.554688 +v 0.679688 0.453125 0.492188 +v -0.679688 0.453125 0.492188 +v 0.796875 0.406250 0.460938 +v -0.796875 0.406250 0.460938 +v 0.773438 0.164062 0.375000 +v -0.773438 0.164062 0.375000 +v 0.601562 0.000000 0.414062 +v -0.601562 0.000000 0.414062 +v 0.437500 -0.093750 0.468750 +v -0.437500 -0.093750 0.468750 +v 0.000000 0.898438 0.289062 +v 0.000000 0.984375 -0.078125 +v 0.000000 -0.195312 -0.671875 +v 0.000000 -0.460938 0.187500 +v 0.000000 -0.976562 0.460938 +v 0.000000 -0.804688 0.343750 +v 0.000000 -0.570312 0.320312 +v 0.000000 -0.484375 0.281250 +v 0.851562 0.234375 0.054688 +v -0.851562 0.234375 0.054688 +v 0.859375 0.320312 -0.046875 +v -0.859375 0.320312 -0.046875 +v 0.773438 0.265625 -0.437500 +v -0.773438 0.265625 -0.437500 +v 0.460938 0.437500 -0.703125 +v -0.460938 0.437500 -0.703125 +v 0.734375 -0.046875 0.070312 +v -0.734375 -0.046875 0.070312 +v 0.593750 -0.125000 -0.164062 +v -0.593750 -0.125000 -0.164062 +v 0.640625 -0.007812 -0.429688 +v -0.640625 -0.007812 -0.429688 +v 0.335938 0.054688 -0.664062 +v -0.335938 0.054688 -0.664062 +v 0.234375 -0.351562 0.406250 +v -0.234375 -0.351562 0.406250 +v 0.179688 -0.414062 0.257812 +v -0.179688 -0.414062 0.257812 +v 0.289062 -0.710938 0.382812 +v -0.289062 -0.710938 0.382812 +v 0.250000 -0.500000 0.390625 +v -0.250000 -0.500000 0.390625 +v 0.328125 -0.914062 0.398438 +v -0.328125 -0.914062 0.398438 +v 0.140625 -0.757812 0.367188 +v -0.140625 -0.757812 0.367188 +v 0.125000 -0.539062 0.359375 +v -0.125000 -0.539062 0.359375 +v 0.164062 -0.945312 0.437500 +v -0.164062 -0.945312 0.437500 +v 0.218750 -0.281250 0.429688 +v -0.218750 -0.281250 0.429688 +v 0.210938 -0.226562 0.468750 +v -0.210938 -0.226562 0.468750 +v 0.203125 -0.171875 0.500000 +v -0.203125 -0.171875 0.500000 +v 0.210938 -0.390625 0.164062 +v -0.210938 -0.390625 0.164062 +v 0.296875 -0.312500 -0.265625 +v -0.296875 -0.312500 -0.265625 +v 0.343750 -0.148438 -0.539062 +v -0.343750 -0.148438 -0.539062 +v 0.453125 0.867188 -0.382812 +v -0.453125 0.867188 -0.382812 +v 0.453125 0.929688 -0.070312 +v -0.453125 0.929688 -0.070312 +v 0.453125 0.851562 0.234375 +v -0.453125 0.851562 0.234375 +v 0.460938 0.523438 0.429688 +v -0.460938 0.523438 0.429688 +v 0.726562 0.406250 0.335938 +v -0.726562 0.406250 0.335938 +v 0.632812 0.453125 0.281250 +v -0.632812 0.453125 0.281250 +v 0.640625 0.703125 0.054688 +v -0.640625 0.703125 0.054688 +v 0.796875 0.562500 0.125000 +v -0.796875 0.562500 0.125000 +v 0.796875 0.617188 -0.117188 +v -0.796875 0.617188 -0.117188 +v 0.640625 0.750000 -0.195312 +v -0.640625 0.750000 -0.195312 +v 0.640625 0.679688 -0.445312 +v -0.640625 0.679688 -0.445312 +v 0.796875 0.539062 -0.359375 +v -0.796875 0.539062 -0.359375 +v 0.617188 0.328125 -0.585938 +v -0.617188 0.328125 -0.585938 +v 0.484375 0.023438 -0.546875 +v -0.484375 0.023438 -0.546875 +v 0.820312 0.328125 -0.203125 +v -0.820312 0.328125 -0.203125 +v 0.406250 -0.171875 0.148438 +v -0.406250 -0.171875 0.148438 +v 0.429688 -0.195312 -0.210938 +v -0.429688 -0.195312 -0.210938 +v 0.890625 0.406250 -0.234375 +v -0.890625 0.406250 -0.234375 +v 0.773438 -0.140625 -0.125000 +v -0.773438 -0.140625 -0.125000 +v 1.039062 -0.101562 -0.328125 +v -1.039062 -0.101562 -0.328125 +v 1.281250 0.054688 -0.429688 +v -1.281250 0.054688 -0.429688 +v 1.351562 0.320312 -0.421875 +v -1.351562 0.320312 -0.421875 +v 1.234375 0.507812 -0.421875 +v -1.234375 0.507812 -0.421875 +v 1.023438 0.476562 -0.312500 +v -1.023438 0.476562 -0.312500 +v 1.015625 0.414062 -0.289062 +v -1.015625 0.414062 -0.289062 +v 1.187500 0.437500 -0.390625 +v -1.187500 0.437500 -0.390625 +v 1.265625 0.289062 -0.406250 +v -1.265625 0.289062 -0.406250 +v 1.210938 0.078125 -0.406250 +v -1.210938 0.078125 -0.406250 +v 1.031250 -0.039062 -0.304688 +v -1.031250 -0.039062 -0.304688 +v 0.828125 -0.070312 -0.132812 +v -0.828125 -0.070312 -0.132812 +v 0.921875 0.359375 -0.218750 +v -0.921875 0.359375 -0.218750 +v 0.945312 0.304688 -0.289062 +v -0.945312 0.304688 -0.289062 +v 0.882812 -0.023438 -0.210938 +v -0.882812 -0.023438 -0.210938 +v 1.039062 0.000000 -0.367188 +v -1.039062 0.000000 -0.367188 +v 1.187500 0.093750 -0.445312 +v -1.187500 0.093750 -0.445312 +v 1.234375 0.250000 -0.445312 +v -1.234375 0.250000 -0.445312 +v 1.171875 0.359375 -0.437500 +v -1.171875 0.359375 -0.437500 +v 1.023438 0.343750 -0.359375 +v -1.023438 0.343750 -0.359375 +v 0.843750 0.289062 -0.210938 +v -0.843750 0.289062 -0.210938 +v 0.835938 0.171875 -0.273438 +v -0.835938 0.171875 -0.273438 +v 0.757812 0.093750 -0.273438 +v -0.757812 0.093750 -0.273438 +v 0.820312 0.085938 -0.273438 +v -0.820312 0.085938 -0.273438 +v 0.843750 0.015625 -0.273438 +v -0.843750 0.015625 -0.273438 +v 0.812500 -0.015625 -0.273438 +v -0.812500 -0.015625 -0.273438 +v 0.726562 0.000000 -0.070312 +v -0.726562 0.000000 -0.070312 +v 0.718750 -0.023438 -0.171875 +v -0.718750 -0.023438 -0.171875 +v 0.718750 0.039062 -0.187500 +v -0.718750 0.039062 -0.187500 +v 0.796875 0.203125 -0.210938 +v -0.796875 0.203125 -0.210938 +v 0.890625 0.242188 -0.265625 +v -0.890625 0.242188 -0.265625 +v 0.890625 0.234375 -0.320312 +v -0.890625 0.234375 -0.320312 +v 0.812500 -0.015625 -0.320312 +v -0.812500 -0.015625 -0.320312 +v 0.851562 0.015625 -0.320312 +v -0.851562 0.015625 -0.320312 +v 0.828125 0.078125 -0.320312 +v -0.828125 0.078125 -0.320312 +v 0.765625 0.093750 -0.320312 +v -0.765625 0.093750 -0.320312 +v 0.843750 0.171875 -0.320312 +v -0.843750 0.171875 -0.320312 +v 1.039062 0.328125 -0.414062 +v -1.039062 0.328125 -0.414062 +v 1.187500 0.343750 -0.484375 +v -1.187500 0.343750 -0.484375 +v 1.257812 0.242188 -0.492188 +v -1.257812 0.242188 -0.492188 +v 1.210938 0.085938 -0.484375 +v -1.210938 0.085938 -0.484375 +v 1.046875 0.000000 -0.421875 +v -1.046875 0.000000 -0.421875 +v 0.882812 -0.015625 -0.265625 +v -0.882812 -0.015625 -0.265625 +v 0.953125 0.289062 -0.343750 +v -0.953125 0.289062 -0.343750 +v 0.890625 0.109375 -0.328125 +v -0.890625 0.109375 -0.328125 +v 0.937500 0.062500 -0.335938 +v -0.937500 0.062500 -0.335938 +v 1.000000 0.125000 -0.367188 +v -1.000000 0.125000 -0.367188 +v 0.960938 0.171875 -0.351562 +v -0.960938 0.171875 -0.351562 +v 1.015625 0.234375 -0.375000 +v -1.015625 0.234375 -0.375000 +v 1.054688 0.187500 -0.382812 +v -1.054688 0.187500 -0.382812 +v 1.109375 0.210938 -0.390625 +v -1.109375 0.210938 -0.390625 +v 1.085938 0.273438 -0.390625 +v -1.085938 0.273438 -0.390625 +v 1.023438 0.437500 -0.484375 +v -1.023438 0.437500 -0.484375 +v 1.250000 0.468750 -0.546875 +v -1.250000 0.468750 -0.546875 +v 1.367188 0.296875 -0.500000 +v -1.367188 0.296875 -0.500000 +v 1.312500 0.054688 -0.531250 +v -1.312500 0.054688 -0.531250 +v 1.039062 -0.085938 -0.492188 +v -1.039062 -0.085938 -0.492188 +v 0.789062 -0.125000 -0.328125 +v -0.789062 -0.125000 -0.328125 +v 0.859375 0.382812 -0.382812 +v -0.859375 0.382812 -0.382812 +vn 0.6617 -0.2026 0.7219 +vn -0.6617 -0.2026 0.7219 +vn 0.8268 -0.3051 0.4725 +vn -0.8268 -0.3051 0.4725 +vn 0.4076 -0.7905 0.4570 +vn -0.4076 -0.7905 0.4570 +vn 0.3791 -0.5163 0.7679 +vn -0.3791 -0.5163 0.7679 +vn -0.0859 -0.5222 0.8485 +vn 0.0859 -0.5222 0.8485 +vn -0.2664 -0.8487 0.4570 +vn 0.2664 -0.8487 0.4570 +vn -0.7824 -0.3294 0.5285 +vn 0.7606 -0.3400 0.5531 +vn -0.4706 -0.1981 0.8598 +vn 0.4706 -0.1981 0.8598 +vn -0.4649 0.1958 0.8634 +vn 0.4649 0.1958 0.8634 +vn -0.7656 0.3223 0.5568 +vn 0.7683 0.3293 0.5488 +vn -0.2560 0.8073 0.5317 +vn 0.2487 0.8249 0.5076 +vn -0.0821 0.6023 0.7940 +vn 0.1017 0.5518 0.8277 +vn 0.3329 0.5231 0.7846 +vn -0.3861 0.5446 0.7445 +vn 0.4246 0.7711 0.4745 +vn -0.4059 0.7641 0.5014 +vn 0.8251 0.2968 0.4808 +vn -0.8299 0.2940 0.4742 +vn 0.6888 0.1868 0.7005 +vn -0.6617 0.2026 0.7219 +vn 0.8400 0.3436 -0.4200 +vn -0.7816 0.3058 -0.5437 +vn 0.2074 0.8296 -0.5185 +vn -0.2037 0.8146 -0.5431 +vn -0.4056 0.7605 -0.5070 +vn 0.4381 0.7988 -0.4123 +vn -0.8642 0.3143 -0.3928 +vn 0.7861 0.3276 -0.5241 +vn -0.7782 -0.3537 -0.5188 +vn 0.7782 -0.3537 -0.5188 +vn -0.4381 -0.7988 -0.4123 +vn 0.4381 -0.7988 -0.4123 +vn 0.2037 -0.8146 -0.5431 +vn -0.2037 -0.8146 -0.5431 +vn 0.7683 -0.3293 -0.5488 +vn -0.7683 -0.3293 -0.5488 +vn 0.4000 -0.0623 0.9144 +vn -0.4000 -0.0623 0.9144 +vn 0.3069 -0.1754 0.9354 +vn -0.3069 -0.1754 0.9354 +vn 0.0945 -0.1835 0.9785 +vn -0.0945 -0.1835 0.9785 +vn -0.0624 -0.0283 0.9977 +vn 0.0624 -0.0283 0.9977 +vn -0.0624 0.0260 0.9977 +vn 0.0624 0.0260 0.9977 +vn 0.0996 0.1729 0.9799 +vn -0.0996 0.1729 0.9799 +vn 0.3036 0.1656 0.9383 +vn -0.3036 0.1656 0.9383 +vn 0.4002 0.0572 0.9147 +vn -0.4002 0.0572 0.9147 +vn 0.1367 -0.8748 0.4648 +vn -0.1054 -0.8433 0.5270 +vn 0.2303 -0.8656 0.4447 +vn -0.1916 -0.8620 0.4693 +vn 0.5788 -0.5049 0.6404 +vn -0.5788 -0.5049 0.6404 +vn 0.7763 -0.0633 0.6272 +vn -0.7763 -0.0633 0.6272 +vn 0.7471 0.1132 0.6550 +vn -0.7471 0.1132 0.6550 +vn 0.3747 -0.8345 0.4040 +vn -0.3747 -0.8345 0.4040 +vn 0.3557 -0.7290 0.5848 +vn -0.4177 -0.5751 0.7034 +vn 0.6947 -0.4197 0.5841 +vn -0.6947 -0.4197 0.5841 +vn 0.7028 -0.3915 0.5939 +vn -0.5537 -0.2978 0.7777 +vn 0.3127 0.3425 0.8860 +vn -0.8227 0.3606 0.4395 +vn 0.5091 0.6482 0.5663 +vn -0.5041 0.6448 0.5745 +vn 0.5977 0.5565 0.5771 +vn -0.5977 0.5565 0.5771 +vn -0.0486 0.6560 0.7532 +vn 0.0371 0.6685 0.7428 +vn -0.7104 0.2715 0.6494 +vn 0.7386 0.3768 0.5590 +vn -0.6013 0.5262 0.6013 +vn 0.5774 0.5774 0.5774 +vn 0.5070 -0.6281 0.5903 +vn -0.5364 -0.3230 0.7797 +vn 0.2226 -0.4694 0.8545 +vn -0.2226 -0.4694 0.8545 +vn -0.0348 -0.5792 0.8144 +vn 0.1073 -0.5010 0.8588 +vn -0.0899 -0.7843 0.6138 +vn 0.0770 -0.5759 0.8139 +vn 0.0547 -0.1695 0.9840 +vn -0.0279 -0.8645 0.5019 +vn 0.4260 -0.0609 0.9027 +vn -0.1687 -0.3128 0.9347 +vn 0.3352 -0.1828 0.9243 +vn -0.4350 -0.1812 0.8820 +vn 0.3579 -0.3068 0.8819 +vn -0.3223 -0.2762 0.9054 +vn 0.3069 0.2113 0.9280 +vn -0.4815 -0.2408 0.8427 +vn -0.1598 0.3903 0.9067 +vn 0.1598 0.3903 0.9067 +vn 0.6819 -0.2915 0.6709 +vn -0.1854 -0.4956 0.8485 +vn 0.0585 -0.0781 0.9952 +vn -0.0585 -0.0781 0.9952 +vn -0.0066 -0.2316 0.9728 +vn -0.0585 -0.0845 0.9947 +vn 0.1008 -0.7103 0.6966 +vn -0.1008 -0.7103 0.6966 +vn 0.1322 -0.5947 0.7930 +vn -0.1322 -0.5947 0.7930 +vn 0.3128 -0.1662 0.9352 +vn -0.3143 -0.3928 0.8642 +vn 0.3288 -0.0360 0.9437 +vn -0.3288 -0.0360 0.9437 +vn 0.3233 -0.0808 0.9429 +vn -0.3233 -0.0808 0.9429 +vn -0.0232 0.0511 0.9984 +vn 0.0000 0.0665 0.9978 +vn -0.0043 -0.0651 0.9979 +vn 0.0000 -0.0665 0.9978 +vn 0.0000 0.0000 1.0000 +vn 0.8447 -0.5335 0.0445 +vn -0.8447 -0.5335 0.0445 +vn 0.9500 0.2692 -0.1583 +vn -0.9500 0.2692 -0.1583 +vn 0.0693 0.9004 -0.4294 +vn -0.1018 0.9165 -0.3870 +vn -1.0000 0.0000 0.0000 +vn 0.6905 0.5492 0.4708 +vn 0.4071 -0.8956 0.1791 +vn -0.4319 -0.8639 0.2592 +vn 0.2873 -0.5747 0.7663 +vn -0.2873 -0.5747 0.7663 +vn -0.6326 0.5353 0.5596 +vn 0.6326 0.5353 0.5596 +vn 0.0862 0.7759 0.6250 +vn -0.0862 0.7759 0.6250 +vn 0.7532 0.2870 0.5918 +vn -0.7639 0.2971 0.5729 +vn 0.3416 -0.5409 0.7686 +vn -0.3416 -0.5409 0.7686 +vn 0.0502 0.2343 0.9709 +vn -0.0375 0.2247 0.9737 +vn -0.1304 -0.6087 0.7826 +vn 0.1304 -0.6087 0.7826 +vn -0.5059 0.0716 0.8596 +vn 0.5059 0.0716 0.8596 +vn -0.5774 -0.5774 0.5774 +vn 0.5774 -0.5774 0.5774 +vn 0.5460 -0.4310 0.7184 +vn -0.3319 0.0738 0.9404 +vn 0.3231 0.0311 0.9459 +vn -0.2815 0.0662 0.9573 +vn 0.7357 0.3910 0.5531 +vn -0.8753 0.2059 0.4376 +vn 0.8480 0.3180 0.4240 +vn -0.8973 0.1994 0.3938 +vn 0.8505 0.3798 0.3638 +vn -0.8505 0.3798 0.3638 +vn 0.1783 -0.4161 0.8917 +vn -0.2524 -0.8655 0.4327 +vn -0.1296 -0.1945 0.9723 +vn 0.1296 -0.1945 0.9723 +vn -0.4472 0.0000 0.8944 +vn 0.4472 0.0000 0.8944 +vn -0.1582 0.9494 0.2713 +vn 0.1582 0.9494 0.2713 +vn -0.6463 0.7337 0.2096 +vn 0.6463 0.7337 0.2096 +vn 1.0000 0.0000 0.0000 +vn 0.3051 -0.9450 0.1181 +vn -0.3051 -0.9450 0.1181 +vn 0.0217 -0.3031 0.9527 +vn -0.0217 -0.3031 0.9527 +vn 0.1353 -0.3479 0.9277 +vn -0.1353 -0.3479 0.9277 +vn -0.4681 -0.2239 0.8548 +vn 0.4681 -0.2239 0.8548 +vn -0.2710 0.0271 0.9622 +vn 0.2710 0.0271 0.9622 +vn -0.1717 -0.0090 0.9851 +vn 0.2595 0.1038 0.9601 +vn -0.4332 -0.4874 0.7581 +vn 0.6684 -0.4595 0.5849 +vn -0.1599 -0.8797 0.4478 +vn 0.1599 -0.8797 0.4478 +vn 0.3900 -0.5895 0.7074 +vn -0.3900 -0.5895 0.7074 +vn 0.6547 -0.4589 0.6007 +vn -0.6547 -0.4589 0.6007 +vn 0.5378 -0.1144 0.8353 +vn -0.5378 -0.1144 0.8353 +vn 0.5657 0.1197 0.8159 +vn -0.5774 0.1155 0.8083 +vn 0.4082 0.4082 0.8165 +vn -0.5214 0.6574 0.5441 +vn 0.1796 0.7882 0.5886 +vn -0.1796 0.7882 0.5886 +vn 0.1881 0.3387 0.9219 +vn -0.1881 0.3387 0.9219 +vn -0.0870 0.2756 0.9573 +vn 0.0870 0.2756 0.9573 +vn 0.2804 -0.2181 0.9348 +vn -0.3553 -0.5739 0.7379 +vn 0.3015 -0.3015 0.9045 +vn -0.3015 -0.3015 0.9045 +vn -0.3766 -0.8339 0.4035 +vn 0.0631 -0.3156 0.9468 +vn 0.0823 -0.7822 0.6175 +vn 0.2016 -0.9071 0.3696 +vn -0.3707 -0.2851 0.8839 +vn 0.3707 -0.2851 0.8839 +vn -0.2692 -0.0577 0.9614 +vn 0.4568 0.0508 0.8881 +vn -0.2797 0.5245 0.8042 +vn 0.2797 0.5245 0.8042 +vn -0.0213 0.5546 0.8319 +vn 0.0487 0.6815 0.7302 +vn 0.3778 0.6342 0.6746 +vn -0.3378 0.5221 0.7831 +vn 0.4988 0.5300 0.6858 +vn -0.4988 0.5300 0.6858 +vn 0.5425 -0.3391 0.7686 +vn -0.5425 -0.3391 0.7686 +vn 0.8305 -0.0615 0.5536 +vn -0.8305 -0.0615 0.5536 +vn 0.7814 0.1116 0.6140 +vn -0.7814 0.1116 0.6140 +vn -0.4338 0.8888 -0.1481 +vn 0.4338 0.8888 -0.1481 +vn -0.8515 0.3744 -0.3670 +vn 0.8515 0.3744 -0.3670 +vn -0.2664 0.8710 -0.4127 +vn 0.2197 0.8626 -0.4557 +vn 0.5932 0.7445 -0.3063 +vn -0.5914 0.7489 -0.2991 +vn 0.3714 0.8685 -0.3284 +vn -0.3653 0.8833 -0.2938 +vn 0.2901 0.9141 -0.2833 +vn -0.2901 0.9141 -0.2833 +vn 0.8873 0.1343 -0.4412 +vn -0.7964 0.1323 -0.5901 +vn 0.5108 -0.6649 -0.5450 +vn -0.5108 -0.6649 -0.5450 +vn 0.3695 -0.8566 -0.3601 +vn -0.3695 -0.8566 -0.3601 +vn 0.3617 -0.3858 -0.8487 +vn -0.1649 -0.6644 -0.7289 +vn 0.1952 -0.0976 -0.9759 +vn -0.3011 -0.0125 -0.9535 +vn -0.0107 -0.5633 -0.8262 +vn -0.2562 -0.3112 -0.9152 +vn 0.1533 -0.9649 -0.2134 +vn -0.1533 -0.9649 -0.2134 +vn 0.1260 -0.9624 -0.2406 +vn -0.1260 -0.9624 -0.2406 +vn 0.9396 0.1573 -0.3041 +vn -0.9396 0.1573 -0.3041 +vn 0.9278 0.1838 -0.3246 +vn -0.9278 0.1838 -0.3246 +vn 0.2192 0.0766 -0.9727 +vn -0.2192 0.0766 -0.9727 +vn 0.1211 -0.0530 -0.9912 +vn 0.1497 -0.3635 -0.9195 +vn 0.9094 0.1371 -0.3927 +vn -0.3706 -0.6780 -0.6349 +vn 0.9202 0.1355 -0.3672 +vn -0.9202 0.1355 -0.3672 +vn 0.9173 0.3440 -0.2007 +vn -0.9457 0.2673 -0.1850 +vn 0.9004 0.3642 -0.2380 +vn -0.9337 0.2813 -0.2215 +vn 0.8945 0.4337 0.1084 +vn -0.9501 0.2455 -0.1922 +vn 0.1596 -0.9577 -0.2394 +vn -0.1835 -0.7864 -0.5898 +vn 0.3693 -0.4712 -0.8010 +vn -0.3727 -0.4759 -0.7966 +vn 0.2986 -0.8236 -0.4821 +vn -0.3263 -0.8342 -0.4446 +vn 0.2995 -0.9442 -0.1368 +vn -0.2995 -0.9442 -0.1368 +vn 0.3287 -0.9163 -0.2291 +vn -0.3287 -0.9163 -0.2291 +vn 0.8305 0.3333 -0.4463 +vn -0.8642 -0.4737 0.1696 +vn 0.9166 -0.3740 0.1414 +vn -0.9166 -0.3740 0.1414 +vn 0.2950 -0.0454 -0.9544 +vn -0.4189 -0.2265 -0.8793 +vn 0.1272 0.9658 0.2260 +vn -0.1119 0.9626 0.2468 +vn 0.1320 0.9750 -0.1788 +vn -0.1320 0.9750 -0.1788 +vn 0.3878 0.6192 -0.6828 +vn -0.3878 0.6192 -0.6828 +vn 0.4951 0.8618 -0.1100 +vn -0.4951 0.8618 -0.1100 +vn 0.2561 0.6447 0.7202 +vn -0.2561 0.6447 0.7202 +vn 0.5966 0.7888 0.1479 +vn -0.5966 0.7888 0.1479 +vn 0.7125 0.6755 -0.1900 +vn -0.7125 0.6755 -0.1900 +vn 0.7104 0.1364 -0.6904 +vn -0.6304 0.2517 -0.7343 +vn 0.6823 0.2318 -0.6933 +vn -0.6823 0.2318 -0.6933 +vn 0.6574 0.7254 -0.2040 +vn -0.6574 0.7254 -0.2040 +vn 0.7289 0.6729 0.1262 +vn -0.7289 0.6729 0.1262 +vn 0.7791 0.4074 0.4764 +vn -0.7791 0.4074 0.4764 +vn 0.3669 0.8840 -0.2898 +vn -0.3238 0.9434 -0.0720 +vn 0.2854 0.6237 0.7277 +vn -0.1548 0.5080 0.8473 +vn -0.1681 0.1005 -0.9806 +vn 0.1681 0.1005 -0.9806 +vn 0.2925 0.5674 0.7697 +vn -0.2925 0.5674 0.7697 +vn -0.1616 0.1847 0.9694 +vn 0.1616 0.1847 0.9694 +vn 0.8681 0.0893 -0.4883 +vn -0.9340 0.2255 0.2773 +vn 0.9276 0.0762 0.3657 +vn -0.9276 0.0762 0.3657 +vn 0.9750 0.2169 0.0490 +vn -0.9750 0.2169 0.0490 +vn 0.9817 -0.0304 -0.1882 +vn -0.9956 0.0893 -0.0288 +vn 0.7466 -0.6646 0.0285 +vn -0.6374 -0.7651 0.0915 +vn 0.3723 -0.9243 0.0847 +vn -0.3720 -0.9244 0.0845 +vn 0.3986 -0.8754 0.2734 +vn -0.3986 -0.8754 0.2734 +vn 0.6328 -0.7642 0.1247 +vn -0.6328 -0.7642 0.1247 +vn 0.7325 -0.6368 0.2407 +vn -0.7325 -0.6368 0.2407 +vn 0.2637 -0.4499 0.8533 +vn -0.2637 -0.4499 0.8533 +vn 0.5881 -0.3070 -0.7483 +vn -0.5236 -0.3290 -0.7859 +vn 0.4694 -0.2400 -0.8498 +vn -0.5396 -0.3343 -0.7727 +vn 0.4463 -0.8452 -0.2941 +vn -0.2144 -0.8341 -0.5082 +vn 0.6973 -0.6610 -0.2771 +vn -0.7365 -0.6154 -0.2808 +vn 0.4972 -0.4408 -0.7473 +vn -0.4972 -0.4408 -0.7473 +vn 0.3691 0.2855 0.8844 +vn -0.3244 0.4867 0.8111 +vn 0.4467 0.0975 0.8894 +vn -0.4467 0.0975 0.8894 +vn 0.3188 0.1993 0.9266 +vn -0.1817 -0.0079 0.9833 +vn 0.2076 -0.0836 0.9746 +vn -0.2925 -0.0758 0.9533 +vn 0.3398 0.0824 0.9369 +vn -0.5847 -0.2198 0.7809 +vn 0.5957 -0.3850 0.7049 +vn -0.5957 -0.3850 0.7049 +vn 0.4843 0.5580 0.6738 +vn -0.4843 0.5580 0.6738 +vn -0.2675 0.8318 0.4864 +vn 0.2675 0.8318 0.4864 +vn -0.8576 0.2223 0.4637 +vn 0.7885 0.2366 0.5677 +vn -0.5257 -0.3579 0.7717 +vn 0.5242 -0.3548 0.7742 +vn 0.4663 -0.5991 0.6509 +vn -0.4390 -0.5252 0.7290 +vn 0.7104 -0.4567 0.5356 +vn -0.7104 -0.4567 0.5356 +vn 0.7507 -0.6131 -0.2461 +vn -0.6302 -0.7658 0.1282 +vn -0.1788 0.2923 0.9395 +vn 0.2175 0.2733 0.9370 +vn 0.9042 -0.3578 -0.2332 +vn -0.9042 -0.3578 -0.2332 +vn 0.0400 0.3399 0.9396 +vn -0.0400 0.3399 0.9396 +vn 0.2734 0.9064 0.3221 +vn -0.2734 0.9064 0.3221 +vn 0.4480 -0.4480 0.7737 +vn -0.7177 0.1689 0.6755 +vn 0.5534 -0.5534 0.6225 +vn -0.9008 -0.4075 0.1501 +vn 0.5724 -0.3122 0.7582 +vn -0.5815 -0.5217 0.6243 +vn 0.5597 -0.5533 0.6169 +vn -0.6138 -0.2571 0.7465 +vn 0.8271 0.5323 -0.1802 +vn -0.8271 0.5323 -0.1802 +vn 0.9227 -0.3765 -0.0825 +vn -0.8717 -0.4446 -0.2063 +vn 0.9972 -0.0181 -0.0725 +vn -0.9972 -0.0181 -0.0725 +vn 0.6895 -0.6644 0.2883 +vn -0.6895 -0.6644 0.2883 +vn 0.7815 -0.6176 0.0882 +vn -0.7930 -0.5947 0.1322 +vn 0.7022 -0.7022 0.1170 +vn -0.7022 -0.7022 0.1170 +vn 0.1240 0.9921 0.0207 +vn -0.2408 0.9631 -0.1204 +vn 0.9435 0.3145 0.1048 +vn -0.9251 0.3469 0.1542 +vn 0.6213 -0.7767 0.1036 +vn -0.6213 -0.7767 0.1036 +vn 0.0000 1.0000 0.0000 +vn 0.6197 -0.6899 0.3742 +vn -0.6197 -0.6899 0.3742 +vn 0.2752 -0.8808 0.3853 +vn -0.2752 -0.8808 0.3853 +vn -0.7929 -0.5252 -0.3089 +vn 0.7929 -0.5252 -0.3089 +vn -0.8096 0.2429 -0.5343 +vn 0.8538 0.2328 -0.4657 +vn -0.5621 0.8231 -0.0803 +vn 0.5433 0.6985 -0.4657 +vn -0.0071 0.9899 0.1414 +vn 0.1096 0.9939 -0.0157 +vn 0.1046 0.0392 0.9937 +vn -0.1738 0.0097 0.9847 +vn 0.2461 0.0852 0.9655 +vn -0.4134 0.0413 0.9096 +vn 0.3009 0.0926 0.9491 +vn -0.3009 0.0926 0.9491 +vn 0.2104 0.0124 0.9775 +vn -0.1220 0.0458 0.9915 +vn -0.0099 0.3867 0.9221 +vn 0.0099 0.3867 0.9221 +vn 0.3787 -0.0364 0.9248 +vn -0.4244 -0.0320 0.9049 +vn 0.2530 -0.1897 0.9487 +vn -0.2570 0.0723 0.9637 +vn -0.4870 0.6088 0.6262 +vn 0.2981 0.7454 0.5963 +vn 0.6693 0.1802 0.7208 +vn -0.6693 0.1802 0.7208 +vn 0.4388 -0.2008 0.8759 +vn -0.4723 -0.1986 0.8588 +vn 0.5786 -0.1334 0.8046 +vn -0.2975 -0.4062 0.8640 +vn 0.5002 0.2833 0.8182 +vn -0.5002 0.2833 0.8182 +vn 0.2980 0.5802 0.7580 +vn -0.2980 0.5802 0.7580 +vn 0.0929 -0.9912 -0.0944 +vn -0.0929 -0.9912 -0.0944 +vn 0.4688 -0.8715 0.1442 +vn -0.4688 -0.8715 0.1442 +vn 0.9309 -0.2541 0.2624 +vn -0.9264 -0.2460 0.2851 +vn 0.8465 0.5291 -0.0595 +vn -0.8267 0.5627 -0.0035 +vn -0.2511 0.9439 -0.2145 +vn 0.2146 0.9243 -0.3157 +vn -0.4841 0.8743 -0.0361 +vn 0.4196 0.8851 -0.2012 +vn -0.5256 -0.0030 -0.8507 +vn 0.5470 -0.0144 -0.8370 +vn -0.1466 0.0104 -0.9891 +vn 0.1466 0.0104 -0.9891 +vn 0.4046 0.0266 -0.9141 +vn -0.4046 0.0266 -0.9141 +vn -0.8073 0.5901 0.0041 +vn 0.7330 0.6786 0.0472 +vn 0.4200 -0.2291 -0.8781 +vn -0.4200 -0.2291 -0.8781 +vn -0.0687 -0.9943 -0.0818 +vn 0.0687 -0.9943 -0.0818 +vn 0.6713 -0.1971 0.7145 +vn -0.6713 -0.1971 0.7145 +vn 0.8326 -0.3017 0.4646 +vn -0.8326 -0.3017 0.4646 +vn 0.4258 -0.7967 0.4290 +vn -0.4258 -0.7967 0.4290 +vn 0.3265 -0.4954 0.8050 +vn -0.3265 -0.4954 0.8050 +vn -0.0649 -0.5714 0.8181 +vn 0.0649 -0.5714 0.8181 +vn -0.2738 -0.8315 0.4834 +vn 0.2738 -0.8315 0.4834 +vn -0.7606 -0.3400 0.5531 +vn 0.7824 -0.3294 0.5285 +vn -0.4658 -0.1863 0.8651 +vn 0.4658 -0.1863 0.8651 +vn -0.4983 0.1812 0.8478 +vn 0.4983 0.1812 0.8478 +vn -0.7683 0.3293 0.5488 +vn 0.7656 0.3223 0.5568 +vn -0.2487 0.8249 0.5076 +vn 0.2560 0.8073 0.5317 +vn -0.1017 0.5518 0.8277 +vn 0.0821 0.6023 0.7940 +vn 0.3861 0.5446 0.7445 +vn -0.3329 0.5231 0.7846 +vn 0.4059 0.7641 0.5014 +vn -0.4246 0.7711 0.4745 +vn 0.8299 0.2940 0.4742 +vn -0.8251 0.2968 0.4808 +vn 0.6617 0.2026 0.7219 +vn -0.6888 0.1868 0.7005 +vn 0.7816 0.3058 -0.5437 +vn -0.8400 0.3436 -0.4200 +vn 0.2037 0.8146 -0.5431 +vn -0.2074 0.8296 -0.5185 +vn -0.4381 0.7988 -0.4123 +vn 0.4056 0.7605 -0.5070 +vn -0.7861 0.3276 -0.5241 +vn 0.8642 0.3143 -0.3928 +vn -0.8519 -0.3408 -0.3976 +vn 0.8519 -0.3408 -0.3976 +vn -0.4056 -0.7605 -0.5070 +vn 0.4056 -0.7605 -0.5070 +vn 0.2074 -0.8296 -0.5185 +vn -0.2074 -0.8296 -0.5185 +vn 0.8297 -0.3734 -0.4149 +vn -0.8297 -0.3734 -0.4149 +vn 0.1054 -0.8433 0.5270 +vn -0.1367 -0.8748 0.4648 +vn 0.1916 -0.8620 0.4693 +vn -0.2303 -0.8656 0.4447 +vn 0.5959 -0.4256 0.6810 +vn -0.5959 -0.4256 0.6810 +vn 0.7563 -0.0299 0.6535 +vn -0.7563 -0.0299 0.6535 +vn 0.8069 0.0689 0.5866 +vn -0.8069 0.0689 0.5866 +vn 0.2334 -0.7779 0.5834 +vn -0.2334 -0.7779 0.5834 +vn 0.4177 -0.5751 0.7034 +vn -0.3557 -0.7290 0.5848 +vn 0.6872 -0.4191 0.5934 +vn -0.6872 -0.4191 0.5934 +vn 0.5537 -0.2978 0.7777 +vn -0.7028 -0.3915 0.5939 +vn 0.8227 0.3606 0.4395 +vn -0.3127 0.3425 0.8860 +vn 0.5041 0.6448 0.5745 +vn -0.5091 0.6482 0.5663 +vn 0.6155 0.4924 0.6155 +vn -0.6155 0.4924 0.6155 +vn -0.0371 0.6685 0.7428 +vn 0.0486 0.6560 0.7532 +vn -0.7386 0.3768 0.5590 +vn 0.7104 0.2715 0.6494 +vn -0.5774 0.5774 0.5774 +vn 0.6013 0.5262 0.6013 +vn 0.5364 -0.3230 0.7797 +vn -0.5070 -0.6281 0.5903 +vn 0.2181 -0.4685 0.8561 +vn -0.2181 -0.4685 0.8561 +vn -0.1073 -0.5010 0.8588 +vn 0.0348 -0.5792 0.8144 +vn -0.0770 -0.5759 0.8139 +vn 0.0899 -0.7843 0.6138 +vn 0.0279 -0.8645 0.5019 +vn -0.0547 -0.1695 0.9840 +vn 0.1687 -0.3128 0.9347 +vn -0.4260 -0.0609 0.9027 +vn 0.4350 -0.1812 0.8820 +vn -0.3352 -0.1828 0.9243 +vn 0.3223 -0.2762 0.9054 +vn -0.3579 -0.3068 0.8819 +vn 0.4815 -0.2408 0.8427 +vn -0.3069 0.2113 0.9280 +vn -0.0317 -0.1899 0.9813 +vn 0.0317 -0.1899 0.9813 +vn 0.1854 -0.4956 0.8485 +vn -0.6819 -0.2915 0.6709 +vn 0.2623 -0.3498 0.8994 +vn -0.2623 -0.3498 0.8994 +vn 0.0585 -0.0845 0.9947 +vn 0.0066 -0.2316 0.9728 +vn -0.0136 -0.6507 0.7592 +vn 0.0136 -0.6507 0.7592 +vn 0.2404 -0.5476 0.8014 +vn -0.2404 -0.5476 0.8014 +vn 0.3143 -0.3928 0.8642 +vn -0.3128 -0.1662 0.9352 +vn 0.2821 -0.0164 0.9592 +vn -0.2821 -0.0164 0.9592 +vn 0.3273 -0.1432 0.9340 +vn -0.3273 -0.1432 0.9340 +vn 0.0232 0.0511 0.9984 +vn 0.0043 -0.0651 0.9979 +vn 0.7826 -0.6087 -0.1304 +vn -0.7826 -0.6087 -0.1304 +vn 0.9448 0.1919 -0.2657 +vn -0.9448 0.1919 -0.2657 +vn 0.1018 0.9165 -0.3870 +vn -0.0693 0.9004 -0.4294 +vn -0.6905 0.5492 0.4708 +vn 0.4319 -0.8639 0.2592 +vn -0.4071 -0.8956 0.1791 +vn -0.6667 0.6667 0.3333 +vn 0.6667 0.6667 0.3333 +vn 0.1348 0.8086 0.5727 +vn -0.1348 0.8086 0.5727 +vn 0.7639 0.2971 0.5729 +vn -0.7532 0.2870 0.5918 +vn 0.4116 -0.8575 0.3087 +vn -0.4116 -0.8575 0.3087 +vn 0.0375 0.2247 0.9737 +vn -0.0502 0.2343 0.9709 +vn 0.1304 -0.2609 0.9565 +vn -0.1304 -0.2609 0.9565 +vn -0.0631 -0.8206 0.5681 +vn 0.0631 -0.8206 0.5681 +vn 0.7325 0.2817 0.6198 +vn -0.7325 0.2817 0.6198 +vn 0.3319 0.0738 0.9404 +vn -0.5460 -0.4310 0.7184 +vn 0.2815 0.0662 0.9573 +vn -0.3231 0.0311 0.9459 +vn 0.8753 0.2059 0.4376 +vn -0.7357 0.3910 0.5531 +vn 0.8973 0.1994 0.3938 +vn -0.8480 0.3180 0.4240 +vn 0.9586 0.0664 0.2767 +vn -0.9586 0.0664 0.2767 +vn 0.2524 -0.8655 0.4327 +vn -0.1783 -0.4161 0.8917 +vn -0.1751 -0.2043 0.9631 +vn 0.1751 -0.2043 0.9631 +vn -0.1219 -0.1829 0.9755 +vn 0.1219 -0.1829 0.9755 +vn -0.1562 0.3123 0.9370 +vn 0.1562 0.3123 0.9370 +vn -0.7238 0.6857 0.0762 +vn 0.7238 0.6857 0.0762 +vn 0.0478 -0.2870 0.9567 +vn -0.0478 -0.2870 0.9567 +vn -0.5488 -0.3293 0.7683 +vn 0.5488 -0.3293 0.7683 +vn -0.4945 -0.1130 0.8618 +vn 0.4945 -0.1130 0.8618 +vn -0.2595 0.1038 0.9601 +vn 0.1717 -0.0090 0.9851 +vn -0.6684 -0.4595 0.5849 +vn 0.4332 -0.4874 0.7581 +vn -0.1156 -0.6359 0.7631 +vn 0.1156 -0.6359 0.7631 +vn 0.4242 -0.6211 0.6590 +vn -0.4242 -0.6211 0.6590 +vn 0.4767 -0.3557 0.8039 +vn -0.4767 -0.3557 0.8039 +vn 0.5871 -0.0839 0.8052 +vn -0.5871 -0.0839 0.8052 +vn 0.5774 0.1155 0.8083 +vn -0.5657 0.1197 0.8159 +vn 0.5214 0.6574 0.5441 +vn -0.4082 0.4082 0.8165 +vn 0.3358 0.3478 0.8754 +vn -0.3358 0.3478 0.8754 +vn 0.1452 0.3774 0.9146 +vn -0.1452 0.3774 0.9146 +vn 0.0301 0.2306 0.9726 +vn -0.0301 0.2306 0.9726 +vn 0.3553 -0.5739 0.7379 +vn -0.2804 -0.2181 0.9348 +vn 0.2627 -0.2252 0.9382 +vn -0.2627 -0.2252 0.9382 +vn -0.0631 -0.3156 0.9468 +vn 0.3766 -0.8339 0.4035 +vn -0.2016 -0.9071 0.3696 +vn -0.0823 -0.7822 0.6175 +vn -0.3356 -0.2397 0.9110 +vn 0.3356 -0.2397 0.9110 +vn -0.4568 0.0508 0.8881 +vn 0.2692 -0.0577 0.9614 +vn -0.0247 0.4072 0.9130 +vn 0.0247 0.4072 0.9130 +vn -0.0487 0.6815 0.7302 +vn 0.0213 0.5546 0.8319 +vn 0.3378 0.5221 0.7831 +vn -0.3778 0.6342 0.6746 +vn 0.7895 -0.3158 0.5263 +vn -0.7895 -0.3158 0.5263 +vn 0.8070 -0.0807 0.5851 +vn -0.8070 -0.0807 0.5851 +vn 0.7868 0.1210 0.6052 +vn -0.7868 0.1210 0.6052 +vn -0.6357 0.6811 -0.3633 +vn 0.6357 0.6811 -0.3633 +vn -0.8507 0.3650 -0.3783 +vn 0.8507 0.3650 -0.3783 +vn -0.2197 0.8626 -0.4557 +vn 0.2664 0.8710 -0.4127 +vn 0.5914 0.7489 -0.2991 +vn -0.5932 0.7445 -0.3063 +vn 0.3653 0.8833 -0.2938 +vn -0.3714 0.8685 -0.3284 +vn 0.2760 0.9159 -0.2915 +vn -0.2760 0.9159 -0.2915 +vn 0.7964 0.1323 -0.5901 +vn -0.8873 0.1343 -0.4412 +vn 0.5442 -0.7524 -0.3712 +vn -0.5442 -0.7524 -0.3712 +vn 0.4027 -0.7323 -0.5492 +vn -0.4027 -0.7323 -0.5492 +vn 0.1649 -0.6644 -0.7289 +vn -0.3617 -0.3858 -0.8487 +vn 0.3011 -0.0125 -0.9535 +vn -0.1952 -0.0976 -0.9759 +vn 0.2562 -0.3112 -0.9152 +vn 0.0107 -0.5633 -0.8262 +vn 0.0779 -0.9948 -0.0663 +vn -0.0779 -0.9948 -0.0663 +vn 0.1094 -0.9718 -0.2089 +vn -0.1094 -0.9718 -0.2089 +vn 0.8150 -0.5621 -0.1405 +vn -0.8150 -0.5621 -0.1405 +vn 0.9358 0.1396 -0.3236 +vn -0.9358 0.1396 -0.3236 +vn 0.1132 -0.0274 -0.9932 +vn -0.1132 -0.0274 -0.9932 +vn -0.1497 -0.3635 -0.9195 +vn -0.1211 -0.0530 -0.9912 +vn 0.3706 -0.6780 -0.6349 +vn -0.9094 0.1371 -0.3927 +vn 0.9193 0.1393 -0.3682 +vn -0.9193 0.1393 -0.3682 +vn 0.9457 0.2673 -0.1850 +vn -0.9173 0.3440 -0.2007 +vn 0.9337 0.2813 -0.2215 +vn -0.9004 0.3642 -0.2380 +vn 0.9501 0.2455 -0.1922 +vn -0.8945 0.4337 0.1084 +vn 0.1835 -0.7864 -0.5898 +vn -0.1596 -0.9577 -0.2394 +vn 0.3727 -0.4759 -0.7966 +vn -0.3693 -0.4712 -0.8010 +vn 0.3263 -0.8342 -0.4446 +vn -0.2986 -0.8236 -0.4821 +vn 0.2620 -0.9574 -0.1217 +vn -0.2620 -0.9574 -0.1217 +vn 0.2996 -0.9443 -0.1362 +vn -0.2996 -0.9443 -0.1362 +vn 0.8642 -0.4737 0.1696 +vn -0.8305 0.3333 -0.4463 +vn 0.6869 -0.6358 0.3521 +vn -0.6869 -0.6358 0.3521 +vn 0.4189 -0.2265 -0.8793 +vn -0.2950 -0.0454 -0.9544 +vn 0.1119 0.9626 0.2468 +vn -0.1272 0.9658 0.2260 +vn 0.1208 0.9734 -0.1947 +vn -0.1208 0.9734 -0.1947 +vn 0.3140 0.5711 -0.7585 +vn -0.3140 0.5711 -0.7585 +vn 0.3231 0.9288 -0.1817 +vn -0.3231 0.9288 -0.1817 +vn 0.0452 0.7955 0.6043 +vn -0.0452 0.7955 0.6043 +vn 0.6144 0.7696 0.1738 +vn -0.6144 0.7696 0.1738 +vn 0.6935 0.6857 -0.2212 +vn -0.6935 0.6857 -0.2212 +vn 0.6304 0.2517 -0.7343 +vn -0.7104 0.1364 -0.6904 +vn 0.3179 0.5704 -0.7574 +vn -0.3179 0.5704 -0.7574 +vn 0.6289 0.7624 -0.1525 +vn -0.6289 0.7624 -0.1525 +vn 0.7088 0.6833 0.1752 +vn -0.7088 0.6833 0.1752 +vn 0.6885 0.3830 0.6158 +vn -0.6885 0.3830 0.6158 +vn 0.3238 0.9434 -0.0720 +vn -0.3669 0.8840 -0.2898 +vn 0.1548 0.5080 0.8473 +vn -0.2854 0.6237 0.7277 +vn -0.1819 0.1145 -0.9766 +vn 0.1819 0.1145 -0.9766 +vn -0.2638 0.9462 -0.1871 +vn 0.2638 0.9462 -0.1871 +vn 0.9340 0.2255 0.2773 +vn -0.8681 0.0893 -0.4883 +vn 0.9758 0.1241 0.1800 +vn -0.9758 0.1241 0.1800 +vn 0.9613 0.1472 -0.2330 +vn -0.9613 0.1472 -0.2330 +vn 0.9956 0.0893 -0.0288 +vn -0.9817 -0.0304 -0.1882 +vn 0.6374 -0.7651 0.0915 +vn -0.7466 -0.6646 0.0285 +vn 0.3720 -0.9244 0.0845 +vn -0.3723 -0.9243 0.0847 +vn 0.5281 -0.8354 0.1522 +vn -0.5281 -0.8354 0.1522 +vn 0.3070 -0.5237 0.7946 +vn -0.3070 -0.5237 0.7946 +vn 0.5236 -0.3290 -0.7859 +vn -0.5881 -0.3070 -0.7483 +vn 0.5396 -0.3343 -0.7727 +vn -0.4694 -0.2400 -0.8498 +vn 0.2144 -0.8341 -0.5082 +vn -0.4463 -0.8452 -0.2941 +vn 0.7365 -0.6154 -0.2808 +vn -0.6973 -0.6610 -0.2771 +vn 0.3244 0.4867 0.8111 +vn -0.3691 0.2855 0.8844 +vn 0.4649 0.2593 0.8465 +vn -0.4649 0.2593 0.8465 +vn 0.1817 -0.0079 0.9833 +vn -0.3188 0.1993 0.9266 +vn 0.2925 -0.0758 0.9533 +vn -0.2076 -0.0836 0.9746 +vn 0.5847 -0.2198 0.7809 +vn -0.3398 0.0824 0.9369 +vn 0.6509 -0.1939 0.7340 +vn -0.6509 -0.1939 0.7340 +vn 0.4075 0.7506 0.5201 +vn -0.4075 0.7506 0.5201 +vn -0.2655 0.8296 0.4911 +vn 0.2655 0.8296 0.4911 +vn -0.7885 0.2366 0.5677 +vn 0.8576 0.2223 0.4637 +vn -0.5242 -0.3548 0.7742 +vn 0.5257 -0.3579 0.7717 +vn 0.4390 -0.5252 0.7290 +vn -0.4663 -0.5991 0.6509 +vn 0.6888 -0.4428 0.5740 +vn -0.6888 -0.4428 0.5740 +vn 0.6302 -0.7658 0.1282 +vn -0.7507 -0.6131 -0.2461 +vn -0.2175 0.2733 0.9370 +vn 0.1788 0.2923 0.9395 +vn 0.9046 -0.3869 -0.1792 +vn -0.9046 -0.3869 -0.1792 +vn 0.1782 -0.0891 0.9800 +vn -0.1782 -0.0891 0.9800 +vn -0.2335 0.8972 0.3749 +vn 0.2335 0.8972 0.3749 +vn 0.7177 0.1689 0.6755 +vn -0.4480 -0.4480 0.7737 +vn 0.5313 0.5844 0.6134 +vn -0.5313 0.5844 0.6134 +vn 0.9008 -0.4075 0.1501 +vn -0.5534 -0.5534 0.6225 +vn 0.5815 -0.5217 0.6243 +vn -0.5724 -0.3122 0.7582 +vn 0.6138 -0.2571 0.7465 +vn -0.5597 -0.5533 0.6169 +vn 0.8779 -0.4788 0.0076 +vn -0.8779 -0.4788 0.0076 +vn 0.8717 -0.4446 -0.2063 +vn -0.9227 -0.3765 -0.0825 +vn 0.7661 -0.6363 0.0909 +vn -0.7661 -0.6363 0.0909 +vn 0.7930 -0.5947 0.1322 +vn -0.7815 -0.6176 0.0882 +vn 0.2408 0.9631 -0.1204 +vn -0.1240 0.9921 0.0207 +vn 0.9251 0.3469 0.1542 +vn -0.9435 0.3145 0.1048 +vn 0.7071 -0.7071 0.0000 +vn -0.7071 -0.7071 0.0000 +vn -0.0157 0.9898 0.1414 +vn 0.0157 0.9898 0.1414 +vn 0.6266 -0.7211 0.2956 +vn -0.6266 -0.7211 0.2956 +vn 0.2714 -0.9022 0.3353 +vn -0.2714 -0.9022 0.3353 +vn -0.8651 -0.4853 -0.1266 +vn 0.8651 -0.4853 -0.1266 +vn -0.8538 0.2328 -0.4657 +vn 0.8096 0.2429 -0.5343 +vn -0.5433 0.6985 -0.4657 +vn 0.5621 0.8231 -0.0803 +vn -0.1096 0.9939 -0.0157 +vn 0.0071 0.9899 0.1414 +vn 0.1738 0.0097 0.9847 +vn -0.1046 0.0392 0.9937 +vn 0.4134 0.0413 0.9096 +vn -0.2461 0.0852 0.9655 +vn 0.3228 -0.0461 0.9453 +vn -0.3228 -0.0461 0.9453 +vn 0.1220 0.0458 0.9915 +vn -0.2104 0.0124 0.9775 +vn 0.5679 0.1916 0.8005 +vn -0.5679 0.1916 0.8005 +vn 0.4244 -0.0320 0.9049 +vn -0.3787 -0.0364 0.9248 +vn 0.2570 0.0723 0.9637 +vn -0.2530 -0.1897 0.9487 +vn 0.1351 -0.0225 0.9906 +vn -0.1351 -0.0225 0.9906 +vn -0.2981 0.7454 0.5963 +vn 0.4870 0.6088 0.6262 +vn 0.5571 -0.1486 0.8171 +vn -0.5571 -0.1486 0.8171 +vn 0.4723 -0.1986 0.8588 +vn -0.4388 -0.2008 0.8759 +vn 0.2975 -0.4062 0.8640 +vn -0.5786 -0.1334 0.8046 +vn 0.5771 0.2164 0.7875 +vn -0.5771 0.2164 0.7875 +vn 0.0931 -0.9932 -0.0692 +vn -0.0931 -0.9932 -0.0692 +vn 0.5161 -0.8527 -0.0812 +vn -0.5161 -0.8527 -0.0812 +vn 0.9264 -0.2460 0.2851 +vn -0.9309 -0.2541 0.2624 +vn 0.8267 0.5627 -0.0035 +vn -0.8465 0.5291 -0.0595 +vn -0.2146 0.9243 -0.3157 +vn 0.2511 0.9439 -0.2145 +vn -0.4196 0.8851 -0.2012 +vn 0.4841 0.8743 -0.0361 +vn -0.5470 -0.0144 -0.8370 +vn 0.5256 -0.0030 -0.8507 +vn -0.2556 -0.0749 -0.9639 +vn 0.2556 -0.0749 -0.9639 +vn -0.7330 0.6786 0.0472 +vn 0.8073 0.5901 0.0041 +vn 0.6844 -0.1711 -0.7088 +vn -0.6844 -0.1711 -0.7088 +vn -0.3604 -0.8283 -0.4290 +vn 0.3604 -0.8283 -0.4290 +usemtl None +s off +f 47//1 3//1 45//1 +f 4//2 48//2 46//2 +f 45//3 5//3 43//3 +f 6//4 46//4 44//4 +f 3//5 7//5 5//5 +f 8//6 4//6 6//6 +f 1//7 9//7 3//7 +f 10//8 2//8 4//8 +f 11//9 15//9 9//9 +f 16//10 12//10 10//10 +f 9//11 17//11 7//11 +f 18//12 10//12 8//12 +f 21//13 17//13 15//13 +f 22//14 18//14 20//14 +f 13//15 21//15 15//15 +f 22//16 14//16 16//16 +f 23//17 27//17 21//17 +f 28//18 24//18 22//18 +f 27//19 19//19 21//19 +f 28//20 20//20 30//20 +f 33//21 29//21 27//21 +f 34//22 30//22 32//22 +f 35//23 27//23 25//23 +f 36//24 28//24 34//24 +f 37//25 33//25 35//25 +f 38//26 34//26 40//26 +f 39//27 31//27 33//27 +f 40//28 32//28 42//28 +f 45//29 41//29 39//29 +f 46//30 42//30 44//30 +f 47//31 39//31 37//31 +f 48//32 40//32 46//32 +f 37//33 49//33 47//33 +f 38//34 50//34 52//34 +f 35//35 51//35 37//35 +f 36//36 52//36 54//36 +f 25//37 53//37 35//37 +f 26//38 54//38 56//38 +f 23//39 55//39 25//39 +f 24//40 56//40 58//40 +f 23//41 59//41 57//41 +f 60//42 24//42 58//42 +f 13//43 63//43 59//43 +f 64//44 14//44 60//44 +f 11//45 65//45 63//45 +f 66//46 12//46 64//46 +f 1//47 49//47 65//47 +f 50//48 2//48 66//48 +f 61//49 65//49 49//49 +f 50//50 66//50 62//50 +f 63//51 65//51 61//51 +f 62//52 66//52 64//52 +f 61//53 59//53 63//53 +f 64//54 60//54 62//54 +f 61//55 57//55 59//55 +f 60//56 58//56 62//56 +f 61//57 55//57 57//57 +f 58//58 56//58 62//58 +f 61//59 53//59 55//59 +f 56//60 54//60 62//60 +f 61//61 51//61 53//61 +f 54//62 52//62 62//62 +f 61//63 49//63 51//63 +f 52//64 50//64 62//64 +f 174//65 91//65 89//65 +f 175//66 91//66 176//66 +f 172//67 89//67 87//67 +f 173//68 90//68 175//68 +f 85//69 172//69 87//69 +f 173//70 86//70 88//70 +f 83//71 170//71 85//71 +f 171//72 84//72 86//72 +f 81//73 168//73 83//73 +f 169//74 82//74 84//74 +f 79//75 146//75 164//75 +f 147//76 80//76 165//76 +f 94//77 146//77 92//77 +f 95//78 147//78 149//78 +f 94//79 150//79 148//79 +f 151//80 95//80 149//80 +f 98//81 150//81 96//81 +f 99//82 151//82 153//82 +f 100//83 152//83 98//83 +f 101//84 153//84 155//84 +f 102//85 154//85 100//85 +f 103//86 155//86 157//86 +f 102//87 158//87 156//87 +f 159//88 103//88 157//88 +f 106//89 158//89 104//89 +f 107//90 159//90 161//90 +f 108//91 160//91 106//91 +f 109//92 161//92 163//92 +f 67//93 162//93 108//93 +f 67//94 163//94 68//94 +f 128//95 162//95 110//95 +f 129//96 163//96 161//96 +f 128//97 158//97 160//97 +f 159//98 129//98 161//98 +f 156//99 179//99 126//99 +f 157//100 180//100 159//100 +f 154//101 126//101 124//101 +f 155//102 127//102 157//102 +f 152//103 124//103 122//103 +f 153//104 125//104 155//104 +f 150//105 122//105 120//105 +f 151//106 123//106 153//106 +f 148//107 120//107 118//107 +f 149//108 121//108 151//108 +f 146//109 118//109 116//109 +f 147//110 119//110 149//110 +f 164//111 116//111 114//111 +f 165//112 117//112 147//112 +f 114//113 177//113 164//113 +f 177//114 115//114 165//114 +f 162//115 112//115 110//115 +f 163//116 113//116 68//116 +f 112//117 178//117 183//117 +f 178//118 113//118 184//118 +f 181//119 178//119 177//119 +f 182//120 178//120 184//120 +f 135//121 176//121 174//121 +f 176//122 136//122 175//122 +f 133//123 174//123 172//123 +f 175//124 134//124 173//124 +f 133//125 170//125 131//125 +f 134//126 171//126 173//126 +f 166//127 185//127 168//127 +f 186//128 167//128 169//128 +f 131//129 168//129 185//129 +f 169//130 132//130 186//130 +f 190//131 187//131 144//131 +f 190//132 188//132 189//132 +f 187//133 69//133 185//133 +f 188//134 69//134 189//134 +f 131//135 69//135 130//135 +f 132//135 69//135 186//135 +f 142//136 191//136 144//136 +f 192//137 143//137 145//137 +f 140//138 193//138 142//138 +f 194//139 141//139 143//139 +f 197//140 140//140 139//140 +f 198//141 141//141 196//141 +f 71//142 139//142 138//142 +f 71//143 139//143 198//143 +f 144//144 70//144 190//144 +f 145//145 70//145 192//145 +f 191//146 208//146 70//146 +f 192//147 208//147 207//147 +f 71//148 200//148 197//148 +f 201//149 71//149 198//149 +f 197//150 202//150 195//150 +f 203//151 198//151 196//151 +f 202//152 193//152 195//152 +f 203//153 194//153 205//153 +f 193//154 206//154 191//154 +f 207//155 194//155 192//155 +f 204//156 200//156 199//156 +f 205//157 201//157 203//157 +f 199//158 206//158 204//158 +f 207//159 199//159 205//159 +f 139//160 164//160 177//160 +f 165//161 139//161 177//161 +f 140//162 211//162 164//162 +f 212//163 141//163 165//163 +f 144//164 211//164 142//164 +f 145//165 212//165 214//165 +f 187//166 213//166 144//166 +f 188//167 214//167 167//167 +f 209//168 166//168 81//168 +f 210//169 167//169 214//169 +f 215//170 213//170 209//170 +f 216//171 214//171 212//171 +f 79//172 211//172 215//172 +f 212//173 80//173 216//173 +f 130//174 222//174 131//174 +f 130//175 223//175 72//175 +f 133//176 222//176 220//176 +f 223//177 134//177 221//177 +f 135//178 220//178 218//178 +f 221//179 136//179 219//179 +f 137//135 218//135 217//135 +f 219//135 137//135 217//135 +f 218//180 231//180 217//180 +f 219//181 231//181 230//181 +f 218//182 227//182 229//182 +f 228//183 219//183 230//183 +f 220//142 225//142 227//142 +f 226//184 221//184 228//184 +f 72//185 225//185 222//185 +f 72//186 226//186 224//186 +f 224//187 229//187 225//187 +f 230//188 224//188 226//188 +f 225//189 229//189 227//189 +f 228//190 230//190 226//190 +f 183//191 234//191 232//191 +f 235//192 184//192 233//192 +f 112//193 232//193 254//193 +f 233//194 113//194 255//194 +f 112//195 256//195 110//195 +f 113//196 257//196 255//196 +f 114//197 234//197 181//197 +f 115//198 235//198 253//198 +f 114//199 250//199 252//199 +f 251//200 115//200 253//200 +f 116//201 248//201 250//201 +f 249//202 117//202 251//202 +f 118//203 246//203 248//203 +f 247//204 119//204 249//204 +f 120//205 244//205 246//205 +f 245//206 121//206 247//206 +f 124//207 244//207 122//207 +f 125//208 245//208 243//208 +f 126//209 242//209 124//209 +f 127//210 243//210 241//210 +f 126//211 236//211 240//211 +f 237//212 127//212 241//212 +f 179//213 238//213 236//213 +f 239//214 180//214 237//214 +f 128//215 256//215 238//215 +f 257//216 129//216 239//216 +f 256//217 276//217 238//217 +f 257//218 277//218 259//218 +f 236//219 276//219 278//219 +f 277//220 237//220 279//220 +f 236//221 274//221 240//221 +f 237//222 275//222 279//222 +f 240//223 272//223 242//223 +f 241//224 273//224 275//224 +f 244//225 272//225 270//225 +f 273//226 245//226 271//226 +f 244//227 268//227 246//227 +f 245//228 269//228 271//228 +f 248//229 268//229 266//229 +f 269//230 249//230 267//230 +f 248//231 264//231 250//231 +f 249//232 265//232 267//232 +f 250//233 262//233 252//233 +f 251//234 263//234 265//234 +f 234//235 262//235 280//235 +f 263//236 235//236 281//236 +f 256//237 260//237 258//237 +f 261//238 257//238 259//238 +f 254//239 282//239 260//239 +f 283//240 255//240 261//240 +f 232//241 280//241 282//241 +f 281//242 233//242 283//242 +f 67//243 284//243 73//243 +f 285//244 67//244 73//244 +f 108//245 286//245 284//245 +f 287//246 109//246 285//246 +f 104//247 286//247 106//247 +f 105//248 287//248 289//248 +f 102//249 288//249 104//249 +f 103//250 289//250 291//250 +f 100//251 290//251 102//251 +f 101//252 291//252 293//252 +f 100//253 294//253 292//253 +f 295//254 101//254 293//254 +f 96//255 294//255 98//255 +f 97//256 295//256 297//256 +f 96//257 298//257 296//257 +f 299//258 97//258 297//258 +f 94//259 300//259 298//259 +f 301//260 95//260 299//260 +f 309//261 338//261 308//261 +f 309//262 339//262 329//262 +f 308//263 336//263 307//263 +f 308//264 337//264 339//264 +f 307//265 340//265 306//265 +f 307//266 341//266 337//266 +f 89//267 306//267 340//267 +f 306//268 90//268 341//268 +f 87//269 340//269 334//269 +f 341//270 88//270 335//270 +f 85//271 334//271 330//271 +f 335//272 86//272 331//272 +f 83//273 330//273 332//273 +f 331//274 84//274 333//274 +f 330//275 338//275 332//275 +f 339//276 331//276 333//276 +f 334//277 336//277 330//277 +f 335//278 337//278 341//278 +f 332//279 328//279 326//279 +f 333//280 329//280 339//280 +f 81//281 332//281 326//281 +f 333//282 82//282 327//282 +f 342//283 215//283 209//283 +f 343//284 216//284 345//284 +f 326//285 209//285 81//285 +f 327//286 210//286 343//286 +f 215//287 346//287 79//287 +f 216//288 347//288 345//288 +f 346//289 92//289 79//289 +f 347//290 93//290 301//290 +f 324//291 304//291 77//291 +f 325//292 304//292 353//292 +f 352//293 78//293 304//293 +f 353//294 78//294 351//294 +f 78//295 348//295 305//295 +f 349//296 78//296 305//296 +f 305//297 328//297 309//297 +f 329//298 305//298 309//298 +f 328//299 342//299 326//299 +f 329//300 343//300 349//300 +f 296//301 318//301 310//301 +f 319//302 297//302 311//302 +f 316//303 77//303 76//303 +f 317//304 77//304 325//304 +f 358//305 303//305 302//305 +f 359//306 303//306 357//306 +f 303//307 354//307 75//307 +f 355//308 303//308 75//308 +f 75//309 316//309 76//309 +f 317//310 75//310 76//310 +f 292//311 362//311 364//311 +f 363//312 293//312 365//312 +f 364//313 368//313 366//313 +f 369//314 365//314 367//314 +f 366//315 370//315 372//315 +f 371//316 367//316 373//316 +f 372//317 376//317 374//317 +f 377//318 373//318 375//318 +f 378//319 376//319 314//319 +f 379//320 377//320 375//320 +f 316//321 374//321 378//321 +f 375//322 317//322 379//322 +f 354//323 372//323 374//323 +f 373//324 355//324 375//324 +f 356//325 366//325 372//325 +f 367//326 357//326 373//326 +f 358//327 364//327 366//327 +f 365//328 359//328 367//328 +f 292//329 360//329 290//329 +f 293//330 361//330 365//330 +f 360//331 302//331 74//331 +f 361//332 302//332 359//332 +f 284//333 288//333 290//333 +f 289//334 285//334 291//334 +f 284//335 360//335 74//335 +f 361//336 285//336 74//336 +f 73//337 284//337 74//337 +f 74//338 285//338 73//338 +f 296//339 362//339 294//339 +f 297//340 363//340 311//340 +f 310//341 368//341 362//341 +f 369//342 311//342 363//342 +f 312//343 370//343 368//343 +f 371//344 313//344 369//344 +f 376//345 382//345 314//345 +f 377//346 383//346 371//346 +f 350//347 384//347 348//347 +f 351//348 385//348 387//348 +f 384//349 320//349 318//349 +f 385//350 321//350 387//350 +f 298//351 384//351 318//351 +f 385//352 299//352 319//352 +f 300//353 342//353 384//353 +f 343//354 301//354 385//354 +f 342//355 348//355 384//355 +f 385//356 349//356 343//356 +f 300//357 346//357 344//357 +f 345//358 347//358 301//358 +f 322//359 378//359 314//359 +f 323//360 379//360 381//360 +f 378//361 324//361 316//361 +f 379//362 325//362 381//362 +f 386//363 322//363 320//363 +f 387//364 323//364 381//364 +f 352//365 386//365 350//365 +f 353//366 387//366 381//366 +f 324//367 380//367 352//367 +f 353//368 381//368 325//368 +f 388//369 402//369 400//369 +f 389//370 403//370 415//370 +f 400//371 404//371 398//371 +f 405//372 401//372 399//372 +f 404//373 396//373 398//373 +f 405//374 397//374 407//374 +f 406//375 394//375 396//375 +f 407//376 395//376 409//376 +f 408//377 392//377 394//377 +f 409//378 393//378 411//378 +f 392//379 412//379 390//379 +f 413//380 393//380 391//380 +f 410//381 418//381 412//381 +f 419//382 411//382 413//382 +f 408//383 420//383 410//383 +f 421//384 409//384 411//384 +f 424//385 408//385 406//385 +f 425//386 409//386 423//386 +f 426//387 406//387 404//387 +f 427//388 407//388 425//388 +f 428//389 404//389 402//389 +f 429//390 405//390 427//390 +f 402//391 416//391 428//391 +f 417//392 403//392 429//392 +f 320//393 442//393 318//393 +f 321//394 443//394 445//394 +f 390//395 444//395 320//395 +f 391//396 445//396 413//396 +f 310//397 442//397 312//397 +f 443//398 311//398 313//398 +f 382//399 414//399 388//399 +f 415//400 383//400 389//400 +f 412//401 440//401 444//401 +f 441//402 413//402 445//402 +f 446//403 440//403 438//403 +f 447//404 441//404 445//404 +f 434//135 438//135 436//135 +f 439//135 435//135 437//135 +f 448//405 434//405 432//405 +f 449//406 435//406 447//406 +f 448//407 450//407 430//407 +f 449//408 451//408 433//408 +f 430//409 416//409 414//409 +f 431//410 417//410 451//410 +f 312//411 430//411 382//411 +f 431//412 313//412 383//412 +f 442//413 448//413 312//413 +f 443//414 449//414 447//414 +f 442//415 444//415 446//415 +f 447//416 445//416 443//416 +f 416//417 452//417 476//417 +f 453//418 417//418 477//418 +f 432//419 452//419 450//419 +f 433//420 453//420 463//420 +f 432//421 460//421 462//421 +f 461//422 433//422 463//422 +f 436//423 460//423 434//423 +f 437//424 461//424 459//424 +f 438//425 458//425 436//425 +f 439//426 459//426 457//426 +f 438//427 454//427 456//427 +f 455//428 439//428 457//428 +f 440//429 474//429 454//429 +f 475//429 441//429 455//429 +f 428//430 476//430 464//430 +f 477//431 429//431 465//431 +f 426//432 464//432 466//432 +f 465//433 427//433 467//433 +f 424//434 466//434 468//434 +f 467//435 425//435 469//435 +f 424//436 470//436 422//436 +f 425//437 471//437 469//437 +f 422//438 472//438 420//438 +f 423//439 473//439 471//439 +f 420//440 474//440 418//440 +f 421//441 475//441 473//441 +f 456//442 478//442 458//442 +f 457//443 479//443 481//443 +f 480//444 484//444 478//444 +f 481//445 485//445 483//445 +f 484//446 488//446 486//446 +f 489//447 485//447 487//447 +f 488//448 492//448 486//448 +f 489//449 493//449 491//449 +f 464//450 486//450 492//450 +f 487//451 465//451 493//451 +f 484//452 476//452 452//452 +f 485//453 477//453 487//453 +f 462//454 484//454 452//454 +f 463//455 485//455 479//455 +f 458//135 462//135 460//135 +f 463//135 459//135 461//135 +f 474//456 456//456 454//456 +f 475//457 457//457 481//457 +f 472//458 480//458 474//458 +f 481//459 473//459 475//459 +f 488//460 472//460 470//460 +f 489//461 473//461 483//461 +f 490//462 470//462 468//462 +f 491//463 471//463 489//463 +f 466//464 490//464 468//464 +f 491//465 467//465 469//465 +f 464//466 492//466 466//466 +f 467//467 493//467 465//467 +f 392//468 504//468 502//468 +f 505//469 393//469 503//469 +f 394//470 502//470 500//470 +f 503//471 395//471 501//471 +f 394//472 498//472 396//472 +f 395//473 499//473 501//473 +f 396//474 496//474 398//474 +f 397//475 497//475 499//475 +f 398//476 494//476 400//476 +f 399//477 495//477 497//477 +f 400//478 506//478 388//478 +f 401//479 507//479 495//479 +f 502//480 506//480 494//480 +f 503//481 507//481 505//481 +f 494//482 500//482 502//482 +f 501//483 495//483 503//483 +f 496//484 498//484 500//484 +f 501//485 499//485 497//485 +f 382//486 506//486 314//486 +f 383//487 507//487 389//487 +f 314//488 504//488 322//488 +f 505//489 315//489 323//489 +f 320//490 504//490 390//490 +f 505//491 321//491 391//491 +f 47//492 1//492 3//492 +f 4//493 2//493 48//493 +f 45//494 3//494 5//494 +f 6//495 4//495 46//495 +f 3//496 9//496 7//496 +f 8//497 10//497 4//497 +f 1//498 11//498 9//498 +f 10//499 12//499 2//499 +f 11//500 13//500 15//500 +f 16//501 14//501 12//501 +f 9//502 15//502 17//502 +f 18//503 16//503 10//503 +f 21//504 19//504 17//504 +f 22//505 16//505 18//505 +f 13//506 23//506 21//506 +f 22//507 24//507 14//507 +f 23//508 25//508 27//508 +f 28//509 26//509 24//509 +f 27//510 29//510 19//510 +f 28//511 22//511 20//511 +f 33//512 31//512 29//512 +f 34//513 28//513 30//513 +f 35//514 33//514 27//514 +f 36//515 26//515 28//515 +f 37//516 39//516 33//516 +f 38//517 36//517 34//517 +f 39//518 41//518 31//518 +f 40//519 34//519 32//519 +f 45//520 43//520 41//520 +f 46//521 40//521 42//521 +f 47//522 45//522 39//522 +f 48//523 38//523 40//523 +f 37//524 51//524 49//524 +f 38//525 48//525 50//525 +f 35//526 53//526 51//526 +f 36//527 38//527 52//527 +f 25//528 55//528 53//528 +f 26//529 36//529 54//529 +f 23//530 57//530 55//530 +f 24//531 26//531 56//531 +f 23//532 13//532 59//532 +f 60//533 14//533 24//533 +f 13//534 11//534 63//534 +f 64//535 12//535 14//535 +f 11//536 1//536 65//536 +f 66//537 2//537 12//537 +f 1//538 47//538 49//538 +f 50//539 48//539 2//539 +f 174//540 176//540 91//540 +f 175//541 90//541 91//541 +f 172//542 174//542 89//542 +f 173//543 88//543 90//543 +f 85//544 170//544 172//544 +f 173//545 171//545 86//545 +f 83//546 168//546 170//546 +f 171//547 169//547 84//547 +f 81//548 166//548 168//548 +f 169//549 167//549 82//549 +f 79//550 92//550 146//550 +f 147//551 93//551 80//551 +f 94//552 148//552 146//552 +f 95//553 93//553 147//553 +f 94//554 96//554 150//554 +f 151//555 97//555 95//555 +f 98//556 152//556 150//556 +f 99//557 97//557 151//557 +f 100//558 154//558 152//558 +f 101//559 99//559 153//559 +f 102//560 156//560 154//560 +f 103//561 101//561 155//561 +f 102//562 104//562 158//562 +f 159//563 105//563 103//563 +f 106//564 160//564 158//564 +f 107//565 105//565 159//565 +f 108//566 162//566 160//566 +f 109//567 107//567 161//567 +f 67//568 68//568 162//568 +f 67//569 109//569 163//569 +f 128//570 160//570 162//570 +f 129//571 111//571 163//571 +f 128//572 179//572 158//572 +f 159//573 180//573 129//573 +f 156//574 158//574 179//574 +f 157//575 127//575 180//575 +f 154//576 156//576 126//576 +f 155//577 125//577 127//577 +f 152//578 154//578 124//578 +f 153//579 123//579 125//579 +f 150//580 152//580 122//580 +f 151//581 121//581 123//581 +f 148//582 150//582 120//582 +f 149//583 119//583 121//583 +f 146//584 148//584 118//584 +f 147//585 117//585 119//585 +f 164//586 146//586 116//586 +f 165//587 115//587 117//587 +f 114//588 181//588 177//588 +f 177//589 182//589 115//589 +f 162//590 68//590 112//590 +f 163//591 111//591 113//591 +f 112//592 68//592 178//592 +f 178//593 68//593 113//593 +f 181//594 183//594 178//594 +f 182//595 177//595 178//595 +f 135//596 137//596 176//596 +f 176//597 137//597 136//597 +f 133//598 135//598 174//598 +f 175//599 136//599 134//599 +f 133//600 172//600 170//600 +f 134//601 132//601 171//601 +f 166//602 187//602 185//602 +f 186//603 188//603 167//603 +f 131//604 170//604 168//604 +f 169//605 171//605 132//605 +f 190//132 189//132 187//132 +f 190//606 145//606 188//606 +f 187//134 189//134 69//134 +f 188//607 186//607 69//607 +f 131//135 185//135 69//135 +f 132//135 130//135 69//135 +f 142//608 193//608 191//608 +f 192//609 194//609 143//609 +f 140//610 195//610 193//610 +f 194//611 196//611 141//611 +f 197//612 195//612 140//612 +f 198//613 139//613 141//613 +f 71//614 197//614 139//614 +f 71//184 138//184 139//184 +f 144//615 191//615 70//615 +f 145//616 190//616 70//616 +f 191//146 206//146 208//146 +f 192//147 70//147 208//147 +f 71//617 199//617 200//617 +f 201//618 199//618 71//618 +f 197//619 200//619 202//619 +f 203//620 201//620 198//620 +f 202//621 204//621 193//621 +f 203//622 196//622 194//622 +f 193//623 204//623 206//623 +f 207//624 205//624 194//624 +f 204//625 202//625 200//625 +f 205//626 199//626 201//626 +f 199//627 208//627 206//627 +f 207//628 208//628 199//628 +f 139//629 140//629 164//629 +f 165//630 141//630 139//630 +f 140//631 142//631 211//631 +f 212//632 143//632 141//632 +f 144//633 213//633 211//633 +f 145//634 143//634 212//634 +f 187//635 166//635 213//635 +f 188//636 145//636 214//636 +f 209//637 213//637 166//637 +f 210//638 82//638 167//638 +f 215//639 211//639 213//639 +f 216//640 210//640 214//640 +f 79//641 164//641 211//641 +f 212//642 165//642 80//642 +f 130//643 72//643 222//643 +f 130//644 132//644 223//644 +f 133//645 131//645 222//645 +f 223//646 132//646 134//646 +f 135//647 133//647 220//647 +f 221//648 134//648 136//648 +f 137//649 135//649 218//649 +f 219//650 136//650 137//650 +f 218//180 229//180 231//180 +f 219//181 217//181 231//181 +f 218//651 220//651 227//651 +f 228//652 221//652 219//652 +f 220//142 222//142 225//142 +f 226//184 223//184 221//184 +f 72//185 224//185 225//185 +f 72//186 223//186 226//186 +f 224//653 231//653 229//653 +f 230//654 231//654 224//654 +f 183//655 181//655 234//655 +f 235//656 182//656 184//656 +f 112//657 183//657 232//657 +f 233//658 184//658 113//658 +f 112//659 254//659 256//659 +f 113//660 111//660 257//660 +f 114//661 252//661 234//661 +f 115//662 182//662 235//662 +f 114//663 116//663 250//663 +f 251//664 117//664 115//664 +f 116//665 118//665 248//665 +f 249//666 119//666 117//666 +f 118//667 120//667 246//667 +f 247//668 121//668 119//668 +f 120//669 122//669 244//669 +f 245//670 123//670 121//670 +f 124//671 242//671 244//671 +f 125//672 123//672 245//672 +f 126//673 240//673 242//673 +f 127//674 125//674 243//674 +f 126//675 179//675 236//675 +f 237//676 180//676 127//676 +f 179//677 128//677 238//677 +f 239//678 129//678 180//678 +f 128//679 110//679 256//679 +f 257//680 111//680 129//680 +f 256//681 258//681 276//681 +f 257//682 239//682 277//682 +f 236//683 238//683 276//683 +f 277//684 239//684 237//684 +f 236//685 278//685 274//685 +f 237//686 241//686 275//686 +f 240//687 274//687 272//687 +f 241//688 243//688 273//688 +f 244//689 242//689 272//689 +f 273//690 243//690 245//690 +f 244//691 270//691 268//691 +f 245//692 247//692 269//692 +f 248//693 246//693 268//693 +f 269//694 247//694 249//694 +f 248//695 266//695 264//695 +f 249//696 251//696 265//696 +f 250//697 264//697 262//697 +f 251//698 253//698 263//698 +f 234//235 252//235 262//235 +f 263//236 253//236 235//236 +f 256//699 254//699 260//699 +f 261//700 255//700 257//700 +f 254//701 232//701 282//701 +f 283//702 233//702 255//702 +f 232//703 234//703 280//703 +f 281//704 235//704 233//704 +f 67//705 108//705 284//705 +f 285//706 109//706 67//706 +f 108//707 106//707 286//707 +f 287//708 107//708 109//708 +f 104//709 288//709 286//709 +f 105//710 107//710 287//710 +f 102//711 290//711 288//711 +f 103//712 105//712 289//712 +f 100//713 292//713 290//713 +f 101//714 103//714 291//714 +f 100//715 98//715 294//715 +f 295//716 99//716 101//716 +f 96//717 296//717 294//717 +f 97//718 99//718 295//718 +f 96//719 94//719 298//719 +f 299//720 95//720 97//720 +f 94//721 92//721 300//721 +f 301//722 93//722 95//722 +f 309//723 328//723 338//723 +f 309//724 308//724 339//724 +f 308//725 338//725 336//725 +f 308//726 307//726 337//726 +f 307//727 336//727 340//727 +f 307//728 306//728 341//728 +f 89//729 91//729 306//729 +f 306//730 91//730 90//730 +f 87//731 89//731 340//731 +f 341//732 90//732 88//732 +f 85//733 87//733 334//733 +f 335//734 88//734 86//734 +f 83//735 85//735 330//735 +f 331//736 86//736 84//736 +f 330//737 336//737 338//737 +f 339//738 337//738 331//738 +f 334//739 340//739 336//739 +f 335//740 331//740 337//740 +f 332//741 338//741 328//741 +f 333//742 327//742 329//742 +f 81//743 83//743 332//743 +f 333//744 84//744 82//744 +f 342//745 344//745 215//745 +f 343//746 210//746 216//746 +f 326//747 342//747 209//747 +f 327//748 82//748 210//748 +f 215//749 344//749 346//749 +f 216//750 80//750 347//750 +f 346//751 300//751 92//751 +f 347//752 80//752 93//752 +f 324//753 352//753 304//753 +f 325//754 77//754 304//754 +f 352//755 350//755 78//755 +f 353//756 304//756 78//756 +f 78//757 350//757 348//757 +f 349//758 351//758 78//758 +f 305//759 348//759 328//759 +f 329//760 349//760 305//760 +f 328//761 348//761 342//761 +f 329//762 327//762 343//762 +f 296//763 298//763 318//763 +f 319//764 299//764 297//764 +f 316//765 324//765 77//765 +f 317//766 76//766 77//766 +f 358//767 356//767 303//767 +f 359//768 302//768 303//768 +f 303//769 356//769 354//769 +f 355//770 357//770 303//770 +f 75//771 354//771 316//771 +f 317//772 355//772 75//772 +f 292//773 294//773 362//773 +f 363//774 295//774 293//774 +f 364//775 362//775 368//775 +f 369//776 363//776 365//776 +f 366//777 368//777 370//777 +f 371//778 369//778 367//778 +f 372//779 370//779 376//779 +f 377//780 371//780 373//780 +f 378//781 374//781 376//781 +f 379//782 315//782 377//782 +f 316//783 354//783 374//783 +f 375//784 355//784 317//784 +f 354//785 356//785 372//785 +f 373//786 357//786 355//786 +f 356//787 358//787 366//787 +f 367//788 359//788 357//788 +f 358//789 360//789 364//789 +f 365//790 361//790 359//790 +f 292//791 364//791 360//791 +f 293//792 291//792 361//792 +f 360//793 358//793 302//793 +f 361//794 74//794 302//794 +f 284//795 286//795 288//795 +f 289//796 287//796 285//796 +f 284//797 290//797 360//797 +f 361//798 291//798 285//798 +f 296//799 310//799 362//799 +f 297//800 295//800 363//800 +f 310//801 312//801 368//801 +f 369//802 313//802 311//802 +f 312//803 382//803 370//803 +f 371//804 383//804 313//804 +f 376//805 370//805 382//805 +f 377//806 315//806 383//806 +f 350//807 386//807 384//807 +f 351//808 349//808 385//808 +f 384//809 386//809 320//809 +f 385//810 319//810 321//810 +f 298//811 300//811 384//811 +f 385//812 301//812 299//812 +f 300//813 344//813 342//813 +f 343//814 345//814 301//814 +f 322//815 380//815 378//815 +f 323//816 315//816 379//816 +f 378//817 380//817 324//817 +f 379//818 317//818 325//818 +f 386//819 380//819 322//819 +f 387//820 321//820 323//820 +f 352//821 380//821 386//821 +f 353//822 351//822 387//822 +f 388//823 414//823 402//823 +f 389//824 401//824 403//824 +f 400//825 402//825 404//825 +f 405//826 403//826 401//826 +f 404//827 406//827 396//827 +f 405//828 399//828 397//828 +f 406//829 408//829 394//829 +f 407//830 397//830 395//830 +f 408//831 410//831 392//831 +f 409//832 395//832 393//832 +f 392//833 410//833 412//833 +f 413//834 411//834 393//834 +f 410//835 420//835 418//835 +f 419//836 421//836 411//836 +f 408//837 422//837 420//837 +f 421//838 423//838 409//838 +f 424//839 422//839 408//839 +f 425//840 407//840 409//840 +f 426//841 424//841 406//841 +f 427//842 405//842 407//842 +f 428//843 426//843 404//843 +f 429//844 403//844 405//844 +f 402//845 414//845 416//845 +f 417//846 415//846 403//846 +f 320//847 444//847 442//847 +f 321//848 319//848 443//848 +f 390//849 412//849 444//849 +f 391//850 321//850 445//850 +f 310//851 318//851 442//851 +f 443//852 319//852 311//852 +f 382//853 430//853 414//853 +f 415//854 431//854 383//854 +f 412//855 418//855 440//855 +f 441//856 419//856 413//856 +f 446//857 444//857 440//857 +f 447//858 439//858 441//858 +f 434//859 446//859 438//859 +f 439//860 447//860 435//860 +f 448//861 446//861 434//861 +f 449//862 433//862 435//862 +f 448//863 432//863 450//863 +f 449//864 431//864 451//864 +f 430//865 450//865 416//865 +f 431//866 415//866 417//866 +f 312//867 448//867 430//867 +f 431//868 449//868 313//868 +f 442//869 446//869 448//869 +f 443//870 313//870 449//870 +f 416//871 450//871 452//871 +f 453//872 451//872 417//872 +f 432//873 462//873 452//873 +f 433//874 451//874 453//874 +f 432//421 434//421 460//421 +f 461//422 435//422 433//422 +f 436//875 458//875 460//875 +f 437//876 435//876 461//876 +f 438//877 456//877 458//877 +f 439//878 437//878 459//878 +f 438//879 440//879 454//879 +f 455//880 441//880 439//880 +f 440//881 418//881 474//881 +f 475//882 419//882 441//882 +f 428//883 416//883 476//883 +f 477//884 417//884 429//884 +f 426//885 428//885 464//885 +f 465//886 429//886 427//886 +f 424//887 426//887 466//887 +f 467//888 427//888 425//888 +f 424//889 468//889 470//889 +f 425//890 423//890 471//890 +f 422//891 470//891 472//891 +f 423//892 421//892 473//892 +f 420//893 472//893 474//893 +f 421//894 419//894 475//894 +f 456//895 480//895 478//895 +f 457//896 459//896 479//896 +f 480//897 482//897 484//897 +f 481//898 479//898 485//898 +f 484//899 482//899 488//899 +f 489//900 483//900 485//900 +f 488//901 490//901 492//901 +f 489//902 487//902 493//902 +f 464//903 476//903 486//903 +f 487//904 477//904 465//904 +f 484//905 486//905 476//905 +f 485//906 453//906 477//906 +f 462//907 478//907 484//907 +f 463//908 453//908 485//908 +f 458//909 478//909 462//909 +f 463//910 479//910 459//910 +f 474//911 480//911 456//911 +f 475//912 455//912 457//912 +f 472//913 482//913 480//913 +f 481//914 483//914 473//914 +f 488//915 482//915 472//915 +f 489//916 471//916 473//916 +f 490//917 488//917 470//917 +f 491//918 469//918 471//918 +f 466//919 492//919 490//919 +f 491//920 493//920 467//920 +f 392//921 390//921 504//921 +f 505//922 391//922 393//922 +f 394//923 392//923 502//923 +f 503//924 393//924 395//924 +f 394//925 500//925 498//925 +f 395//926 397//926 499//926 +f 396//927 498//927 496//927 +f 397//928 399//928 497//928 +f 398//929 496//929 494//929 +f 399//930 401//930 495//930 +f 400//931 494//931 506//931 +f 401//932 389//932 507//932 +f 502//933 504//933 506//933 +f 503//934 495//934 507//934 +f 494//935 496//935 500//935 +f 501//936 497//936 495//936 +f 382//937 388//937 506//937 +f 383//938 315//938 507//938 +f 314//939 506//939 504//939 +f 505//940 507//940 315//940 +f 320//941 322//941 504//941 +f 505//942 323//942 321//942 diff --git a/resources/my_tree.mtl b/resources/my_tree.mtl new file mode 100644 index 0000000..70d3ba1 --- /dev/null +++ b/resources/my_tree.mtl @@ -0,0 +1,10 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl None +Ns 0 +Ka 0.000000 0.000000 0.000000 +Kd 0.8 0.8 0.8 +Ks 0.8 0.8 0.8 +d 1 +illum 2 diff --git a/resources/my_tree.obj b/resources/my_tree.obj new file mode 100644 index 0000000..cd9add1 --- /dev/null +++ b/resources/my_tree.obj @@ -0,0 +1,621 @@ +# Blender v2.79 (sub 0) OBJ File: '' +# www.blender.org +mtllib my_tree.mtl +o Cylinder +v 0.106095 0.015904 -0.310996 +v 0.106095 0.764620 -0.310996 +v 0.179129 0.015904 -0.303803 +v 0.179129 0.764620 -0.303803 +v 0.249356 0.015904 -0.282500 +v 0.249356 0.764620 -0.282500 +v 0.314077 0.015904 -0.247905 +v 0.314077 0.764620 -0.247905 +v 0.370806 0.015904 -0.201349 +v 0.370806 0.764620 -0.201349 +v 0.417362 0.015904 -0.144620 +v 0.417362 0.764620 -0.144620 +v 0.451957 0.015904 -0.079899 +v 0.451957 0.764620 -0.079899 +v 0.473260 0.015904 -0.009672 +v 0.473260 0.764620 -0.009672 +v 0.480453 0.015904 0.063362 +v 0.480453 0.764620 0.063362 +v 0.473260 0.015904 0.136395 +v 0.473260 0.764620 0.136395 +v 0.451957 0.015904 0.206622 +v 0.451957 0.764620 0.206622 +v 0.417362 0.015904 0.271344 +v 0.417362 0.764620 0.271344 +v 0.370806 0.015904 0.328073 +v 0.370806 0.764620 0.328073 +v 0.314077 0.015904 0.374629 +v 0.314077 0.764620 0.374629 +v 0.249356 0.015904 0.409223 +v 0.249356 0.764620 0.409223 +v 0.179129 0.015904 0.430526 +v 0.179129 0.764620 0.430526 +v 0.106095 0.015904 0.437719 +v 0.106095 0.764620 0.437719 +v 0.033062 0.015904 0.430526 +v 0.033062 0.764620 0.430526 +v -0.037165 0.015904 0.409223 +v -0.037165 0.764620 0.409223 +v -0.101887 0.015904 0.374629 +v -0.101887 0.764620 0.374629 +v -0.158616 0.015904 0.328072 +v -0.158616 0.764620 0.328072 +v -0.205172 0.015904 0.271344 +v -0.205172 0.764620 0.271344 +v -0.239766 0.015904 0.206622 +v -0.239766 0.764620 0.206622 +v -0.261069 0.015904 0.136395 +v -0.261069 0.764620 0.136395 +v -0.268262 0.015904 0.063361 +v -0.268262 0.764620 0.063361 +v -0.261069 0.015904 -0.009672 +v -0.261069 0.764620 -0.009672 +v -0.239766 0.015904 -0.079899 +v -0.239766 0.764620 -0.079899 +v -0.205171 0.015904 -0.144621 +v -0.205171 0.764620 -0.144621 +v -0.158615 0.015904 -0.201349 +v -0.158615 0.764620 -0.201349 +v -0.101886 0.015904 -0.247906 +v -0.101886 0.764620 -0.247906 +v -0.037165 0.015904 -0.282500 +v -0.037165 0.764620 -0.282500 +v 0.033062 0.015904 -0.303803 +v 0.033062 0.764620 -0.303803 +vn 0.0980 0.0000 -0.9952 +vn 0.2903 0.0000 -0.9569 +vn 0.4714 0.0000 -0.8819 +vn 0.6344 0.0000 -0.7730 +vn 0.7730 0.0000 -0.6344 +vn 0.8819 0.0000 -0.4714 +vn 0.9569 0.0000 -0.2903 +vn 0.9952 0.0000 -0.0980 +vn 0.9952 0.0000 0.0980 +vn 0.9569 0.0000 0.2903 +vn 0.8819 0.0000 0.4714 +vn 0.7730 0.0000 0.6344 +vn 0.6344 0.0000 0.7730 +vn 0.4714 0.0000 0.8819 +vn 0.2903 0.0000 0.9569 +vn 0.0980 0.0000 0.9952 +vn -0.0980 0.0000 0.9952 +vn -0.2903 0.0000 0.9569 +vn -0.4714 0.0000 0.8819 +vn -0.6344 0.0000 0.7730 +vn -0.7730 0.0000 0.6344 +vn -0.8819 0.0000 0.4714 +vn -0.9569 0.0000 0.2903 +vn -0.9952 0.0000 0.0980 +vn -0.9952 0.0000 -0.0980 +vn -0.9569 0.0000 -0.2903 +vn -0.8819 0.0000 -0.4714 +vn -0.7730 0.0000 -0.6344 +vn -0.6344 0.0000 -0.7730 +vn -0.4714 0.0000 -0.8819 +vn 0.0000 1.0000 0.0000 +vn -0.2903 0.0000 -0.9569 +vn -0.0980 0.0000 -0.9952 +vn 0.0000 -1.0000 0.0000 +usemtl None +s off +f 2//1 3//1 1//1 +f 4//2 5//2 3//2 +f 6//3 7//3 5//3 +f 8//4 9//4 7//4 +f 10//5 11//5 9//5 +f 12//6 13//6 11//6 +f 14//7 15//7 13//7 +f 16//8 17//8 15//8 +f 18//9 19//9 17//9 +f 20//10 21//10 19//10 +f 22//11 23//11 21//11 +f 24//12 25//12 23//12 +f 26//13 27//13 25//13 +f 28//14 29//14 27//14 +f 30//15 31//15 29//15 +f 32//16 33//16 31//16 +f 34//17 35//17 33//17 +f 36//18 37//18 35//18 +f 38//19 39//19 37//19 +f 40//20 41//20 39//20 +f 42//21 43//21 41//21 +f 44//22 45//22 43//22 +f 46//23 47//23 45//23 +f 48//24 49//24 47//24 +f 50//25 51//25 49//25 +f 52//26 53//26 51//26 +f 54//27 55//27 53//27 +f 56//28 57//28 55//28 +f 58//29 59//29 57//29 +f 60//30 61//30 59//30 +f 54//31 38//31 22//31 +f 62//32 63//32 61//32 +f 64//33 1//33 63//33 +f 15//34 31//34 47//34 +f 2//1 4//1 3//1 +f 4//2 6//2 5//2 +f 6//3 8//3 7//3 +f 8//4 10//4 9//4 +f 10//5 12//5 11//5 +f 12//6 14//6 13//6 +f 14//7 16//7 15//7 +f 16//8 18//8 17//8 +f 18//9 20//9 19//9 +f 20//10 22//10 21//10 +f 22//11 24//11 23//11 +f 24//12 26//12 25//12 +f 26//13 28//13 27//13 +f 28//14 30//14 29//14 +f 30//15 32//15 31//15 +f 32//16 34//16 33//16 +f 34//17 36//17 35//17 +f 36//18 38//18 37//18 +f 38//19 40//19 39//19 +f 40//20 42//20 41//20 +f 42//21 44//21 43//21 +f 44//22 46//22 45//22 +f 46//23 48//23 47//23 +f 48//24 50//24 49//24 +f 50//25 52//25 51//25 +f 52//26 54//26 53//26 +f 54//27 56//27 55//27 +f 56//28 58//28 57//28 +f 58//29 60//29 59//29 +f 60//30 62//30 61//30 +f 6//31 4//31 2//31 +f 2//31 64//31 6//31 +f 64//31 62//31 6//31 +f 62//31 60//31 58//31 +f 58//31 56//31 54//31 +f 54//31 52//31 50//31 +f 50//31 48//31 54//31 +f 48//31 46//31 54//31 +f 46//31 44//31 38//31 +f 44//31 42//31 38//31 +f 42//31 40//31 38//31 +f 38//31 36//31 34//31 +f 34//31 32//31 30//31 +f 30//31 28//31 26//31 +f 26//31 24//31 22//31 +f 22//31 20//31 18//31 +f 18//31 16//31 22//31 +f 16//31 14//31 22//31 +f 14//31 12//31 10//31 +f 10//31 8//31 6//31 +f 62//31 58//31 6//31 +f 58//31 54//31 6//31 +f 38//31 34//31 22//31 +f 34//31 30//31 22//31 +f 30//31 26//31 22//31 +f 14//31 10//31 22//31 +f 10//31 6//31 22//31 +f 54//31 46//31 38//31 +f 6//31 54//31 22//31 +f 62//32 64//32 63//32 +f 64//33 2//33 1//33 +f 63//34 1//34 3//34 +f 3//34 5//34 7//34 +f 7//34 9//34 11//34 +f 11//34 13//34 7//34 +f 13//34 15//34 7//34 +f 15//34 17//34 19//34 +f 19//34 21//34 15//34 +f 21//34 23//34 15//34 +f 23//34 25//34 31//34 +f 25//34 27//34 31//34 +f 27//34 29//34 31//34 +f 31//34 33//34 35//34 +f 35//34 37//34 39//34 +f 39//34 41//34 43//34 +f 43//34 45//34 47//34 +f 47//34 49//34 51//34 +f 51//34 53//34 55//34 +f 55//34 57//34 63//34 +f 57//34 59//34 63//34 +f 59//34 61//34 63//34 +f 63//34 3//34 7//34 +f 31//34 35//34 47//34 +f 35//34 39//34 47//34 +f 39//34 43//34 47//34 +f 47//34 51//34 63//34 +f 51//34 55//34 63//34 +f 63//34 7//34 15//34 +f 15//34 23//34 31//34 +f 63//34 15//34 47//34 +o Cone +v 0.054508 2.540176 -0.904596 +v 0.226944 2.540176 -0.887612 +v 0.392753 2.540176 -0.837315 +v 0.545563 2.540176 -0.755636 +v 0.679503 2.540176 -0.645714 +v 0.789424 2.540176 -0.511775 +v 0.871103 2.540176 -0.358964 +v 0.921401 2.540176 -0.193155 +v 0.938384 2.540176 -0.020720 +v 0.921401 2.540176 0.151716 +v 0.871103 2.540176 0.317525 +v 0.789424 2.540176 0.470336 +v 0.679503 2.540176 0.604275 +v 0.545563 2.540176 0.714197 +v 0.392753 2.540176 0.795876 +v 0.226944 2.540176 0.846173 +v 0.054508 2.540176 0.863156 +v -0.117928 2.540176 0.846173 +v -0.283737 2.540176 0.795875 +v -0.436547 2.540176 0.714196 +v -0.570487 2.540176 0.604275 +v -0.680408 2.540176 0.470335 +v -0.762087 2.540176 0.317525 +v 0.054508 4.307928 -0.020720 +v -0.812385 2.540176 0.151715 +v -0.829368 2.540176 -0.020720 +v -0.812384 2.540176 -0.193156 +v -0.762086 2.540176 -0.358965 +v -0.680407 2.540176 -0.511776 +v -0.570486 2.540176 -0.645715 +v -0.436546 2.540176 -0.755636 +v -0.283735 2.540176 -0.837315 +v -0.117926 2.540176 -0.887612 +vn 0.0878 0.4455 -0.8910 +vn 0.2599 0.4455 -0.8567 +vn 0.4220 0.4455 -0.7896 +vn 0.5680 0.4455 -0.6921 +vn 0.6921 0.4455 -0.5680 +vn 0.7896 0.4455 -0.4220 +vn 0.8567 0.4455 -0.2599 +vn 0.8910 0.4455 -0.0878 +vn 0.8910 0.4455 0.0878 +vn 0.8567 0.4455 0.2599 +vn 0.7896 0.4455 0.4220 +vn 0.6921 0.4455 0.5680 +vn 0.5680 0.4455 0.6921 +vn 0.4220 0.4455 0.7896 +vn 0.2599 0.4455 0.8567 +vn 0.0878 0.4455 0.8910 +vn -0.0878 0.4455 0.8910 +vn -0.2599 0.4455 0.8567 +vn -0.4220 0.4455 0.7896 +vn -0.5680 0.4455 0.6921 +vn -0.6921 0.4455 0.5680 +vn -0.7896 0.4455 0.4220 +vn -0.8567 0.4455 0.2599 +vn -0.8910 0.4455 0.0878 +vn -0.8910 0.4455 -0.0878 +vn -0.8567 0.4455 -0.2599 +vn -0.7896 0.4455 -0.4220 +vn -0.6921 0.4455 -0.5680 +vn -0.5680 0.4455 -0.6921 +vn -0.4220 0.4455 -0.7896 +vn -0.2599 0.4455 -0.8567 +vn -0.0878 0.4455 -0.8910 +vn 0.0000 -1.0000 -0.0000 +usemtl None +s off +f 65//35 88//35 66//35 +f 66//36 88//36 67//36 +f 67//37 88//37 68//37 +f 68//38 88//38 69//38 +f 69//39 88//39 70//39 +f 70//40 88//40 71//40 +f 71//41 88//41 72//41 +f 72//42 88//42 73//42 +f 73//43 88//43 74//43 +f 74//44 88//44 75//44 +f 75//45 88//45 76//45 +f 76//46 88//46 77//46 +f 77//47 88//47 78//47 +f 78//48 88//48 79//48 +f 79//49 88//49 80//49 +f 80//50 88//50 81//50 +f 81//51 88//51 82//51 +f 82//52 88//52 83//52 +f 83//53 88//53 84//53 +f 84//54 88//54 85//54 +f 85//55 88//55 86//55 +f 86//56 88//56 87//56 +f 87//57 88//57 89//57 +f 89//58 88//58 90//58 +f 90//59 88//59 91//59 +f 91//60 88//60 92//60 +f 92//61 88//61 93//61 +f 93//62 88//62 94//62 +f 94//63 88//63 95//63 +f 95//64 88//64 96//64 +f 96//65 88//65 97//65 +f 97//66 88//66 65//66 +f 80//67 89//67 97//67 +f 97//67 65//67 66//67 +f 66//67 67//67 68//67 +f 68//67 69//67 72//67 +f 69//67 70//67 72//67 +f 70//67 71//67 72//67 +f 72//67 73//67 74//67 +f 74//67 75//67 72//67 +f 75//67 76//67 72//67 +f 76//67 77//67 80//67 +f 77//67 78//67 80//67 +f 78//67 79//67 80//67 +f 80//67 81//67 82//67 +f 82//67 83//67 80//67 +f 83//67 84//67 80//67 +f 84//67 85//67 89//67 +f 85//67 86//67 89//67 +f 86//67 87//67 89//67 +f 89//67 90//67 91//67 +f 91//67 92//67 89//67 +f 92//67 93//67 89//67 +f 93//67 94//67 95//67 +f 95//67 96//67 97//67 +f 97//67 66//67 72//67 +f 66//67 68//67 72//67 +f 93//67 95//67 97//67 +f 72//67 76//67 80//67 +f 80//67 84//67 89//67 +f 89//67 93//67 97//67 +f 97//67 72//67 80//67 +o Cone.001 +v 0.054508 1.691299 -1.020720 +v 0.249599 1.691299 -1.001505 +v 0.437192 1.691299 -0.944599 +v 0.610078 1.691299 -0.852189 +v 0.761615 1.691299 -0.727826 +v 0.885978 1.691299 -0.576290 +v 0.978388 1.691299 -0.403403 +v 1.035293 1.691299 -0.215810 +v 1.054508 1.691299 -0.020720 +v 1.035294 1.691299 0.174371 +v 0.978388 1.691299 0.361964 +v 0.885978 1.691299 0.534851 +v 0.761615 1.691299 0.686387 +v 0.610078 1.691299 0.810750 +v 0.437191 1.691299 0.903160 +v 0.249598 1.691299 0.960066 +v 0.054508 1.691299 0.979280 +v -0.140583 1.691299 0.960066 +v -0.328176 1.691299 0.903160 +v -0.501063 1.691299 0.810750 +v -0.652599 1.691299 0.686387 +v -0.776962 1.691299 0.534850 +v -0.869372 1.691299 0.361963 +v 0.054508 3.691299 -0.020720 +v -0.926277 1.691299 0.174370 +v -0.945492 1.691299 -0.020720 +v -0.926277 1.691299 -0.215811 +v -0.869371 1.691299 -0.403404 +v -0.776961 1.691299 -0.576291 +v -0.652598 1.691299 -0.727827 +v -0.501061 1.691299 -0.852190 +v -0.328174 1.691299 -0.944600 +v -0.140581 1.691299 -1.001505 +vn 0.0878 0.4455 -0.8910 +vn 0.2599 0.4455 -0.8567 +vn 0.4220 0.4455 -0.7896 +vn 0.5680 0.4455 -0.6921 +vn 0.6921 0.4455 -0.5680 +vn 0.7896 0.4455 -0.4220 +vn 0.8567 0.4455 -0.2599 +vn 0.8910 0.4455 -0.0878 +vn 0.8910 0.4455 0.0878 +vn 0.8567 0.4455 0.2599 +vn 0.7896 0.4455 0.4220 +vn 0.6921 0.4455 0.5680 +vn 0.5680 0.4455 0.6921 +vn 0.4220 0.4455 0.7896 +vn 0.2599 0.4455 0.8567 +vn 0.0878 0.4455 0.8910 +vn -0.0878 0.4455 0.8910 +vn -0.2599 0.4455 0.8567 +vn -0.4220 0.4455 0.7896 +vn -0.5680 0.4455 0.6921 +vn -0.6921 0.4455 0.5680 +vn -0.7896 0.4455 0.4220 +vn -0.8567 0.4455 0.2599 +vn -0.8910 0.4455 0.0878 +vn -0.8910 0.4455 -0.0878 +vn -0.8567 0.4455 -0.2599 +vn -0.7896 0.4455 -0.4220 +vn -0.6921 0.4455 -0.5680 +vn -0.5680 0.4455 -0.6921 +vn -0.4220 0.4455 -0.7896 +vn -0.2599 0.4455 -0.8567 +vn -0.0878 0.4455 -0.8910 +vn 0.0000 -1.0000 0.0000 +usemtl None +s off +f 98//68 121//68 99//68 +f 99//69 121//69 100//69 +f 100//70 121//70 101//70 +f 101//71 121//71 102//71 +f 102//72 121//72 103//72 +f 103//73 121//73 104//73 +f 104//74 121//74 105//74 +f 105//75 121//75 106//75 +f 106//76 121//76 107//76 +f 107//77 121//77 108//77 +f 108//78 121//78 109//78 +f 109//79 121//79 110//79 +f 110//80 121//80 111//80 +f 111//81 121//81 112//81 +f 112//82 121//82 113//82 +f 113//83 121//83 114//83 +f 114//84 121//84 115//84 +f 115//85 121//85 116//85 +f 116//86 121//86 117//86 +f 117//87 121//87 118//87 +f 118//88 121//88 119//88 +f 119//89 121//89 120//89 +f 120//90 121//90 122//90 +f 122//91 121//91 123//91 +f 123//92 121//92 124//92 +f 124//93 121//93 125//93 +f 125//94 121//94 126//94 +f 126//95 121//95 127//95 +f 127//96 121//96 128//96 +f 128//97 121//97 129//97 +f 129//98 121//98 130//98 +f 130//99 121//99 98//99 +f 105//100 113//100 122//100 +f 130//100 98//100 99//100 +f 99//100 100//100 101//100 +f 101//100 102//100 103//100 +f 103//100 104//100 101//100 +f 104//100 105//100 101//100 +f 105//100 106//100 107//100 +f 107//100 108//100 105//100 +f 108//100 109//100 105//100 +f 109//100 110//100 113//100 +f 110//100 111//100 113//100 +f 111//100 112//100 113//100 +f 113//100 114//100 115//100 +f 115//100 116//100 117//100 +f 117//100 118//100 119//100 +f 119//100 120//100 122//100 +f 122//100 123//100 124//100 +f 124//100 125//100 126//100 +f 126//100 127//100 130//100 +f 127//100 128//100 130//100 +f 128//100 129//100 130//100 +f 130//100 99//100 101//100 +f 113//100 115//100 122//100 +f 115//100 117//100 122//100 +f 117//100 119//100 122//100 +f 122//100 124//100 130//100 +f 124//100 126//100 130//100 +f 130//100 101//100 105//100 +f 105//100 109//100 113//100 +f 130//100 105//100 122//100 +o Cone.002 +v 0.054508 0.587866 -1.314641 +v 0.306940 0.587866 -1.289779 +v 0.549671 0.587866 -1.216147 +v 0.773372 0.587866 -1.096576 +v 0.969449 0.587866 -0.935660 +v 1.130365 0.587866 -0.739584 +v 1.249936 0.587866 -0.515882 +v 1.323567 0.587866 -0.273151 +v 1.348430 0.587866 -0.020720 +v 1.323567 0.587866 0.231712 +v 1.249936 0.587866 0.474443 +v 1.130365 0.587866 0.698145 +v 0.969449 0.587866 0.894221 +v 0.773372 0.587866 1.055137 +v 0.549670 0.587866 1.174708 +v 0.306939 0.587866 1.248340 +v 0.054508 0.587866 1.273202 +v -0.197924 0.587866 1.248340 +v -0.440655 0.587866 1.174708 +v -0.664357 0.587866 1.055136 +v -0.860433 0.587866 0.894221 +v -1.021349 0.587866 0.698144 +v -1.140920 0.587866 0.474442 +v 0.054508 3.175709 -0.020720 +v -1.214551 0.587866 0.231711 +v -1.239413 0.587866 -0.020721 +v -1.214551 0.587866 -0.273152 +v -1.140919 0.587866 -0.515883 +v -1.021347 0.587866 -0.739585 +v -0.860431 0.587866 -0.935661 +v -0.664355 0.587866 -1.096577 +v -0.440652 0.587866 -1.216148 +v -0.197921 0.587866 -1.289779 +vn 0.0878 0.4455 -0.8910 +vn 0.2599 0.4455 -0.8567 +vn 0.4220 0.4455 -0.7896 +vn 0.5680 0.4455 -0.6921 +vn 0.6921 0.4455 -0.5680 +vn 0.7896 0.4455 -0.4220 +vn 0.8567 0.4455 -0.2599 +vn 0.8910 0.4455 -0.0878 +vn 0.8910 0.4455 0.0878 +vn 0.8567 0.4455 0.2599 +vn 0.7896 0.4455 0.4220 +vn 0.6921 0.4455 0.5680 +vn 0.5680 0.4455 0.6921 +vn 0.4220 0.4455 0.7896 +vn 0.2599 0.4455 0.8567 +vn 0.0878 0.4455 0.8910 +vn -0.0878 0.4455 0.8910 +vn -0.2599 0.4455 0.8567 +vn -0.4220 0.4455 0.7896 +vn -0.5680 0.4455 0.6921 +vn -0.6921 0.4455 0.5680 +vn -0.7896 0.4455 0.4220 +vn -0.8567 0.4455 0.2599 +vn -0.8910 0.4455 0.0878 +vn -0.8910 0.4455 -0.0878 +vn -0.8567 0.4455 -0.2599 +vn -0.7896 0.4455 -0.4220 +vn -0.6921 0.4455 -0.5680 +vn -0.5680 0.4455 -0.6921 +vn -0.4220 0.4455 -0.7896 +vn -0.2599 0.4455 -0.8567 +vn -0.0878 0.4455 -0.8910 +vn 0.0000 -1.0000 0.0000 +usemtl None +s off +f 131//101 154//101 132//101 +f 132//102 154//102 133//102 +f 133//103 154//103 134//103 +f 134//104 154//104 135//104 +f 135//105 154//105 136//105 +f 136//106 154//106 137//106 +f 137//107 154//107 138//107 +f 138//108 154//108 139//108 +f 139//109 154//109 140//109 +f 140//110 154//110 141//110 +f 141//111 154//111 142//111 +f 142//112 154//112 143//112 +f 143//113 154//113 144//113 +f 144//114 154//114 145//114 +f 145//115 154//115 146//115 +f 146//116 154//116 147//116 +f 147//117 154//117 148//117 +f 148//118 154//118 149//118 +f 149//119 154//119 150//119 +f 150//120 154//120 151//120 +f 151//121 154//121 152//121 +f 152//122 154//122 153//122 +f 153//123 154//123 155//123 +f 155//124 154//124 156//124 +f 156//125 154//125 157//125 +f 157//126 154//126 158//126 +f 158//127 154//127 159//127 +f 159//128 154//128 160//128 +f 160//129 154//129 161//129 +f 161//130 154//130 162//130 +f 162//131 154//131 163//131 +f 163//132 154//132 131//132 +f 138//133 146//133 155//133 +f 163//133 131//133 132//133 +f 132//133 133//133 134//133 +f 134//133 135//133 136//133 +f 136//133 137//133 134//133 +f 137//133 138//133 134//133 +f 138//133 139//133 140//133 +f 140//133 141//133 138//133 +f 141//133 142//133 138//133 +f 142//133 143//133 146//133 +f 143//133 144//133 146//133 +f 144//133 145//133 146//133 +f 146//133 147//133 148//133 +f 148//133 149//133 150//133 +f 150//133 151//133 152//133 +f 152//133 153//133 155//133 +f 155//133 156//133 157//133 +f 157//133 158//133 159//133 +f 159//133 160//133 163//133 +f 160//133 161//133 163//133 +f 161//133 162//133 163//133 +f 163//133 132//133 134//133 +f 146//133 148//133 155//133 +f 148//133 150//133 155//133 +f 150//133 152//133 155//133 +f 155//133 157//133 163//133 +f 157//133 159//133 163//133 +f 163//133 134//133 138//133 +f 138//133 142//133 146//133 +f 163//133 138//133 155//133 diff --git a/src/framework.rs b/src/framework.rs index 2914e98..8ec039f 100644 --- a/src/framework.rs +++ b/src/framework.rs @@ -1,36 +1,7 @@ -use futures::task::LocalSpawn; -#[cfg(not(target_arch = "wasm32"))] -use std::time::{Duration, Instant}; -use winit::{ - event::{self, WindowEvent}, - event_loop::{ControlFlow, EventLoop}, -}; -use wgpu_subscriber; - -#[cfg_attr(rustfmt, rustfmt_skip)] -#[allow(unused)] -pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( - 1.0, 0.0, 0.0, 0.0, - 0.0, 1.0, 0.0, 0.0, - 0.0, 0.0, 0.5, 0.0, - 0.0, 0.0, 0.5, 1.0, -); - -#[allow(dead_code)] -pub fn cast_slice(data: &[T]) -> &[u8] { - use std::{mem::size_of, slice::from_raw_parts}; - - unsafe { from_raw_parts(data.as_ptr() as *const u8, data.len() * size_of::()) } -} -#[allow(dead_code)] -pub enum ShaderStage { - Vertex, - Fragment, - Compute, -} -pub trait Example: 'static + Sized { +/* +pub trait Runtime: 'static + Sized { fn optional_features() -> wgpu::Features { wgpu::Features::empty() } @@ -60,253 +31,21 @@ pub trait Example: 'static + Sized { spawner: &impl LocalSpawn, ); } +*/ -struct Setup { - window: winit::window::Window, - event_loop: EventLoop<()>, - instance: wgpu::Instance, - size: winit::dpi::PhysicalSize, - surface: wgpu::Surface, - adapter: wgpu::Adapter, - device: wgpu::Device, - queue: wgpu::Queue, -} - -async fn setup(title: &str) -> Setup { - #[cfg(not(target_arch = "wasm32"))] - { - let chrome_tracing_dir = std::env::var("WGPU_CHROME_TRACE"); - wgpu_subscriber::initialize_default_subscriber( - chrome_tracing_dir.as_ref().map(std::path::Path::new).ok(), - ); - }; - - #[cfg(target_arch = "wasm32")] - console_log::init().expect("could not initialize logger"); - - let event_loop = EventLoop::new(); - let mut builder = winit::window::WindowBuilder::new(); - builder = builder.with_title(title); - #[cfg(windows_OFF)] // TODO - { - use winit::platform::windows::WindowBuilderExtWindows; - builder = builder.with_no_redirection_bitmap(true); - } - let window = builder.build(&event_loop).unwrap(); - - log::info!("Initializing the surface..."); - - let instance = wgpu::Instance::new(wgpu::BackendBit::PRIMARY); - let (size, surface) = unsafe { - let size = window.inner_size(); - let surface = instance.create_surface(&window); - (size, surface) - }; - - let adapter = instance - .request_adapter(&wgpu::RequestAdapterOptions { - power_preference: wgpu::PowerPreference::HighPerformance, - compatible_surface: Some(&surface), - }) - .await - .unwrap(); - - let optional_features = E::optional_features(); - let required_features = E::required_features(); - let adapter_features = adapter.features(); - assert!( - adapter_features.contains(required_features), - "Adapter does not support required features for this example: {:?}", - required_features - adapter_features - ); - - let needed_limits = E::required_limits(); - - let trace_dir = std::env::var("WGPU_TRACE"); - let (device, queue) = adapter - .request_device( - &wgpu::DeviceDescriptor { - features: (optional_features & adapter_features) | required_features, - limits: needed_limits, - shader_validation: true, - }, - trace_dir.ok().as_ref().map(std::path::Path::new), - ) - .await - .unwrap(); - - Setup { - window, - event_loop, - instance, - size, - surface, - adapter, - device, - queue, - } -} - -fn start( - Setup { - window, - event_loop, - instance, - size, - surface, - adapter, - device, - queue, - }: Setup, -) { - #[cfg(not(target_arch = "wasm32"))] - let (mut pool, spawner) = { - let local_pool = futures::executor::LocalPool::new(); - let spawner = local_pool.spawner(); - (local_pool, spawner) - }; - - #[cfg(target_arch = "wasm32")] - let spawner = { - use futures::{future::LocalFutureObj, task::SpawnError}; - use winit::platform::web::WindowExtWebSys; - - struct WebSpawner {} - impl LocalSpawn for WebSpawner { - fn spawn_local_obj( - &self, - future: LocalFutureObj<'static, ()>, - ) -> Result<(), SpawnError> { - Ok(wasm_bindgen_futures::spawn_local(future)) - } - } - - std::panic::set_hook(Box::new(console_error_panic_hook::hook)); - - // On wasm, append the canvas to the document body - web_sys::window() - .and_then(|win| win.document()) - .and_then(|doc| doc.body()) - .and_then(|body| { - body.append_child(&web_sys::Element::from(window.canvas())) - .ok() - }) - .expect("couldn't append canvas to document body"); - - WebSpawner {} - }; - - let mut sc_desc = wgpu::SwapChainDescriptor { - usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT, - // TODO: Allow srgb unconditionally - format: if cfg!(target_arch = "wasm32") { - wgpu::TextureFormat::Bgra8Unorm - } else { - wgpu::TextureFormat::Bgra8UnormSrgb - }, - width: size.width, - height: size.height, - present_mode: wgpu::PresentMode::Mailbox, - }; - let mut swap_chain = device.create_swap_chain(&surface, &sc_desc); - - log::info!("Initializing the example..."); - let mut example = E::init(&sc_desc, &device, &queue); - - #[cfg(not(target_arch = "wasm32"))] - let mut last_update_inst = Instant::now(); - - log::info!("Entering render loop..."); - event_loop.run(move |event, _, control_flow| { - let _ = (&instance, &adapter); // force ownership by the closure - *control_flow = if cfg!(feature = "metal-auto-capture") { - ControlFlow::Exit - } else { - #[cfg(not(target_arch = "wasm32"))] - { - ControlFlow::WaitUntil(Instant::now() + Duration::from_millis(10)) - } - #[cfg(target_arch = "wasm32")] - { - ControlFlow::Poll - } - }; - match event { - event::Event::MainEventsCleared => { - #[cfg(not(target_arch = "wasm32"))] - { - if last_update_inst.elapsed() > Duration::from_millis(20) { - window.request_redraw(); - last_update_inst = Instant::now(); - } - - pool.run_until_stalled(); - } - - #[cfg(target_arch = "wasm32")] - window.request_redraw(); - } - event::Event::WindowEvent { - event: WindowEvent::Resized(size), - .. - } => { - log::info!("Resizing to {:?}", size); - sc_desc.width = size.width; - sc_desc.height = size.height; - example.resize(&sc_desc, &device, &queue); - swap_chain = device.create_swap_chain(&surface, &sc_desc); - } - event::Event::WindowEvent { event, .. } => match event { - WindowEvent::KeyboardInput { - input: - event::KeyboardInput { - virtual_keycode: Some(event::VirtualKeyCode::Escape), - state: event::ElementState::Pressed, - .. - }, - .. - } - | WindowEvent::CloseRequested => { - *control_flow = ControlFlow::Exit; - } - _ => { - example.update(event); - } - }, - event::Event::RedrawRequested(_) => { - let frame = match swap_chain.get_current_frame() { - Ok(frame) => frame, - Err(_) => { - swap_chain = device.create_swap_chain(&surface, &sc_desc); - swap_chain - .get_current_frame() - .expect("Failed to acquire next swap chain texture!") - } - }; - - example.render(&frame.output, &device, &queue, &spawner); - } - _ => {} - } - }); -} - +/* #[cfg(not(target_arch = "wasm32"))] -pub fn run(title: &str) { +pub fn run(title: &str) { let setup = futures::executor::block_on(setup::(title)); start::(setup); } #[cfg(target_arch = "wasm32")] -pub fn run(title: &str) { +pub fn run(title: &str) { let title = title.to_owned(); wasm_bindgen_futures::spawn_local(async move { let setup = setup::(&title).await; start::(setup); }); } - -// This allows treating the framework as a standalone example, -// thus avoiding listing the example names in `Cargo.toml`. -#[allow(dead_code)] -fn main() {} +*/ \ No newline at end of file diff --git a/src/geometry.rs b/src/geometry.rs new file mode 100644 index 0000000..7039c02 --- /dev/null +++ b/src/geometry.rs @@ -0,0 +1,87 @@ +use bytemuck::{Pod, Zeroable}; + +#[repr(C)] +#[derive(Clone, Copy, Debug)] +struct Vertex { + _pos: [f32; 4], + _normal: [f32; 4], +} + +unsafe impl Pod for Vertex {} + +unsafe impl Zeroable for Vertex {} + +fn vertex(pos: [f32; 3], nor: [f32; 3]) -> Vertex { + Vertex { + _pos: [pos[0], pos[1], pos[2], 1.0], + _normal: [nor[0], nor[1], nor[2], 0.0], + } +} + +fn import_mesh(mesh_path: &str) -> (Vec, Vec) { + //let obj_file = "/home/mrh/source/3d-min-viable-eng/resources/Tree_01.obj"; + //let mtl_file = "/home/mrh/source/3d-min-viable-eng/resources/Tree_01.mtl"; + let (models, materials) = tobj::load_obj(mesh_path, false).expect("Failed to load file"); + + //let q = tobj::load_mtl(mtl_file).unwrap(); + + println!("# of models: {}", models.len()); + println!("# of materials: {}", materials.len()); + + //let model = models.get(2).unwrap(); + //let mesh = &model.mesh; + + let mut index_data : Vec = Vec::new(); + let mut vertex_data = Vec::new(); + + for model in models { + let mesh = &model.mesh; + let mut next_face = 0; + for f in 0..mesh.num_face_indices.len() { + let end = next_face + mesh.num_face_indices[f] as usize; + let face_indices: Vec<_> = mesh.indices[next_face..end].iter().collect(); + + for i in face_indices { + index_data.push(*i); + } + + //println!(" face[{}] = {:?}", f, face_indices); + next_face = end; + } + + // Normals and texture coordinates are also loaded, but not printed in this example + //println!("model[{}].vertices: {}", i, mesh.positions.len() / 3); + assert!(mesh.positions.len() % 3 == 0); + + for v in 0..mesh.positions.len() / 3 { + vertex_data.push( + vertex([ + mesh.positions[3 * v], + mesh.positions[3 * v + 1], + mesh.positions[3 * v + 2] + ], + [ + mesh.normals[3 * v], + mesh.normals[3 * v + 1], + mesh.normals[3 * v + 2] + ], + )); + } + } + println!("{:?}\n\n\n\n\n {:?}", vertex_data, index_data); + (vertex_data.to_vec(), index_data.to_vec()) + +} + +fn create_plane(size: f32) -> (Vec, Vec) { + let vertex_data = [ + vertex([size, -size, 0.0], [0.0, 0.0, 1.0]), + vertex([size, size, 0.0], [0.0, 0.0, 1.0]), + vertex([-size, -size, 0.0], [0.0, 0.0, 1.0]), + vertex([-size, size, 0.0], [0.0, 0.0, 1.0]), + ]; + + let index_data: &[u32] = &[0, 1, 2, 2, 1, 3]; + + (vertex_data.to_vec(), index_data.to_vec()) +} \ No newline at end of file diff --git a/src/light.rs b/src/light.rs new file mode 100644 index 0000000..604b69f --- /dev/null +++ b/src/light.rs @@ -0,0 +1,49 @@ +use bytemuck::__core::ops::Range; +use bytemuck::{Zeroable, Pod}; + +struct Light { + pos: cgmath::Point3, + color: wgpu::Color, + fov: f32, + depth: Range, + target_view: wgpu::TextureView, +} + +#[repr(C)] +#[derive(Clone, Copy)] +struct LightRaw { + proj: [[f32; 4]; 4], + pos: [f32; 4], + color: [f32; 4], +} + +unsafe impl Pod for LightRaw {} + +unsafe impl Zeroable for LightRaw {} + +impl Light { + fn to_raw(&self) -> LightRaw { + use cgmath::{Deg, EuclideanSpace, Matrix4, PerspectiveFov, Point3, Vector3}; + + let mx_view = Matrix4::look_at(self.pos, Point3::origin(), Vector3::unit_z()); + let projection = PerspectiveFov { + fovy: Deg(self.fov).into(), + aspect: 1.0, + near: self.depth.start, + far: self.depth.end, + }; + let mx_correction = framework::OPENGL_TO_WGPU_MATRIX; + let mx_view_proj = + mx_correction * cgmath::Matrix4::from(projection.to_perspective()) * mx_view; + LightRaw { + proj: *mx_view_proj.as_ref(), + pos: [self.pos.x, self.pos.y, self.pos.z, 1.0], + color: [ + self.color.r as f32, + self.color.g as f32, + self.color.b as f32, + 1.0, + ], + } + } +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index c74da62..0bdeff6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,854 +1,316 @@ +extern crate tobj; +extern crate winit; + use std::{iter, mem, num::NonZeroU32, ops::Range, rc::Rc}; +#[cfg(not(target_arch = "wasm32"))] +use std::time::{Duration, Instant}; -extern crate winit; +use bytemuck::{Pod, Zeroable}; +use futures::task::LocalSpawn; +use wgpu::util::DeviceExt; +use wgpu_subscriber; +use winit::{ + event::{self, WindowEvent}, + event_loop::{ControlFlow, EventLoop}, +}; -#[path = "framework.rs"] mod framework; +mod geometry; +mod light; +mod render; +mod runtime; +/* +Collision detection +https://crates.io/crates/mgf -use bytemuck::{Pod, Zeroable}; -use wgpu::util::DeviceExt; +Obj file format +http://paulbourke.net/dataformats/obj/ -#[repr(C)] -#[derive(Clone, Copy)] +tobj obj loader +https://docs.rs/tobj/2.0.3/tobj/index.html -struct Vertex { - _pos: [i8; 4], - _normal: [i8; 4], -} +mesh generator lib, might be useful +https://docs.rs/genmesh/0.6.2/genmesh/ -unsafe impl Pod for Vertex {} -unsafe impl Zeroable for Vertex {} +legion ECS +https://github.com/amethyst/legion -fn vertex(pos: [i8; 3], nor: [i8; 3]) -> Vertex { - Vertex { - _pos: [pos[0], pos[1], pos[2], 1], - _normal: [nor[0], nor[1], nor[2], 0], - } -} -fn create_cube() -> (Vec, Vec) { - let vertex_data = [ - // top (0, 0, 1) - vertex([-1, -1, 1], [0, 0, 1]), - vertex([1, -1, 1], [0, 0, 1]), - vertex([1, 1, 1], [0, 0, 1]), - vertex([-1, 1, 1], [0, 0, 1]), - // bottom (0, 0, -1) - vertex([-1, 1, -1], [0, 0, -1]), - vertex([1, 1, -1], [0, 0, -1]), - vertex([1, -1, -1], [0, 0, -1]), - vertex([-1, -1, -1], [0, 0, -1]), - // right (1, 0, 0) - vertex([1, -1, -1], [1, 0, 0]), - vertex([1, 1, -1], [1, 0, 0]), - vertex([1, 1, 1], [1, 0, 0]), - vertex([1, -1, 1], [1, 0, 0]), - // left (-1, 0, 0) - vertex([-1, -1, 1], [-1, 0, 0]), - vertex([-1, 1, 1], [-1, 0, 0]), - vertex([-1, 1, -1], [-1, 0, 0]), - vertex([-1, -1, -1], [-1, 0, 0]), - // front (0, 1, 0) - vertex([1, 1, -1], [0, 1, 0]), - vertex([-1, 1, -1], [0, 1, 0]), - vertex([-1, 1, 1], [0, 1, 0]), - vertex([1, 1, 1], [0, 1, 0]), - // back (0, -1, 0) - vertex([1, -1, 1], [0, -1, 0]), - vertex([-1, -1, 1], [0, -1, 0]), - vertex([-1, -1, -1], [0, -1, 0]), - vertex([1, -1, -1], [0, -1, 0]), - ]; - - let index_data: &[u16] = &[ - 0, 1, 2, 2, 3, 0, // top - 4, 5, 6, 6, 7, 4, // bottom - 8, 9, 10, 10, 11, 8, // right - 12, 13, 14, 14, 15, 12, // left - 16, 17, 18, 18, 19, 16, // front - 20, 21, 22, 22, 23, 20, // back - ]; - - (vertex_data.to_vec(), index_data.to_vec()) -} +mvp: -fn create_plane(size: i8) -> (Vec, Vec) { - let vertex_data = [ - vertex([size, -size, 0], [0, 0, 1]), - vertex([size, size, 0], [0, 0, 1]), - vertex([-size, -size, 0], [0, 0, 1]), - vertex([-size, size, 0], [0, 0, 1]), - ]; +ECS + animation + render 3d + input/io + collision / physics + entities & behaviours - let index_data: &[u16] = &[0, 1, 2, 2, 1, 3]; + */ - (vertex_data.to_vec(), index_data.to_vec()) -} -struct Entity { - mx_world: cgmath::Matrix4, - rotation_speed: f32, - color: wgpu::Color, - vertex_buf: Rc, - index_buf: Rc, - index_count: usize, - bind_group: wgpu::BindGroup, - uniform_buf: wgpu::Buffer, -} -struct Light { - pos: cgmath::Point3, - color: wgpu::Color, - fov: f32, - depth: Range, - target_view: wgpu::TextureView, -} - -#[repr(C)] -#[derive(Clone, Copy)] -struct LightRaw { - proj: [[f32; 4]; 4], - pos: [f32; 4], - color: [f32; 4], -} -unsafe impl Pod for LightRaw {} -unsafe impl Zeroable for LightRaw {} +#[cfg_attr(rustfmt, rustfmt_skip)] +#[allow(unused)] +pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4 = cgmath::Matrix4::new( + 1.0, 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 0.5, 0.0, + 0.0, 0.0, 0.5, 1.0, +); -impl Light { - fn to_raw(&self) -> LightRaw { - use cgmath::{Deg, EuclideanSpace, Matrix4, PerspectiveFov, Point3, Vector3}; +#[allow(dead_code)] +pub fn cast_slice(data: &[T]) -> &[u8] { + use std::{mem::size_of, slice::from_raw_parts}; - let mx_view = Matrix4::look_at(self.pos, Point3::origin(), Vector3::unit_z()); - let projection = PerspectiveFov { - fovy: Deg(self.fov).into(), - aspect: 1.0, - near: self.depth.start, - far: self.depth.end, - }; - let mx_correction = framework::OPENGL_TO_WGPU_MATRIX; - let mx_view_proj = - mx_correction * cgmath::Matrix4::from(projection.to_perspective()) * mx_view; - LightRaw { - proj: *mx_view_proj.as_ref(), - pos: [self.pos.x, self.pos.y, self.pos.z, 1.0], - color: [ - self.color.r as f32, - self.color.g as f32, - self.color.b as f32, - 1.0, - ], - } - } + unsafe { from_raw_parts(data.as_ptr() as *const u8, data.len() * size_of::()) } } -#[repr(C)] -#[derive(Clone, Copy)] -struct ForwardUniforms { - proj: [[f32; 4]; 4], - num_lights: [u32; 4], +#[allow(dead_code)] +pub enum ShaderStage { + Vertex, + Fragment, + Compute, } -unsafe impl Pod for ForwardUniforms {} -unsafe impl Zeroable for ForwardUniforms {} +/* + window: winit::window::Window, + event_loop: EventLoop<()>, + instance: wgpu::Instance, + size: winit::dpi::PhysicalSize, + surface: wgpu::Surface, + adapter: wgpu::Adapter, + device: wgpu::Device, + queue: wgpu::Queue, + */ -#[repr(C)] -#[derive(Clone, Copy)] -struct EntityUniforms { - model: [[f32; 4]; 4], - color: [f32; 4], -} +fn main() { -unsafe impl Pod for EntityUniforms {} -unsafe impl Zeroable for EntityUniforms {} + // #[cfg(not(target_arch = "wasm32"))] + // { + // let chrome_tracing_dir = std::env::var("WGPU_CHROME_TRACE"); + // wgpu_subscriber::initialize_default_subscriber( + // chrome_tracing_dir.as_ref().map(std::path::Path::new).ok(), + // ); + // }; + // #[cfg(target_arch = "wasm32")] + // console_log::init().expect("could not initialize logger"); -#[repr(C)] -struct ShadowUniforms { - proj: [[f32; 4]; 4], -} -struct Pass { - pipeline: wgpu::RenderPipeline, - bind_group: wgpu::BindGroup, - uniform_buf: wgpu::Buffer, -} + let event_loop = EventLoop::new(); + let mut builder = winit::window::WindowBuilder::new(); + builder = builder.with_title(title); -struct Example { - entities: Vec, - lights: Vec, - lights_are_dirty: bool, - shadow_pass: Pass, - forward_pass: Pass, - forward_depth: wgpu::TextureView, - light_uniform_buf: wgpu::Buffer, -} + // I don't know what they are doing here + #[cfg(windows_OFF)] // TODO + { + use winit::platform::windows::WindowBuilderExtWindows; + builder = builder.with_no_redirection_bitmap(true); + } -impl Example { - const MAX_LIGHTS: usize = 10; - const SHADOW_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Depth32Float; - const SHADOW_SIZE: wgpu::Extent3d = wgpu::Extent3d { - width: 512, - height: 512, - depth: Self::MAX_LIGHTS as u32, + let window = builder.build(&event_loop).unwrap(); + + log::info!("Initializing the surface..."); + + // Grab the GPU instance, and query its features + let instance = wgpu::Instance::new(wgpu::BackendBit::PRIMARY); + let (size, surface) = unsafe { + let size = window.inner_size(); + let surface = instance.create_surface(&window); + (size, surface) }; - const DEPTH_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Depth32Float; - - fn generate_matrix(aspect_ratio: f32) -> cgmath::Matrix4 { - let mx_projection = cgmath::perspective(cgmath::Deg(45f32), aspect_ratio, 1.0, 20.0); - let mx_view = cgmath::Matrix4::look_at( - cgmath::Point3::new(3.0f32, -10.0, 6.0), - cgmath::Point3::new(0f32, 0.0, 0.0), - cgmath::Vector3::unit_z(), - ); - let mx_correction = framework::OPENGL_TO_WGPU_MATRIX; - mx_correction * mx_projection * mx_view - } -} -impl framework::Example for Example { - fn optional_features() -> wgpu::Features { - wgpu::Features::DEPTH_CLAMPING - } - - fn init( - sc_desc: &wgpu::SwapChainDescriptor, - device: &wgpu::Device, - _queue: &wgpu::Queue, - ) -> Self { - // Create the vertex and index buffers - let vertex_size = mem::size_of::(); - let (cube_vertex_data, cube_index_data) = create_cube(); - let cube_vertex_buf = Rc::new(device.create_buffer_init( - &wgpu::util::BufferInitDescriptor { - label: Some("Cubes Vertex Buffer"), - contents: bytemuck::cast_slice(&cube_vertex_data), - usage: wgpu::BufferUsage::VERTEX, + let adapter = instance + .request_adapter(&wgpu::RequestAdapterOptions { + power_preference: wgpu::PowerPreference::HighPerformance, + compatible_surface: Some(&surface), + }) + .await + .unwrap(); + + let optional_features = E::optional_features(); + let required_features = E::required_features(); + let adapter_features = adapter.features(); + assert!( + adapter_features.contains(required_features), + "Adapter does not support required features for this example: {:?}", + required_features - adapter_features + ); + + let needed_limits = E::required_limits(); + + // Maybe for debug tracing??? + let trace_dir = std::env::var("WGPU_TRACE"); + + // And then get the device we want + let (device, queue) = adapter + .request_device( + &wgpu::DeviceDescriptor { + features: (optional_features & adapter_features) | required_features, + limits: needed_limits, + shader_validation: true, }, - )); + trace_dir.ok().as_ref().map(std::path::Path::new), + ) + .await + .unwrap(); - let cube_index_buf = Rc::new(device.create_buffer_init( - &wgpu::util::BufferInitDescriptor { - label: Some("Cubes Index Buffer"), - contents: bytemuck::cast_slice(&cube_index_data), - usage: wgpu::BufferUsage::INDEX, - }, - )); - - let (plane_vertex_data, plane_index_data) = create_plane(7); - let plane_vertex_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { - label: Some("Plane Vertex Buffer"), - contents: bytemuck::cast_slice(&plane_vertex_data), - usage: wgpu::BufferUsage::VERTEX, - }); - - let plane_index_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { - label: Some("Plane Index Buffer"), - contents: bytemuck::cast_slice(&plane_index_data), - usage: wgpu::BufferUsage::INDEX, - }); - - let entity_uniform_size = mem::size_of::() as wgpu::BufferAddress; - let plane_uniform_buf = device.create_buffer(&wgpu::BufferDescriptor { - label: None, - size: entity_uniform_size, - usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST, - mapped_at_creation: false, - }); - - let local_bind_group_layout = - device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { - entries: &[wgpu::BindGroupLayoutEntry { - binding: 0, - visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT, - ty: wgpu::BindingType::UniformBuffer { - dynamic: false, - min_binding_size: wgpu::BufferSize::new( - mem::size_of::() as _ - ), - }, - count: None, - }], - label: None, - }); - - let mut entities = vec![{ - use cgmath::SquareMatrix; - - let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { - layout: &local_bind_group_layout, - entries: &[wgpu::BindGroupEntry { - binding: 0, - resource: wgpu::BindingResource::Buffer(plane_uniform_buf.slice(..)), - }], - label: None, - }); - Entity { - mx_world: cgmath::Matrix4::identity(), - rotation_speed: 0.0, - color: wgpu::Color::WHITE, - vertex_buf: Rc::new(plane_vertex_buf), - index_buf: Rc::new(plane_index_buf), - index_count: plane_index_data.len(), - bind_group, - uniform_buf: plane_uniform_buf, - } - }]; - struct CubeDesc { - offset: cgmath::Vector3, - angle: f32, - scale: f32, - rotation: f32, - } - let cube_descs = [ - CubeDesc { - offset: cgmath::vec3(-2.0, -2.0, 2.0), - angle: 10.0, - scale: 0.7, - rotation: 0.1, - }, - CubeDesc { - offset: cgmath::vec3(2.0, -2.0, 2.0), - angle: 50.0, - scale: 1.3, - rotation: 0.2, - }, - CubeDesc { - offset: cgmath::vec3(-2.0, 2.0, 2.0), - angle: 140.0, - scale: 1.1, - rotation: 0.3, - }, - CubeDesc { - offset: cgmath::vec3(2.0, 2.0, 2.0), - angle: 210.0, - scale: 0.9, - rotation: 0.4, - }, - ]; - - for cube in &cube_descs { - use cgmath::{Decomposed, Deg, InnerSpace, Quaternion, Rotation3}; - - let transform = Decomposed { - disp: cube.offset.clone(), - rot: Quaternion::from_axis_angle(cube.offset.normalize(), Deg(cube.angle)), - scale: cube.scale, - }; - let uniform_buf = device.create_buffer(&wgpu::BufferDescriptor { - label: None, - size: entity_uniform_size, - usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST, - mapped_at_creation: false, - }); - entities.push(Entity { - mx_world: cgmath::Matrix4::from(transform), - rotation_speed: cube.rotation, - color: wgpu::Color::GREEN, - vertex_buf: Rc::clone(&cube_vertex_buf), - index_buf: Rc::clone(&cube_index_buf), - index_count: cube_index_data.len(), - bind_group: device.create_bind_group(&wgpu::BindGroupDescriptor { - layout: &local_bind_group_layout, - entries: &[wgpu::BindGroupEntry { - binding: 0, - resource: wgpu::BindingResource::Buffer(uniform_buf.slice(..)), - }], - label: None, - }), - uniform_buf, - }); + #[cfg(not(target_arch = "wasm32"))] + let (mut pool, spawner) = { + let local_pool = futures::executor::LocalPool::new(); + let spawner = local_pool.spawner(); + (local_pool, spawner) + }; + + // This is some gross-ass web shit + /*#[cfg(target_arch = "wasm32")] + let spawner = { + use futures::{future::LocalFutureObj, task::SpawnError}; + use winit::platform::web::WindowExtWebSys; + + struct WebSpawner {} + impl LocalSpawn for WebSpawner { + fn spawn_local_obj( + &self, + future: LocalFutureObj<'static, ()>, + ) -> Result<(), SpawnError> { + Ok(wasm_bindgen_futures::spawn_local(future)) + } } - // Create other resources - let shadow_sampler = device.create_sampler(&wgpu::SamplerDescriptor { - label: Some("shadow"), - address_mode_u: wgpu::AddressMode::ClampToEdge, - address_mode_v: wgpu::AddressMode::ClampToEdge, - address_mode_w: wgpu::AddressMode::ClampToEdge, - mag_filter: wgpu::FilterMode::Linear, - min_filter: wgpu::FilterMode::Linear, - mipmap_filter: wgpu::FilterMode::Nearest, - compare: Some(wgpu::CompareFunction::LessEqual), - ..Default::default() - }); - - let shadow_texture = device.create_texture(&wgpu::TextureDescriptor { - size: Self::SHADOW_SIZE, - mip_level_count: 1, - sample_count: 1, - dimension: wgpu::TextureDimension::D2, - format: Self::SHADOW_FORMAT, - usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT | wgpu::TextureUsage::SAMPLED, - label: None, - }); - let shadow_view = shadow_texture.create_view(&wgpu::TextureViewDescriptor::default()); - - let mut shadow_target_views = (0..2) - .map(|i| { - Some(shadow_texture.create_view(&wgpu::TextureViewDescriptor { - label: Some("shadow"), - format: None, - dimension: Some(wgpu::TextureViewDimension::D2), - aspect: wgpu::TextureAspect::All, - base_mip_level: 0, - level_count: None, - base_array_layer: i as u32, - array_layer_count: NonZeroU32::new(1), - })) + std::panic::set_hook(Box::new(console_error_panic_hook::hook)); + + // On wasm, append the canvas to the document body + web_sys::window() + .and_then(|win| win.document()) + .and_then(|doc| doc.body()) + .and_then(|body| { + body.append_child(&web_sys::Element::from(window.canvas())) + .ok() }) - .collect::>(); - let lights = vec![ - Light { - pos: cgmath::Point3::new(7.0, -5.0, 10.0), - color: wgpu::Color { - r: 0.5, - g: 1.0, - b: 0.5, - a: 1.0, - }, - fov: 60.0, - depth: 1.0..20.0, - target_view: shadow_target_views[0].take().unwrap(), - }, - Light { - pos: cgmath::Point3::new(-5.0, 7.0, 10.0), - color: wgpu::Color { - r: 1.0, - g: 0.5, - b: 0.5, - a: 1.0, - }, - fov: 45.0, - depth: 1.0..20.0, - target_view: shadow_target_views[1].take().unwrap(), - }, - ]; - let light_uniform_size = - (Self::MAX_LIGHTS * mem::size_of::()) as wgpu::BufferAddress; - let light_uniform_buf = device.create_buffer(&wgpu::BufferDescriptor { - label: None, - size: light_uniform_size, - usage: wgpu::BufferUsage::UNIFORM - | wgpu::BufferUsage::COPY_SRC - | wgpu::BufferUsage::COPY_DST, - mapped_at_creation: false, - }); - - let vertex_attr = wgpu::vertex_attr_array![0 => Char4, 1 => Char4]; - let vb_desc = wgpu::VertexBufferDescriptor { - stride: vertex_size as wgpu::BufferAddress, - step_mode: wgpu::InputStepMode::Vertex, - attributes: &vertex_attr, - }; + .expect("couldn't append canvas to document body"); + + WebSpawner {} + };*/ + + // Swapchain has a prototype dealio + let mut sc_desc = wgpu::SwapChainDescriptor { + // Allows a texture to be a output attachment of a renderpass. + usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT, + format: if cfg!(target_arch = "wasm32") { + wgpu::TextureFormat::Bgra8Unorm + } else { + wgpu::TextureFormat::Bgra8UnormSrgb + }, + width: size.width, + height: size.height, + // The presentation engine waits for the next vertical blanking period to update + present_mode: wgpu::PresentMode::Mailbox, + }; - let shadow_pass = { - let uniform_size = mem::size_of::() as wgpu::BufferAddress; - // Create pipeline layout - let bind_group_layout = - device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { - label: None, - entries: &[wgpu::BindGroupLayoutEntry { - binding: 0, // global - visibility: wgpu::ShaderStage::VERTEX, - ty: wgpu::BindingType::UniformBuffer { - dynamic: false, - min_binding_size: wgpu::BufferSize::new(uniform_size), - }, - count: None, - }], - }); - let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { - label: Some("shadow"), - bind_group_layouts: &[&bind_group_layout, &local_bind_group_layout], - push_constant_ranges: &[], - }); - - let uniform_buf = device.create_buffer(&wgpu::BufferDescriptor { - label: None, - size: uniform_size, - usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST, - mapped_at_creation: false, - }); - - // Create bind group - let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { - layout: &bind_group_layout, - entries: &[wgpu::BindGroupEntry { - binding: 0, - resource: wgpu::BindingResource::Buffer(uniform_buf.slice(..)), - }], - label: None, - }); - - // Create the render pipeline - let vs_module = device.create_shader_module(wgpu::include_spirv!("../resources/bake.vert.spv")); - let fs_module = device.create_shader_module(wgpu::include_spirv!("../resources/bake.frag.spv")); - - let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { - label: Some("shadow"), - layout: Some(&pipeline_layout), - vertex_stage: wgpu::ProgrammableStageDescriptor { - module: &vs_module, - entry_point: "main", - }, - fragment_stage: Some(wgpu::ProgrammableStageDescriptor { - module: &fs_module, - entry_point: "main", - }), - rasterization_state: Some(wgpu::RasterizationStateDescriptor { - front_face: wgpu::FrontFace::Ccw, - cull_mode: wgpu::CullMode::Back, - depth_bias: 2, // corresponds to bilinear filtering - depth_bias_slope_scale: 2.0, - depth_bias_clamp: 0.0, - clamp_depth: device.features().contains(wgpu::Features::DEPTH_CLAMPING), - }), - primitive_topology: wgpu::PrimitiveTopology::TriangleList, - color_states: &[], - depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor { - format: Self::SHADOW_FORMAT, - depth_write_enabled: true, - depth_compare: wgpu::CompareFunction::LessEqual, - stencil: wgpu::StencilStateDescriptor::default(), - }), - vertex_state: wgpu::VertexStateDescriptor { - index_format: wgpu::IndexFormat::Uint16, - vertex_buffers: &[vb_desc.clone()], - }, - sample_count: 1, - sample_mask: !0, - alpha_to_coverage_enabled: false, - }); - - Pass { - pipeline, - bind_group, - uniform_buf, - } - }; + let mut swap_chain = device.create_swap_chain(&surface, &sc_desc); + log::info!("Done doing the loading part..."); - let forward_pass = { - // Create pipeline layout - let bind_group_layout = - device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { - entries: &[ - wgpu::BindGroupLayoutEntry { - binding: 0, // global - visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT, - ty: wgpu::BindingType::UniformBuffer { - dynamic: false, - min_binding_size: wgpu::BufferSize::new(mem::size_of::< - ForwardUniforms, - >( - ) - as _), - }, - count: None, - }, - wgpu::BindGroupLayoutEntry { - binding: 1, // lights - visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT, - ty: wgpu::BindingType::UniformBuffer { - dynamic: false, - min_binding_size: wgpu::BufferSize::new(light_uniform_size), - }, - count: None, - }, - wgpu::BindGroupLayoutEntry { - binding: 2, - visibility: wgpu::ShaderStage::FRAGMENT, - ty: wgpu::BindingType::SampledTexture { - multisampled: false, - component_type: wgpu::TextureComponentType::Float, - dimension: wgpu::TextureViewDimension::D2Array, - }, - count: None, - }, - wgpu::BindGroupLayoutEntry { - binding: 3, - visibility: wgpu::ShaderStage::FRAGMENT, - ty: wgpu::BindingType::Sampler { comparison: true }, - count: None, - }, - ], - label: None, - }); - let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { - label: Some("main"), - bind_group_layouts: &[&bind_group_layout, &local_bind_group_layout], - push_constant_ranges: &[], - }); - - let mx_total = Self::generate_matrix(sc_desc.width as f32 / sc_desc.height as f32); - let forward_uniforms = ForwardUniforms { - proj: *mx_total.as_ref(), - num_lights: [lights.len() as u32, 0, 0, 0], - }; - let uniform_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { - label: Some("Uniform Buffer"), - contents: bytemuck::bytes_of(&forward_uniforms), - usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST, - }); - - // Create bind group - let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { - layout: &bind_group_layout, - entries: &[ - wgpu::BindGroupEntry { - binding: 0, - resource: wgpu::BindingResource::Buffer(uniform_buf.slice(..)), - }, - wgpu::BindGroupEntry { - binding: 1, - resource: wgpu::BindingResource::Buffer(light_uniform_buf.slice(..)), - }, - wgpu::BindGroupEntry { - binding: 2, - resource: wgpu::BindingResource::TextureView(&shadow_view), - }, - wgpu::BindGroupEntry { - binding: 3, - resource: wgpu::BindingResource::Sampler(&shadow_sampler), - }, - ], - label: None, - }); - - // Create the render pipeline - let vs_module = device.create_shader_module(wgpu::include_spirv!("../resources/forward.vert.spv")); - let fs_module = device.create_shader_module(wgpu::include_spirv!("../resources/forward.frag.spv")); - - let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { - label: Some("main"), - layout: Some(&pipeline_layout), - vertex_stage: wgpu::ProgrammableStageDescriptor { - module: &vs_module, - entry_point: "main", - }, - fragment_stage: Some(wgpu::ProgrammableStageDescriptor { - module: &fs_module, - entry_point: "main", - }), - rasterization_state: Some(wgpu::RasterizationStateDescriptor { - front_face: wgpu::FrontFace::Ccw, - cull_mode: wgpu::CullMode::Back, - ..Default::default() - }), - primitive_topology: wgpu::PrimitiveTopology::TriangleList, - color_states: &[sc_desc.format.into()], - depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor { - format: Self::DEPTH_FORMAT, - depth_write_enabled: true, - depth_compare: wgpu::CompareFunction::Less, - stencil: wgpu::StencilStateDescriptor::default(), - }), - vertex_state: wgpu::VertexStateDescriptor { - index_format: wgpu::IndexFormat::Uint16, - vertex_buffers: &[vb_desc], - }, - sample_count: 1, - sample_mask: !0, - alpha_to_coverage_enabled: false, - }); - - Pass { - pipeline, - bind_group, - uniform_buf, - } - }; + // Init + let mut runtime = runtime::Runtime::init(&sc_desc, &device, &queue); - let depth_texture = device.create_texture(&wgpu::TextureDescriptor { - size: wgpu::Extent3d { - width: sc_desc.width, - height: sc_desc.height, - depth: 1, - }, - mip_level_count: 1, - sample_count: 1, - dimension: wgpu::TextureDimension::D2, - format: Self::DEPTH_FORMAT, - usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT, - label: None, - }); - - Example { - entities, - lights, - lights_are_dirty: true, - shadow_pass, - forward_pass, - forward_depth: depth_texture.create_view(&wgpu::TextureViewDescriptor::default()), - light_uniform_buf, - } - } - - fn update(&mut self, _event: winit::event::WindowEvent) { - //empty - } - - fn resize( - &mut self, - sc_desc: &wgpu::SwapChainDescriptor, - device: &wgpu::Device, - queue: &wgpu::Queue, - ) { - // update view-projection matrix - let mx_total = Self::generate_matrix(sc_desc.width as f32 / sc_desc.height as f32); - let mx_ref: &[f32; 16] = mx_total.as_ref(); - queue.write_buffer( - &self.forward_pass.uniform_buf, - 0, - bytemuck::cast_slice(mx_ref), - ); - - let depth_texture = device.create_texture(&wgpu::TextureDescriptor { - size: wgpu::Extent3d { - width: sc_desc.width, - height: sc_desc.height, - depth: 1, - }, - mip_level_count: 1, - sample_count: 1, - dimension: wgpu::TextureDimension::D2, - format: Self::DEPTH_FORMAT, - usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT, - label: None, - }); - self.forward_depth = depth_texture.create_view(&wgpu::TextureViewDescriptor::default()); - } - - fn render( - &mut self, - frame: &wgpu::SwapChainTexture, - device: &wgpu::Device, - queue: &wgpu::Queue, - _spawner: &impl futures::task::LocalSpawn, - ) { - // update uniforms - for entity in self.entities.iter_mut() { - if entity.rotation_speed != 0.0 { - let rotation = cgmath::Matrix4::from_angle_x(cgmath::Deg(entity.rotation_speed)); - entity.mx_world = entity.mx_world * rotation; - } - let data = EntityUniforms { - model: entity.mx_world.into(), - color: [ - entity.color.r as f32, - entity.color.g as f32, - entity.color.b as f32, - entity.color.a as f32, - ], - }; - queue.write_buffer(&entity.uniform_buf, 0, bytemuck::bytes_of(&data)); - } + // Not sure why this is guarded, maybe we don't handle the event loop timing? + #[cfg(not(target_arch = "wasm32"))] + let mut last_update_inst = Instant::now(); + + + log::info!("Entering render loop..."); - if self.lights_are_dirty { - self.lights_are_dirty = false; - for (i, light) in self.lights.iter().enumerate() { - queue.write_buffer( - &self.light_uniform_buf, - (i * mem::size_of::()) as wgpu::BufferAddress, - bytemuck::bytes_of(&light.to_raw()), - ); - } - } - let mut encoder = - device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); - - encoder.push_debug_group("shadow passes"); - for (i, light) in self.lights.iter().enumerate() { - encoder.push_debug_group(&format!( - "shadow pass {} (light at position {:?})", - i, light.pos - )); - - // The light uniform buffer already has the projection, - // let's just copy it over to the shadow uniform buffer. - encoder.copy_buffer_to_buffer( - &self.light_uniform_buf, - (i * mem::size_of::()) as wgpu::BufferAddress, - &self.shadow_pass.uniform_buf, - 0, - 64, - ); - - encoder.insert_debug_marker("render entities"); - { - let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { - color_attachments: &[], - depth_stencil_attachment: Some( - wgpu::RenderPassDepthStencilAttachmentDescriptor { - attachment: &light.target_view, - depth_ops: Some(wgpu::Operations { - load: wgpu::LoadOp::Clear(1.0), - store: true, - }), - stencil_ops: None, - }, - ), - }); - pass.set_pipeline(&self.shadow_pass.pipeline); - pass.set_bind_group(0, &self.shadow_pass.bind_group, &[]); - - for entity in &self.entities { - pass.set_bind_group(1, &entity.bind_group, &[]); - pass.set_index_buffer(entity.index_buf.slice(..)); - pass.set_vertex_buffer(0, entity.vertex_buf.slice(..)); - pass.draw_indexed(0..entity.index_count as u32, 0, 0..1); + // This is just an winit event loop + event_loop.run(move |event, _, control_flow| { + let _ = (&instance, &adapter); // force ownership by the closure (wtf??) + + // Override the control flow behaviour based on our system + *control_flow = if cfg!(feature = "metal-auto-capture") { + ControlFlow::Exit + } else { + #[cfg(not(target_arch = "wasm32"))] + { + // Artificially slows the loop rate to 10 millis + // This is called after redraw events cleared + ControlFlow::WaitUntil(Instant::now() + Duration::from_millis(10)) + } + #[cfg(target_arch = "wasm32")] + { + ControlFlow::Poll } + }; + + match event { + event::Event::MainEventsCleared => { + #[cfg(not(target_arch = "wasm32"))] + { + // ask for a redraw every 20 millis + if last_update_inst.elapsed() > Duration::from_millis(20) { + window.request_redraw(); + last_update_inst = Instant::now(); + } + + pool.run_until_stalled(); + } + + #[cfg(target_arch = "wasm32")] + window.request_redraw(); } - encoder.pop_debug_group(); - } - encoder.pop_debug_group(); + // Resizing will queue a request_redraw + event::Event::WindowEvent { + event: WindowEvent::Resized(size), + .. + } => { + log::info!("Resizing to {:?}", size); + sc_desc.width = size.width; + sc_desc.height = size.height; - // forward pass - encoder.push_debug_group("forward rendering pass"); - { - let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { - color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { - attachment: &frame.view, - resolve_target: None, - ops: wgpu::Operations { - load: wgpu::LoadOp::Clear(wgpu::Color { - r: 0.1, - g: 0.2, - b: 0.3, - a: 1.0, - }), - store: true, + example.resize(&sc_desc, &device, &queue); + + swap_chain = device.create_swap_chain(&surface, &sc_desc); + } + event::Event::WindowEvent { event, .. } => match event { + WindowEvent::KeyboardInput { + input: + event::KeyboardInput { + virtual_keycode: Some(event::VirtualKeyCode::Escape), + state: event::ElementState::Pressed, + .. }, - }], - depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { - attachment: &self.forward_depth, - depth_ops: Some(wgpu::Operations { - load: wgpu::LoadOp::Clear(1.0), - store: false, - }), - stencil_ops: None, - }), - }); - pass.set_pipeline(&self.forward_pass.pipeline); - pass.set_bind_group(0, &self.forward_pass.bind_group, &[]); - - for entity in &self.entities { - pass.set_bind_group(1, &entity.bind_group, &[]); - pass.set_index_buffer(entity.index_buf.slice(..)); - pass.set_vertex_buffer(0, entity.vertex_buf.slice(..)); - pass.draw_indexed(0..entity.index_count as u32, 0, 0..1); + .. + } + | WindowEvent::CloseRequested => { + *control_flow = ControlFlow::Exit; + } + _ => { + example.update(event); + } + }, + event::Event::RedrawRequested(_) => { + let frame = match swap_chain.get_current_frame() { + Ok(frame) => frame, + Err(_) => { + swap_chain = device.create_swap_chain(&surface, &sc_desc); + swap_chain + .get_current_frame() + .expect("Failed to acquire next swap chain texture!") + } + }; + + example.render(&frame.output, &device, &queue, &spawner); } + _ => {} } - encoder.pop_debug_group(); + }); - queue.submit(iter::once(encoder.finish())); - } + //framework::run::("shadow"); } -fn main() { - framework::run::("shadow"); -} + + diff --git a/src/render.rs b/src/render.rs new file mode 100644 index 0000000..000e226 --- /dev/null +++ b/src/render.rs @@ -0,0 +1,551 @@ +use crate::{EntityUniforms, Pass}; +use bytemuck::{Pod, Zeroable}; +use bytemuck::__core::mem; +use wgpu::util::DeviceExt; +use std::rc::Rc; + +#[repr(C)] +#[derive(Clone, Copy)] +struct ForwardUniforms { + proj: [[f32; 4]; 4], + num_lights: [u32; 4], +} + +unsafe impl Pod for ForwardUniforms {} + +unsafe impl Zeroable for ForwardUniforms {} + +#[repr(C)] +#[derive(Clone, Copy)] +struct EntityUniforms { + model: [[f32; 4]; 4], + color: [f32; 4], +} + +unsafe impl Pod for EntityUniforms {} + +unsafe impl Zeroable for EntityUniforms {} + +#[repr(C)] +struct ShadowUniforms { + proj: [[f32; 4]; 4], +} + +struct Pass { + pipeline: wgpu::RenderPipeline, + bind_group: wgpu::BindGroup, + uniform_buf: wgpu::Buffer, +} + + +pub struct Renderer { + lights_are_dirty: bool, + shadow_pass: Pass, + forward_pass: Pass, + forward_depth: wgpu::TextureView, + light_uniform_buf: wgpu::Buffer, +} + +impl Renderer { + const MAX_LIGHTS: usize = 10; + const SHADOW_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Depth32Float; + const SHADOW_SIZE: wgpu::Extent3d = wgpu::Extent3d { + width: 512, + height: 512, + depth: Self::MAX_LIGHTS as u32, + }; + const DEPTH_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Depth32Float; + + fn generate_matrix(aspect_ratio: f32) -> cgmath::Matrix4 { + let mx_projection = cgmath::perspective(cgmath::Deg(45f32), aspect_ratio, 1.0, 20.0); + let mx_view = cgmath::Matrix4::look_at( + cgmath::Point3::new(3.0f32, -10.0, 6.0), + cgmath::Point3::new(0f32, 0.0, 0.0), + cgmath::Vector3::unit_z(), + ); + let mx_correction = framework::OPENGL_TO_WGPU_MATRIX; + mx_correction * mx_projection * mx_view + } +} + +impl Renderer { + + pub fn create_buffer(&mut self, device: &wgpu::Device) { + + // Creates the vertex and index buffers for the cube + let vertex_size = mem::size_of::(); + let (cube_vertex_data, cube_index_data) = import_mesh("/home/mrh/source/3d-min-viable-eng/resources/my_tree.obj"); + let cube_vertex_buf = Rc::new(device.create_buffer_init( + &wgpu::util::BufferInitDescriptor { + label: Some("Cubes Vertex Buffer"), + contents: bytemuck::cast_slice(&cube_vertex_data), + usage: wgpu::BufferUsage::VERTEX, + }, + )); + + let cube_index_buf = Rc::new(device.create_buffer_init( + &wgpu::util::BufferInitDescriptor { + label: Some("Cubes Index Buffer"), + contents: bytemuck::cast_slice(&cube_index_data), + usage: wgpu::BufferUsage::INDEX, + }, + )); + + // Creates the vertex and index buffers for the plane + let (plane_vertex_data, plane_index_data) = create_plane(7.0); + let plane_vertex_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { + label: Some("Plane Vertex Buffer"), + contents: bytemuck::cast_slice(&plane_vertex_data), + usage: wgpu::BufferUsage::VERTEX, + }); + + let plane_index_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { + label: Some("Plane Index Buffer"), + contents: bytemuck::cast_slice(&plane_index_data), + usage: wgpu::BufferUsage::INDEX, + }); + + // Creates the uniform for entities, which does the rotation and projection + let entity_uniform_size = mem::size_of::() as wgpu::BufferAddress; + let plane_uniform_buf = device.create_buffer(&wgpu::BufferDescriptor { + label: None, + size: entity_uniform_size, + usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST, + mapped_at_creation: false, + }); + } + + pub fn init(&mut self) -> Renderer { + + // Pre init the light uniform, with slots enough for MAX_LIGHTS + let light_uniform_size = + (Self::MAX_LIGHTS * mem::size_of::()) as wgpu::BufferAddress; + + let light_uniform_buf = device.create_buffer(&wgpu::BufferDescriptor { + label: None, + size: light_uniform_size, + usage: wgpu::BufferUsage::UNIFORM + | wgpu::BufferUsage::COPY_SRC + | wgpu::BufferUsage::COPY_DST, + mapped_at_creation: false, + }); + + // This seems way way way way easier than what I was doing in tracer + // Though the attr thing is still a macro. Which would cause issues if + // I wanted to get tricky with the 0,1 types + let vertex_attr = wgpu::vertex_attr_array![0 => Float4, 1 => Float4]; + let vb_desc = wgpu::VertexBufferDescriptor { + stride: vertex_size as wgpu::BufferAddress, + step_mode: wgpu::InputStepMode::Vertex, + attributes: &vertex_attr, + }; + + /* + There appear to be two passes required for shadows, the shadow pass, and the forward pass + Need to open this up in renderdoc and see what it's actually doing + */ + + let shadow_pass = { + let uniform_size = mem::size_of::() as wgpu::BufferAddress; + // Create pipeline layout + let bind_group_layout = + device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { + label: None, + entries: &[wgpu::BindGroupLayoutEntry { + binding: 0, // global + visibility: wgpu::ShaderStage::VERTEX, + ty: wgpu::BindingType::UniformBuffer { + dynamic: false, + min_binding_size: wgpu::BufferSize::new(uniform_size), + }, + count: None, + }], + }); + let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { + label: Some("shadow"), + bind_group_layouts: &[&bind_group_layout, &local_bind_group_layout], + push_constant_ranges: &[], + }); + + let uniform_buf = device.create_buffer(&wgpu::BufferDescriptor { + label: None, + size: uniform_size, + usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST, + mapped_at_creation: false, + }); + + // Create bind group + let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { + layout: &bind_group_layout, + entries: &[wgpu::BindGroupEntry { + binding: 0, + resource: wgpu::BindingResource::Buffer(uniform_buf.slice(..)), + }], + label: None, + }); + + // Create the render pipeline + let vs_module = device.create_shader_module(wgpu::include_spirv!("../resources/bake.vert.spv")); + let fs_module = device.create_shader_module(wgpu::include_spirv!("../resources/bake.frag.spv")); + + let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { + label: Some("shadow"), + layout: Some(&pipeline_layout), + vertex_stage: wgpu::ProgrammableStageDescriptor { + module: &vs_module, + entry_point: "main", + }, + fragment_stage: Some(wgpu::ProgrammableStageDescriptor { + module: &fs_module, + entry_point: "main", + }), + rasterization_state: Some(wgpu::RasterizationStateDescriptor { + front_face: wgpu::FrontFace::Ccw, + cull_mode: wgpu::CullMode::Back, + depth_bias: 2, // corresponds to bilinear filtering + depth_bias_slope_scale: 2.0, + depth_bias_clamp: 0.0, + clamp_depth: device.features().contains(wgpu::Features::DEPTH_CLAMPING), + }), + primitive_topology: wgpu::PrimitiveTopology::TriangleList, + color_states: &[], + depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor { + format: Self::SHADOW_FORMAT, + depth_write_enabled: true, + depth_compare: wgpu::CompareFunction::LessEqual, + stencil: wgpu::StencilStateDescriptor::default(), + }), + vertex_state: wgpu::VertexStateDescriptor { + index_format: wgpu::IndexFormat::Uint32, + vertex_buffers: &[vb_desc.clone()], + }, + sample_count: 1, + sample_mask: !0, + alpha_to_coverage_enabled: false, + }); + + Pass { + pipeline, + bind_group, + uniform_buf, + } + }; + + let forward_pass = { + // Create pipeline layout + let bind_group_layout = + device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { + entries: &[ + wgpu::BindGroupLayoutEntry { + binding: 0, // global + visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT, + ty: wgpu::BindingType::UniformBuffer { + dynamic: false, + min_binding_size: wgpu::BufferSize::new(mem::size_of::< + ForwardUniforms, + >() + as _), + }, + count: None, + }, + wgpu::BindGroupLayoutEntry { + binding: 1, // lights + visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT, + ty: wgpu::BindingType::UniformBuffer { + dynamic: false, + min_binding_size: wgpu::BufferSize::new(light_uniform_size), + }, + count: None, + }, + wgpu::BindGroupLayoutEntry { + binding: 2, + visibility: wgpu::ShaderStage::FRAGMENT, + ty: wgpu::BindingType::SampledTexture { + multisampled: false, + component_type: wgpu::TextureComponentType::Float, + dimension: wgpu::TextureViewDimension::D2Array, + }, + count: None, + }, + wgpu::BindGroupLayoutEntry { + binding: 3, + visibility: wgpu::ShaderStage::FRAGMENT, + ty: wgpu::BindingType::Sampler { comparison: true }, + count: None, + }, + ], + label: None, + }); + let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { + label: Some("main"), + bind_group_layouts: &[&bind_group_layout, &local_bind_group_layout], + push_constant_ranges: &[], + }); + + let mx_total = Self::generate_matrix(sc_desc.width as f32 / sc_desc.height as f32); + let forward_uniforms = ForwardUniforms { + proj: *mx_total.as_ref(), + num_lights: [lights.len() as u32, 0, 0, 0], + }; + let uniform_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { + label: Some("Uniform Buffer"), + contents: bytemuck::bytes_of(&forward_uniforms), + usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST, + }); + + // Create bind group + let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { + layout: &bind_group_layout, + entries: &[ + wgpu::BindGroupEntry { + binding: 0, + resource: wgpu::BindingResource::Buffer(uniform_buf.slice(..)), + }, + wgpu::BindGroupEntry { + binding: 1, + resource: wgpu::BindingResource::Buffer(light_uniform_buf.slice(..)), + }, + wgpu::BindGroupEntry { + binding: 2, + resource: wgpu::BindingResource::TextureView(&shadow_view), + }, + wgpu::BindGroupEntry { + binding: 3, + resource: wgpu::BindingResource::Sampler(&shadow_sampler), + }, + ], + label: None, + }); + + // Create the render pipeline + let vs_module = device.create_shader_module(wgpu::include_spirv!("../resources/forward.vert.spv")); + let fs_module = device.create_shader_module(wgpu::include_spirv!("../resources/forward.frag.spv")); + + let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { + label: Some("main"), + layout: Some(&pipeline_layout), + vertex_stage: wgpu::ProgrammableStageDescriptor { + module: &vs_module, + entry_point: "main", + }, + fragment_stage: Some(wgpu::ProgrammableStageDescriptor { + module: &fs_module, + entry_point: "main", + }), + rasterization_state: Some(wgpu::RasterizationStateDescriptor { + front_face: wgpu::FrontFace::Ccw, + cull_mode: wgpu::CullMode::Back, + ..Default::default() + }), + primitive_topology: wgpu::PrimitiveTopology::TriangleList, + color_states: &[sc_desc.format.into()], + depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor { + format: Self::DEPTH_FORMAT, + depth_write_enabled: true, + depth_compare: wgpu::CompareFunction::Less, + stencil: wgpu::StencilStateDescriptor::default(), + }), + vertex_state: wgpu::VertexStateDescriptor { + index_format: wgpu::IndexFormat::Uint32, + vertex_buffers: &[vb_desc], + }, + sample_count: 1, + sample_mask: !0, + alpha_to_coverage_enabled: false, + }); + + Pass { + pipeline, + bind_group, + uniform_buf, + } + }; + + let depth_texture = device.create_texture(&wgpu::TextureDescriptor { + size: wgpu::Extent3d { + width: sc_desc.width, + height: sc_desc.height, + depth: 1, + }, + mip_level_count: 1, + sample_count: 1, + dimension: wgpu::TextureDimension::D2, + format: Self::DEPTH_FORMAT, + usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT, + label: None, + }); + + Renderer { + lights_are_dirty: false, + shadow_pass, + forward_pass, + forward_depth: depth_texture.create_view(&wgpu::TextureViewDescriptor::default()), + light_uniform_buf, + } + } + + pub fn render( + &mut self, + frame: &wgpu::SwapChainTexture, + device: &wgpu::Device, + queue: &wgpu::Queue, + _spawner: &impl futures::task::LocalSpawn, + ) + { + // update uniforms + for entity in self.entities.iter_mut() { + if entity.rotation_speed != 0.0 { + let rotation = cgmath::Matrix4::from_angle_x(cgmath::Deg(entity.rotation_speed)); + entity.mx_world = entity.mx_world * rotation; + } + let data = EntityUniforms { + model: entity.mx_world.into(), + color: [ + entity.color.r as f32, + entity.color.g as f32, + entity.color.b as f32, + entity.color.a as f32, + ], + }; + queue.write_buffer(&entity.uniform_buf, 0, bytemuck::bytes_of(&data)); + } + + if self.lights_are_dirty { + self.lights_are_dirty = false; + for (i, light) in self.lights.iter().enumerate() { + queue.write_buffer( + &self.light_uniform_buf, + (i * mem::size_of::()) as wgpu::BufferAddress, + bytemuck::bytes_of(&light.to_raw()), + ); + } + } + + let mut encoder = + device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); + + encoder.push_debug_group("shadow passes"); + for (i, light) in self.lights.iter().enumerate() { + encoder.push_debug_group(&format!( + "shadow pass {} (light at position {:?})", + i, light.pos + )); + + // The light uniform buffer already has the projection, + // let's just copy it over to the shadow uniform buffer. + encoder.copy_buffer_to_buffer( + &self.light_uniform_buf, + (i * mem::size_of::()) as wgpu::BufferAddress, + &self.shadow_pass.uniform_buf, + 0, + 64, + ); + + encoder.insert_debug_marker("render entities"); + { + let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { + color_attachments: &[], + depth_stencil_attachment: Some( + wgpu::RenderPassDepthStencilAttachmentDescriptor { + attachment: &light.target_view, + depth_ops: Some(wgpu::Operations { + load: wgpu::LoadOp::Clear(1.0), + store: true, + }), + stencil_ops: None, + }, + ), + }); + pass.set_pipeline(&self.shadow_pass.pipeline); + pass.set_bind_group(0, &self.shadow_pass.bind_group, &[]); + + for entity in &self.entities { + pass.set_bind_group(1, &entity.bind_group, &[]); + pass.set_index_buffer(entity.index_buf.slice(..)); + pass.set_vertex_buffer(0, entity.vertex_buf.slice(..)); + pass.draw_indexed(0..entity.index_count as u32, 0, 0..1); + } + } + + encoder.pop_debug_group(); + } + encoder.pop_debug_group(); + + // forward pass + encoder.push_debug_group("forward rendering pass"); + { + let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { + color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor { + attachment: &frame.view, + resolve_target: None, + ops: wgpu::Operations { + load: wgpu::LoadOp::Clear(wgpu::Color { + r: 0.1, + g: 0.2, + b: 0.3, + a: 1.0, + }), + store: true, + }, + }], + depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachmentDescriptor { + attachment: &self.forward_depth, + depth_ops: Some(wgpu::Operations { + load: wgpu::LoadOp::Clear(1.0), + store: false, + }), + stencil_ops: None, + }), + }); + pass.set_pipeline(&self.forward_pass.pipeline); + pass.set_bind_group(0, &self.forward_pass.bind_group, &[]); + + for entity in &self.entities { + pass.set_bind_group(1, &entity.bind_group, &[]); + pass.set_index_buffer(entity.index_buf.slice(..)); + pass.set_vertex_buffer(0, entity.vertex_buf.slice(..)); + pass.draw_indexed(0..entity.index_count as u32, 0, 0..1); + } + } + encoder.pop_debug_group(); + + queue.submit(iter::once(encoder.finish())); + } + + pub fn optional_features() -> wgpu::Features { + wgpu::Features::DEPTH_CLAMPING + } + + pub fn resize( + &mut self, + sc_desc: &wgpu::SwapChainDescriptor, + device: &wgpu::Device, + queue: &wgpu::Queue, + ) + { + // update view-projection matrix + let mx_total = Self::generate_matrix(sc_desc.width as f32 / sc_desc.height as f32); + let mx_ref: &[f32; 16] = mx_total.as_ref(); + queue.write_buffer( + &self.forward_pass.uniform_buf, + 0, + bytemuck::cast_slice(mx_ref), + ); + + let depth_texture = device.create_texture(&wgpu::TextureDescriptor { + size: wgpu::Extent3d { + width: sc_desc.width, + height: sc_desc.height, + depth: 1, + }, + mip_level_count: 1, + sample_count: 1, + dimension: wgpu::TextureDimension::D2, + format: Self::DEPTH_FORMAT, + usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT, + label: None, + }); + self.forward_depth = depth_texture.create_view(&wgpu::TextureViewDescriptor::default()); + } +} + diff --git a/src/runtime.rs b/src/runtime.rs new file mode 100644 index 0000000..c1a8826 --- /dev/null +++ b/src/runtime.rs @@ -0,0 +1,202 @@ +use crate::ShadowUniforms; +use bytemuck::__core::mem; +use std::rc::Rc; + + +struct Entity { + mx_world: cgmath::Matrix4, + rotation_speed: f32, + color: wgpu::Color, + vertex_buf: Rc, + index_buf: Rc, + index_count: usize, + bind_group: wgpu::BindGroup, + uniform_buf: wgpu::Buffer, +} + +pub struct Runtime { + entities: Vec, // This is going to be ECS'd + lights: Vec, // ECS +} + +impl Runtime { + pub fn init( + sc_desc: &wgpu::SwapChainDescriptor, + device: &wgpu::Device, + _queue: &wgpu::Queue, ) -> Self + { + + // https://sotrh.github.io/learn-wgpu/beginner/tutorial5-textures/#the-bindgroup + // It appears like bindgroups are + + // Defines the Uniform buffer for the Vertex and Fragment shaders + let local_bind_group_layout = + device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { + entries: &[wgpu::BindGroupLayoutEntry { + binding: 0, + visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT, + ty: wgpu::BindingType::UniformBuffer { + dynamic: false, + min_binding_size: wgpu::BufferSize::new( + mem::size_of::() as _ + ), + }, + count: None, + }], + label: None, + }); + + + let mut entities = vec![{ + use cgmath::SquareMatrix; + + let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor { + layout: &local_bind_group_layout, + entries: &[wgpu::BindGroupEntry { + binding: 0, + resource: wgpu::BindingResource::Buffer(plane_uniform_buf.slice(..)), + }], + label: None, + }); + Entity { + mx_world: cgmath::Matrix4::identity(), + rotation_speed: 0.0, + color: wgpu::Color::WHITE, + vertex_buf: Rc::new(plane_vertex_buf), + index_buf: Rc::new(plane_index_buf), + index_count: plane_index_data.len(), + bind_group, + uniform_buf: plane_uniform_buf, + } + }]; + + struct CubeDesc { + offset: cgmath::Vector3, + angle: f32, + scale: f32, + rotation: f32, + } + + let cube_descs = [ + CubeDesc { + offset: cgmath::vec3(-2.0, -2.0, 2.0), + angle: 10.0, + scale: 0.7, + rotation: 1.5, + }, + ]; + + + for cube in &cube_descs { + use cgmath::{Decomposed, Deg, InnerSpace, Quaternion, Rotation3}; + + let transform = Decomposed { + disp: cube.offset.clone(), + rot: Quaternion::from_axis_angle(cube.offset.normalize(), Deg(cube.angle)), + scale: cube.scale, + }; + let uniform_buf = device.create_buffer(&wgpu::BufferDescriptor { + label: None, + size: entity_uniform_size, + usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::COPY_DST, + mapped_at_creation: false, + }); + entities.push(Entity { + mx_world: cgmath::Matrix4::from(transform), + rotation_speed: cube.rotation, + color: wgpu::Color::GREEN, + vertex_buf: Rc::clone(&cube_vertex_buf), + index_buf: Rc::clone(&cube_index_buf), + index_count: cube_index_data.len(), + bind_group: device.create_bind_group(&wgpu::BindGroupDescriptor { + layout: &local_bind_group_layout, + entries: &[wgpu::BindGroupEntry { + binding: 0, + resource: wgpu::BindingResource::Buffer(uniform_buf.slice(..)), + }], + label: None, + }), + uniform_buf, + }); + } + + // Create other resources + let shadow_sampler = device.create_sampler(&wgpu::SamplerDescriptor { + label: Some("shadow"), + address_mode_u: wgpu::AddressMode::ClampToEdge, + address_mode_v: wgpu::AddressMode::ClampToEdge, + address_mode_w: wgpu::AddressMode::ClampToEdge, + mag_filter: wgpu::FilterMode::Linear, + min_filter: wgpu::FilterMode::Linear, + mipmap_filter: wgpu::FilterMode::Nearest, + compare: Some(wgpu::CompareFunction::LessEqual), + ..Default::default() + }); + + let shadow_texture = device.create_texture(&wgpu::TextureDescriptor { + size: Self::SHADOW_SIZE, + mip_level_count: 1, + sample_count: 1, + dimension: wgpu::TextureDimension::D2, + format: Self::SHADOW_FORMAT, + usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT | wgpu::TextureUsage::SAMPLED, + label: None, + }); + let shadow_view = shadow_texture.create_view(&wgpu::TextureViewDescriptor::default()); + + let mut shadow_target_views = (0..2) + .map(|i| { + Some(shadow_texture.create_view(&wgpu::TextureViewDescriptor { + label: Some("shadow"), + format: None, + dimension: Some(wgpu::TextureViewDimension::D2), + aspect: wgpu::TextureAspect::All, + base_mip_level: 0, + level_count: None, + base_array_layer: i as u32, + array_layer_count: NonZeroU32::new(1), + })) + }) + .collect::>(); + + // This is just metadata we hold for the lights. We can hold onto this + let lights = vec![ + Light { + pos: cgmath::Point3::new(7.0, -5.0, 10.0), + color: wgpu::Color { + r: 0.5, + g: 1.0, + b: 0.5, + a: 1.0, + }, + fov: 60.0, + depth: 1.0..20.0, + target_view: shadow_target_views[0].take().unwrap(), + }, + Light { + pos: cgmath::Point3::new(-5.0, 7.0, 10.0), + color: wgpu::Color { + r: 1.0, + g: 0.5, + b: 0.5, + a: 1.0, + }, + fov: 45.0, + depth: 1.0..20.0, + target_view: shadow_target_views[1].take().unwrap(), + }, + ]; + + Runtime { + entities, + lights, + lights_are_dirty: true, + + light_uniform_buf, + } + } + + pub fn update(&mut self, _event: winit::event::WindowEvent) { + //empty + } +} \ No newline at end of file