parent
7fc761ef9c
commit
77dcf1faf9
@ -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
|
||||
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6f6049ee83f1b2a99865cbd2ad3eef7
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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
|
||||
|
@ -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:
|
@ -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
|
||||
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7674ea23439a8e6d8c5d537866bcd90
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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
|
||||
|
@ -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:
|
Binary file not shown.
Binary file not shown.
@ -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
|
Binary file not shown.
Binary file not shown.
@ -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
|
File diff suppressed because it is too large
Load Diff
@ -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
|
@ -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
|
@ -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<Vertex>, Vec<u32>) {
|
||||
//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<u32> = 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<Vertex>, Vec<u32>) {
|
||||
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())
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
use bytemuck::__core::ops::Range;
|
||||
use bytemuck::{Zeroable, Pod};
|
||||
|
||||
struct Light {
|
||||
pos: cgmath::Point3<f32>,
|
||||
color: wgpu::Color,
|
||||
fov: f32,
|
||||
depth: Range<f32>,
|
||||
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,
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -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<f32> {
|
||||
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::<Vertex>();
|
||||
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::<EntityUniforms>() 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::<LightRaw>()) 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::<ShadowUniforms>() 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::<LightRaw>()) 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::<LightRaw>()) 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());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,202 @@
|
||||
use crate::ShadowUniforms;
|
||||
use bytemuck::__core::mem;
|
||||
use std::rc::Rc;
|
||||
|
||||
|
||||
struct Entity {
|
||||
mx_world: cgmath::Matrix4<f32>,
|
||||
rotation_speed: f32,
|
||||
color: wgpu::Color,
|
||||
vertex_buf: Rc<wgpu::Buffer>,
|
||||
index_buf: Rc<wgpu::Buffer>,
|
||||
index_count: usize,
|
||||
bind_group: wgpu::BindGroup,
|
||||
uniform_buf: wgpu::Buffer,
|
||||
}
|
||||
|
||||
pub struct Runtime {
|
||||
entities: Vec<Entity>, // This is going to be ECS'd
|
||||
lights: Vec<Light>, // 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::<EntityUniforms>() 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<f32>,
|
||||
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::<Vec<_>>();
|
||||
|
||||
// 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
|
||||
}
|
||||
}
|
Loading…
Reference in new issue