mirror of
				https://github.com/aap/librw.git
				synced 2025-10-31 15:09:17 +00:00 
			
		
		
		
	fixed stipid holes in lcs meshes
This commit is contained in:
		
							parent
							
								
									39711c0a32
								
							
						
					
					
						commit
						4e81f31c6b
					
				
							
								
								
									
										20
									
								
								src/mdl.cpp
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								src/mdl.cpp
									
									
									
									
									
								
							| @ -203,18 +203,16 @@ insertVertices(Geometry *g, RslGeometry *rg, RslMesh *rm) | |||||||
| 		indices = &skin->indices[g->numVertices*4]; | 		indices = &skin->indices[g->numVertices*4]; | ||||||
| 		weights = &skin->weights[g->numVertices*4]; | 		weights = &skin->weights[g->numVertices*4]; | ||||||
| 	} | 	} | ||||||
| 	bool first = 1; |  | ||||||
| 
 | 
 | ||||||
| 	uint8 *p = rg->data + rm->dmaOffset; | 	uint8 *p = rg->data + rm->dmaOffset; | ||||||
| 	uint32 *w = (uint32*)p; | 	uint32 *w = (uint32*)p; | ||||||
| 	uint32 *end = (uint32*)(p + ((w[0] & 0xFFFF) + 1)*0x10); | 	uint32 *end = (uint32*)(p + ((w[0] & 0xFFFF) + 1)*0x10); | ||||||
| 	w += 4; | 	w += 4; | ||||||
| 	int flags = 0; | 	int flags = 0; | ||||||
| 	int32 nvert, n; | 	int32 nvert; | ||||||
| 	while(w < end){ | 	while(w < end){ | ||||||
| 		assert(w[0] == 0x6C018000);	// UNPACK
 | 		assert(w[0] == 0x6C018000);	// UNPACK
 | ||||||
| 		nvert = w[4] & 0x7FFF; | 		nvert = w[4] & 0x7FFF; | ||||||
| 		n = first ? nvert : nvert-2; |  | ||||||
| 		w += 5; | 		w += 5; | ||||||
| 
 | 
 | ||||||
| 		// positions
 | 		// positions
 | ||||||
| @ -225,7 +223,7 @@ insertVertices(Geometry *g, RslGeometry *rg, RslMesh *rm) | |||||||
| 		assert((w[0] & 0xFF004000) == 0x79000000); | 		assert((w[0] & 0xFF004000) == 0x79000000); | ||||||
| 		unpackVertices(rg, (int16*)(w+1), verts, nvert); | 		unpackVertices(rg, (int16*)(w+1), verts, nvert); | ||||||
| 		w = skipUnpack(w); | 		w = skipUnpack(w); | ||||||
| 		verts += 3*n; | 		verts += 3*(nvert-2); | ||||||
| 
 | 
 | ||||||
| 		// tex coords
 | 		// tex coords
 | ||||||
| 		assert(w[0] == 0x20000000);	// STMASK
 | 		assert(w[0] == 0x20000000);	// STMASK
 | ||||||
| @ -235,36 +233,36 @@ insertVertices(Geometry *g, RslGeometry *rg, RslMesh *rm) | |||||||
| 		assert((w[0] & 0xFF004000) == 0x76004000); | 		assert((w[0] & 0xFF004000) == 0x76004000); | ||||||
| 		unpackTex(rm, (uint8*)(w+1), texCoords, nvert); | 		unpackTex(rm, (uint8*)(w+1), texCoords, nvert); | ||||||
| 		w = skipUnpack(w); | 		w = skipUnpack(w); | ||||||
| 		texCoords += 2*n; | 		texCoords += 2*(nvert-2); | ||||||
| 
 | 
 | ||||||
| 		if(g->geoflags & Geometry::NORMALS){ | 		if(g->geoflags & Geometry::NORMALS){ | ||||||
| 			assert((w[0] & 0xFF004000) == 0x6A000000); | 			assert((w[0] & 0xFF004000) == 0x6A000000); | ||||||
| 			unpackNormals((int8*)(w+1), norms, nvert); | 			unpackNormals((int8*)(w+1), norms, nvert); | ||||||
| 			w = skipUnpack(w); | 			w = skipUnpack(w); | ||||||
| 			norms += 3*n; | 			norms += 3*(nvert-2); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if(g->geoflags & Geometry::PRELIT){ | 		if(g->geoflags & Geometry::PRELIT){ | ||||||
| 			assert((w[0] & 0xFF004000) == 0x6F000000); | 			assert((w[0] & 0xFF004000) == 0x6F000000); | ||||||
| 			unpackColors((uint16*)(w+1), cols, nvert); | 			unpackColors((uint16*)(w+1), cols, nvert); | ||||||
| 			w = skipUnpack(w); | 			w = skipUnpack(w); | ||||||
| 			cols += 4*n; | 			cols += 4*(nvert-2); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if(skin){ | 		if(skin){ | ||||||
| 			assert((w[0] & 0xFF004000) == 0x6C000000); | 			assert((w[0] & 0xFF004000) == 0x6C000000); | ||||||
| 			unpackSkinData((w+1), weights, indices, nvert); | 			unpackSkinData((w+1), weights, indices, nvert); | ||||||
| 			w = skipUnpack(w); | 			w = skipUnpack(w); | ||||||
| 			indices += 4*n; | 			indices += 4*(nvert-2); | ||||||
| 			weights += 4*n; | 			weights += 4*(nvert-2); | ||||||
| 		} | 		} | ||||||
| 		g->numVertices += n; | 		g->numVertices += nvert-2; | ||||||
| 
 | 
 | ||||||
| 		assert(w[0] == 0x14000006); | 		assert(w[0] == 0x14000006); | ||||||
| 		w++; | 		w++; | ||||||
| 		while(w[0] == 0) w++; | 		while(w[0] == 0) w++; | ||||||
| 		first = 0; |  | ||||||
| 	} | 	} | ||||||
|  | 	g->numVertices += 2; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user