About Store Forum Documentation Contact



Post Reply 
Hiding mesh parts
Author Message
Aniketos Offline
Member

Post: #1
Hiding mesh parts
I noticed there is an option to hide a mesh part but what I also noticed is that it hides it on all models (that are same mesh) not just the model you specified. Now it would really be handy with armors and such to be able to hide a part of the mesh and then just put the armor in position.

Is there a walk around for this or some other solution?

EDIT: Maybe something like loading Player models separably not via resource manager so that they are not the same as Chr's ? Not sure if we can access the resource manager though...
(This post was last modified: 12-12-2010 04:48 AM by Aniketos.)
12-12-2010 04:44 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #2
RE: Hiding mesh parts
You have to hide it, then draw it, and then show it once again. Example code.

There are some tutorials on this. I believe one is called "Armor Rendering".
12-12-2010 09:04 AM
Find all posts by this user Quote this message in a reply
Aniketos Offline
Member

Post: #3
RE: Hiding mesh parts
[quote][quote='Driklyn' pid='18923' dateline='1292141056']
You have to hide it, then draw it, and then show it once again. Example code.

There are some tutorials on this. I believe one is called "Armor Rendering".
[/quote]

Tried it with my current code and it didn't work. It might be because the meshes are being loaded differently from example in armor rendering tutorial.

Instead of creating separate mesh parts etc I have a mesh file with mesh parts backed in already. Because the model is made up of separate parts in max I just only had to rename the parts via mesh editor to lets say tshirt, pants, head etc. I didn't really have the option to save it separably.

In the tutorial from what I understood the meshes boots, pants, gauntlets en main mesh are loaded in separably and then you can just most likely stop drawing one mesh?

However I want to do it with one whole mesh, I tried adding a bool to chr (npcs) and player which was true for players and false for npcs. But it didn't really work. I might be missing something... added the code below with screenshot.

Also I'm not creating players npcs etc code wise i'm getting them off the world like in other tutorials.

[img]     [/img]

[Quote]

// create the world
Game::World.init()
.setObjType(Statics,OBJ_STATIC )
.setObjType(Chrs ,OBJ_CHR )
.setObjType(Players,OBJ_PLAYER )
.setObjType(Items ,OBJ_ITEM )
.New ("world/testworld.world");

void Player::Draw()
{
if(hide_shirt == true)
{
mesh->hide("shirt");
}

__super::Draw(); // call default drawing

if(hide_shirt == false)
{
mesh->draw(cskel);
//mesh->show("shirt"); //Also tried this it didn't work
}
}
[/quote]
12-12-2010 05:59 PM
Visit this user's website Find all posts by this user Quote this message in a reply
menajev Offline
Member

Post: #4
RE: Hiding mesh parts
Look at Bloody Massacre source. Main chr is a parted mesh and his head is not draw.
12-12-2010 07:42 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #5
RE: Hiding mesh parts
Try something like this:

Code:
UInt Player::drawPrepare()
{
    if (hide_shirt) mesh->hide("shirt");
    UInt modes = __super::drawPrepare();

    if (hide_shirt) mesh->show("shirt");
    return modes;
}
12-12-2010 08:22 PM
Find all posts by this user Quote this message in a reply
Aniketos Offline
Member

Post: #6
RE: Hiding mesh parts
Thanks it works now. I think the key here was that it had to be done in drawPrepare().
12-12-2010 09:08 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply