3d Model Viewer for April's Newsletter: It's here!
by Matt W · in Torque Game Engine · 04/04/2002 (12:43 am) · 15 replies
Rejoice!
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2484
Check this out... or I'll sick Jimmy Jones on your ass.
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2484
Check this out... or I'll sick Jimmy Jones on your ass.
#2
04/04/2002 (3:03 am)
I provided a link to my personal ftp server incase that link doesn't work. I checked it, and that link works!
#3
04/04/2002 (3:49 am)
Sorry Matt, did not look at the comment ;)
#4
04/04/2002 (4:03 am)
so whats this good for? the -show mod does this, dont it? Set me straigt man ;)
#5
www.garagegames.com/newsletter/community/apr2002/
04/04/2002 (4:09 am)
Matt has given a good description in the April newsletter.www.garagegames.com/newsletter/community/apr2002/
#6
This allows you to use models in the GUI.
You could use it for the actual in-game interface (like Quake 3), or player select screens (like Half-Life and Tony Hawk Pro Skater), targetted players could show up in a little menu (like in most RTS or Turn-based games)
The list goes on.
I haven't provided a scripted example of it's use, but it should be pretty clear what you can do.
You can adjust the LOD of the model, the sequence, the skin, the model, the scale(zoom) or the rotation(spin)
04/04/2002 (2:35 pm)
The show mod is for debugging models.This allows you to use models in the GUI.
You could use it for the actual in-game interface (like Quake 3), or player select screens (like Half-Life and Tony Hawk Pro Skater), targetted players could show up in a little menu (like in most RTS or Turn-based games)
The list goes on.
I haven't provided a scripted example of it's use, but it should be pretty clear what you can do.
You can adjust the LOD of the model, the sequence, the skin, the model, the scale(zoom) or the rotation(spin)
#7
haven't looked deeply into the code yet, but it seems to support only ONE .png as skin, right? Cause the tanks I use in the car mod have more than one .png and so they don't get textured at all in the viewer... works great with the player, though!
04/04/2002 (10:28 pm)
Matt-haven't looked deeply into the code yet, but it seems to support only ONE .png as skin, right? Cause the tanks I use in the car mod have more than one .png and so they don't get textured at all in the viewer... works great with the player, though!
#8
I removed multi texture support since I couldn't think of a reason to use multiple textures in normal use. I forgot about vehicles!
Why exactly would you want to use vehicles with this control?
Well, the code directly refers to the first material (the default, and only skin texture in current player models) as array index in the material list of 0.
The code is in place to be expanded with some very simple code. Just add a variable to set the object's skin count (so it knows how many skin file paths it recieved) to the setModel function, and it should work fine.
If you have any problems with adding that, just post them here. I really won't need multiple textures, so it's not something that I'm going to work on my own but if you get stuck just ask.
04/05/2002 (1:40 am)
Dang!I removed multi texture support since I couldn't think of a reason to use multiple textures in normal use. I forgot about vehicles!
Why exactly would you want to use vehicles with this control?
Well, the code directly refers to the first material (the default, and only skin texture in current player models) as array index in the material list of 0.
The code is in place to be expanded with some very simple code. Just add a variable to set the object's skin count (so it knows how many skin file paths it recieved) to the setModel function, and it should work fine.
If you have any problems with adding that, just post them here. I really won't need multiple textures, so it's not something that I'm going to work on my own but if you get stuck just ask.
#9
I'll try to add multitexture support myself...
just a quick question - how do I get the number of textures a specific model uses (object's skin count) out of the .dts file? Haven't done anything with skins yet...
Thanks for your help!
04/05/2002 (2:01 am)
Quote:Why exactly would you want to use vehicles with this control?Well, why NOT? ;-) It's just cool to view the different vehicles in the car mod (even if nodes - aka tires - aren't supported) and select the one you want (currently I have a car and two different tanks)...
I'll try to add multitexture support myself...
just a quick question - how do I get the number of textures a specific model uses (object's skin count) out of the .dts file? Haven't done anything with skins yet...
Thanks for your help!
#10
Try looking at guiPlayerView.cc that came with the engine. I removed the multiple texture support since I didn't see the need, but if that's what you want then your going to need to get the length of the material list.
04/05/2002 (2:30 am)
There is a way to get the length of the material list.Try looking at guiPlayerView.cc that came with the engine. I removed the multiple texture support since I didn't see the need, but if that's what you want then your going to need to get the length of the material list.
#11
Now, Con::printf("newName %d: %s", i, newName); is never reached, cause "replaced" seems to be "false"...
Do you have any idea, what this whole string concatenation stuff is supposed to do?? What is "base."? None of the textures has a "base." in its filename...
Also, what exactly is the use of $pref::usePrefSkins?
Thanks for any clearing thoughts...!
04/05/2002 (9:17 am)
Matt, it doesn't work... I took the original code out of Frank's guiObjectView.cc (which worked with my vehicles and their multiple textures) and put it into yours like that:// if we want standard skins...
if(mMode == 0 || mMode == 1)
{
// Set the skin:
if ( !mModel->ownMaterialList() )
mModel->cloneMaterialList();
TSMaterialList* materialList = mModel->getMaterialList();
for ( U32 i = 0; i < materialList->mMaterialNames.size(); i++ )
{
const char* name = materialList->mMaterialNames[i];
if ( !name )
continue;
const U32 len = dStrlen( name );
AssertFatal( len < 200, "GuiObjectView::setPlayerModel - Skin name exceeds maximum length!" );
if ( len < 6 )
continue;
Con::printf("name %d: %s", i, name);
const char* replace = dStrstr( name, "base." );
if ( !replace )
continue;
char newName[256];
dStrncpy( newName, name, replace - name );
newName[replace - name] = 0;
dStrcat( newName, skin );
dStrcat( newName, "." );
dStrcat( newName, replace + 5 );
Con::printf("newName %d: %s", i, newName);
TextureHandle test = TextureHandle( newName, MeshTexture, false );
if ( test.getGLName() )
materialList->mMaterials[i] = test;
else
materialList->mMaterials[i] = TextureHandle( name, MeshTexture, false );
}Now, Con::printf("newName %d: %s", i, newName); is never reached, cause "replaced" seems to be "false"...
Do you have any idea, what this whole string concatenation stuff is supposed to do?? What is "base."? None of the textures has a "base." in its filename...
Also, what exactly is the use of $pref::usePrefSkins?
Thanks for any clearing thoughts...!
#12
You really don't need most of that code.
There's the loop that will cycle through one time for every material in the model's default material list.
In a normal player's case, it's only one skin. In your vehicle, it's 2.
Actually... now that I See how I could do this, I'll just code it in and rerelease it.
It'll only require one more variable, and won't interfere with things that already have 1 skin.
I should have this done by Saturday night (24hrs)
04/05/2002 (2:21 pm)
The concatination stuff is from Tribes 2. The skin textures were in the format of: base.hmale.pngYou really don't need most of that code.
for ( U32 i = 0; i < materialList->mMaterialNames.size(); i++ )
There's the loop that will cycle through one time for every material in the model's default material list.
In a normal player's case, it's only one skin. In your vehicle, it's 2.
Actually... now that I See how I could do this, I'll just code it in and rerelease it.
It'll only require one more variable, and won't interfere with things that already have 1 skin.
I should have this done by Saturday night (24hrs)
#13
It just won't work for me with this loop, even if I strip out all the unnecessay T2 stuff... Nothing happens, no errors, ... :-(
04/09/2002 (2:22 am)
Hey Matt, any news on "multi-part skins"? Did you have a chance to try this?It just won't work for me with this loop, even if I strip out all the unnecessay T2 stuff... Nothing happens, no errors, ... :-(
#14
However this doesn't have anything to do with using multiple textures simultaneously on different parts of an object; AFAIK Matt is right about looping through the materials list to do that.
04/09/2002 (4:06 pm)
Stefan, you might want to check out the object skinning resource to see code for correctly dealing with those "base." format skin names (and why one might want to use names like that).However this doesn't have anything to do with using multiple textures simultaneously on different parts of an object; AFAIK Matt is right about looping through the materials list to do that.
#15
I'll try to take a look tonight, shouldn't be much more than a loop and one more variable.
04/09/2002 (4:10 pm)
Ack I forgot about this!I'll try to take a look tonight, shouldn't be much more than a loop and one more variable.
Torque 3D Owner Frank Bignone
Darkhand Studio