Fantastic xiyou beautiful edition. Gim (3D model) File Format Structure record

Source: Internet
Author: User

Fantastic xiyou beautiful edition. Gim (3D model) File Format Structure record
V0.2
By xiaobao

Dream has added real 3D resources to the beautiful edition. Will this encourage xiaobao to learn 3D graphics?

I think about it all day long. It is better to learn it.

We extract resources not for resources, but to make them an interest and motivation for learning.

There are many file versions maintained by. Gim. I don't have the energy to fully analyze them, and I have a lot of new knowledge to learn. So I shared the earlier versions and hope to provide a reference for interested friends.

-------------------------------------------------------------------------------
A 28-byte structure usually appears in the file, which may be 7 float values. I'm not sure what to do.
If the following text starts with #, it indicates that it is basically determined. If it cannot be determined, it should start with a space.
Count? It indicates which count variable is not determined.

#4-byte rgim flag
#4-byte version 00030010 (currently supports 2.0.0-3.0.10)
#2 bytes is always 0001 (or not 0001, but the analysis is not debugged)
#2 bytes zero1 always 0000
#28-byte floats
1-byte var1
1-byte var2
1-byte var3
1-byte var4
#4-byte count1
#4-byte zero2
-------------------------------------------------------------------------------
The following is the count1 structure (96 bytes)
#32-byte name1 may be the model name
#28-byte floats
#4-byte zero3
#32-byte name2 may be the material name
-------------------------------------------------------------------------------
A string of signs (5 bytes) 00 00 00 01
#2-byte count2
# Count2 byte Table1 (each item is 1 byte)
# Count2 * 32-byte Table2 (each item is the name of BIP)
1 byte 01 should be a flag
# Count2 * 28 bytes table3 (each item is a floats)
# Count2 * 64-byte table4 (each item is 64-byte 16 float, Which is matrix4x4)
-------------------------------------------------------------------------------
#2 bytes 01 00 gis_file_count
-------------------------------------------------------------------------------
The following figure shows the gis_file_count structure (the length is calculated on demand)
#2-byte name_length
# Name_length byte. GIS file name
-------------------------------------------------------------------------------
1 byte 01
4-byte AB 40 EF 37
-------------------------------------------------------------------------------
The following figure shows the gis_file_count structure (the length is calculated on demand)
#2-byte count3
========================================================== ========================================================
The following is the count3 structure (the length must be calculated according to the formula)
#2-byte count4
# Count4 * 28-byte table5 (each item is a floats)
========================================================== ========================================================
-------------------------------------------------------------------------------
**************************************** ***************************************
So far, the Common Data Reading is complete! Start to read vertex information.
The number of vertex is more than one segment, and there is a count control, which may be the number of GIS.
**************************************** ***************************************
-------------------------------------------------------------------------------
The following is the count1 structure (the length is 8 + 2)
4-byte int1 // Number of vertices in a model
4-byte int2 // Number of faces in a model
========================================================== ========================================================
// Read the two bytes when version> = 3.00.08; otherwise, the loop continues.
1 byte 01
1 byte 01
========================================================== ========================================================
-------------------------------------------------------------------------------
2 bytes 01 00
#4-byte count5 (total number of vertices)
#4-byte count6 (total number of faces)
-------------------------------------------------------------------------------
# Count5 * 12-byte table6 (each item is 12-byte 3 float, vertex ?)
# Count5 * 12-byte table6_2 (each item is 12-byte 3 float, vertex Normal Vector ?)
# Count6 * 6-byte table7 (each item is a 6-byte, 3-word, surface vertex index table)
# Count5 * 8-byte table8 (each item contains 8 bytes and 2 float values. What are the UV coordinates of the texture ?)
# Count5 * 4-byte table9 (each item is 4 bytes, neither float nor rgba)
# Count5 * 4-byte table9_2 (each item is 4 bytes, not float ,)
# Count5 * 16-byte table10 (each item is a 16-byte 4 float, should not be a color, the color cannot be greater than 1.0f)
-------------------------------------------------------------------------------
**************************************** ***************************************
Next, read the embedded material information.
1 byte 00
1 byte 00
#4-byte length1
# Built-in. MTG file of length1 bytes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.