About Store Forum Documentation Contact



Post Reply 
Mesh rendering in a viewport
Author Message
Qbound Offline
Member

Post: #1
Mesh rendering in a viewport
Hi all,

i created a class for my states like (menu, running, intro etc)
and i use a factory for my objects like (items, chars etc)

when i try to render my selected char in my viewport where the player selects his wanted char for the game (like the menu in RPG2) then i have a problem to render the character or better said the meshes.

The mesh is successfully loaded (checked witht the boolean from load) thereafter the skeleton is loaded.

Code:
    // Load the Mesh
    if( m_MeshBase.load( _strMesh.c_str() ) )
    {
        // We found the mesh now load the bones
        m_cSkeleton.create(_strSkel.c_str(),1.8);

    }

while doing the update the position from the skeleton is set to the wanted position (0,0,0) and just for the test i used MatrixIdentity.

Code:
    m_cSkeleton.clear  ().updateMatrix(Matrix().setRotateY(PI).move(Vec( 0.0,0,0)));

the rendering is a little different to normal.

The state_manager calles the rendering of the state this calles the static viewport_render() method of my class. there in i can do anything i want.

Code:
void CGAME_OBJECT_CHARACTER::Render( void )
{
    // Render the blended things Matrix().setPos(Vec(m_sDB_OBJECT.fPosition_X, m_sDB_OBJECT.fPosition_Y, m_sDB_OBJECT.fPosition_Z))
    switch(Renderer())
    {
    case RM_PREPARE:    
        m_MeshBase.draw( m_cSkeleton );
        break;
    case RM_BLEND  :
    case RM_PALETTE:    break;
    }

    //m_MeshBase.draw( MatrixIdentity );

    m_MeshBase.setRender().setBox();

    // Render a box
    Box( 0.5f ,Vec(0,0,0)).draw( RED );
    Box( 1.0,Vec(m_sDB_OBJECT.fPosition_X, m_sDB_OBJECT.fPosition_Y, m_sDB_OBJECT.fPosition_Z)).draw(GREEN_DARK);
    Box( 1.5,Vec(m_sDB_OBJECT.fPosition_X, m_sDB_OBJECT.fPosition_Y, m_sDB_OBJECT.fPosition_Z)).draw(GREEN_LIGHT);
    Box( 2.0,Vec(m_sDB_OBJECT.fPosition_X, m_sDB_OBJECT.fPosition_Y, m_sDB_OBJECT.fPosition_Z)).draw(GREEN_LIGHT2);

}

the RM_PREPARE was called and the boxes for debug are rendered.

here is a screenshot.

any hints for me?

cu
Oliver


Attached File(s) Image(s)
   
08-25-2010 04:43 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: Mesh rendering in a viewport
could you specify what's exactly the problem?
08-25-2010 08:34 PM
Find all posts by this user Quote this message in a reply
Qbound Offline
Member

Post: #3
RE: Mesh rendering in a viewport
i can not display the mesh in the area of the boxes which i have loaded.

I thought if i can render the boxes i can render everything.

The mesh is successfully loaded (it is the warrior).

if i use the following
Code:
switch(Renderer())
    {
    case RM_PREPARE:    
        //m_MeshBase.draw( MatrixIdentity );
        Meshs("Obj/character/warrior/body.mesh")->draw( MatrixIdentity );
        break;
    case RM_BLEND  :
    case RM_PALETTE: break;
    }
then the mesh is rendered in the viewport. I looked into the headers and 'Meshs' is a type of extern Cache<Mesh>; so what is the difference between those two?

m_MeshBase is a Mesh.

any idea?

cu
Oliver
08-25-2010 10:25 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #4
RE: Mesh rendering in a viewport
Meshes( );


Meshes("Obj/chr/Barbarian_meshskels/Barbarian.mesh" )->draw(NewGame.cskel[1]);
08-25-2010 10:28 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #5
RE: Mesh rendering in a viewport
so m_MeshBase doesn't display but Meshs does?
maybe you delete m_MeshBase somewhere,
you can check m_MeshBase with debugging during rendering, if it has meshlods, and mesh parts
08-25-2010 10:34 PM
Find all posts by this user Quote this message in a reply
Qbound Offline
Member

Post: #6
RE: Mesh rendering in a viewport
Hi,

many thanks for the tipp with the lods and parts. that brought me on the right track smile

One Question about the meshes. if i create 10 times the same mesh with
Mesh.create( "new_awesome_hero.mesh" ); then internally only 1 mesh is loaded and the others are only references?

here is a little screen.

thanks
Oliver


Attached File(s) Image(s)
   
08-26-2010 06:40 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #7
RE: Mesh rendering in a viewport
there is no such function : Mesh.create( "new_awesome_hero.mesh" );
08-26-2010 10:35 PM
Find all posts by this user Quote this message in a reply
Qbound Offline
Member

Post: #8
RE: Mesh rendering in a viewport
Hi,

sorry for the fault function.. (a brainmix)

now my question:
if i LOAD a mesh file like this:
Code:
// Load the Mesh
    if( m_MeshBase.load( _strMesh.c_str() ) )
    {
        // We found the mesh now load the bones
        m_cSkeleton.create(_strSkel.c_str(),1.8);

    }

And i load this mesh (hero.mesh) 10 times, then internally the mesh is 1 time loaded and 9 times as a reference... correct?

thanks
Oliver
08-27-2010 02:38 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #9
RE: Mesh rendering in a viewport
Yes, the cache in EE is loading all meshes just once. This is because the render is way faster then loading 10x the same mesh and render them individually . So which means if you edit the hero and you have loaded him twice that the edit is performed on both hero's(1 mesh the other 1 is reference).

There is always evil somewhere, you just have to look for it properly.
08-27-2010 04:23 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Qbound Offline
Member

Post: #10
RE: Mesh rendering in a viewport
thanks for the answer smile

cu
Oliver
08-27-2010 09:40 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #11
RE: Mesh rendering in a viewport
if( m_MeshBase.load( _strMesh.c_str() ) )
this will always reload the mesh (this does not use Meshes cache)

caching is done by:
MeshPtr and Mesh* and Meshes
08-29-2010 01:44 PM
Find all posts by this user Quote this message in a reply
Post Reply