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 / How to apply a transformation matrix to a dbpro object?

Author
Message
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 31st Aug 2009 13:14 Edited at: 31st Aug 2009 13:15
How to apply a transformation matrix to a dGDK object?

And how to get the transformation matrix of a dGDK object?

I would like to be able to do this:



and this:



There is always one more imbecile than you counted on.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 31st Aug 2009 13:56
Get a pointer to the object like this :

sObject* pObject = dbGetObject(1);

pObject->pFrame

has D3DMATRIX objects representing different transforms, im not sure which is which, you would have to play with them.

Hope this helps

If it ain't broke.... DONT FIX IT !!!
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 31st Aug 2009 13:59
err..lets suppose im abit of a newbie with c++ and dark gdk.

Can you elaborate abit?

Like, if you can show me just an example of a basic getMatrix() function?

There is always one more imbecile than you counted on.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 31st Aug 2009 14:19
Ok sorry, I assumed you would know what I meant...

ok, all of the objects in GDK are DBO objects, you can have a look in the DBOData.h file in the Include\DBO folder if your GDK installation to examine exactly what the DBO object structure looks like(this is why its faster to load .DBO objects, there is no conversion from one format to another, load a .X and GDK has to copy all the data to DBO structures.

The function dbGetObject(int ObjID); returns a pointer of the type *sObject ... this is a pointer to the DBO object, which contains among other things, all of the information pertaining to the directX mesh and effects etc...

Once you have created or loaded you object and it has an ID, you can call the dbGetObject function like so and get a pointer to use.



You can then acces the object directly by dereferencing that pointer ( -> )

To be specific, there are actually a who bunch of different transform matrices you could grab from it, including the Combined world, Original World and transformed world matrices.... here is an example of how to grab one of those from an object.



This will extract the "Real-Time Transformed Matrix" from the object and store it inside matTrans. Im not really sure which of the matrices in the object are representative of which DX transforms, they do have comments, but there seem to be more than you would expect, so you would have to experiment with which is going to do what you want.... use intellisense to explore the pointer you get from dbGetObject() .... it is very interesting what you can do to the object via it's pointer rather than GDK functions....

If it ain't broke.... DONT FIX IT !!!
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 31st Aug 2009 14:46
Or just use: dbSetObjectWorldMatrix()

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 31st Aug 2009 14:52
Thats pretty cool Mista Wilson, is accessing the objects like this completely safe? assuming you can change the matrices this way too.

I mean when you call the db functions to change an objects state they maybe updating other things as well, so if you bypass the db functions and change the object directly, could there be consequences down the line if you revert back to using the db functions?

I am currently learning C++ myself so I'm sorry if my question doesn't make much sense.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 31st Aug 2009 15:47
Quote: "Or just use: dbSetObjectWorldMatrix()"


Where is this ocmmand in the help file? I couldnt find it.

Also, is there a command like dbGETObjectWorldMatrix() too?

There is always one more imbecile than you counted on.
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 31st Aug 2009 15:50
@dark coder - lol Thank you I didnt know that method existed..

CuCuMbEr - it would be alot easier to use the way dark coder mentioned lol

@matty - yes it's generally safe, provided that you know what you are doing. I use this method of object access quite a bit myself, from simple things like setting the object's mask for shaders(it improves performance not having to hide/exclude xx object over and over so many timer per second) to creating brand new objects and filling the data structures manually...

If you arent 100% sure of what something will do though, its best to expect it to break something or cause unexpected behaviour if you change it, if it doesnt, consider it lucky lol...

And also, Good Luck with learning C++, feel free to ask whatever questions you like they made perfect sense to me, its one of the best ways to learn. And dont let any mistakes or drawbacks discourage you, just try to learn from them.

If it ain't broke.... DONT FIX IT !!!
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 31st Aug 2009 16:02
Thanks Mista Wilson.

Cucumber, that command is not documented in the help file, that is why I was slightly weary about using it. There is a dbGetObjectWorldMatrix() as well and they seem to work fine.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 31st Aug 2009 16:31
Thanks

There is always one more imbecile than you counted on.

Login to post a reply

Server time is: 2024-10-01 12:30:23
Your offset time is: 2024-10-01 12:30:23