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


C++ CalBone::getBoundingBox方法代码示例

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


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

示例1:

void CCal3DSceneNode::render()
{
    if ( bInitialized )
    {
      irr::video::IVideoDriver* driver = SceneManager->getVideoDriver(); 


      driver->setTransform( irr::video::ETS_WORLD, AbsoluteTransformation ); 


      irr::video::S3DVertex tmp; 
      irr::scene::SMeshBuffer mb; 

      unsigned char meshColor[4]; // r g b a 


      // get the renderer of the model 
      CalRenderer* pCalRenderer; 
      pCalRenderer = m_calModel->getRenderer(); 
      pCalRenderer->setNormalization( true ); 

      if ( this->DebugDataVisible )
      {
        irr::video::SMaterial mat; 
        mat.Wireframe = false; 
        mat.Lighting = false; 
        driver->setMaterial( mat ); 
        driver->draw3DBox( Box ); 

        CalSkeleton* pCalSkeleton = m_calModel->getSkeleton(); 
        pCalSkeleton->calculateBoundingBoxes(); 
        std::vector<CalBone*>& vectorCoreBone = pCalSkeleton->getVectorBone(); 
        irr::core::aabbox3df b; 
        CalVector p[8]; 
        Vector3 v[8]; 


        for ( size_t boneId = 0; boneId < vectorCoreBone.size(); ++boneId )
        {
          CalBone* bone = vectorCoreBone[boneId]; 
          CalBoundingBox& calBoundingBox = bone->getBoundingBox(); 
          calBoundingBox.computePoints( p ); 

          for ( int i = 0; i < 8; ++i )
          {
            v[i].set( p[i].x, p[i].y, p[i].z );
          } 

          driver->setMaterial( mat ); 
          // draw the box 
          driver->draw3DLine( v[0], v[1], irr::video::SColor( 255, 0, 0, 255 ) ); 
          driver->draw3DLine( v[0], v[2], irr::video::SColor( 255, 0, 0, 255 ) ); 
          driver->draw3DLine( v[1], v[3], irr::video::SColor( 255, 0, 0, 255 ) ); 
          driver->draw3DLine( v[2], v[3], irr::video::SColor( 255, 0, 0, 255 ) ); 
          driver->draw3DLine( v[4], v[5], irr::video::SColor( 255, 0, 0, 255 ) ); 
          driver->draw3DLine( v[4], v[6], irr::video::SColor( 255, 0, 0, 255 ) ); 
          driver->draw3DLine( v[5], v[7], irr::video::SColor( 255, 0, 0, 255 ) ); 
          driver->draw3DLine( v[6], v[7], irr::video::SColor( 255, 0, 0, 255 ) ); 
          driver->draw3DLine( v[0], v[4], irr::video::SColor( 255, 0, 0, 255 ) ); 
          driver->draw3DLine( v[1], v[5], irr::video::SColor( 255, 0, 0, 255 ) ); 
          driver->draw3DLine( v[2], v[6], irr::video::SColor( 255, 0, 0, 255 ) ); 
          driver->draw3DLine( v[3], v[7], irr::video::SColor( 255, 0, 0, 255 ) ); 
          //printf("F: %f\n", v[0].X);
        }
      } 


      // begin the rendering loop 
      if ( pCalRenderer->beginRendering() )
      {
        // get the number of meshes 
        int meshCount; 
        meshCount = pCalRenderer->getMeshCount(); 

        // render all meshes of the model 
        int meshId; 
        for ( meshId = 0; meshId < meshCount; meshId++ )
        {
          // get the number of submeshes 
          int submeshCount; 
          submeshCount = pCalRenderer->getSubmeshCount( meshId ); 

          // render all submeshes of the mesh 
          int submeshId; 
          for ( submeshId = 0; submeshId < submeshCount; submeshId++ )
          {
            // select mesh and submesh for further data access 
            if ( pCalRenderer->selectMeshSubmesh( meshId, submeshId ) )
            {
              // set the material ambient color 
              pCalRenderer->getAmbientColor( &meshColor[0] ); 
              material.AmbientColor.set( meshColor[3], meshColor[0], meshColor[1], meshColor[2] ); 

              // set the material diffuse color 
              pCalRenderer->getDiffuseColor( &meshColor[0] ); 
              material.DiffuseColor.set( meshColor[3], meshColor[0], meshColor[1], meshColor[2] ); 

              // set the material specular color 
              pCalRenderer->getSpecularColor( &meshColor[0] ); 
              material.SpecularColor.set( meshColor[3], meshColor[0], meshColor[1], meshColor[2] ); 
//.........这里部分代码省略.........
开发者ID:master4523,项目名称:crimsonglory,代码行数:101,代码来源:CCal3dSceneNode.cpp


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