MAKE MESH FROM MEMBLOCK This command will make a mesh from a memblock.
Syntax
    MAKE MESH FROM MEMBLOCK Mesh Number, Memblock Number
Parameters
    Mesh Number
Integer The memblock number
    Memblock Number
Integer The mesh number
Returns
This command does not return a value.
Description
The specified values must be integer values and the source resource must exist or the command will fail. The mesh memblock is layed out in the following format. The first DWORD is the FVF Format, which controls which components each vertex of your mesh will contain. The default FVF Format is 338. The second DWORD 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 DWORD 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 DWORD 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.
Example Code
    MeshNumber=1

    load mesh "mesh.x",MeshNumber

    MemblockNumber=1

    MAKE MEMBLOCK FROM MESH MemblockNumber, MeshNumber

    MAKE MESH FROM MEMBLOCK MeshNumber, MemblockNumber

    rem Display data

    cls

    print "MEMBLOCK EXPRESSION DATA"

    print

    if MEMBLOCK EXIST(MemblockNumber)=1

    print "memblock:";MemblockNumber

    print "exist:";MEMBLOCK EXIST(MemblockNumber)

    print "ptr:";GET MEMBLOCK PTR(MemblockNumber)

    print "size:";GET MEMBLOCK SIZE(MemblockNumber)

    endif

    rem Delete memblocks

    if MEMBLOCK EXIST(MemblockNumber)=1 then DELETE MEMBLOCK MemblockNumber

    do

    loop

    end
See also
MEMBLOCKS Commands Menu Index