Orbiter-Forum  

Go Back   Orbiter-Forum > Projects > ORBITER: 2010-P1 > Bug
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

GetDevMesh() and oapiMeshGroup() do not work together Issue Tools
issueid=972 07-19-2012 03:41 PM
Crazy about real time sims
GetDevMesh() and oapiMeshGroup() do not work together
GetDevMesh() and oapiMeshGroup() do not work together

As discussed in this thread : http://orbiter-forum.com/showthread.php?p=372076

I was looking for a way to get mesh group vertex data that works uniformly across all clients.


I tried this :

Code:
    VISHANDLE hvisCar = *oapiObjectVisualPtr (oapiGetObjectByName("GL-01"));

    if (hvisCar != NULL) {

        DEVMESHHANDLE hDevMsh = vCollider->GetDevMesh(hvisCar, 0);
        MESHGROUP* mshGrp =  oapiMeshGroup(hDevMsh, mGroupIndex);
        }
So hDevMsh is valid , but mshGrp is returned as NULL.

This works :

Code:
VISHANDLE hvisCar = *oapiObjectVisualPtr (oapiGetObjectByName("GL-01"));

    if (hvisCar != NULL) {

        //DEVMESHHANDLE hDevMsh = vCollider->GetDevMesh(hvisCar, 0);
        MESHHANDLE hDevMsh = vCollider->GetMesh(hvisCar, 0);
        MESHGROUP* mshGrp =  oapiMeshGroup(hDevMsh, mGroupIndex);

    }
GetDevMesh() output should work with oapiMeshGroup(() and this is supposed to be the device independent way...isnt it ?
Issue Details
Project ORBITER: 2010-P1
Status Unconfirmed
Priority 5 - Medium
Affected Version 111105
Fixed Version (none)
Users able to reproduce bug 0
Users unable to reproduce bug 0
Assigned Users (none)
Tags (none)

07-19-2012 04:45 PM
orb orb is offline
O-F Administrator
Ninja
 
I'm not sure a device dependent mesh will return a valid mesh group. It should be rather a device independent mesh (template) which will return valid mesh groups.
Reply
07-19-2012 05:40 PM
orb orb is offline
O-F Administrator
Ninja
 
Here's a quote from Orbiter Beta forum:
Quote:
Originally Posted by martins
 Functions that operate on a DEVMESHHANDLE are not entirely analogous to those acting on MESHHANDLES. For example, oapiMeshGroup is not implemented for DEVMESHHANDLEs, because orbiter doesn't know where and in what format mesh groups are stored (or even if the meshes are organised in groups by the client). Therefore, oapiMeshGroup is deprecated. It still works with the inline client, but not with external clients.
For reference, it was also quoted in this issue report.
Reply
07-27-2012 03:21 AM
Crazy about real time sims
 
ok, so how then do I get the vertices for a mesh group in my plugin and expect it to run across all clients ?

Here is what I do currently :

Code:
double xMin = DBL_MAX, xMax = -DBL_MAX, yMin = DBL_MAX, yMax = -DBL_MAX, zMin = DBL_MAX, zMax = -DBL_MAX;


    // Print out the vertices

    VISHANDLE hvisCar = *oapiObjectVisualPtr (oapiGetObjectByName("GL-01"));

    if (hvisCar != NULL) {

        //DEVMESHHANDLE hDevMsh = vCollider->GetDevMesh(hvisCar, 0); //TODO This should be made to work, GetMesh() crashes with clients
        MESHHANDLE hDevMsh = vCollider->GetMesh(hvisCar, 0);

        for (int i = 0; i < NUM_WHEELS; i++) {
            MESHGROUP* mshGrp =  oapiMeshGroup(hDevMsh, mWheelMeshGroupIndex[i]);

            for (unsigned int j = 0; j < mshGrp->nVtx; j++ ) {
                /*oapiWriteLogV("Vertex : %3d : (%f, %f, %f)", j,
                        mshGrp->Vtx[j].x, mshGrp->Vtx[j].y, mshGrp->Vtx[j].z );*/

                if (mshGrp->Vtx[j].x < xMin)
                    xMin = mshGrp->Vtx[j].x;
                if (mshGrp->Vtx[j].x > xMax)
                    xMax = mshGrp->Vtx[j].x;

                if (mshGrp->Vtx[j].y < yMin)
                    yMin = mshGrp->Vtx[j].y;
                if (mshGrp->Vtx[j].y > yMax)
                    yMax = mshGrp->Vtx[j].y;

                if (mshGrp->Vtx[j].z < zMin)
                    zMin = mshGrp->Vtx[j].z;
                if (mshGrp->Vtx[j].z > zMax)
                    zMax = mshGrp->Vtx[j].z;

            }

            mWheelMeshGroupCenter[i] = _V((xMax + xMin)/2, (yMax + yMin)/2, (zMax + zMin)/2);

            oapiWriteLogV("Center of mesh group %d is at (%f, %f, %f) wrt vessel",
                    mWheelMeshGroupIndex[i], V3ARGS(mWheelMeshGroupCenter[i]));
        }

    }
Reply
07-29-2012 12:39 AM
Orbiter Founder
 
For modifying the group, you can use oapiEditMeshGroup, which calls the client's clbkEditMeshGroup method.

Note that this is less efficient than oapiMeshGroup, since the modified vertices need to be copied, but that can't be helped.

For obtaining the mesh group, can't you query the device-independent template instead?
Reply
Reply

Issue Tools
Subscribe to this issue

All times are GMT. The time now is 07:43 AM.

Quick Links Need Help?


About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2007 - 2012, Orbiter-Forum.com. All rights reserved.