@jack120/test 0.2.0 → 0.2.2
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.d.ts +1140 -0
- package/dist/index.js +1 -2415
- package/package.json +7 -2
- package/{library/adamas-types.d.ts → types/index.d.ts} +2 -5
- package/.gitmodules +0 -3
- package/.prettierrc +0 -6
- package/.vscode/c_cpp_properties.json +0 -14
- package/.vscode/launch.json +0 -24
- package/.vscode/settings.json +0 -8
- package/CMakeLists.txt +0 -52
- package/adamas-config.json +0 -5
- package/external/CMakeLists.txt +0 -1
- package/external/Unity-NodeJS-RPC/CMakeLists.txt +0 -13
- package/external/Unity-NodeJS-RPC/README.md +0 -1
- package/external/Unity-NodeJS-RPC/RpcClient.cpp +0 -265
- package/external/Unity-NodeJS-RPC/include/RpcClient.h +0 -118
- package/external/Unity-NodeJS-RPC/main.cpp +0 -76
- package/external/Unity-NodeJS-RPC/nlohmann/json.hpp +0 -25526
- package/external/Unity-NodeJS-RPC/server/Program.cs +0 -52
- package/external/Unity-NodeJS-RPC/server/json.cs +0 -66
- package/external/Unity-NodeJS-RPC/server/rpc.cs +0 -369
- package/external/Unity-NodeJS-RPC/server/sample1.csproj +0 -10
- package/external/Unity-NodeJS-RPC/server/sample1.sln +0 -24
- package/external/Unity-NodeJS-RPC/server/unity/RpcUnity.cs.txt +0 -60
- package/index.ts +0 -36
- package/library/debug.ts +0 -7
- package/library/device.ts +0 -279
- package/library/entity.ts +0 -35
- package/library/index.ts +0 -19
- package/library/interaction/interaction.ts +0 -281
- package/library/native-bindings-osx.node +0 -0
- package/library/native-bindings-win.node +0 -0
- package/library/networking/state-sync.ts +0 -62
- package/library/physics/collider.ts +0 -252
- package/library/physics/rigidbody.ts +0 -119
- package/library/render/camera.ts +0 -172
- package/library/render/light.ts +0 -169
- package/library/render/material.ts +0 -258
- package/library/render/mesh.ts +0 -208
- package/library/render/primitives.ts +0 -76
- package/library/render/renderable.ts +0 -137
- package/library/render/renderer.ts +0 -124
- package/library/render/scene.ts +0 -89
- package/library/render/texture.ts +0 -247
- package/library/render/transform.ts +0 -259
- package/library/rpc.ts +0 -81
- package/library/utilities/base64.ts +0 -63
- package/loader-template.ts +0 -419
- package/native.cc +0 -111
- package/project.adamas.json +0 -457
- package/rusk.glb +0 -0
- package/samples/device-sample.ts +0 -30
- package/samples/interaction-sample.ts +0 -134
- package/samples/physics-sample.ts +0 -39
- package/samples/rendering-sample.ts +0 -88
- package/samples/spawn-cube.ts +0 -422
- package/samples/state-sync-sample.ts +0 -25
- package/tsconfig.json +0 -20
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import { Entity } from "../entity";
|
|
2
|
-
import { RpcClient } from "../rpc";
|
|
3
|
-
import { vec3 } from "gl-matrix";
|
|
4
|
-
|
|
5
|
-
export type ColliderHandle = number;
|
|
6
|
-
|
|
7
|
-
export class ColliderManager {
|
|
8
|
-
static CreateBox(entityHandle: Entity): ColliderHandle {
|
|
9
|
-
return Number(
|
|
10
|
-
RpcClient.Call("ColliderAPI_CreateBox", {
|
|
11
|
-
entityHandle,
|
|
12
|
-
}),
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
static CreateSphere(entityHandle: Entity): ColliderHandle {
|
|
17
|
-
return Number(
|
|
18
|
-
RpcClient.Call("ColliderAPI_CreateSphere", {
|
|
19
|
-
entityHandle,
|
|
20
|
-
}),
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
static CreateCapsule(entityHandle: Entity): ColliderHandle {
|
|
25
|
-
return Number(
|
|
26
|
-
RpcClient.Call("ColliderAPI_CreateCapsule", {
|
|
27
|
-
entityHandle,
|
|
28
|
-
}),
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
static Destroy(
|
|
33
|
-
entityHandle: Entity,
|
|
34
|
-
colliderHandle: ColliderHandle,
|
|
35
|
-
): boolean {
|
|
36
|
-
return Boolean(
|
|
37
|
-
RpcClient.Call("ColliderAPI_Destroy", {
|
|
38
|
-
entityHandle,
|
|
39
|
-
colliderHandle,
|
|
40
|
-
}),
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
static HasComponent(
|
|
45
|
-
entityHandle: Entity,
|
|
46
|
-
colliderHandle: ColliderHandle,
|
|
47
|
-
): boolean {
|
|
48
|
-
return Boolean(
|
|
49
|
-
RpcClient.Call("ColliderAPI_HasComponent", {
|
|
50
|
-
entityHandle,
|
|
51
|
-
colliderHandle,
|
|
52
|
-
}),
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
static GetGameObject(entityHandle: Entity): ColliderHandle {
|
|
57
|
-
return Number(
|
|
58
|
-
RpcClient.Call("ColliderAPI_GetGameObject", {
|
|
59
|
-
entityHandle,
|
|
60
|
-
}),
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
static GetBoxColliderCenter(colliderHandle: ColliderHandle): vec3 {
|
|
65
|
-
const center = JSON.parse(
|
|
66
|
-
RpcClient.Call("ColliderAPI_GetBoxColliderCenter", {
|
|
67
|
-
colliderHandle,
|
|
68
|
-
}) as string,
|
|
69
|
-
) as number[];
|
|
70
|
-
|
|
71
|
-
return vec3.fromValues(center[0], center[1], center[2]);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static SetBoxColliderCenter(
|
|
75
|
-
colliderHandle: ColliderHandle,
|
|
76
|
-
center: vec3,
|
|
77
|
-
): boolean {
|
|
78
|
-
return RpcClient.Call("ColliderAPI_SetBoxColliderCenter", {
|
|
79
|
-
colliderHandle,
|
|
80
|
-
v0: center[0],
|
|
81
|
-
v1: center[1],
|
|
82
|
-
v2: center[2],
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
static GetBoxColliderSize(colliderHandle: ColliderHandle): vec3 {
|
|
87
|
-
const center = JSON.parse(
|
|
88
|
-
RpcClient.Call("ColliderAPI_GetBoxColliderSize", {
|
|
89
|
-
colliderHandle,
|
|
90
|
-
}) as string,
|
|
91
|
-
) as number[];
|
|
92
|
-
|
|
93
|
-
return vec3.fromValues(center[0], center[1], center[2]);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
static SetBoxColliderSize(
|
|
97
|
-
colliderHandle: ColliderHandle,
|
|
98
|
-
size: vec3,
|
|
99
|
-
): boolean {
|
|
100
|
-
return RpcClient.Call("ColliderAPI_SetBoxColliderSize", {
|
|
101
|
-
colliderHandle,
|
|
102
|
-
v0: size[0],
|
|
103
|
-
v1: size[1],
|
|
104
|
-
v2: size[2],
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
static GetSphereColliderCenter(colliderHandle: ColliderHandle): vec3 {
|
|
109
|
-
const center = JSON.parse(
|
|
110
|
-
RpcClient.Call("ColliderAPI_GetSphereColliderCenter", {
|
|
111
|
-
colliderHandle,
|
|
112
|
-
}) as string,
|
|
113
|
-
) as number[];
|
|
114
|
-
|
|
115
|
-
return vec3.fromValues(center[0], center[1], center[2]);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
static SetSphereColliderCenter(
|
|
119
|
-
colliderHandle: ColliderHandle,
|
|
120
|
-
center: vec3,
|
|
121
|
-
): boolean {
|
|
122
|
-
return RpcClient.Call("ColliderAPI_SetSphereColliderCenter", {
|
|
123
|
-
colliderHandle,
|
|
124
|
-
v0: center[0],
|
|
125
|
-
v1: center[1],
|
|
126
|
-
v2: center[2],
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
static GetSphereColliderRadius(colliderHandle: ColliderHandle): number {
|
|
131
|
-
return RpcClient.Call("ColliderAPI_GetSphereColliderRadius", {
|
|
132
|
-
colliderHandle,
|
|
133
|
-
}) as number;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
static SetSphereColliderRadius(
|
|
137
|
-
colliderHandle: ColliderHandle,
|
|
138
|
-
radius: number,
|
|
139
|
-
): boolean {
|
|
140
|
-
return RpcClient.Call("ColliderAPI_SetSphereColliderRadius", {
|
|
141
|
-
colliderHandle,
|
|
142
|
-
radius,
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
static GetCapsuleColliderCenter(colliderHandle: ColliderHandle): vec3 {
|
|
147
|
-
const center = JSON.parse(
|
|
148
|
-
RpcClient.Call("ColliderAPI_GetCapsuleColliderCenter", {
|
|
149
|
-
colliderHandle,
|
|
150
|
-
}) as string,
|
|
151
|
-
) as number[];
|
|
152
|
-
|
|
153
|
-
return vec3.fromValues(center[0], center[1], center[2]);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
static SetCapsuleColliderCenter(
|
|
157
|
-
colliderHandle: ColliderHandle,
|
|
158
|
-
center: vec3,
|
|
159
|
-
): boolean {
|
|
160
|
-
return RpcClient.Call("ColliderAPI_SetCapsuleColliderCenter", {
|
|
161
|
-
colliderHandle,
|
|
162
|
-
v0: center[0],
|
|
163
|
-
v1: center[1],
|
|
164
|
-
v2: center[2],
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
static GetCapsuleColliderRadius(colliderHandle: ColliderHandle): number {
|
|
169
|
-
return RpcClient.Call("ColliderAPI_GetCapsuleColliderRadius", {
|
|
170
|
-
colliderHandle,
|
|
171
|
-
}) as number;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
static SetCapsuleColliderRadius(
|
|
175
|
-
colliderHandle: ColliderHandle,
|
|
176
|
-
radius: number,
|
|
177
|
-
): boolean {
|
|
178
|
-
return RpcClient.Call("ColliderAPI_SetCapsuleColliderRadius", {
|
|
179
|
-
colliderHandle,
|
|
180
|
-
radius,
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
static GetCapsuleColliderHeight(colliderHandle: ColliderHandle): number {
|
|
185
|
-
return RpcClient.Call("ColliderAPI_GetCapsuleColliderHeight", {
|
|
186
|
-
colliderHandle,
|
|
187
|
-
}) as number;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
static SetCapsuleColliderHeight(
|
|
191
|
-
colliderHandle: ColliderHandle,
|
|
192
|
-
height: number,
|
|
193
|
-
): boolean {
|
|
194
|
-
return RpcClient.Call("ColliderAPI_SetCapsuleColliderHeight", {
|
|
195
|
-
colliderHandle,
|
|
196
|
-
height,
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
static GetIsTrigger(entityHandle: Entity): Boolean {
|
|
201
|
-
return Boolean(
|
|
202
|
-
RpcClient.Call("ColliderAPI_GetIsTrigger", {
|
|
203
|
-
entityHandle,
|
|
204
|
-
}),
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
static SetIsTrigger(colliderHandle: Entity, isTrigger: boolean): Boolean {
|
|
209
|
-
return Boolean(
|
|
210
|
-
RpcClient.Call("ColliderAPI_SetIsTrigger", {
|
|
211
|
-
colliderHandle,
|
|
212
|
-
isTrigger,
|
|
213
|
-
}),
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
static AddTriggerEnterCallback(
|
|
218
|
-
entityHandle: Entity,
|
|
219
|
-
onTriggerEnter: () => void,
|
|
220
|
-
): boolean {
|
|
221
|
-
return Boolean(
|
|
222
|
-
RpcClient.Call("ColliderAPI_AddTriggerEnterCallback", {
|
|
223
|
-
entityHandle,
|
|
224
|
-
onTriggerEnter,
|
|
225
|
-
}),
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
static AddTriggerExitCallback(
|
|
230
|
-
entityHandle: Entity,
|
|
231
|
-
onTriggerExit: () => void,
|
|
232
|
-
): boolean {
|
|
233
|
-
return Boolean(
|
|
234
|
-
RpcClient.Call("ColliderAPI_AddTriggerExitCallback", {
|
|
235
|
-
entityHandle,
|
|
236
|
-
onTriggerExit,
|
|
237
|
-
}),
|
|
238
|
-
);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
static AddTriggerStayCallback(
|
|
242
|
-
entityHandle: Entity,
|
|
243
|
-
onTriggerStay: () => void,
|
|
244
|
-
): boolean {
|
|
245
|
-
return Boolean(
|
|
246
|
-
RpcClient.Call("ColliderAPI_AddTriggerStayCallback", {
|
|
247
|
-
entityHandle,
|
|
248
|
-
onTriggerStay,
|
|
249
|
-
}),
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { Entity } from "../entity";
|
|
2
|
-
import { RpcClient } from "../rpc";
|
|
3
|
-
|
|
4
|
-
export class RigidbodyManager {
|
|
5
|
-
static Create(entityHandle: Entity): boolean {
|
|
6
|
-
return Boolean(
|
|
7
|
-
RpcClient.Call("RidigbodyAPI_Create", {
|
|
8
|
-
entityHandle,
|
|
9
|
-
}),
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
static Destroy(entityHandle: Entity): boolean {
|
|
14
|
-
return Boolean(
|
|
15
|
-
RpcClient.Call("RidigbodyAPI_Destroy", {
|
|
16
|
-
entityHandle,
|
|
17
|
-
}),
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
static HasComponent(entityHandle: Entity): boolean {
|
|
22
|
-
return Boolean(
|
|
23
|
-
RpcClient.Call("RidigbodyAPI_HasComponent", {
|
|
24
|
-
entityHandle,
|
|
25
|
-
}),
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static GetIsKinematic(entityHandle: Entity): boolean {
|
|
30
|
-
return Boolean(
|
|
31
|
-
RpcClient.Call("RidigbodyAPI_GetIsKinematic", {
|
|
32
|
-
entityHandle,
|
|
33
|
-
}),
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static SetIsKinematic(entityHandle: Entity, isKinematic: boolean): boolean {
|
|
38
|
-
return Boolean(
|
|
39
|
-
RpcClient.Call("RidigbodyAPI_SetIsKinematic", {
|
|
40
|
-
entityHandle,
|
|
41
|
-
isKinematic,
|
|
42
|
-
}),
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
static GetUseGravity(entityHandle: Entity): boolean {
|
|
47
|
-
return Boolean(
|
|
48
|
-
RpcClient.Call("RidigbodyAPI_GetUseGravity", {
|
|
49
|
-
entityHandle,
|
|
50
|
-
}),
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
static SetUseGravity(entityHandle: Entity, useGravity: boolean): boolean {
|
|
55
|
-
return Boolean(
|
|
56
|
-
RpcClient.Call("RidigbodyAPI_SetUseGravity", {
|
|
57
|
-
entityHandle,
|
|
58
|
-
useGravity,
|
|
59
|
-
}),
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
static GetMass(entityHandle: Entity): number {
|
|
64
|
-
return Number(
|
|
65
|
-
RpcClient.Call("RidigbodyAPI_GetMass", {
|
|
66
|
-
entityHandle,
|
|
67
|
-
}),
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
static SetMass(entityHandle: Entity, mass: number): boolean {
|
|
72
|
-
return Boolean(
|
|
73
|
-
RpcClient.Call("RidigbodyAPI_SetMass", {
|
|
74
|
-
entityHandle,
|
|
75
|
-
mass,
|
|
76
|
-
}),
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
static GetLinearDamping(entityHandle: Entity): number {
|
|
81
|
-
return Number(
|
|
82
|
-
RpcClient.Call("RidigbodyAPI_GetLinearDamping", {
|
|
83
|
-
entityHandle,
|
|
84
|
-
}),
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
static SetLinearDamping(
|
|
89
|
-
entityHandle: Entity,
|
|
90
|
-
linearDamping: number,
|
|
91
|
-
): boolean {
|
|
92
|
-
return Boolean(
|
|
93
|
-
RpcClient.Call("RidigbodyAPI_SetLinearDamping", {
|
|
94
|
-
entityHandle,
|
|
95
|
-
linearDamping,
|
|
96
|
-
}),
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
static GetAngularDamping(entityHandle: Entity): number {
|
|
101
|
-
return Number(
|
|
102
|
-
RpcClient.Call("RidigbodyAPI_GetAngularDamping", {
|
|
103
|
-
entityHandle,
|
|
104
|
-
}),
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
static SetAngularDamping(
|
|
109
|
-
entityHandle: Entity,
|
|
110
|
-
angularDamping: number,
|
|
111
|
-
): boolean {
|
|
112
|
-
return Boolean(
|
|
113
|
-
RpcClient.Call("RidigbodyAPI_SetAngularDamping", {
|
|
114
|
-
entityHandle,
|
|
115
|
-
angularDamping,
|
|
116
|
-
}),
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
}
|
package/library/render/camera.ts
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { RpcClient } from "../rpc";
|
|
2
|
-
import { Entity } from "../entity";
|
|
3
|
-
import { TextureHandle } from "./texture";
|
|
4
|
-
|
|
5
|
-
export class CameraManager {
|
|
6
|
-
/**
|
|
7
|
-
* Create a Camera component and attach it to the specified entity
|
|
8
|
-
* @param entity The entity to attach the camera to
|
|
9
|
-
* @returns boolean indicating success
|
|
10
|
-
*/
|
|
11
|
-
static Create(entity: Entity): boolean {
|
|
12
|
-
return Boolean(RpcClient.Call("Camera_Create", { entityHandle: entity }));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Destroy the Camera component from the specified entity
|
|
17
|
-
* @param entity The entity to remove the camera from
|
|
18
|
-
* @returns boolean indicating success
|
|
19
|
-
*/
|
|
20
|
-
static Destroy(entity: Entity): boolean {
|
|
21
|
-
return Boolean(RpcClient.Call("Camera_Destroy", { entityHandle: entity }));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Check if the entity has a Camera component
|
|
26
|
-
* @param entity The entity to check
|
|
27
|
-
* @returns boolean indicating if camera component exists
|
|
28
|
-
*/
|
|
29
|
-
static HasComponent(entity: Entity): boolean {
|
|
30
|
-
return Boolean(
|
|
31
|
-
RpcClient.Call("Camera_HasComponent", { entityHandle: entity }),
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Set the projection parameters for the camera
|
|
37
|
-
* @param entity The entity with the camera component
|
|
38
|
-
* @param projectionType Type of projection
|
|
39
|
-
* @param fov Field of view
|
|
40
|
-
* @param aspect Aspect ratio
|
|
41
|
-
* @param near Near plane
|
|
42
|
-
* @param far Far plane
|
|
43
|
-
* @returns boolean indicating success
|
|
44
|
-
*/
|
|
45
|
-
static SetProjection(
|
|
46
|
-
entity: Entity,
|
|
47
|
-
projectionType: number,
|
|
48
|
-
fov: number,
|
|
49
|
-
aspect: number,
|
|
50
|
-
near: number,
|
|
51
|
-
far: number,
|
|
52
|
-
): boolean {
|
|
53
|
-
return Boolean(
|
|
54
|
-
RpcClient.Call("Camera_SetProjection", {
|
|
55
|
-
entityHandle: entity,
|
|
56
|
-
projectionType,
|
|
57
|
-
fov,
|
|
58
|
-
aspect,
|
|
59
|
-
near,
|
|
60
|
-
far,
|
|
61
|
-
}),
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Set orthographic projection parameters
|
|
67
|
-
* @param entity The entity with the camera component
|
|
68
|
-
* @param left Left plane
|
|
69
|
-
* @param right Right plane
|
|
70
|
-
* @param bottom Bottom plane
|
|
71
|
-
* @param top Top plane
|
|
72
|
-
* @param near Near plane
|
|
73
|
-
* @param far Far plane
|
|
74
|
-
* @returns boolean indicating success
|
|
75
|
-
*/
|
|
76
|
-
static SetOrthographic(
|
|
77
|
-
entity: Entity,
|
|
78
|
-
left: number,
|
|
79
|
-
right: number,
|
|
80
|
-
bottom: number,
|
|
81
|
-
top: number,
|
|
82
|
-
near: number,
|
|
83
|
-
far: number,
|
|
84
|
-
): boolean {
|
|
85
|
-
return Boolean(
|
|
86
|
-
RpcClient.Call("Camera_SetOrthographic", {
|
|
87
|
-
entityHandle: entity,
|
|
88
|
-
left,
|
|
89
|
-
right,
|
|
90
|
-
bottom,
|
|
91
|
-
top,
|
|
92
|
-
near,
|
|
93
|
-
far,
|
|
94
|
-
}),
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Make the camera look at a target point
|
|
100
|
-
* @param entity The entity with the camera component
|
|
101
|
-
* @param targetX Target X coordinate
|
|
102
|
-
* @param targetY Target Y coordinate
|
|
103
|
-
* @param targetZ Target Z coordinate
|
|
104
|
-
* @param upX Up vector X
|
|
105
|
-
* @param upY Up vector Y
|
|
106
|
-
* @param upZ Up vector Z
|
|
107
|
-
* @param worldUpX World up X
|
|
108
|
-
* @param worldUpY World up Y
|
|
109
|
-
* @param worldUpZ World up Z
|
|
110
|
-
* @returns boolean indicating success
|
|
111
|
-
*/
|
|
112
|
-
static LookAt(
|
|
113
|
-
entity: Entity,
|
|
114
|
-
targetX: number,
|
|
115
|
-
targetY: number,
|
|
116
|
-
targetZ: number,
|
|
117
|
-
upX: number,
|
|
118
|
-
upY: number,
|
|
119
|
-
upZ: number,
|
|
120
|
-
worldUpX: number,
|
|
121
|
-
worldUpY: number,
|
|
122
|
-
worldUpZ: number,
|
|
123
|
-
): boolean {
|
|
124
|
-
return Boolean(
|
|
125
|
-
RpcClient.Call("Camera_LookAt", {
|
|
126
|
-
entityHandle: entity,
|
|
127
|
-
targetX,
|
|
128
|
-
targetY,
|
|
129
|
-
targetZ,
|
|
130
|
-
upX,
|
|
131
|
-
upY,
|
|
132
|
-
upZ,
|
|
133
|
-
worldUpX,
|
|
134
|
-
worldUpY,
|
|
135
|
-
worldUpZ,
|
|
136
|
-
}),
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Set the culling mask for the camera
|
|
142
|
-
* @param entity The entity with the camera component
|
|
143
|
-
* @param mask The culling mask
|
|
144
|
-
* @returns boolean indicating success
|
|
145
|
-
*/
|
|
146
|
-
static SetCullingMask(entity: Entity, mask: number): boolean {
|
|
147
|
-
return Boolean(
|
|
148
|
-
RpcClient.Call("Camera_SetCullingMask", {
|
|
149
|
-
entityHandle: entity,
|
|
150
|
-
mask,
|
|
151
|
-
}),
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Set the render texture for the camera
|
|
157
|
-
* @param entity The entity with the camera component
|
|
158
|
-
* @param textureHandle The render texture handle
|
|
159
|
-
* @returns boolean indicating success
|
|
160
|
-
*/
|
|
161
|
-
static SetRenderTexture(
|
|
162
|
-
entity: Entity,
|
|
163
|
-
textureHandle: TextureHandle,
|
|
164
|
-
): boolean {
|
|
165
|
-
return Boolean(
|
|
166
|
-
RpcClient.Call("Camera_SetRenderTexture", {
|
|
167
|
-
entityHandle: entity,
|
|
168
|
-
renderTextureHandle: textureHandle,
|
|
169
|
-
}),
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
}
|
package/library/render/light.ts
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { RpcClient } from "../rpc";
|
|
2
|
-
import { Entity } from "../entity";
|
|
3
|
-
import { vec3 } from "gl-matrix";
|
|
4
|
-
|
|
5
|
-
export class LightManager {
|
|
6
|
-
/**
|
|
7
|
-
* Create a Light component and attach it to the specified entity
|
|
8
|
-
* @param entity The entity to attach the light to
|
|
9
|
-
* @param type The type of light to create
|
|
10
|
-
* @returns boolean indicating success
|
|
11
|
-
*/
|
|
12
|
-
static Create(entity: Entity, type: LightType): boolean {
|
|
13
|
-
return Boolean(
|
|
14
|
-
RpcClient.Call("Light_Create", {
|
|
15
|
-
entityHandle: entity,
|
|
16
|
-
lightType: type, // 0=Spot,1=Directional,2=Point,3=Area
|
|
17
|
-
}),
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Destroy the Light component from the specified entity
|
|
23
|
-
* @param entity The entity to remove the light from
|
|
24
|
-
* @returns boolean indicating success
|
|
25
|
-
*/
|
|
26
|
-
static Destroy(entity: Entity): boolean {
|
|
27
|
-
return Boolean(RpcClient.Call("Light_Destroy", { entityHandle: entity }));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Check if the entity has a Light component
|
|
32
|
-
* @param entity The entity to check
|
|
33
|
-
* @returns boolean indicating if light component exists
|
|
34
|
-
*/
|
|
35
|
-
static HasComponent(entity: Entity): boolean {
|
|
36
|
-
return Boolean(
|
|
37
|
-
RpcClient.Call("Light_HasComponent", { entityHandle: entity }),
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Set the type of light
|
|
43
|
-
* @param entity The entity with the light component
|
|
44
|
-
* @param type The light type
|
|
45
|
-
* @returns boolean indicating success
|
|
46
|
-
*/
|
|
47
|
-
static SetType(entity: Entity, type: LightType): boolean {
|
|
48
|
-
return Boolean(
|
|
49
|
-
RpcClient.Call("Light_SetType", {
|
|
50
|
-
entityHandle: entity,
|
|
51
|
-
lightType: type, // 0=Spot,1=Directional,2=Point,3=Area
|
|
52
|
-
}),
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Set the color of the light
|
|
58
|
-
* @param entity The entity with the light component
|
|
59
|
-
* @param r Red component (0-1)
|
|
60
|
-
* @param g Green component (0-1)
|
|
61
|
-
* @param b Blue component (0-1)
|
|
62
|
-
* @returns boolean indicating success
|
|
63
|
-
*/
|
|
64
|
-
static SetColor(entity: Entity, rgb: vec3): boolean {
|
|
65
|
-
return Boolean(
|
|
66
|
-
RpcClient.Call("Light_SetColor", {
|
|
67
|
-
entityHandle: entity,
|
|
68
|
-
r: rgb[0],
|
|
69
|
-
g: rgb[1],
|
|
70
|
-
b: rgb[2],
|
|
71
|
-
}),
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Set the intensity of the light
|
|
77
|
-
* @param entity The entity with the light component
|
|
78
|
-
* @param intensity The light intensity
|
|
79
|
-
* @returns boolean indicating success
|
|
80
|
-
*/
|
|
81
|
-
static SetIntensity(entity: Entity, intensity: number): boolean {
|
|
82
|
-
return Boolean(
|
|
83
|
-
RpcClient.Call("Light_SetIntensity", {
|
|
84
|
-
entityHandle: entity,
|
|
85
|
-
intensity,
|
|
86
|
-
}),
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Set the range of the light
|
|
92
|
-
* @param entity The entity with the light component
|
|
93
|
-
* @param range The light range
|
|
94
|
-
* @returns boolean indicating success
|
|
95
|
-
*/
|
|
96
|
-
static SetRange(entity: Entity, range: number): boolean {
|
|
97
|
-
return Boolean(
|
|
98
|
-
RpcClient.Call("Light_SetRange", {
|
|
99
|
-
entityHandle: entity,
|
|
100
|
-
range,
|
|
101
|
-
}),
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Set the spot angle for spot lights
|
|
107
|
-
* @param entity The entity with the light component
|
|
108
|
-
* @param angle The spot angle
|
|
109
|
-
* @param asDegrees Whether the angle is in degrees (default: true)
|
|
110
|
-
* @returns boolean indicating success
|
|
111
|
-
*/
|
|
112
|
-
static SetSpotAngle(
|
|
113
|
-
entity: Entity,
|
|
114
|
-
angle: number,
|
|
115
|
-
asDegrees = true,
|
|
116
|
-
): boolean {
|
|
117
|
-
return Boolean(
|
|
118
|
-
RpcClient.Call("Light_SetSpotAngle", {
|
|
119
|
-
entityHandle: entity,
|
|
120
|
-
angle,
|
|
121
|
-
// third param "bool" unused in bridge—always true
|
|
122
|
-
value: asDegrees,
|
|
123
|
-
}),
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Set the shadow mode for the light
|
|
129
|
-
* @param entity The entity with the light component
|
|
130
|
-
* @param mode The shadow mode
|
|
131
|
-
* @returns boolean indicating success
|
|
132
|
-
*/
|
|
133
|
-
static SetShadows(entity: Entity, mode: LightShadowMode): boolean {
|
|
134
|
-
return Boolean(
|
|
135
|
-
RpcClient.Call("Light_SetShadows", {
|
|
136
|
-
entityHandle: entity,
|
|
137
|
-
shadowType: mode, // 0=NoShadows,1=Hard,2=Soft
|
|
138
|
-
}),
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Set the culling mask for the light
|
|
144
|
-
* @param entity The entity with the light component
|
|
145
|
-
* @param mask The culling mask
|
|
146
|
-
* @returns boolean indicating success
|
|
147
|
-
*/
|
|
148
|
-
static SetCullingMask(entity: Entity, mask: number): boolean {
|
|
149
|
-
return Boolean(
|
|
150
|
-
RpcClient.Call("Light_SetCullingMask", {
|
|
151
|
-
entityHandle: entity,
|
|
152
|
-
mask,
|
|
153
|
-
}),
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export enum LightShadowMode {
|
|
159
|
-
NoShadows = 0,
|
|
160
|
-
Hard = 1,
|
|
161
|
-
Soft = 2,
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export enum LightType {
|
|
165
|
-
Spot = 0,
|
|
166
|
-
Directional = 1,
|
|
167
|
-
Point = 2,
|
|
168
|
-
Area = 3,
|
|
169
|
-
}
|