Addmesh only add poly infos ?

Blitz3D Forums/Blitz3D Programming/Addmesh only add poly infos ?

Bobysait(Posted 2008) [#1]
If we use AddMesh, it seems, surfaces propertys are not preserved...
Is my code wrong ?

Graphics3D 300,200,0,2

Mesh1	=	CreateMesh()
For n=1 To 6
	s=CreateSurface(Mesh1)
	AddVertex(s,-1,+1,0)
	AddVertex(s,+1,+1,0)
	AddVertex(s,+1,-1,0)
	AddVertex(s,-1,-1,0)
	AddTriangle(s,0,1,2):AddTriangle(s,0,2,3)
Next

Print "Mesh1 Count S:"+CountSurfaces(mesh1)

Mesh2	=	CreateMesh	()
			AddMesh		(Mesh1, Mesh2)
Print "Mesh2 Count S:"+CountSurfaces(mesh2)
WaitKey


we should have 6 surfaces Input, and 6 output, but, the result is a single surface mesh :/


Stevie G(Posted 2008) [#2]
If you add a mesh which shares the same brush properties as the original mesh then blitz will automatically combine them. Personally I think it's a handy feature.

If you do this ...

Graphics3D 300,200,0,2

Mesh1	=	CreateMesh()
For n=1 To 6
	s=CreateSurface(Mesh1)
	AddVertex(s,-1,+1,0)
	AddVertex(s,+1,+1,0)
	AddVertex(s,+1,-1,0)
	AddVertex(s,-1,-1,0)
	AddTriangle(s,0,1,2):AddTriangle(s,0,2,3)
	b = CreateBrush( Rand(128,255), Rand(128, 255), Rand(128, 255 ) )
	PaintSurface s, b	
	FreeBrush b
Next

Print "Mesh1 Count S:"+CountSurfaces(mesh1)

Mesh2	=	CreateMesh	()
			AddMesh		(Mesh1, Mesh2)
Print "Mesh2 Count S:"+CountSurfaces(mesh2)
WaitKey



... you get 6 surfaces.

Stevie


Bobysait(Posted 2008) [#3]
So, Blitz3D preserve Surfaces in AddMesh only if surface has a brushe different from the receiver . Thanks for help .


jfk EO-11110(Posted 2008) [#4]
This is true. You may however cheat a little, eg. by using something like Brushcolor brush1,255,255,254, or other properties that are allowed to vary decently.


puki(Posted 2008) [#5]
Damn! I was trying to keep this secret.