Small demo of Matrix/Bone Animation

Blitz3D Forums/Blitz3D Programming/Small demo of Matrix/Bone Animation

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Great stuff. Second demo MAVs though.

Are you getting all the B3D info from the file? There's a way to peek the vertex info, weightmap values and their associated bone IDs if it helps.

	meshHeader = PeekMemInt(ent+644)
	surfCount = PeekMemInt(meshHeader)
	surfListPtr = PeekMemInt(meshHeader+80)
	
	For i = 0 To surfCount-1
		surf = PeekMemInt(surfListPtr + i*4)
		vPtr = PeekMemInt(surf + 28)
		tPtr = PeekMemInt(surf + 44) ;shorts

		firstVertPtr = PeekMemInt(surf+28)
		nextFreeVertPtr = PeekMemInt(surf+32)

		firstTriPtr = PeekMemInt(surf+44)
		nextFreeTriPtr = PeekMemInt(surf+48)
		
		vertCount = (nextFreeVertPtr - firstVertPtr) / 64 ;64bytes per vertex struct
		triCount = (nextFreeTriPtr - firstTriPtr) / 6 ;6 bytes  = 3 Short indices

		Print "Surface: "+Hex(surf)
		Print "vert count: "+vertcount
		Print "tri count:  "+triCount


		;Vertex Chunks, 64bytes each
		For i = 0 To 4
			i60=vPtr+i*64
			Print
			Print "Pos:     X: "+PeekMemFloat(i60)+" , Y: "+PeekMemFloat(i60+4)+" , Z: "+PeekMemFloat(i60+8)
			Print "Norm:   nX: "+PeekMemFloat(i60+12)+" , nY: "+PeekMemFloat(i60+16)+" , nZ: "+PeekMemFloat(i60+20)
			Print "Color: Red: "+PeekMemByte(i60+26)+" , Grn: "+PeekMemByte(i60+25)+" , Blu: "+PeekMemByte(i60+24)+" , Alpha: "+PeekMemByte(i60+27)
			Print "UVs:    U0: "+PeekMemFloat(i60+28)+" , V0: "+PeekMemFloat(i60+32)+" , U1: "+PeekMemFloat(i60+36)+" , V1: "+PeekMemFloat(i60+40)

			;Vertex Weightmap indices
			;The 4 following bytes indicate what weightmaps the vertex is part of/mapped to.
			;If the value >0 And <255 then the value is the vertex map index.
;to the best of my knowledge, the weightmap IDs index the same bone hierarchy of the entity, should you recursively visit all it's bones.
			Print "WeightMapIDs: VMap1: "+PeekMemByte(i60+44)+", VMap2: "+PeekMemByte(i60+45)+", VMap3: "+PeekMemByte(i60+46)+", VMap4: "+PeekMemByte(i60+47)

			;The weight of each vertex in the above vertex maps (the bones influence)
			Print "Weight: "+PeekMemFloat(i60+48)+" , "+PeekMemFloat(i60+52)+" , "+PeekMemFloat(i60+56)+" , "+PeekMemFloat(i60+60)
		Next
		
		Print "TriPtr: "+Hex(tPtr)
		For i = 0 To 5
			Print "Tri Index: "+PeekMemShort(tPtr+i*2) ;*2 for shorts!

		Next
Next