Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/plugins/iqmmodel/iqm.cpp b/plugins/iqmmodel/iqm.cpp
- index 96883c68..61c82f60 100644
- --- a/plugins/iqmmodel/iqm.cpp
- +++ b/plugins/iqmmodel/iqm.cpp
- @@ -141,6 +141,23 @@ void istream_read_iqmHeader(PointerInputStream &inputStream, iqmHeader_t &header
- #undef READINT
- }
- +typedef struct iqmmesh_s {
- + unsigned int name;
- + unsigned int material;
- + unsigned int first_vertex, num_vertexes;
- + unsigned int first_triangle, num_triangles;
- +} iqmmesh_t;
- +
- +void istream_read_iqmMesh(PointerInputStream &inputStream, iqmmesh_t &iqmmesh)
- +{
- + iqmmesh.name = istream_read_uint32_le(inputStream);
- + iqmmesh.material = istream_read_uint32_le(inputStream);
- + iqmmesh.first_vertex = istream_read_uint32_le(inputStream);
- + iqmmesh.num_vertexes = istream_read_uint32_le(inputStream);
- + iqmmesh.first_triangle = istream_read_uint32_le(inputStream);
- + iqmmesh.num_triangles = istream_read_uint32_le(inputStream);
- +}
- +
- typedef struct iqmvertexarray_s {
- unsigned int type;
- unsigned int flags;
- @@ -243,7 +260,25 @@ void IQMSurface_read(Model &model, const byte *buffer, ArchiveFile &file)
- }
- }
- - surface.setShader("");
- + bool found = false;
- + PointerInputStream iqmMesh(buffer + header.ofs_meshes);
- + for ( unsigned int i = 0; i < header.num_meshes; i++ ) {
- + iqmmesh_t iqmmesh;
- + istream_read_iqmMesh(iqmMesh, iqmmesh);
- + if ( iqmmesh.material <= header.num_text ) {
- + char *text;
- + text = (char*) buffer + header.ofs_text + iqmmesh.material;
- + printf("ll: %s\n", text);
- + if ( text[0] != '\0' ) {
- + surface.setShader(text);
- + found = true;
- + }
- + }
- + }
- + if ( !found ) {
- + surface.setShader("textures/radiant/notex");
- + }
- +
- surface.updateAABB();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement