mirror of
				https://notabug.org/scuti/lib3ddevil1
				synced 2025-05-31 14:11:42 +05:30 
			
		
		
		
	Added example for geo component
This commit is contained in:
		| @@ -98,4 +98,30 @@ Functions | ||||
|             When file size is detected to be too small for a given i-th | ||||
|             Mesh. | ||||
|  | ||||
|      | ||||
| Example logic to interact with all meshes: | ||||
|     { | ||||
|         // After the file has been read in. | ||||
|  | ||||
|         // Need to know how many meshes are in the file. | ||||
|         struct Header *h = (struct Header*)filedata; | ||||
|          | ||||
|         // Need to know about a specific mesh (how many batches). | ||||
|         struct MeshHeader *mh = NULL; | ||||
|          | ||||
|         // Need to hold information about mesh. | ||||
|         struct Mesh m; | ||||
|         // As a precaution - empty for now. | ||||
|         m.b = NULL; | ||||
|  | ||||
|         unsigned int i; | ||||
|         for (i = 0; i < h -> numMesh; i++) { | ||||
|             DEVIL1GEO.getmeshheader(&mh, i, filedata); | ||||
|             // Allocate space to hold batch data. | ||||
|             m.b = (struct Batch*)malloc(sizeof(struct Batch) * (mh -> numBatch)); | ||||
|             if (m.b != NULL) { | ||||
|                 DEVIL1GEO.getmesh(&m, i, filedata, filesize); | ||||
|                 // Do whatever you want with the mesh. | ||||
|                 free(m.b); | ||||
|             } | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	