public static function createVAGAL(val:String):ByteArray
{
var rel:ByteArray;
var vagal:AGALMiniAssembler = new AGALMiniAssembler();
vagal.assemble( Context3DProgramType.VERTEX, val );
rel = vagal.agalcode;
return rel;
}
public static function createFAGAL(val:String):ByteArray
{
var rel:ByteArray;
var vagal:AGALMiniAssembler = new AGALMiniAssembler();
vagal.assemble( Context3DProgramType.FRAGMENT, val );
rel = vagal.agalcode;
return rel;
}
public class VertexDataRead
{
private var _data32PerVertex:uint;
private var _numVertices:uint;
private var _data:ByteArray;
public function VertexDataRead()
{
}
public function get data():ByteArray
{
return _data;
}
public function get numVertices():uint
{
return _numVertices;
}
public function get data32PerVertex():uint
{
return _data32PerVertex;
}
public function read( val:ByteArray ):void
{
val.endian = Endian.LITTLE_ENDIAN;
var format:int = val.readByte();
if( format == 0 )
{
trace("[VertexDataRead 数据正确]");
this._data32PerVertex = val.readInt();
this._numVertices = val.readInt();
this._data = new ByteArray();
this._data.endian = Endian.LITTLE_ENDIAN;
val.readBytes( this._data );
}
else
{
throw new Error("数据操作失败,数据格式不正确!");
}
}
}
}
public class IndexDataRead
{
private var _numVertices:uint;
private var _data:ByteArray;
public function IndexDataRead()
{
}
public function get data():ByteArray
{
return _data;
}
public function get numVertices():uint
{
return _numVertices;
}
public function read( val:ByteArray ):void
{
val.endian = Endian.LITTLE_ENDIAN;
var format:int = val.readByte();
if( format == 1 )
{
trace("[IndexDataRead 数据正确]");
this._numVertices = val.readInt();
this._data = new ByteArray();
this._data.endian = Endian.LITTLE_ENDIAN;
val.readBytes( this._data );
}
else
{
throw new Error("IndexDataRead::数据操作失败,数据格式不正确!");
}
}
}
}