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

Mod bufferobject #2981

Merged
merged 8 commits into from
Feb 6, 2024
4 changes: 2 additions & 2 deletions Sources/Common/DataModel/SelectionNode/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface vtkSelectionNode extends vtkObject {
/**
* This functions is called internally by VTK.js and is not intended for public use.
*/
setProperties(properties: ISelectionNodeProperties);
setProperties(properties: ISelectionNodeProperties): boolean;

/**
* Get the list of the underlying selected attribute IDs.
Expand All @@ -64,7 +64,7 @@ export interface vtkSelectionNode extends vtkObject {
/**
* This functions is called internally by VTK.js and is not intended for public use.
*/
setSelectionList(selectionAttributeIDs: ISelectionNodeProperties);
setSelectionList(selectionAttributeIDs: ISelectionNodeProperties): boolean;
}

/**
Expand Down
11 changes: 11 additions & 0 deletions Sources/Rendering/OpenGL/BufferObject/Constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export declare enum ObjectType {
ARRAY_BUFFER = 0,
ELEMENT_ARRAY_BUFFER = 1,
TEXTURE_BUFFER = 2,
}

declare const _default: {
ObjectType: typeof ObjectType;
};

export default _default;
82 changes: 82 additions & 0 deletions Sources/Rendering/OpenGL/BufferObject/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { ObjectType } from './Constants';
import { vtkAlgorithm, vtkObject } from '../../../interfaces';

/**
* Interface for initial values of BufferObject
*/
export interface IBufferObjectInitialValues {
objectType?: ObjectType | ObjectType.ARRAY_BUFFER;
context?: WebGLRenderingContext | WebGL2RenderingContext;
allocatedGPUMemoryInBytes?: number | 0;
hjunqq marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* Interface for OpenGL Buffer Object
*/
export interface vtkOpenGLBufferObject extends vtkObject {
/**
* Uploads data to the buffer object.
* @param data The data to be uploaded.
* @param type The type of the data.
* @returns {boolean} Whether the upload was successful.
*/
upload(data: any, type: any): boolean;

/**
* Binds the buffer object.
* @returns {boolean} Whether the binding was successful.
*/
bind(): boolean;

/**
* Releases the buffer object.
* @returns {boolean} Whether the release was successful.
*/
release(): boolean;

/**
* Releases graphics resources associated with the buffer object.
*/
releaseGraphicsResources(): void;

/**
* Sets the OpenGL render window.
* @param renWin The render window to set.
*/
setOpenGLRenderWindow(renWin: any): void;

/**
* Retrieves the error message, if any.
* @returns {string} The error message.
*/
getError(): string;

}

/**
* Extends the given object with the properties and methods of vtkOpenGLBufferObject.
* @param publicAPI The public API to extend.
* @param model The model to extend.
* @param initialValues The initial values to apply.
*/
export function extend(
publicAPI: object,
model: object,
initialValues?: IBufferObjectInitialValues
): void;

/**
* Creates a new instance of vtkOpenGLBufferObject with the given initial values.
* @param initialValues The initial values to use.
* @returns {vtkOpenGLBufferObject} The new instance.
*/
export function newInstance(initialValues?: IBufferObjectInitialValues): vtkOpenGLBufferObject;

/**
* Object containing the newInstance and extend functions for vtkOpenGLBufferObject.
*/
export declare const vtkOpenGLBufferObject: {
newInstance: typeof newInstance;
extend: typeof extend;
};
export default vtkOpenGLBufferObject;
21 changes: 21 additions & 0 deletions Sources/Rendering/OpenGL/Texture/Constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export declare enum Wrap {
CLAMP_TO_EDGE = 0,
REPEAT = 1,
MIRRORED_REPEAT = 2,
}

export declare enum Filter {
NEAREST = 0,
LINEAR = 1,
NEAREST_MIPMAP_NEAREST = 2,
NEAREST_MIPMAP_LINEAR = 3,
LINEAR_MIPMAP_NEAREST = 4,
LINEAR_MIPMAP_LINEAR = 5,
}

declare const _default: {
Wrap: typeof Wrap;
Filter: typeof Filter;
};

export default _default;
Loading
Loading