Radikalizm wrote:
I have not included skeletal information in here for a good reason. When you tie skeletal information directly to a mesh it can get harder to re-use, and each mesh using the same skeletal data would require to hold a copy of the information inside its own file, creating a memory and loading-time overhead. Defining these as external files (maybe even as simple xml files) could avoid this problem.
Same goes for materials....
@REDDemon: I see where you are coming from, but don't you think storing different files each with their own administrative overhead in an archive would slow down loading times? Also, I don't think it's up to us to determine how much information anyone would want to store in a mesh. If someone wants to push a scene's worth of data into a mesh (which is done regularly), that should be completely possible IMO and we should make the format work just like it would for smaller files.
Also I find the assumption that large files would require heavy and complex exporters kind of strange. The complexity of writing out a single mesh buffer is exactly the same as writing out hundreds of them, it's just repeating the same procedure over and over again until every buffer has been handled. Since buffers do not depend on eachother and since they don't overlap I don't see why this would be a problem.
That's exactly what I sad
I defined a chunk for a single mesh buffer. No one forbids to to put more chunks in one file, the scalability to multiple mesh buffers is implicit. Header of each chunk contains enough info for move the file pointer directly to the next chunk if desired. Or you can just load all chunks and that's all. I always sad to use a list of mesh buffers instead of a scene with its hierarchy. I was thinking that you wanted to handle the hierarchy also in your file format. If not we are just trying to do the same using a different naming convention and file format XD
Once you have a procedure for a single mesh buffer you have just to repeat that for each mesh buffer
I have already writed that. And if an user doesn't want skeletal info it can just decide to skip loading since the skeletal buffer can be skipped because its lenght is known thanks to the header. I have just posted a very simple, and fast to load, file type wich is able to store a meshbuffer. Then if an user want to pack more mesh buffers it has just to append another "chunk" to the file. Every chunk is a mesh buffer . If the user doesn't want skeletal info it can just decide to set the option "no bones" and the mesh will be loaded without frames. Or if he set "no animated" the mesh will be also loaded without bone weights so just as a static mehs (I can't figure a reason for removing weights from vertices, But this is still possible!)
There's no point in keeping skeletal info separed from the file. The file format I posted is able also to contain just bones transformations without vertices. Just need to set "buffers" "vertices" and "triangles" to zero and the file becomes magically just a skeleton with its animation(so you can store a motion capture result in this file without declaring a single vertex!). I don't understand why you would like to put all mesh buffers together and keep skeleton separed. Skeleton is specific to a mesh. If you remove bone weights you have to give again weights using a 3D editing tool like blender. There's no reuse in that. And if you refer just to keep the bones, but change frames. This is already possible with the file format I provided:)
Given a mesh with its bones and weights, a skeletal animation (Specific to that set of bones) can be loaded from different files if wanted, or just from the original file. this is already the maximum reusability
. The format file I posted is as flexible as simple and effective.
The only missing things is as you say a footer for check integrity of the file. Never thinked to that. What do you thinked to use? A checksum system?
revision 2:
Code: Select all
//start of text header
irr //'i' 'r' 'r' '\n' magic number to detect endiannes.
text //for a text file else bin.
buffers num //number of meshbuffer states in this file. "num" is a text number wich needs to be parsed.
vertices num //expected nunmber of vertices
triangles num //expected number of indices = triangles*3
bones num //expected number of bones
frames num // expected number of frames
description //vertex description. Just a list of attributes pairs (type-name)
float X
float Y
float Z
irr_header_end
/*Binary data*/
irr //I don't think that writing again "irr\ntext\n" will add to much administrative overhead to the loading of the file.
text
buffers 0
vertices 0
triangles 0
bones num
frames num
description //in this example we have 1 mesh buffer with its animation and a skeletal animation without a mesh buffer
irr_header_end
/*Binary data*/
footer CHECKSUM //as you suggest a footer here would be great. A even/odd test will be great for detecting missin bytes. Something more complex like a SHA i don't think is worth. So every time we read 32 bits we XOR them with last loaded 32 bits and if something is missing at the end of the file check sum will be different. A lenght measure of the file is not needed since it can be checked thanks to the headers.
Another interesting thing is your idea to put debug data. What kind of data do you think to use? Something like names? because most of the debug data are already drawable by irrlicht (normals, AaBB etc.) without the need of a specific file for that.. Yeah I suppose you are speaking about names. I have seen lots of engines using to show the name of a node or a mesh buffer in debug mode This is a great idea. (already possible in irrlicht, but the user has to set debug name. But using an external file the name can be setted from the file instead of from the code (don' know if already possible with irrlicht that. I will check now)
So actually possible things:
*Fast loading (minimum header and binary econded data.)
*Flexible vertex description (many 3D formats use that)
*Skeletal info (bones and frames)
*parsing (file pointer can be moved to the next section of the file if some info is not needed)
*Multiple meshes in one file. (implicitly possible. Instead or writing a hierarcy file we have just a list of meshbuffer. Very stable solution)
*ability to store different kind of info with 1 file (so you can separe indices, bones and frames into different files if you want to reuse them. Or you can just put them all togheter)
*morphed animation
*skeletal animation
*lenght checks (possible with binary format only)
*morphed + skeletal animation.
*detection of errors (just parse headers and check if the file lenght is ok is enough to see if there are missing vertices etc.)
Missing things suggested by you
*debug info
*footer
*eventually more error check test? ("checksum"?)
Ah yeah! We are still missing the material description. Any Idea? Both adding the material as an external link or as a propierty of the mesh in the file have pro/contros. A hybrid solution would be great too.
I think that irrlicht is already able to serialize materials (not sure at all) maybe a link to the serialized material file would be enough.
Code: Select all
//start of text header
irr //'i' 'r' 'r' '\n' magic number to detect endiannes.
material "material01.xml"
text //for a text file else bin.
buffers num //number of meshbuffer states in this file. "num" is a text number wich needs to be parsed.
something like that is very easy to do.
Pros:
reuse irrlicht materials.
sideeffects:
How can a 3D tool export a "material01.xml"?
so maybe is better doing something different. Ideas for that?
please wait some minutes to reply I will check for errors.
I'm really tired ATM.
EDIT: readed twice the post should be ok. XD
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me