Using JSON as HL library export


Using JSON as HL library export
#1
I've been playing with a simple JSON export in LDCad 1.5 alpha to see if its worth the effort in regards to the introducing a second HL library topic.

It resulted in this extremely light weight welGL renderer. This is far from a full featured LDraw renderer but it demonstrates the ease of doing so when using a new HL LDraw library format.

The JSON structure is readable in the test's javascript source. For now the format only includes polygons (excluding textures).

The test also raised some questions we need to awnser if we ever want to setup some official JSON LDraw format, My main concerns / discussion points I would like to throw into the group are:

How to split the geometry data

In the example I basically dumped the LDCad OpenGL vertex data into a single array (made out of continues pos/nor pairs). Alternative could be to first list all unique positions, normals and tex coords individually and also setup separate index arrays for them per mesh. The enduser software can then construct any kind of buffer they need. Optionally ignoring normals and / or texture coordinates etc.

Webgl (one of the main end users of the format) has no QUAD support, should we therefore drop quads in the fileformat to?

For now I converted the quad indices to triangle indices while keeping them separated. That way you can transform them back when needed.

How to handle non BFC parts
Non bfc parts are handled with dual lighting inside LDCad so these export tests will cause problems for non bfc parts. So how do we handle non bfc parts in the JSON files? Ether by duplicating all data or by setting some flag so the enduser handles it with a different shader or by drawing everything twice (CW and CCW) or something.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Using JSON as HL library export - by Roland Melkert - 2015-03-15, 23:14

Forum Jump:


Users browsing this thread: 1 Guest(s)