@spatialwalk/avatarkit 1.0.0-beta.80 → 1.0.0-beta.82

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +26 -0
  3. package/dist/{StreamingAudioPlayer-BT5-8dZQ.js → StreamingAudioPlayer-Pe6o4lP8.js} +1 -1
  4. package/dist/avatar_core_wasm-e68766db.wasm +0 -0
  5. package/dist/core/AvatarController.d.ts +1 -25
  6. package/dist/{index-a-0wPb5D.js → index-DvCy6yVA.js} +9249 -8937
  7. package/dist/index.d.ts +0 -1
  8. package/dist/index.js +1 -1
  9. package/dist/next.d.ts +2 -0
  10. package/dist/types/character.d.ts +37 -1
  11. package/dist/types/index.d.ts +9 -0
  12. package/next.d.ts +1 -12
  13. package/next.js +115 -25
  14. package/package.json +20 -17
  15. package/dist/animation/AnimationWebSocketClient.d.ts +0 -6
  16. package/dist/animation/utils/eventEmitter.d.ts +0 -5
  17. package/dist/animation/utils/flameConverter.d.ts +0 -5
  18. package/dist/audio/AnimationPlayer.d.ts +0 -6
  19. package/dist/audio/StreamingAudioPlayer.d.ts +0 -7
  20. package/dist/config/app-config.d.ts +0 -43
  21. package/dist/config/constants.d.ts +0 -21
  22. package/dist/config/sdk-config-loader.d.ts +0 -6
  23. package/dist/core/AvatarDownloader.d.ts +0 -15
  24. package/dist/core/NetworkLayer.d.ts +0 -7
  25. package/dist/generated/common/v1/models.d.ts +0 -36
  26. package/dist/generated/driveningress/v1/driveningress.d.ts +0 -79
  27. package/dist/generated/driveningress/v2/driveningress.d.ts +0 -162
  28. package/dist/generated/google/protobuf/struct.d.ts +0 -107
  29. package/dist/generated/google/protobuf/timestamp.d.ts +0 -128
  30. package/dist/internal/constants.d.ts +0 -102
  31. package/dist/internal/index.d.ts +0 -7
  32. package/dist/renderer/RenderSystem.d.ts +0 -9
  33. package/dist/renderer/covariance.d.ts +0 -5
  34. package/dist/renderer/renderer.d.ts +0 -12
  35. package/dist/renderer/sortSplats.d.ts +0 -5
  36. package/dist/renderer/webgl/reorderData.d.ts +0 -7
  37. package/dist/renderer/webgl/webglRenderer.d.ts +0 -96
  38. package/dist/renderer/webgpu/webgpuRenderer.d.ts +0 -79
  39. package/dist/utils/animation-interpolation.d.ts +0 -8
  40. package/dist/utils/client-id.d.ts +0 -6
  41. package/dist/utils/conversationId.d.ts +0 -10
  42. package/dist/utils/error-utils.d.ts +0 -26
  43. package/dist/utils/id-manager.d.ts +0 -34
  44. package/dist/utils/log-sanitizer.d.ts +0 -15
  45. package/dist/utils/log-sink.d.ts +0 -47
  46. package/dist/utils/logger.d.ts +0 -25
  47. package/dist/utils/posthog-tracker.d.ts +0 -8
  48. package/dist/utils/pwa-cache-manager.d.ts +0 -17
  49. package/dist/utils/usage-tracker.d.ts +0 -6
  50. package/dist/vanilla/vite.config.d.ts +0 -2
  51. package/dist/wasm/avatarCoreAdapter.d.ts +0 -77
  52. package/dist/wasm/avatarCoreMemory.d.ts +0 -144
@@ -1,162 +0,0 @@
1
- import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
2
- import { CustomAnimation } from '../../common/v1/models';
3
- import { Timestamp } from '../../google/protobuf/timestamp';
4
- export declare const protobufPackage = "driveningress.v2";
5
- export declare enum MessageType {
6
- MESSAGE_UNSPECIFIED = 0,
7
- /** MESSAGE_CLIENT_CONFIGURE_SESSION - 协商会话参数 */
8
- MESSAGE_CLIENT_CONFIGURE_SESSION = 1,
9
- /** MESSAGE_SERVER_CONFIRM_SESSION - 确认协商成功 */
10
- MESSAGE_SERVER_CONFIRM_SESSION = 2,
11
- MESSAGE_CLIENT_AUDIO_INPUT = 3,
12
- MESSAGE_SERVER_ERROR = 4,
13
- MESSAGE_SERVER_RESPONSE_ANIMATION = 5,
14
- UNRECOGNIZED = -1
15
- }
16
- export declare function messageTypeFromJSON(object: any): MessageType;
17
- export declare function messageTypeToJSON(object: MessageType): string;
18
- export declare enum AudioFormat {
19
- AUDIO_FORMAT_PCM_S16LE = 0,
20
- UNRECOGNIZED = -1
21
- }
22
- export declare function audioFormatFromJSON(object: any): AudioFormat;
23
- export declare function audioFormatToJSON(object: AudioFormat): string;
24
- export declare enum TransportCompression {
25
- TRANSPORT_COMPRESSION_NONE = 0,
26
- UNRECOGNIZED = -1
27
- }
28
- export declare function transportCompressionFromJSON(object: any): TransportCompression;
29
- export declare function transportCompressionToJSON(object: TransportCompression): string;
30
- export interface GetCharacterInfoRequest {
31
- characterId: string;
32
- }
33
- export interface CharacterAsset {
34
- /** 资产ID,例如 "v1/xxx" */
35
- characterId: string;
36
- /** 资产版本,例如 "1.0.0" */
37
- version: string;
38
- createdAt?: Timestamp | undefined;
39
- updatedAt?: Timestamp | undefined;
40
- camera?: ResourceHolder | undefined;
41
- models?: Models | undefined;
42
- animations?: Animations | undefined;
43
- background?: ResourceHolder | undefined;
44
- characterSettings?: {
45
- [key: string]: any;
46
- } | undefined;
47
- /** 自定义动画列表 */
48
- customAnimations: CustomAnimation[];
49
- }
50
- export interface Resource {
51
- type: string;
52
- local: string;
53
- remote: string;
54
- }
55
- export interface ResourceHolder {
56
- resource?: Resource | undefined;
57
- }
58
- export interface Models {
59
- shape?: ResourceHolder | undefined;
60
- gsStandard?: ResourceHolder | undefined;
61
- gsHigh?: ResourceHolder | undefined;
62
- gsUltra?: ResourceHolder | undefined;
63
- }
64
- export interface Animations {
65
- frameIdle?: ResourceHolder | undefined;
66
- frameMono?: ResourceHolder | undefined;
67
- audioMono?: ResourceHolder | undefined;
68
- }
69
- export interface ClientConfigureSession {
70
- sampleRate: number;
71
- bitrate: number;
72
- audioFormat: AudioFormat;
73
- transportCompression: TransportCompression;
74
- }
75
- export interface ServerConfirmSession {
76
- connectionId: string;
77
- }
78
- export interface ClientAudioInput {
79
- reqId: string;
80
- end: boolean;
81
- audio: Uint8Array;
82
- }
83
- export interface ServerError {
84
- connectionId: string;
85
- reqId: string;
86
- code: number;
87
- message: string;
88
- }
89
- export interface Flame {
90
- translation: number[];
91
- rotation: number[];
92
- neckPose: number[];
93
- jawPose: number[];
94
- eyePose: number[];
95
- eyeLid: number[];
96
- expression: number[];
97
- }
98
- export interface FlameAnimation {
99
- keyframes: Flame[];
100
- }
101
- export interface ServerResponseAnimation {
102
- connectionId: string;
103
- reqId: string;
104
- end: boolean;
105
- animation?: FlameAnimation | undefined;
106
- }
107
- export interface Message {
108
- type: MessageType;
109
- clientConfigureSession?: ClientConfigureSession | undefined;
110
- serverConfirmSession?: ServerConfirmSession | undefined;
111
- clientAudioInput?: ClientAudioInput | undefined;
112
- serverError?: ServerError | undefined;
113
- serverResponseAnimation?: ServerResponseAnimation | undefined;
114
- }
115
- export declare const GetCharacterInfoRequest: MessageFns<GetCharacterInfoRequest>;
116
- export declare const CharacterAsset: MessageFns<CharacterAsset>;
117
- export declare const Resource: MessageFns<Resource>;
118
- export declare const ResourceHolder: MessageFns<ResourceHolder>;
119
- export declare const Models: MessageFns<Models>;
120
- export declare const Animations: MessageFns<Animations>;
121
- export declare const ClientConfigureSession: MessageFns<ClientConfigureSession>;
122
- export declare const ServerConfirmSession: MessageFns<ServerConfirmSession>;
123
- export declare const ClientAudioInput: MessageFns<ClientAudioInput>;
124
- export declare const ServerError: MessageFns<ServerError>;
125
- export declare const Flame: MessageFns<Flame>;
126
- export declare const FlameAnimation: MessageFns<FlameAnimation>;
127
- export declare const ServerResponseAnimation: MessageFns<ServerResponseAnimation>;
128
- export declare const Message: MessageFns<Message>;
129
- export interface DrivenIngressService {
130
- GetCharacterInfo(request: GetCharacterInfoRequest): Promise<CharacterAsset>;
131
- }
132
- export declare const DrivenIngressServiceServiceName = "driveningress.v2.DrivenIngressService";
133
- export declare class DrivenIngressServiceClientImpl implements DrivenIngressService {
134
- private readonly rpc;
135
- private readonly service;
136
- constructor(rpc: Rpc, opts?: {
137
- service?: string;
138
- });
139
- GetCharacterInfo(request: GetCharacterInfoRequest): Promise<CharacterAsset>;
140
- }
141
- interface Rpc {
142
- request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
143
- }
144
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
145
- export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
146
- [K in keyof T]?: DeepPartial<T[K]>;
147
- } : Partial<T>;
148
- type KeysOfUnion<T> = T extends T ? keyof T : never;
149
- export type Exact<P, I extends P> = P extends Builtin ? P : P & {
150
- [K in keyof P]: Exact<P[K], I[K]>;
151
- } & {
152
- [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
153
- };
154
- export interface MessageFns<T> {
155
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
156
- decode(input: BinaryReader | Uint8Array, length?: number): T;
157
- fromJSON(object: any): T;
158
- toJSON(message: T): unknown;
159
- create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
160
- fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
161
- }
162
- export {};
@@ -1,107 +0,0 @@
1
- import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
2
- export declare const protobufPackage = "google.protobuf";
3
- /**
4
- * `NullValue` is a singleton enumeration to represent the null value for the
5
- * `Value` type union.
6
- *
7
- * The JSON representation for `NullValue` is JSON `null`.
8
- */
9
- export declare enum NullValue {
10
- /** NULL_VALUE - Null value. */
11
- NULL_VALUE = 0,
12
- UNRECOGNIZED = -1
13
- }
14
- export declare function nullValueFromJSON(object: any): NullValue;
15
- export declare function nullValueToJSON(object: NullValue): string;
16
- /**
17
- * `Struct` represents a structured data value, consisting of fields
18
- * which map to dynamically typed values. In some languages, `Struct`
19
- * might be supported by a native representation. For example, in
20
- * scripting languages like JS a struct is represented as an
21
- * object. The details of that representation are described together
22
- * with the proto support for the language.
23
- *
24
- * The JSON representation for `Struct` is JSON object.
25
- */
26
- export interface Struct {
27
- /** Unordered map of dynamically typed values. */
28
- fields: {
29
- [key: string]: any | undefined;
30
- };
31
- }
32
- export interface Struct_FieldsEntry {
33
- key: string;
34
- value?: any | undefined;
35
- }
36
- /**
37
- * `Value` represents a dynamically typed value which can be either
38
- * null, a number, a string, a boolean, a recursive struct value, or a
39
- * list of values. A producer of value is expected to set one of these
40
- * variants. Absence of any variant indicates an error.
41
- *
42
- * The JSON representation for `Value` is JSON value.
43
- */
44
- export interface Value {
45
- /** Represents a null value. */
46
- nullValue?: NullValue | undefined;
47
- /** Represents a double value. */
48
- numberValue?: number | undefined;
49
- /** Represents a string value. */
50
- stringValue?: string | undefined;
51
- /** Represents a boolean value. */
52
- boolValue?: boolean | undefined;
53
- /** Represents a structured value. */
54
- structValue?: {
55
- [key: string]: any;
56
- } | undefined;
57
- /** Represents a repeated `Value`. */
58
- listValue?: Array<any> | undefined;
59
- }
60
- /**
61
- * `ListValue` is a wrapper around a repeated field of values.
62
- *
63
- * The JSON representation for `ListValue` is JSON array.
64
- */
65
- export interface ListValue {
66
- /** Repeated field of dynamically typed values. */
67
- values: any[];
68
- }
69
- export declare const Struct: MessageFns<Struct> & StructWrapperFns;
70
- export declare const Struct_FieldsEntry: MessageFns<Struct_FieldsEntry>;
71
- export declare const Value: MessageFns<Value> & AnyValueWrapperFns;
72
- export declare const ListValue: MessageFns<ListValue> & ListValueWrapperFns;
73
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
74
- export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
75
- [K in keyof T]?: DeepPartial<T[K]>;
76
- } : Partial<T>;
77
- type KeysOfUnion<T> = T extends T ? keyof T : never;
78
- export type Exact<P, I extends P> = P extends Builtin ? P : P & {
79
- [K in keyof P]: Exact<P[K], I[K]>;
80
- } & {
81
- [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
82
- };
83
- export interface MessageFns<T> {
84
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
85
- decode(input: BinaryReader | Uint8Array, length?: number): T;
86
- fromJSON(object: any): T;
87
- toJSON(message: T): unknown;
88
- create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
89
- fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
90
- }
91
- export interface StructWrapperFns {
92
- wrap(object: {
93
- [key: string]: any;
94
- } | undefined): Struct;
95
- unwrap(message: Struct): {
96
- [key: string]: any;
97
- };
98
- }
99
- export interface AnyValueWrapperFns {
100
- wrap(value: any): Value;
101
- unwrap(message: any): string | number | boolean | Object | null | Array<any> | undefined;
102
- }
103
- export interface ListValueWrapperFns {
104
- wrap(array: Array<any> | undefined): ListValue;
105
- unwrap(message: ListValue): Array<any>;
106
- }
107
- export {};
@@ -1,128 +0,0 @@
1
- import { BinaryReader, BinaryWriter } from '@bufbuild/protobuf/wire';
2
- export declare const protobufPackage = "google.protobuf";
3
- /**
4
- * A Timestamp represents a point in time independent of any time zone or local
5
- * calendar, encoded as a count of seconds and fractions of seconds at
6
- * nanosecond resolution. The count is relative to an epoch at UTC midnight on
7
- * January 1, 1970, in the proleptic Gregorian calendar which extends the
8
- * Gregorian calendar backwards to year one.
9
- *
10
- * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
11
- * second table is needed for interpretation, using a [24-hour linear
12
- * smear](https://developers.google.com/time/smear).
13
- *
14
- * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
15
- * restricting to that range, we ensure that we can convert to and from [RFC
16
- * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
17
- *
18
- * # Examples
19
- *
20
- * Example 1: Compute Timestamp from POSIX `time()`.
21
- *
22
- * Timestamp timestamp;
23
- * timestamp.set_seconds(time(NULL));
24
- * timestamp.set_nanos(0);
25
- *
26
- * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
27
- *
28
- * struct timeval tv;
29
- * gettimeofday(&tv, NULL);
30
- *
31
- * Timestamp timestamp;
32
- * timestamp.set_seconds(tv.tv_sec);
33
- * timestamp.set_nanos(tv.tv_usec * 1000);
34
- *
35
- * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
36
- *
37
- * FILETIME ft;
38
- * GetSystemTimeAsFileTime(&ft);
39
- * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
40
- *
41
- * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
42
- * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
43
- * Timestamp timestamp;
44
- * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
45
- * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
46
- *
47
- * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
48
- *
49
- * long millis = System.currentTimeMillis();
50
- *
51
- * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
52
- * .setNanos((int) ((millis % 1000) * 1000000)).build();
53
- *
54
- * Example 5: Compute Timestamp from Java `Instant.now()`.
55
- *
56
- * Instant now = Instant.now();
57
- *
58
- * Timestamp timestamp =
59
- * Timestamp.newBuilder().setSeconds(now.getEpochSecond())
60
- * .setNanos(now.getNano()).build();
61
- *
62
- * Example 6: Compute Timestamp from current time in Python.
63
- *
64
- * timestamp = Timestamp()
65
- * timestamp.GetCurrentTime()
66
- *
67
- * # JSON Mapping
68
- *
69
- * In JSON format, the Timestamp type is encoded as a string in the
70
- * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
71
- * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
72
- * where {year} is always expressed using four digits while {month}, {day},
73
- * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
74
- * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
75
- * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
76
- * is required. A proto3 JSON serializer should always use UTC (as indicated by
77
- * "Z") when printing the Timestamp type and a proto3 JSON parser should be
78
- * able to accept both UTC and other timezones (as indicated by an offset).
79
- *
80
- * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
81
- * 01:30 UTC on January 15, 2017.
82
- *
83
- * In JavaScript, one can convert a Date object to this format using the
84
- * standard
85
- * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
86
- * method. In Python, a standard `datetime.datetime` object can be converted
87
- * to this format using
88
- * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
89
- * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
90
- * the Joda Time's [`ISODateTimeFormat.dateTime()`](
91
- * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
92
- * ) to obtain a formatter capable of generating timestamps in this format.
93
- */
94
- export interface Timestamp {
95
- /**
96
- * Represents seconds of UTC time since Unix epoch
97
- * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
98
- * 9999-12-31T23:59:59Z inclusive.
99
- */
100
- seconds: string;
101
- /**
102
- * Non-negative fractions of a second at nanosecond resolution. Negative
103
- * second values with fractions must still have non-negative nanos values
104
- * that count forward in time. Must be from 0 to 999,999,999
105
- * inclusive.
106
- */
107
- nanos: number;
108
- }
109
- export declare const Timestamp: MessageFns<Timestamp>;
110
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
111
- export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
112
- [K in keyof T]?: DeepPartial<T[K]>;
113
- } : Partial<T>;
114
- type KeysOfUnion<T> = T extends T ? keyof T : never;
115
- export type Exact<P, I extends P> = P extends Builtin ? P : P & {
116
- [K in keyof P]: Exact<P[K], I[K]>;
117
- } & {
118
- [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
119
- };
120
- export interface MessageFns<T> {
121
- encode(message: T, writer?: BinaryWriter): BinaryWriter;
122
- decode(input: BinaryReader | Uint8Array, length?: number): T;
123
- fromJSON(object: any): T;
124
- toJSON(message: T): unknown;
125
- create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
126
- fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
127
- }
128
- export {};
@@ -1,102 +0,0 @@
1
- /**
2
- * Avatar SDK 内部共享常量
3
- * 跨平台统一配置,确保行为一致
4
- *
5
- * 对应:
6
- * - Android: AvatarPlayer.kt 中的 companion object
7
- * - iOS: (待实现)
8
- *
9
- * @internal
10
- */
11
- /** 帧间隔 (毫秒) */
12
- export declare const FLAME_FRAME_INTERVAL_MS: number;
13
- /** 开始过渡时长 (秒): idle -> speaking */
14
- export declare const START_TRANSITION_DURATION_S = 0.2;
15
- /** 结束过渡时长 (秒): speaking -> idle */
16
- export declare const END_TRANSITION_DURATION_S = 1.6;
17
- /** 开始过渡时长 (毫秒) */
18
- export declare const START_TRANSITION_DURATION_MS: number;
19
- /** 结束过渡时长 (毫秒) */
20
- export declare const END_TRANSITION_DURATION_MS: number;
21
- /** 默认音频采样率 (Hz) */
22
- export declare const AUDIO_SAMPLE_RATE = 16000;
23
- /** 音频声道数 (mono) */
24
- export declare const AUDIO_CHANNELS = 1;
25
- /** 每样本字节数 (16bit PCM) */
26
- export declare const AUDIO_BYTES_PER_SAMPLE = 2;
27
- /** 每秒音频字节数 */
28
- export declare const AUDIO_BYTES_PER_SECOND: number;
29
- /**
30
- * 各部位插值曲线控制点
31
- * 格式: [x1, y1, x2, y2] 对应 cubic-bezier(x1, y1, x2, y2)
32
- *
33
- * 与 Android FlameFrameData.kt 中的 BEZIER_CURVES 完全一致
34
- */
35
- export declare const BEZIER_CURVES: {
36
- /** 下颌: 快速启动,平滑停止 */
37
- readonly jaw: readonly [0.2, 0.8, 0.3, 1];
38
- /** 表情: 平滑 S 曲线 */
39
- readonly expression: readonly [0.4, 0, 0.2, 1];
40
- /** 眼部: 柔和 S 曲线 */
41
- readonly eye: readonly [0.3, 0, 0.1, 1];
42
- /** 颈部: 慢启动,惯性停止 */
43
- readonly neck: readonly [0.1, 0.2, 0.2, 1];
44
- /** 全局: 标准 ease-in-out */
45
- readonly global: readonly [0.42, 0, 0.58, 1];
46
- };
47
- /**
48
- * 各部位时间缩放因子
49
- * 控制各部位完成过渡所需的相对时间
50
- *
51
- * 与 Android FlameFrameData.kt 中的 TIME_SCALE 完全一致
52
- */
53
- export declare const TIME_SCALE: {
54
- /** 下颌: 40% 时间完成 (1/2.5) */
55
- readonly jaw: 2.5;
56
- /** 表情: 62.5% 时间完成 (1/1.6) */
57
- readonly expression: 1.6;
58
- /** 眼部: 77% 时间完成 (1/1.3) */
59
- readonly eye: 1.3;
60
- /** 颈部: 100% 时间完成 */
61
- readonly neck: 1;
62
- /** 全局: 100% 时间完成 */
63
- readonly global: 1;
64
- };
65
- export type BezierCurveKey = keyof typeof BEZIER_CURVES;
66
- export type TimeScaleKey = keyof typeof TIME_SCALE;
67
- export declare const AvatarConstants: {
68
- readonly FLAME_FRAME_RATE: 25;
69
- readonly FLAME_FRAME_INTERVAL_MS: number;
70
- readonly START_TRANSITION_DURATION_S: 0.2;
71
- readonly END_TRANSITION_DURATION_S: 1.6;
72
- readonly START_TRANSITION_DURATION_MS: number;
73
- readonly END_TRANSITION_DURATION_MS: number;
74
- readonly AUDIO_SAMPLE_RATE: 16000;
75
- readonly AUDIO_CHANNELS: 1;
76
- readonly AUDIO_BYTES_PER_SAMPLE: 2;
77
- readonly AUDIO_BYTES_PER_SECOND: number;
78
- readonly BEZIER_CURVES: {
79
- /** 下颌: 快速启动,平滑停止 */
80
- readonly jaw: readonly [0.2, 0.8, 0.3, 1];
81
- /** 表情: 平滑 S 曲线 */
82
- readonly expression: readonly [0.4, 0, 0.2, 1];
83
- /** 眼部: 柔和 S 曲线 */
84
- readonly eye: readonly [0.3, 0, 0.1, 1];
85
- /** 颈部: 慢启动,惯性停止 */
86
- readonly neck: readonly [0.1, 0.2, 0.2, 1];
87
- /** 全局: 标准 ease-in-out */
88
- readonly global: readonly [0.42, 0, 0.58, 1];
89
- };
90
- readonly TIME_SCALE: {
91
- /** 下颌: 40% 时间完成 (1/2.5) */
92
- readonly jaw: 2.5;
93
- /** 表情: 62.5% 时间完成 (1/1.6) */
94
- readonly expression: 1.6;
95
- /** 眼部: 77% 时间完成 (1/1.3) */
96
- readonly eye: 1.3;
97
- /** 颈部: 100% 时间完成 */
98
- readonly neck: 1;
99
- /** 全局: 100% 时间完成 */
100
- readonly global: 1;
101
- };
102
- };
@@ -1,7 +0,0 @@
1
- /**
2
- * Internal Module - 统一常量和配置
3
- *
4
- * 与 Android SDK 保持一致的配置,方便跨平台维护
5
- * @internal
6
- */
7
- export {};
@@ -1,9 +0,0 @@
1
- /**
2
- * Render System - Unified WebGL/WebGPU rendering management
3
- *
4
- * Responsibilities:
5
- * 1. Automatically select rendering backend (WebGPU preferred, fallback to WebGL)
6
- * 2. Camera management
7
- * 3. Matrix calculations
8
- */
9
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * 3D Covariance Matrix Calculation Utility
3
- * Used to calculate Gaussian Splat covariance matrix from scale and rotation parameters
4
- */
5
- export {};
@@ -1,12 +0,0 @@
1
- export interface Transform {
2
- x: number;
3
- y: number;
4
- scale: number;
5
- }
6
- export interface I3DGSRenderer {
7
- initialize: () => Promise<void>;
8
- loadSplatsFromPackedData: (packedData: Float32Array, pointCount: number, sortOrder?: Uint32Array) => void;
9
- render: (viewMatrix: Float32Array, projectionMatrix: Float32Array, screenSize: [number, number], transform?: Transform) => void;
10
- dispose: () => void;
11
- }
12
- export type RenderBackend = 'webgl' | 'webgpu';
@@ -1,5 +0,0 @@
1
- /**
2
- * Splat depth sorting (Radix Sort optimized version)
3
- * Uses 11-bit radix sort, O(n) time complexity
4
- */
5
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * Packed Data utility functions
3
- *
4
- * Packed format: [pos3, color4, cov6] x N points
5
- * Each point has 13 floats, 52 bytes total
6
- */
7
- export {};
@@ -1,96 +0,0 @@
1
- import { I3DGSRenderer, Transform } from '../renderer';
2
- export declare class WebGLRenderer implements I3DGSRenderer {
3
- private canvas;
4
- private backgroundColor;
5
- private gl;
6
- private shaderProgram;
7
- private uniformLocations;
8
- private attributeLocations;
9
- private splatBuffer;
10
- private quadVertexBuffer;
11
- private vertexArray;
12
- private splatCount;
13
- private isInitialized;
14
- private splatBufferSize;
15
- private framebuffer;
16
- private renderTexture;
17
- private depthBuffer;
18
- private framebufferWidth;
19
- private framebufferHeight;
20
- private blitShaderProgram;
21
- private blitUniformLocations;
22
- private blitAttributeLocations;
23
- private blitQuadBuffer;
24
- private blitVAO;
25
- constructor(canvas: HTMLCanvasElement, backgroundColor?: [number, number, number, number], alpha?: boolean);
26
- private alpha;
27
- /**
28
- * 初始化 WebGL 渲染器
29
- */
30
- initialize(): Promise<void>;
31
- /**
32
- * 设置着色器位置
33
- */
34
- private setupShaderLocations;
35
- /**
36
- * 设置 WebGL 渲染状态
37
- */
38
- private setupWebGLState;
39
- /**
40
- * 创建渲染缓冲区
41
- */
42
- private createBuffers;
43
- /**
44
- * 创建四边形顶点缓冲区(实例化渲染用)
45
- */
46
- private createQuadVertexBuffer;
47
- /**
48
- * 从已打包数据加载(零拷贝,GPU 优化路径)
49
- * 🚀 性能优化版本:直接使用 WASM 输出的 packed 数据
50
- * 🚀 Buffer 复用:避免每帧重新分配,使用 bufferSubData 更新
51
- * @param packedData Float32Array [pos3, color4, cov6] x N 个点
52
- * @param pointCount 点数
53
- * @param _sortOrder WebGL 忽略此参数(已在 RenderSystem 中重排序)
54
- */
55
- loadSplatsFromPackedData(packedData: Float32Array, pointCount: number, _sortOrder?: Uint32Array): void;
56
- /**
57
- * 上传数据到 GPU
58
- */
59
- private uploadToGPU;
60
- /**
61
- * 设置实例化渲染顶点属性
62
- */
63
- private setupVertexAttributes;
64
- /**
65
- * 渲染一帧
66
- */
67
- render(viewMatrix: Float32Array, projectionMatrix: Float32Array, screenSize: [number, number], transform?: Transform): void;
68
- /**
69
- * 创建着色器程序
70
- */
71
- private createShaderProgram;
72
- /**
73
- * 更新背景颜色
74
- */
75
- updateBackgroundColor(backgroundColor: [number, number, number, number]): void;
76
- /**
77
- * 渲染 3DGS 场景(公共方法,用于直接渲染和渲染到 framebuffer)
78
- */
79
- private render3DGS;
80
- /**
81
- * 创建 framebuffer 和 render texture
82
- */
83
- private createFramebuffer;
84
- /**
85
- * 创建 blit shader(用于绘制 render texture 到屏幕)
86
- */
87
- private createBlitShader;
88
- /**
89
- * 将 render texture 绘制到屏幕(应用 transform)
90
- */
91
- private blitToScreen;
92
- /**
93
- * 清理资源
94
- */
95
- dispose(): void;
96
- }