@zephyr3d/scene 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asset/assetmanager.js +83 -34
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/builtin.js +2 -2
- package/dist/asset/loaders/gltf/gltf_loader.js +105 -59
- package/dist/asset/loaders/gltf/gltf_loader.js.map +1 -1
- package/dist/asset/loaders/hdr/hdr.js +1 -1
- package/dist/blitter/blitter.js +0 -1
- package/dist/blitter/blitter.js.map +1 -1
- package/dist/blitter/depthlimitedgaussion.js +0 -1
- package/dist/blitter/depthlimitedgaussion.js.map +1 -1
- package/dist/blitter/gaussianblur.js +0 -1
- package/dist/blitter/gaussianblur.js.map +1 -1
- package/dist/camera/camera.js +11 -8
- package/dist/camera/camera.js.map +1 -1
- package/dist/camera/orbit.js +24 -7
- package/dist/camera/orbit.js.map +1 -1
- package/dist/index.d.ts +3220 -3680
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/dist/material/blinn.js +47 -57
- package/dist/material/blinn.js.map +1 -1
- package/dist/material/grassmat.js +127 -0
- package/dist/material/grassmat.js.map +1 -0
- package/dist/material/grassmaterial.js +58 -186
- package/dist/material/grassmaterial.js.map +1 -1
- package/dist/material/lambert.js +48 -22
- package/dist/material/lambert.js.map +1 -1
- package/dist/material/lightmodel.js +4 -4
- package/dist/material/material.js +124 -105
- package/dist/material/material.js.map +1 -1
- package/dist/material/meshmaterial.js +321 -145
- package/dist/material/meshmaterial.js.map +1 -1
- package/dist/material/mixins/albedocolor.js +32 -99
- package/dist/material/mixins/albedocolor.js.map +1 -1
- package/dist/material/mixins/foliage.js +47 -0
- package/dist/material/mixins/foliage.js.map +1 -0
- package/dist/material/mixins/ggxlut.js +213 -0
- package/dist/material/mixins/ggxlut.js.map +1 -0
- package/dist/material/mixins/lightmodel/blinnphong.js +89 -0
- package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -0
- package/dist/material/mixins/lightmodel/lambert.js +58 -0
- package/dist/material/mixins/lightmodel/lambert.js.map +1 -0
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +132 -0
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -0
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js +105 -0
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -0
- package/dist/material/mixins/lit.js +464 -0
- package/dist/material/mixins/lit.js.map +1 -0
- package/dist/material/mixins/pbr/common.js +451 -0
- package/dist/material/mixins/pbr/common.js.map +1 -0
- package/dist/material/mixins/pbr/metallicroughness.js +126 -0
- package/dist/material/mixins/pbr/metallicroughness.js.map +1 -0
- package/dist/material/mixins/pbr/specularglossness.js +104 -0
- package/dist/material/mixins/pbr/specularglossness.js.map +1 -0
- package/dist/material/mixins/texture.js +157 -0
- package/dist/material/mixins/texture.js.map +1 -0
- package/dist/material/mixins/vertexcolor.js +16 -11
- package/dist/material/mixins/vertexcolor.js.map +1 -1
- package/dist/material/pbrmr.js +65 -0
- package/dist/material/pbrmr.js.map +1 -0
- package/dist/material/pbrsg.js +64 -0
- package/dist/material/pbrsg.js.map +1 -0
- package/dist/material/shader/helper.js +905 -0
- package/dist/material/shader/helper.js.map +1 -0
- package/dist/material/terrainmat.js +357 -0
- package/dist/material/terrainmat.js.map +1 -0
- package/dist/material/terrainmaterial.js +302 -94
- package/dist/material/terrainmaterial.js.map +1 -1
- package/dist/material/unlit.js +12 -9
- package/dist/material/unlit.js.map +1 -1
- package/dist/posteffect/bloom.js +9 -6
- package/dist/posteffect/bloom.js.map +1 -1
- package/dist/posteffect/compositor.js +15 -6
- package/dist/posteffect/compositor.js.map +1 -1
- package/dist/posteffect/posteffect.js +1 -1
- package/dist/posteffect/sao.js +8 -5
- package/dist/posteffect/sao.js.map +1 -1
- package/dist/posteffect/tonemap.js +2 -2
- package/dist/posteffect/water.js +11 -8
- package/dist/posteffect/water.js.map +1 -1
- package/dist/render/cluster_light.js +6 -5
- package/dist/render/cluster_light.js.map +1 -1
- package/dist/render/cull_visitor.js +24 -3
- package/dist/render/cull_visitor.js.map +1 -1
- package/dist/render/depthpass.js +46 -0
- package/dist/render/depthpass.js.map +1 -0
- package/dist/render/envlight.js +26 -24
- package/dist/render/envlight.js.map +1 -1
- package/dist/render/fullscreenquad.js +38 -0
- package/dist/render/fullscreenquad.js.map +1 -0
- package/dist/render/lightpass.js +98 -0
- package/dist/render/lightpass.js.map +1 -0
- package/dist/render/primitive.js +31 -0
- package/dist/render/primitive.js.map +1 -1
- package/dist/render/render_queue.js +113 -39
- package/dist/render/render_queue.js.map +1 -1
- package/dist/render/renderer.js +200 -0
- package/dist/render/renderer.js.map +1 -0
- package/dist/render/renderpass.js +10 -8
- package/dist/render/renderpass.js.map +1 -1
- package/dist/render/shadowmap_pass.js +3 -4
- package/dist/render/shadowmap_pass.js.map +1 -1
- package/dist/render/sky.js +33 -19
- package/dist/render/sky.js.map +1 -1
- package/dist/scene/batchgroup.js +126 -0
- package/dist/scene/batchgroup.js.map +1 -0
- package/dist/scene/environment.js +9 -6
- package/dist/scene/environment.js.map +1 -1
- package/dist/scene/graph_node.js +11 -0
- package/dist/scene/graph_node.js.map +1 -1
- package/dist/scene/mesh.js +48 -14
- package/dist/scene/mesh.js.map +1 -1
- package/dist/scene/octree.js +37 -72
- package/dist/scene/octree.js.map +1 -1
- package/dist/scene/octree_update_visitor.js +5 -1
- package/dist/scene/octree_update_visitor.js.map +1 -1
- package/dist/scene/scene.js +17 -31
- package/dist/scene/scene.js.map +1 -1
- package/dist/scene/scene_node.js +59 -52
- package/dist/scene/scene_node.js.map +1 -1
- package/dist/scene/terrain/grass.js +4 -14
- package/dist/scene/terrain/grass.js.map +1 -1
- package/dist/scene/terrain/patch.js +3 -3
- package/dist/scene/terrain/terrain.js +4 -9
- package/dist/scene/terrain/terrain.js.map +1 -1
- package/dist/scene/xform.js +61 -36
- package/dist/scene/xform.js.map +1 -1
- package/dist/shaders/framework.js +17 -3
- package/dist/shaders/framework.js.map +1 -1
- package/dist/shaders/misc.js +13 -161
- package/dist/shaders/misc.js.map +1 -1
- package/dist/shaders/noise.js +7 -7
- package/dist/shaders/pbr.js +1 -82
- package/dist/shaders/pbr.js.map +1 -1
- package/dist/shaders/shadow.js +33 -31
- package/dist/shaders/shadow.js.map +1 -1
- package/dist/shaders/water.js +3 -9
- package/dist/shaders/water.js.map +1 -1
- package/dist/shadow/esm.js +12 -9
- package/dist/shadow/esm.js.map +1 -1
- package/dist/shadow/pcf_opt.js +15 -15
- package/dist/shadow/pcf_pd.js +15 -15
- package/dist/shadow/shadowmapper.js +35 -21
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/shadow/ssm.js +21 -55
- package/dist/shadow/ssm.js.map +1 -1
- package/dist/shadow/vsm.js +16 -13
- package/dist/shadow/vsm.js.map +1 -1
- package/dist/shapes/box.js +15 -6
- package/dist/shapes/box.js.map +1 -1
- package/dist/shapes/cylinder.js +1 -4
- package/dist/shapes/cylinder.js.map +1 -1
- package/dist/shapes/shape.js +5 -0
- package/dist/shapes/shape.js.map +1 -1
- package/dist/shapes/sphere.js +3 -0
- package/dist/shapes/sphere.js.map +1 -1
- package/dist/shapes/torus.js +2 -2
- package/dist/utility/bounding_volume.js +27 -27
- package/dist/utility/pmrem.js +4 -4
- package/dist/utility/sheenlut.js +196 -0
- package/dist/utility/sheenlut.js.map +1 -0
- package/dist/utility/shprojection.js +0 -1
- package/dist/utility/shprojection.js.map +1 -1
- package/dist/values.js +11 -8
- package/dist/values.js.map +1 -1
- package/package.json +6 -6
|
@@ -14,11 +14,9 @@ import { ScaleTrack } from '../animation/scaletrack.js';
|
|
|
14
14
|
import { Skeleton } from '../animation/skeleton.js';
|
|
15
15
|
import { BoundingBox } from '../utility/bounding_volume.js';
|
|
16
16
|
import { Application } from '../app.js';
|
|
17
|
-
import '../shaders/framework.js';
|
|
18
17
|
import '@zephyr3d/device';
|
|
19
18
|
import { CopyBlitter } from '../blitter/copy.js';
|
|
20
19
|
import { getSheenLutLoader, getTestCubemapLoader } from './builtin.js';
|
|
21
|
-
import { GraphNode } from '../scene/graph_node.js';
|
|
22
20
|
import { BUILTIN_ASSET_TEXTURE_SHEEN_LUT, BUILTIN_ASSET_TEST_CUBEMAP } from '../values.js';
|
|
23
21
|
import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
24
22
|
|
|
@@ -70,6 +68,17 @@ import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
|
70
68
|
this._textDatas = {};
|
|
71
69
|
}
|
|
72
70
|
/**
|
|
71
|
+
* Remove and dispose all cached assets
|
|
72
|
+
*/ purgeCache() {
|
|
73
|
+
for(const k in this._textures){
|
|
74
|
+
this._textures[k].then((tex)=>tex?.dispose()).catch((err)=>{});
|
|
75
|
+
delete this._textures[k];
|
|
76
|
+
}
|
|
77
|
+
this._models = {};
|
|
78
|
+
this._binaryDatas = {};
|
|
79
|
+
this._textDatas = {};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
73
82
|
* Adds a texture loader to the asset manager
|
|
74
83
|
*
|
|
75
84
|
* @remarks
|
|
@@ -96,11 +105,19 @@ import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
|
96
105
|
/**
|
|
97
106
|
* Fetches a text resource from a given URL
|
|
98
107
|
* @param url - The URL from where to fetch the resource
|
|
108
|
+
* @param postProcess - A function that will be involved when the text data was loaded.
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* If a text data has already been loaded, the function will ignore the
|
|
112
|
+
* postProcess parameter and directly return the text loaded previously.
|
|
113
|
+
* To load the same text with different postProcess parameters,
|
|
114
|
+
* use different AssetManager instances separately.
|
|
115
|
+
*
|
|
99
116
|
* @returns The fetched text
|
|
100
|
-
*/ async fetchTextData(url) {
|
|
117
|
+
*/ async fetchTextData(url, postProcess) {
|
|
101
118
|
let P = this._textDatas[url];
|
|
102
119
|
if (!P) {
|
|
103
|
-
P = this.loadTextData(url);
|
|
120
|
+
P = this.loadTextData(url, postProcess);
|
|
104
121
|
this._textDatas[url] = P;
|
|
105
122
|
}
|
|
106
123
|
return P;
|
|
@@ -108,11 +125,19 @@ import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
|
108
125
|
/**
|
|
109
126
|
* Fetches a binary resource from a given URL
|
|
110
127
|
* @param url - The URL from where to fetch the resource
|
|
111
|
-
* @
|
|
112
|
-
|
|
128
|
+
* @param postProcess - A function that will be involved when the binary data was loaded.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* If a binary data has already been loaded, the function will ignore the
|
|
132
|
+
* postProcess parameter and directly return the data loaded previously.
|
|
133
|
+
* To load the same data with different postProcess parameters,
|
|
134
|
+
* use different AssetManager instances separately.
|
|
135
|
+
*
|
|
136
|
+
* @returns Binary data as ArrayBuffer
|
|
137
|
+
*/ async fetchBinaryData(url, postProcess) {
|
|
113
138
|
let P = this._binaryDatas[url];
|
|
114
139
|
if (!P) {
|
|
115
|
-
P = this.loadBinaryData(url);
|
|
140
|
+
P = this.loadBinaryData(url, postProcess);
|
|
116
141
|
this._binaryDatas[url] = P;
|
|
117
142
|
}
|
|
118
143
|
return P;
|
|
@@ -141,10 +166,10 @@ import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
|
141
166
|
return P;
|
|
142
167
|
}
|
|
143
168
|
}
|
|
144
|
-
/** @internal */ async fetchModelData(scene, url, mimeType) {
|
|
169
|
+
/** @internal */ async fetchModelData(scene, url, mimeType, postProcess) {
|
|
145
170
|
let P = this._models[url];
|
|
146
171
|
if (!P) {
|
|
147
|
-
P = this.loadModel(url, mimeType);
|
|
172
|
+
P = this.loadModel(url, mimeType, postProcess);
|
|
148
173
|
this._models[url] = P;
|
|
149
174
|
}
|
|
150
175
|
return P;
|
|
@@ -153,17 +178,40 @@ import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
|
153
178
|
* Fetches a model resource from a given URL and adds it to a scene
|
|
154
179
|
* @param scene - The scene to which the model node belongs
|
|
155
180
|
* @param url - The URL from where to fetch the resource
|
|
156
|
-
* @param
|
|
181
|
+
* @param options - Options for model fetching
|
|
182
|
+
*
|
|
183
|
+
* @remarks
|
|
184
|
+
* If a model has already been loaded, the function will ignore the
|
|
185
|
+
* postProcess parameter and directly return the model loaded previously.
|
|
186
|
+
* To load the same model with different postProcess parameters,
|
|
187
|
+
* use different AssetManager instances separately.
|
|
188
|
+
*
|
|
157
189
|
* @returns The created model node
|
|
158
|
-
*/ async fetchModel(scene, url,
|
|
159
|
-
const sharedModel = await this.fetchModelData(scene, url, mimeType);
|
|
160
|
-
return this.createSceneNode(scene, sharedModel);
|
|
190
|
+
*/ async fetchModel(scene, url, options) {
|
|
191
|
+
const sharedModel = await this.fetchModelData(scene, url, options?.mimeType, options?.postProcess);
|
|
192
|
+
return this.createSceneNode(scene, sharedModel, !options?.disableInstancing);
|
|
161
193
|
}
|
|
162
|
-
/** @internal */ async loadTextData(url) {
|
|
163
|
-
|
|
194
|
+
/** @internal */ async loadTextData(url, postProcess) {
|
|
195
|
+
let text = await this._httpRequest.requestText(url);
|
|
196
|
+
if (postProcess) {
|
|
197
|
+
try {
|
|
198
|
+
text = postProcess(text);
|
|
199
|
+
} catch (err) {
|
|
200
|
+
throw new Error(`Load text data post process failed: ${err}`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return text;
|
|
164
204
|
}
|
|
165
|
-
/** @internal */ async loadBinaryData(url) {
|
|
166
|
-
|
|
205
|
+
/** @internal */ async loadBinaryData(url, postProcess) {
|
|
206
|
+
let data = await this._httpRequest.requestArrayBuffer(url);
|
|
207
|
+
if (postProcess) {
|
|
208
|
+
try {
|
|
209
|
+
data = postProcess(data);
|
|
210
|
+
} catch (err) {
|
|
211
|
+
throw new Error(`Load binary data post process failed: ${err}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return data;
|
|
167
215
|
}
|
|
168
216
|
/** @internal */ async loadTexture(url, mimeType, srgb, samplerOptions, texture) {
|
|
169
217
|
const data = await this._httpRequest.requestArrayBuffer(url);
|
|
@@ -254,7 +302,7 @@ import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
|
254
302
|
return tex;
|
|
255
303
|
}
|
|
256
304
|
}
|
|
257
|
-
/** @internal */ async loadModel(url, mimeType,
|
|
305
|
+
/** @internal */ async loadModel(url, mimeType, postProcess) {
|
|
258
306
|
const data = await this.httpRequest.requestBlob(url);
|
|
259
307
|
const filename = new URL(url, new URL(location.href).origin).pathname.split('/').filter((val)=>!!val).slice(-1)[0];
|
|
260
308
|
const p = filename ? filename.lastIndexOf('.') : -1;
|
|
@@ -263,11 +311,18 @@ import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
|
263
311
|
if (!loader.supportExtension(ext) && !loader.supportMIMEType(mimeType || data.type)) {
|
|
264
312
|
continue;
|
|
265
313
|
}
|
|
266
|
-
|
|
314
|
+
let model = await loader.load(this, url, mimeType || data.type, data);
|
|
267
315
|
if (!model) {
|
|
268
316
|
throw new Error(`Load asset failed: ${url}`);
|
|
269
317
|
}
|
|
270
|
-
|
|
318
|
+
if (postProcess) {
|
|
319
|
+
try {
|
|
320
|
+
model = postProcess(model);
|
|
321
|
+
} catch (err) {
|
|
322
|
+
throw new Error(`Model loader post process failed: ${err}`);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
model.name = filename;
|
|
271
326
|
return model;
|
|
272
327
|
}
|
|
273
328
|
throw new Error(`Can not find loader for asset ${url}`);
|
|
@@ -296,21 +351,16 @@ import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
|
296
351
|
return tex;
|
|
297
352
|
}
|
|
298
353
|
}
|
|
299
|
-
/** @internal */ createSceneNode(scene, model,
|
|
354
|
+
/** @internal */ createSceneNode(scene, model, instancing) {
|
|
300
355
|
const group = new SceneNode(scene);
|
|
301
356
|
group.name = model.name;
|
|
302
357
|
let animationSet = new AnimationSet(scene);
|
|
303
358
|
for(let i = 0; i < model.scenes.length; i++){
|
|
304
|
-
if (typeof sceneIndex === 'number' && sceneIndex >= 0 && i !== sceneIndex) {
|
|
305
|
-
continue;
|
|
306
|
-
} else if ((sceneIndex === undefined || sceneIndex === null) && model.activeScene >= 0 && i !== model.activeScene) {
|
|
307
|
-
continue;
|
|
308
|
-
}
|
|
309
359
|
const assetScene = model.scenes[i];
|
|
310
360
|
const skeletonMeshMap = new Map();
|
|
311
361
|
const nodeMap = new Map();
|
|
312
362
|
for(let k = 0; k < assetScene.rootNodes.length; k++){
|
|
313
|
-
this.setAssetNodeToSceneNode(scene, group, model, assetScene.rootNodes[k], skeletonMeshMap, nodeMap);
|
|
363
|
+
this.setAssetNodeToSceneNode(scene, group, model, assetScene.rootNodes[k], skeletonMeshMap, nodeMap, instancing);
|
|
314
364
|
}
|
|
315
365
|
for (const animationData of model.animations){
|
|
316
366
|
const animation = new AnimationClip(animationData.name, group);
|
|
@@ -323,7 +373,7 @@ import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
|
323
373
|
} else if (track.type === 'rotation') {
|
|
324
374
|
animation.addTrack(nodeMap.get(track.node), new RotationTrack(track.interpolator));
|
|
325
375
|
} else {
|
|
326
|
-
|
|
376
|
+
console.error(`Invalid animation track type: ${track.type}`);
|
|
327
377
|
}
|
|
328
378
|
}
|
|
329
379
|
for (const sk of animationData.skeletons){
|
|
@@ -425,7 +475,7 @@ import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
|
425
475
|
};
|
|
426
476
|
return info;
|
|
427
477
|
}
|
|
428
|
-
/** @internal */ setAssetNodeToSceneNode(scene, parent, model, assetNode, skeletonMeshMap, nodeMap) {
|
|
478
|
+
/** @internal */ setAssetNodeToSceneNode(scene, parent, model, assetNode, skeletonMeshMap, nodeMap, instancing) {
|
|
429
479
|
const node = new SceneNode(scene);
|
|
430
480
|
nodeMap.set(assetNode, node);
|
|
431
481
|
node.name = `${assetNode.name}`;
|
|
@@ -438,11 +488,10 @@ import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
|
438
488
|
for (const subMesh of meshData.subMeshes){
|
|
439
489
|
const meshNode = new Mesh(scene);
|
|
440
490
|
meshNode.name = subMesh.name;
|
|
441
|
-
meshNode.
|
|
442
|
-
meshNode.showState =
|
|
443
|
-
meshNode.pickMode = GraphNode.PICK_INHERITED;
|
|
491
|
+
meshNode.clipTestEnabled = true;
|
|
492
|
+
meshNode.showState = 'inherit';
|
|
444
493
|
meshNode.primitive = subMesh.primitive;
|
|
445
|
-
meshNode.material = subMesh.material;
|
|
494
|
+
meshNode.material = instancing ? subMesh.material.createInstance() : subMesh.material;
|
|
446
495
|
// meshNode.drawBoundingBox = true;
|
|
447
496
|
meshNode.reparent(node);
|
|
448
497
|
if (skeleton) {
|
|
@@ -464,7 +513,7 @@ import { TGALoader } from './loaders/image/tga_Loader.js';
|
|
|
464
513
|
}
|
|
465
514
|
node.reparent(parent);
|
|
466
515
|
for (const child of assetNode.children){
|
|
467
|
-
this.setAssetNodeToSceneNode(scene, node, model, child, skeletonMeshMap, nodeMap);
|
|
516
|
+
this.setAssetNodeToSceneNode(scene, node, model, child, skeletonMeshMap, nodeMap, instancing);
|
|
468
517
|
}
|
|
469
518
|
}
|
|
470
519
|
getHash(type, url, options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assetmanager.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assetmanager.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/asset/builtin.js
CHANGED
|
@@ -349,12 +349,12 @@ interface MicrofacetDistributionSample {
|
|
|
349
349
|
const image = new Uint16Array(textureSize * textureSize * 4);
|
|
350
350
|
let p = 0;
|
|
351
351
|
const one = encodeF16(1);
|
|
352
|
-
for(let y =
|
|
352
|
+
for(let y = textureSize - 1; y >= 0; y--){
|
|
353
353
|
const coord = Math.min(Math.max((y + 0.5) / textureSize, 0), 1);
|
|
354
354
|
const roughness = coord * coord;
|
|
355
355
|
for(let x = 0; x < textureSize; x++){
|
|
356
356
|
const NdotV = Math.min(Math.max((x + 0.5) / textureSize, 0), 1);
|
|
357
|
-
const c = dfvCharlieUniform(NdotV, roughness,
|
|
357
|
+
const c = dfvCharlieUniform(NdotV, roughness, 512);
|
|
358
358
|
const f16 = encodeF16(c);
|
|
359
359
|
image[p++] = 0;
|
|
360
360
|
image[p++] = 0;
|
|
@@ -2,16 +2,17 @@ import { Matrix4x4, Vector3, Quaternion, Interpolator, Vector4 } from '@zephyr3d
|
|
|
2
2
|
import { AssetScene, AssetSkeleton, SharedModel } from '../../model.js';
|
|
3
3
|
import { BoundingBox } from '../../../utility/bounding_volume.js';
|
|
4
4
|
import { Primitive } from '../../../render/primitive.js';
|
|
5
|
-
import '../../../material/
|
|
6
|
-
import '@zephyr3d/device';
|
|
7
|
-
import '../../../shaders/framework.js';
|
|
8
|
-
import { Application } from '../../../app.js';
|
|
9
|
-
import '../../../render/scatteringlut.js';
|
|
5
|
+
import '../../../material/shader/helper.js';
|
|
10
6
|
import '../../../material/lambert.js';
|
|
11
7
|
import '../../../material/blinn.js';
|
|
12
8
|
import { UnlitMaterial } from '../../../material/unlit.js';
|
|
13
|
-
import
|
|
14
|
-
import '../../../material/
|
|
9
|
+
import '../../../material/material.js';
|
|
10
|
+
import '../../../material/meshmaterial.js';
|
|
11
|
+
import '../../../material/grassmaterial.js';
|
|
12
|
+
import '../../../material/terrainmaterial.js';
|
|
13
|
+
import { PBRMetallicRoughnessMaterial } from '../../../material/pbrmr.js';
|
|
14
|
+
import { PBRSpecularGlossinessMaterial } from '../../../material/pbrsg.js';
|
|
15
|
+
import { Application } from '../../../app.js';
|
|
15
16
|
import { GLTFAccessor, ComponentType } from './helpers.js';
|
|
16
17
|
import { AbstractModelLoader } from '../loader.js';
|
|
17
18
|
|
|
@@ -379,13 +380,13 @@ import { AbstractModelLoader } from '../loader.js';
|
|
|
379
380
|
async _createMaterial(assetManager, assetMaterial) {
|
|
380
381
|
if (assetMaterial.type === 'unlit') {
|
|
381
382
|
const unlitAssetMaterial = assetMaterial;
|
|
382
|
-
const unlitMaterial = new UnlitMaterial; //new NewLambertMaterial();// new TestLitMaterial();// new UnlitMaterial();
|
|
383
|
+
const unlitMaterial = new UnlitMaterial(); //new NewLambertMaterial();// new TestLitMaterial();// new UnlitMaterial();
|
|
383
384
|
unlitMaterial.albedoColor = unlitAssetMaterial.diffuse ?? Vector4.one();
|
|
384
385
|
if (unlitAssetMaterial.diffuseMap) {
|
|
385
386
|
unlitMaterial.albedoTexture = unlitAssetMaterial.diffuseMap.texture;
|
|
386
387
|
unlitMaterial.albedoTextureSampler = unlitAssetMaterial.diffuseMap.sampler;
|
|
387
388
|
unlitMaterial.albedoTexCoordIndex = unlitAssetMaterial.diffuseMap.texCoord;
|
|
388
|
-
unlitMaterial.
|
|
389
|
+
unlitMaterial.albedoTexCoordMatrix = unlitAssetMaterial.diffuseMap.transform;
|
|
389
390
|
}
|
|
390
391
|
unlitMaterial.vertexColor = unlitAssetMaterial.common.vertexColor;
|
|
391
392
|
if (assetMaterial.common.alphaMode === 'blend') {
|
|
@@ -401,33 +402,48 @@ import { AbstractModelLoader } from '../loader.js';
|
|
|
401
402
|
} else if (assetMaterial.type === 'pbrSpecularGlossiness') {
|
|
402
403
|
const assetPBRMaterial = assetMaterial;
|
|
403
404
|
const pbrMaterial = new PBRSpecularGlossinessMaterial();
|
|
404
|
-
pbrMaterial.
|
|
405
|
-
pbrMaterial.
|
|
406
|
-
pbrMaterial.
|
|
407
|
-
pbrMaterial.
|
|
405
|
+
pbrMaterial.ior = assetPBRMaterial.ior;
|
|
406
|
+
pbrMaterial.albedoColor = assetPBRMaterial.diffuse;
|
|
407
|
+
pbrMaterial.specularFactor = new Vector4(assetPBRMaterial.specular.x, assetPBRMaterial.specular.y, assetPBRMaterial.specular.z, 1);
|
|
408
|
+
pbrMaterial.glossinessFactor = assetPBRMaterial.glossness;
|
|
408
409
|
if (assetPBRMaterial.diffuseMap) {
|
|
409
|
-
pbrMaterial.
|
|
410
|
+
pbrMaterial.albedoTexture = assetPBRMaterial.diffuseMap.texture;
|
|
411
|
+
pbrMaterial.albedoTextureSampler = assetPBRMaterial.diffuseMap.sampler;
|
|
412
|
+
pbrMaterial.albedoTexCoordIndex = assetPBRMaterial.diffuseMap.texCoord;
|
|
413
|
+
pbrMaterial.albedoTexCoordMatrix = assetPBRMaterial.diffuseMap.transform;
|
|
410
414
|
}
|
|
411
415
|
if (assetPBRMaterial.common.normalMap) {
|
|
412
|
-
pbrMaterial.
|
|
416
|
+
pbrMaterial.normalTexture = assetPBRMaterial.common.normalMap.texture;
|
|
417
|
+
pbrMaterial.normalTextureSampler = assetPBRMaterial.common.normalMap.sampler;
|
|
418
|
+
pbrMaterial.normalTexCoordIndex = assetPBRMaterial.common.normalMap.texCoord;
|
|
419
|
+
pbrMaterial.normalTexCoordMatrix = assetPBRMaterial.common.normalMap.transform;
|
|
413
420
|
}
|
|
414
|
-
pbrMaterial.
|
|
421
|
+
pbrMaterial.normalScale = assetPBRMaterial.common.bumpScale;
|
|
415
422
|
if (assetPBRMaterial.common.emissiveMap) {
|
|
416
|
-
pbrMaterial.
|
|
423
|
+
pbrMaterial.emissiveTexture = assetPBRMaterial.common.emissiveMap.texture;
|
|
424
|
+
pbrMaterial.emissiveTextureSampler = assetPBRMaterial.common.emissiveMap.sampler;
|
|
425
|
+
pbrMaterial.emissiveTexCoordIndex = assetPBRMaterial.common.emissiveMap.texCoord;
|
|
426
|
+
pbrMaterial.emissiveTexCoordMatrix = assetPBRMaterial.common.emissiveMap.transform;
|
|
417
427
|
}
|
|
418
|
-
pbrMaterial.
|
|
419
|
-
pbrMaterial.
|
|
428
|
+
pbrMaterial.emissiveColor = assetPBRMaterial.common.emissiveColor;
|
|
429
|
+
pbrMaterial.emissiveStrength = assetPBRMaterial.common.emissiveStrength;
|
|
420
430
|
if (assetPBRMaterial.common.occlusionMap) {
|
|
421
|
-
pbrMaterial.
|
|
431
|
+
pbrMaterial.occlusionTexture = assetPBRMaterial.common.occlusionMap.texture;
|
|
432
|
+
pbrMaterial.occlusionTextureSampler = assetPBRMaterial.common.occlusionMap.sampler;
|
|
433
|
+
pbrMaterial.occlusionTexCoordIndex = assetPBRMaterial.common.occlusionMap.texCoord;
|
|
434
|
+
pbrMaterial.occlusionTexCoordMatrix = assetPBRMaterial.common.occlusionMap.transform;
|
|
422
435
|
}
|
|
423
|
-
pbrMaterial.
|
|
436
|
+
pbrMaterial.occlusionStrength = assetPBRMaterial.common.occlusionStrength;
|
|
424
437
|
if (assetPBRMaterial.specularGlossnessMap) {
|
|
425
|
-
pbrMaterial.
|
|
438
|
+
pbrMaterial.specularTexture = assetPBRMaterial.specularGlossnessMap.texture;
|
|
439
|
+
pbrMaterial.specularTextureSampler = assetPBRMaterial.specularGlossnessMap.sampler;
|
|
440
|
+
pbrMaterial.specularTexCoordIndex = assetPBRMaterial.specularGlossnessMap.texCoord;
|
|
441
|
+
pbrMaterial.specularTexCoordMatrix = assetPBRMaterial.specularGlossnessMap.transform;
|
|
426
442
|
}
|
|
427
443
|
pbrMaterial.vertexTangent = assetPBRMaterial.common.useTangent;
|
|
428
444
|
pbrMaterial.vertexColor = assetPBRMaterial.common.vertexColor;
|
|
429
445
|
if (assetPBRMaterial.common.alphaMode === 'blend') {
|
|
430
|
-
pbrMaterial.
|
|
446
|
+
pbrMaterial.blendMode = 'blend';
|
|
431
447
|
} else if (assetPBRMaterial.common.alphaMode === 'mask') {
|
|
432
448
|
pbrMaterial.alphaCutoff = assetPBRMaterial.common.alphaCutoff;
|
|
433
449
|
}
|
|
@@ -440,73 +456,103 @@ import { AbstractModelLoader } from '../loader.js';
|
|
|
440
456
|
} else if (assetMaterial.type === 'pbrMetallicRoughness') {
|
|
441
457
|
const assetPBRMaterial = assetMaterial;
|
|
442
458
|
const pbrMaterial = new PBRMetallicRoughnessMaterial();
|
|
443
|
-
pbrMaterial.
|
|
444
|
-
pbrMaterial.
|
|
445
|
-
pbrMaterial.
|
|
446
|
-
pbrMaterial.
|
|
459
|
+
pbrMaterial.ior = assetPBRMaterial.ior;
|
|
460
|
+
pbrMaterial.albedoColor = assetPBRMaterial.diffuse;
|
|
461
|
+
pbrMaterial.metallic = assetPBRMaterial.metallic;
|
|
462
|
+
pbrMaterial.roughness = assetPBRMaterial.roughness;
|
|
447
463
|
if (assetPBRMaterial.diffuseMap) {
|
|
448
|
-
pbrMaterial.
|
|
464
|
+
pbrMaterial.albedoTexture = assetPBRMaterial.diffuseMap.texture;
|
|
465
|
+
pbrMaterial.albedoTextureSampler = assetPBRMaterial.diffuseMap.sampler;
|
|
466
|
+
pbrMaterial.albedoTexCoordIndex = assetPBRMaterial.diffuseMap.texCoord;
|
|
467
|
+
pbrMaterial.albedoTexCoordMatrix = assetPBRMaterial.diffuseMap.transform;
|
|
449
468
|
}
|
|
450
469
|
if (assetPBRMaterial.common.normalMap) {
|
|
451
|
-
pbrMaterial.
|
|
470
|
+
pbrMaterial.normalTexture = assetPBRMaterial.common.normalMap.texture;
|
|
471
|
+
pbrMaterial.normalTextureSampler = assetPBRMaterial.common.normalMap.sampler;
|
|
472
|
+
pbrMaterial.normalTexCoordIndex = assetPBRMaterial.common.normalMap.texCoord;
|
|
473
|
+
pbrMaterial.normalTexCoordMatrix = assetPBRMaterial.common.normalMap.transform;
|
|
452
474
|
}
|
|
453
|
-
pbrMaterial.
|
|
475
|
+
pbrMaterial.normalScale = assetPBRMaterial.common.bumpScale;
|
|
454
476
|
if (assetPBRMaterial.common.emissiveMap) {
|
|
455
|
-
pbrMaterial.
|
|
477
|
+
pbrMaterial.emissiveTexture = assetPBRMaterial.common.emissiveMap.texture;
|
|
478
|
+
pbrMaterial.emissiveTextureSampler = assetPBRMaterial.common.emissiveMap.sampler;
|
|
479
|
+
pbrMaterial.emissiveTexCoordIndex = assetPBRMaterial.common.emissiveMap.texCoord;
|
|
480
|
+
pbrMaterial.emissiveTexCoordMatrix = assetPBRMaterial.common.emissiveMap.transform;
|
|
456
481
|
}
|
|
457
|
-
pbrMaterial.
|
|
458
|
-
pbrMaterial.
|
|
482
|
+
pbrMaterial.emissiveColor = assetPBRMaterial.common.emissiveColor;
|
|
483
|
+
pbrMaterial.emissiveStrength = assetPBRMaterial.common.emissiveStrength;
|
|
459
484
|
if (assetPBRMaterial.common.occlusionMap) {
|
|
460
|
-
pbrMaterial.
|
|
485
|
+
pbrMaterial.occlusionTexture = assetPBRMaterial.common.occlusionMap.texture;
|
|
486
|
+
pbrMaterial.occlusionTextureSampler = assetPBRMaterial.common.occlusionMap.sampler;
|
|
487
|
+
pbrMaterial.occlusionTexCoordIndex = assetPBRMaterial.common.occlusionMap.texCoord;
|
|
488
|
+
pbrMaterial.occlusionTexCoordMatrix = assetPBRMaterial.common.occlusionMap.transform;
|
|
489
|
+
pbrMaterial.occlusionStrength = assetPBRMaterial.common.occlusionStrength;
|
|
461
490
|
}
|
|
462
|
-
pbrMaterial.lightModel.occlusionStrength = assetPBRMaterial.common.occlusionStrength;
|
|
463
491
|
if (assetPBRMaterial.metallicMap) {
|
|
464
|
-
pbrMaterial.
|
|
492
|
+
pbrMaterial.metallicRoughnessTexture = assetPBRMaterial.metallicMap.texture;
|
|
493
|
+
pbrMaterial.metallicRoughnessTextureSampler = assetPBRMaterial.metallicMap.sampler;
|
|
494
|
+
pbrMaterial.metallicRoughnessTexCoordIndex = assetPBRMaterial.metallicMap.texCoord;
|
|
495
|
+
pbrMaterial.metallicRoughnessTexCoordMatrix = assetPBRMaterial.metallicMap.transform;
|
|
465
496
|
}
|
|
466
|
-
pbrMaterial.
|
|
467
|
-
pbrMaterial.lightModel.roughnessIndex = assetPBRMaterial.roughnessIndex;
|
|
468
|
-
pbrMaterial.lightModel.specularFactor = assetPBRMaterial.specularFactor;
|
|
497
|
+
pbrMaterial.specularFactor = assetPBRMaterial.specularFactor;
|
|
469
498
|
if (assetPBRMaterial.specularMap) {
|
|
470
|
-
pbrMaterial.
|
|
499
|
+
pbrMaterial.specularTexture = assetPBRMaterial.specularMap.texture;
|
|
500
|
+
pbrMaterial.specularTextureSampler = assetPBRMaterial.specularMap.sampler;
|
|
501
|
+
pbrMaterial.specularTexCoordIndex = assetPBRMaterial.specularMap.texCoord;
|
|
502
|
+
pbrMaterial.specularTexCoordMatrix = assetPBRMaterial.specularMap.transform;
|
|
471
503
|
}
|
|
472
504
|
if (assetPBRMaterial.specularColorMap) {
|
|
473
|
-
pbrMaterial.
|
|
505
|
+
pbrMaterial.specularColorTexture = assetPBRMaterial.specularColorMap.texture;
|
|
506
|
+
pbrMaterial.specularColorTextureSampler = assetPBRMaterial.specularColorMap.sampler;
|
|
507
|
+
pbrMaterial.specularColorTexCoordIndex = assetPBRMaterial.specularColorMap.texCoord;
|
|
508
|
+
pbrMaterial.specularColorTexCoordMatrix = assetPBRMaterial.specularColorMap.transform;
|
|
474
509
|
}
|
|
475
510
|
if (assetPBRMaterial.sheen) {
|
|
476
511
|
const sheen = assetPBRMaterial.sheen;
|
|
477
|
-
pbrMaterial.
|
|
478
|
-
pbrMaterial.
|
|
479
|
-
pbrMaterial.
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
pbrMaterial.lightModel.setSheenColorMap(sheen.sheenColorMap.texture, sheen.sheenColorMap.sampler, sheen.sheenColorMap.texCoord, sheen.sheenColorMap.transform);
|
|
512
|
+
pbrMaterial.sheen = true;
|
|
513
|
+
pbrMaterial.sheenColorFactor = sheen.sheenColorFactor;
|
|
514
|
+
pbrMaterial.sheenRoughnessFactor = sheen.sheenRoughnessFactor;
|
|
515
|
+
if (sheen.sheenColorMap) {
|
|
516
|
+
pbrMaterial.sheenColorTexture = sheen.sheenColorMap.texture;
|
|
517
|
+
pbrMaterial.sheenColorTextureSampler = sheen.sheenColorMap.sampler;
|
|
518
|
+
pbrMaterial.sheenColorTexCoordIndex = sheen.sheenColorMap.texCoord;
|
|
519
|
+
pbrMaterial.sheenColorTexCoordMatrix = sheen.sheenColorMap.transform;
|
|
486
520
|
}
|
|
487
521
|
if (sheen.sheenRoughnessMap) {
|
|
488
|
-
pbrMaterial.
|
|
522
|
+
pbrMaterial.sheenRoughnessTexture = sheen.sheenRoughnessMap.texture;
|
|
523
|
+
pbrMaterial.sheenRoughnessTextureSampler = sheen.sheenRoughnessMap.sampler;
|
|
524
|
+
pbrMaterial.sheenRoughnessTexCoordIndex = sheen.sheenRoughnessMap.texCoord;
|
|
525
|
+
pbrMaterial.sheenRoughnessTexCoordMatrix = sheen.sheenRoughnessMap.transform;
|
|
489
526
|
}
|
|
490
527
|
}
|
|
491
528
|
if (assetPBRMaterial.clearcoat) {
|
|
492
529
|
const cc = assetPBRMaterial.clearcoat;
|
|
493
|
-
pbrMaterial.
|
|
494
|
-
pbrMaterial.
|
|
495
|
-
pbrMaterial.
|
|
530
|
+
pbrMaterial.clearcoat = true;
|
|
531
|
+
pbrMaterial.clearcoatIntensity = cc.clearCoatFactor;
|
|
532
|
+
pbrMaterial.clearcoatRoughnessFactor = cc.clearCoatRoughnessFactor;
|
|
496
533
|
if (cc.clearCoatIntensityMap) {
|
|
497
|
-
pbrMaterial.
|
|
534
|
+
pbrMaterial.clearcoatIntensityTexture = cc.clearCoatIntensityMap.texture;
|
|
535
|
+
pbrMaterial.clearcoatIntensityTextureSampler = cc.clearCoatIntensityMap.sampler;
|
|
536
|
+
pbrMaterial.clearcoatIntensityTexCoordIndex = cc.clearCoatIntensityMap.texCoord;
|
|
537
|
+
pbrMaterial.clearcoatIntensityTexCoordMatrix = cc.clearCoatIntensityMap.transform;
|
|
498
538
|
}
|
|
499
539
|
if (cc.clearCoatRoughnessMap) {
|
|
500
|
-
pbrMaterial.
|
|
540
|
+
pbrMaterial.clearcoatRoughnessTexture = cc.clearCoatRoughnessMap.texture;
|
|
541
|
+
pbrMaterial.clearcoatRoughnessTextureSampler = cc.clearCoatRoughnessMap.sampler;
|
|
542
|
+
pbrMaterial.clearcoatRoughnessTexCoordIndex = cc.clearCoatRoughnessMap.texCoord;
|
|
543
|
+
pbrMaterial.clearcoatRoughnessTexCoordMatrix = cc.clearCoatRoughnessMap.transform;
|
|
501
544
|
}
|
|
502
545
|
if (cc.clearCoatNormalMap) {
|
|
503
|
-
pbrMaterial.
|
|
546
|
+
pbrMaterial.clearcoatNormalTexture = cc.clearCoatNormalMap.texture;
|
|
547
|
+
pbrMaterial.clearcoatNormalTextureSampler = cc.clearCoatNormalMap.sampler;
|
|
548
|
+
pbrMaterial.clearcoatNormalTexCoordIndex = cc.clearCoatNormalMap.texCoord;
|
|
549
|
+
pbrMaterial.clearcoatNormalTexCoordMatrix = cc.clearCoatNormalMap.transform;
|
|
504
550
|
}
|
|
505
551
|
}
|
|
506
552
|
pbrMaterial.vertexTangent = assetPBRMaterial.common.useTangent;
|
|
507
553
|
pbrMaterial.vertexColor = assetPBRMaterial.common.vertexColor;
|
|
508
554
|
if (assetPBRMaterial.common.alphaMode === 'blend') {
|
|
509
|
-
pbrMaterial.
|
|
555
|
+
pbrMaterial.blendMode = 'blend';
|
|
510
556
|
} else if (assetPBRMaterial.common.alphaMode === 'mask') {
|
|
511
557
|
pbrMaterial.alphaCutoff = assetPBRMaterial.common.alphaCutoff;
|
|
512
558
|
}
|
|
@@ -875,7 +921,7 @@ import { AbstractModelLoader } from '../loader.js';
|
|
|
875
921
|
const accessor = gltf._accessors[accessorIndex];
|
|
876
922
|
const componentCount = accessor.getComponentCount(accessor.type);
|
|
877
923
|
const normalized = !!accessor.normalized;
|
|
878
|
-
const hash = `${accessorIndex}:${
|
|
924
|
+
const hash = `${accessorIndex}:${semantic || ''}:${Number(normalized)}`;
|
|
879
925
|
let buffer = gltf._bufferCache[hash];
|
|
880
926
|
if (!buffer) {
|
|
881
927
|
let data = accessor.getNormalizedDeinterlacedView(gltf);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf_loader.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gltf_loader.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -126,7 +126,7 @@ const _f16one = floatToHalf(1);
|
|
|
126
126
|
for(let j = 0; j < height; j++){
|
|
127
127
|
const scanline = [];
|
|
128
128
|
let rgbe = d8.slice(pos, pos += 4);
|
|
129
|
-
const isNewRLE = rgbe[0] == 2 && rgbe[1] == 2 && rgbe[2] == (width >> 8 &
|
|
129
|
+
const isNewRLE = rgbe[0] == 2 && rgbe[1] == 2 && rgbe[2] == (width >> 8 & 0xff) && rgbe[3] == (width & 0xff);
|
|
130
130
|
if (isNewRLE && width >= 8 && width < 32768) {
|
|
131
131
|
for(let i = 0; i < 4; i++){
|
|
132
132
|
let ptr = i * width;
|
package/dist/blitter/blitter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blitter.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"blitter.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"depthlimitedgaussion.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"depthlimitedgaussion.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gaussianblur.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gaussianblur.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/camera/camera.js
CHANGED
|
@@ -2,15 +2,18 @@ import { Matrix4x4, Vector4, Frustum } from '@zephyr3d/base';
|
|
|
2
2
|
import { SceneNode } from '../scene/scene_node.js';
|
|
3
3
|
import { Application } from '../app.js';
|
|
4
4
|
import '../scene/octree.js';
|
|
5
|
-
import '../material/
|
|
6
|
-
import '@zephyr3d/device';
|
|
7
|
-
import '../shaders/framework.js';
|
|
8
|
-
import '../render/scatteringlut.js';
|
|
5
|
+
import '../material/shader/helper.js';
|
|
9
6
|
import '../material/lambert.js';
|
|
10
7
|
import '../material/blinn.js';
|
|
11
8
|
import '../material/unlit.js';
|
|
12
|
-
import '../material/
|
|
13
|
-
import
|
|
9
|
+
import '../material/material.js';
|
|
10
|
+
import '../material/meshmaterial.js';
|
|
11
|
+
import '../material/grassmaterial.js';
|
|
12
|
+
import '../material/terrainmaterial.js';
|
|
13
|
+
import '../material/pbrmr.js';
|
|
14
|
+
import '../material/pbrsg.js';
|
|
15
|
+
import '@zephyr3d/device';
|
|
16
|
+
import { SceneRenderer } from '../render/renderer.js';
|
|
14
17
|
import '../render/sky.js';
|
|
15
18
|
import '../render/clipmap.js';
|
|
16
19
|
import '../render/watermesh.js';
|
|
@@ -299,8 +302,8 @@ import '../render/watermesh.js';
|
|
|
299
302
|
device.pushDeviceStates();
|
|
300
303
|
device.reverseVertexWindingOrder(false);
|
|
301
304
|
device.setFramebuffer(this._framebuffer);
|
|
302
|
-
|
|
303
|
-
|
|
305
|
+
SceneRenderer.setClearColor(this._clearColor);
|
|
306
|
+
SceneRenderer.renderScene(scene, this, compositor, logger);
|
|
304
307
|
device.popDeviceStates();
|
|
305
308
|
}
|
|
306
309
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"camera.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|