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.

DarkBASIC Discussion / Retrieve a pointer to the frames/meshes of a D3D file I load into DBC

Author
Message
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 19th Oct 2007 15:46
Hello,

I've been trying to figure out how to get the pointers to the frames, meshes, vertices, textures, and other objects that are loaded into DBC through an X or 3ds file. I was also wondering how to get the pointers to the primative objects and limbs one would create with DBC. Any advice would be greatly appreciated. If it could be done through DBC, that would be great - but I doubt it could. I would like to make a DLL, or use any of the DLLs that are installed with DirectX runtime if that is possible.

Thanks in advance!

Enjoy your day.
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 19th Oct 2007 18:02
I have no idea how to do it and if you don't I doubt anyone else does, but what are you you trying to do?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 19th Oct 2007 18:34
There are many reasons, but in the case I was thinking about specifcally, I'm trying to get the size of individual limbs. I'm also trying to extract limb vertice and texture data. I can intercept this info from the x file before it is actually loaded into DBC, but if I can get at it from memory, then that opens up the door to many possibilities.

Enjoy your day.
demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 19th Oct 2007 18:36
I don't think you can use pointers in DBC so unless TDK pops in, you should probably try another forum.

http://jamesmason01.googlepages.com/index.htm
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 19th Oct 2007 18:42
Well, you can call dlls through DBC and one could use the DLL to handle all the pointer stuff. Plus you can get a pointer to a memblock and use that pointer to transfer information back and forth to/from a DLL.

Quote: "...you should probably try another forum"


I'll give it a little time here and see what turns up. Thanks for the input.

Enjoy your day.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 19th Oct 2007 19:20
I don't know what a pointer is, but isn't the data you need in the memblock header? Offsets to vertices etc
There must be some indicator that is stored in a mesh memblock.
I've never looked at a memblock of an object with limbs so... i dunno
there's not a lot of commands for handling memblocks IMHO but the data must be there or it's stupid haha

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 19th Oct 2007 19:23
pointers are used in programming languages like C++.

This might help. It makes no sense to me, to be honest.

http://jamesmason01.googlepages.com/index.htm
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 19th Oct 2007 20:00
A pointer is a value that points to a memory address. A memory address is a location where something is stored. A pointer can point to a string, it can point to a bitmap, it can point to a window, it can point to just about anything that can be stored in memory.

When you create an object with a command like MAKE OBJECT SPHERE 1,25 , even though you are making an object with number 1, there is a memory location where the information for this object is stored. DarkBASIC makes it easy for the user by just returning an index number of 1 (or whatever number we assign to the object). As far as the computer is concerned, the object is actually stored at some memory location (not at 1). This location can be referenced by a pointer. The index of the object isn't the pointer, but sort of a reference to the real pointer. If one could get the address of the real pointer, then you could create an object in DBC, get the pointer to it, then call and draw that object in a completely different program that is running at the same time by referencing the actual pointer. Or you could do other things with the object information like edit the vertices or the textures or whatever.

Quote: "but isn't the data you need in the memblock header? Offsets to vertices etc"


It is and it isn't. If you were to load an object or make an object with a series of limbs, once you convert the object to a mesh, then the mesh to a memblock, all of the limb information is gone. What you end up with is just one object with all of the limbs as part of it. Also, the actual texture references disappear in the mesh to memblock scenario. So if you had individually textured limbs in your original object, that would all be gone when you make a mesh from object.

If there was a way to get the real pointers to the objects, bitmaps, images, sprites, etc. you could use DLLs to do all sorts of cool stuff that goes beyond native DBC commands.

Enjoy your day.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 19th Oct 2007 20:12
Oh right I understand now, I've started reading a massive book called "Understanding Computer Science" so that makes some vague sense to me
hmm... I'm not an expert at those sorts of commands but I'm pretty sure you can't access memory with DBC (bit too dangerous haha) I spose a DLL would be able to although I know nothing about them except for that cool example YOU showed me haha.
So... nope, no help from me on this one, sorry.

demons breath
21
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 19th Oct 2007 20:28
Oh so there actually is a purpose to pointers. I could see what they did. I just couldn't see why anyone would actually care.

http://jamesmason01.googlepages.com/index.htm
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 27th Oct 2007 02:32
Does any body have any ideas on how I might be able to retrieve a pointer to a loaded object and/or it's child frames (limbs) from DBC?

Enjoy your day.
pcRaider
18
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 30th Oct 2007 07:09
Quote: "it's child frames (limbs) from DBC?"


This is a program of DBP.
You must convert it into DBC.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 30th Oct 2007 18:54
@pcRaider

Thank you.

Unfortunately the checklist doesn't seem to contain the information I'm looking for.

The values a,b,c and d do return values - a) returns the limb number and b),c), and d) return -1. I haven't been able to find any documentation on what the checklist values are supposed to hold for limbs. Maybe the functionality hasn't been implemented for DBC.

This isn't a show stopper, because I have a workaround managing the x file itself. However, I still would love to know how to get the memory addresses of where this stuff is stored once loaded into DBC.

Enjoy your day.
w2up
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location:
Posted: 2nd Nov 2007 04:34
DBC runns interpretted. So, accessing the memory data is really not possible. There probably is a way, but you may need to get "experts" at hacking programs to help you. Rob Knight comes to mind and there was this russion guy that did hack DBC and extracted the interpreter from it .....

Another factor is how directx manages pointers. Since the directx surface pointers can be moved around in real time, locking the pointer while accessing the data can be very hard to hack. If you are somewhat knowledgable in C++, maybe considered porting to DGSDK which should give you many more options.

DBC is great for "messing around" but to get "serious" you need something that permits greater access. For me, DBC is just fine. I have DBPro, but can't use it (fully) and so DGSDK is definately out for me. For you, it may be perfect. Think of it as leveraging what you know, so you can do more.

code ... the international laguage
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 2nd Nov 2007 19:00
How come this thread didn't update with your post?

Anyway...

Thanks w2up. I was hoping that wouldn't be the answer. If it takes a hack, that kind of effort could be used to program directx in C/C++ and maybe I'll go there when I'm done with DBC; but not today. I still believe though I've barely scratched the surface with what can be done with DB Classic, and part of the fun is that challenge of discovery.

Enjoy your day.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 11th Dec 2007 22:21
Quote: "but isn't the data you need in the memblock header? Offsets to vertices etc
There must be some indicator that is stored in a mesh memblock."

Well, I revisted this after putting some thought into it (getting specific limb information). After some trial and error, I've found a way to extract individual limbs out of a memblock as meshes. I still have a few tests to run but it looks like it'll work.

Does anybody know of a way to texture an object that is copied from another object when the original object may have multiple bitmap textures? What I mean is if you load an x file, then make that object into a mesh then make another object out of that mesh, if the original object had two or three texture files associated with it, is there a way to texture the new object with all of those bitmaps? Somehow, the faces and the UV coordinates relate to the pixels of the textures. Is there a way to combine the multiple bitmaps into 1 so as to satisfy the UV coordinates of the new object? Anyone know the algorithms to unwrap an object for UV mapping?

Enjoy your day.
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 12th Dec 2007 05:04
Quote: "What I mean is if you load an x file, then make that object into a mesh then make another object out of that mesh, if the original object had two or three texture files associated with it, is there a way to texture the new object with all of those bitmaps? "

Wow, I never realised that you wouldn't be able to do that...

You could redo the UV mapping for the object if you converted it into a memblock and then set the UV data for each vertex couldn't you? How does the UV data for the object differ if you are using multiple textures? I guess you would lose information on what texture each vertices UV values refer too wouldn't you? If so this was a pointless post so sorry
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 12th Dec 2007 21:12
Quote: "How does the UV data for the object differ if you are using multiple textures?"

That's what I've been wrestling with. Assumingly, for an entire object, the UV data ranges from 0 to 1. If you have multiple objects that are made into limbs, I assume each one's UV map ranged from 0 to 1 also. So that kinda kicked the idea of combining all of the bitmaps into one. But, there has to be a reference to each limb's UV data right? because we can texture individual limbs in DB with their own image. And in a directx file, a texture can be assigned to each face - again the UV data would determine how the texture is spread out on that face.

Quote: "I guess you would lose information on what texture each vertices UV values refer too wouldn't you? "

What I've been avoiding is checking and comparing each UV coordinate before and after converting the mesh from the original. Blah! well, I guess I'll have to in this case...

Quote: "If so this was a pointless post"

Not at all! Talking it out and seeing other ideas really helps! It makes the old rusty wheels start turning.

Question, do you or does anybody know if limbs are used in mesh skinning with bone mesh deformation (using a skeleton)? Or is it just one mesh with a skeleton inside? And if so, are the bones referenced as limbs? Does anyone have a direct x example with skeletal animation that I could look at? Hopefully a text and not a binary file.

Enjoy your day.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 19th Dec 2007 19:23
guys - just research the file format and make a loader, store the info for the object into your own "Storage Mechanism" - then Load the Object via DarkBasic - THEN - You Can LOCK VERTEX DATA for Ovject ID, Limb ID - And mess with normals (Effect light on polys), Move Vertices Around, Set Vertice Color "Scorch a Robot's Elbow by darken it" then UNLOCK VERTEX DATA - And You Managed it (I Hope) what you're trying - without losing the Bitmap Stuff.

you can Manipulate 1 TEXTURE's UV and Stuff - but if you model has multiple bitmaps or whatever to texture it - Make your own loader to "Look Ahead" and "have the Data available".

Shoot - if you did this (dented metal, scorched etc) - and never modified the ORIGINAL Data from your homebrew file "Model File Reader" - You probably could do a very fancy "HEALTH/REPAIR animation - gradually "Repairing" Stuff back to the way it was before you mangled it

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Dec 2007 06:24
Thanks for the suggestions! Though LOCK and UNLOCK VERTEX DATA are not DBC commands nor can vertices be colored independently... the woes of an antiquated programming language. Everything else makes good sense.

Enjoy your day.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 20th Dec 2007 13:24
Quote: "Though LOCK and UNLOCK VERTEX DATA are not DBC commands nor can vertices be colored independently"


Does DBC have Make Mesh from MemBlock? Because - the first thing I do is make a mesh - using a memblock - and at that point you can color verts, set the uv info (For one texture...think Lith Unwrap .. to get kinda fancy) ... you may not be able to adjust it once its made - but you might be able to do something like this:

Set Everything, Choose your Vertex heights, Normalize it - THEN make it into a mesh - then to an object then apply the texture... I don't know but maybe

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 21st Dec 2007 01:26 Edited at: 21st Dec 2007 01:29
Does DBC have Make Mesh from MemBlock

...from a little earlier in the thread:
Quote: "Well, I revisted this after putting some thought into it (getting specific limb information). After some trial and error, I've found a way to extract individual limbs out of a memblock as meshes. I still have a few tests to run but it looks like it'll work."


The challenge with multiple textures and the conversion of the mesh to a memblock and then apply the multiple textures to the new mesh is the real obstacle. DBC doesn't allow shaders or vertex colors. The conversion to a memblock only contains vertex x,y and z , normal x,y and z , face index, and texture coordinates u,v. It contains no colors or color references nor any reference to the texture image(s) itself.

Quote: "Set Everything, Choose your Vertex heights, Normalize it - THEN make it into a mesh - then to an object then apply the texture... I don't know but maybe "


This is part of the process I'm using. To clarify a little bit of my goal, there are actually a couple of different applications I'm using these ideas in. Both involve character animation. Since DBC doesn't allow mesh deformation as an animation method assigned to keys in a directx file, one of the applications I'm developing will allow skeleton driven mesh animations direct x files to be loaded into DBC and able to be played. Because the only real way to do this in DBC is to have multiple static meshes created then cycled, I have to be able to texture the new meshes exactly the same way as the original object. An alternative is to break down the skeletons into articulated meshes (limbs) and change the animations keys to those that can be read by DBC. Then texture each individual mesh with the bitmap textures identified in the x file.

Enjoy your day.

Login to post a reply

Server time is: 2025-06-02 10:02:45
Your offset time is: 2025-06-02 10:02:45