[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Public WebGL] Typed arrays and network data
- To: public_webgl@khronos.org
- Subject: [Public WebGL] Typed arrays and network data
- From: Kenneth Russell <kbr@google.com>
- Date: Wed, 3 Feb 2010 15:28:48 -0800
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1265239730; bh=aQ+tcAhT6LknzU23CW8M+BIfU/Y=; h=MIME-Version:Date:Message-ID:Subject:From:To:Content-Type; b=O6KsiYx2JmoPV7tbY8zgxJyShrFiIjEaAas/bZ4lgkw23nmbNOuccGdk+2Y2lKn0P QZsCXhKztBKtEYJhbWZow==
- Domainkey-signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:date:message-id:subject:from:to:content-type:x-system-of-record; b=h14AX9QIo5+Wr4iGyIy9gWNTDCKhvMR7D/ErgJzBoWsG2v3MeuFNoaandRC98mLzs 6KT7duCaTzYqlVMpm5C5g==
- Sender: owner-public_webgl@khronos.org
I've seen a few comments about the typed array proposal and some
missing features for parsing data from the network. If we add one more
type of view, I think we can cover a large number of additional use
cases and improve the chances of widespread acceptance of the
proposal.
Consider adding a type called DataStream, which has a cursor and gets
or sets data at that point.
[
Constructor(in ArrayBuffer buffer,
optional in unsigned long byteOffset,
optional in unsigned long length)
]
interface DataStream : TypedArray {
const object BIG_ENDIAN;
const object LITTLE_ENDIAN;
// Takes either BIG_ENDIAN or LITTLE_ENDIAN as argument
void setEndianness(object endianness);
// Fetches the given type at the cursor with the current endianness.
// Increments the cursor by the size in bytes of the type.
// Throws an exception if the operation would read past the end of the view.
unsigned byte getUint8();
byte getInt8();
unsigned short getUint16();
short getInt16();
unsigned long getUint32();
long getInt32();
unsigned long long getUint64();
long long getInt64();
float getFloat();
double getDouble();
// Sets the given type at the cursor with the current endianness.
// Increments the cursor by the size in bytes of the type.
// Throws an exception if the operation would read past the end of the view.
void setUint8(in unsigned byte value);
void setInt8(in byte value);
void setUint16(in unsigned short value);
void setInt16(in short value);
void setUint32(in unsigned long value);
void setInt32(in long value);
void setUint64(in unsigned long long value);
void setInt64(in long long value);
void setFloat(in float value);
void setDouble(in double value);
// Gets the current position of the cursor, in bytes, from the
beginning of the view.
unsigned long getCursorPosition();
// Sets the current position of the cursor, in bytes, from the
beginning of the view.
void setCursorPosition(in unsigned long byteOffset);
};
Note that this wouldn't perturb any of the other interfaces in the spec.
What do you think?
-Ken
-----------------------------------------------------------
You are currently subscribe to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: