What does AddMesh do?

Blitz3D Forums/Blitz3D Programming/What does AddMesh do?

_PJ_(Posted 2009) [#1]
How does AddMesh affect the original (Destination) mesh with regards to:

EntityRadii etc, UV Coordinates, The 'handle point' of the Mesh, children of the source mesh, What happens to the 'Handle' of the Added Mesh?


Warner(Posted 2009) [#2]
AddMesh copies the surfaces, vertices and triangles from 'dest' to 'src'.
Any rotation/position/scaling etc. that is applied to the src entity will remain the same. Any rotation/scaling/position that is applied to the 'src' mesh will not be copied.

Basically, only the 'mesh' part of the src entity will be copied and added to the 'mesh' part of the dest entity. Anything the belongs to the 'entity' part of the src entity will be ignored.

EntityRadius?
From src will not be copied. From dst will remain the same
Handle Point of the mesh?
Both src and dst will remain their centerpoint. The center is determined by the location of the vertices. A vertex at (0,0,0) is in the center of the mesh. To change that, use PositionMesh
'Handle' of Added Mesh?
Will not be disposed. If you want to get rid of 'src', you'd have to free it using FreeEntity.




_PJ_(Posted 2009) [#3]
Thanks Warner, regarding this point:

'Handle' of Added Mesh?
Will not be disposed. If you want to get rid of 'src', you'd have to free it using FreeEntity.



So does the original mesh still exist then? As a separate Entity


Warner(Posted 2009) [#4]
Yes, indeed. It still exists both as a separate Entity and as a separate Mesh. (Since multiple entities could use the same mesh)


jfk EO-11110(Posted 2009) [#5]
What you can do is: Create an empty mesh with CreateMesh, then AddMesh several meshes to it, then delete the original ones.

The surface count will be optimized this way, multiple identic brushes will then use only one single brush/surface.

As Warner said, only the Mesh-Commands must be used, eg. BrushTexture instead of EntityTexture etc.