コード例 #1
0
    bool operator==(const ModelContainer& pMc1, const ModelContainer& pMc2)
    {
        bool result = false;
        if(pMc1.getNSubModel() == pMc2.getNSubModel() && pMc1.getAABoxBounds() == pMc2.getAABoxBounds())
        {
            if(pMc1.getNNodes() == pMc2.getNNodes() && pMc1.getNTriangles() == pMc2.getNTriangles() && pMc1.getBasePosition() == pMc2.getBasePosition())
            {
                result = true;
                for(unsigned int i=0; i<pMc2.getNSubModel(); ++i)
                {
                    SubModel sm1 = pMc2.getSubModel(i);
                    SubModel sm2 = pMc1.getSubModel(i);
                    result = (sm1 == sm2);
                    if(!result) break;
                }
                if(result)
                {
                    for(unsigned int i=0; i<pMc2.getNTriangles(); ++i)
                    {
                        TriangleBox t1=pMc2.getTriangle(i);
                        TriangleBox t2=pMc1.getTriangle(i);
                        result = (t1 == t2);
                        if(!result) break;
                    }
                }
                if(result)
                {
                    for(unsigned int i=0; i<pMc2.getNNodes(); ++i)
                    {
                        TreeNode tn1=pMc2.getTreeNode(i);
                        TreeNode tn2=pMc1.getTreeNode(i);
                        result = (tn1 == tn2);
                        if(!result) break;
                    }
                }
            }
        }

        return(result);
    }
コード例 #2
0
ファイル: VMapManager.cpp プロジェクト: AegisEmu/AegisEmu
    float MapTree::getIntersectionTime(const Ray& pRay, float pMaxDist, bool pStopAtFirstHit)
    {
        double  firstDistance = inf();

        const IT end = iTree->endRayIntersection();
        IT obj = iTree->beginRayIntersection(pRay, pMaxDist);

        for ( ;obj != end; ++obj)                           // (preincrement is *much* faster than postincrement!)
        {
            /*
            Call your accurate intersection test here.  It is guaranteed
            that the ray hits the bounding box of obj.  (*obj) has type T,
            so you can call methods directly using the "->" operator.
            */
            ModelContainer *model = (ModelContainer *) (*obj);

            float t = model->getIntersectionTime(pRay, pStopAtFirstHit, pMaxDist);

            // just for visual debugging with an external debug class
            #ifdef _DEBUG_VMAPS
            if(gCount3 == gCount1)
            {
                AABox testBox;
                testBox = model->getAABoxBounds();
                gBoxArray.append(testBox);
            }
            ++gCount3;
            #endif
            if(t > 0 && t < inf())
            {
                obj.markBreakNode();
                if(firstDistance > t && pMaxDist >= t)
                {
                    firstDistance = t;
                    if(pStopAtFirstHit) break;
                }
            }
        }
        return firstDistance;
    }
コード例 #3
0
ファイル: ModelContainer.cpp プロジェクト: artas/quademu
 //=================================================================
 void getBounds(const ModelContainer& pMc, G3D::AABox& pAABox)
 {
     pAABox = pMc.getAABoxBounds();
 }