@predy-js/render-interface 0.3.4-beta.3 → 0.3.4-beta.30

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/statistic.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Name: @predy-js/render-interface
3
3
  * Description: undefined
4
4
  * Author: undefined
5
- * Version: v0.3.4-beta.3
5
+ * Version: v0.3.4-beta.30
6
6
  */
7
7
 
8
8
  // https://github.com/greggman/webgl-memory/blob/main/src/texture-utils.js
@@ -4,6 +4,7 @@ import type { GPUBufferOptionsMemoryShared } from '../GPUBuffer';
4
4
  export interface GPUBufferInternalOptions {
5
5
  data?: TypedArray;
6
6
  options?: typeof GPUBufferOptionsMemoryShared;
7
+ target?: number;
7
8
  }
8
9
  /**
9
10
  * 内存写入GPU的具体时机由框架自行决定,只要保证在渲染前输入GPU即可
@@ -6,6 +6,7 @@ import type { ImageBitmapInternal } from './ImageBitmapInternal';
6
6
  import type { PredyVideoDecoder, PredyVideoDecoderConstructor } from './VideoDecoder';
7
7
  import type { ResourcePlatform } from './ResourceInternal';
8
8
  import type { PredyVideoCodec, PredyTextEncoding, PredyResourceCacheStatus } from '../constants';
9
+ import type { MotionOrientationManager } from './motion';
9
10
  export interface PredyRequestOptions {
10
11
  url: string;
11
12
  disableCache?: boolean;
@@ -94,6 +95,7 @@ export interface PredyNativeInternal {
94
95
  * @param codec
95
96
  */
96
97
  supportVideoCodec(codec: PredyVideoCodec): boolean;
98
+ createOrientationManager(): MotionOrientationManager;
97
99
  }
98
100
  type renderSDFImageCallback = (img: SDFImage) => void;
99
101
  export {};
@@ -14,3 +14,4 @@ export * from './AndGLContext';
14
14
  export * from './PredyNativeInternal';
15
15
  export * from './PredyNativeModule';
16
16
  export * from './VideoDecoder';
17
+ export * from './motion';
@@ -0,0 +1,20 @@
1
+ import type { vec4 } from '../type';
2
+ export interface OrientationData {
3
+ timestamp: number;
4
+ orientation: {
5
+ alpha: number;
6
+ beta: number;
7
+ gamma: number;
8
+ quat: vec4;
9
+ };
10
+ }
11
+ export interface MotionStartOptions {
12
+ fps?: number;
13
+ }
14
+ type MotionStartCallback = (success: boolean, error?: string) => void;
15
+ export declare abstract class MotionOrientationManager {
16
+ motionCallback?: (motion: OrientationData) => void;
17
+ abstract start(options: MotionStartOptions, callback?: MotionStartCallback): void;
18
+ abstract destroy(): void;
19
+ }
20
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@predy-js/render-interface",
3
- "version": "0.3.4-beta.3",
3
+ "version": "0.3.4-beta.30",
4
4
  "license": "MIT",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -21,6 +21,9 @@ export abstract class DataBlockInternal implements ResourceInternal {
21
21
 
22
22
  protected constructor (options: DataBlockInternalOptions) {}
23
23
 
24
+ //todo
25
+ // setUniformValues (uniforms: Record<string, TypedArray>): void;
26
+
24
27
  abstract destroy (): void;
25
28
 
26
29
  /**
@@ -5,6 +5,7 @@ import type { GPUBufferOptionsMemoryShared } from '../GPUBuffer';
5
5
  export interface GPUBufferInternalOptions {
6
6
  data?: TypedArray,
7
7
  options?: typeof GPUBufferOptionsMemoryShared,
8
+ target?: number,
8
9
  }
9
10
 
10
11
  /**
@@ -6,6 +6,7 @@ import type { ImageBitmapInternal } from './ImageBitmapInternal';
6
6
  import type { PredyVideoDecoder, PredyVideoDecoderConstructor } from './VideoDecoder';
7
7
  import type { ResourcePlatform } from './ResourceInternal';
8
8
  import type { PredyVideoCodec, PredyTextEncoding, PredyResourceCacheStatus } from '../constants';
9
+ import type { MotionOrientationManager } from './motion';
9
10
 
10
11
  export interface PredyRequestOptions {
11
12
  url: string,
@@ -110,6 +111,9 @@ export interface PredyNativeInternal {
110
111
  * @param codec
111
112
  */
112
113
  supportVideoCodec(codec: PredyVideoCodec): boolean,
114
+
115
+ createOrientationManager(): MotionOrientationManager,
116
+
113
117
  }
114
118
 
115
119
  type renderSDFImageCallback = (img: SDFImage) => void;
@@ -14,3 +14,4 @@ export * from './AndGLContext';
14
14
  export * from './PredyNativeInternal';
15
15
  export * from './PredyNativeModule';
16
16
  export * from './VideoDecoder';
17
+ export * from './motion';
@@ -0,0 +1,26 @@
1
+ import type { vec4 } from '../type';
2
+
3
+ export interface OrientationData {
4
+ timestamp: number,
5
+ orientation: {
6
+ alpha: number,
7
+ beta: number,
8
+ gamma: number,
9
+ quat: vec4,
10
+ },
11
+ }
12
+
13
+ export interface MotionStartOptions {
14
+ fps?: number,
15
+ }
16
+
17
+ type MotionStartCallback = (success: boolean, error?: string) => void;
18
+
19
+ export abstract class MotionOrientationManager {
20
+ // 设置数据监听的回调
21
+ motionCallback?: (motion: OrientationData) => void;
22
+ // start 之后开始监听事件
23
+ abstract start (options: MotionStartOptions, callback?: MotionStartCallback): void;
24
+ // 停止并销毁
25
+ abstract destroy (): void;
26
+ }