Support for new ExtraParams

This commit is contained in:
Casper Warden
2023-11-09 18:08:37 +00:00
parent 8187726962
commit 53506ff2cb
8 changed files with 184 additions and 7 deletions

View File

@@ -0,0 +1,39 @@
import { ReflectionProbeFlags } from './ReflectionProbeFlags';
export class ReflectionProbeData
{
public ambiance = 0.0;
public clipDistance = 0.0;
public flags: ReflectionProbeFlags = 0 as ReflectionProbeFlags;
constructor(buf?: Buffer, pos?: number, length?: number)
{
if (buf !== undefined && pos !== undefined && length !== undefined)
{
if (buf.length - pos >= 9 && length >= 9)
{
this.ambiance = buf.readFloatLE(pos);
pos = pos + 4;
this.clipDistance = buf.readFloatLE(pos);
pos = pos + 4;
this.flags = buf.readUInt8(pos);
}
}
}
writeToBuffer(buf: Buffer, pos: number): void
{
buf.writeFloatLE(this.ambiance, pos);
pos = pos + 4;
buf.writeFloatLE(this.clipDistance, pos);
pos = pos + 4;
buf.writeUInt8(this.flags, pos);
}
getBuffer(): Buffer
{
const buf = Buffer.allocUnsafe(9);
this.writeToBuffer(buf, 0);
return buf;
}
}