mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-10 11:16:10 +01:00
YZ correction across collision and glb
This commit is contained in:
7 files changed
+579
-406
No files matched your search
@@ -137,6 +137,13 @@ interface RbAabbox {
|
||||
maximum: number[];
|
||||
}
|
||||
|
||||
export type ComponentName = Component["comp.typename"];
|
||||
|
||||
export type ComponentOf<Name extends ComponentName> = Extract<
|
||||
Component,
|
||||
{ "comp.typename": Name }
|
||||
>;
|
||||
|
||||
export type Component =
|
||||
| {
|
||||
"comp.typename": "TransformComponent";
|
||||
|
||||
@@ -16,13 +16,16 @@ interface PolygonGroupRaw {
|
||||
vertices: ArrayBuffer;
|
||||
}
|
||||
|
||||
type BlitzkitVertex = { attribute: VertexAttribute; value: number[] }[];
|
||||
export type Vertex = { attribute: VertexAttribute; value: number[] }[];
|
||||
|
||||
interface BlitzkitPolygonGroup {
|
||||
vertices: BlitzkitVertex[];
|
||||
export interface PolygonGroup {
|
||||
vertices: Vertex[];
|
||||
indices: number[];
|
||||
}
|
||||
|
||||
/** polygon group id -> polygon group */
|
||||
export type ScgPolygonGroups = Map<bigint, PolygonGroup>;
|
||||
|
||||
const vertexAttributesArray = Object.values(VertexAttribute).filter(
|
||||
(value) => typeof value === "number",
|
||||
);
|
||||
@@ -63,7 +66,7 @@ export class ScgReadStream extends ScpgReadStream {
|
||||
scg() {
|
||||
const header = this.header();
|
||||
const polygonGroupsRaw: PolygonGroupRaw[] = [];
|
||||
const polygonGroups = new Map<bigint, BlitzkitPolygonGroup>();
|
||||
const polygonGroups = new Map<bigint, PolygonGroup>();
|
||||
|
||||
for (let index = 0; index < header.nodeCount; index++) {
|
||||
const polygonGroupRaw = this.ka() as PolygonGroupRaw;
|
||||
@@ -83,7 +86,7 @@ export class ScgReadStream extends ScpgReadStream {
|
||||
}
|
||||
|
||||
const verticesStream = new ScpgReadStream(polygonGroupRaw.vertices);
|
||||
const vertices: BlitzkitVertex[] = [];
|
||||
const vertices: Vertex[] = [];
|
||||
const { format, stride } = ScgReadStream.parseVertexFormat(
|
||||
polygonGroupRaw.vertexFormat,
|
||||
);
|
||||
@@ -110,7 +113,7 @@ export class ScgReadStream extends ScpgReadStream {
|
||||
);
|
||||
});
|
||||
|
||||
return polygonGroups;
|
||||
return polygonGroups satisfies ScgPolygonGroups;
|
||||
}
|
||||
|
||||
static parseVertexFormat(formatInt: number) {
|
||||
|
||||
Reference in new issue
Block a user