@predy-js/render-interface 0.3.4-beta.3 → 0.3.4-beta.31
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 +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/statistic.js +1 -1
- package/dist/types/native/GPUBufferInternal.d.ts +1 -0
- package/dist/types/native/PredyNativeInternal.d.ts +2 -0
- package/dist/types/native/index.d.ts +1 -0
- package/dist/types/native/motion.d.ts +20 -0
- package/package.json +1 -1
- package/types/native/DataBlockInternal.ts +3 -0
- package/types/native/GPUBufferInternal.ts +1 -0
- package/types/native/PredyNativeInternal.ts +4 -0
- package/types/native/index.ts +1 -0
- package/types/native/motion.ts +26 -0
package/dist/statistic.js
CHANGED
@@ -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 {};
|
@@ -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
@@ -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
|
/**
|
@@ -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;
|
package/types/native/index.ts
CHANGED
@@ -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
|
+
}
|