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 Professional Discussion / How To Add Multiple Textures On single Stage

Author
Message
paul5147
20
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 20th May 2010 18:28
Bit of cheat this but realy easy enough to do once you get your head around .x format files.This is part of a UV Painting Program im working on in DBPro.I asked in another thread if any one knew how to acces the textures that were loaded from a .x file as if they were normal DBPro textures so you could adjust them.But so far no one has answered,so i decided to attack the problem from the other end and simply make the .x object and add the textures i want to it in the positions i want,then reload the newly created object.DBPro then simply loads it as any other object but now it has as many textures as you want built into it.
This code snippet simply generates a cube and 10 random textures and builds them in to 1 .x object.
Ill post up the UV Painter in the WIP forum some time later,or at least some screen shots of it.

maybe using some matrix1 code in it somewhere,i cant remember the last time i didnt use it,and cant understand why some of the commands arnt in DBPro anyway.
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 20th May 2010 18:50
That's pretty cool.

Is there a use for this you have planned?

paul5147
20
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 20th May 2010 21:16
KISTech,
Keep watching the WIP Forum for the next few days,i should get a chance to post what this is part of.It provides a fairly big piece of the puzzle for my UV painter/wrapper code,allowing you to pick from multiple images and apply them as the base texture on to your models.The hardest part was to get the vertex selection code working,for now it just picks individual faces of meshes,allowing for any limb offset and rotation that may have been applied and wire frames the selected poly,then you simply point to the 3 parts of any given texture you have loaded to set the new UV Values.
This code then saves out the new .x file for that particular limb with its new texture data and reloads it and applies it to the model.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st May 2010 00:19
Good. Keep it up. That's more or less the way I'd do it in DBPro as well. I'm looking forward to seeing how you get on.
paul5147
20
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 21st May 2010 09:04 Edited at: 21st May 2010 10:51
Ran into a bit of road block with this last night,its fine for the base object of the model to be reloaded back in,but i cant find a way to make a new limb and retain the texture,all the limb commands only accept meshes and as soon as you create a mesh from the object it loses all its texture data.Some of IanM's commands look promising if you could load the model to a memory bank and build the limb from there that might work.Ill give it a try,but if any one knows another way,the help would be apreciated,thanks.
EDIT
Think ive sorted this out but its a slow way of doing it,i have to export the entire model included all its limbs and load it back in,not just the limb im editing,but again if im missing something then please let me know,thanks.
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 21st May 2010 18:15
Make a cube.

Use the cube as the limb.

Hide the limb.

Attach your object to the limb with GLUE OBJECT TO LIMB.

paul5147
20
Years of Service
User Offline
Joined: 11th Jan 2006
Location: Hot & Sunny
Posted: 21st May 2010 18:53
Thanks KISTech,thats how i was doing it before,but decided i wanted to use the limbs properly so i could save and load the models as 1 object, and not have the hassle of setting it all back up every time I load the model.Ive got it working now by exporting the whole object as a .x text file and then reloading it.It just took a bit of fidling with the .x exporter I rote to make it parse through all the objects limbs and add the data to the .x file.Thanks for the help though.Ive started up a WIP thread for this know,probably a bit premature,but what the hell,progress is progress.
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 21st May 2010 20:54
True, if the goal is to keep it as one single object that would work better. I use the method I mentioned to dock and undock cargo pods to my ships.

Login to post a reply

Server time is: 2026-07-25 16:21:19
Your offset time is: 2026-07-25 16:21:19