@plasius/gpu-renderer 0.2.53 → 0.2.55
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/CHANGELOG.md +30 -0
- package/README.md +11 -18
- package/dist/index.cjs +17 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/canonical-wavefront-meshes.js +3 -1
- package/src/index.d.ts +5 -0
- package/src/wavefront-mesh-sources.js +3 -3
- package/src/wavefront-scene-normalizers.js +10 -1
- package/src/wavefront-shader-materials.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -23,6 +23,34 @@ All notable changes to this project will be documented in this file.
|
|
|
23
23
|
- **Security**
|
|
24
24
|
- (placeholder)
|
|
25
25
|
|
|
26
|
+
## [0.2.55] - 2026-10-24
|
|
27
|
+
|
|
28
|
+
- **Added**
|
|
29
|
+
- (placeholder)
|
|
30
|
+
|
|
31
|
+
- **Changed**
|
|
32
|
+
- (placeholder)
|
|
33
|
+
|
|
34
|
+
- **Fixed**
|
|
35
|
+
- Preserve canonical blend alpha exactly once and ignore factor/texture alpha for opaque materials through CPU/GPU packing and material sampling; retain legacy Wavefront alpha composition when mode is omitted.
|
|
36
|
+
|
|
37
|
+
- **Security**
|
|
38
|
+
- (placeholder)
|
|
39
|
+
|
|
40
|
+
## [0.2.54] - 2026-10-21
|
|
41
|
+
|
|
42
|
+
- **Added**
|
|
43
|
+
- (placeholder)
|
|
44
|
+
|
|
45
|
+
- **Changed**
|
|
46
|
+
- Explain direct WebGPU control in the public README and keep dependency admission guidance in the development guide.
|
|
47
|
+
|
|
48
|
+
- **Fixed**
|
|
49
|
+
- (placeholder)
|
|
50
|
+
|
|
51
|
+
- **Security**
|
|
52
|
+
- (placeholder)
|
|
53
|
+
|
|
26
54
|
## [0.2.53] - 2026-10-20
|
|
27
55
|
|
|
28
56
|
- **Added**
|
|
@@ -1285,3 +1313,5 @@ All notable changes to this project will be documented in this file.
|
|
|
1285
1313
|
[0.2.51]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.2.51
|
|
1286
1314
|
[0.2.52]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.2.52
|
|
1287
1315
|
[0.2.53]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.2.53
|
|
1316
|
+
[0.2.54]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.2.54
|
|
1317
|
+
[0.2.55]: https://github.com/Plasius-LTD/gpu-renderer/releases/tag/v0.2.55
|
package/README.md
CHANGED
|
@@ -12,6 +12,10 @@ Framework-independent WebGPU rendering for browser applications. Render triangle
|
|
|
12
12
|
meshes with the wavefront path tracer, draw native raster surfaces, or use the
|
|
13
13
|
frame lifecycle and XR integration APIs in your own rendering pipeline.
|
|
14
14
|
|
|
15
|
+
The APIs expose GPU resource ownership, render passes and sample accumulation
|
|
16
|
+
directly. Use them from JavaScript or TypeScript when you want explicit control
|
|
17
|
+
over your application's WebGPU pipeline.
|
|
18
|
+
|
|
15
19
|
Apache-2.0 · ESM and CommonJS · TypeScript declarations included.
|
|
16
20
|
|
|
17
21
|
## Install
|
|
@@ -70,6 +74,10 @@ The canonical adapter maps the core 0.5 material texture slots; it currently
|
|
|
70
74
|
accepts UV0 and identity texture transforms. Other selections/transforms fail
|
|
71
75
|
explicitly so authored appearance is not silently changed. See the
|
|
72
76
|
[canonical integration contract](docs/guides/integration.md#canonical-model-ingestion).
|
|
77
|
+
Canonical blend materials multiply authored factor alpha by texture alpha once;
|
|
78
|
+
opaque materials ignore both alpha channels. Direct `WavefrontMeshInput` callers
|
|
79
|
+
can select `alphaMode: "opaque" | "blend"`; omitting it preserves legacy opacity
|
|
80
|
+
composition. Alpha masks remain unsupported by the canonical adapter.
|
|
73
81
|
For an interactive model viewer with loading, integrity checks, camera gestures
|
|
74
82
|
and quality controls, use the shared package's `model-inspection` entry.
|
|
75
83
|
|
|
@@ -145,29 +153,14 @@ route capabilities and rollout policy before mounting a scene.
|
|
|
145
153
|
|
|
146
154
|
## Development
|
|
147
155
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
```sh
|
|
151
|
-
npm ci --legacy-peer-deps
|
|
152
|
-
npm run lint
|
|
153
|
-
npm run typecheck
|
|
154
|
-
npm run test:coverage
|
|
155
|
-
npm run build
|
|
156
|
-
npm run pack:check
|
|
157
|
-
npm run zero-three
|
|
158
|
-
```
|
|
156
|
+
For checkout setup and required validation, start with the
|
|
157
|
+
[development guide](https://github.com/Plasius-LTD/gpu-renderer/blob/main/docs/guides/development.md).
|
|
159
158
|
|
|
160
159
|
`npm run demo` requires Python 3 and serves the parent workspace. With the checkout
|
|
161
160
|
named `gpu-renderer`, visit `http://localhost:8000/gpu-renderer/demo/`.
|
|
162
|
-
|
|
163
|
-
for sibling-package requirements and source layout, and
|
|
161
|
+
The development guide also describes the source layout. See
|
|
164
162
|
[CONTRIBUTING.md](https://github.com/Plasius-LTD/gpu-renderer/blob/main/CONTRIBUTING.md).
|
|
165
163
|
|
|
166
|
-
Three.js and dependency paths reaching it are prohibited across runtime,
|
|
167
|
-
development tooling and published artifacts. `npm run zero-three:source` checks
|
|
168
|
-
source admission before installation; `npm run zero-three` validates the installed
|
|
169
|
-
and built package evidence.
|
|
170
|
-
|
|
171
164
|
<!-- BEGIN PLASIUS RELEASE INTEGRITY -->
|
|
172
165
|
## Release integrity
|
|
173
166
|
|
package/dist/index.cjs
CHANGED
|
@@ -1691,12 +1691,14 @@ function mapMaterial(material, materialRefId, textures) {
|
|
|
1691
1691
|
}
|
|
1692
1692
|
const mapped = {
|
|
1693
1693
|
materialRefId,
|
|
1694
|
+
alphaMode: material.alphaMode,
|
|
1694
1695
|
...material.alphaMode === "blend" ? { materialKind: "transparent" } : {},
|
|
1695
1696
|
baseColor: material.baseColorFactor,
|
|
1696
1697
|
emission: material.emissiveFactor ? [...material.emissiveFactor, 1] : [0, 0, 0, 1],
|
|
1697
1698
|
roughness: material.roughnessFactor,
|
|
1698
1699
|
metallic: material.metallicFactor,
|
|
1699
|
-
|
|
1700
|
+
// The authored factor remains in baseColor.a; do not multiply it twice.
|
|
1701
|
+
opacity: 1,
|
|
1700
1702
|
clearcoat: material.clearcoatFactor,
|
|
1701
1703
|
clearcoatRoughness: material.clearcoatRoughnessFactor,
|
|
1702
1704
|
transmission: material.transmissionFactor,
|
|
@@ -8377,7 +8379,7 @@ fn sample_surface_material(
|
|
|
8377
8379
|
let baseColorTexel = sample_atlas(baseColorAtlasTexture, triangle.baseColorAtlas, uv);
|
|
8378
8380
|
let baseColor = vec4<f32>(
|
|
8379
8381
|
clamp(triangle.color.rgb * srgb_to_linear_vec3(baseColorTexel.rgb), vec3<f32>(0.0), vec3<f32>(1.0)),
|
|
8380
|
-
clamp(triangle.color.a * baseColorTexel.a, 0.0, 1.0)
|
|
8382
|
+
select(clamp(triangle.color.a * baseColorTexel.a, 0.0, 1.0), 1.0, triangle.textureSettings.w > 0.5)
|
|
8381
8383
|
);
|
|
8382
8384
|
let metallicRoughnessTexel = sample_atlas(
|
|
8383
8385
|
metallicRoughnessAtlasTexture,
|
|
@@ -9361,6 +9363,10 @@ function createDefaultWavefrontSceneObjects() {
|
|
|
9361
9363
|
]);
|
|
9362
9364
|
}
|
|
9363
9365
|
function normalizeWavefrontMesh(input = {}, meshIndex = 0) {
|
|
9366
|
+
const alphaMode = input.alphaMode;
|
|
9367
|
+
if (alphaMode !== void 0 && alphaMode !== "opaque" && alphaMode !== "blend") {
|
|
9368
|
+
throw new TypeError("mesh alphaMode must be opaque or blend.");
|
|
9369
|
+
}
|
|
9364
9370
|
const positions = input.positions;
|
|
9365
9371
|
const positionLength = getArrayLikeLength(positions);
|
|
9366
9372
|
if (positionLength < 9 || positionLength % 3 !== 0) {
|
|
@@ -9390,7 +9396,11 @@ function normalizeWavefrontMesh(input = {}, meshIndex = 0) {
|
|
|
9390
9396
|
input.emission ?? input.emissive ?? input.material?.emission ?? input.material?.emissive,
|
|
9391
9397
|
[0, 0, 0, 1]
|
|
9392
9398
|
);
|
|
9393
|
-
const opacity =
|
|
9399
|
+
const opacity = alphaMode === "opaque" ? 1 : clamp2(
|
|
9400
|
+
readFiniteNumber("opacity", input.opacity ?? input.material?.opacity, alphaMode === "blend" ? 1 : color[3] ?? 1),
|
|
9401
|
+
0,
|
|
9402
|
+
1
|
|
9403
|
+
);
|
|
9394
9404
|
const transmission = clamp2(
|
|
9395
9405
|
readFiniteNumber("transmission", input.transmission ?? input.material?.transmission, materialExtensions.transmission),
|
|
9396
9406
|
0,
|
|
@@ -9422,6 +9432,7 @@ function normalizeWavefrontMesh(input = {}, meshIndex = 0) {
|
|
|
9422
9432
|
0
|
|
9423
9433
|
),
|
|
9424
9434
|
medium,
|
|
9435
|
+
alphaMode,
|
|
9425
9436
|
color: Object.freeze(color),
|
|
9426
9437
|
emission: Object.freeze(emission),
|
|
9427
9438
|
roughness: clamp2(readFiniteNumber("roughness", input.roughness ?? input.material?.roughness, 0.72), 0, 1),
|
|
@@ -9573,7 +9584,7 @@ function createMeshTriangleRecords(meshes, gpuMaterialSource = null) {
|
|
|
9573
9584
|
clampUnit(mesh.normalTexture?.scale ?? mesh.normalTexture?.strength ?? 1),
|
|
9574
9585
|
clampUnit(mesh.occlusionTexture?.strength ?? 1),
|
|
9575
9586
|
clampUnit(mesh.emissiveTexture?.strength ?? 1),
|
|
9576
|
-
0
|
|
9587
|
+
mesh.alphaMode === "opaque" ? 1 : 0
|
|
9577
9588
|
]),
|
|
9578
9589
|
extensionTextures: Object.freeze(
|
|
9579
9590
|
Object.fromEntries(
|
|
@@ -9916,7 +9927,7 @@ function createWavefrontGpuMaterialSource(meshes = []) {
|
|
|
9916
9927
|
clampUnit(mesh.normalTexture?.scale ?? mesh.normalTexture?.strength ?? 1),
|
|
9917
9928
|
clampUnit(mesh.occlusionTexture?.strength ?? 1),
|
|
9918
9929
|
clampUnit(mesh.emissiveTexture?.strength ?? 1),
|
|
9919
|
-
0
|
|
9930
|
+
mesh.alphaMode === "opaque" ? 1 : 0
|
|
9920
9931
|
]);
|
|
9921
9932
|
});
|
|
9922
9933
|
return Object.freeze({
|
|
@@ -10101,7 +10112,7 @@ function createWavefrontGpuMeshSource(meshes = [], gpuMaterialSourceInput = null
|
|
|
10101
10112
|
clampUnit(mesh.normalTexture?.scale ?? mesh.normalTexture?.strength ?? 1),
|
|
10102
10113
|
clampUnit(mesh.occlusionTexture?.strength ?? 1),
|
|
10103
10114
|
clampUnit(mesh.emissiveTexture?.strength ?? 1),
|
|
10104
|
-
0
|
|
10115
|
+
mesh.alphaMode === "opaque" ? 1 : 0
|
|
10105
10116
|
]);
|
|
10106
10117
|
vertexCursor += meshVertexCount;
|
|
10107
10118
|
indexCursor += mesh.indices.length;
|