void makeMdlBuffer()
{
var vSize;
byte* buffer;
/* the minimum MDL5 has no vertices and one single frame.
It requires 120 Byte of Memory
header: 84 bytes
frame: 36 bytes
byte pack info: 4 bytes
bounding box: 16 bytes (word packed)
frame name: 16 bytes
This is a hack to overcome the incompatibility between
NULL-Entities and ent_setmesh().
MDL5 format info taken from Acknex manual
*/
vSize = 120;
buffer = (byte*)malloc(sizeof(byte) * vSize);
/* since there is no skin, no uv map, no lod, most bytes can remain zero */
memset(buffer, 0x0, vSize);
/* set file type info */
buffer[0] = 'M';
buffer[1] = 'D';
buffer[2] = 'L';
buffer[3] = '5';
/* set number of frames at bytes 69-72 */
buffer[68] = 1;
/* MDL5 seems to support word packed vertex data only.
Enable word packing at bytes 85-88 */
buffer[84] = 2;
/* that's it. Amazingly simple */
add_buffer("simple.mdl", buffer, vSize);
}
...
entDummy = ent_create("simple.mdl", vecPos, NULL);
...