import {ObjectBase} from '../../common/lang/ObjectBase'; //========================================================== // 图形数据。 // // @class // @author maocy // @history 150308 //========================================================== export class FloatStream extends ObjectBase { public length: number; public memory: Float32Array; public position: number; //========================================================== // 构造处理。 // // @author maocy // @history 141230 //========================================================== public constructor() { super(); // 设置属性 this.length = 0; this.position = 0; } //========================================================== // 设置长度。 // // @method // @param length:Integer 长度 //========================================================== public setLength(length) { this.length = length; this.memory = new Float32Array(length); } //========================================================== // 写入4个浮点数。 // // @param value1 浮点数1 // @param value2 浮点数2 // @param value3 浮点数3 // @param value4 浮点数4 //========================================================== public writeFloat4(value1: number, value2: number, value3: number, value4: number) { this.memory[this.position++] = value1; this.memory[this.position++] = value2; this.memory[this.position++] = value3; this.memory[this.position++] = value4; } //========================================================== // 写入颜色。 // // @param value:SColor4 颜色 //========================================================== public writeColor4(value) { this.writeFloat4(value.red, value.green, value.blue, value.alpha); } //========================================================== // 重置处理。 // // @method //========================================================== public reset() { this.position = 0; } //========================================================== // 清空处理。 // // @method //========================================================== public clear() { this.position = 0; } //========================================================== // 释放处理。 // // @author maocy //========================================================== public dispose() { this.memory = null; // 父处理 super.dispose(); } }