@flighthq/scene3d-wgpu 0.3.0-next.1315.1d4eb64 → 0.3.0-next.1392.f0bd0cc
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/blinnPhongWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/blinnPhongWgpuMeshMaterialRenderer.js +2 -2
- package/dist/contract.d.ts +1 -1
- package/dist/contract.js +1 -1
- package/dist/customShaderWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/customShaderWgpuMeshMaterialRenderer.d.ts.map +1 -1
- package/dist/customShaderWgpuMeshMaterialRenderer.js +6 -6
- package/dist/customShaderWgpuMeshMaterialRenderer.js.map +1 -1
- package/dist/depthWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/depthWgpuMeshMaterialRenderer.js +2 -2
- package/dist/emissiveWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/emissiveWgpuMeshMaterialRenderer.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lambertWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/lambertWgpuMeshMaterialRenderer.js +2 -2
- package/dist/matcapWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/matcapWgpuMeshMaterialRenderer.js +2 -2
- package/dist/normalWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/normalWgpuMeshMaterialRenderer.js +2 -2
- package/dist/phongWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/phongWgpuMeshMaterialRenderer.js +2 -2
- package/dist/registerWgpuStandardPbrMaterial.d.ts +3 -0
- package/dist/registerWgpuStandardPbrMaterial.d.ts.map +1 -0
- package/dist/{registerStandardPbrWgpuMaterial.js → registerWgpuStandardPbrMaterial.js} +2 -2
- package/dist/{registerStandardPbrWgpuMaterial.js.map → registerWgpuStandardPbrMaterial.js.map} +1 -1
- package/dist/shadedWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/shadedWgpuMeshMaterialRenderer.js +1 -1
- package/dist/specularGlossinessPbrWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/specularGlossinessPbrWgpuMeshMaterialRenderer.js +2 -2
- package/dist/standardPbrWgpuMeshMaterialRenderer.js +1 -1
- package/dist/toonWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/toonWgpuMeshMaterialRenderer.js +2 -2
- package/dist/unlitWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/unlitWgpuMeshMaterialRenderer.js +2 -2
- package/dist/vertexColorWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/vertexColorWgpuMeshMaterialRenderer.js +2 -2
- package/dist/wgpuMeshMaterialRegistry.js +1 -1
- package/dist/wireframeWgpuMeshMaterialRenderer.d.ts +1 -1
- package/dist/wireframeWgpuMeshMaterialRenderer.js +2 -2
- package/package.json +15 -15
- package/src/blinnPhongWgpuMeshMaterialRenderer.test.ts +3 -3
- package/src/customShaderWgpuMeshMaterialRenderer.test.ts +13 -10
- package/src/depthWgpuMeshMaterialRenderer.test.ts +3 -3
- package/src/drawWgpuScene3D.test.ts +10 -10
- package/src/emissiveWgpuMeshMaterialRenderer.test.ts +3 -3
- package/src/lambertWgpuMeshMaterialRenderer.test.ts +3 -3
- package/src/matcapWgpuMeshMaterialRenderer.test.ts +3 -3
- package/src/normalWgpuMeshMaterialRenderer.test.ts +3 -3
- package/src/phongWgpuMeshMaterialRenderer.test.ts +3 -3
- package/src/{registerStandardPbrWgpuMaterial.test.ts → registerWgpuStandardPbrMaterial.test.ts} +3 -3
- package/src/shadedWgpuMeshMaterialRenderer.test.ts +3 -3
- package/src/specularGlossinessPbrWgpuMeshMaterialRenderer.test.ts +3 -3
- package/src/toonWgpuMeshMaterialRenderer.test.ts +3 -3
- package/src/unlitWgpuMeshMaterialRenderer.test.ts +10 -4
- package/src/vertexColorWgpuMeshMaterialRenderer.test.ts +3 -3
- package/src/wgpuEnvironmentCube.test.ts +4 -1
- package/src/wgpuEnvironmentIblBake.test.ts +4 -1
- package/src/wgpuEnvironmentSkybox.test.ts +4 -1
- package/src/wgpuShadedPrelude.test.ts +4 -1
- package/src/wgpuShadowMap.test.ts +2 -2
- package/src/wgpuUnlitPrelude.test.ts +7 -1
- package/src/wireframeWgpuMeshMaterialRenderer.test.ts +3 -3
- package/dist/registerStandardPbrWgpuMaterial.d.ts +0 -3
- package/dist/registerStandardPbrWgpuMaterial.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMeshMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
2
|
export declare const blinnPhongWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerWgpuBlinnPhongMaterial(state: WgpuRenderState): void;
|
|
4
4
|
//# sourceMappingURL=blinnPhongWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -11,7 +11,7 @@ import { beginWgpuMeshDraw, drawWgpuMeshSubset, isWgpuTextureReady, writeWgpuFra
|
|
|
11
11
|
// the shared Frame uniform (camera position AND view-projection, since the specular term is view-
|
|
12
12
|
// dependent, plus the packed light block), binds the pipeline + Frame group (beginWgpuMeshDraw), then
|
|
13
13
|
// binds the material's linear diffuse + specular colors and shininess at group(2). draw issues the
|
|
14
|
-
// indexed draw. See
|
|
14
|
+
// indexed draw. See registerWgpuBlinnPhongMaterial to install it.
|
|
15
15
|
export const blinnPhongWgpuMeshMaterialRenderer = {
|
|
16
16
|
bind(state, material, lights, camera) {
|
|
17
17
|
const stateRuntime = getWgpuRenderStateRuntime(state);
|
|
@@ -41,7 +41,7 @@ export const blinnPhongWgpuMeshMaterialRenderer = {
|
|
|
41
41
|
// Registers the built-in BlinnPhong renderer for BlinnPhongMaterialKind on this state. Opt-in (no
|
|
42
42
|
// top-level side effect); call once per WgpuRenderState before drawWgpuScene3D so meshes with BlinnPhong
|
|
43
43
|
// materials draw.
|
|
44
|
-
export function
|
|
44
|
+
export function registerWgpuBlinnPhongMaterial(state) {
|
|
45
45
|
registerWgpuBitmapTextureResolver(state);
|
|
46
46
|
registerWgpuImageTextureResolver(state);
|
|
47
47
|
registerWgpuMeshMaterialRenderer(state, BlinnPhongMaterialKind, blinnPhongWgpuMeshMaterialRenderer);
|
package/dist/contract.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export * from './matcapWgpuMeshMaterialRenderer';
|
|
|
14
14
|
export * from './normalWgpuMeshMaterialRenderer';
|
|
15
15
|
export * from './phongWgpuMeshMaterialRenderer';
|
|
16
16
|
export * from './prepareWgpuScene3DForwardLights';
|
|
17
|
-
export * from './
|
|
17
|
+
export * from './registerWgpuStandardPbrMaterial';
|
|
18
18
|
export * from './shadedWgpuMeshMaterialRenderer';
|
|
19
19
|
export * from './specularGlossinessPbrWgpuMeshMaterialRenderer';
|
|
20
20
|
export * from './standardPbrWgpuMeshMaterialRenderer';
|
package/dist/contract.js
CHANGED
|
@@ -14,7 +14,7 @@ export * from './matcapWgpuMeshMaterialRenderer';
|
|
|
14
14
|
export * from './normalWgpuMeshMaterialRenderer';
|
|
15
15
|
export * from './phongWgpuMeshMaterialRenderer';
|
|
16
16
|
export * from './prepareWgpuScene3DForwardLights';
|
|
17
|
-
export * from './
|
|
17
|
+
export * from './registerWgpuStandardPbrMaterial';
|
|
18
18
|
export * from './shadedWgpuMeshMaterialRenderer';
|
|
19
19
|
export * from './specularGlossinessPbrWgpuMeshMaterialRenderer';
|
|
20
20
|
export * from './standardPbrWgpuMeshMaterialRenderer';
|
|
@@ -2,6 +2,6 @@ import type { WgpuCustomMaterialShaderSource, WgpuMeshMaterialRenderer, WgpuRend
|
|
|
2
2
|
export { WGPU_CUSTOM_SHADER_TEXTURE_CAPACITY, WGPU_CUSTOM_SHADER_USER_VEC4_CAPACITY } from './wgpuCustomMaterialAbi';
|
|
3
3
|
export declare const customShaderWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
4
4
|
export declare function getWgpuCustomMaterialShaderSource(state: WgpuRenderState, shaderKey: string): WgpuCustomMaterialShaderSource | null;
|
|
5
|
-
export declare function registerCustomShaderWgpuMaterial(state: WgpuRenderState): void;
|
|
6
5
|
export declare function registerWgpuCustomMaterialShader(state: WgpuRenderState, shaderKey: string, wgslSource: WgpuCustomMaterialShaderSource): void;
|
|
6
|
+
export declare function registerWgpuCustomShaderMaterial(state: WgpuRenderState): void;
|
|
7
7
|
//# sourceMappingURL=customShaderWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customShaderWgpuMeshMaterialRenderer.d.ts","sourceRoot":"","sources":["../src/customShaderWgpuMeshMaterialRenderer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAOV,8BAA8B,EAC9B,wBAAwB,EAExB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAmBlC,OAAO,EAAE,mCAAmC,EAAE,qCAAqC,EAAE,MAAM,yBAAyB,CAAC;AAmBrH,eAAO,MAAM,oCAAoC,EAAE,wBAuDlD,CAAC;AAGF,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,eAAe,EACtB,SAAS,EAAE,MAAM,GAChB,8BAA8B,GAAG,IAAI,CAEvC;
|
|
1
|
+
{"version":3,"file":"customShaderWgpuMeshMaterialRenderer.d.ts","sourceRoot":"","sources":["../src/customShaderWgpuMeshMaterialRenderer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAOV,8BAA8B,EAC9B,wBAAwB,EAExB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAmBlC,OAAO,EAAE,mCAAmC,EAAE,qCAAqC,EAAE,MAAM,yBAAyB,CAAC;AAmBrH,eAAO,MAAM,oCAAoC,EAAE,wBAuDlD,CAAC;AAGF,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,eAAe,EACtB,SAAS,EAAE,MAAM,GAChB,8BAA8B,GAAG,IAAI,CAEvC;AAiBD,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,eAAe,EACtB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,8BAA8B,GACzC,IAAI,CAON;AAGD,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAI7E"}
|
|
@@ -52,12 +52,6 @@ export const customShaderWgpuMeshMaterialRenderer = {
|
|
|
52
52
|
export function getWgpuCustomMaterialShaderSource(state, shaderKey) {
|
|
53
53
|
return _customMaterialShaders.get(state)?.get(shaderKey) ?? null;
|
|
54
54
|
}
|
|
55
|
-
// Installs CustomShaderMaterialKind in this state's WGPU mesh-material registry.
|
|
56
|
-
export function registerCustomShaderWgpuMaterial(state) {
|
|
57
|
-
registerWgpuBitmapTextureResolver(state);
|
|
58
|
-
registerWgpuImageTextureResolver(state);
|
|
59
|
-
registerWgpuMeshMaterialRenderer(state, CustomShaderMaterialKind, customShaderWgpuMeshMaterialRenderer);
|
|
60
|
-
}
|
|
61
55
|
// Registers a complete WGSL module for a CustomShaderMaterial shaderKey.
|
|
62
56
|
//
|
|
63
57
|
// Fixed ABI:
|
|
@@ -81,6 +75,12 @@ export function registerWgpuCustomMaterialShader(state, shaderKey, wgslSource) {
|
|
|
81
75
|
}
|
|
82
76
|
registry.set(shaderKey, wgslSource);
|
|
83
77
|
}
|
|
78
|
+
// Installs CustomShaderMaterialKind in this state's WGPU mesh-material registry.
|
|
79
|
+
export function registerWgpuCustomShaderMaterial(state) {
|
|
80
|
+
registerWgpuBitmapTextureResolver(state);
|
|
81
|
+
registerWgpuImageTextureResolver(state);
|
|
82
|
+
registerWgpuMeshMaterialRenderer(state, CustomShaderMaterialKind, customShaderWgpuMeshMaterialRenderer);
|
|
83
|
+
}
|
|
84
84
|
function compileCustomMaterialPipeline(state, source, format, doubleSided, blended, skinned, layouts) {
|
|
85
85
|
return createWgpuMeshPipeline(state, {
|
|
86
86
|
blended,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customShaderWgpuMeshMaterialRenderer.js","sourceRoot":"","sources":["../src/custom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CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,sBAAsB,GAAG,IAAI,OAAO,EAAgE,CAAC;AAC3G,MAAM,sBAAsB,GAAG,IAAI,OAAO,EAA0C,CAAC;AACrF,MAAM,uBAAuB,GAAG,IAAI,OAAO,EAA2D,CAAC;AACvG,MAAM,eAAe,GAAG,IAAI,YAAY,CAAC,qCAAqC,GAAG,CAAC,CAAC,CAAC;AACpF,MAAM,kBAAkB,GAAa,EAAE,CAAC;AACxC,MAAM,sBAAsB,GAAiB,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;AAC5F,MAAM,mBAAmB,GAAqB,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMeshMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
2
|
export declare const depthWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerWgpuDepthMaterial(state: WgpuRenderState): void;
|
|
4
4
|
//# sourceMappingURL=depthWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -8,7 +8,7 @@ import { beginWgpuMeshDraw, drawWgpuMeshSubset, writeWgpuFrameUniform } from './
|
|
|
8
8
|
// debug pipeline in depth mode for the color format, writes the shared Frame uniform (lights ignored),
|
|
9
9
|
// and binds the material's [near, far] linearization range; draw issues the indexed draw. The fragment
|
|
10
10
|
// scene2d linearizes window-space depth into eye space and writes it as grayscale LINEAR color. See
|
|
11
|
-
//
|
|
11
|
+
// registerWgpuDepthMaterial to install it.
|
|
12
12
|
export const depthWgpuMeshMaterialRenderer = {
|
|
13
13
|
bind(state, material, _lights, camera) {
|
|
14
14
|
const stateRuntime = getWgpuRenderStateRuntime(state);
|
|
@@ -35,7 +35,7 @@ export const depthWgpuMeshMaterialRenderer = {
|
|
|
35
35
|
};
|
|
36
36
|
// Registers the built-in Depth renderer for DepthMaterialKind on this state. Opt-in (no top-level side
|
|
37
37
|
// effect); call once per WgpuRenderState before drawWgpuScene3D so meshes with DepthMaterials draw.
|
|
38
|
-
export function
|
|
38
|
+
export function registerWgpuDepthMaterial(state) {
|
|
39
39
|
registerWgpuMeshMaterialRenderer(state, DepthMaterialKind, depthWgpuMeshMaterialRenderer);
|
|
40
40
|
}
|
|
41
41
|
const FALLBACK_MATERIAL = {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMeshMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
2
|
export declare const emissiveWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerWgpuEmissiveMaterial(state: WgpuRenderState): void;
|
|
4
4
|
//# sourceMappingURL=emissiveWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -7,7 +7,7 @@ import { bindWgpuUnlitSurface, ensureWgpuUnlitPipeline } from './wgpuUnlitPrelud
|
|
|
7
7
|
// The built-in Emissive forward renderer (WgpuMeshMaterialRenderer for EmissiveMaterialKind) — the WGSL
|
|
8
8
|
// mirror of emissiveGlMeshMaterialRenderer. Self-illuminating, lighting-independent: binds the linear
|
|
9
9
|
// emissive color scaled by emissiveStrength through the shared unlit pipeline (values > 1 drive bloom
|
|
10
|
-
// over the rgba16float scene target). See
|
|
10
|
+
// over the rgba16float scene target). See registerWgpuEmissiveMaterial.
|
|
11
11
|
export const emissiveWgpuMeshMaterialRenderer = {
|
|
12
12
|
bind(state, material, _lights, camera) {
|
|
13
13
|
const stateRuntime = getWgpuRenderStateRuntime(state);
|
|
@@ -35,7 +35,7 @@ export const emissiveWgpuMeshMaterialRenderer = {
|
|
|
35
35
|
};
|
|
36
36
|
// Registers the built-in Emissive renderer for EmissiveMaterialKind on this state. Opt-in (no top-level
|
|
37
37
|
// side effect); call once per WgpuRenderState before drawWgpuScene3D so meshes with EmissiveMaterials draw.
|
|
38
|
-
export function
|
|
38
|
+
export function registerWgpuEmissiveMaterial(state) {
|
|
39
39
|
registerWgpuBitmapTextureResolver(state);
|
|
40
40
|
registerWgpuImageTextureResolver(state);
|
|
41
41
|
registerWgpuMeshMaterialRenderer(state, EmissiveMaterialKind, emissiveWgpuMeshMaterialRenderer);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { bakeWgpuEnvironmentIbl, beginWgpuMeshDraw, drawWgpuEnvironmentSkybox, drawWgpuScene3D, drawWgpuScene3DShadowMap, ensureWgpuShadowSampleLayout, prepareWgpuScene3DForwardLights,
|
|
1
|
+
export { bakeWgpuEnvironmentIbl, beginWgpuMeshDraw, drawWgpuEnvironmentSkybox, drawWgpuScene3D, drawWgpuScene3DShadowMap, ensureWgpuShadowSampleLayout, prepareWgpuScene3DForwardLights, registerWgpuBlinnPhongMaterial, registerBuiltInWgpuModifierSnippets, registerWgpuCustomShaderMaterial, registerWgpuDepthMaterial, registerWgpuEmissiveMaterial, registerWgpuLambertMaterial, registerWgpuMatcapMaterial, registerWgpuNormalMaterial, registerWgpuPhongMaterial, registerWgpuShadedMaterial, registerWgpuSpecularGlossinessPbrMaterial, registerWgpuStandardPbrMaterial, registerWgpuToonMaterial, registerWgpuUnlitMaterial, registerWgpuVertexColorMaterial, registerWgpuCustomMaterialShader, registerWgpuGpuSkinning, registerWgpuWireframeMaterial, setWgpuScene3DTime, standardPbrWgpuMeshMaterialRenderer, unlitWgpuMeshMaterialRenderer, writeWgpuDrawUniform, } from './contract';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { bakeWgpuEnvironmentIbl, beginWgpuMeshDraw, drawWgpuEnvironmentSkybox, drawWgpuScene3D, drawWgpuScene3DShadowMap, ensureWgpuShadowSampleLayout, prepareWgpuScene3DForwardLights,
|
|
1
|
+
export { bakeWgpuEnvironmentIbl, beginWgpuMeshDraw, drawWgpuEnvironmentSkybox, drawWgpuScene3D, drawWgpuScene3DShadowMap, ensureWgpuShadowSampleLayout, prepareWgpuScene3DForwardLights, registerWgpuBlinnPhongMaterial, registerBuiltInWgpuModifierSnippets, registerWgpuCustomShaderMaterial, registerWgpuDepthMaterial, registerWgpuEmissiveMaterial, registerWgpuLambertMaterial, registerWgpuMatcapMaterial, registerWgpuNormalMaterial, registerWgpuPhongMaterial, registerWgpuShadedMaterial, registerWgpuSpecularGlossinessPbrMaterial, registerWgpuStandardPbrMaterial, registerWgpuToonMaterial, registerWgpuUnlitMaterial, registerWgpuVertexColorMaterial, registerWgpuCustomMaterialShader, registerWgpuGpuSkinning, registerWgpuWireframeMaterial, setWgpuScene3DTime, standardPbrWgpuMeshMaterialRenderer, unlitWgpuMeshMaterialRenderer, writeWgpuDrawUniform, } from './contract';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMeshMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
2
|
export declare const lambertWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerWgpuLambertMaterial(state: WgpuRenderState): void;
|
|
4
4
|
//# sourceMappingURL=lambertWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -10,7 +10,7 @@ import { beginWgpuMeshDraw, drawWgpuMeshSubset, isWgpuTextureReady, writeWgpuFra
|
|
|
10
10
|
// color format, writes the shared Frame uniform (camera + the packed light block), binds the pipeline
|
|
11
11
|
// + Frame group (beginWgpuMeshDraw), then binds the material's linear diffuse color at group(2). draw
|
|
12
12
|
// issues the indexed draw. Lambert has no view-dependent term, so the classic prelude compiles out its
|
|
13
|
-
// specular branch (the specular color it binds is unused). See
|
|
13
|
+
// specular branch (the specular color it binds is unused). See registerWgpuLambertMaterial to install.
|
|
14
14
|
export const lambertWgpuMeshMaterialRenderer = {
|
|
15
15
|
bind(state, material, lights, camera) {
|
|
16
16
|
const stateRuntime = getWgpuRenderStateRuntime(state);
|
|
@@ -38,7 +38,7 @@ export const lambertWgpuMeshMaterialRenderer = {
|
|
|
38
38
|
};
|
|
39
39
|
// Registers the built-in Lambert renderer for LambertMaterialKind on this state. Opt-in (no top-level
|
|
40
40
|
// side effect); call once per WgpuRenderState before drawWgpuScene3D so meshes with LambertMaterials draw.
|
|
41
|
-
export function
|
|
41
|
+
export function registerWgpuLambertMaterial(state) {
|
|
42
42
|
registerWgpuBitmapTextureResolver(state);
|
|
43
43
|
registerWgpuImageTextureResolver(state);
|
|
44
44
|
registerWgpuMeshMaterialRenderer(state, LambertMaterialKind, lambertWgpuMeshMaterialRenderer);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMeshMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
2
|
export declare const matcapWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerWgpuMatcapMaterial(state: WgpuRenderState): void;
|
|
4
4
|
//# sourceMappingURL=matcapWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -8,7 +8,7 @@ import { beginWgpuMeshDraw, drawWgpuMeshSubset, writeWgpuFrameUniform } from './
|
|
|
8
8
|
// mirror of matcapGlMeshMaterialRenderer. Lighting-independent material-capture shading: bind selects
|
|
9
9
|
// the matcap pipeline variant for the alpha mode + color format, writes the shared Frame uniform
|
|
10
10
|
// (lights ignored — the matcap texture is the prebaked lighting), and binds the linear tint; draw
|
|
11
|
-
// issues the indexed draw. See
|
|
11
|
+
// issues the indexed draw. See registerWgpuMatcapMaterial to install it. The real matcap texture is not
|
|
12
12
|
// yet sampled on wgpu (hasMatcap stays false; see wgpuMatcapPrelude's note), so the surface renders as
|
|
13
13
|
// the tint alone for now.
|
|
14
14
|
export const matcapWgpuMeshMaterialRenderer = {
|
|
@@ -38,7 +38,7 @@ export const matcapWgpuMeshMaterialRenderer = {
|
|
|
38
38
|
};
|
|
39
39
|
// Registers the built-in Matcap renderer for MatcapMaterialKind on this state. Opt-in (no top-level
|
|
40
40
|
// side effect); call once per WgpuRenderState before drawWgpuScene3D so meshes with MatcapMaterials draw.
|
|
41
|
-
export function
|
|
41
|
+
export function registerWgpuMatcapMaterial(state) {
|
|
42
42
|
registerWgpuBitmapTextureResolver(state);
|
|
43
43
|
registerWgpuImageTextureResolver(state);
|
|
44
44
|
registerWgpuMeshMaterialRenderer(state, MatcapMaterialKind, matcapWgpuMeshMaterialRenderer);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMeshMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
2
|
export declare const normalWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerWgpuNormalMaterial(state: WgpuRenderState): void;
|
|
4
4
|
//# sourceMappingURL=normalWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -10,7 +10,7 @@ import { beginWgpuMeshDraw, drawWgpuMeshSubset, writeWgpuFrameUniform } from './
|
|
|
10
10
|
// scene2d transforms the geometric normal by the normal matrix (so the visualized normal is WORLD-space)
|
|
11
11
|
// and encodes it as `n * 0.5 + 0.5` LINEAR color. The tangent-space normal map is NOT sampled on wgpu
|
|
12
12
|
// yet — hasNormalMap stays false and the shared placeholder texture is bound (mirrors the documented map
|
|
13
|
-
// gap on the rest of the wgpu side; see wgpuDebugPrelude). See
|
|
13
|
+
// gap on the rest of the wgpu side; see wgpuDebugPrelude). See registerWgpuNormalMaterial to install it.
|
|
14
14
|
export const normalWgpuMeshMaterialRenderer = {
|
|
15
15
|
bind(state, material, _lights, camera) {
|
|
16
16
|
const stateRuntime = getWgpuRenderStateRuntime(state);
|
|
@@ -40,7 +40,7 @@ export const normalWgpuMeshMaterialRenderer = {
|
|
|
40
40
|
};
|
|
41
41
|
// Registers the built-in Normal renderer for NormalMaterialKind on this state. Opt-in (no top-level side
|
|
42
42
|
// effect); call once per WgpuRenderState before drawWgpuScene3D so meshes with NormalMaterials draw.
|
|
43
|
-
export function
|
|
43
|
+
export function registerWgpuNormalMaterial(state) {
|
|
44
44
|
registerWgpuBitmapTextureResolver(state);
|
|
45
45
|
registerWgpuImageTextureResolver(state);
|
|
46
46
|
registerWgpuMeshMaterialRenderer(state, NormalMaterialKind, normalWgpuMeshMaterialRenderer);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMeshMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
2
|
export declare const phongWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerWgpuPhongMaterial(state: WgpuRenderState): void;
|
|
4
4
|
//# sourceMappingURL=phongWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -10,7 +10,7 @@ import { beginWgpuMeshDraw, drawWgpuMeshSubset, isWgpuTextureReady, writeWgpuFra
|
|
|
10
10
|
// material's alpha mode + color format, writes the shared Frame uniform (camera position AND view-
|
|
11
11
|
// projection, since the specular term is view-dependent, plus the packed light block), binds the
|
|
12
12
|
// pipeline + Frame group (beginWgpuMeshDraw), then binds the material's linear diffuse + specular
|
|
13
|
-
// colors and shininess at group(2). draw issues the indexed draw. See
|
|
13
|
+
// colors and shininess at group(2). draw issues the indexed draw. See registerWgpuPhongMaterial to
|
|
14
14
|
// install it.
|
|
15
15
|
export const phongWgpuMeshMaterialRenderer = {
|
|
16
16
|
bind(state, material, lights, camera) {
|
|
@@ -40,7 +40,7 @@ export const phongWgpuMeshMaterialRenderer = {
|
|
|
40
40
|
};
|
|
41
41
|
// Registers the built-in Phong renderer for PhongMaterialKind on this state. Opt-in (no top-level
|
|
42
42
|
// side effect); call once per WgpuRenderState before drawWgpuScene3D so meshes with PhongMaterials draw.
|
|
43
|
-
export function
|
|
43
|
+
export function registerWgpuPhongMaterial(state) {
|
|
44
44
|
registerWgpuBitmapTextureResolver(state);
|
|
45
45
|
registerWgpuImageTextureResolver(state);
|
|
46
46
|
registerWgpuMeshMaterialRenderer(state, PhongMaterialKind, phongWgpuMeshMaterialRenderer);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerWgpuStandardPbrMaterial.d.ts","sourceRoot":"","sources":["../src/registerWgpuStandardPbrMaterial.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAUhE,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAI5E"}
|
|
@@ -6,9 +6,9 @@ import { registerWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
|
6
6
|
// Convenience over registerWgpuMeshMaterialRenderer(state, StandardPbrMaterialKind, …); call it once
|
|
7
7
|
// per WgpuRenderState before drawScene3D so meshes carrying StandardPbrMaterials draw. Opt-in by design
|
|
8
8
|
// (no top-level side effect): the render path knows no built-in material until registered.
|
|
9
|
-
export function
|
|
9
|
+
export function registerWgpuStandardPbrMaterial(state) {
|
|
10
10
|
registerWgpuBitmapTextureResolver(state);
|
|
11
11
|
registerWgpuImageTextureResolver(state);
|
|
12
12
|
registerWgpuMeshMaterialRenderer(state, StandardPbrMaterialKind, standardPbrWgpuMeshMaterialRenderer);
|
|
13
13
|
}
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=registerWgpuStandardPbrMaterial.js.map
|
package/dist/{registerStandardPbrWgpuMaterial.js.map → registerWgpuStandardPbrMaterial.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"registerWgpuStandardPbrMaterial.js","sourceRoot":"","sources":["../src/registerWgpuStandardPbrMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAErH,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAC5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AAE9E,qGAAqG;AACrG,qGAAqG;AACrG,wGAAwG;AACxG,2FAA2F;AAC3F,MAAM,UAAU,+BAA+B,CAAC,KAAsB;IACpE,iCAAiC,CAAC,KAAK,CAAC,CAAC;IACzC,gCAAgC,CAAC,KAAK,CAAC,CAAC;IACxC,gCAAgC,CAAC,KAAK,EAAE,uBAAuB,EAAE,mCAAmC,CAAC,CAAC;AACxG,CAAC"}
|
|
@@ -7,5 +7,5 @@ export declare function getWgpuShadedBaseFlags(material: Readonly<ShadedMaterial
|
|
|
7
7
|
hasNormalMap: boolean;
|
|
8
8
|
hasSpecularMap: boolean;
|
|
9
9
|
};
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function registerWgpuShadedMaterial(state: WgpuRenderState): void;
|
|
11
11
|
//# sourceMappingURL=shadedWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -39,7 +39,7 @@ export function getWgpuShadedBaseFlags(material) {
|
|
|
39
39
|
}
|
|
40
40
|
// Registers ShadedMaterialKind on one state. Modifier compilers are a separate open registry: call
|
|
41
41
|
// registerBuiltInWgpuModifierSnippets (and/or vendor registrations) explicitly before drawing.
|
|
42
|
-
export function
|
|
42
|
+
export function registerWgpuShadedMaterial(state) {
|
|
43
43
|
registerWgpuBitmapTextureResolver(state);
|
|
44
44
|
registerWgpuImageTextureResolver(state);
|
|
45
45
|
registerWgpuMeshMaterialRenderer(state, ShadedMaterialKind, shadedWgpuMeshMaterialRenderer);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMeshMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
2
|
export declare const specularGlossinessPbrWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerWgpuSpecularGlossinessPbrMaterial(state: WgpuRenderState): void;
|
|
4
4
|
//# sourceMappingURL=specularGlossinessPbrWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -28,7 +28,7 @@ import { ensureWgpuPbrPipeline } from './wgpuPbrPipelineCache';
|
|
|
28
28
|
//
|
|
29
29
|
// Colors are decoded to linear on the CPU before the conversion math; the converted standard block
|
|
30
30
|
// re-packs baseColor/emissive to RGBA8 so writeWgpuPbrStandardBlock's CPU decode round-trips. See
|
|
31
|
-
//
|
|
31
|
+
// registerWgpuSpecularGlossinessPbrMaterial.
|
|
32
32
|
export const specularGlossinessPbrWgpuMeshMaterialRenderer = {
|
|
33
33
|
bind(state, material, lights, camera) {
|
|
34
34
|
const stateRuntime = getWgpuRenderStateRuntime(state);
|
|
@@ -56,7 +56,7 @@ export const specularGlossinessPbrWgpuMeshMaterialRenderer = {
|
|
|
56
56
|
// Installs the built-in SpecularGlossiness renderer for SpecularGlossinessPbrMaterialKind on this
|
|
57
57
|
// state. Opt-in (no top-level side effect): drawScene3D only draws SpecularGlossiness subsets once this
|
|
58
58
|
// is called.
|
|
59
|
-
export function
|
|
59
|
+
export function registerWgpuSpecularGlossinessPbrMaterial(state) {
|
|
60
60
|
registerWgpuBitmapTextureResolver(state);
|
|
61
61
|
registerWgpuImageTextureResolver(state);
|
|
62
62
|
registerWgpuMeshMaterialRenderer(state, SpecularGlossinessPbrMaterialKind, specularGlossinessPbrWgpuMeshMaterialRenderer);
|
|
@@ -135,7 +135,7 @@ export function writeWgpuPbrStandardBlock(out, standard, alphaCutoff) {
|
|
|
135
135
|
// pipeline. The five standard maps (base color, metallic-roughness, normal, occlusion, emissive) are
|
|
136
136
|
// sampled when bound — the textured pipeline variant compiles per the `has*Map` flags and the real
|
|
137
137
|
// uploaded views bind into the map slots; an unbound slot falls back to the placeholder. See
|
|
138
|
-
//
|
|
138
|
+
// registerWgpuStandardPbrMaterial to install it.
|
|
139
139
|
//
|
|
140
140
|
// Cannot be visually captured in JSDOM (no GPU adapter); the unit test asserts the pipeline/bind/draw
|
|
141
141
|
// call shape against the mock device, mirrored against the verified GL result.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMeshMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
2
|
export declare const toonWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerWgpuToonMaterial(state: WgpuRenderState): void;
|
|
4
4
|
//# sourceMappingURL=toonWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -14,7 +14,7 @@ import { bindWgpuToonSurface, ensureWgpuToonPipeline } from './wgpuToonPrelude';
|
|
|
14
14
|
// rgba16float scene target. draw uploads the geometry's GPU buffers lazily (cached by geometry.version),
|
|
15
15
|
// writes the per-draw model + normal matrices into the render-state's uniform ring buffer (group(1),
|
|
16
16
|
// dynamic offset), and issues the indexed draw over the proxy's subset. Depth-test LESS + depth-write
|
|
17
|
-
// on and back-face culling (unless double-sided) are baked on the pipeline. See
|
|
17
|
+
// on and back-face culling (unless double-sided) are baked on the pipeline. See registerWgpuToonMaterial
|
|
18
18
|
// to install it.
|
|
19
19
|
//
|
|
20
20
|
// MAPS NOT SAMPLED YET: baseColorMap and ramp are not uploaded on wgpu, so the define key keeps
|
|
@@ -51,7 +51,7 @@ export const toonWgpuMeshMaterialRenderer = {
|
|
|
51
51
|
};
|
|
52
52
|
// Registers the built-in Toon renderer for ToonMaterialKind on this state. Opt-in (no top-level side
|
|
53
53
|
// effect); call once per WgpuRenderState before drawWgpuScene3D so meshes with ToonMaterials draw.
|
|
54
|
-
export function
|
|
54
|
+
export function registerWgpuToonMaterial(state) {
|
|
55
55
|
registerWgpuBitmapTextureResolver(state);
|
|
56
56
|
registerWgpuImageTextureResolver(state);
|
|
57
57
|
registerWgpuMeshMaterialRenderer(state, ToonMaterialKind, toonWgpuMeshMaterialRenderer);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMeshMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
2
|
export declare const unlitWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerWgpuUnlitMaterial(state: WgpuRenderState): void;
|
|
4
4
|
//# sourceMappingURL=unlitWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -7,7 +7,7 @@ import { bindWgpuUnlitSurface, ensureWgpuUnlitPipeline } from './wgpuUnlitPrelud
|
|
|
7
7
|
// The built-in Unlit forward renderer (WgpuMeshMaterialRenderer for UnlitMaterialKind) — the WGSL
|
|
8
8
|
// mirror of unlitGlMeshMaterialRenderer. Lighting-independent flat color: bind selects the unlit
|
|
9
9
|
// pipeline variant for the alpha mode + color format, writes the shared Frame uniform (lights ignored),
|
|
10
|
-
// and binds the linear base color; draw issues the indexed draw. See
|
|
10
|
+
// and binds the linear base color; draw issues the indexed draw. See registerWgpuUnlitMaterial.
|
|
11
11
|
export const unlitWgpuMeshMaterialRenderer = {
|
|
12
12
|
bind(state, material, _lights, camera) {
|
|
13
13
|
const stateRuntime = getWgpuRenderStateRuntime(state);
|
|
@@ -35,7 +35,7 @@ export const unlitWgpuMeshMaterialRenderer = {
|
|
|
35
35
|
};
|
|
36
36
|
// Registers the built-in Unlit renderer for UnlitMaterialKind on this state. Opt-in (no top-level side
|
|
37
37
|
// effect); call once per WgpuRenderState before drawWgpuScene3D so meshes with UnlitMaterials draw.
|
|
38
|
-
export function
|
|
38
|
+
export function registerWgpuUnlitMaterial(state) {
|
|
39
39
|
registerWgpuBitmapTextureResolver(state);
|
|
40
40
|
registerWgpuImageTextureResolver(state);
|
|
41
41
|
registerWgpuRenderTextureResolver(state);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMeshMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
2
|
export declare const vertexColorWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerWgpuVertexColorMaterial(state: WgpuRenderState): void;
|
|
4
4
|
//# sourceMappingURL=vertexColorWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -8,7 +8,7 @@ import { bindWgpuUnlitSurface, ensureWgpuUnlitPipeline } from './wgpuUnlitPrelud
|
|
|
8
8
|
// the WGSL mirror of vertexColorGlMeshMaterialRenderer. Lighting-independent: renders the material's
|
|
9
9
|
// linear tint through the shared unlit pipeline. The canonical 48-byte vertex layout has no color0
|
|
10
10
|
// slot on wgpu, so (unlike the GL path) the mesh color0 attribute is not yet multiplied in — the tint
|
|
11
|
-
// alone drives the surface until color0 vertex support lands. See
|
|
11
|
+
// alone drives the surface until color0 vertex support lands. See registerWgpuVertexColorMaterial.
|
|
12
12
|
export const vertexColorWgpuMeshMaterialRenderer = {
|
|
13
13
|
bind(state, material, _lights, camera) {
|
|
14
14
|
const stateRuntime = getWgpuRenderStateRuntime(state);
|
|
@@ -39,7 +39,7 @@ export const vertexColorWgpuMeshMaterialRenderer = {
|
|
|
39
39
|
// Registers the built-in VertexColor renderer for VertexColorMaterialKind on this state. Opt-in (no
|
|
40
40
|
// top-level side effect); call once per WgpuRenderState before drawWgpuScene3D so meshes with
|
|
41
41
|
// VertexColorMaterials draw.
|
|
42
|
-
export function
|
|
42
|
+
export function registerWgpuVertexColorMaterial(state) {
|
|
43
43
|
registerWgpuMeshMaterialRenderer(state, VertexColorMaterialKind, vertexColorWgpuMeshMaterialRenderer);
|
|
44
44
|
}
|
|
45
45
|
function defineKeyForMaterial(material) {
|
|
@@ -8,7 +8,7 @@ export function getWgpuMeshMaterialRenderer(state, kind) {
|
|
|
8
8
|
}
|
|
9
9
|
// Registers a 3D mesh-material renderer against a material kind on this state. Opt-in: drawScene3D only
|
|
10
10
|
// draws subsets whose material kind (or StandardMaterialKind) has a renderer here. Call
|
|
11
|
-
//
|
|
11
|
+
// registerWgpuStandardPbrMaterial for the built-in StandardPbr path. Mirrors registerWgpuMaterialRenderer
|
|
12
12
|
// but writes scene-wgpu's separate 3D registry.
|
|
13
13
|
export function registerWgpuMeshMaterialRenderer(state, kind, renderer) {
|
|
14
14
|
getWgpuScene3DRuntime(state).materialRegistry.set(kind, renderer);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { WgpuMeshMaterialRenderer, WgpuRenderState } from '@flighthq/types/contract';
|
|
2
2
|
export declare const wireframeWgpuMeshMaterialRenderer: WgpuMeshMaterialRenderer;
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerWgpuWireframeMaterial(state: WgpuRenderState): void;
|
|
4
4
|
//# sourceMappingURL=wireframeWgpuMeshMaterialRenderer.d.ts.map
|
|
@@ -12,7 +12,7 @@ import { ensureWgpuWireframeUpload } from './wgpuWireframeUpload';
|
|
|
12
12
|
// drawWgpuMeshSubset: draw binds the derived line-index buffer (see wgpuWireframeUpload) and issues a
|
|
13
13
|
// line-list indexed draw over the subset's line range. `thickness` > 1 is not honored (WebGPU has no
|
|
14
14
|
// line-width control); the field is documented as best-effort and ignored. Lights are ignored. See
|
|
15
|
-
//
|
|
15
|
+
// registerWgpuWireframeMaterial to install it.
|
|
16
16
|
export const wireframeWgpuMeshMaterialRenderer = {
|
|
17
17
|
bind(state, material, _lights, camera) {
|
|
18
18
|
const stateRuntime = getWgpuRenderStateRuntime(state);
|
|
@@ -59,7 +59,7 @@ export const wireframeWgpuMeshMaterialRenderer = {
|
|
|
59
59
|
// Registers the built-in Wireframe renderer for WireframeMaterialKind on this state. Opt-in (no top-
|
|
60
60
|
// level side effect); call once per WgpuRenderState before drawWgpuScene3D so meshes with
|
|
61
61
|
// WireframeMaterials draw.
|
|
62
|
-
export function
|
|
62
|
+
export function registerWgpuWireframeMaterial(state) {
|
|
63
63
|
registerWgpuMeshMaterialRenderer(state, WireframeMaterialKind, wireframeWgpuMeshMaterialRenderer);
|
|
64
64
|
}
|
|
65
65
|
const _scratch = [0, 0, 0, 0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/scene3d-wgpu",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.1392.f0bd0cc",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/flighthq/flight.git",
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@flighthq/camera": "0.3.0-next.
|
|
40
|
-
"@flighthq/color": "0.3.0-next.
|
|
41
|
-
"@flighthq/geometry": "0.3.0-next.
|
|
42
|
-
"@flighthq/image": "0.3.0-next.
|
|
43
|
-
"@flighthq/lighting": "0.3.0-next.
|
|
44
|
-
"@flighthq/log": "0.3.0-next.
|
|
45
|
-
"@flighthq/materials": "0.3.0-next.
|
|
46
|
-
"@flighthq/node": "0.3.0-next.
|
|
47
|
-
"@flighthq/render": "0.3.0-next.
|
|
48
|
-
"@flighthq/render-wgpu": "0.3.0-next.
|
|
49
|
-
"@flighthq/scene3d": "0.3.0-next.
|
|
50
|
-
"@flighthq/shading": "0.3.0-next.
|
|
51
|
-
"@flighthq/texture": "0.3.0-next.
|
|
52
|
-
"@flighthq/types": "0.3.0-next.
|
|
39
|
+
"@flighthq/camera": "0.3.0-next.1392.f0bd0cc",
|
|
40
|
+
"@flighthq/color": "0.3.0-next.1392.f0bd0cc",
|
|
41
|
+
"@flighthq/geometry": "0.3.0-next.1392.f0bd0cc",
|
|
42
|
+
"@flighthq/image": "0.3.0-next.1392.f0bd0cc",
|
|
43
|
+
"@flighthq/lighting": "0.3.0-next.1392.f0bd0cc",
|
|
44
|
+
"@flighthq/log": "0.3.0-next.1392.f0bd0cc",
|
|
45
|
+
"@flighthq/materials": "0.3.0-next.1392.f0bd0cc",
|
|
46
|
+
"@flighthq/node": "0.3.0-next.1392.f0bd0cc",
|
|
47
|
+
"@flighthq/render": "0.3.0-next.1392.f0bd0cc",
|
|
48
|
+
"@flighthq/render-wgpu": "0.3.0-next.1392.f0bd0cc",
|
|
49
|
+
"@flighthq/scene3d": "0.3.0-next.1392.f0bd0cc",
|
|
50
|
+
"@flighthq/shading": "0.3.0-next.1392.f0bd0cc",
|
|
51
|
+
"@flighthq/texture": "0.3.0-next.1392.f0bd0cc",
|
|
52
|
+
"@flighthq/types": "0.3.0-next.1392.f0bd0cc"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@flighthq/mesh": "*",
|
|
@@ -7,7 +7,7 @@ import { BlinnPhongMaterialKind } from '@flighthq/types/contract';
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
blinnPhongWgpuMeshMaterialRenderer,
|
|
10
|
-
|
|
10
|
+
registerWgpuBlinnPhongMaterial,
|
|
11
11
|
} from './blinnPhongWgpuMeshMaterialRenderer';
|
|
12
12
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
13
13
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
@@ -73,10 +73,10 @@ describe('blinnPhongWgpuMeshMaterialRenderer', () => {
|
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
describe('
|
|
76
|
+
describe('registerWgpuBlinnPhongMaterial', () => {
|
|
77
77
|
it('installs the renderer for BlinnPhongMaterialKind', () => {
|
|
78
78
|
const { state } = makeWgpuScene3DState();
|
|
79
|
-
|
|
79
|
+
registerWgpuBlinnPhongMaterial(state);
|
|
80
80
|
expect(getWgpuMeshMaterialRenderer(state, BlinnPhongMaterialKind)).toBe(blinnPhongWgpuMeshMaterialRenderer);
|
|
81
81
|
});
|
|
82
82
|
});
|
|
@@ -10,7 +10,7 @@ import { CustomShaderMaterialKind, ImageTextureSourceKind } from '@flighthq/type
|
|
|
10
10
|
import {
|
|
11
11
|
customShaderWgpuMeshMaterialRenderer,
|
|
12
12
|
getWgpuCustomMaterialShaderSource,
|
|
13
|
-
|
|
13
|
+
registerWgpuCustomShaderMaterial,
|
|
14
14
|
registerWgpuCustomMaterialShader,
|
|
15
15
|
} from './customShaderWgpuMeshMaterialRenderer';
|
|
16
16
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
@@ -172,10 +172,13 @@ describe('customShaderWgpuMeshMaterialRenderer', () => {
|
|
|
172
172
|
});
|
|
173
173
|
|
|
174
174
|
function makeImageResource(version: number): Image {
|
|
175
|
+
const source = document.createElement('canvas');
|
|
176
|
+
source.width = 1;
|
|
177
|
+
source.height = 1;
|
|
175
178
|
return {
|
|
176
179
|
height: 1,
|
|
177
180
|
kind: ImageTextureSourceKind,
|
|
178
|
-
source
|
|
181
|
+
source,
|
|
179
182
|
version,
|
|
180
183
|
width: 1,
|
|
181
184
|
} as unknown as Image;
|
|
@@ -188,14 +191,6 @@ describe('getWgpuCustomMaterialShaderSource', () => {
|
|
|
188
191
|
});
|
|
189
192
|
});
|
|
190
193
|
|
|
191
|
-
describe('registerCustomShaderWgpuMaterial', () => {
|
|
192
|
-
it('installs the renderer for CustomShaderMaterialKind', () => {
|
|
193
|
-
const { state } = makeWgpuScene3DState();
|
|
194
|
-
registerCustomShaderWgpuMaterial(state);
|
|
195
|
-
expect(getWgpuMeshMaterialRenderer(state, CustomShaderMaterialKind)).toBe(customShaderWgpuMeshMaterialRenderer);
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
|
|
199
194
|
describe('registerWgpuCustomMaterialShader', () => {
|
|
200
195
|
it('registers WGSL by key with last-write-wins lookup', () => {
|
|
201
196
|
const { state } = makeWgpuScene3DState();
|
|
@@ -206,3 +201,11 @@ describe('registerWgpuCustomMaterialShader', () => {
|
|
|
206
201
|
expect(getWgpuCustomMaterialShaderSource(state, 'missing')).toBeNull();
|
|
207
202
|
});
|
|
208
203
|
});
|
|
204
|
+
|
|
205
|
+
describe('registerWgpuCustomShaderMaterial', () => {
|
|
206
|
+
it('installs the renderer for CustomShaderMaterialKind', () => {
|
|
207
|
+
const { state } = makeWgpuScene3DState();
|
|
208
|
+
registerWgpuCustomShaderMaterial(state);
|
|
209
|
+
expect(getWgpuMeshMaterialRenderer(state, CustomShaderMaterialKind)).toBe(customShaderWgpuMeshMaterialRenderer);
|
|
210
|
+
});
|
|
211
|
+
});
|
|
@@ -5,7 +5,7 @@ import { createBoxMeshGeometry } from '@flighthq/mesh/contract';
|
|
|
5
5
|
import type { Camera3D, Scene3DLightBlock, Scene3DRenderProxy } from '@flighthq/types/contract';
|
|
6
6
|
import { DepthMaterialKind } from '@flighthq/types/contract';
|
|
7
7
|
|
|
8
|
-
import { depthWgpuMeshMaterialRenderer,
|
|
8
|
+
import { depthWgpuMeshMaterialRenderer, registerWgpuDepthMaterial } from './depthWgpuMeshMaterialRenderer';
|
|
9
9
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
10
10
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
11
11
|
|
|
@@ -60,10 +60,10 @@ describe('depthWgpuMeshMaterialRenderer', () => {
|
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
describe('
|
|
63
|
+
describe('registerWgpuDepthMaterial', () => {
|
|
64
64
|
it('installs the renderer for DepthMaterialKind', () => {
|
|
65
65
|
const { state } = makeWgpuScene3DState();
|
|
66
|
-
|
|
66
|
+
registerWgpuDepthMaterial(state);
|
|
67
67
|
expect(getWgpuMeshMaterialRenderer(state, DepthMaterialKind)).toBe(depthWgpuMeshMaterialRenderer);
|
|
68
68
|
});
|
|
69
69
|
});
|
|
@@ -13,7 +13,7 @@ import { createMesh, createNode3D, Node3DKind } from '@flighthq/scene3d/contract
|
|
|
13
13
|
import type { Camera3D, ParticleEmitter3D, Scene3DLightsLike, Skeleton3D } from '@flighthq/types/contract';
|
|
14
14
|
|
|
15
15
|
import { drawWgpuScene3D, isWgpuMeshGpuSkinned } from './drawWgpuScene3D';
|
|
16
|
-
import {
|
|
16
|
+
import { registerWgpuStandardPbrMaterial } from './registerWgpuStandardPbrMaterial';
|
|
17
17
|
import { getWgpuScene3DRuntime } from './wgpuScene3DRuntime';
|
|
18
18
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
19
19
|
import { registerWgpuGpuSkinning } from './wgpuSkinPalette';
|
|
@@ -36,7 +36,7 @@ const LIGHTS: Scene3DLightsLike = {
|
|
|
36
36
|
describe('drawWgpuScene3D', () => {
|
|
37
37
|
it('draws each visible mesh subset with its registered material renderer', () => {
|
|
38
38
|
const { fake, state } = makeWgpuScene3DState();
|
|
39
|
-
|
|
39
|
+
registerWgpuStandardPbrMaterial(state);
|
|
40
40
|
|
|
41
41
|
const scene = createNode3D(Node3DKind);
|
|
42
42
|
const mesh = createMesh(createBoxMeshGeometry(), [createStandardPbrMaterial()]);
|
|
@@ -50,7 +50,7 @@ describe('drawWgpuScene3D', () => {
|
|
|
50
50
|
|
|
51
51
|
it('skips a subset whose material has no registered renderer (no fallback)', () => {
|
|
52
52
|
const { fake, state } = makeWgpuScene3DState();
|
|
53
|
-
// No
|
|
53
|
+
// No registerWgpuStandardPbrMaterial: nothing resolves.
|
|
54
54
|
const scene = createNode3D(Node3DKind);
|
|
55
55
|
const mesh = createMesh(createBoxMeshGeometry(), [createStandardPbrMaterial()]);
|
|
56
56
|
addNodeChild(scene, mesh);
|
|
@@ -61,7 +61,7 @@ describe('drawWgpuScene3D', () => {
|
|
|
61
61
|
|
|
62
62
|
it('binds once for a run of subsets sharing a material', () => {
|
|
63
63
|
const { fake, state } = makeWgpuScene3DState();
|
|
64
|
-
|
|
64
|
+
registerWgpuStandardPbrMaterial(state);
|
|
65
65
|
|
|
66
66
|
const scene = createNode3D(Node3DKind);
|
|
67
67
|
const material = createStandardPbrMaterial();
|
|
@@ -79,7 +79,7 @@ describe('drawWgpuScene3D', () => {
|
|
|
79
79
|
|
|
80
80
|
it('does not draw a disabled mesh', () => {
|
|
81
81
|
const { fake, state } = makeWgpuScene3DState();
|
|
82
|
-
|
|
82
|
+
registerWgpuStandardPbrMaterial(state);
|
|
83
83
|
|
|
84
84
|
const scene = createNode3D(Node3DKind);
|
|
85
85
|
const mesh = createMesh(createBoxMeshGeometry(), [createStandardPbrMaterial()]);
|
|
@@ -92,7 +92,7 @@ describe('drawWgpuScene3D', () => {
|
|
|
92
92
|
|
|
93
93
|
it('partitions opaque and blended subsets into distinct pipeline runs', () => {
|
|
94
94
|
const { state } = makeWgpuScene3DState();
|
|
95
|
-
|
|
95
|
+
registerWgpuStandardPbrMaterial(state);
|
|
96
96
|
const scene = createNode3D(Node3DKind);
|
|
97
97
|
const blendedMaterial = createStandardPbrMaterial();
|
|
98
98
|
blendedMaterial.alphaMode = 'blend';
|
|
@@ -112,7 +112,7 @@ describe('drawWgpuScene3D', () => {
|
|
|
112
112
|
|
|
113
113
|
it('routes resolved node alpha through the blended pass and draw proxy', () => {
|
|
114
114
|
const { state } = makeWgpuScene3DState();
|
|
115
|
-
|
|
115
|
+
registerWgpuStandardPbrMaterial(state);
|
|
116
116
|
const scene = createNode3D(Node3DKind);
|
|
117
117
|
const mesh = createMesh(createBoxMeshGeometry(), [createStandardPbrMaterial()]);
|
|
118
118
|
mesh.alpha = 0.5;
|
|
@@ -128,7 +128,7 @@ describe('drawWgpuScene3D', () => {
|
|
|
128
128
|
|
|
129
129
|
it('sorts blended subsets back-to-front by projected depth', () => {
|
|
130
130
|
const { state } = makeWgpuScene3DState();
|
|
131
|
-
|
|
131
|
+
registerWgpuStandardPbrMaterial(state);
|
|
132
132
|
const scene = createNode3D(Node3DKind);
|
|
133
133
|
const material = createStandardPbrMaterial();
|
|
134
134
|
material.alphaMode = 'blend';
|
|
@@ -148,7 +148,7 @@ describe('drawWgpuScene3D', () => {
|
|
|
148
148
|
|
|
149
149
|
it('sorts blended subsets back-to-front with an orthographic camera', () => {
|
|
150
150
|
const { state } = makeWgpuScene3DState();
|
|
151
|
-
|
|
151
|
+
registerWgpuStandardPbrMaterial(state);
|
|
152
152
|
const scene = createNode3D(Node3DKind);
|
|
153
153
|
const material = createStandardPbrMaterial();
|
|
154
154
|
material.alphaMode = 'blend';
|
|
@@ -172,7 +172,7 @@ describe('drawWgpuScene3D', () => {
|
|
|
172
172
|
|
|
173
173
|
it('reuses opaque and blended draw records across frames', () => {
|
|
174
174
|
const { state } = makeWgpuScene3DState();
|
|
175
|
-
|
|
175
|
+
registerWgpuStandardPbrMaterial(state);
|
|
176
176
|
const scene = createNode3D(Node3DKind);
|
|
177
177
|
const opaque = createMesh(createBoxMeshGeometry(), [createStandardPbrMaterial()]);
|
|
178
178
|
const material = createStandardPbrMaterial();
|
|
@@ -5,7 +5,7 @@ import { createBoxMeshGeometry } from '@flighthq/mesh/contract';
|
|
|
5
5
|
import type { Camera3D, Scene3DLightBlock, Scene3DRenderProxy } from '@flighthq/types/contract';
|
|
6
6
|
import { EmissiveMaterialKind } from '@flighthq/types/contract';
|
|
7
7
|
|
|
8
|
-
import { emissiveWgpuMeshMaterialRenderer,
|
|
8
|
+
import { emissiveWgpuMeshMaterialRenderer, registerWgpuEmissiveMaterial } from './emissiveWgpuMeshMaterialRenderer';
|
|
9
9
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
10
10
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
11
11
|
|
|
@@ -55,10 +55,10 @@ describe('emissiveWgpuMeshMaterialRenderer', () => {
|
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
describe('
|
|
58
|
+
describe('registerWgpuEmissiveMaterial', () => {
|
|
59
59
|
it('installs the renderer for EmissiveMaterialKind', () => {
|
|
60
60
|
const { state } = makeWgpuScene3DState();
|
|
61
|
-
|
|
61
|
+
registerWgpuEmissiveMaterial(state);
|
|
62
62
|
expect(getWgpuMeshMaterialRenderer(state, EmissiveMaterialKind)).toBe(emissiveWgpuMeshMaterialRenderer);
|
|
63
63
|
});
|
|
64
64
|
});
|
|
@@ -5,7 +5,7 @@ import { createBoxMeshGeometry } from '@flighthq/mesh/contract';
|
|
|
5
5
|
import type { Camera3D, Matrix3, Matrix4, Scene3DLightBlock, Scene3DRenderProxy } from '@flighthq/types/contract';
|
|
6
6
|
import { LambertMaterialKind } from '@flighthq/types/contract';
|
|
7
7
|
|
|
8
|
-
import { lambertWgpuMeshMaterialRenderer,
|
|
8
|
+
import { lambertWgpuMeshMaterialRenderer, registerWgpuLambertMaterial } from './lambertWgpuMeshMaterialRenderer';
|
|
9
9
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
10
10
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
11
11
|
|
|
@@ -68,10 +68,10 @@ describe('lambertWgpuMeshMaterialRenderer', () => {
|
|
|
68
68
|
});
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
describe('
|
|
71
|
+
describe('registerWgpuLambertMaterial', () => {
|
|
72
72
|
it('installs the renderer for LambertMaterialKind', () => {
|
|
73
73
|
const { state } = makeWgpuScene3DState();
|
|
74
|
-
|
|
74
|
+
registerWgpuLambertMaterial(state);
|
|
75
75
|
expect(getWgpuMeshMaterialRenderer(state, LambertMaterialKind)).toBe(lambertWgpuMeshMaterialRenderer);
|
|
76
76
|
});
|
|
77
77
|
});
|
|
@@ -5,7 +5,7 @@ import { createBoxMeshGeometry } from '@flighthq/mesh/contract';
|
|
|
5
5
|
import type { Camera3D, Scene3DLightBlock, Scene3DRenderProxy } from '@flighthq/types/contract';
|
|
6
6
|
import { MatcapMaterialKind } from '@flighthq/types/contract';
|
|
7
7
|
|
|
8
|
-
import { matcapWgpuMeshMaterialRenderer,
|
|
8
|
+
import { matcapWgpuMeshMaterialRenderer, registerWgpuMatcapMaterial } from './matcapWgpuMeshMaterialRenderer';
|
|
9
9
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
10
10
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
11
11
|
|
|
@@ -60,10 +60,10 @@ describe('matcapWgpuMeshMaterialRenderer', () => {
|
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
describe('
|
|
63
|
+
describe('registerWgpuMatcapMaterial', () => {
|
|
64
64
|
it('installs the renderer for MatcapMaterialKind', () => {
|
|
65
65
|
const { state } = makeWgpuScene3DState();
|
|
66
|
-
|
|
66
|
+
registerWgpuMatcapMaterial(state);
|
|
67
67
|
expect(getWgpuMeshMaterialRenderer(state, MatcapMaterialKind)).toBe(matcapWgpuMeshMaterialRenderer);
|
|
68
68
|
});
|
|
69
69
|
});
|
|
@@ -5,7 +5,7 @@ import { createBoxMeshGeometry } from '@flighthq/mesh/contract';
|
|
|
5
5
|
import type { Camera3D, Scene3DLightBlock, Scene3DRenderProxy } from '@flighthq/types/contract';
|
|
6
6
|
import { NormalMaterialKind } from '@flighthq/types/contract';
|
|
7
7
|
|
|
8
|
-
import { normalWgpuMeshMaterialRenderer,
|
|
8
|
+
import { normalWgpuMeshMaterialRenderer, registerWgpuNormalMaterial } from './normalWgpuMeshMaterialRenderer';
|
|
9
9
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
10
10
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
11
11
|
|
|
@@ -60,10 +60,10 @@ describe('normalWgpuMeshMaterialRenderer', () => {
|
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
describe('
|
|
63
|
+
describe('registerWgpuNormalMaterial', () => {
|
|
64
64
|
it('installs the renderer for NormalMaterialKind', () => {
|
|
65
65
|
const { state } = makeWgpuScene3DState();
|
|
66
|
-
|
|
66
|
+
registerWgpuNormalMaterial(state);
|
|
67
67
|
expect(getWgpuMeshMaterialRenderer(state, NormalMaterialKind)).toBe(normalWgpuMeshMaterialRenderer);
|
|
68
68
|
});
|
|
69
69
|
});
|
|
@@ -5,7 +5,7 @@ import { createBoxMeshGeometry } from '@flighthq/mesh/contract';
|
|
|
5
5
|
import type { Camera3D, Matrix3, Matrix4, Scene3DLightBlock, Scene3DRenderProxy } from '@flighthq/types/contract';
|
|
6
6
|
import { PhongMaterialKind } from '@flighthq/types/contract';
|
|
7
7
|
|
|
8
|
-
import { phongWgpuMeshMaterialRenderer,
|
|
8
|
+
import { phongWgpuMeshMaterialRenderer, registerWgpuPhongMaterial } from './phongWgpuMeshMaterialRenderer';
|
|
9
9
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
10
10
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
11
11
|
|
|
@@ -70,10 +70,10 @@ describe('phongWgpuMeshMaterialRenderer', () => {
|
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
describe('
|
|
73
|
+
describe('registerWgpuPhongMaterial', () => {
|
|
74
74
|
it('installs the renderer for PhongMaterialKind', () => {
|
|
75
75
|
const { state } = makeWgpuScene3DState();
|
|
76
|
-
|
|
76
|
+
registerWgpuPhongMaterial(state);
|
|
77
77
|
expect(getWgpuMeshMaterialRenderer(state, PhongMaterialKind)).toBe(phongWgpuMeshMaterialRenderer);
|
|
78
78
|
});
|
|
79
79
|
});
|
package/src/{registerStandardPbrWgpuMaterial.test.ts → registerWgpuStandardPbrMaterial.test.ts}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { StandardPbrMaterialKind } from '@flighthq/types/contract';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { registerWgpuStandardPbrMaterial } from './registerWgpuStandardPbrMaterial';
|
|
4
4
|
import { standardPbrWgpuMeshMaterialRenderer } from './standardPbrWgpuMeshMaterialRenderer';
|
|
5
5
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
6
6
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
7
7
|
|
|
8
|
-
describe('
|
|
8
|
+
describe('registerWgpuStandardPbrMaterial', () => {
|
|
9
9
|
it('registers the StandardPbr renderer for StandardPbrMaterialKind', () => {
|
|
10
10
|
const { state } = makeWgpuScene3DState();
|
|
11
11
|
expect(getWgpuMeshMaterialRenderer(state, StandardPbrMaterialKind)).toBeNull();
|
|
12
|
-
|
|
12
|
+
registerWgpuStandardPbrMaterial(state);
|
|
13
13
|
expect(getWgpuMeshMaterialRenderer(state, StandardPbrMaterialKind)).toBe(standardPbrWgpuMeshMaterialRenderer);
|
|
14
14
|
});
|
|
15
15
|
});
|
|
@@ -5,7 +5,7 @@ import { ShadedMaterialKind } from '@flighthq/types/contract';
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
getWgpuShadedBaseFlags,
|
|
8
|
-
|
|
8
|
+
registerWgpuShadedMaterial,
|
|
9
9
|
shadedWgpuMeshMaterialRenderer,
|
|
10
10
|
} from './shadedWgpuMeshMaterialRenderer';
|
|
11
11
|
|
|
@@ -26,10 +26,10 @@ describe('getWgpuShadedBaseFlags', () => {
|
|
|
26
26
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
27
27
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
28
28
|
|
|
29
|
-
describe('
|
|
29
|
+
describe('registerWgpuShadedMaterial', () => {
|
|
30
30
|
it('installs the renderer for ShadedMaterialKind', () => {
|
|
31
31
|
const { state } = makeWgpuScene3DState();
|
|
32
|
-
|
|
32
|
+
registerWgpuShadedMaterial(state);
|
|
33
33
|
expect(getWgpuMeshMaterialRenderer(state, ShadedMaterialKind)).toBe(shadedWgpuMeshMaterialRenderer);
|
|
34
34
|
});
|
|
35
35
|
});
|
|
@@ -6,7 +6,7 @@ import type { Camera3D, Matrix3, Matrix4, Scene3DLightBlock, Scene3DRenderProxy
|
|
|
6
6
|
import { SpecularGlossinessPbrMaterialKind } from '@flighthq/types/contract';
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
|
-
|
|
9
|
+
registerWgpuSpecularGlossinessPbrMaterial,
|
|
10
10
|
specularGlossinessPbrWgpuMeshMaterialRenderer,
|
|
11
11
|
} from './specularGlossinessPbrWgpuMeshMaterialRenderer';
|
|
12
12
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
@@ -38,10 +38,10 @@ function makeProxy(): Scene3DRenderProxy {
|
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
describe('
|
|
41
|
+
describe('registerWgpuSpecularGlossinessPbrMaterial', () => {
|
|
42
42
|
it('installs the renderer for SpecularGlossinessPbrMaterialKind', () => {
|
|
43
43
|
const { state } = makeWgpuScene3DState();
|
|
44
|
-
|
|
44
|
+
registerWgpuSpecularGlossinessPbrMaterial(state);
|
|
45
45
|
expect(getWgpuMeshMaterialRenderer(state, SpecularGlossinessPbrMaterialKind)).toBe(
|
|
46
46
|
specularGlossinessPbrWgpuMeshMaterialRenderer,
|
|
47
47
|
);
|
|
@@ -5,7 +5,7 @@ import { createBoxMeshGeometry } from '@flighthq/mesh/contract';
|
|
|
5
5
|
import type { Camera3D, Matrix3, Matrix4, Scene3DLightBlock, Scene3DRenderProxy } from '@flighthq/types/contract';
|
|
6
6
|
import { ToonMaterialKind } from '@flighthq/types/contract';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { registerWgpuToonMaterial, toonWgpuMeshMaterialRenderer } from './toonWgpuMeshMaterialRenderer';
|
|
9
9
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
10
10
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
11
11
|
|
|
@@ -37,10 +37,10 @@ function makeProxy(): Scene3DRenderProxy {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
describe('
|
|
40
|
+
describe('registerWgpuToonMaterial', () => {
|
|
41
41
|
it('installs the toon renderer for ToonMaterialKind', () => {
|
|
42
42
|
const { state } = makeWgpuScene3DState();
|
|
43
|
-
|
|
43
|
+
registerWgpuToonMaterial(state);
|
|
44
44
|
expect(getWgpuMeshMaterialRenderer(state, ToonMaterialKind)).toBe(toonWgpuMeshMaterialRenderer);
|
|
45
45
|
});
|
|
46
46
|
});
|
|
@@ -7,7 +7,7 @@ import { advanceVideoTexture, createVideoTexture } from '@flighthq/texture/contr
|
|
|
7
7
|
import type { Camera3D, Scene3DLightBlock, Scene3DRenderProxy } from '@flighthq/types/contract';
|
|
8
8
|
import { UnlitMaterialKind } from '@flighthq/types/contract';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { registerWgpuUnlitMaterial, unlitWgpuMeshMaterialRenderer } from './unlitWgpuMeshMaterialRenderer';
|
|
11
11
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
12
12
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
13
13
|
|
|
@@ -35,10 +35,10 @@ function makeProxy(): Scene3DRenderProxy {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
describe('
|
|
38
|
+
describe('registerWgpuUnlitMaterial', () => {
|
|
39
39
|
it('installs the renderer for UnlitMaterialKind', () => {
|
|
40
40
|
const { state } = makeWgpuScene3DState();
|
|
41
|
-
|
|
41
|
+
registerWgpuUnlitMaterial(state);
|
|
42
42
|
expect(getWgpuMeshMaterialRenderer(state, UnlitMaterialKind)).toBe(unlitWgpuMeshMaterialRenderer);
|
|
43
43
|
});
|
|
44
44
|
});
|
|
@@ -55,8 +55,14 @@ describe('unlitWgpuMeshMaterialRenderer', () => {
|
|
|
55
55
|
it('uploads a ready dynamic video map into the color-map slot', () => {
|
|
56
56
|
const { fake, state } = makeWgpuScene3DState();
|
|
57
57
|
const material = createUnlitMaterial();
|
|
58
|
+
const element = document.createElement('video');
|
|
59
|
+
Object.defineProperties(element, {
|
|
60
|
+
readyState: { value: 4 },
|
|
61
|
+
videoHeight: { value: 120 },
|
|
62
|
+
videoWidth: { value: 160 },
|
|
63
|
+
});
|
|
58
64
|
material.baseColorMap = createVideoTexture({
|
|
59
|
-
element
|
|
65
|
+
element,
|
|
60
66
|
objectUrl: null,
|
|
61
67
|
});
|
|
62
68
|
advanceVideoTexture(material.baseColorMap);
|
|
@@ -6,7 +6,7 @@ import type { Camera3D, Scene3DLightBlock, Scene3DRenderProxy } from '@flighthq/
|
|
|
6
6
|
import { VertexColorMaterialKind } from '@flighthq/types/contract';
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
|
-
|
|
9
|
+
registerWgpuVertexColorMaterial,
|
|
10
10
|
vertexColorWgpuMeshMaterialRenderer,
|
|
11
11
|
} from './vertexColorWgpuMeshMaterialRenderer';
|
|
12
12
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
@@ -36,10 +36,10 @@ function makeProxy(): Scene3DRenderProxy {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
describe('
|
|
39
|
+
describe('registerWgpuVertexColorMaterial', () => {
|
|
40
40
|
it('installs the renderer for VertexColorMaterialKind', () => {
|
|
41
41
|
const { state } = makeWgpuScene3DState();
|
|
42
|
-
|
|
42
|
+
registerWgpuVertexColorMaterial(state);
|
|
43
43
|
expect(getWgpuMeshMaterialRenderer(state, VertexColorMaterialKind)).toBe(vertexColorWgpuMeshMaterialRenderer);
|
|
44
44
|
});
|
|
45
45
|
});
|
|
@@ -10,10 +10,13 @@ import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
|
10
10
|
// and the "no complete cube" sentinel path callers depend on to no-op — mirroring scene-gl's cube test.
|
|
11
11
|
|
|
12
12
|
function completeEnvironment(): Environment {
|
|
13
|
+
const source = document.createElement('canvas');
|
|
14
|
+
source.width = 4;
|
|
15
|
+
source.height = 4;
|
|
13
16
|
const face = {
|
|
14
17
|
height: 4,
|
|
15
18
|
kind: ImageTextureSourceKind,
|
|
16
|
-
source
|
|
19
|
+
source,
|
|
17
20
|
width: 4,
|
|
18
21
|
} as unknown as Image;
|
|
19
22
|
const cube = {
|
|
@@ -11,10 +11,13 @@ import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
|
11
11
|
// scene-gl's bake test.
|
|
12
12
|
|
|
13
13
|
function completeEnvironment(): Environment {
|
|
14
|
+
const source = document.createElement('canvas');
|
|
15
|
+
source.width = 4;
|
|
16
|
+
source.height = 4;
|
|
14
17
|
const face = {
|
|
15
18
|
height: 4,
|
|
16
19
|
kind: ImageTextureSourceKind,
|
|
17
|
-
source
|
|
20
|
+
source,
|
|
18
21
|
width: 4,
|
|
19
22
|
} as unknown as Image;
|
|
20
23
|
const cube = {
|
|
@@ -14,10 +14,13 @@ function makeCamera(): Camera3D {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function completeEnvironment(): Environment {
|
|
17
|
+
const source = document.createElement('canvas');
|
|
18
|
+
source.width = 4;
|
|
19
|
+
source.height = 4;
|
|
17
20
|
const face = {
|
|
18
21
|
height: 4,
|
|
19
22
|
kind: ImageTextureSourceKind,
|
|
20
|
-
source
|
|
23
|
+
source,
|
|
21
24
|
width: 4,
|
|
22
25
|
} as unknown as Image;
|
|
23
26
|
const cube = {
|
|
@@ -428,10 +428,13 @@ describe('shaded binding cache', () => {
|
|
|
428
428
|
});
|
|
429
429
|
|
|
430
430
|
function makeImageResource(): Image {
|
|
431
|
+
const source = document.createElement('canvas');
|
|
432
|
+
source.width = 1;
|
|
433
|
+
source.height = 1;
|
|
431
434
|
return {
|
|
432
435
|
height: 1,
|
|
433
436
|
kind: ImageTextureSourceKind,
|
|
434
|
-
source
|
|
437
|
+
source,
|
|
435
438
|
version: 0,
|
|
436
439
|
width: 1,
|
|
437
440
|
} as unknown as Image;
|
|
@@ -9,7 +9,7 @@ import { createMesh, createNode3D, Node3DKind } from '@flighthq/scene3d/contract
|
|
|
9
9
|
import type { Camera3D, Scene3DLightsLike, Node3D } from '@flighthq/types/contract';
|
|
10
10
|
|
|
11
11
|
import { drawWgpuScene3D } from './drawWgpuScene3D';
|
|
12
|
-
import {
|
|
12
|
+
import { registerWgpuStandardPbrMaterial } from './registerWgpuStandardPbrMaterial';
|
|
13
13
|
import { buildWgpuPbrStandardDefineKey } from './standardPbrWgpuMeshMaterialRenderer';
|
|
14
14
|
import { getWgpuClassicModuleSourceForKey } from './wgpuClassicPrelude';
|
|
15
15
|
import { getWgpuPbrModuleSourceForKey } from './wgpuPbrPrelude';
|
|
@@ -123,7 +123,7 @@ describe('drawWgpuScene3DShadowMap', () => {
|
|
|
123
123
|
|
|
124
124
|
it('binds a group(3) shadow group on the lit PBR draw that follows', () => {
|
|
125
125
|
const { fake, state } = makeWgpuScene3DState();
|
|
126
|
-
|
|
126
|
+
registerWgpuStandardPbrMaterial(state);
|
|
127
127
|
drawWgpuScene3DShadowMap(state, makeShadowScene3D(), makeShadowCamera());
|
|
128
128
|
|
|
129
129
|
const scene = createNode3D(Node3DKind);
|
|
@@ -33,8 +33,14 @@ describe('bindWgpuUnlitVideoSurface', () => {
|
|
|
33
33
|
it('uploads the ready video frame into the same unlit material layout', () => {
|
|
34
34
|
const { fake, state } = makeWgpuScene3DState();
|
|
35
35
|
const pipeline = compileWgpuUnlitPipeline(state, { ...FLAT, hasColorMap: true }, 'bgra8unorm');
|
|
36
|
+
const element = document.createElement('video');
|
|
37
|
+
Object.defineProperties(element, {
|
|
38
|
+
readyState: { value: 4 },
|
|
39
|
+
videoHeight: { value: 120 },
|
|
40
|
+
videoWidth: { value: 160 },
|
|
41
|
+
});
|
|
36
42
|
const video = createVideoTexture({
|
|
37
|
-
element
|
|
43
|
+
element,
|
|
38
44
|
objectUrl: null,
|
|
39
45
|
});
|
|
40
46
|
advanceVideoTexture(video);
|
|
@@ -7,7 +7,7 @@ import { WireframeMaterialKind } from '@flighthq/types/contract';
|
|
|
7
7
|
|
|
8
8
|
import { getWgpuMeshMaterialRenderer } from './wgpuMeshMaterialRegistry';
|
|
9
9
|
import { makeWgpuScene3DState } from './wgpuScene3DTestHelper';
|
|
10
|
-
import {
|
|
10
|
+
import { registerWgpuWireframeMaterial, wireframeWgpuMeshMaterialRenderer } from './wireframeWgpuMeshMaterialRenderer';
|
|
11
11
|
|
|
12
12
|
function makeCamera(): Camera3D {
|
|
13
13
|
return createCamera3D({ far: 100, near: 0.1, projection: { aspect: 1, fovY: Math.PI / 3, kind: 'perspective' } });
|
|
@@ -33,10 +33,10 @@ function makeProxy(): Scene3DRenderProxy {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
describe('
|
|
36
|
+
describe('registerWgpuWireframeMaterial', () => {
|
|
37
37
|
it('installs the renderer for WireframeMaterialKind', () => {
|
|
38
38
|
const { state } = makeWgpuScene3DState();
|
|
39
|
-
|
|
39
|
+
registerWgpuWireframeMaterial(state);
|
|
40
40
|
expect(getWgpuMeshMaterialRenderer(state, WireframeMaterialKind)).toBe(wireframeWgpuMeshMaterialRenderer);
|
|
41
41
|
});
|
|
42
42
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registerStandardPbrWgpuMaterial.d.ts","sourceRoot":"","sources":["../src/registerStandardPbrWgpuMaterial.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAUhE,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAI5E"}
|