import { mat4 , vec3 } from 'gl-matrix' ; import { Entity , Frustum , GLSLContext } from '../..' ; import { IAttribute , IAttributeInitializationOptions } from './IAttribute' ; import { IBuffer , IBufferInitializationOptions } from './IBuffer' ; import { IComputeModel } from './IComputeModel' ; import { IElements , IElementsInitializationOptions } from './IElements' ; import { IFramebuffer , IFramebufferInitializationOptions , } from './IFramebuffer' ; import { IModel , IModelInitializationOptions } from './IModel' ; import { IPass } from './IMultiPassRenderer' ; import { ITexture2D , ITexture2DInitializationOptions } from './ITexture2D' ; export interface ICamera { getFrustum ( ) : Frustum ; getViewTransform ( ) : mat4 ; getWorldTransform ( ) : mat4 ; getPerspective ( ) : mat4 ; getPosition ( ) : vec3 ; getProjectionMode ( ) : string ; rotate ( azimuth , elevation , roll ) : void ; pan ( tx , ty ) : void ; dolly ( value ) : void ; changeAzimuth ( az ) : void ; changeElevation ( el ) : void ; } export interface IScene { getEntities ( ) : Entity [ ] ; } export interface IViewport { x : number ; y : number ; width : number ; height : number ; } export interface IView { getCamera ( ) : ICamera ; getScene ( ) : IScene ; getViewport ( ) : IViewport ; getClearColor ( ) : [ number , number , number , number ] ; setCamera ( camera ) : IView ; setScene ( scene ) : IView ; setViewport ( viewport ) : IView ; setClearColor ( clearColor ) : IView ; pick ( position , view ) : number | undefined ; } export interface IRendererConfig { canvas : HTMLCanvasElement ; /**
     * Whether to use WGSL instead of GLSL 450
     */ useWGSL ? : boolean ; /**
     * 是否开启 multi pass
     */ enableMultiPassRenderer ? : boolean ; passes ? : Array < IPass < unknown > > ; antialias ? : boolean ; preserveDrawingBuffer ? : boolean ; /**
     * Defines the category of adapter to use.
     * Is it the discrete or integrated device.
     */ powerPreference ? : GPUPowerPreference ; /**
     * Defines the device descriptor used to create a device.
     */ deviceDescriptor ? : GPUDeviceDescriptor ; /**
     * Defines the requested Swap Chain Format.
     */ swapChainFormat ? : GPUTextureFormat ; /**
     * Defines wether MSAA is enabled on the canvas.
     */ antialiasing ? : boolean ; /**
     * Whether to support ComputePipeline.
     */ supportCompute ? : boolean ; } export interface IClearOptions { color ? : [ number , number , number , number ] ; depth ? : number ; stencil ? : number ; framebuffer ? : IFramebuffer | null ; } export interface IReadPixelsOptions { x : number ; y : number ; width : number ; height : number ; framebuffer ? : IFramebuffer ; data ? : Uint8Array ; } export type BufferData = number | number [ ] | Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array ; export interface IRendererService { supportWebGPU : boolean ; useWGSL : boolean ; init ( cfg ) : Promise < void > ; clear ( options ) : void ; createModel ( options ) : Promise < IModel > ; createAttribute ( options ) : IAttribute ; createBuffer ( options ) : IBuffer ; createElements ( options ) : IElements ; createTexture2D ( options ) : ITexture2D ; createFramebuffer ( options ) : IFramebuffer ; useFramebuffer ( framebuffer , drawCommands ) : void ; getCanvas ( ) : HTMLCanvasElement ; getGLContext ( ) : WebGLRenderingContext ; viewport ( size ) : void ; readPixels ( options ) : Uint8Array ; setScissor ( scissor ) : void ; destroy ( ) : void ; beginFrame ( ) : void ; endFrame ( ) : void ; createComputeModel ( context ) : Promise < IComputeModel > ; }