@woosh/meep-engine 2.33.2 → 2.33.6
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/core/bvh2/aabb3/AABB3.js +18 -0
- package/core/bvh2/aabb3/aabb3_intersects_frustum.js +38 -0
- package/core/collection/RingBuffer.js +40 -10
- package/core/collection/array/copyArray.js +2 -2
- package/core/collection/array/typed/typed_array_copy.js +2 -2
- package/core/collection/table/RowFirstTableSpec.js +8 -0
- package/core/geom/3d/aabb/aabb3_compute_projected_area.js +16 -14
- package/core/geom/3d/aabb/aabb3_estimate_projected_area2.js +59 -0
- package/core/geom/3d/aabb/aabb3_matrix4_project.js +33 -0
- package/core/geom/3d/aabb/aabb3_matrix4_project.spec.js +41 -0
- package/core/geom/3d/plane/plane3_lerp.js +2 -2
- package/core/geom/3d/topology/TopoTriangle.js +2 -2
- package/core/geom/AABB2.d.ts +2 -0
- package/core/geom/Matrix4.js +4 -4
- package/core/geom/Vector3.js +5 -5
- package/core/model/reactive/model/terminal/ReactiveReference.js +7 -1
- package/core/process/undo/ActionProcessor.d.ts +2 -0
- package/core/process/undo/ActionProcessor.js +59 -1
- package/core/process/undo/ActionProcessor.spec.js +59 -0
- package/core/process/undo/Mark.js +2 -1
- package/engine/asset/loaders/GLTFAssetLoader.js +3 -3
- package/engine/asset/loaders/material/TextureAttachmensByMaterialType.js +11 -1
- package/engine/asset/loaders/material/TextureAttachment.js +12 -1
- package/engine/asset/loaders/material/bitmap2sampler_gl.js +19 -0
- package/engine/asset/loaders/material/computeImageBitmapEquality.js +7 -19
- package/engine/asset/loaders/material/computeTextureEquality.js +1 -1
- package/engine/asset/loaders/material/computeTextureHash.js +16 -14
- package/engine/asset/loaders/material/traverseMaterialTextures.js +2 -2
- package/engine/ecs/animation/OneBoneSurfaceAlignmentSolver.js +2 -2
- package/engine/ecs/animation/TwoBoneInverseKinematicsSolver.js +4 -4
- package/engine/graphics/GraphicsEngine.d.ts +2 -2
- package/engine/graphics/GraphicsEngine.js +20 -62
- package/engine/graphics/filter/FlipArrayInPlace.js +25 -0
- package/engine/graphics/filter/FlipArrayViaCanvas.js +13 -0
- package/engine/graphics/filter/ImageFilter.js +20 -51
- package/engine/graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js +2 -2
- package/engine/graphics/geometry/instancing/InstancedMeshGroup.js +25 -16
- package/engine/graphics/material/SplatMaterial.js +4 -97
- package/engine/graphics/material/optimization/MaterialOptimizationContext.js +598 -0
- package/engine/graphics/micron/build/PatchRepresentation.js +4 -43
- package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +4 -75
- package/engine/graphics/micron/build/compute_buffer_geometry_byte_size.js +16 -0
- package/engine/graphics/micron/build/fill_patch_geometry_data.js +2 -0
- package/engine/graphics/micron/format/MicronGeometryBufferAttributeSpec.js +1 -1
- package/engine/graphics/micron/format/MicronGeometryPatch.js +17 -5
- package/engine/graphics/micron/format/MicronVertexDataSpec.js +25 -3
- package/engine/graphics/micron/prototypeVirtualGeometry.js +19 -12
- package/engine/graphics/micron/render/VirtualGeometryBuilder.js +34 -27
- package/engine/graphics/micron/render/instanced/AttributeDataTexture.js +2 -4
- package/engine/graphics/micron/render/instanced/PatchDataTextures.js +1 -0
- package/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +1 -29
- package/engine/graphics/micron/render/refinement/ActivePatchList.js +43 -159
- package/engine/graphics/micron/render/refinement/ActivePatchRecord.js +4 -2
- package/engine/graphics/micron/render/refinement/RefinementSpec.js +98 -0
- package/engine/graphics/micron/render/refinement/array_normalize_plane.js +25 -0
- package/engine/graphics/micron/render/refinement/array_setFromProjectionMatrix.js +60 -0
- package/engine/graphics/micron/render/refinement/is_patch_facing_back.js +43 -0
- package/engine/graphics/micron/render/refinement/is_patch_visible.js +37 -0
- package/engine/graphics/micron/render/v1/MaterialVertexSpec.js +21 -0
- package/engine/graphics/micron/render/v1/VGThreeRenderer.js +12 -9
- package/engine/graphics/micron/util/unit_hemioct.spec.js +2 -2
- package/engine/graphics/render/buffer/buffers/ColorAndDepthFrameBuffer.js +5 -3
- package/engine/graphics/render/buffer/buffers/NormalFrameBuffer.js +12 -2
- package/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +8 -10
- package/engine/graphics/render/forward_plus/LightManager.js +5 -7
- package/engine/graphics/render/forward_plus/data/NumericType.js +9 -0
- package/engine/graphics/render/forward_plus/{TextureBackedMemoryRegion.js → data/TextureBackedMemoryRegion.js} +11 -190
- package/engine/graphics/render/forward_plus/data/channelCountToThreIntegerTextureType.js +16 -0
- package/engine/graphics/render/forward_plus/data/computeDataType.js +36 -0
- package/engine/graphics/render/forward_plus/data/computeThreeTextureFormat.js +18 -0
- package/engine/graphics/render/forward_plus/data/computeThreeTextureInternalFormatFromDataType.js +63 -0
- package/engine/graphics/render/forward_plus/data/computeThreeTextureTypeFromDataType.js +41 -0
- package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
- package/engine/graphics/render/forward_plus/prototypeLightManager.js +1 -1
- package/engine/graphics/render/utils/ThreeBypassRenderer.js +1 -3
- package/engine/graphics/render/visibility/hiz/buffer/HierarchicalZBuffer.js +198 -0
- package/engine/graphics/render/visibility/hiz/buffer/ReductionShader.js +51 -0
- package/engine/graphics/render/visibility/hiz/buildCanvasViewFromTexture.js +179 -0
- package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +435 -0
- package/engine/graphics/render/visibility/hiz/query/BatchOcclusionQuery.js +174 -0
- package/engine/graphics/render/visibility/hiz/query/QueryShader.js +173 -0
- package/engine/graphics/shadows/ShadowMapRenderer.js +12 -2
- package/engine/graphics/texture/atlas/TextureAtlas.js +1 -1
- package/engine/graphics/texture/cubemap/buildCubeURLs.js +13 -0
- package/engine/graphics/texture/cubemap/load_environment_map.d.ts +8 -0
- package/engine/graphics/texture/cubemap/load_environment_map.js +163 -0
- package/engine/graphics/texture/sampler/Sampler2D.js +18 -62
- package/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +8 -4
- package/engine/graphics/texture/sampler/debug/paintSamplerOnHTML.js +3 -2
- package/engine/graphics/texture/sampler/differenceSampler.js +31 -0
- package/engine/graphics/texture/sampler/typedArrayConstructorByInstance.js +25 -0
- package/engine/graphics/texture/sampler/util/drawSamplerHTML.js +3 -2
- package/engine/graphics/texture/virtual/v2/ShaderUsage.js +6 -5
- package/engine/graphics/texture/virtual/v2/prototype.js +16 -6
- package/package.json +1 -1
- package/view/elements/progress/segmented/SegmentedResourceBarView.js +50 -15
- package/view/minimap/gl/MinimapMarkersGL.js +2 -2
- package/engine/graphics/micron/render/RefinementSpec.js +0 -110
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FrameBuffer } from "../FrameBuffer.js";
|
|
2
2
|
import {
|
|
3
|
+
DepthFormat,
|
|
3
4
|
DepthTexture,
|
|
4
5
|
FloatType,
|
|
5
6
|
NearestFilter,
|
|
6
|
-
|
|
7
|
+
RGBFormat,
|
|
7
8
|
sRGBEncoding,
|
|
8
9
|
Vector2,
|
|
9
10
|
WebGLMultisampleRenderTarget
|
|
@@ -39,9 +40,9 @@ export class ColorAndDepthFrameBuffer extends FrameBuffer {
|
|
|
39
40
|
|
|
40
41
|
renderer.getSize(size);
|
|
41
42
|
|
|
42
|
-
const target = new WebGLMultisampleRenderTarget(size.x, size.y);
|
|
43
|
+
const target = new WebGLMultisampleRenderTarget(size.x, size.y,{ignoreDepth: false});
|
|
43
44
|
|
|
44
|
-
target.texture.format =
|
|
45
|
+
target.texture.format = RGBFormat; // note, three.js required RGBA render texture, even though RGB would do here
|
|
45
46
|
target.texture.minFilter = NearestFilter;
|
|
46
47
|
target.texture.magFilter = NearestFilter;
|
|
47
48
|
target.texture.generateMipmaps = false;
|
|
@@ -51,6 +52,7 @@ export class ColorAndDepthFrameBuffer extends FrameBuffer {
|
|
|
51
52
|
target.depthBuffer = true;
|
|
52
53
|
|
|
53
54
|
target.depthTexture = new DepthTexture();
|
|
55
|
+
target.depthTexture.format = DepthFormat;
|
|
54
56
|
target.depthTexture.type = FloatType;
|
|
55
57
|
target.depthTexture.generateMipmaps = false;
|
|
56
58
|
target.depthTexture.internalFormat = 'DEPTH_COMPONENT32F';
|
|
@@ -52,11 +52,15 @@ export class NormalFrameBuffer extends FrameBuffer {
|
|
|
52
52
|
this.__material_skinned.side = DoubleSide;
|
|
53
53
|
|
|
54
54
|
|
|
55
|
+
const scene = new Scene();
|
|
55
56
|
/**
|
|
56
57
|
* @type {Scene}
|
|
57
58
|
* @private
|
|
58
59
|
*/
|
|
59
|
-
this.__scene =
|
|
60
|
+
this.__scene = scene;
|
|
61
|
+
scene.autoUpdate = false;
|
|
62
|
+
scene.matrixAutoUpdate = false;
|
|
63
|
+
scene.matrixWorldNeedsUpdate = false;
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
|
|
@@ -90,7 +94,13 @@ export class NormalFrameBuffer extends FrameBuffer {
|
|
|
90
94
|
|
|
91
95
|
if (source_material !== undefined) {
|
|
92
96
|
// assign normal map and color map
|
|
93
|
-
|
|
97
|
+
|
|
98
|
+
if (source_material.alphaTest > 0) {
|
|
99
|
+
target_material.map = source_material.map;
|
|
100
|
+
} else {
|
|
101
|
+
target_material.map = null;
|
|
102
|
+
}
|
|
103
|
+
|
|
94
104
|
target_material.normalMap = source_material.normalMap;
|
|
95
105
|
}
|
|
96
106
|
}
|
|
@@ -50,8 +50,6 @@ import { enableEditor } from "../../../../../editor/enableEditor.js";
|
|
|
50
50
|
import EntityBuilder from "../../../../ecs/EntityBuilder.js";
|
|
51
51
|
import { Transform } from "../../../../ecs/transform/Transform.js";
|
|
52
52
|
import Mesh from "../../../ecs/mesh/Mesh.js";
|
|
53
|
-
import ViewportPosition from "../../../../ecs/gui/position/ViewportPosition.js";
|
|
54
|
-
import GUIElement from "../../../../ecs/gui/GUIElement.js";
|
|
55
53
|
import { CopyShader } from "three/examples/jsm/shaders/CopyShader.js";
|
|
56
54
|
import {
|
|
57
55
|
DoubleSide,
|
|
@@ -64,11 +62,11 @@ import {
|
|
|
64
62
|
UniformsUtils,
|
|
65
63
|
WebGLRenderTarget
|
|
66
64
|
} from "three";
|
|
67
|
-
import { buildCubeURLs } from "../../../GraphicsEngine.js";
|
|
68
65
|
import { AmbientOcclusionPostProcessEffect } from "../simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
|
|
69
66
|
import { PathDisplaySystem } from "../../../ecs/path/PathDisplaySystem.js";
|
|
70
67
|
import { MicronRenderPlugin } from "../../../micron/plugin/MicronRenderPlugin.js";
|
|
71
68
|
import { StandardFrameBuffers } from "../../../StandardFrameBuffers.js";
|
|
69
|
+
import { buildCubeURLs } from "../../../texture/cubemap/buildCubeURLs.js";
|
|
72
70
|
|
|
73
71
|
const engineHarness = new EngineHarness();
|
|
74
72
|
|
|
@@ -386,13 +384,13 @@ function main(engine) {
|
|
|
386
384
|
// .build(ecd);
|
|
387
385
|
|
|
388
386
|
// const canvasView = makeCameraClippingDebug(engine);
|
|
389
|
-
|
|
390
|
-
new EntityBuilder()
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
387
|
+
//
|
|
388
|
+
// new EntityBuilder()
|
|
389
|
+
// .add(ViewportPosition.fromJSON({
|
|
390
|
+
// offset: new Vector2(10, 10)
|
|
391
|
+
// }))
|
|
392
|
+
// .add(GUIElement.fromView(canvasView))
|
|
393
|
+
// .build(ecd);
|
|
396
394
|
|
|
397
395
|
|
|
398
396
|
}
|
|
@@ -11,15 +11,13 @@ import { compute_light_data_hash_0 } from "./cluster/compute_light_data_hash_0.j
|
|
|
11
11
|
import { read_plane_pair } from "./cluster/read_plane_pair.js";
|
|
12
12
|
import { read_frustum_planes_to_array } from "./cluster/read_frustum_planes_to_array.js";
|
|
13
13
|
import { compute_cluster_planes_from_points } from "./cluster/compute_cluster_planes_from_points.js";
|
|
14
|
-
import {
|
|
15
|
-
computeDataType,
|
|
16
|
-
computeThreeTextureInternalFormatFromDataType,
|
|
17
|
-
computeThreeTextureTypeFromDataType,
|
|
18
|
-
NumericType,
|
|
19
|
-
TextureBackedMemoryRegion
|
|
20
|
-
} from "./TextureBackedMemoryRegion.js";
|
|
14
|
+
import { TextureBackedMemoryRegion } from "./data/TextureBackedMemoryRegion.js";
|
|
21
15
|
import { assert } from "../../../../core/assert.js";
|
|
22
16
|
import { DataType2TypedArrayConstructorMapping } from "../../../../core/collection/table/DataType2TypedArrayConstructorMapping.js";
|
|
17
|
+
import { NumericType } from "./data/NumericType.js";
|
|
18
|
+
import { computeDataType } from "./data/computeDataType.js";
|
|
19
|
+
import { computeThreeTextureTypeFromDataType } from "./data/computeThreeTextureTypeFromDataType.js";
|
|
20
|
+
import { computeThreeTextureInternalFormatFromDataType } from "./data/computeThreeTextureInternalFormatFromDataType.js";
|
|
23
21
|
|
|
24
22
|
const LOOKUP_CACHE_SIZE = 16384; // must be power of two
|
|
25
23
|
/**
|
|
@@ -1,36 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
RGIntegerFormat,
|
|
13
|
-
ShortType,
|
|
14
|
-
UnsignedByteType,
|
|
15
|
-
UnsignedIntType,
|
|
16
|
-
UnsignedShortType
|
|
17
|
-
} from "three";
|
|
18
|
-
import { DataType } from "../../../../core/collection/table/DataType.js";
|
|
19
|
-
import { assert } from "../../../../core/assert.js";
|
|
20
|
-
import { DataType2TypedArrayConstructorMapping } from "../../../../core/collection/table/DataType2TypedArrayConstructorMapping.js";
|
|
21
|
-
import { max2 } from "../../../../core/math/max2.js";
|
|
22
|
-
import { channelCountToThreeTextureFormat } from "../../texture/channelCountToThreeTextureFormat.js";
|
|
23
|
-
import { DataTypeByteSizes } from "../../../../core/collection/table/RowFirstTableSpec.js";
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @enum {number}
|
|
28
|
-
*/
|
|
29
|
-
export const NumericType = {
|
|
30
|
-
Uint: 0,
|
|
31
|
-
Int: 1,
|
|
32
|
-
Float: 2
|
|
33
|
-
};
|
|
1
|
+
import { DataTexture, NearestFilter, RedFormat, UnsignedByteType } from "three";
|
|
2
|
+
import { DataType } from "../../../../../core/collection/table/DataType.js";
|
|
3
|
+
import { assert } from "../../../../../core/assert.js";
|
|
4
|
+
import { DataType2TypedArrayConstructorMapping } from "../../../../../core/collection/table/DataType2TypedArrayConstructorMapping.js";
|
|
5
|
+
import { max2 } from "../../../../../core/math/max2.js";
|
|
6
|
+
import { DataTypeByteSizes } from "../../../../../core/collection/table/RowFirstTableSpec.js";
|
|
7
|
+
import { NumericType } from "./NumericType.js";
|
|
8
|
+
import { computeDataType } from "./computeDataType.js";
|
|
9
|
+
import { computeThreeTextureTypeFromDataType } from "./computeThreeTextureTypeFromDataType.js";
|
|
10
|
+
import { computeThreeTextureInternalFormatFromDataType } from "./computeThreeTextureInternalFormatFromDataType.js";
|
|
11
|
+
import { computeThreeTextureFormat } from "./computeThreeTextureFormat.js";
|
|
34
12
|
|
|
35
13
|
/**
|
|
36
14
|
* How wide a data texture is
|
|
@@ -42,163 +20,6 @@ const SHRINK_FACTOR = 0.5;
|
|
|
42
20
|
const GROW_FACTOR = 1.05;
|
|
43
21
|
|
|
44
22
|
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
* @param {NumericType} type
|
|
48
|
-
* @param {number} precision
|
|
49
|
-
* @returns {DataType}
|
|
50
|
-
*/
|
|
51
|
-
export function computeDataType(type, precision) {
|
|
52
|
-
if (type === NumericType.Uint) {
|
|
53
|
-
if (precision <= 8) {
|
|
54
|
-
return DataType.Uint8;
|
|
55
|
-
} else if (precision <= 16) {
|
|
56
|
-
return DataType.Uint16;
|
|
57
|
-
} else if (precision <= 32) {
|
|
58
|
-
return DataType.Uint32;
|
|
59
|
-
}
|
|
60
|
-
} else if (type === NumericType.Int) {
|
|
61
|
-
if (precision <= 8) {
|
|
62
|
-
return DataType.Int8;
|
|
63
|
-
} else if (precision <= 16) {
|
|
64
|
-
return DataType.Int16;
|
|
65
|
-
} else if (precision <= 32) {
|
|
66
|
-
return DataType.Int32;
|
|
67
|
-
}
|
|
68
|
-
} else if (type === NumericType.Float) {
|
|
69
|
-
if (precision <= 32) {
|
|
70
|
-
return DataType.Float32;
|
|
71
|
-
} else if (precision <= 64) {
|
|
72
|
-
return DataType.Float64;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
throw new Error(`Unsupported numeric type(=${type}) and precision(=${precision}) combination`);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
*
|
|
81
|
-
* @param {DataType} dt
|
|
82
|
-
* @returns {number}
|
|
83
|
-
*/
|
|
84
|
-
export function computeThreeTextureTypeFromDataType(dt) {
|
|
85
|
-
switch (dt) {
|
|
86
|
-
case DataType.Uint8:
|
|
87
|
-
return UnsignedByteType;
|
|
88
|
-
case DataType.Uint16:
|
|
89
|
-
return UnsignedShortType;
|
|
90
|
-
case DataType.Uint32:
|
|
91
|
-
return UnsignedIntType;
|
|
92
|
-
case DataType.Int8:
|
|
93
|
-
return ByteType;
|
|
94
|
-
case DataType.Int16:
|
|
95
|
-
return ShortType;
|
|
96
|
-
case DataType.Int32:
|
|
97
|
-
return IntType;
|
|
98
|
-
case DataType.Float16:
|
|
99
|
-
return HalfFloatType;
|
|
100
|
-
case DataType.Float32:
|
|
101
|
-
return FloatType;
|
|
102
|
-
case DataType.Float64:
|
|
103
|
-
return FloatType;
|
|
104
|
-
default:
|
|
105
|
-
throw new Error(`Unsupported data type '${dt}'`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
*
|
|
112
|
-
* @param {DataType} dt
|
|
113
|
-
* @param {number} channel_count
|
|
114
|
-
* @returns {string|THREE.PixelFormatGPU}
|
|
115
|
-
*/
|
|
116
|
-
export function computeThreeTextureInternalFormatFromDataType(dt, channel_count) {
|
|
117
|
-
let suffix = '';
|
|
118
|
-
switch (dt) {
|
|
119
|
-
case DataType.Uint8:
|
|
120
|
-
suffix = '8UI';
|
|
121
|
-
break;
|
|
122
|
-
case DataType.Uint16:
|
|
123
|
-
suffix = '16UI';
|
|
124
|
-
break;
|
|
125
|
-
case DataType.Uint32:
|
|
126
|
-
suffix = '32UI';
|
|
127
|
-
break;
|
|
128
|
-
case DataType.Int8:
|
|
129
|
-
suffix = '8I';
|
|
130
|
-
break;
|
|
131
|
-
case DataType.Int16:
|
|
132
|
-
suffix = '16I';
|
|
133
|
-
break;
|
|
134
|
-
case DataType.Int32:
|
|
135
|
-
suffix = '32I';
|
|
136
|
-
break;
|
|
137
|
-
case DataType.Float16:
|
|
138
|
-
suffix = '16F';
|
|
139
|
-
break;
|
|
140
|
-
case DataType.Float32:
|
|
141
|
-
suffix = '32F';
|
|
142
|
-
break;
|
|
143
|
-
case DataType.Float64:
|
|
144
|
-
suffix = '64F';
|
|
145
|
-
break;
|
|
146
|
-
default:
|
|
147
|
-
throw new Error(`Unsupported data type '${dt}'`);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
let prefix = '';
|
|
151
|
-
|
|
152
|
-
switch (channel_count) {
|
|
153
|
-
case 1:
|
|
154
|
-
prefix = 'R';
|
|
155
|
-
break;
|
|
156
|
-
case 2:
|
|
157
|
-
prefix = 'RG';
|
|
158
|
-
break;
|
|
159
|
-
case 3:
|
|
160
|
-
prefix = 'RGB';
|
|
161
|
-
break;
|
|
162
|
-
case 4:
|
|
163
|
-
prefix = 'RGBA';
|
|
164
|
-
break;
|
|
165
|
-
default:
|
|
166
|
-
throw new Error(`Unsupported channel count '${channel_count}'`);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
return prefix + suffix;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function channelCountToThreIntegerTextureType(channel_count) {
|
|
173
|
-
switch (channel_count) {
|
|
174
|
-
case 1:
|
|
175
|
-
return RedIntegerFormat;
|
|
176
|
-
case 2:
|
|
177
|
-
return RGIntegerFormat;
|
|
178
|
-
case 3:
|
|
179
|
-
return RGBIntegerFormat;
|
|
180
|
-
case 4:
|
|
181
|
-
return RGBAIntegerFormat;
|
|
182
|
-
default:
|
|
183
|
-
throw new Error(`Unsupported channel count '${channel_count}'`);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
*
|
|
189
|
-
* @param {NumericType} type
|
|
190
|
-
* @param {number} channel_count
|
|
191
|
-
*/
|
|
192
|
-
function computeThreeTextureFormat(type, channel_count) {
|
|
193
|
-
if (type === NumericType.Uint || type === NumericType.Int) {
|
|
194
|
-
return channelCountToThreIntegerTextureType(channel_count);
|
|
195
|
-
} else if (type === NumericType.Float) {
|
|
196
|
-
return channelCountToThreeTextureFormat(channel_count);
|
|
197
|
-
} else {
|
|
198
|
-
throw new Error(`Unsupported numeric type '${type}'`);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
23
|
export class TextureBackedMemoryRegion {
|
|
203
24
|
|
|
204
25
|
constructor() {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RedIntegerFormat, RGBAIntegerFormat, RGBIntegerFormat, RGIntegerFormat } from "three";
|
|
2
|
+
|
|
3
|
+
export function channelCountToThreIntegerTextureType(channel_count) {
|
|
4
|
+
switch (channel_count) {
|
|
5
|
+
case 1:
|
|
6
|
+
return RedIntegerFormat;
|
|
7
|
+
case 2:
|
|
8
|
+
return RGIntegerFormat;
|
|
9
|
+
case 3:
|
|
10
|
+
return RGBIntegerFormat;
|
|
11
|
+
case 4:
|
|
12
|
+
return RGBAIntegerFormat;
|
|
13
|
+
default:
|
|
14
|
+
throw new Error(`Unsupported channel count '${channel_count}'`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NumericType } from "./NumericType.js";
|
|
2
|
+
import { DataType } from "../../../../../core/collection/table/DataType.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {NumericType} type
|
|
7
|
+
* @param {number} precision
|
|
8
|
+
* @returns {DataType}
|
|
9
|
+
*/
|
|
10
|
+
export function computeDataType(type, precision) {
|
|
11
|
+
if (type === NumericType.Uint) {
|
|
12
|
+
if (precision <= 8) {
|
|
13
|
+
return DataType.Uint8;
|
|
14
|
+
} else if (precision <= 16) {
|
|
15
|
+
return DataType.Uint16;
|
|
16
|
+
} else if (precision <= 32) {
|
|
17
|
+
return DataType.Uint32;
|
|
18
|
+
}
|
|
19
|
+
} else if (type === NumericType.Int) {
|
|
20
|
+
if (precision <= 8) {
|
|
21
|
+
return DataType.Int8;
|
|
22
|
+
} else if (precision <= 16) {
|
|
23
|
+
return DataType.Int16;
|
|
24
|
+
} else if (precision <= 32) {
|
|
25
|
+
return DataType.Int32;
|
|
26
|
+
}
|
|
27
|
+
} else if (type === NumericType.Float) {
|
|
28
|
+
if (precision <= 32) {
|
|
29
|
+
return DataType.Float32;
|
|
30
|
+
} else if (precision <= 64) {
|
|
31
|
+
return DataType.Float64;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
throw new Error(`Unsupported numeric type(=${type}) and precision(=${precision}) combination`);
|
|
36
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NumericType } from "./NumericType.js";
|
|
2
|
+
import { channelCountToThreIntegerTextureType } from "./channelCountToThreIntegerTextureType.js";
|
|
3
|
+
import { channelCountToThreeTextureFormat } from "../../../texture/channelCountToThreeTextureFormat.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {NumericType} type
|
|
8
|
+
* @param {number} channel_count
|
|
9
|
+
*/
|
|
10
|
+
export function computeThreeTextureFormat(type, channel_count) {
|
|
11
|
+
if (type === NumericType.Uint || type === NumericType.Int) {
|
|
12
|
+
return channelCountToThreIntegerTextureType(channel_count);
|
|
13
|
+
} else if (type === NumericType.Float) {
|
|
14
|
+
return channelCountToThreeTextureFormat(channel_count);
|
|
15
|
+
} else {
|
|
16
|
+
throw new Error(`Unsupported numeric type '${type}'`);
|
|
17
|
+
}
|
|
18
|
+
}
|
package/engine/graphics/render/forward_plus/data/computeThreeTextureInternalFormatFromDataType.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { DataType } from "../../../../../core/collection/table/DataType.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {DataType} dt
|
|
6
|
+
* @param {number} channel_count
|
|
7
|
+
* @returns {string|THREE.PixelFormatGPU}
|
|
8
|
+
*/
|
|
9
|
+
export function computeThreeTextureInternalFormatFromDataType(dt, channel_count) {
|
|
10
|
+
let suffix = '';
|
|
11
|
+
switch (dt) {
|
|
12
|
+
case DataType.Uint8:
|
|
13
|
+
suffix = '8UI';
|
|
14
|
+
break;
|
|
15
|
+
case DataType.Uint16:
|
|
16
|
+
suffix = '16UI';
|
|
17
|
+
break;
|
|
18
|
+
case DataType.Uint32:
|
|
19
|
+
suffix = '32UI';
|
|
20
|
+
break;
|
|
21
|
+
case DataType.Int8:
|
|
22
|
+
suffix = '8I';
|
|
23
|
+
break;
|
|
24
|
+
case DataType.Int16:
|
|
25
|
+
suffix = '16I';
|
|
26
|
+
break;
|
|
27
|
+
case DataType.Int32:
|
|
28
|
+
suffix = '32I';
|
|
29
|
+
break;
|
|
30
|
+
case DataType.Float16:
|
|
31
|
+
suffix = '16F';
|
|
32
|
+
break;
|
|
33
|
+
case DataType.Float32:
|
|
34
|
+
suffix = '32F';
|
|
35
|
+
break;
|
|
36
|
+
case DataType.Float64:
|
|
37
|
+
suffix = '64F';
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
throw new Error(`Unsupported data type '${dt}'`);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let prefix = '';
|
|
44
|
+
|
|
45
|
+
switch (channel_count) {
|
|
46
|
+
case 1:
|
|
47
|
+
prefix = 'R';
|
|
48
|
+
break;
|
|
49
|
+
case 2:
|
|
50
|
+
prefix = 'RG';
|
|
51
|
+
break;
|
|
52
|
+
case 3:
|
|
53
|
+
prefix = 'RGB';
|
|
54
|
+
break;
|
|
55
|
+
case 4:
|
|
56
|
+
prefix = 'RGBA';
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
throw new Error(`Unsupported channel count '${channel_count}'`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return prefix + suffix;
|
|
63
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DataType } from "../../../../../core/collection/table/DataType.js";
|
|
2
|
+
import {
|
|
3
|
+
ByteType,
|
|
4
|
+
FloatType,
|
|
5
|
+
HalfFloatType,
|
|
6
|
+
IntType,
|
|
7
|
+
ShortType,
|
|
8
|
+
UnsignedByteType,
|
|
9
|
+
UnsignedIntType,
|
|
10
|
+
UnsignedShortType
|
|
11
|
+
} from "three";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {DataType} dt
|
|
16
|
+
* @returns {number}
|
|
17
|
+
*/
|
|
18
|
+
export function computeThreeTextureTypeFromDataType(dt) {
|
|
19
|
+
switch (dt) {
|
|
20
|
+
case DataType.Uint8:
|
|
21
|
+
return UnsignedByteType;
|
|
22
|
+
case DataType.Uint16:
|
|
23
|
+
return UnsignedShortType;
|
|
24
|
+
case DataType.Uint32:
|
|
25
|
+
return UnsignedIntType;
|
|
26
|
+
case DataType.Int8:
|
|
27
|
+
return ByteType;
|
|
28
|
+
case DataType.Int16:
|
|
29
|
+
return ShortType;
|
|
30
|
+
case DataType.Int32:
|
|
31
|
+
return IntType;
|
|
32
|
+
case DataType.Float16:
|
|
33
|
+
return HalfFloatType;
|
|
34
|
+
case DataType.Float32:
|
|
35
|
+
return FloatType;
|
|
36
|
+
case DataType.Float64:
|
|
37
|
+
return FloatType;
|
|
38
|
+
default:
|
|
39
|
+
throw new Error(`Unsupported data type '${dt}'`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -45,7 +45,6 @@ import { SerializationMetadataSystem } from "../../../../ecs/systems/Serializati
|
|
|
45
45
|
import { InverseKinematicsSystem } from "../../../../ecs/animation/InverseKinematicsSystem.js";
|
|
46
46
|
import { PathDisplaySystem } from "../../../ecs/path/PathDisplaySystem.js";
|
|
47
47
|
import { Line, LineBasicMaterial, MeshStandardMaterial, TorusKnotBufferGeometry } from "three";
|
|
48
|
-
import { buildCubeURLs } from "../../../GraphicsEngine.js";
|
|
49
48
|
import RenderSystem from "../../../../ecs/systems/RenderSystem.js";
|
|
50
49
|
import { makeEngineOptionsModel } from "../../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
51
50
|
import { enableEditor } from "../../../../../editor/enableEditor.js";
|
|
@@ -77,6 +76,7 @@ import { GameAssetType } from "../../../../asset/GameAssetType.js";
|
|
|
77
76
|
import { GLTFAssetLoader } from "../../../../asset/loaders/GLTFAssetLoader.js";
|
|
78
77
|
import { ImageRGBADataLoader } from "../../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
79
78
|
import { MicronRenderPlugin } from "../../../micron/plugin/MicronRenderPlugin.js";
|
|
79
|
+
import { buildCubeURLs } from "../../../texture/cubemap/buildCubeURLs.js";
|
|
80
80
|
|
|
81
81
|
const engineHarness = new EngineHarness();
|
|
82
82
|
|
|
@@ -233,7 +233,7 @@ function prepare_scene_0() {
|
|
|
233
233
|
|
|
234
234
|
controls.minDistance = 2;
|
|
235
235
|
|
|
236
|
-
for (let i = 0; i <
|
|
236
|
+
for (let i = 0; i < 500; i++) {
|
|
237
237
|
const radius = randomFloatBetween(random, 4, 4);
|
|
238
238
|
const intensity = randomFloatBetween(random, 2, 2);
|
|
239
239
|
addPointLight([
|
|
@@ -107,14 +107,12 @@ export class ThreeBypassRenderer {
|
|
|
107
107
|
|
|
108
108
|
mesh.matrix.copy(object3D.matrix);
|
|
109
109
|
mesh.matrixWorld.copy(object3D.matrixWorld);
|
|
110
|
-
|
|
110
|
+
mesh.normalMatrix.copy(object3D.normalMatrix);
|
|
111
111
|
|
|
112
112
|
scene_children[j++] = mesh;
|
|
113
113
|
mesh.parent = scene;
|
|
114
114
|
|
|
115
115
|
}
|
|
116
|
-
} else if (object3D.isMicronMesh) {
|
|
117
|
-
// scene_children[j++] = object3D;
|
|
118
116
|
}
|
|
119
117
|
}
|
|
120
118
|
|