2025-01-17 23:37:54 +00:00
|
|
|
import type { ReflectionProbeFlags } from './ReflectionProbeFlags';
|
2023-11-09 18:08:37 +00:00
|
|
|
|
|
|
|
|
export class ReflectionProbeData
|
|
|
|
|
{
|
|
|
|
|
public ambiance = 0.0;
|
|
|
|
|
public clipDistance = 0.0;
|
|
|
|
|
public flags: ReflectionProbeFlags = 0 as ReflectionProbeFlags;
|
|
|
|
|
|
2025-01-17 23:37:54 +00:00
|
|
|
public constructor(buf?: Buffer, pos?: number, length?: number)
|
2023-11-09 18:08:37 +00:00
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-17 23:37:54 +00:00
|
|
|
public writeToBuffer(buf: Buffer, pos: number): void
|
2023-11-09 18:08:37 +00:00
|
|
|
{
|
|
|
|
|
buf.writeFloatLE(this.ambiance, pos);
|
|
|
|
|
pos = pos + 4;
|
|
|
|
|
buf.writeFloatLE(this.clipDistance, pos);
|
|
|
|
|
pos = pos + 4;
|
|
|
|
|
buf.writeUInt8(this.flags, pos);
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-17 23:37:54 +00:00
|
|
|
public getBuffer(): Buffer
|
2023-11-09 18:08:37 +00:00
|
|
|
{
|
|
|
|
|
const buf = Buffer.allocUnsafe(9);
|
|
|
|
|
this.writeToBuffer(buf, 0);
|
|
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
}
|