Support for new ExtraParams
This commit is contained in:
39
lib/classes/public/ReflectionProbeData.ts
Normal file
39
lib/classes/public/ReflectionProbeData.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user