几何处理库 DirectXMesh

码农软件 · 软件分类 · 图形/图像处理 · 2019-09-06 18:57:32

软件介绍

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

本文地址:https://codercto.com/soft/d/14024.html

Hadoop: The Definitive Guide

Hadoop: The Definitive Guide

Tom White / O'Reilly Media, Inc. / 2009 / 44.99

Apache Hadoop is ideal for organizations with a growing need to store and process massive application datasets. Hadoop: The Definitive Guide is a comprehensive resource for using Hadoop to build relia......一起来看看 《Hadoop: The Definitive Guide》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试