Is there documentation labeling the individual lines in FVF formats? I'm getting different results when I alter the variables as you've shown. Does it magically vary? DX has got me lost on this one. Here's what I've got. Sorry its so sloppy. It was gonna be a quick learn example just for myself so I just slapped it together as I went.
#include "DarkGDK.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
/*
double meshd = dbGetMemblockPtr ( 1 );
float meshf = (float)meshd;
float* meshfptr = &meshf;
The following is the process we'll be using to create
a 3D matrix made of objects.
Create
Virtualize
Edit
Destroy
Re-Create
Position
Properties
This is the layout needed for a global array
[Global Array]
ID
Row
Column
*/
dbSyncOn ( );
dbSyncRate ( 60 );
dbRandomize ( dbTimer ( ) );
int y, pos = 8;
/*
// create some 'vertices'
dbMakeObjectSphere ( 6, .5 );
dbMakeObjectSphere ( 7, .5 );
dbMakeObjectSphere ( 8, .5 );
dbMakeObjectSphere ( 9, .5 );
dbMakeObjectSphere ( 10, .5 );
dbMakeObjectSphere ( 11, .5 );
dbMakeObjectSphere ( 12, .5 );
dbMakeObjectSphere ( 13, .5 );
dbMakeObjectSphere ( 14, .5 );
dbMakeObjectSphere ( 15, .5 );
dbMakeObjectSphere ( 16, .5 );
dbMakeObjectSphere ( 17, .5 );
*/
// create plains
dbMakeObjectPlain ( 1, 20, 20 );
dbMakeMeshFromObject ( 1, 1 );
dbMakeMemblockFromMesh ( 1, 1 );
dbMakeObjectPlain ( 2, 20, 20 );
dbMakeMeshFromObject ( 2, 2 );
dbMakeMemblockFromMesh ( 2, 2 );
dbMakeObjectPlain ( 3, 20, 20 );
dbMakeMeshFromObject ( 3, 3 );
dbMakeMemblockFromMesh ( 3, 3 );
dbMakeObjectPlain ( 4, 20, 20 );
dbMakeMeshFromObject ( 4, 4 );
dbMakeMemblockFromMesh ( 4, 4 );
// edit memblocks
dbWriteMemblockFloat ( 1, 20, dbRnd ( 10 ) - 5 );
dbWriteMemblockFloat ( 1, 52, dbRnd ( 10 ) - 5 );
dbWriteMemblockFloat ( 1, 84, dbRnd ( 10 ) - 5 );
dbWriteMemblockFloat ( 1, 116, dbMemblockFloat ( 1, 52 ) );
dbWriteMemblockFloat ( 1, 148, dbRnd ( 10 ) - 5 );
dbWriteMemblockFloat ( 1, 180, dbMemblockFloat ( 1, 84 ) );
dbWriteMemblockFloat ( 2, 20, dbRnd ( 10 ) - 5 );
dbWriteMemblockFloat ( 2, 52, dbMemblockFloat ( 1, 20 ) );
dbWriteMemblockFloat ( 2, 84, dbRnd ( 10 ) - 5 );
dbWriteMemblockFloat ( 2, 116, dbMemblockFloat ( 1, 20 ) );
dbWriteMemblockFloat ( 2, 148, dbMemblockFloat ( 1, 84 ) );
dbWriteMemblockFloat ( 2, 180, dbMemblockFloat ( 2, 84 ) );
dbWriteMemblockFloat ( 3, 20, dbMemblockFloat ( 1, 84 ) );
dbWriteMemblockFloat ( 3, 52, dbMemblockFloat ( 1, 148 ) );
dbWriteMemblockFloat ( 3, 84, dbRnd ( 10 ) - 5 );
dbWriteMemblockFloat ( 3, 116, dbMemblockFloat ( 1, 148 ) );
dbWriteMemblockFloat ( 3, 148, dbRnd ( 10 ) - 5 );
dbWriteMemblockFloat ( 3, 180, dbMemblockFloat ( 3, 84 ) );
dbWriteMemblockFloat ( 4, 20, dbMemblockFloat ( 2, 84 ) );
dbWriteMemblockFloat ( 4, 52, dbMemblockFloat ( 1, 84 ) );
dbWriteMemblockFloat ( 4, 84, dbRnd ( 10 ) - 5 );
dbWriteMemblockFloat ( 4, 116, dbMemblockFloat ( 1, 180 ) );
dbWriteMemblockFloat ( 4, 148, dbMemblockFloat ( 3, 84 ) );
dbWriteMemblockFloat ( 4, 180, dbMemblockFloat ( 4, 84 ) );
/*
// position vertices
dbPositionObject ( 6, dbMemblockFloat ( 1, 16 ), dbMemblockFloat ( 1, 12 ), dbMemblockFloat ( 1, 20 ) );
dbPositionObject ( 7, dbMemblockFloat ( 1, 48 ), dbMemblockFloat ( 1, 44 ), dbMemblockFloat ( 1, 84 ) );
dbPositionObject ( 8, dbMemblockFloat ( 1, 80 ), dbMemblockFloat ( 1, 76 ), dbMemblockFloat ( 1, 52 ) );
dbPositionObject ( 9, dbMemblockFloat ( 1, 112 ), dbMemblockFloat ( 1, 108 ), dbMemblockFloat ( 1, 180 ) );
dbPositionObject ( 10, dbMemblockFloat ( 1, 144 ), dbMemblockFloat ( 1, 140 ), dbMemblockFloat ( 1, 148 ) );
dbPositionObject ( 11, dbMemblockFloat ( 1, 176 ), dbMemblockFloat ( 1, 172 ), dbMemblockFloat ( 1, 116 ) );
dbPositionObject ( 12, dbMemblockFloat ( 2, 16 ) + 20, dbMemblockFloat ( 2, 12 ), dbMemblockFloat ( 2, 20 ) );
dbPositionObject ( 13, dbMemblockFloat ( 2, 48 ) + 20, dbMemblockFloat ( 2, 44 ), dbMemblockFloat ( 2, 84 ) );
dbPositionObject ( 14, dbMemblockFloat ( 2, 80 ) + 20, dbMemblockFloat ( 2, 76 ), dbMemblockFloat ( 2, 52 ) );
dbPositionObject ( 15, dbMemblockFloat ( 2, 112 ) + 20, dbMemblockFloat ( 2, 108 ), dbMemblockFloat ( 2, 180 ) );
dbPositionObject ( 16, dbMemblockFloat ( 2, 144 ) + 20, dbMemblockFloat ( 2, 140 ), dbMemblockFloat ( 2, 148 ) );
dbPositionObject ( 17, dbMemblockFloat ( 2, 176 ) + 20, dbMemblockFloat ( 2, 172 ), dbMemblockFloat ( 2, 116 ) );
*/
// destroy original plains
dbDeleteObject ( 1 );
dbDeleteMesh ( 1 );
dbDeleteObject ( 2 );
dbDeleteMesh ( 2 );
dbDeleteObject ( 3 );
dbDeleteMesh ( 3 );
dbDeleteObject ( 4 );
dbDeleteMesh ( 4 );
// re-create plains
dbMakeMeshFromMemblock ( 1, 1 );
dbMakeObject ( 1, 1, 0 );
dbMakeMeshFromMemblock ( 2, 2 );
dbMakeObject ( 2, 2, 0 );
dbMakeMeshFromMemblock ( 3, 3 );
dbMakeObject ( 3, 3, 0 );
dbMakeMeshFromMemblock ( 4, 4 );
dbMakeObject ( 4, 4, 0 );
// position plains
dbPositionObject ( 2, dbObjectPositionX ( 2 ) + 20, dbObjectPositionY ( 2 ), dbObjectPositionZ ( 2 ) );
dbPositionObject ( 3, dbObjectPositionX ( 3 ), dbObjectPositionY ( 3 ) - 20, dbObjectPositionZ ( 3 ) );
dbPositionObject ( 4, dbObjectPositionX ( 4 ) + 20, dbObjectPositionY ( 4 ) - 20, dbObjectPositionZ ( 4 ) );
// set properties
dbSetObjectWireframe ( 1, 1 );
dbSetObjectWireframe ( 2, 1 );
dbSetObjectWireframe ( 3, 1 );
dbSetObjectWireframe ( 4, 1 );
dbSetObjectCull ( 1, 0 );
dbSetObjectCull ( 2, 0 );
dbSetObjectCull ( 3, 0 );
dbSetObjectCull ( 4, 0 );
// write debug file to desktop
if ( dbFileExist ( "C:\\Users\\User\\Desktop\\Plain.txt" ) != 0 )
{
dbDeleteFile ( "C:\\Users\\User\\Desktop\\Plain.txt" );
}
if ( dbFileExist ( "C:\\Users\\User\\Desktop\\Plain.txt" ) == 0 )
{
dbOpenToWrite ( 1, "C:\\Users\\User\\Desktop\\Plain.txt" );
dbWriteString ( 1, dbStr ( (float)dbMemblockDword ( 1, 0 ) ) );
dbWriteString ( 1, dbStr ( (float)dbMemblockDword ( 1, 4 ) ) );
dbWriteString ( 1, dbStr ( (float)( dbMemblockDword ( 1, 8 ) * 4 ) ) );
for ( y = 3; y < 208; y++ )
{
pos = pos + 4;
dbWriteString ( 1, dbStr ( pos ) );
dbWriteString ( 1, dbStr ( dbMemblockFloat ( 1, pos ) ) );
}
pos = 8;
dbWriteString ( 1, dbStr ( (float)dbMemblockDword ( 2, 0 ) ) );
dbWriteString ( 1, dbStr ( (float)dbMemblockDword ( 2, 4 ) ) );
dbWriteString ( 1, dbStr ( (float)( dbMemblockDword ( 2, 8 ) * 4 ) ) );
for ( y = 3; y < 208; y++ )
{
pos = pos + 4;
dbWriteString ( 1, dbStr ( pos ) );
dbWriteString ( 1, dbStr ( dbMemblockFloat ( 2, pos ) ) );
}
pos = 8;
dbCloseFile ( 1 );
}
// now we come to our main loop, we call LoopGDK so some internal
// work can be carried out by the GDK
while ( LoopGDK ( ) )
{
// display debug text on screen
dbText ( 0, 0, dbStr ( (float)dbMemblockDword ( 1, 0 ) ) );
dbText ( 0, 10, dbStr ( (float)dbMemblockDword ( 1, 4 ) ) );
dbText ( 0, 20, dbStr ( (float)dbMemblockDword ( 1, 8 ) ) );
for ( y = 3; y < 11; y++ )
{
pos = pos + 4;
dbText ( 0, y * 10, dbStr ( dbMemblockFloat ( 1, pos ) ) );
}
pos = 8;
dbText ( 0, 170, dbStr ( dbGetMemblockSize ( 2 ) ) );
// basic camera control
dbControlCameraUsingArrowKeys ( 0, 1, 2 );
// here we make a call to update the contents of the screen
dbSync ( );
}
// clean up
dbDeleteObject ( 1 );
dbDeleteMesh ( 1 );
dbDeleteMemblock ( 1 );
dbDeleteObject ( 2 );
dbDeleteMesh ( 2 );
dbDeleteMemblock ( 2 );
dbDeleteObject ( 3 );
dbDeleteMesh ( 3 );
dbDeleteMemblock ( 3 );
dbDeleteObject ( 4 );
dbDeleteMesh ( 4 );
dbDeleteMemblock ( 4 );
for ( y = 6; y < 17; y++ ){
dbDeleteObject ( y );
}
// and now everything is ready to return back to Windows
return;
}
It creates a txt file on the desktop with the memblock output of two of the objects. You'll need to update the folder path.
Thanks for your help on this issue.