Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KTX2Exporter: Add support for WebGPURenderer. #1243

Merged
merged 4 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ index 40a62fb1..cb9d3f59 100644
save(new Blob([buffer], { type: 'application/octet-stream' }), filename);
}
diff --git a/examples-testing/examples/misc_exporter_exr.ts b/examples-testing/examples/misc_exporter_exr.ts
index c239a65f..1b774b55 100644
index f4a189bb..1cd5fb27 100644
--- a/examples-testing/examples/misc_exporter_exr.ts
+++ b/examples-testing/examples/misc_exporter_exr.ts
@@ -5,7 +5,14 @@ import { EXRExporter, ZIP_COMPRESSION, ZIPS_COMPRESSION, NO_COMPRESSION } from '
Expand All @@ -1138,7 +1138,7 @@ index c239a65f..1b774b55 100644

const params = {
target: 'pmrem',
@@ -148,7 +155,7 @@ function exportFile() {
@@ -148,7 +155,7 @@ async function exportFile() {
saveArrayBuffer(result, params.target + '.exr');
}

Expand Down Expand Up @@ -12749,7 +12749,7 @@ index 1ad6d264..10b32582 100644
renderer.render(scene, camera);
}
diff --git a/examples-testing/examples/webgl_tonemapping.ts b/examples-testing/examples/webgl_tonemapping.ts
index 08115cf3..f68d7a8d 100644
index 9945826c..db817304 100644
--- a/examples-testing/examples/webgl_tonemapping.ts
+++ b/examples-testing/examples/webgl_tonemapping.ts
@@ -1,22 +1,35 @@
Expand Down Expand Up @@ -12804,23 +12804,29 @@ index 08115cf3..f68d7a8d 100644

render();
@@ -99,7 +112,7 @@ async function init() {
const toneMappingFolder = gui.addFolder('tone mapping');
const toneMappingFolder = gui.addFolder('Tone Mapping');

toneMappingFolder
- .add(params, 'toneMapping', Object.keys(toneMappingOptions))
+ .add(params, 'toneMapping', Object.keys(toneMappingOptions) as ToneMapping[])

.name('type')
.onChange(function () {
updateGUI(toneMappingFolder);
@@ -131,7 +144,7 @@ async function init() {
@@ -140,11 +153,11 @@ async function init() {
gui.open();
}

-function updateGUI(folder) {
+function updateGUI(folder: GUI) {
if (guiExposure !== null) {
guiExposure.destroy();
guiExposure = null;
if (params.toneMapping === 'None') {
- guiExposure.hide();
+ guiExposure!.hide();
} else {
- guiExposure.show();
+ guiExposure!.show();
}
}

diff --git a/examples-testing/examples/webgl_ubo.ts b/examples-testing/examples/webgl_ubo.ts
index 01064f11..814edd87 100644
--- a/examples-testing/examples/webgl_ubo.ts
Expand Down
3 changes: 2 additions & 1 deletion types/three/examples/jsm/exporters/EXRExporter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { DataTexture, TextureDataType, WebGLRenderer, WebGLRenderTarget } from "three";
import { WebGPURenderer } from "three/webgpu";

export const NO_COMPRESSION: 0;
export const ZIPS_COMPRESSION: 2;
Expand All @@ -18,7 +19,7 @@ export interface EXRExporterParseOptions {

export class EXRExporter {
parse(
renderer: WebGLRenderer,
renderer: WebGLRenderer | WebGPURenderer,
renderTarget: WebGLRenderTarget,
options?: EXRExporterParseOptions,
): Promise<Uint8Array>;
Expand Down
4 changes: 3 additions & 1 deletion types/three/examples/jsm/exporters/KTX2Exporter.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Data3DTexture, DataTexture, WebGLRenderer, WebGLRenderTarget } from "three";
import { WebGPURenderer } from "three/webgpu";

export class KTX2Exporter {
parse(arg1: Data3DTexture | DataTexture | WebGLRenderer, arg2?: WebGLRenderTarget): Uint8Array;
parse(renderer: WebGLRenderer | WebGPURenderer, rtt?: WebGLRenderTarget): Promise<Uint8Array>;
parse(texture: Data3DTexture | DataTexture): Promise<Uint8Array>;
}
Loading