Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / [DarkGDK2.0] dbGetObject()

Author
Message
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 14th Jul 2012 23:01 Edited at: 15th Jul 2012 13:15
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:

Open 'darkgdk-3d.cpp' and add the lines:


You can now do this:

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:



For me to work with GDK2 and continue to create plug-ins I need low level access to objects, is this possible? Thanks.

Attachments

Login to view attachments
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 14th Jul 2012 23:25
The function is built-in to the Basic3DDebug.dll, so all you would have to do is create an interface like any other function in DarkGDK 2.0. The function address on my machine is: ?GetObjectA@@YAPAUsObject@@H@Z
Note: You should definitely check that the function export is the same on your machine before you make an interface function.

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 15th Jul 2012 01:15
Thanks Dar13.

Once I get the pointer to the object, can I use it? Or do I need to cast it to the sObject structure myself somehow. I'm not too familiar with working with a dll instead of libs so I'm not sure if the process is the same for this kind of thing.

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 15th Jul 2012 02:16
Quote: "?GetObjectA@@YAPAUsObject@@H@Z"

It seems it will return a sObject pointer directly, hence no cast necessary.


"Why do programmers get Halloween and Christmas mixed up?"
Mistrel
Retired Moderator
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 15th Jul 2012 04:38 Edited at: 15th Jul 2012 04:39
I haven't actually tried this so forgive me if there is a typo somewhere:



You will need to include the definition for sObject from the DBP or GDK 1.0 SDK.

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 15th Jul 2012 13:12
Thanks everyone.

I have updated top post with instructions and files attached.

Qqite
14
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 23rd Sep 2012 09:01 Edited at: 23rd Sep 2012 11:09
Lets say I have my program running as multiple threads.
How would I go about loading an object to an sObject WITHOUT GarkGDK2 pausing on other threads? I've noticed that DarkGDK2 is "Thread safe" but that only means that it makes sure one function is run at a time, not actual thread savvy. I'm assuming I need to manually edit the sObject object, but is it possible to do this without db commands being used?

Ventures of the worlds around us are limited only by our imagination.
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 23rd Sep 2012 18:10
You could load in a simple model(a cube or something) and then get the sObject pointer and put your own data into it. I'm not sure how smart it is to do that, but it's worth a shot.

Qqite
14
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 23rd Sep 2012 23:11
@Dar13

That was what I was wondering, is how would I go about putting that data in the sObject :\

Ventures of the worlds around us are limited only by our imagination.
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 24th Sep 2012 03:29
You'd probably have to follow the chain of code that's called by the dbLoadObject function and see how DGDK populates the struct.

Then simulate that sequence with your own loading code.

Qqite
14
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 24th Sep 2012 09:00
How do I go about following? Is DarkGDK2 open source??

Ventures of the worlds around us are limited only by our imagination.
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 25th Sep 2012 05:42
Quote: "How do I go about following? Is DarkGDK2 open source??"

DarkGDK2 just wraps calls to the original DBP dlls, so all you'd have to do is follow the code in the actual DBP Dlls, which is in the DBP Google Code repository.

Qqite
14
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 25th Sep 2012 09:41
I think I'm in the right Google code. All I see is wrappers and header files, no real code. Where would I find the dbLoadObject function code?

Ventures of the worlds around us are limited only by our imagination.
Brendy boy
19
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 25th Sep 2012 16:53
Quote: "I think I'm in the right Google code. All I see is wrappers and header files, no real code. Where would I find the dbLoadObject function code?"

donwload the code with SVN toll like SVNtortoisse and then open the project in visual studio and search for the wanted function

Login to post a reply

Server time is: 2024-11-18 21:46:58
Your offset time is: 2024-11-18 21:46:58