@predy-js/render-interface 0.3.0-beta.135 → 0.3.0-beta.137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -13
- package/dist/index.mjs.map +1 -1
- package/dist/src/render/MarsMaterialDataBlock.d.ts +3 -3
- package/dist/src/render/MarsTextureFactory.d.ts +1 -1
- package/dist/src/webgl/GLProgram.d.ts +3 -2
- package/dist/statistic.js +1 -1
- package/dist/types/Material.d.ts +3 -4
- package/dist/types/native/PredyNativeInternal.d.ts +22 -1
- package/package.json +1 -1
- package/types/Material.ts +3 -4
- package/types/native/PredyNativeInternal.ts +27 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { MaterialDataBlock, MaterialDataBlockDestroyOptions, MaterialDataBlockOptions, UniformSemantic, UniformValue, vec2, Texture
|
1
|
+
import type { MaterialDataBlock, MaterialDataBlockDestroyOptions, MaterialDataBlockOptions, UniformSemantic, UniformValue, vec2, Texture } from '../../types';
|
2
2
|
import type { MarsRenderer } from './MarsRenderer';
|
3
3
|
import { MarsTexture } from './MarsTexture';
|
4
4
|
import type { UniformBlockSpec } from '../webgl/GLUniformUtils';
|
@@ -10,7 +10,7 @@ export declare class MarsMaterialDataBlock implements MaterialDataBlock {
|
|
10
10
|
readonly _uniformValueRanges: Record<string, vec2>;
|
11
11
|
readonly name: string;
|
12
12
|
readonly uniformSemantics: {
|
13
|
-
[key: string]: UniformSemantic
|
13
|
+
[key: string]: UniformSemantic;
|
14
14
|
};
|
15
15
|
readonly renderer?: MarsRenderer;
|
16
16
|
readonly uboBufferMap: Record<string, UniformBlockBuffer>;
|
@@ -41,6 +41,6 @@ export declare class MarsMaterialDataBlock implements MaterialDataBlock {
|
|
41
41
|
setUniformValues(map: {
|
42
42
|
[p: string]: UniformValue;
|
43
43
|
}): void;
|
44
|
-
setUniformSemantic(name: string, semantic: string |
|
44
|
+
setUniformSemantic(name: string, semantic: string | undefined): void;
|
45
45
|
clone(name: string): MarsMaterialDataBlock;
|
46
46
|
}
|
@@ -5,7 +5,7 @@ export declare class MarsTextureFactory implements TextureFactory {
|
|
5
5
|
[key: string]: Promise<Texture>;
|
6
6
|
};
|
7
7
|
constructor();
|
8
|
-
loadMipmapImagesAsync(pointers: vec2[], bin: ArrayBuffer): Promise<(
|
8
|
+
loadMipmapImagesAsync(pointers: vec2[], bin: ArrayBuffer): Promise<(ImageBitmap | HTMLImageElement)[]>;
|
9
9
|
loadImageAsync(url: string | HTMLImageElement | Blob): Promise<HTMLImageElement | ImageBitmap>;
|
10
10
|
requestBinaryAsync(url: string): Promise<ArrayBuffer>;
|
11
11
|
loadImageBinaryAsync(binary: ArrayBuffer | TypedArray | Blob, mime?: string): Promise<HTMLImageElement | ImageBitmap>;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import type { GLGPURenderer } from './GLGPURenderer';
|
2
2
|
import type { GLGeometry } from './GLGeometry';
|
3
|
-
import type { RenderState
|
3
|
+
import type { RenderState } from '../../types/RenderFrame';
|
4
4
|
import type { GLVertexArrayObject } from './GLVertexArrayObject';
|
5
5
|
import type { UniformBlockSpec } from './GLUniformUtils';
|
6
|
+
import type { UniformValue } from '../../types';
|
6
7
|
export interface ProgramAttributeInfo {
|
7
8
|
readonly name: string;
|
8
9
|
readonly size: number;
|
@@ -35,7 +36,7 @@ export declare class GLProgram {
|
|
35
36
|
constructor(renderer: GLGPURenderer, program: WebGLProgram, shared: boolean, id: string);
|
36
37
|
init(renderer: GLGPURenderer, program: WebGLProgram): void;
|
37
38
|
bind(): void;
|
38
|
-
getSemanticValue(state: RenderState, semanticName: string
|
39
|
+
getSemanticValue(state: RenderState, semanticName: string): import("../../types").GPUBuffer | UniformValue | null | undefined;
|
39
40
|
setupUniforms(state: RenderState): void;
|
40
41
|
setGLUniformValue(name: string, value: any, info: ProgramUniformInfo, gl: WebGL2RenderingContext | WebGLRenderingContext): void;
|
41
42
|
setupAttributes(geometry: GLGeometry): GLVertexArrayObject;
|
package/dist/statistic.js
CHANGED
package/dist/types/Material.d.ts
CHANGED
@@ -4,7 +4,6 @@ import type { Immutable, TypedArray } from './type';
|
|
4
4
|
import type { GPURenderer } from './Renderer';
|
5
5
|
import type { DestroyOptions } from './constants';
|
6
6
|
import type { Texture } from './Texture';
|
7
|
-
import type { SemanticFunc } from './RenderFrame';
|
8
7
|
export type UniformSemantic = 'VIEW' | 'MODEL' | 'MODELVIEW' | 'PROJECTION' | 'VIEWPROJECTION' | 'MODELVIEWPROJECTION' | string;
|
9
8
|
export interface MaterialRenderStates {
|
10
9
|
sampleAlphaToCoverage?: boolean;
|
@@ -111,7 +110,7 @@ export interface MaterialDataBlockOptions {
|
|
111
110
|
uniformTextures?: Record<string, Texture | Texture[]>;
|
112
111
|
name?: string;
|
113
112
|
uniformSemantics?: {
|
114
|
-
[key: string]: UniformSemantic
|
113
|
+
[key: string]: UniformSemantic;
|
115
114
|
};
|
116
115
|
}
|
117
116
|
export interface MaterialDataBlockDestroyOptions {
|
@@ -122,11 +121,11 @@ export declare class MaterialDataBlock implements IGPUResource {
|
|
122
121
|
readonly isDestroyed: boolean;
|
123
122
|
readonly name: string;
|
124
123
|
readonly uniformSemantics?: {
|
125
|
-
[key: string]: UniformSemantic
|
124
|
+
[key: string]: UniformSemantic;
|
126
125
|
};
|
127
126
|
constructor(options: MaterialDataBlockOptions);
|
128
127
|
hasUniformValue(name: string): boolean;
|
129
|
-
setUniformSemantic(name: string, semantic: string |
|
128
|
+
setUniformSemantic(name: string, semantic: string | undefined): void;
|
130
129
|
/**
|
131
130
|
* 多次调用次函数只会更新JS层的数据,不会直接更新GPU数据
|
132
131
|
* 在下一次渲染前,会将JS层的数据更新到GPU
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ImageBitmapCallback, ImageBitmapConstructor } from './ImageBitmapInternal';
|
2
|
-
import type { TypedArray } from '../type';
|
2
|
+
import type { TypedArray, vec2 } from '../type';
|
3
3
|
import type { GPUCapability } from '../GPUCapability';
|
4
4
|
import type { PredyResizeTemplate, SDFImageOptions, SDFImage } from '@predy-js/specification';
|
5
5
|
import type { ImageBitmapInternal } from './ImageBitmapInternal';
|
@@ -21,6 +21,8 @@ export interface PredyRequestResponse {
|
|
21
21
|
time: number;
|
22
22
|
}
|
23
23
|
export type PredyRequestCallback = (err: string | undefined, res: PredyRequestResponse) => void;
|
24
|
+
export declare const DataCompressMethodZlib = 1;
|
25
|
+
type DataCompressMethod = typeof DataCompressMethodZlib;
|
24
26
|
export interface PredyNativeInternal {
|
25
27
|
webpDisabled?: boolean;
|
26
28
|
createImageBitmap(data: TypedArray | string, //图片文件的数据
|
@@ -53,6 +55,25 @@ export interface PredyNativeInternal {
|
|
53
55
|
* @param callback
|
54
56
|
*/
|
55
57
|
evaluateScriptURL(url: string, callback: (err: Error, result: any) => void): void;
|
58
|
+
/**
|
59
|
+
* 将float32Array转换为half float,写入Uint16Array中,
|
60
|
+
* 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
|
61
|
+
* 提供range参数后,算法求出source的最大最小值,然后将float16重新映射到range中
|
62
|
+
* 如果source和target的长度不匹配,返回false
|
63
|
+
*/
|
64
|
+
float32ToFloat16(source: Float32Array, target: Uint16Array, range?: vec2): boolean;
|
65
|
+
/**
|
66
|
+
* 将half float转换为float32,通过Float32Array返回,
|
67
|
+
* 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
|
68
|
+
* 如果没有提供,float16会被直接转化为float32
|
69
|
+
* 如果source和target的长度不匹配,返回false
|
70
|
+
*/
|
71
|
+
float16ToFloat32(source: Uint16Array, target: Float32Array, range?: vec2): boolean;
|
72
|
+
/**
|
73
|
+
* 解压数据
|
74
|
+
* @param data
|
75
|
+
*/
|
76
|
+
deflateData(data: Uint8Array, method: DataCompressMethod): Uint8Array | undefined;
|
56
77
|
}
|
57
78
|
type renderSDFImageCallback = (img: SDFImage) => void;
|
58
79
|
export {};
|
package/package.json
CHANGED
package/types/Material.ts
CHANGED
@@ -4,7 +4,6 @@ import type { Immutable, TypedArray } from './type';
|
|
4
4
|
import type { GPURenderer } from './Renderer';
|
5
5
|
import type { DestroyOptions } from './constants';
|
6
6
|
import type { Texture } from './Texture';
|
7
|
-
import type { SemanticFunc } from './RenderFrame';
|
8
7
|
|
9
8
|
export type UniformSemantic =
|
10
9
|
| 'VIEW'
|
@@ -143,7 +142,7 @@ export interface MaterialDataBlockOptions {
|
|
143
142
|
uniformValues?: { [key: string]: UniformValue },
|
144
143
|
uniformTextures?: Record<string, Texture | Texture[]>,
|
145
144
|
name?: string,
|
146
|
-
uniformSemantics?: { [key: string]: UniformSemantic
|
145
|
+
uniformSemantics?: { [key: string]: UniformSemantic },
|
147
146
|
}
|
148
147
|
|
149
148
|
export interface MaterialDataBlockDestroyOptions {
|
@@ -158,13 +157,13 @@ export declare class MaterialDataBlock implements IGPUResource {
|
|
158
157
|
|
159
158
|
readonly name: string;
|
160
159
|
|
161
|
-
readonly uniformSemantics?: { [key: string]: UniformSemantic
|
160
|
+
readonly uniformSemantics?: { [key: string]: UniformSemantic };
|
162
161
|
|
163
162
|
constructor (options: MaterialDataBlockOptions);
|
164
163
|
|
165
164
|
hasUniformValue (name: string): boolean;
|
166
165
|
|
167
|
-
setUniformSemantic (name: string, semantic: string |
|
166
|
+
setUniformSemantic (name: string, semantic: string | undefined): void;
|
168
167
|
|
169
168
|
/**
|
170
169
|
* 多次调用次函数只会更新JS层的数据,不会直接更新GPU数据
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ImageBitmapCallback, ImageBitmapConstructor } from './ImageBitmapInternal';
|
2
|
-
import type { TypedArray } from '../type';
|
2
|
+
import type { TypedArray, vec2 } from '../type';
|
3
3
|
import type { GPUCapability } from '../GPUCapability';
|
4
4
|
import type { PredyResizeTemplate, SDFImageOptions, SDFImage } from '@predy-js/specification';
|
5
5
|
import type { ImageBitmapInternal } from './ImageBitmapInternal';
|
@@ -29,6 +29,10 @@ export interface PredyRequestResponse {
|
|
29
29
|
|
30
30
|
export type PredyRequestCallback = (err: string | undefined, res: PredyRequestResponse) => void;
|
31
31
|
|
32
|
+
export const DataCompressMethodZlib = 1;
|
33
|
+
|
34
|
+
type DataCompressMethod = typeof DataCompressMethodZlib;
|
35
|
+
|
32
36
|
export interface PredyNativeInternal {
|
33
37
|
webpDisabled?: boolean,
|
34
38
|
|
@@ -67,6 +71,28 @@ export interface PredyNativeInternal {
|
|
67
71
|
* @param callback
|
68
72
|
*/
|
69
73
|
evaluateScriptURL (url: string, callback: (err: Error, result: any) => void): void,
|
74
|
+
|
75
|
+
/**
|
76
|
+
* 将float32Array转换为half float,写入Uint16Array中,
|
77
|
+
* 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
|
78
|
+
* 提供range参数后,算法求出source的最大最小值,然后将float16重新映射到range中
|
79
|
+
* 如果source和target的长度不匹配,返回false
|
80
|
+
*/
|
81
|
+
float32ToFloat16(source: Float32Array, target: Uint16Array, range?: vec2): boolean,
|
82
|
+
|
83
|
+
/**
|
84
|
+
* 将half float转换为float32,通过Float32Array返回,
|
85
|
+
* 如果提供了range参数,代表float16会被重新map到range中,以此提高精度范围
|
86
|
+
* 如果没有提供,float16会被直接转化为float32
|
87
|
+
* 如果source和target的长度不匹配,返回false
|
88
|
+
*/
|
89
|
+
float16ToFloat32(source: Uint16Array, target: Float32Array, range?: vec2): boolean,
|
90
|
+
|
91
|
+
/**
|
92
|
+
* 解压数据
|
93
|
+
* @param data
|
94
|
+
*/
|
95
|
+
deflateData(data: Uint8Array, method: DataCompressMethod): Uint8Array | undefined,
|
70
96
|
}
|
71
97
|
|
72
98
|
type renderSDFImageCallback = (img: SDFImage) => void;
|