@umicat/three-sdk 0.8.4 → 0.8.5
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/SceneLoader3D.js +9 -2
- package/dist/scene3d.d.ts +9 -0
- package/package.json +1 -1
package/dist/SceneLoader3D.js
CHANGED
|
@@ -132,7 +132,7 @@ export async function loadScene3D(scene3d, manifest, opts = {}) {
|
|
|
132
132
|
const mesh = o;
|
|
133
133
|
if (!mesh.isMesh)
|
|
134
134
|
return;
|
|
135
|
-
mesh.castShadow =
|
|
135
|
+
mesh.castShadow = e.castShadow !== false;
|
|
136
136
|
mesh.receiveShadow = true;
|
|
137
137
|
// A SkinnedMesh's bounding sphere is computed from the BIND pose and
|
|
138
138
|
// does not follow the bones. Once the object moves, three.js culls it
|
|
@@ -242,7 +242,14 @@ export async function loadScene3D(scene3d, manifest, opts = {}) {
|
|
|
242
242
|
// would otherwise be lit from the side of a box centred somewhere else.
|
|
243
243
|
d.target.position.copy(centre);
|
|
244
244
|
scene.add(d.target);
|
|
245
|
-
|
|
245
|
+
// Sized for the DEVICE, not for the desktop it was written on. A
|
|
246
|
+
// 2048 map is four megapixels of extra render target every frame, and
|
|
247
|
+
// a phone is already drawing at 2x for its screen — that combination
|
|
248
|
+
// took a board from smooth on a laptop to visibly dropping frames on
|
|
249
|
+
// an iPhone while looking identical in a screenshot.
|
|
250
|
+
const dense = typeof window !== 'undefined' && (window.devicePixelRatio ?? 1) > 2;
|
|
251
|
+
const map = dense ? 512 : 1024;
|
|
252
|
+
d.shadow.mapSize.set(map, map);
|
|
246
253
|
d.shadow.bias = -0.0012;
|
|
247
254
|
}
|
|
248
255
|
}
|
package/dist/scene3d.d.ts
CHANGED
|
@@ -83,6 +83,15 @@ export interface Entity3D {
|
|
|
83
83
|
/** Free-form, read by game code. The 2D SDK's `properties` equivalent. */
|
|
84
84
|
properties?: Record<string, unknown>;
|
|
85
85
|
visible?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Whether this entity casts a shadow. Defaults to true.
|
|
88
|
+
*
|
|
89
|
+
* Set it false for ground: a flat tile casting onto the flat tile beside it
|
|
90
|
+
* produces nothing anyone can see and costs a full extra draw of that mesh
|
|
91
|
+
* every frame. A board made of 144 tiles was drawing 288 times for 144
|
|
92
|
+
* tiles' worth of picture.
|
|
93
|
+
*/
|
|
94
|
+
castShadow?: boolean;
|
|
86
95
|
}
|
|
87
96
|
/**
|
|
88
97
|
* Semantic clip name → the clip actually inside the model.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umicat/three-sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "Three.js runtime for Umicat games: the scene3d design format, its loader with physics, a kinematic character controller, and the Umicat platform via @umicat/platform-sdk.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|