mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
fix: warehouse
This commit is contained in:
1 parent
428a0bbad5
commit
08d4e301d2
3 files changed
+20
-17
No files matched your search
@@ -8,7 +8,7 @@ export function Lighting() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Environment preset="dawn" />
|
<Environment preset="warehouse" />
|
||||||
{/* <directionalLight
|
{/* <directionalLight
|
||||||
position={[1, 1, -1]}
|
position={[1, 1, -1]}
|
||||||
intensity={hasPbr ? 3 : 5}
|
intensity={hasPbr ? 3 : 5}
|
||||||
|
|||||||
+17
-14
@@ -1,12 +1,12 @@
|
|||||||
export class BufferStream {
|
export class BufferStream {
|
||||||
public index = 0;
|
public index = 0;
|
||||||
constructor(public stream: Buffer) {}
|
constructor(public buffer: Buffer) {}
|
||||||
|
|
||||||
skip(size: number) {
|
skip(size: number) {
|
||||||
this.index += size;
|
this.index += size;
|
||||||
}
|
}
|
||||||
read(size: number) {
|
read(size: number) {
|
||||||
return this.stream.subarray(this.index, this.index + size);
|
return this.buffer.subarray(this.index, this.index + size);
|
||||||
}
|
}
|
||||||
consume(size: number) {
|
consume(size: number) {
|
||||||
const subarray = this.read(size);
|
const subarray = this.read(size);
|
||||||
@@ -14,12 +14,15 @@ export class BufferStream {
|
|||||||
|
|
||||||
return subarray;
|
return subarray;
|
||||||
}
|
}
|
||||||
|
increment(size: number) {
|
||||||
|
return (this.index += size) - size;
|
||||||
|
}
|
||||||
|
|
||||||
readRemaining() {
|
readRemaining() {
|
||||||
return this.read(Number.POSITIVE_INFINITY);
|
return this.read(Number.POSITIVE_INFINITY);
|
||||||
}
|
}
|
||||||
readRemainingLength() {
|
readRemainingLength() {
|
||||||
return this.stream.length - this.index;
|
return this.buffer.length - this.index;
|
||||||
}
|
}
|
||||||
consumeRemaining() {
|
consumeRemaining() {
|
||||||
return this.consume(Number.POSITIVE_INFINITY);
|
return this.consume(Number.POSITIVE_INFINITY);
|
||||||
@@ -30,38 +33,38 @@ export class BufferStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ascii(size: number) {
|
ascii(size: number) {
|
||||||
return this.consume(size).toString('ascii');
|
return this.buffer.toString('ascii', this.increment(size), this.index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int8() {
|
int8() {
|
||||||
return this.consume(1).readInt8();
|
return this.buffer.readInt8(this.increment(1));
|
||||||
}
|
}
|
||||||
int16() {
|
int16() {
|
||||||
return this.consume(2).readInt16LE();
|
return this.buffer.readInt16LE(this.increment(2));
|
||||||
}
|
}
|
||||||
int32() {
|
int32() {
|
||||||
return this.consume(4).readInt32LE();
|
return this.buffer.readInt32LE(this.increment(4));
|
||||||
}
|
}
|
||||||
int64() {
|
int64() {
|
||||||
return this.consume(8).readBigInt64LE();
|
return this.buffer.readBigInt64LE(this.increment(8));
|
||||||
}
|
}
|
||||||
uint8() {
|
uint8() {
|
||||||
return this.consume(1).readUInt8();
|
return this.buffer.readUInt8(this.increment(1));
|
||||||
}
|
}
|
||||||
uint16() {
|
uint16() {
|
||||||
return this.consume(2).readUInt16LE();
|
return this.buffer.readUInt16LE(this.increment(2));
|
||||||
}
|
}
|
||||||
uint32() {
|
uint32() {
|
||||||
return this.consume(4).readUInt32LE();
|
return this.buffer.readUInt32LE(this.increment(4));
|
||||||
}
|
}
|
||||||
uint64() {
|
uint64() {
|
||||||
return this.consume(8).readBigUInt64LE();
|
return this.buffer.readBigUInt64LE(this.increment(8));
|
||||||
}
|
}
|
||||||
float() {
|
float() {
|
||||||
return this.consume(4).readFloatLE();
|
return this.buffer.readFloatLE(this.increment(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean() {
|
boolean() {
|
||||||
return this.consume(1).readUInt8() === 1;
|
return this.buffer.readUInt8(this.increment(1)) === 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,9 +89,9 @@ export class ScgStream extends ScpgStream {
|
|||||||
);
|
);
|
||||||
const strideBasedSize = stride * polygonGroupRaw.vertexCount;
|
const strideBasedSize = stride * polygonGroupRaw.vertexCount;
|
||||||
|
|
||||||
if (verticesStream.stream.length !== strideBasedSize) {
|
if (verticesStream.buffer.length !== strideBasedSize) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`Vertex stride mismatch; expected ${strideBasedSize}, got ${verticesStream.stream.length}; skipping...`,
|
`Vertex stride mismatch; expected ${strideBasedSize}, got ${verticesStream.buffer.length}; skipping...`,
|
||||||
);
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in new issue
Block a user