[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] WebGLTF: Proposal for a WebGL transmission format



Brandon: That shortcut doesn't work in case of the json being bigger than a few kbytes, JS doesn't like passing thousands of arguments.


On Fri, Nov 2, 2012 at 9:34 PM, Brandon Jones <bajones@google.com> wrote:
Florian: An interesting shortcut to your for loop could be

var charArray new Uint8Array([6566676869707172]);
var result String.fromCharCode.apply(StringcharArray);

Works on Chrome, Firefox, and Safari that I've tested, maybe more. Not sure what the performance difference is but the code is a bit nicer. 


On Fri, Nov 2, 2012 at 12:58 PM, Florian Bösch <pyalot@gmail.com> wrote:
I'm doing it like this

length = new Uint32Array(data, 4, 1)[0]
metadata = new Uint8Array(data, 8, length)
result = ''
for i in [0...length]
    result += String.fromCharCode(metadata[i])
result = JSON.parse(result)



On Fri, Nov 2, 2012 at 8:56 PM, Rico P. <mailtorico@gmail.com> wrote:
Interesting... How can I convert a binary blob back into a string?

- Rico

2012/11/2 Florian Bösch <pyalot@gmail.com>:

> Note that you can pack both the JSON and the binary blobs into one array
> buffer. A format I'm using is built like this: <uint: length of json string>
> <json> <buffers>
>
> Where the json part contains offsets/lengths of the buffers relative to the
> start of the binary part.
>
>
> On Fri, Nov 2, 2012 at 7:33 PM, Fabrice Robinet <fabricerobinet@me.com>
> wrote:
>>
>> Dear WebGL group,
>>
>> I'd like to share with you a work in progress to define a JSON format for
>> WebGL.
>> This initiative was initially started from the COLLADA working group.
>> It aims to be a response to developers expectations to get 3D assets
>> seamlessly on the web.
>> This is an entirely new format that stands at the end of the asset
>> pipeline, it can be generated from COLLADA, but it is not tied to it.
>>
>> This format reuses as much as possible existing concepts (like using typed
>> arrays for binary blobs ) and it is _javascript_ friendly with JSON. It also
>> takes advantage of a few concepts inherited from COLLADA that proved to be
>> successful.
>>
>> There are already many JSON formats out there, so why another one ?
>> One implicit goal of this project is to gather all the great ideas from
>> the community and focus on the particular purpose of getting a JSON format
>> usable for many developers. But obviously, a single format cannot be
>> convenient for everyone,  for those (many) who want a delivery format ready
>> for rendering, this effort is the way to go, for those who want to
>> edit/remodel 3d assets and keep most informations then COLLADA would be
>> better suited.
>>
>> General presentation of the top level project:
>> https://github.com/fabrobinet/collada2json/
>>
>> More insights about the format (work in progress):
>> https://github.com/fabrobinet/collada2json/wiki/WebGLTF
>>
>> Last but not least, I'll be presenting the format at this meet-up:
>> https://github.com/fabrobinet/collada2json/
>> I'll show there some demos that will be online shortly.
>>
>> All feedback is very welcome,
>>
>> Thank you,
>> Fabrice.
>
>