Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: collada model and positions

  1. #11
    i post the code:
    this is the render loop:
    I draw only 2 meshes of the 200 meshes vector m_AllMeshes
    Code :
    for(itMesh = m_AllMeshes.begin();itMesh != m_AllMeshes.end();itMesh++)
    		{
    			Device->SetMaterial(&mtrl);
    			CMeshBase* pmesh=((CMeshBase*)*itMesh);
    			if(pmesh->getName().find("F430-mesh")!=string::npos )
    			{
    				vRotationAxis->x = 0.57735f;
    				vRotationAxis->y = 0.57735f;	
    				vRotationAxis->z = 0.57735f;
     
    				matr->LoadIdentity();
    				matr->RotateAxis(vRotationAxis,-240);
    				matr->Translate(0.642309f,-0.1489442f,0.442514f);
     
     
    				matr->Push();
     
    				Device->SetTransform(D3DTS_WORLDMATRIX(0), matr->GetTop());
    				pmesh->mesh->DrawSubset(0);
    			}
    			if(pmesh->getName().find("B-floor-mesh")!=string::npos)
    			{
     
     
    				matr->LoadIdentity();
    				matr->RotateAxis(vRotationAxis,-240);
    				matr->Translate(0.234062f, -1.04631f,0.148801f);
     
     
    				matr->Push();
     
    				Device->SetTransform(D3DTS_WORLDMATRIX(0), matr->GetTop());
    				pmesh->mesh->DrawSubset(0);
     
    			}
    		}
    I call loadidentity before apply the transform and the rotation result is ok ,but there is an error in the location of the 2 meshes
    i already test that the values of the translate is correct.
    I must use translate or translatelocal?
    thanks.

  2. #12
    I'm read somewere that in collada in directx i must invert the z coordintate of translation, from Lhc to rhc.
    is true?
    thanks.

  3. #13
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771
    Quote Originally Posted by giugio
    But I have a collada file with 200 meshes and i would render only 3 meshes, and i ask you if these meshes are "linked" or indipendent.
    Linked if i must apply all the 200 transformation and render all 200 meshes or indipendent if i can apply only the 3 transformation of the 3 meshes nodes.
    Thanks.
    COLLADA nodes are local coordinate systems that are hierarchical when representing a transformation stack. The composition of the hierarchical transforms from the root node to a given node represents the placement of geometry that is instantiated in that node's space. In your example the geometry with id of "Cylinder12-mesh" is in that space. This composition is repeated for each instantiation.

    So depending on what you mean by your question, probably I will answer "independent".

  4. #14
    Senior Member
    Join Date
    Aug 2004
    Location
    California
    Posts
    771
    Quote Originally Posted by giugio
    I'm read somewere that in collada in directx i must invert the z coordintate of translation, from Lhc to rhc.
    is true?
    thanks.
    COLLADA is 'Rhc" (like OpenGL). DirectX is normally "Lhc" but supports RH functions too (see D3DXMatrixPerspectiveRH). I think this explanation about Direct3D Coordinate Systems from Microsoft will help you understand what approach you will want to take.

  5. #15

    Re: collada model and positions

    1)I think that i find the error:
    The vectors that collada use for the transform in the scene node must be flipped!
    I'm flip the indexes 2 with 3 when import the meshes and i think that i must flip the y with the z in the vector, may be?

    for example:
    this are two collada position vector:

    <translate>0.642309 -0.148944 0.442514</translate>
    <rotate>0.57735 0.57735 0.57735 -240</rotate>
    i trasform the world coord for those vectors.
    how i flip the values?
    I must change also the sign?

    2)i must use the rh functions(D3DXMatrixPerspectiveRH ecc..)?

    3)i mustip the signs in the view matrix?
    i do so:
    Code :
    	D3DXMatrixLookAtLH(
    		&V,
    		&pos,
    		&target,
    		&up);
     
    	D3DXMATRIX V1,result;
    	Device->SetTransform(D3DTS_VIEW, &V);
     
    	Device->GetTransform( D3DTS_VIEW ,&V1);
    	V1._31=-V1._31;
    	V1._32=-V1._32;
    	V1._33=-V1._33;
    	V1._34=-V1._34;
    	Device->SetTransform( D3DTS_VIEW ,&V1);
    is correct .
    Thanks in advance

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •