DirectXMesh 几何处理库

程序名称:DirectXMesh

授权协议: MIT

操作系统: Windows

开发语言: C/C++

DirectXMesh 介绍

DirectXMesh 是微软开发的 DirectX 的几何处理库。

示例代码:

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

DirectXMesh 官网

https://github.com/Microsoft/DirectXMesh

相关编程语言

BlazeDS 是一个基于服务器的Java 远程控制(remoting...
OVal 是一个可扩展的Java对象数据验证框架,验证的规...
Volta 是一套开发工具,专为开发分布式、实时系统应...
OpenDDS 是一个开源的 C++ 实现的 对象管理组织 OMG...
JADE (Java Agent DEvelopment Framework) 是一个完...
FastMM ,在D2006和2007中已代替了原来的内存管理器。