Skip to content

Commit

Permalink
WebGPURenderer: support using 3d textures (#976)
Browse files Browse the repository at this point in the history
* WebGPURenderer: support using 3d textures

* Update three.js

* Add examples

* Update

* Fix
  • Loading branch information
Methuselah96 authored May 23, 2024
1 parent db87d87 commit 04ef205
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 3 deletions.
2 changes: 2 additions & 0 deletions examples-testing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ const exceptionList = [
'webgpu_multisampled_renderbuffers',
'webgpu_storage_buffer',
'webgpu_texturegrad',
'webgpu_volume_cloud',
'webgpu_volume_perlin',
'webxr_vr_handinput_cubes',
'webxr_vr_handinput_profiles',
'webxr_vr_handinput_pointerclick',
Expand Down
2 changes: 1 addition & 1 deletion three.js
1 change: 1 addition & 0 deletions types/three/examples/jsm/nodes/Nodes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export { default as RendererReferenceNode, rendererReference } from "./accessors
export { default as SkinningNode, skinning } from "./accessors/SkinningNode.js";
export { default as StorageBufferNode, storage, storageObject } from "./accessors/StorageBufferNode.js";
export * from "./accessors/TangentNode.js";
export { default as Texture3DNode } from "./accessors/Texture3DNode.js";
export { default as TextureBicubicNode, textureBicubic } from "./accessors/TextureBicubicNode.js";
export { default as TextureNode, sampler, texture } from "./accessors/TextureNode.js";
export { default as UniformsNode, uniforms } from "./accessors/UniformsNode.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class CubeTextureNode extends TextureNode {
uvNode: ShaderNodeObject<Node> | null;
levelNode: ShaderNodeObject<Node> | null;

constructor(value: CubeTexture, uvNode?: Node | null, levelNode?: Node | null);
constructor(value: CubeTexture, uvNode?: ShaderNodeObject<Node> | null, levelNode?: ShaderNodeObject<Node> | null);

getDefaultUV(): Node;
}
Expand Down
16 changes: 16 additions & 0 deletions types/three/examples/jsm/nodes/accessors/Texture3DNode.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { CubeTexture, Texture } from "three";
import Node from "../core/Node.js";
import { NodeRepresentation, ShaderNodeObject } from "../shadernode/ShaderNode.js";
import TextureNode from "./TextureNode.js";

export default class Texture3DNode extends TextureNode {
readonly isTexture3DNode: true;

constructor(value: Texture, uvNode?: ShaderNodeObject<Node> | null, levelNode?: ShaderNodeObject<Node> | null);
}

export const texture3D: (
value: CubeTexture,
uvNode?: NodeRepresentation,
levelNode?: NodeRepresentation,
) => ShaderNodeObject<Texture3DNode>;
2 changes: 1 addition & 1 deletion types/three/examples/jsm/nodes/accessors/TextureNode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class TextureNode extends UniformNode<Texture> {

referenceNode: Node | null;

constructor(value: Texture, uvNode?: ShaderNodeObject<Node>, levelNode?: ShaderNodeObject<Node> | null);
constructor(value: Texture, uvNode?: ShaderNodeObject<Node> | null, levelNode?: ShaderNodeObject<Node> | null);

getDefaultUV(): Node;

Expand Down
1 change: 1 addition & 0 deletions types/three/examples/jsm/nodes/materials/Materials.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export { default as NodeMaterial } from "./NodeMaterial.js";
export { default as PointsNodeMaterial } from "./PointsNodeMaterial.js";
export { default as ShadowNodeMaterial } from "./ShadowNodeMaterial.js";
export { default as SpriteNodeMaterial } from "./SpriteNodeMaterial.js";
export { default as VolumeNodeMaterial } from "./VolumeNodeMaterial.js";
10 changes: 10 additions & 0 deletions types/three/examples/jsm/nodes/materials/VolumeNodeMaterial.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Node from "../core/Node.js";
import NodeMaterial, { NodeMaterialParameters } from "./NodeMaterial.js";

export default class VolumeNodeMaterial extends NodeMaterial {
lights: boolean;
readonly isVolumeNodeMaterial: true;
testNode: Node | null;

constructor(parameters?: NodeMaterialParameters);
}

0 comments on commit 04ef205

Please sign in to comment.