This repository has been archived by the owner on Aug 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Babylon file creation from prims
David Daeschler edited this page Sep 27, 2016
·
6 revisions
The babylon file format groups objects together by parent ID. This is usable for multi-prim objects. However, we still have to deal with viewer faces that can have different materials assigned.
Looking at the file structure, exporting for every individual prim is relatively straightforward: For every prim:
- Collect all vertices for all faces
- Collect all indices for all faces
- Collect all normals for all faces
- Collect all UVs for all faces
Then for each prim:
- Create a new entry in meshes
- Give each prim mesh a unique ID
- Calculate the djb2 hash of the shape
- Calculate the djb2 hash of the materials
- Create the ID from those
- Export all vertices (as "positions")
- Export all normals (as "normals")
- Export all UVs (as "uvs")
- Export all indices (as "indices")
- Export all materials (as "materials")
For each face:
- Create a new multimaterial
- Add the material for each face to the multimaterial
- Create a new submesh
- Add the face vertices/indices to the submesh
- Home
- Development
- Installation
- Configuration
- Downloads
- Contributing
- Supporting old and new grids
- Reporting a problem
- Documentation
- Future