1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
|
// basé sur le code : http://www.gamedev.net/community/forums/mod/journal/journal.asp?jn=316777&reply_id=2747161
// Desc:convertit un ID3DXMesh (DX9) en ID3DX10Mesh (DX10)
//-----------------------------
#include "DXUT.h"
#include <windows.h>
#include <atlbase.h> // pour COM
#include <strsafe.h>
#pragma warning( disable: 4996 ) // pas d'avertissements de fonctions obosolètes
// include entêtes D3D10
//--------------------------
#include <d3d10.h>
#include <d3dx10.h>
#include <d3dx9.h>
// macros
#define WIDEN( w ) WIDEN2( w )
#define WIDEN2( w ) L ##w
#define INFO_OUT( text ) OutputDebugString( L"(INFO) : " WIDEN( __FUNCTION__ ) L"() - " text L"\n" )
#define ERR_OUT( text ) OutputDebugString( L"(ERROR) : " WIDEN( __FUNCTION__ ) L"() - " text L"\n" )
#define WARN_OUT( text ) OutputDebugString( L"(WARNING) : " WIDEN( __FUNCTION__ ) L"() - " text L"\n" )
#ifndef SAFE_RELEASE
#define SAFE_RELEASE( p ) {if(p){(p)->Release();(p)=NULL;}}
#endif
#ifndef SAFE_DELETE
#define SAFE_DELETE( p ) {if(p){delete(p);(p)=NULL;}}
#endif
#ifndef SAFE_DELETE_ARRAY
#define SAFE_DELETE_ARRAY( p ) {if(p){delete[](p);(p)=NULL;}}
#endif
void ComputeSizeAsString( WCHAR *wc, UINT wcLen, SIZE_T bytes );
#include "MeshDX9ToDX10.h"
namespace MeshConvert
{
HRESULT ConvertDeclaration( const D3DVERTEXELEMENT9 original[ MAX_FVF_DECL_SIZE ],
D3D10_INPUT_ELEMENT_DESC output[ MAX_FVF_DECL_SIZE ] );
LPCSTR ConvertSemantic( const D3DDECLUSAGE& d3d9Form );
DXGI_FORMAT ConvertDeclType( const D3DDECLTYPE& d3d9Form );
HRESULT CopyIndexBufferData( ID3DXMesh* pMesh9, ID3DX10Mesh* pMesh10 );
HRESULT CopyVertexBufferData( ID3DXMesh* pMesh9, ID3DX10Mesh* pMesh10 );
HRESULT ConfigureAttributeTable( ID3DXMesh* pMesh9, ID3DX10Mesh* pMesh10 );
//-----------------------------------------------------------------------------
// Nom: CreateD3DX10MeshFromD3DX9Mesh()
// Desc: créé un mesh DX10 depuis un mesh DX9, copie et convertit les infos du mesh DX9 vers un mesh DX10
// convertit déclaration, et sémantique des buffer, table d'attributs, copie vertex et index buffer
//-----------------------------------------------------------------------------
HRESULT CreateD3DX10MeshFromD3DX9Mesh( ID3DXMesh* pInMeshDX9, ID3DX10Mesh** pOutMesh10, ID3D10Device *pDevice )
{
// Check the parameters
if( (NULL == pInMeshDX9) || (NULL == pDevice) )
{
ERR_OUT( L"ERREUR !!! CreateD3DX10MeshFromD3DX9Mesh() un ou plusieurs paramètres sont NULL" );
return E_INVALIDARG;
}
// acquiert déclaration du mesh DX9
D3DVERTEXELEMENT9 OriginalDeclaration[ MAX_FVF_DECL_SIZE ];
if( FAILED( pInMeshDX9->GetDeclaration( OriginalDeclaration ) ) )
{
ERR_OUT( L"ERREUR !!! CreateD3DX10MeshFromD3DX9Mesh() ne peut obtenir la déclaration du mesh DX9" );
return E_FAIL;
}
else
INFO_OUT( L"CreateD3DX10MeshFromD3DX9Mesh() acquisition déclaration mesh D3DX9 OK" );
// convertit la déclaration du vertex buffer
D3D10_INPUT_ELEMENT_DESC NewDeclaration[ MAX_FVF_DECL_SIZE ];
ZeroMemory( NewDeclaration, sizeof( NewDeclaration ) );
if( FAILED( ConvertDeclaration( OriginalDeclaration, NewDeclaration ) ) )
{
ERR_OUT( L"ERREUR !!! CreateD3DX10MeshFromD3DX9Mesh() ne peut convertir la déclaration D3D9 en déclaration D3D10" );
return E_FAIL;
}
else
INFO_OUT( L"CreateD3DX10MeshFromD3DX9Mesh() conversion déclaration mesh D3DX9 OK" );
// calcule le nombre d'élements dans la déclaration DX9
UINT DeclSize = D3DXGetDeclLength( OriginalDeclaration );
// convertit les mesh options
UINT NewOptions = 0;
if( 0 != (pInMeshDX9->GetOptions() & D3DXMESH_32BIT) ) // indice en 32 bits, si ils ne le sont pas
NewOptions = D3DX10_MESH_32_BIT;
// créé le DX10 Mesh
if( FAILED( D3DX10CreateMesh(
pDevice,
NewDeclaration,
DeclSize,
"POSITION",
pInMeshDX9->GetNumVertices(),
pInMeshDX9->GetNumFaces(),
NewOptions,
pOutMesh10
) ) )
{
ERR_OUT( L"ERREUR !!! CreateD3DX10MeshFromD3DX9Mesh() ne peut créér le ID3DX10Mesh object!" );
return E_FAIL;
}
else
{
INFO_OUT( L"CreateD3DX10MeshFromD3DX9Mesh(): Création D3DX10 mesh basé sur l'input du mesh DX9 OK" );
WCHAR wcMeshInfo[512];
StringCchPrintf( wcMeshInfo, 512, L"(INFO) : D3DX10 mesh nb vertices: %d nb faces: %d \n",
(*pOutMesh10)->GetVertexCount(),
(*pOutMesh10)->GetFaceCount()
);
OutputDebugString( wcMeshInfo );
}
// copie mesh data D3D9 vers le mesh D3D10
if( FAILED( CopyIndexBufferData( pInMeshDX9, *pOutMesh10 ) ) )
{
ERR_OUT( L"ERREUR !!! CreateD3DX10MeshFromD3DX9Mesh() copie index buffer D3X9 mesh vers D3DX10 mesh." );
return E_FAIL;
}
else
INFO_OUT( L"CreateD3DX10MeshFromD3DX9Mesh() CopyIndexBufferData() mesh DX9 -> mesh DX10 OK" );
if( FAILED( CopyVertexBufferData( pInMeshDX9, *pOutMesh10 ) ) )
{
ERR_OUT( L"ERREUR CreateD3DX10MeshFromD3DX9Mesh() copie vertex vertex buffer de D3DX9 mesh vers D3DX10 mesh échoué" );
return E_FAIL;
}
else
INFO_OUT( L"CreateD3DX10MeshFromD3DX9Mesh() CopyVertexBufferData() mesh DX9 -> mesh DX10 OK" );
// table d'attributs
if( FAILED( ConfigureAttributeTable( pInMeshDX9, *pOutMesh10 ) ) )
{
ERR_OUT( L"ERREUR !!! CreateD3DX10MeshFromD3DX9Mesh() configuration table d'attributs pour le nouveau mesh DX10 échouée" );
return E_FAIL;
}
else
INFO_OUT( L"CreateD3DX10MeshFromD3DX9Mesh() ConfigureAttributeTable() mesh DX9 -> mesh DX10 OK" );
// génére la table d'adjacence
if( FAILED( (*pOutMesh10)->GenerateAdjacencyAndPointReps( 0.0f ) ) )
{
ERR_OUT( L"ERREUR !!! CreateD3DX10MeshFromD3DX9Mesh() génération du buffer d'adajcence D3DX10 mesh échoué" );
return E_FAIL;
}
else
INFO_OUT( L"CreateD3DX10MeshFromD3DX9Mesh() GenerateAdjacencyAndPointReps() mesh DX10 OK" );
// optimise le mesh
if( FAILED( (*pOutMesh10)->Optimize( D3DX10_MESHOPT_COMPACT | D3DX10_MESHOPT_ATTR_SORT | D3DX10_MESHOPT_VERTEX_CACHE, NULL, NULL ) ) )
{
ERR_OUT( L"ERREUR !!! CreateD3DX10MeshFromD3DX9Mesh() optimisation mesh (compact, attribute sort, vertex cache) échoué" );
return E_FAIL;
}
else
INFO_OUT( L"CreateD3DX10MeshFromD3DX9Mesh() Optimize() mesh DX10 OK" );
INFO_OUT( L"CreateD3DX10MeshFromD3DX9Mesh() création D3DX10 mesh depuis D3DX9 mesh OK" );
return S_OK;
}
//-----------------------------------------------------------------------------
// Nom: ConvertDeclaration()
// Desc: convertit la déclaration de format du vertex buffer mesh DX9 vers mesh DX10
//-----------------------------------------------------------------------------
HRESULT ConvertDeclaration( const D3DVERTEXELEMENT9 original[ MAX_FVF_DECL_SIZE ], D3D10_INPUT_ELEMENT_DESC output[ MAX_FVF_DECL_SIZE ] )
{
for( UINT i = 0; i < D3DXGetDeclLength( original ); ++i )
{
// Convert this element
output[i].SemanticName = ConvertSemantic( static_cast< D3DDECLUSAGE >( original[i].Usage ) );
output[i].SemanticIndex = original[i].UsageIndex;
output[i].AlignedByteOffset = original[i].Offset;
output[i].InputSlot = original[i].Stream;
output[i].InputSlotClass = D3D10_INPUT_PER_VERTEX_DATA;
output[i].InstanceDataStepRate = 0;
output[i].Format = ConvertDeclType( static_cast< D3DDECLTYPE >( original[i].Type ) );
}
return S_OK;
}
//---------------------------------------------------------------------------------------------------
// Nom: CopyIndexBufferData()
// Desc: convertit semantique de description de vertex buffer layout , depuis mesh DX9 vers mesh DX10
//----------------------------------------------------------------------------------------------------
LPCSTR ConvertSemantic( const D3DDECLUSAGE& d3d9Form )
{
switch( d3d9Form )
{
case D3DDECLUSAGE_POSITION: return "POSITION";
case D3DDECLUSAGE_BLENDWEIGHT: return "BLENDWEIGHT";
case D3DDECLUSAGE_BLENDINDICES: return "BLENDINDICES";
case D3DDECLUSAGE_NORMAL: return "NORMAL";
case D3DDECLUSAGE_PSIZE: return "PSIZE";
case D3DDECLUSAGE_TEXCOORD: return "TEXCOORD";
case D3DDECLUSAGE_TANGENT: return "TANGENT";
case D3DDECLUSAGE_BINORMAL: return "BINORMAL";
case D3DDECLUSAGE_TESSFACTOR: return "TESSFACTOR";
case D3DDECLUSAGE_POSITIONT: return "POSITIONT";
case D3DDECLUSAGE_COLOR: return "COLOR";
case D3DDECLUSAGE_FOG: return "FOG";
case D3DDECLUSAGE_DEPTH: return "DEPTH";
case D3DDECLUSAGE_SAMPLE: return "SAMPLE";
default: return "UNKNOWN";
}
}
//---------------------------------------------------------------------------------------------------
// Nom: ConvertDeclType()
// Desc: convertit le type de la déclaration, depuis mesh DX9 vers mesh DX10
//----------------------------------------------------------------------------------------------------
DXGI_FORMAT ConvertDeclType( const D3DDECLTYPE& d3d9Form )
{
switch( d3d9Form )
{
case D3DDECLTYPE_FLOAT1: return DXGI_FORMAT_R32_FLOAT;
case D3DDECLTYPE_FLOAT2: return DXGI_FORMAT_R32G32_FLOAT;
case D3DDECLTYPE_FLOAT3: return DXGI_FORMAT_R32G32B32_FLOAT;
case D3DDECLTYPE_FLOAT4: return DXGI_FORMAT_R32G32B32A32_FLOAT;
case D3DDECLTYPE_D3DCOLOR: return DXGI_FORMAT_R8G8B8A8_UNORM;
case D3DDECLTYPE_UBYTE4: return DXGI_FORMAT_R8G8B8A8_UINT;
case D3DDECLTYPE_SHORT2: return DXGI_FORMAT_R16G16_SINT;
case D3DDECLTYPE_SHORT4: return DXGI_FORMAT_R16G16B16A16_SINT;
case D3DDECLTYPE_UBYTE4N: return DXGI_FORMAT_R8G8B8A8_UNORM;
case D3DDECLTYPE_SHORT2N: return DXGI_FORMAT_R16G16_SNORM;
case D3DDECLTYPE_SHORT4N: return DXGI_FORMAT_R16G16B16A16_SNORM;
case D3DDECLTYPE_USHORT2N: return DXGI_FORMAT_R16G16_UNORM;
case D3DDECLTYPE_USHORT4N: return DXGI_FORMAT_R16G16B16A16_UNORM;
case D3DDECLTYPE_UDEC3: return DXGI_FORMAT_R10G10B10A2_UINT;
case D3DDECLTYPE_DEC3N: return DXGI_FORMAT_R10G10B10A2_UNORM;
case D3DDECLTYPE_FLOAT16_2: return DXGI_FORMAT_R16G16_FLOAT;
case D3DDECLTYPE_FLOAT16_4: return DXGI_FORMAT_R16G16B16A16_FLOAT;
case D3DDECLTYPE_UNUSED:
default: return DXGI_FORMAT_UNKNOWN;
}
}
//-----------------------------------------------------------------------------
// Nom: CopyIndexBufferData()
// Desc: copie index buffer mesh DX9 vers mesh DX10
//-----------------------------------------------------------------------------
HRESULT CopyIndexBufferData( ID3DXMesh* pMesh9, ID3DX10Mesh* pMesh10 )
{
// verify inputs
if( (NULL == pMesh9) || (NULL == pMesh10) )
{
ERR_OUT( L"les 2 mesh d'input doivent être non-NULL." );
return E_INVALIDARG;
}
CComPtr< ID3DX10MeshBuffer > pIBuffer10;
if( FAILED( pMesh10->GetIndexBuffer( &pIBuffer10 ) ) )
{
ERR_OUT( L"ERREUR !!! acquisition D3DX10 mesh index buffer." );
return E_FAIL;
}
// switch depending on 16 or 32 bit indices..
if( 0 != (pMesh10->GetFlags() & D3DX10_MESH_32_BIT) )
{
INFO_OUT( L"INFO: les indices ne sont pas en 32 bit form, conversion des indices..." );
// vetification taille index buffer prévue
if( pIBuffer10->GetSize() != (pMesh10->GetFaceCount() * 3 * sizeof( unsigned __int32 ) ) )
{
ERR_OUT( L"ERREUR !!! le nombre de bytes de l'index buffer ne correspond pas à la taille attendue!" );
return E_FAIL;
}
SIZE_T stRawIndices10 = 0;
unsigned __int32 *pRawIndices10 = NULL;
if( SUCCEEDED( pIBuffer10->Map( reinterpret_cast< void** >( &pRawIndices10 ), &stRawIndices10 ) ) )
{
// verrouillage buffers pour la copie
unsigned __int32 *pRawIndices9 = NULL;
if( SUCCEEDED( pMesh9->LockIndexBuffer( 0, reinterpret_cast< LPVOID* >( &pRawIndices9 ) ) ) )
{
memcpy_s( pRawIndices10,
stRawIndices10,
pRawIndices9,
pMesh9->GetNumFaces() * 3 * sizeof( unsigned __int32 )
);
// Tidy up
pMesh9->UnlockIndexBuffer( );
}
else
{
ERR_OUT( L"ERREUR !!! impossible de verrouiller le D3DX9 mesh index buffer!" );
pIBuffer10->Unmap(); // libération buffer
return E_FAIL;
}
// // libération buffer
pIBuffer10->Unmap( );
}
else
{
ERR_OUT( L"ERREUR !!! Map() D3DX10 index buffer!" );
return E_FAIL;
}
}
else
{
INFO_OUT( L"INFO: conversion des indices 16 bits..." );
if( pIBuffer10->GetSize() != (pMesh10->GetFaceCount() * 3 * sizeof( unsigned __int16 ) ) )
{
ERR_OUT( L"ERREUR !!! erreur taille prévue indice buffer !" );
return E_FAIL;
}
SIZE_T stRawIndices10 = 0;
unsigned __int16 *pRawIndices10 = NULL;
if( SUCCEEDED( pIBuffer10->Map( reinterpret_cast< void** >( &pRawIndices10 ), &stRawIndices10 ) ) )
{
// verrouillage index buffer
unsigned __int16 *pRawIndices9 = NULL;
if( SUCCEEDED( pMesh9->LockIndexBuffer( 0, reinterpret_cast< LPVOID* >( &pRawIndices9 ) ) ) )
{
memcpy_s( pRawIndices10,
stRawIndices10,
pRawIndices9,
pMesh9->GetNumFaces() * 3 * sizeof( unsigned __int16 )
);
// libération
pMesh9->UnlockIndexBuffer( );
}
else
{
ERR_OUT( L"ERREUR !!! impossible de verrouiller le D3DX9 mesh index buffer!" );
pIBuffer10->Unmap( );
return E_FAIL;
}
// libération
pIBuffer10->Unmap( );
}
else
{
ERR_OUT( L"ERREUR !!! Map() D3DX10 index buffer!" );
return E_FAIL;
}
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Nom: CopyVertexBufferData()
// Desc: copie vertex buffer mesh DX9 vers mesh DX10 vertexbuffer[0]
//-----------------------------------------------------------------------------
HRESULT CopyVertexBufferData( ID3DXMesh* pMesh9, ID3DX10Mesh* pMesh10 )
{
if( (NULL == pMesh9) || (NULL == pMesh10) )
{
ERR_OUT( L"ERREUR !!! pointeur mesh(es) non valide(s) !" );
return E_INVALIDARG;
}
// les D3DX10 meshes peuvent avoir de multiples VB, 1 seul pour les mesh D3DX9
if( 1 != pMesh10->GetVertexBufferCount( ) )
{
ERR_OUT( L"ERREUR !!! le D3DX10 mesh a plus d'un vertex buffer." );
return E_FAIL;
}
// acquiert le vb du mesh DX10
CComPtr< ID3DX10MeshBuffer > pVBuffer10;
if( SUCCEEDED( pMesh10->GetVertexBuffer( 0, &pVBuffer10 ) ) )
{
SIZE_T stRawVertices10 = 0;
unsigned __int8 *pRawVertices10 = NULL;
if( SUCCEEDED( pVBuffer10->Map( reinterpret_cast< void** >( &pRawVertices10 ), &stRawVertices10 ) ) )
{
// verrouillage et copie VB9 vers VB10
unsigned __int8 *pRawVertices9 = NULL;
if( SUCCEEDED( pMesh9->LockVertexBuffer( 0, reinterpret_cast< LPVOID* >( &pRawVertices9 ) ) ) )
{
memcpy_s(
pRawVertices10,
stRawVertices10,
pRawVertices9,
pMesh9->GetNumBytesPerVertex() * pMesh9->GetNumVertices()
);
pMesh9->UnlockVertexBuffer( );
}
else
{
ERR_OUT( L"ERREUR !!! verrouillage D3DX9 mesh vertex buffer échoué!" );
pVBuffer10->Unmap( );
return E_FAIL;
}
pVBuffer10->Unmap( );
}
else
{
ERR_OUT( L"ERREUR !!! verrouillage VB10 Map()" );
return E_FAIL;
}
}
else
{
ERR_OUT( L"ERREUR !!! acquisition D3DX10 mesh vertex buffer échouée!" );
return E_FAIL;
}
return S_OK;
}
//-----------------------------------------------------------------------------
// Nom: ConfigureAttributeTable()
// Desc: convertit table d'attributs mesh DX9 vers mesh DX10
//-----------------------------------------------------------------------------
HRESULT ConfigureAttributeTable( ID3DXMesh* pMesh9, ID3DX10Mesh* pMesh10 )
{
// verify inputs
if( (NULL == pMesh9) || (NULL == pMesh10) )
{
ERR_OUT( L"ERREUR !!! pointeur mesh(es) non valide(s) !" );
return E_INVALIDARG;
}
DWORD dwInputTableSize = 0;
if( FAILED( pMesh9->GetAttributeTable( NULL, &dwInputTableSize ) ) )
{
ERR_OUT( L"ERREUR !!! impossible d'acquérir la table d'attributs mesh DX9" );
return E_FAIL;
}
if( 0 == dwInputTableSize )
{
// The incoming mesh doesn't have an attribute table
INFO_OUT( L"table d'attributs D3DX9 mesh vide, création d'une table par défaut" );
D3DX10_ATTRIBUTE_RANGE defTable;
defTable.AttribId = 0;
defTable.FaceCount = pMesh10->GetFaceCount( );
defTable.FaceStart = 0;
defTable.VertexCount = pMesh10->GetVertexCount( );
defTable.VertexStart = 0;
if( FAILED( pMesh10->SetAttributeTable( &defTable, 1 ) ) )
{
ERR_OUT( L"ERREUR !!! impossible de stocker la table d'attributs dans le mesh D3DX10" );
return E_FAIL;
}
}
else
{
D3DXATTRIBUTERANGE *pInputAttrTable = new D3DXATTRIBUTERANGE[ dwInputTableSize ];
if( FAILED( pMesh9->GetAttributeTable( pInputAttrTable, &dwInputTableSize ) ) )
{
ERR_OUT( L"ERREUR !!! impossible d'acquérir la table d'attributs mesh DX9" );
SAFE_DELETE_ARRAY( pInputAttrTable );
return E_FAIL;
}
D3DX10_ATTRIBUTE_RANGE *pNewAttrTable = new D3DX10_ATTRIBUTE_RANGE[ dwInputTableSize ];
for( DWORD i = 0; i < dwInputTableSize; ++i )
{
pNewAttrTable[i].AttribId = pInputAttrTable[i].AttribId;
pNewAttrTable[i].FaceCount = pInputAttrTable[i].FaceCount;
pNewAttrTable[i].FaceStart = pInputAttrTable[i].FaceStart;
pNewAttrTable[i].VertexCount = pInputAttrTable[i].VertexCount;
pNewAttrTable[i].VertexStart = pInputAttrTable[i].VertexStart;
}
SAFE_DELETE_ARRAY( pInputAttrTable );
if( FAILED( pMesh10->SetAttributeTable( pNewAttrTable, static_cast< UINT >( dwInputTableSize ) ) ) )
{
ERR_OUT( L"ERREUR !!! impossible de copier la table d'attributs depuis le mesh DX9" );
SAFE_DELETE_ARRAY( pNewAttrTable );
return E_FAIL;
}
SAFE_DELETE_ARRAY( pNewAttrTable );
}
// créé la table d'attributs du mesh DX10
if( FAILED( pMesh10->GenerateAttributeBufferFromTable( ) ) )
{
ERR_OUT( L"ERREUR !!! impossible de générer la table d'attributs DX10 depuis la table DX9" );
return E_FAIL;
}
return S_OK;
}
//-----------------------------------------------------------------------------
}; // fin de namespace |
Partager