Syntax

Result = dbMakeMemblockFromMesh(MemblockID, MeshID)

Description

If #PB_Any is used as the MemblockID parameter, the new ID will be returned as 'Result'. Otherwise the value of 'Result' is the same value passed as the MemblockID parameter.

This command will make a memblock from a mesh. The source resource must exist or the command will fail. The mesh memblock is layed out in the following format.

The first Long is the FVF format, which controls which components each vertex of your mesh will contain. The default FVF Format is 338.

The second Long is the FVF Size, which is the size in bytes of a single vertex element. This size is respective of the FVF Format you specified, which has a default of 36. The third Long is the number of Vertices in your mesh.

The remainder of the memblock contains mesh data. The mesh data is a sequential list of vertices, containing the component data arranged as specified by the FVF Format. The default FVF Format would specify the following arrangement of data within the vertex element, which is duplicated for every vertex specified in the memblock. Each grouping of three vertices makes a polygon.

Given the default FVF Format of 338, the first three FLOAT values (12 bytes) of the vertex element would be the XYZ coordinates in model space. The second three Float values (12 bytes) of the vertex element would be the normals coordinates in model space. The next Long is a diffuse colour component that specifies the colour of the vertex. The last two floats are UV texture coordinates for the vertex. This adds up to 36 bytes which is the size of a single vertex. Multiply 36 by the number of vertices in the mesh and you get the overall size of the mesh data.

See Also

dbChangeMeshFromMemblock, dbMakeMemblockFromBitmap, dbMakeMemblockFromImage, dbMakeMemblockFromMesh, dbMakeMemblockFromSound, dbMakeMeshFromMemblock