Assimp.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (ASSIMP)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2010, ASSIMP Development Team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the ASSIMP team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the ASSIMP Development Team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. /** @file Assimp.cpp
  35. * @brief Implementation of the Plain-C API
  36. */
  37. #include "AssimpPCH.h"
  38. #include "../include/assimp.h"
  39. #include "GenericProperty.h"
  40. #include "CInterfaceIOWrapper.h"
  41. #include "Importer.h"
  42. // ------------------------------------------------------------------------------------------------
  43. #ifdef AI_C_THREADSAFE
  44. # include <boost/thread/thread.hpp>
  45. # include <boost/thread/mutex.hpp>
  46. #endif
  47. // ------------------------------------------------------------------------------------------------
  48. using namespace Assimp;
  49. namespace Assimp
  50. {
  51. /** Stores the importer objects for all active import processes */
  52. typedef std::map<const aiScene*, Assimp::Importer*> ImporterMap;
  53. /** Stores the LogStream objects for all active C log streams */
  54. struct mpred {
  55. bool operator () (const aiLogStream& s0, const aiLogStream& s1) const {
  56. return s0.callback<s1.callback&&s0.user<s1.user;
  57. }
  58. };
  59. typedef std::map<aiLogStream, Assimp::LogStream*, mpred> LogStreamMap;
  60. /** Stores the LogStream objects allocated by #aiGetPredefinedLogStream */
  61. typedef std::list<Assimp::LogStream*> PredefLogStreamMap;
  62. /** Local storage of all active import processes */
  63. static ImporterMap gActiveImports;
  64. /** Local storage of all active log streams */
  65. static LogStreamMap gActiveLogStreams;
  66. /** Local storage of LogStreams allocated by #aiGetPredefinedLogStream */
  67. static PredefLogStreamMap gPredefinedStreams;
  68. /** Error message of the last failed import process */
  69. static std::string gLastErrorString;
  70. /** Verbose logging active or not? */
  71. static aiBool gVerboseLogging = false;
  72. }
  73. /** Configuration properties */
  74. static ImporterPimpl::IntPropertyMap gIntProperties;
  75. static ImporterPimpl::FloatPropertyMap gFloatProperties;
  76. static ImporterPimpl::StringPropertyMap gStringProperties;
  77. #ifdef AI_C_THREADSAFE
  78. /** Global mutex to manage the access to the importer map */
  79. static boost::mutex gMutex;
  80. /** Global mutex to manage the access to the logstream map */
  81. static boost::mutex gLogStreamMutex;
  82. #endif
  83. // ------------------------------------------------------------------------------------------------
  84. // Custom LogStream implementation for the C-API
  85. class LogToCallbackRedirector : public LogStream
  86. {
  87. public:
  88. LogToCallbackRedirector(const aiLogStream& s)
  89. : stream (s) {
  90. ai_assert(NULL != s.callback);
  91. }
  92. ~LogToCallbackRedirector() {
  93. #ifdef AI_C_THREADSAFE
  94. boost::mutex::scoped_lock lock(gLogStreamMutex);
  95. #endif
  96. // (HACK) Check whether the 'stream.user' pointer points to a
  97. // custom LogStream allocated by #aiGetPredefinedLogStream.
  98. // In this case, we need to delete it, too. Of course, this
  99. // might cause strange problems, but the chance is quite low.
  100. PredefLogStreamMap::iterator it = std::find(gPredefinedStreams.begin(),
  101. gPredefinedStreams.end(), (Assimp::LogStream*)stream.user);
  102. if (it != gPredefinedStreams.end()) {
  103. delete *it;
  104. gPredefinedStreams.erase(it);
  105. }
  106. }
  107. /** @copydoc LogStream::write */
  108. void write(const char* message) {
  109. stream.callback(message,stream.user);
  110. }
  111. private:
  112. aiLogStream stream;
  113. };
  114. // ------------------------------------------------------------------------------------------------
  115. void ReportSceneNotFoundError()
  116. {
  117. DefaultLogger::get()->error("Unable to find the Assimp::Importer for this aiScene. "
  118. "Are you playing fools with us? Don't mix cpp and c API. Thanks.");
  119. assert(false);
  120. }
  121. // ------------------------------------------------------------------------------------------------
  122. // Reads the given file and returns its content.
  123. const aiScene* aiImportFile( const char* pFile, unsigned int pFlags)
  124. {
  125. return aiImportFileEx(pFile,pFlags,NULL);
  126. }
  127. // ------------------------------------------------------------------------------------------------
  128. const aiScene* aiImportFileEx( const char* pFile, unsigned int pFlags,
  129. aiFileIO* pFS)
  130. {
  131. ai_assert(NULL != pFile);
  132. const aiScene* scene = NULL;
  133. ASSIMP_BEGIN_EXCEPTION_REGION();
  134. // create an Importer for this file
  135. Assimp::Importer* imp = new Assimp::Importer();
  136. #ifdef AI_C_THREADSAFE
  137. boost::mutex::scoped_lock lock(gMutex);
  138. #endif
  139. // copy the global property lists to the Importer instance
  140. imp->pimpl->mIntProperties = gIntProperties;
  141. imp->pimpl->mFloatProperties = gFloatProperties;
  142. imp->pimpl->mStringProperties = gStringProperties;
  143. #ifdef AI_C_THREADSAFE
  144. lock.unlock();
  145. #endif
  146. // setup a custom IO system if necessary
  147. if (pFS) {
  148. imp->SetIOHandler( new CIOSystemWrapper (pFS) );
  149. }
  150. // and have it read the file
  151. scene = imp->ReadFile( pFile, pFlags);
  152. // if succeeded, place it in the collection of active processes
  153. if( scene) {
  154. #ifdef AI_C_THREADSAFE
  155. lock.lock();
  156. #endif
  157. gActiveImports[scene] = imp;
  158. }
  159. else {
  160. // if failed, extract error code and destroy the import
  161. gLastErrorString = imp->GetErrorString();
  162. delete imp;
  163. }
  164. // return imported data. If the import failed the pointer is NULL anyways
  165. ASSIMP_END_EXCEPTION_REGION(const aiScene*);
  166. return scene;
  167. }
  168. // ------------------------------------------------------------------------------------------------
  169. const aiScene* aiImportFileFromMemory(
  170. const char* pBuffer,
  171. unsigned int pLength,
  172. unsigned int pFlags,
  173. const char* pHint)
  174. {
  175. ai_assert(NULL != pBuffer && 0 != pLength);
  176. const aiScene* scene = NULL;
  177. ASSIMP_BEGIN_EXCEPTION_REGION();
  178. // create an Importer for this file
  179. Assimp::Importer* imp = new Assimp::Importer();
  180. #ifdef AI_C_THREADSAFE
  181. boost::mutex::scoped_lock lock(gMutex);
  182. #endif
  183. // copy the global property lists to the Importer instance
  184. imp->pimpl->mIntProperties = gIntProperties;
  185. imp->pimpl->mFloatProperties = gFloatProperties;
  186. imp->pimpl->mStringProperties = gStringProperties;
  187. #ifdef AI_C_THREADSAFE
  188. lock.unlock();
  189. #endif
  190. // and have it read the file from the memory buffer
  191. scene = imp->ReadFileFromMemory( pBuffer, pLength, pFlags,pHint);
  192. // if succeeded, place it in the collection of active processes
  193. if( scene) {
  194. #ifdef AI_C_THREADSAFE
  195. lock.lock();
  196. #endif
  197. gActiveImports[scene] = imp;
  198. }
  199. else {
  200. // if failed, extract error code and destroy the import
  201. gLastErrorString = imp->GetErrorString();
  202. delete imp;
  203. }
  204. // return imported data. If the import failed the pointer is NULL anyways
  205. ASSIMP_END_EXCEPTION_REGION(const aiScene*);
  206. return scene;
  207. }
  208. // ------------------------------------------------------------------------------------------------
  209. // Releases all resources associated with the given import process.
  210. void aiReleaseImport( const aiScene* pScene)
  211. {
  212. if (!pScene) {
  213. return;
  214. }
  215. ASSIMP_BEGIN_EXCEPTION_REGION();
  216. #ifdef AI_C_THREADSAFE
  217. boost::mutex::scoped_lock lock(gMutex);
  218. #endif
  219. // find the importer associated with this data
  220. ImporterMap::iterator it = gActiveImports.find( pScene);
  221. // it should be there... else the user is playing fools with us
  222. if( it == gActiveImports.end()) {
  223. ReportSceneNotFoundError();
  224. return;
  225. }
  226. // kill the importer, the data dies with it
  227. delete it->second;
  228. gActiveImports.erase( it);
  229. ASSIMP_END_EXCEPTION_REGION(void);
  230. }
  231. // ------------------------------------------------------------------------------------------------
  232. ASSIMP_API const aiScene* aiApplyPostProcessing(const aiScene* pScene,
  233. unsigned int pFlags)
  234. {
  235. const aiScene* sc = NULL;
  236. ASSIMP_BEGIN_EXCEPTION_REGION();
  237. #ifdef AI_C_THREADSAFE
  238. boost::mutex::scoped_lock lock(gMutex);
  239. #endif
  240. // find the importer associated with this data
  241. ImporterMap::iterator it = gActiveImports.find( pScene);
  242. // it should be there... else the user is playing fools with us
  243. if( it == gActiveImports.end()) {
  244. ReportSceneNotFoundError();
  245. return NULL;
  246. }
  247. #ifdef AI_C_THREADSAFE
  248. lock.unlock();
  249. #endif
  250. sc = it->second->ApplyPostProcessing(pFlags);
  251. #ifdef AI_C_THREADSAFE
  252. lock.lock();
  253. #endif
  254. if (!sc) {
  255. // kill the importer, the data dies with it
  256. delete it->second;
  257. gActiveImports.erase( it);
  258. return NULL;
  259. }
  260. ASSIMP_END_EXCEPTION_REGION(const aiScene*);
  261. return sc;
  262. }
  263. // ------------------------------------------------------------------------------------------------
  264. void CallbackToLogRedirector (const char* msg, char* dt)
  265. {
  266. ai_assert(NULL != msg && NULL != dt);
  267. LogStream* s = (LogStream*)dt;
  268. s->write(msg);
  269. }
  270. // ------------------------------------------------------------------------------------------------
  271. ASSIMP_API aiLogStream aiGetPredefinedLogStream(aiDefaultLogStream pStream,const char* file)
  272. {
  273. aiLogStream sout;
  274. ASSIMP_BEGIN_EXCEPTION_REGION();
  275. LogStream* stream = LogStream::createDefaultStream(pStream,file);
  276. if (!stream) {
  277. sout.callback = NULL;
  278. sout.user = NULL;
  279. }
  280. else {
  281. sout.callback = &CallbackToLogRedirector;
  282. sout.user = (char*)stream;
  283. }
  284. gPredefinedStreams.push_back(stream);
  285. ASSIMP_END_EXCEPTION_REGION(aiLogStream);
  286. return sout;
  287. }
  288. // ------------------------------------------------------------------------------------------------
  289. ASSIMP_API void aiAttachLogStream( const aiLogStream* stream )
  290. {
  291. ASSIMP_BEGIN_EXCEPTION_REGION();
  292. #ifdef AI_C_THREADSAFE
  293. boost::mutex::scoped_lock lock(gLogStreamMutex);
  294. #endif
  295. LogStream* lg = new LogToCallbackRedirector(*stream);
  296. gActiveLogStreams[*stream] = lg;
  297. if (DefaultLogger::isNullLogger()) {
  298. DefaultLogger::create(NULL,(gVerboseLogging == AI_TRUE ? Logger::VERBOSE : Logger::NORMAL));
  299. }
  300. DefaultLogger::get()->attachStream(lg);
  301. ASSIMP_END_EXCEPTION_REGION(void);
  302. }
  303. // ------------------------------------------------------------------------------------------------
  304. ASSIMP_API aiReturn aiDetachLogStream( const aiLogStream* stream)
  305. {
  306. ASSIMP_BEGIN_EXCEPTION_REGION();
  307. #ifdef AI_C_THREADSAFE
  308. boost::mutex::scoped_lock lock(gLogStreamMutex);
  309. #endif
  310. // find the logstream associated with this data
  311. LogStreamMap::iterator it = gActiveLogStreams.find( *stream);
  312. // it should be there... else the user is playing fools with us
  313. if( it == gActiveLogStreams.end()) {
  314. return AI_FAILURE;
  315. }
  316. DefaultLogger::get()->detatchStream( it->second );
  317. delete it->second;
  318. gActiveLogStreams.erase( it);
  319. if (gActiveLogStreams.empty()) {
  320. DefaultLogger::kill();
  321. }
  322. ASSIMP_END_EXCEPTION_REGION(aiReturn);
  323. return AI_SUCCESS;
  324. }
  325. // ------------------------------------------------------------------------------------------------
  326. ASSIMP_API void aiDetachAllLogStreams(void)
  327. {
  328. ASSIMP_BEGIN_EXCEPTION_REGION();
  329. #ifdef AI_C_THREADSAFE
  330. boost::mutex::scoped_lock lock(gLogStreamMutex);
  331. #endif
  332. for (LogStreamMap::iterator it = gActiveLogStreams.begin(); it != gActiveLogStreams.end(); ++it) {
  333. DefaultLogger::get()->detatchStream( it->second );
  334. delete it->second;
  335. }
  336. gActiveLogStreams.clear();
  337. DefaultLogger::kill();
  338. ASSIMP_END_EXCEPTION_REGION(void);
  339. }
  340. // ------------------------------------------------------------------------------------------------
  341. ASSIMP_API void aiEnableVerboseLogging(aiBool d)
  342. {
  343. if (!DefaultLogger::isNullLogger()) {
  344. DefaultLogger::get()->setLogSeverity((d == AI_TRUE ? Logger::VERBOSE : Logger::NORMAL));
  345. }
  346. gVerboseLogging = d;
  347. }
  348. // ------------------------------------------------------------------------------------------------
  349. // Returns the error text of the last failed import process.
  350. const char* aiGetErrorString()
  351. {
  352. return gLastErrorString.c_str();
  353. }
  354. // ------------------------------------------------------------------------------------------------
  355. // Returns the error text of the last failed import process.
  356. aiBool aiIsExtensionSupported(const char* szExtension)
  357. {
  358. ai_assert(NULL != szExtension);
  359. aiBool candoit=AI_FALSE;
  360. ASSIMP_BEGIN_EXCEPTION_REGION();
  361. #ifdef AI_C_THREADSAFE
  362. boost::mutex::scoped_lock lock(gMutex);
  363. #endif
  364. if (!gActiveImports.empty()) {
  365. return ((*(gActiveImports.begin())).second->IsExtensionSupported( szExtension )) ? AI_TRUE : AI_FALSE;
  366. }
  367. // fixme: no need to create a temporary Importer instance just for that ..
  368. Assimp::Importer tmp;
  369. candoit = tmp.IsExtensionSupported(std::string(szExtension)) ? AI_TRUE : AI_FALSE;
  370. ASSIMP_END_EXCEPTION_REGION(aiBool);
  371. return candoit;
  372. }
  373. // ------------------------------------------------------------------------------------------------
  374. // Get a list of all file extensions supported by ASSIMP
  375. void aiGetExtensionList(aiString* szOut)
  376. {
  377. ai_assert(NULL != szOut);
  378. ASSIMP_BEGIN_EXCEPTION_REGION();
  379. #ifdef AI_C_THREADSAFE
  380. boost::mutex::scoped_lock lock(gMutex);
  381. #endif
  382. if (!gActiveImports.empty()) {
  383. (*(gActiveImports.begin())).second->GetExtensionList(*szOut);
  384. return;
  385. }
  386. // fixme: no need to create a temporary Importer instance just for that ..
  387. Assimp::Importer tmp;
  388. tmp.GetExtensionList(*szOut);
  389. ASSIMP_END_EXCEPTION_REGION(void);
  390. }
  391. // ------------------------------------------------------------------------------------------------
  392. // Get the memory requirements for a particular import.
  393. void aiGetMemoryRequirements(const C_STRUCT aiScene* pIn,
  394. C_STRUCT aiMemoryInfo* in)
  395. {
  396. ASSIMP_BEGIN_EXCEPTION_REGION();
  397. #ifdef AI_C_THREADSAFE
  398. boost::mutex::scoped_lock lock(gMutex);
  399. #endif
  400. // find the importer associated with this data
  401. ImporterMap::iterator it = gActiveImports.find( pIn);
  402. // it should be there... else the user is playing fools with us
  403. if( it == gActiveImports.end()) {
  404. ReportSceneNotFoundError();
  405. return;
  406. }
  407. // get memory statistics
  408. #ifdef AI_C_THREADSAFE
  409. lock.unlock();
  410. #endif
  411. it->second->GetMemoryRequirements(*in);
  412. ASSIMP_END_EXCEPTION_REGION(void);
  413. }
  414. // ------------------------------------------------------------------------------------------------
  415. // Importer::SetPropertyInteger
  416. ASSIMP_API void aiSetImportPropertyInteger(const char* szName, int value)
  417. {
  418. ASSIMP_BEGIN_EXCEPTION_REGION();
  419. #ifdef AI_C_THREADSAFE
  420. boost::mutex::scoped_lock lock(gMutex);
  421. #endif
  422. SetGenericProperty<int>(gIntProperties,szName,value,NULL);
  423. ASSIMP_END_EXCEPTION_REGION(void);
  424. }
  425. // ------------------------------------------------------------------------------------------------
  426. // Importer::SetPropertyFloat
  427. ASSIMP_API void aiSetImportPropertyFloat(const char* szName, float value)
  428. {
  429. ASSIMP_BEGIN_EXCEPTION_REGION();
  430. #ifdef AI_C_THREADSAFE
  431. boost::mutex::scoped_lock lock(gMutex);
  432. #endif
  433. SetGenericProperty<float>(gFloatProperties,szName,value,NULL);
  434. ASSIMP_END_EXCEPTION_REGION(void);
  435. }
  436. // ------------------------------------------------------------------------------------------------
  437. // Importer::SetPropertyString
  438. ASSIMP_API void aiSetImportPropertyString(const char* szName,
  439. const C_STRUCT aiString* st)
  440. {
  441. if (!st) {
  442. return;
  443. }
  444. ASSIMP_BEGIN_EXCEPTION_REGION();
  445. #ifdef AI_C_THREADSAFE
  446. boost::mutex::scoped_lock lock(gMutex);
  447. #endif
  448. SetGenericProperty<std::string>(gStringProperties,szName,
  449. std::string( st->data ),NULL);
  450. ASSIMP_END_EXCEPTION_REGION(void);
  451. }
  452. // ------------------------------------------------------------------------------------------------
  453. // Rotation matrix to quaternion
  454. ASSIMP_API void aiCreateQuaternionFromMatrix(aiQuaternion* quat,const aiMatrix3x3* mat)
  455. {
  456. ai_assert(NULL != quat && NULL != mat);
  457. *quat = aiQuaternion(*mat);
  458. }
  459. // ------------------------------------------------------------------------------------------------
  460. // Matrix decomposition
  461. ASSIMP_API void aiDecomposeMatrix(const aiMatrix4x4* mat,aiVector3D* scaling,
  462. aiQuaternion* rotation,
  463. aiVector3D* position)
  464. {
  465. ai_assert(NULL != rotation && NULL != position && NULL != scaling && NULL != mat);
  466. mat->Decompose(*scaling,*rotation,*position);
  467. }
  468. // ------------------------------------------------------------------------------------------------
  469. // Matrix transpose
  470. ASSIMP_API void aiTransposeMatrix3(aiMatrix3x3* mat)
  471. {
  472. ai_assert(NULL != mat);
  473. mat->Transpose();
  474. }
  475. // ------------------------------------------------------------------------------------------------
  476. ASSIMP_API void aiTransposeMatrix4(aiMatrix4x4* mat)
  477. {
  478. ai_assert(NULL != mat);
  479. mat->Transpose();
  480. }
  481. // ------------------------------------------------------------------------------------------------
  482. // Vector transformation
  483. ASSIMP_API void aiTransformVecByMatrix3(C_STRUCT aiVector3D* vec,
  484. const C_STRUCT aiMatrix3x3* mat)
  485. {
  486. ai_assert(NULL != mat && NULL != vec);
  487. *vec *= (*mat);
  488. }
  489. // ------------------------------------------------------------------------------------------------
  490. ASSIMP_API void aiTransformVecByMatrix4(C_STRUCT aiVector3D* vec,
  491. const C_STRUCT aiMatrix4x4* mat)
  492. {
  493. ai_assert(NULL != mat && NULL != vec);
  494. *vec *= (*mat);
  495. }
  496. // ------------------------------------------------------------------------------------------------
  497. // Matrix multiplication
  498. ASSIMP_API void aiMultiplyMatrix4(
  499. C_STRUCT aiMatrix4x4* dst,
  500. const C_STRUCT aiMatrix4x4* src)
  501. {
  502. ai_assert(NULL != dst && NULL != src);
  503. *dst = (*dst) * (*src);
  504. }
  505. // ------------------------------------------------------------------------------------------------
  506. ASSIMP_API void aiMultiplyMatrix3(
  507. C_STRUCT aiMatrix3x3* dst,
  508. const C_STRUCT aiMatrix3x3* src)
  509. {
  510. ai_assert(NULL != dst && NULL != src);
  511. *dst = (*dst) * (*src);
  512. }
  513. // ------------------------------------------------------------------------------------------------
  514. // Matrix identity
  515. ASSIMP_API void aiIdentityMatrix3(
  516. C_STRUCT aiMatrix3x3* mat)
  517. {
  518. ai_assert(NULL != mat);
  519. *mat = aiMatrix3x3();
  520. }
  521. // ------------------------------------------------------------------------------------------------
  522. ASSIMP_API void aiIdentityMatrix4(
  523. C_STRUCT aiMatrix4x4* mat)
  524. {
  525. ai_assert(NULL != mat);
  526. *mat = aiMatrix4x4();
  527. }