Here are the instructions to retrieve a pointer to an object, files needed are attached. Hopefully this will be added in future release of DarkGDK2 along with some other commands listed in my original post.
Presuming your file structure is the same as used in the DarkGDK setup tutorial for Visual studio 2010.
Add the files:
DBOData.h
global.h
To 'darkgdk' folder.
Open 'darkgdk-3d.h' and add the lines:
#include "../DBOData.h"
sObject* dbGetObject(int32_t objectID);
Open 'darkgdk-3d.cpp' and add the lines:
typedef sObject* (__cdecl *pdbGetObject)(int32_t objectID);
sObject* dbGetObject(int32_t objectID) {
static pdbGetObject Ptr;
sObject* obj;
if (!Ptr && !GDKLoadPtr(&Ptr,"DBProBasic3DDebug.dll", "?GetObjectA@@YAPAUsObject@@H@Z"))
return 0;
if (GDKWaitFunction()) {
if (objectID <= 0)
return NULL; // Invalid object ID
obj = Ptr(objectID);
GDKCleanupFunctionCall();
}
return obj;
}
You can now do this:
sObject* dbGetObject( objectID );
And have access to objects internal data.
Original post:
Using GDK1 I can get access to an object pointer using dbGetObject() which returns a pointer of type sObject.
Is there a way to do this in GDK2?
I recently wrote an LOD terrain library, it's platform independent but DarkGDK jumps in at the last minute and creates an object using these commands:
// http://code.google.com/p/darkbasicpro/source/browse/trunk/%20darkbasicpro%20--username%20LeeBamberTGC/Dark%20Basic%20Pro%20SDK/Shared/Objects/CommonC.h
bool CreateNewObject ( int iID, LPSTR pName, int iFrame );
sFrame* CreateNewFrame ( sObject* pObject, LPSTR pName, bool bNewMesh );
bool SetupStandardVertex ( DWORD dwFVF, BYTE* pVertex, int iOffset, float x, float y, float z, float nx, float ny, float nz, DWORD dwDiffuseColour, float tu, float tv );
bool SetupMeshFVFData ( sMesh* pMesh, DWORD dwFVF, DWORD dwVertexCount, DWORD dwIndexCount );
bool SetNewObjectFinalProperties( int iID, float fRadius );
void SetTexture ( int iID, int iImage );
For me to work with GDK2 and continue to create plug-ins I need low level access to objects, is this possible? Thanks.