当前位置: 首页>>代码示例>>C++>>正文


C++ ModelContainer类代码示例

本文整理汇总了C++中ModelContainer的典型用法代码示例。如果您正苦于以下问题:C++ ModelContainer类的具体用法?C++ ModelContainer怎么用?C++ ModelContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ModelContainer类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ffll_load_fcl_file

int WIN_FFLL_API ffll_load_fcl_file(int model_idx, const char* file)
{
	ModelContainer* container = get_model(model_idx);

	// we have a pointer to the container, so any modifications we
	// make will be in the list. If we used the [] operator here,
	// we'd get a COPY of the model and any changes wouldn't be permanent.

	// perform initialization
	container->init();

	// load the FCL file passed in
	if (container->model->load_from_fcl_file(file))
 		return -1;

	return model_idx;

}; // end ffll_load_fcl_file()
开发者ID:firememory,项目名称:dfwbi,代码行数:18,代码来源:FFLLAPI.cpp

示例2: inf

    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;
    }
开发者ID:AegisEmu,项目名称:AegisEmu,代码行数:40,代码来源:VMapManager.cpp

示例3: Vector3

	bool MapTree::isOutDoors(const Vector3& pos)
	{
		Vector3 dir = Vector3(0,-1,0);
		Ray ray = Ray::fromOriginAndDirection(pos, dir);   // direction with length of 1
		unsigned int flags;

		AABSPTree<ModelContainer*>::RayIntersectionIterator MITR;
		AABSPTree<ModelContainer*>::RayIntersectionIterator MITREND;
		RayIntersectionIterator<TreeNode, SubModel> SMITR;
		RayIntersectionIterator<TreeNode, SubModel> SMITREND;
		ModelContainer * mc;
		SubModel * sm;

		MITR = iTree->beginRayIntersection( ray, MAX_CAN_FALL_DISTANCE );
		MITREND = iTree->endRayIntersection();

		for(; MITR != MITREND; ++MITR)
		{
			mc = ((ModelContainer*)*MITR);
			
			Ray relativeRay = Ray::fromOriginAndDirection(ray.origin - mc->getBasePosition(), ray.direction);
			SMITR = mc->beginRayIntersection( relativeRay, MAX_CAN_FALL_DISTANCE );
			SMITREND = mc->endRayIntersection();

			for( ; SMITR != SMITREND; ++SMITR )
			{
				sm = ((SubModel*)&(*SMITR));
#if 0
				if( sm->getIndoorFlag() != 0 )
				{
					unsigned int i = sm->getIndoorFlag();
					printf("=========================================================\n");
					printf("Model indoor flags: %u\n", sm->getIndoorFlag());
					unsigned int z, b;
					for(z = 1, b = 1; b < 32;)
					{
						if(i & z)
							printf("   Bit %u (0x%.8X or %u) is set!\n", b, z, z);

						z <<= 1;
						b+=1;
					}
					printf("=========================================================\n");
				}
#else
				flags = sm->getIndoorFlag();
				if( flags != 0 )
				{
					/* From WoWdev:
					 Flag 	 Meaning
					0x1 	Always set
					0x4 	Has vertex colors (MOCV chunk)
					0x8 	Outdoor
					0x200 	Has lights (MOLR chunk)
					0x800 	Has doodads (MODR chunk)
					0x1000 	Has water (MLIQ chunk)
					0x2000 	Indoor
					0x40000 	Show skybox

					**********************

					0x8000 seems to be set in the areas in citys (while it has the indoor flag, its not
					an indoor area

					*/

					if( !(flags & 0x8) )
						return false;
				}
#endif
			}
		}

		return true;
	}
开发者ID:AegisEmu,项目名称:AegisEmu,代码行数:75,代码来源:VMapManager.cpp

示例4: getBounds

 //=================================================================
 void getBounds(const ModelContainer& pMc, G3D::AABox& pAABox)
 {
     pAABox = pMc.getAABoxBounds();
 }
开发者ID:artas,项目名称:quademu,代码行数:5,代码来源:ModelContainer.cpp

示例5: hashCode

 /**
 Functions to use ModelContainer with a AABSPTree
 */
 size_t hashCode(const ModelContainer& pMc)
 {
     return (pMc.getBasePosition() * pMc.getNTriangles()).hashCode();
 }
开发者ID:artas,项目名称:quademu,代码行数:7,代码来源:ModelContainer.cpp

示例6: return

    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);
    }
开发者ID:Ballwinkle,项目名称:Ascent_NG,代码行数:40,代码来源:ModelContainer.cpp


注:本文中的ModelContainer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。