Skip to content

Commit

Permalink
- allow cube texture dimension
Browse files Browse the repository at this point in the history
- added cubemap example
  • Loading branch information
martinlaxenaire committed Feb 22, 2024
1 parent 55883e7 commit 4ec7d6c
Show file tree
Hide file tree
Showing 326 changed files with 3,676 additions and 3,423 deletions.
2 changes: 1 addition & 1 deletion dist/esm/core/bindings/TextureBinding.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class TextureBinding extends Binding {
* Get the {@link GPUBindGroupEntry#resource | bind group resource}
*/
get resource() {
return this.texture instanceof GPUTexture ? this.texture.createView({ label: this.options.label + " view" }) : this.texture instanceof GPUExternalTexture ? this.texture : null;
return this.texture instanceof GPUTexture ? this.texture.createView({ label: this.options.label + " view", dimension: this.options.viewDimension }) : this.texture instanceof GPUExternalTexture ? this.texture : null;
}
/**
* Set the {@link GPUBindGroupEntry#resource | bind group resource}
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/core/bindings/TextureBinding.mjs.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/esm/core/textures/RenderTexture.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ class RenderTexture {
this.size = this.options.fixedSize ? {
width: this.options.fixedSize.width * this.options.qualityRatio,
height: this.options.fixedSize.height * this.options.qualityRatio,
depth: this.options.fixedSize.depth
depth: this.options.fixedSize.depth ?? this.options.viewDimension.indexOf("cube") !== -1 ? 6 : 1
} : {
width: Math.floor(this.renderer.displayBoundingRect.width * this.options.qualityRatio),
height: Math.floor(this.renderer.displayBoundingRect.height * this.options.qualityRatio),
depth: 1
depth: this.options.viewDimension.indexOf("cube") !== -1 ? 6 : 1
};
if (this.options.fixedSize) {
__privateSet(this, _autoResize, false);
Expand Down Expand Up @@ -100,7 +100,7 @@ class RenderTexture {
label: this.options.label,
format: this.options.format,
size: [this.size.width, this.size.height, this.size.depth ?? 1],
dimensions: this.options.viewDimension === "1d" ? "1d" : this.options.viewDimension === "3d" ? "3d" : "2d",
dimensions: this.options.viewDimension,
sampleCount: this.options.sampleCount,
usage: (
// TODO let user chose?
Expand Down
Loading

0 comments on commit 4ec7d6c

Please sign in to comment.