B3D format and unused verts

Blitz3D Forums/Blitz3D Programming/B3D format and unused verts

RifRaf(Posted 2004) [#1]
Sorry if this questions sounds off, not sure how to word it..

If you save a B3D format mesh, and have 3 verts created during save, but do not create a triangle from those 3 verts. Does blitz load those verts and store them? or does it ignore them durring load?

heres what im doing.

	surf=GetSurface( layer(mi),1 )
				n_verts=CountVertices( surf )-1
				
				For j=0 To n_verts
					b3dWriteFloat( VertexX( surf,j ) )
					b3dWriteFloat( VertexY( surf,j ))
					b3dWriteFloat( VertexZ( surf,j ) )
					
					b3dWriteFloat( VertexRed(surf,j)/255)
					b3dWriteFloat( VertexGreen(surf,j)/255)
					b3dWriteFloat( VertexBlue(surf,j)/255)

					b3dWriteFloat( VertexAlpha( surf,j))

					
					b3dWriteFloat( VertexU#( surf,j,0 ) )
					b3dWriteFloat( VertexV#( surf,j,0 ) )

									Next
;			Next
		b3dEndChunk()	;end of VRTS chunk
		
		first_vert=0
;		For k=1 To n_surfs
			surf=GetSurface( layer(mi),1 )
			n_tris=CountTriangles( surf )-1
			
			b3dBeginChunk( "TRIS" )

				b3dWriteInt(MI-1)		;brush for these triangles
				
				For j=0 To n_tris
If VertexAlpha(surf,TriangleVertex(Surf,j,0))<>0 Or VertexAlpha(surf,TriangleVertex(Surf,j,1))<>0 Or VertexAlpha(surf,TriangleVertex(Surf,j,2))<>0 Or mi=1 Then 
					b3dWriteInt( first_vert+TriangleVertex( surf,j,0 ) )
					b3dWriteInt( first_vert+TriangleVertex( surf,j,1 ) )
					b3dWriteInt( first_vert+TriangleVertex( surf,j,2 ) )
EndIf
				Next



you will see that im writing all verts, but I have a condition on the trianlge .. if all 3 verts of that triangle have 0 alpha then the triangle is not written to the file.

So is blitz stil loading the unused verts ?


RifRaf(Posted 2004) [#2]
looks like it is.. the vertex count was huge


jfk EO-11110(Posted 2004) [#3]
I think it creates them anyway. Otherwise it would first have to check all vertices is they are used in any triangle before it could start adding them to a surface. I'd rather think it will read the vertices, add them to a surface right away and finally create the triangles described in the tris chunk. So it may leave it up to an external mesh optimize function to wipe out unused or double vertices.

Of course I could be wrong, you can check this out easily by loading the mesh and then watch CountVertices.


Rob(Posted 2004) [#4]
It creates what you tell it to create. A mesh with only verts is still a valid mesh.


big10p(Posted 2004) [#5]
Yes. For all Blitz knows, you may want to build triangles from the verts, dynamically in code.