@plasius/gpu-renderer 0.2.55 → 0.2.56
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 +15 -0
- package/README.md +3 -0
- package/dist/index.cjs +4 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/canonical-wavefront-meshes.js +8 -9
package/package.json
CHANGED
|
@@ -84,14 +84,6 @@ function textureSample(binding, textures, label, extra = {}) {
|
|
|
84
84
|
|
|
85
85
|
function cloneMaterialExtensions(material, textures) {
|
|
86
86
|
const extensions = { ...(material.extensions ?? {}) };
|
|
87
|
-
if (material.workflow === "unlit") {
|
|
88
|
-
const unlitKey = "KHR_materials_unlit";
|
|
89
|
-
const unlitValue = extensions[unlitKey] ?? extensions.unlit ?? {};
|
|
90
|
-
if (typeof unlitValue !== "object" || unlitValue === null || Array.isArray(unlitValue)) {
|
|
91
|
-
throw new TypeError(`Canonical material extension ${unlitKey} must be an object.`);
|
|
92
|
-
}
|
|
93
|
-
extensions[unlitKey] = { ...unlitValue, enabled: true };
|
|
94
|
-
}
|
|
95
87
|
for (const [bindingName, extensionName, textureKey] of EXTENSION_TEXTURE_BINDINGS) {
|
|
96
88
|
const binding = material.textures?.[bindingName];
|
|
97
89
|
if (!binding) {
|
|
@@ -118,7 +110,12 @@ function mapMaterial(material, materialRefId, textures) {
|
|
|
118
110
|
if (material.alphaMode === "mask") {
|
|
119
111
|
throw new Error("Canonical alphaMode mask is unsupported by WavefrontMeshInput.");
|
|
120
112
|
}
|
|
121
|
-
if (material.workflow
|
|
113
|
+
if (material.workflow === "unlit"
|
|
114
|
+
|| Object.hasOwn(material.extensions ?? {}, "KHR_materials_unlit")
|
|
115
|
+
|| Object.hasOwn(material.extensions ?? {}, "unlit")) {
|
|
116
|
+
throw new Error("Canonical unlit materials are unsupported by WavefrontMeshInput; retain an unlit-capable rendering path.");
|
|
117
|
+
}
|
|
118
|
+
if (material.workflow !== "metallic-roughness") {
|
|
122
119
|
throw new Error(`Unsupported canonical material workflow: ${material.workflow}.`);
|
|
123
120
|
}
|
|
124
121
|
|
|
@@ -160,6 +157,8 @@ function mapMaterial(material, materialRefId, textures) {
|
|
|
160
157
|
/**
|
|
161
158
|
* Maps decoded canonical mesh primitives into the renderer's existing Wavefront
|
|
162
159
|
* input contract. Geometry and image decoding remain upstream responsibilities.
|
|
160
|
+
* Referenced unlit workflows or extension markers are rejected until an explicit
|
|
161
|
+
* unlit shading path exists; callers must retain an unlit-capable rendering path.
|
|
163
162
|
*/
|
|
164
163
|
export function createCanonicalWavefrontMeshInputs({ document, geometry, textures = new Map() } = {}) {
|
|
165
164
|
if (!document || typeof document !== "object") {
|