Skip to content

Commit

Permalink
BufferAttribute: add gpuType (#469)
Browse files Browse the repository at this point in the history
* BufferAttribute: add gpuType

* Shorten line

---------

Co-authored-by: Nathan Bierema <[email protected]>
  • Loading branch information
CodyJasonBennett and Methuselah96 committed Jun 29, 2023
1 parent c1ebc57 commit 9613fa7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions types/three/src/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ export const UnsignedShort4444Type: 1017;
export const UnsignedShort5551Type: 1018;
export const UnsignedInt248Type: 1020;

export type AttributeGPUType = typeof FloatType | typeof IntType;

/**
* Texture Types.
* @remarks Must correspond to the correct {@link PixelFormat | format}.
Expand Down
10 changes: 9 additions & 1 deletion types/three/src/core/BufferAttribute.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Usage } from '../constants';
import { Usage, AttributeGPUType } from '../constants';
import { Matrix3 } from './../math/Matrix3';
import { Matrix4 } from './../math/Matrix4';

Expand Down Expand Up @@ -66,6 +66,14 @@ export class BufferAttribute {
*/
usage: Usage;

/**
* Configures the bound GPU type for use in shaders. Either {@link FloatType} or {@link IntType}, default is {@link FloatType}.
*
* Note: this only has an effect for integer arrays and is not configurable for float arrays. For lower precision
* float types, see https://threejs.org/docs/#api/en/core/bufferAttributeTypes/BufferAttributeTypes.
*/
gpuType: AttributeGPUType;

/**
* This can be used to only update some components of stored vectors (for example, just the component related to color).
* @defaultValue `{ offset: number = 0; count: number = -1 }`
Expand Down

0 comments on commit 9613fa7

Please sign in to comment.