Skip to content

Commit 27485bc

Browse files
committed
fix(memory): fix QueryCPUMemoryService->isGeometryBufferNearlyFull:add judge indices16 and indices32
publish npm
1 parent 2e7add8 commit 27485bc

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wonder.js",
3-
"version": "1.1.0-alpha.7",
3+
"version": "1.1.0-alpha.8",
44
"authors": "Wonder",
55
"description": "3d webgl engine",
66
"homepage": "https://github.com/Wonder-Technology/Wonder.js",
Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
11
let isDisposeTooMany = (disposeCount: int, settingRecord) =>
22
disposeCount >= MemorySettingService.getMaxDisposeCount(settingRecord);
33

4-
let isGeometryBufferNearlyFull =
5-
(percent, {vertices, verticesOffset}: GeometryType.geometryRecord) => {
6-
let totalVerticesLength = vertices |> Js.Typed_array.Float32Array.length;
4+
let _isGeometryPointsNearlyFull = (percent, totalPointsLength, pointsOffset) =>
5+
(pointsOffset |> NumberType.convertIntToFloat)
6+
/. (totalPointsLength |> NumberType.convertIntToFloat) >= percent;
77

8-
(verticesOffset |> NumberType.convertIntToFloat)
9-
/. (totalVerticesLength |> NumberType.convertIntToFloat) >= percent;
10-
};
8+
let isGeometryBufferNearlyFull =
9+
(
10+
percent,
11+
{
12+
vertices,
13+
indices16,
14+
indices32,
15+
verticesOffset,
16+
indices16Offset,
17+
indices32Offset,
18+
}: GeometryType.geometryRecord,
19+
) =>
20+
Js.Typed_array.(
21+
_isGeometryPointsNearlyFull(
22+
percent,
23+
vertices |> Float32Array.length,
24+
verticesOffset,
25+
)
26+
|| _isGeometryPointsNearlyFull(
27+
percent,
28+
indices16 |> Uint16Array.length,
29+
indices16Offset,
30+
)
31+
|| _isGeometryPointsNearlyFull(
32+
percent,
33+
indices32 |> Uint32Array.length,
34+
indices32Offset,
35+
)
36+
);

0 commit comments

Comments
 (0)