forked from ComeformPC/cesiumProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb29d54
commit 80eba82
Showing
28 changed files
with
145 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const {src,dest,series,parallel,watch}=require('gulp'); | ||
const gulpclean=require("gulp-clean"); | ||
const gltfPipeline=require("gltf-pipeline"); | ||
const fsExtra=require('fs-extra'); | ||
const config={ | ||
model:'./public/data/model', | ||
Architecture:'chateau_de_montfa_81_gltf' | ||
} | ||
/** | ||
* 清空dist | ||
*/ | ||
function clean(){ | ||
return src(config.model+"/"+config.Architecture+"/draco",{ | ||
read:false, | ||
allowEmpty:true | ||
}) | ||
.pipe(gulpclean()); | ||
//cb();//异步任务执行完成回调函数,当函数不返回内容时必须使用; | ||
} | ||
/** | ||
* 简化gltf网格 | ||
*/ | ||
function dracoCompress(cb){ | ||
const array=["origin","medium","low"]; | ||
const level=[7,7,7]; | ||
for(let i=0;i<array.length;i++){ | ||
const name=array[i]; | ||
const gltf=fsExtra.readJSONSync(config.model+"/"+config.Architecture+"/"+name+"/scene-"+name+".gltf"); | ||
gltfPipeline.processGltf(gltf,{ | ||
resourceDirectory:config.model+"/"+config.Architecture+"/"+name, | ||
separate:true, | ||
dracoOptions: { | ||
compressionLevel: 7 | ||
} | ||
}).then(function(results){ | ||
fsExtra.writeJSONSync(config.model+"/"+config.Architecture+"/"+name+"/scene-"+name+".gltf",results.gltf); | ||
//save separateResources | ||
const resources=results.separateResources; | ||
for(const resource in resources){ | ||
const buffer=resources[resource]; | ||
fsExtra.writeFileSync(config.model+"/"+config.Architecture+"/"+name+"/"+resource,buffer); | ||
} | ||
}); | ||
} | ||
cb(); | ||
} | ||
exports.draco=dracoCompress; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"asset":{"version":"2.0","generator":"babylon.js glTF exporter for 3dsmax 2018 v20200527.2"},"scene":0,"scenes":[{"nodes":[0]}],"nodes":[{"mesh":0,"rotation":[-0.7235671,0,0,0.690254033],"name":"default25%","translation":[0,0,0],"scale":[1,1,1]}],"meshes":[{"primitives":[{"attributes":{"POSITION":1,"NORMAL":2,"TEXCOORD_0":3},"indices":0,"material":0,"mode":4,"extensions":{"KHR_draco_mesh_compression":{"bufferView":0,"attributes":{"POSITION":0,"NORMAL":1,"TEXCOORD_0":2}}}}],"name":"default25%"}],"accessors":[{"componentType":5125,"count":223242,"type":"SCALAR","name":"accessorIndices"},{"componentType":5126,"count":115201,"max":[25.539179909135317,23.97938663019052,19.030418560664387],"min":[-28.94354390913532,-26.78074990913532,1.18858953086468],"type":"VEC3","name":"accessorPositions"},{"componentType":5126,"count":115201,"type":"VEC3","name":"accessorNormals"},{"componentType":5126,"count":115201,"type":"VEC2","name":"accessorUVs"}],"bufferViews":[{"buffer":0,"byteOffset":0,"byteLength":289308}],"buffers":[{"name":"buffer","byteLength":289308,"uri":"buffer.bin"}],"materials":[{"pbrMetallicRoughness":{"baseColorTexture":{"index":0,"texCoord":0},"metallicFactor":0,"roughnessFactor":0.7022211,"baseColorFactor":[1,1,1,1]},"name":"montfa_2020","emissiveFactor":[0,0,0],"alphaMode":"OPAQUE","doubleSided":false}],"textures":[{"sampler":0,"source":0,"name":"montfa_2020.jpg"}],"images":[{"name":"montfa_2020","uri":"montfa_2020.jpg"}],"samplers":[{"magFilter":9729,"minFilter":9987,"wrapS":10497,"wrapT":10497}],"extensionsRequired":["KHR_draco_mesh_compression"],"extensionsUsed":["KHR_draco_mesh_compression"]} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions
1
public/data/model/chateau_de_montfa_81_gltf/medium/scene-medium.gltf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"asset":{"version":"2.0","generator":"babylon.js glTF exporter for 3dsmax 2018 v20200527.2"},"scene":0,"scenes":[{"nodes":[0]}],"nodes":[{"mesh":0,"rotation":[-0.7235671,0,0,0.690254033],"name":"default50%","translation":[0,0,0],"scale":[1,1,1]}],"meshes":[{"primitives":[{"attributes":{"POSITION":1,"NORMAL":2,"TEXCOORD_0":3},"indices":0,"material":0,"mode":4,"extensions":{"KHR_draco_mesh_compression":{"bufferView":0,"attributes":{"POSITION":0,"NORMAL":1,"TEXCOORD_0":2}}}}],"name":"default50%"}],"accessors":[{"componentType":5125,"count":447318,"type":"SCALAR","name":"accessorIndices"},{"componentType":5126,"count":170013,"max":[25.539179935222275,23.978868104103565,19.041736674147533],"min":[-28.943597335222275,-26.781318235222276,1.1733002047777235],"type":"VEC3","name":"accessorPositions"},{"componentType":5126,"count":170013,"type":"VEC3","name":"accessorNormals"},{"componentType":5126,"count":170013,"type":"VEC2","name":"accessorUVs"}],"bufferViews":[{"buffer":0,"byteOffset":0,"byteLength":464584}],"buffers":[{"name":"buffer","byteLength":464584,"uri":"buffer.bin"}],"materials":[{"pbrMetallicRoughness":{"baseColorTexture":{"index":0,"texCoord":0},"metallicFactor":0,"roughnessFactor":0.7022211,"baseColorFactor":[1,1,1,1]},"name":"montfa_2020","emissiveFactor":[0,0,0],"alphaMode":"OPAQUE","doubleSided":false}],"textures":[{"sampler":0,"source":0,"name":"montfa_2020.jpg"}],"images":[{"name":"montfa_2020","uri":"montfa_2020.jpg"}],"samplers":[{"magFilter":9729,"minFilter":9987,"wrapS":10497,"wrapT":10497}],"extensionsRequired":["KHR_draco_mesh_compression"],"extensionsUsed":["KHR_draco_mesh_compression"]} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
1 change: 1 addition & 0 deletions
1
public/data/model/chateau_de_montfa_81_gltf/origin/scene-origin.gltf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"asset":{"version":"2.0","generator":"babylon.js glTF exporter for 3dsmax 2018 v20200527.2"},"scene":0,"scenes":[{"nodes":[0]}],"nodes":[{"mesh":0,"rotation":[-0.7235671,0,0,0.690254033],"name":"default","translation":[0,0,0],"scale":[1,1,1]}],"meshes":[{"primitives":[{"attributes":{"POSITION":1,"NORMAL":2,"TEXCOORD_0":3},"indices":0,"material":0,"mode":4,"extensions":{"KHR_draco_mesh_compression":{"bufferView":0,"attributes":{"POSITION":0,"NORMAL":1,"TEXCOORD_0":2}}}}],"name":"default"}],"accessors":[{"componentType":5125,"count":885138,"type":"SCALAR","name":"accessorIndices"},{"componentType":5126,"count":178864,"max":[25.5391800433317,23.979024776893006,19.06404447223742],"min":[-28.943818743331704,-26.781367943331706,1.142355266668295],"type":"VEC3","name":"accessorPositions"},{"componentType":5126,"count":178864,"type":"VEC3","name":"accessorNormals"},{"componentType":5126,"count":178864,"type":"VEC2","name":"accessorUVs"}],"bufferViews":[{"buffer":0,"byteOffset":0,"byteLength":542473}],"buffers":[{"name":"buffer","byteLength":542476,"uri":"buffer.bin"}],"materials":[{"pbrMetallicRoughness":{"baseColorTexture":{"index":0,"texCoord":0},"metallicFactor":0,"roughnessFactor":0.7022211,"baseColorFactor":[1,1,1,1]},"name":"montfa_2020","emissiveFactor":[0,0,0],"alphaMode":"OPAQUE","doubleSided":false}],"textures":[{"sampler":0,"source":0,"name":"montfa_2020.jpg"}],"images":[{"name":"montfa_2020","uri":"montfa_2020.jpg"}],"samplers":[{"magFilter":9729,"minFilter":9987,"wrapS":10497,"wrapT":10497}],"extensionsRequired":["KHR_draco_mesh_compression"],"extensionsUsed":["KHR_draco_mesh_compression"]} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters