1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        DirectXMesh幾何處理庫(kù)

        聯(lián)合創(chuàng)作 · 2023-09-29 17:03

        DirectXMesh 是微軟開發(fā)的 DirectX 的幾何處理庫(kù)。

        示例代碼:

        std::unique_ptr<WaveFrontReader<uint16_t>> mesh( new WaveFrontReader<uint16_t>() );
        
        if ( FAILED( mesh->Load( L"test.obj" ) ) )
          // Error
        
        if ( mesh->hasNormals )
           // Skip next computation
        
        size_t nFaces = mesh->indices.size() / 3;
        size_t nVerts = mesh->vertices.size();
        
        std::unique_ptr<XMFLOAT3[]> pos( new XMFLOAT3[ nVerts ] );
        for( size_t j = 0; j < nVerts; ++j )
          pos[ j ] = mesh->vertices[ j ].position;
        
        std::unique_ptr<XMFLOAT3[]> normals( new XMFLOAT3[ nVerts ] );
        if ( FAILED( ComputeNormals( &mesh->indices.front(), nFaces, pos.get(), nVerts, CNORM_DEFAULT, normals.get() ) ) )
          // Error
        
        if ( !mesh->hasTexcoords )
          // Skip next computation
        
        std::unique_ptr<XMFLOAT2[]> texcoords( new XMFLOAT2[ nVerts ] );
        for( size_t j = 0; j < nVerts; ++j )
          texcoords[ j ] = mesh->vertices[ j ].textureCoordinate;
        
        std::unique_ptr<XMFLOAT3[]> tangents( new XMFLOAT3[ nVerts ] );
        std::unique_ptr<XMFLOAT3[]> bitangents( new XMFLOAT3[ nVerts ] );
        
        if ( FAILED( ComputeTangentFrame( &mesh->indices.front(), nFaces,
                                         pos.get(), normals.get(), texcoords.get(), nVerts,
                                         tangents.get(), bitangents.get() ) ) )
          // Error
        瀏覽 20
        點(diǎn)贊
        評(píng)論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)
        評(píng)論
        圖片
        表情
        推薦
        點(diǎn)贊
        評(píng)論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            国产午夜av | 无码秘 人妻一区红中av | 岳要我添她下面 | AV免费小说 | 师生恋h好深好紧好湿 | 操屄爽毛片 | 亚洲精品久久久久久久久久久 | 黄色操逼电影 | 翔田千里无码在线 | 丁香久久婷婷 |