Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- abstract IntBuffer(IntBufferImpl) to ArrayBuffer {
- public function new(raw:BytesData) this = new IntBufferImpl(raw);
- @:arrayAccess public inline function get(i:Int):Float
- return untyped __global__.__hxcpp_memory_get_i32(this.buffer, i*4);
- @:arrayAccess public inline function set(i:Int, x:Int):Float {
- untyped __global__.__hxcpp_memory_set_i32(this.buffer, i*4, x);
- return get(this, i);
- }
- }
- class IntBufferImpl extends ArrayBuffer {
- public function new(buffer:BytesData) super(buffer, 4, GL.INT);
- }
- abstract FloatBuffer(FloatBufferImpl) to ArrayBuffer {
- public function new(raw:BytesData) this = new FloatBufferImpl(raw);
- @:arrayAccess public inline function get(i:Int):Float
- return untyped __global__.__hxcpp_memory_get_float(this.buffer, i*4);
- @:arrayAccess public inline function set<T>(i:Int, x:T):Float {
- untyped __global__.__hxcpp_memory_set_float(this.buffer, i*4, x);
- return get(this, i);
- }
- }
- class FloatBufferImpl extends ArrayBuffer {
- public function new(buffer:BytesData) super(buffer, 4, GL.FLOAT);
- }
- class ArrayBuffer {
- public var size:Int;
- public var type:Int;
- public var buffer:BytesData;
- public function new(buffer:BytesData, size:Int, type:Int) {
- this.buffer = buffer;
- this.size = size;
- this.type = type;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment