1 | /* |
2 | --------------------------------------------------------------------------- |
3 | Open Asset Import Library (assimp) |
4 | --------------------------------------------------------------------------- |
5 | |
6 | Copyright (c) 2006-2024, assimp team |
7 | |
8 | All rights reserved. |
9 | |
10 | Redistribution and use of this software in source and binary forms, |
11 | with or without modification, are permitted provided that the following |
12 | conditions are met: |
13 | |
14 | * Redistributions of source code must retain the above |
15 | copyright notice, this list of conditions and the |
16 | following disclaimer. |
17 | |
18 | * Redistributions in binary form must reproduce the above |
19 | copyright notice, this list of conditions and the |
20 | following disclaimer in the documentation and/or other |
21 | materials provided with the distribution. |
22 | |
23 | * Neither the name of the assimp team, nor the names of its |
24 | contributors may be used to endorse or promote products |
25 | derived from this software without specific prior |
26 | written permission of the assimp team. |
27 | |
28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
39 | --------------------------------------------------------------------------- |
40 | */ |
41 | |
42 | /** @file cimport.h |
43 | * @brief Defines the C-API to the Open Asset Import Library. |
44 | */ |
45 | #pragma once |
46 | #ifndef AI_ASSIMP_H_INC |
47 | #define AI_ASSIMP_H_INC |
48 | |
49 | #ifdef __GNUC__ |
50 | #pragma GCC system_header |
51 | #endif |
52 | |
53 | #include <assimp/importerdesc.h> |
54 | #include <assimp/types.h> |
55 | |
56 | #ifdef __cplusplus |
57 | extern "C" { |
58 | #endif |
59 | |
60 | struct aiScene; |
61 | struct aiTexture; |
62 | struct aiFileIO; |
63 | |
64 | typedef void (*aiLogStreamCallback)(const char * /* message */, char * /* user */); |
65 | |
66 | // -------------------------------------------------------------------------------- |
67 | /** C-API: Represents a log stream. A log stream receives all log messages and |
68 | * streams them _somewhere_. |
69 | * @see aiGetPredefinedLogStream |
70 | * @see aiAttachLogStream |
71 | * @see aiDetachLogStream */ |
72 | // -------------------------------------------------------------------------------- |
73 | struct aiLogStream { |
74 | /** callback to be called */ |
75 | aiLogStreamCallback callback; |
76 | |
77 | /** user data to be passed to the callback */ |
78 | char *user; |
79 | }; |
80 | |
81 | // -------------------------------------------------------------------------------- |
82 | /** C-API: Represents an opaque set of settings to be used during importing. |
83 | * @see aiCreatePropertyStore |
84 | * @see aiReleasePropertyStore |
85 | * @see aiImportFileExWithProperties |
86 | * @see aiSetPropertyInteger |
87 | * @see aiSetPropertyFloat |
88 | * @see aiSetPropertyString |
89 | * @see aiSetPropertyMatrix |
90 | */ |
91 | // -------------------------------------------------------------------------------- |
92 | struct aiPropertyStore { |
93 | char sentinel; |
94 | }; |
95 | |
96 | /** Our own C boolean type */ |
97 | typedef int aiBool; |
98 | |
99 | #define AI_FALSE 0 |
100 | #define AI_TRUE 1 |
101 | |
102 | // -------------------------------------------------------------------------------- |
103 | /** Reads the given file and returns its content. |
104 | * |
105 | * If the call succeeds, the imported data is returned in an aiScene structure. |
106 | * The data is intended to be read-only, it stays property of the ASSIMP |
107 | * library and will be stable until aiReleaseImport() is called. After you're |
108 | * done with it, call aiReleaseImport() to free the resources associated with |
109 | * this file. If the import fails, NULL is returned instead. Call |
110 | * aiGetErrorString() to retrieve a human-readable error text. |
111 | * @param pFile Path and filename of the file to be imported, |
112 | * expected to be a null-terminated c-string. NULL is not a valid value. |
113 | * @param pFlags Optional post processing steps to be executed after |
114 | * a successful import. Provide a bitwise combination of the |
115 | * #aiPostProcessSteps flags. |
116 | * @return Pointer to the imported data or NULL if the import failed. |
117 | */ |
118 | ASSIMP_API const C_STRUCT aiScene *aiImportFile( |
119 | const char *pFile, |
120 | unsigned int pFlags); |
121 | |
122 | // -------------------------------------------------------------------------------- |
123 | /** Reads the given file using user-defined I/O functions and returns |
124 | * its content. |
125 | * |
126 | * If the call succeeds, the imported data is returned in an aiScene structure. |
127 | * The data is intended to be read-only, it stays property of the ASSIMP |
128 | * library and will be stable until aiReleaseImport() is called. After you're |
129 | * done with it, call aiReleaseImport() to free the resources associated with |
130 | * this file. If the import fails, NULL is returned instead. Call |
131 | * aiGetErrorString() to retrieve a human-readable error text. |
132 | * @param pFile Path and filename of the file to be imported, |
133 | * expected to be a null-terminated c-string. NULL is not a valid value. |
134 | * @param pFlags Optional post processing steps to be executed after |
135 | * a successful import. Provide a bitwise combination of the |
136 | * #aiPostProcessSteps flags. |
137 | * @param pFS aiFileIO structure. Will be used to open the model file itself |
138 | * and any other files the loader needs to open. Pass NULL to use the default |
139 | * implementation. |
140 | * @return Pointer to the imported data or NULL if the import failed. |
141 | * @note Include <aiFileIO.h> for the definition of #aiFileIO. |
142 | */ |
143 | ASSIMP_API const C_STRUCT aiScene *aiImportFileEx( |
144 | const char *pFile, |
145 | unsigned int pFlags, |
146 | C_STRUCT aiFileIO *pFS); |
147 | |
148 | // -------------------------------------------------------------------------------- |
149 | /** Same as #aiImportFileEx, but adds an extra parameter containing importer settings. |
150 | * |
151 | * @param pFile Path and filename of the file to be imported, |
152 | * expected to be a null-terminated c-string. NULL is not a valid value. |
153 | * @param pFlags Optional post processing steps to be executed after |
154 | * a successful import. Provide a bitwise combination of the |
155 | * #aiPostProcessSteps flags. |
156 | * @param pFS aiFileIO structure. Will be used to open the model file itself |
157 | * and any other files the loader needs to open. Pass NULL to use the default |
158 | * implementation. |
159 | * @param pProps #aiPropertyStore instance containing import settings. |
160 | * @return Pointer to the imported data or NULL if the import failed. |
161 | * @note Include <aiFileIO.h> for the definition of #aiFileIO. |
162 | * @see aiImportFileEx |
163 | */ |
164 | ASSIMP_API const C_STRUCT aiScene *aiImportFileExWithProperties( |
165 | const char *pFile, |
166 | unsigned int pFlags, |
167 | C_STRUCT aiFileIO *pFS, |
168 | const C_STRUCT aiPropertyStore *pProps); |
169 | |
170 | // -------------------------------------------------------------------------------- |
171 | /** Reads the given file from a given memory buffer, |
172 | * |
173 | * If the call succeeds, the contents of the file are returned as a pointer to an |
174 | * aiScene object. The returned data is intended to be read-only, the importer keeps |
175 | * ownership of the data and will destroy it upon destruction. If the import fails, |
176 | * NULL is returned. |
177 | * A human-readable error description can be retrieved by calling aiGetErrorString(). |
178 | * @param pBuffer Pointer to the file data |
179 | * @param pLength Length of pBuffer, in bytes |
180 | * @param pFlags Optional post processing steps to be executed after |
181 | * a successful import. Provide a bitwise combination of the |
182 | * #aiPostProcessSteps flags. If you wish to inspect the imported |
183 | * scene first in order to fine-tune your post-processing setup, |
184 | * consider to use #aiApplyPostProcessing(). |
185 | * @param pHint An additional hint to the library. If this is a non empty string, |
186 | * the library looks for a loader to support the file extension specified by pHint |
187 | * and passes the file to the first matching loader. If this loader is unable to |
188 | * completely the request, the library continues and tries to determine the file |
189 | * format on its own, a task that may or may not be successful. |
190 | * Check the return value, and you'll know ... |
191 | * @return A pointer to the imported data, NULL if the import failed. |
192 | * |
193 | * @note This is a straightforward way to decode models from memory |
194 | * buffers, but it doesn't handle model formats that spread their |
195 | * data across multiple files or even directories. Examples include |
196 | * OBJ or MD3, which outsource parts of their material info into |
197 | * external scripts. If you need full functionality, provide |
198 | * a custom IOSystem to make Assimp find these files and use |
199 | * the regular aiImportFileEx()/aiImportFileExWithProperties() API. |
200 | */ |
201 | ASSIMP_API const C_STRUCT aiScene *aiImportFileFromMemory( |
202 | const char *pBuffer, |
203 | unsigned int pLength, |
204 | unsigned int pFlags, |
205 | const char *pHint); |
206 | |
207 | // -------------------------------------------------------------------------------- |
208 | /** Same as #aiImportFileFromMemory, but adds an extra parameter containing importer settings. |
209 | * |
210 | * @param pBuffer Pointer to the file data |
211 | * @param pLength Length of pBuffer, in bytes |
212 | * @param pFlags Optional post processing steps to be executed after |
213 | * a successful import. Provide a bitwise combination of the |
214 | * #aiPostProcessSteps flags. If you wish to inspect the imported |
215 | * scene first in order to fine-tune your post-processing setup, |
216 | * consider to use #aiApplyPostProcessing(). |
217 | * @param pHint An additional hint to the library. If this is a non empty string, |
218 | * the library looks for a loader to support the file extension specified by pHint |
219 | * and passes the file to the first matching loader. If this loader is unable to |
220 | * completely the request, the library continues and tries to determine the file |
221 | * format on its own, a task that may or may not be successful. |
222 | * Check the return value, and you'll know ... |
223 | * @param pProps #aiPropertyStore instance containing import settings. |
224 | * @return A pointer to the imported data, NULL if the import failed. |
225 | * |
226 | * @note This is a straightforward way to decode models from memory |
227 | * buffers, but it doesn't handle model formats that spread their |
228 | * data across multiple files or even directories. Examples include |
229 | * OBJ or MD3, which outsource parts of their material info into |
230 | * external scripts. If you need full functionality, provide |
231 | * a custom IOSystem to make Assimp find these files and use |
232 | * the regular aiImportFileEx()/aiImportFileExWithProperties() API. |
233 | * @see aiImportFileFromMemory |
234 | */ |
235 | ASSIMP_API const C_STRUCT aiScene *aiImportFileFromMemoryWithProperties( |
236 | const char *pBuffer, |
237 | unsigned int pLength, |
238 | unsigned int pFlags, |
239 | const char *pHint, |
240 | const C_STRUCT aiPropertyStore *pProps); |
241 | |
242 | // -------------------------------------------------------------------------------- |
243 | /** Apply post-processing to an already-imported scene. |
244 | * |
245 | * This is strictly equivalent to calling #aiImportFile()/#aiImportFileEx with the |
246 | * same flags. However, you can use this separate function to inspect the imported |
247 | * scene first to fine-tune your post-processing setup. |
248 | * @param pScene Scene to work on. |
249 | * @param pFlags Provide a bitwise combination of the #aiPostProcessSteps flags. |
250 | * @return A pointer to the post-processed data. Post processing is done in-place, |
251 | * meaning this is still the same #aiScene which you passed for pScene. However, |
252 | * _if_ post-processing failed, the scene could now be NULL. That's quite a rare |
253 | * case, post processing steps are not really designed to 'fail'. To be exact, |
254 | * the #aiProcess_ValidateDataStructure flag is currently the only post processing step |
255 | * which can actually cause the scene to be reset to NULL. |
256 | */ |
257 | ASSIMP_API const C_STRUCT aiScene *aiApplyPostProcessing( |
258 | const C_STRUCT aiScene *pScene, |
259 | unsigned int pFlags); |
260 | |
261 | // -------------------------------------------------------------------------------- |
262 | /** Get one of the predefine log streams. This is the quick'n'easy solution to |
263 | * access Assimp's log system. Attaching a log stream can slightly reduce Assimp's |
264 | * overall import performance. |
265 | * |
266 | * Usage is rather simple (this will stream the log to a file, named log.txt, and |
267 | * the stdout stream of the process: |
268 | * @code |
269 | * struct aiLogStream c; |
270 | * c = aiGetPredefinedLogStream(aiDefaultLogStream_FILE,"log.txt"); |
271 | * aiAttachLogStream(&c); |
272 | * c = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT,NULL); |
273 | * aiAttachLogStream(&c); |
274 | * @endcode |
275 | * |
276 | * @param pStreams One of the #aiDefaultLogStream enumerated values. |
277 | * @param file Solely for the #aiDefaultLogStream_FILE flag: specifies the file to write to. |
278 | * Pass NULL for all other flags. |
279 | * @return The log stream. callback is set to NULL if something went wrong. |
280 | */ |
281 | ASSIMP_API C_STRUCT aiLogStream aiGetPredefinedLogStream( |
282 | C_ENUM aiDefaultLogStream pStreams, |
283 | const char *file); |
284 | |
285 | // -------------------------------------------------------------------------------- |
286 | /** Attach a custom log stream to the libraries' logging system. |
287 | * |
288 | * Attaching a log stream can slightly reduce Assimp's overall import |
289 | * performance. Multiple log-streams can be attached. |
290 | * @param stream Describes the new log stream. |
291 | * @note To ensure proper destruction of the logging system, you need to manually |
292 | * call aiDetachLogStream() on every single log stream you attach. |
293 | * Alternatively (for the lazy folks) #aiDetachAllLogStreams is provided. |
294 | */ |
295 | ASSIMP_API void aiAttachLogStream( |
296 | const C_STRUCT aiLogStream *stream); |
297 | |
298 | // -------------------------------------------------------------------------------- |
299 | /** Enable verbose logging. Verbose logging includes debug-related stuff and |
300 | * detailed import statistics. This can have severe impact on import performance |
301 | * and memory consumption. However, it might be useful to find out why a file |
302 | * didn't read correctly. |
303 | * @param d AI_TRUE or AI_FALSE, your decision. |
304 | */ |
305 | ASSIMP_API void aiEnableVerboseLogging(aiBool d); |
306 | |
307 | // -------------------------------------------------------------------------------- |
308 | /** Detach a custom log stream from the libraries' logging system. |
309 | * |
310 | * This is the counterpart of #aiAttachLogStream. If you attached a stream, |
311 | * don't forget to detach it again. |
312 | * @param stream The log stream to be detached. |
313 | * @return AI_SUCCESS if the log stream has been detached successfully. |
314 | * @see aiDetachAllLogStreams |
315 | */ |
316 | ASSIMP_API C_ENUM aiReturn aiDetachLogStream( |
317 | const C_STRUCT aiLogStream *stream); |
318 | |
319 | // -------------------------------------------------------------------------------- |
320 | /** Detach all active log streams from the libraries' logging system. |
321 | * This ensures that the logging system is terminated properly and all |
322 | * resources allocated by it are actually freed. If you attached a stream, |
323 | * don't forget to detach it again. |
324 | * @see aiAttachLogStream |
325 | * @see aiDetachLogStream |
326 | */ |
327 | ASSIMP_API void aiDetachAllLogStreams(void); |
328 | |
329 | // -------------------------------------------------------------------------------- |
330 | /** Releases all resources associated with the given import process. |
331 | * |
332 | * Call this function after you're done with the imported data. |
333 | * @param pScene The imported data to release. NULL is a valid value. |
334 | */ |
335 | ASSIMP_API void aiReleaseImport( |
336 | const C_STRUCT aiScene *pScene); |
337 | |
338 | // -------------------------------------------------------------------------------- |
339 | /** Returns the error text of the last failed import process. |
340 | * |
341 | * @return A textual description of the error that occurred at the last |
342 | * import process. NULL if there was no error. There can't be an error if you |
343 | * got a non-NULL #aiScene from #aiImportFile/#aiImportFileEx/#aiApplyPostProcessing. |
344 | */ |
345 | ASSIMP_API const char *aiGetErrorString(void); |
346 | |
347 | // -------------------------------------------------------------------------------- |
348 | /** Returns whether a given file extension is supported by ASSIMP |
349 | * |
350 | * @param szExtension Extension for which the function queries support for. |
351 | * Must include a leading dot '.'. Example: ".3ds", ".md3" |
352 | * @return AI_TRUE if the file extension is supported. |
353 | */ |
354 | ASSIMP_API aiBool aiIsExtensionSupported( |
355 | const char *szExtension); |
356 | |
357 | // -------------------------------------------------------------------------------- |
358 | /** Get a list of all file extensions supported by ASSIMP. |
359 | * |
360 | * If a file extension is contained in the list this does, of course, not |
361 | * mean that ASSIMP is able to load all files with this extension. |
362 | * @param szOut String to receive the extension list. |
363 | * Format of the list: "*.3ds;*.obj;*.dae". NULL is not a valid parameter. |
364 | */ |
365 | ASSIMP_API void aiGetExtensionList( |
366 | C_STRUCT aiString *szOut); |
367 | |
368 | // -------------------------------------------------------------------------------- |
369 | /** Get the approximated storage required by an imported asset |
370 | * @param pIn Input asset. |
371 | * @param in Data structure to be filled. |
372 | */ |
373 | ASSIMP_API void aiGetMemoryRequirements( |
374 | const C_STRUCT aiScene *pIn, |
375 | C_STRUCT aiMemoryInfo *in); |
376 | |
377 | // -------------------------------------------------------------------------------- |
378 | /** Returns an embedded texture, or nullptr. |
379 | * @param pIn Input asset. |
380 | * @param filename Texture path extracted from aiGetMaterialString. |
381 | */ |
382 | ASSIMP_API const C_STRUCT aiTexture *aiGetEmbeddedTexture(const C_STRUCT aiScene *pIn, const char *filename); |
383 | |
384 | // -------------------------------------------------------------------------------- |
385 | /** Create an empty property store. Property stores are used to collect import |
386 | * settings. |
387 | * @return New property store. Property stores need to be manually destroyed using |
388 | * the #aiReleasePropertyStore API function. |
389 | */ |
390 | ASSIMP_API C_STRUCT aiPropertyStore *aiCreatePropertyStore(void); |
391 | |
392 | // -------------------------------------------------------------------------------- |
393 | /** Delete a property store. |
394 | * @param p Property store to be deleted. |
395 | */ |
396 | ASSIMP_API void aiReleasePropertyStore(C_STRUCT aiPropertyStore *p); |
397 | |
398 | // -------------------------------------------------------------------------------- |
399 | /** Set an integer property. |
400 | * |
401 | * This is the C-version of #Assimp::Importer::SetPropertyInteger(). In the C |
402 | * interface, properties are always shared by all imports. It is not possible to |
403 | * specify them per import. |
404 | * |
405 | * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store. |
406 | * @param szName Name of the configuration property to be set. All supported |
407 | * public properties are defined in the config.h header file (AI_CONFIG_XXX). |
408 | * @param value New value for the property |
409 | */ |
410 | ASSIMP_API void aiSetImportPropertyInteger( |
411 | C_STRUCT aiPropertyStore *store, |
412 | const char *szName, |
413 | int value); |
414 | |
415 | // -------------------------------------------------------------------------------- |
416 | /** Set a floating-point property. |
417 | * |
418 | * This is the C-version of #Assimp::Importer::SetPropertyFloat(). In the C |
419 | * interface, properties are always shared by all imports. It is not possible to |
420 | * specify them per import. |
421 | * |
422 | * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store. |
423 | * @param szName Name of the configuration property to be set. All supported |
424 | * public properties are defined in the config.h header file (AI_CONFIG_XXX). |
425 | * @param value New value for the property |
426 | */ |
427 | ASSIMP_API void aiSetImportPropertyFloat( |
428 | C_STRUCT aiPropertyStore *store, |
429 | const char *szName, |
430 | ai_real value); |
431 | |
432 | // -------------------------------------------------------------------------------- |
433 | /** Set a string property. |
434 | * |
435 | * This is the C-version of #Assimp::Importer::SetPropertyString(). In the C |
436 | * interface, properties are always shared by all imports. It is not possible to |
437 | * specify them per import. |
438 | * |
439 | * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store. |
440 | * @param szName Name of the configuration property to be set. All supported |
441 | * public properties are defined in the config.h header file (AI_CONFIG_XXX). |
442 | * @param st New value for the property |
443 | */ |
444 | ASSIMP_API void aiSetImportPropertyString( |
445 | C_STRUCT aiPropertyStore *store, |
446 | const char *szName, |
447 | const C_STRUCT aiString *st); |
448 | |
449 | // -------------------------------------------------------------------------------- |
450 | /** Set a matrix property. |
451 | * |
452 | * This is the C-version of #Assimp::Importer::SetPropertyMatrix(). In the C |
453 | * interface, properties are always shared by all imports. It is not possible to |
454 | * specify them per import. |
455 | * |
456 | * @param store Store to modify. Use #aiCreatePropertyStore to obtain a store. |
457 | * @param szName Name of the configuration property to be set. All supported |
458 | * public properties are defined in the config.h header file (AI_CONFIG_XXX). |
459 | * @param mat New value for the property |
460 | */ |
461 | ASSIMP_API void aiSetImportPropertyMatrix( |
462 | C_STRUCT aiPropertyStore *store, |
463 | const char *szName, |
464 | const C_STRUCT aiMatrix4x4 *mat); |
465 | |
466 | // -------------------------------------------------------------------------------- |
467 | /** Construct a quaternion from a 3x3 rotation matrix. |
468 | * @param quat Receives the output quaternion. |
469 | * @param mat Matrix to 'quaternionize'. |
470 | * @see aiQuaternion(const aiMatrix3x3& pRotMatrix) |
471 | */ |
472 | ASSIMP_API void aiCreateQuaternionFromMatrix( |
473 | C_STRUCT aiQuaternion *quat, |
474 | const C_STRUCT aiMatrix3x3 *mat); |
475 | |
476 | // -------------------------------------------------------------------------------- |
477 | /** Decompose a transformation matrix into its rotational, translational and |
478 | * scaling components. |
479 | * |
480 | * @param mat Matrix to decompose |
481 | * @param scaling Receives the scaling component |
482 | * @param rotation Receives the rotational component |
483 | * @param position Receives the translational component. |
484 | * @see aiMatrix4x4::Decompose (aiVector3D&, aiQuaternion&, aiVector3D&) const; |
485 | */ |
486 | ASSIMP_API void aiDecomposeMatrix( |
487 | const C_STRUCT aiMatrix4x4 *mat, |
488 | C_STRUCT aiVector3D *scaling, |
489 | C_STRUCT aiQuaternion *rotation, |
490 | C_STRUCT aiVector3D *position); |
491 | |
492 | // -------------------------------------------------------------------------------- |
493 | /** Transpose a 4x4 matrix. |
494 | * @param mat Pointer to the matrix to be transposed |
495 | */ |
496 | ASSIMP_API void aiTransposeMatrix4( |
497 | C_STRUCT aiMatrix4x4 *mat); |
498 | |
499 | // -------------------------------------------------------------------------------- |
500 | /** Transpose a 3x3 matrix. |
501 | * @param mat Pointer to the matrix to be transposed |
502 | */ |
503 | ASSIMP_API void aiTransposeMatrix3( |
504 | C_STRUCT aiMatrix3x3 *mat); |
505 | |
506 | // -------------------------------------------------------------------------------- |
507 | /** Transform a vector by a 3x3 matrix |
508 | * @param vec Vector to be transformed. |
509 | * @param mat Matrix to transform the vector with. |
510 | */ |
511 | ASSIMP_API void aiTransformVecByMatrix3( |
512 | C_STRUCT aiVector3D *vec, |
513 | const C_STRUCT aiMatrix3x3 *mat); |
514 | |
515 | // -------------------------------------------------------------------------------- |
516 | /** Transform a vector by a 4x4 matrix |
517 | * @param vec Vector to be transformed. |
518 | * @param mat Matrix to transform the vector with. |
519 | */ |
520 | ASSIMP_API void aiTransformVecByMatrix4( |
521 | C_STRUCT aiVector3D *vec, |
522 | const C_STRUCT aiMatrix4x4 *mat); |
523 | |
524 | // -------------------------------------------------------------------------------- |
525 | /** Multiply two 4x4 matrices. |
526 | * @param dst First factor, receives result. |
527 | * @param src Matrix to be multiplied with 'dst'. |
528 | */ |
529 | ASSIMP_API void aiMultiplyMatrix4( |
530 | C_STRUCT aiMatrix4x4 *dst, |
531 | const C_STRUCT aiMatrix4x4 *src); |
532 | |
533 | // -------------------------------------------------------------------------------- |
534 | /** Multiply two 3x3 matrices. |
535 | * @param dst First factor, receives result. |
536 | * @param src Matrix to be multiplied with 'dst'. |
537 | */ |
538 | ASSIMP_API void aiMultiplyMatrix3( |
539 | C_STRUCT aiMatrix3x3 *dst, |
540 | const C_STRUCT aiMatrix3x3 *src); |
541 | |
542 | // -------------------------------------------------------------------------------- |
543 | /** Get a 3x3 identity matrix. |
544 | * @param mat Matrix to receive its personal identity |
545 | */ |
546 | ASSIMP_API void aiIdentityMatrix3( |
547 | C_STRUCT aiMatrix3x3 *mat); |
548 | |
549 | // -------------------------------------------------------------------------------- |
550 | /** Get a 4x4 identity matrix. |
551 | * @param mat Matrix to receive its personal identity |
552 | */ |
553 | ASSIMP_API void aiIdentityMatrix4( |
554 | C_STRUCT aiMatrix4x4 *mat); |
555 | |
556 | // -------------------------------------------------------------------------------- |
557 | /** Returns the number of import file formats available in the current Assimp build. |
558 | * Use aiGetImportFormatDescription() to retrieve infos of a specific import format. |
559 | */ |
560 | ASSIMP_API size_t aiGetImportFormatCount(void); |
561 | |
562 | // -------------------------------------------------------------------------------- |
563 | /** Returns a description of the nth import file format. Use #aiGetImportFormatCount() |
564 | * to learn how many import formats are supported. |
565 | * @param pIndex Index of the import format to retrieve information for. Valid range is |
566 | * 0 to #aiGetImportFormatCount() |
567 | * @return A description of that specific import format. NULL if pIndex is out of range. |
568 | */ |
569 | ASSIMP_API const C_STRUCT aiImporterDesc *aiGetImportFormatDescription(size_t pIndex); |
570 | |
571 | // -------------------------------------------------------------------------------- |
572 | /** Check if 2D vectors are equal. |
573 | * @param a First vector to compare |
574 | * @param b Second vector to compare |
575 | * @return 1 if the vectors are equal |
576 | * @return 0 if the vectors are not equal |
577 | */ |
578 | ASSIMP_API int aiVector2AreEqual( |
579 | const C_STRUCT aiVector2D *a, |
580 | const C_STRUCT aiVector2D *b); |
581 | |
582 | // -------------------------------------------------------------------------------- |
583 | /** Check if 2D vectors are equal using epsilon. |
584 | * @param a First vector to compare |
585 | * @param b Second vector to compare |
586 | * @param epsilon Epsilon |
587 | * @return 1 if the vectors are equal |
588 | * @return 0 if the vectors are not equal |
589 | */ |
590 | ASSIMP_API int aiVector2AreEqualEpsilon( |
591 | const C_STRUCT aiVector2D *a, |
592 | const C_STRUCT aiVector2D *b, |
593 | const float epsilon); |
594 | |
595 | // -------------------------------------------------------------------------------- |
596 | /** Add 2D vectors. |
597 | * @param dst First addend, receives result. |
598 | * @param src Vector to be added to 'dst'. |
599 | */ |
600 | ASSIMP_API void aiVector2Add( |
601 | C_STRUCT aiVector2D *dst, |
602 | const C_STRUCT aiVector2D *src); |
603 | |
604 | // -------------------------------------------------------------------------------- |
605 | /** Subtract 2D vectors. |
606 | * @param dst Minuend, receives result. |
607 | * @param src Vector to be subtracted from 'dst'. |
608 | */ |
609 | ASSIMP_API void aiVector2Subtract( |
610 | C_STRUCT aiVector2D *dst, |
611 | const C_STRUCT aiVector2D *src); |
612 | |
613 | // -------------------------------------------------------------------------------- |
614 | /** Multiply a 2D vector by a scalar. |
615 | * @param dst Vector to be scaled by \p s |
616 | * @param s Scale factor |
617 | */ |
618 | ASSIMP_API void aiVector2Scale( |
619 | C_STRUCT aiVector2D *dst, |
620 | const float s); |
621 | |
622 | // -------------------------------------------------------------------------------- |
623 | /** Multiply each component of a 2D vector with |
624 | * the components of another vector. |
625 | * @param dst First vector, receives result |
626 | * @param other Second vector |
627 | */ |
628 | ASSIMP_API void aiVector2SymMul( |
629 | C_STRUCT aiVector2D *dst, |
630 | const C_STRUCT aiVector2D *other); |
631 | |
632 | // -------------------------------------------------------------------------------- |
633 | /** Divide a 2D vector by a scalar. |
634 | * @param dst Vector to be divided by \p s |
635 | * @param s Scalar divisor |
636 | */ |
637 | ASSIMP_API void aiVector2DivideByScalar( |
638 | C_STRUCT aiVector2D *dst, |
639 | const float s); |
640 | |
641 | // -------------------------------------------------------------------------------- |
642 | /** Divide each component of a 2D vector by |
643 | * the components of another vector. |
644 | * @param dst Vector as the dividend |
645 | * @param v Vector as the divisor |
646 | */ |
647 | ASSIMP_API void aiVector2DivideByVector( |
648 | C_STRUCT aiVector2D *dst, |
649 | C_STRUCT aiVector2D *v); |
650 | |
651 | // -------------------------------------------------------------------------------- |
652 | /** Get the length of a 2D vector. |
653 | * @return v Vector to evaluate |
654 | */ |
655 | ASSIMP_API ai_real aiVector2Length( |
656 | const C_STRUCT aiVector2D *v); |
657 | |
658 | // -------------------------------------------------------------------------------- |
659 | /** Get the squared length of a 2D vector. |
660 | * @return v Vector to evaluate |
661 | */ |
662 | ASSIMP_API ai_real aiVector2SquareLength( |
663 | const C_STRUCT aiVector2D *v); |
664 | |
665 | // -------------------------------------------------------------------------------- |
666 | /** Negate a 2D vector. |
667 | * @param dst Vector to be negated |
668 | */ |
669 | ASSIMP_API void aiVector2Negate( |
670 | C_STRUCT aiVector2D *dst); |
671 | |
672 | // -------------------------------------------------------------------------------- |
673 | /** Get the dot product of 2D vectors. |
674 | * @param a First vector |
675 | * @param b Second vector |
676 | * @return The dot product of vectors |
677 | */ |
678 | ASSIMP_API ai_real aiVector2DotProduct( |
679 | const C_STRUCT aiVector2D *a, |
680 | const C_STRUCT aiVector2D *b); |
681 | |
682 | // -------------------------------------------------------------------------------- |
683 | /** Normalize a 2D vector. |
684 | * @param v Vector to normalize |
685 | */ |
686 | ASSIMP_API void aiVector2Normalize( |
687 | C_STRUCT aiVector2D *v); |
688 | |
689 | // -------------------------------------------------------------------------------- |
690 | /** Check if 3D vectors are equal. |
691 | * @param a First vector to compare |
692 | * @param b Second vector to compare |
693 | * @return 1 if the vectors are equal |
694 | * @return 0 if the vectors are not equal |
695 | */ |
696 | ASSIMP_API int aiVector3AreEqual( |
697 | const C_STRUCT aiVector3D *a, |
698 | const C_STRUCT aiVector3D *b); |
699 | |
700 | // -------------------------------------------------------------------------------- |
701 | /** Check if 3D vectors are equal using epsilon. |
702 | * @param a First vector to compare |
703 | * @param b Second vector to compare |
704 | * @param epsilon Epsilon |
705 | * @return 1 if the vectors are equal |
706 | * @return 0 if the vectors are not equal |
707 | */ |
708 | ASSIMP_API int aiVector3AreEqualEpsilon( |
709 | const C_STRUCT aiVector3D *a, |
710 | const C_STRUCT aiVector3D *b, |
711 | const float epsilon); |
712 | |
713 | // -------------------------------------------------------------------------------- |
714 | /** Check if vector \p a is less than vector \p b. |
715 | * @param a First vector to compare |
716 | * @param b Second vector to compare |
717 | * @param epsilon Epsilon |
718 | * @return 1 if \p a is less than \p b |
719 | * @return 0 if \p a is equal or greater than \p b |
720 | */ |
721 | ASSIMP_API int aiVector3LessThan( |
722 | const C_STRUCT aiVector3D *a, |
723 | const C_STRUCT aiVector3D *b); |
724 | |
725 | // -------------------------------------------------------------------------------- |
726 | /** Add 3D vectors. |
727 | * @param dst First addend, receives result. |
728 | * @param src Vector to be added to 'dst'. |
729 | */ |
730 | ASSIMP_API void aiVector3Add( |
731 | C_STRUCT aiVector3D *dst, |
732 | const C_STRUCT aiVector3D *src); |
733 | |
734 | // -------------------------------------------------------------------------------- |
735 | /** Subtract 3D vectors. |
736 | * @param dst Minuend, receives result. |
737 | * @param src Vector to be subtracted from 'dst'. |
738 | */ |
739 | ASSIMP_API void aiVector3Subtract( |
740 | C_STRUCT aiVector3D *dst, |
741 | const C_STRUCT aiVector3D *src); |
742 | |
743 | // -------------------------------------------------------------------------------- |
744 | /** Multiply a 3D vector by a scalar. |
745 | * @param dst Vector to be scaled by \p s |
746 | * @param s Scale factor |
747 | */ |
748 | ASSIMP_API void aiVector3Scale( |
749 | C_STRUCT aiVector3D *dst, |
750 | const float s); |
751 | |
752 | // -------------------------------------------------------------------------------- |
753 | /** Multiply each component of a 3D vector with |
754 | * the components of another vector. |
755 | * @param dst First vector, receives result |
756 | * @param other Second vector |
757 | */ |
758 | ASSIMP_API void aiVector3SymMul( |
759 | C_STRUCT aiVector3D *dst, |
760 | const C_STRUCT aiVector3D *other); |
761 | |
762 | // -------------------------------------------------------------------------------- |
763 | /** Divide a 3D vector by a scalar. |
764 | * @param dst Vector to be divided by \p s |
765 | * @param s Scalar divisor |
766 | */ |
767 | ASSIMP_API void aiVector3DivideByScalar( |
768 | C_STRUCT aiVector3D *dst, |
769 | const float s); |
770 | |
771 | // -------------------------------------------------------------------------------- |
772 | /** Divide each component of a 3D vector by |
773 | * the components of another vector. |
774 | * @param dst Vector as the dividend |
775 | * @param v Vector as the divisor |
776 | */ |
777 | ASSIMP_API void aiVector3DivideByVector( |
778 | C_STRUCT aiVector3D *dst, |
779 | C_STRUCT aiVector3D *v); |
780 | |
781 | // -------------------------------------------------------------------------------- |
782 | /** Get the length of a 3D vector. |
783 | * @return v Vector to evaluate |
784 | */ |
785 | ASSIMP_API ai_real aiVector3Length( |
786 | const C_STRUCT aiVector3D *v); |
787 | |
788 | // -------------------------------------------------------------------------------- |
789 | /** Get the squared length of a 3D vector. |
790 | * @return v Vector to evaluate |
791 | */ |
792 | ASSIMP_API ai_real aiVector3SquareLength( |
793 | const C_STRUCT aiVector3D *v); |
794 | |
795 | // -------------------------------------------------------------------------------- |
796 | /** Negate a 3D vector. |
797 | * @param dst Vector to be negated |
798 | */ |
799 | ASSIMP_API void aiVector3Negate( |
800 | C_STRUCT aiVector3D *dst); |
801 | |
802 | // -------------------------------------------------------------------------------- |
803 | /** Get the dot product of 3D vectors. |
804 | * @param a First vector |
805 | * @param b Second vector |
806 | * @return The dot product of vectors |
807 | */ |
808 | ASSIMP_API ai_real aiVector3DotProduct( |
809 | const C_STRUCT aiVector3D *a, |
810 | const C_STRUCT aiVector3D *b); |
811 | |
812 | // -------------------------------------------------------------------------------- |
813 | /** Get cross product of 3D vectors. |
814 | * @param dst Vector to receive the result. |
815 | * @param a First vector |
816 | * @param b Second vector |
817 | * @return The dot product of vectors |
818 | */ |
819 | ASSIMP_API void aiVector3CrossProduct( |
820 | C_STRUCT aiVector3D *dst, |
821 | const C_STRUCT aiVector3D *a, |
822 | const C_STRUCT aiVector3D *b); |
823 | |
824 | // -------------------------------------------------------------------------------- |
825 | /** Normalize a 3D vector. |
826 | * @param v Vector to normalize |
827 | */ |
828 | ASSIMP_API void aiVector3Normalize( |
829 | C_STRUCT aiVector3D *v); |
830 | |
831 | // -------------------------------------------------------------------------------- |
832 | /** Check for division by zero and normalize a 3D vector. |
833 | * @param v Vector to normalize |
834 | */ |
835 | ASSIMP_API void aiVector3NormalizeSafe( |
836 | C_STRUCT aiVector3D *v); |
837 | |
838 | // -------------------------------------------------------------------------------- |
839 | /** Rotate a 3D vector by a quaternion. |
840 | * @param v The vector to rotate by \p q |
841 | * @param q Quaternion to use to rotate \p v |
842 | */ |
843 | ASSIMP_API void aiVector3RotateByQuaternion( |
844 | C_STRUCT aiVector3D *v, |
845 | const C_STRUCT aiQuaternion *q); |
846 | |
847 | // -------------------------------------------------------------------------------- |
848 | /** Construct a 3x3 matrix from a 4x4 matrix. |
849 | * @param dst Receives the output matrix |
850 | * @param mat The 4x4 matrix to use |
851 | */ |
852 | ASSIMP_API void aiMatrix3FromMatrix4( |
853 | C_STRUCT aiMatrix3x3 *dst, |
854 | const C_STRUCT aiMatrix4x4 *mat); |
855 | |
856 | // -------------------------------------------------------------------------------- |
857 | /** Construct a 3x3 matrix from a quaternion. |
858 | * @param mat Receives the output matrix |
859 | * @param q The quaternion matrix to use |
860 | */ |
861 | ASSIMP_API void aiMatrix3FromQuaternion( |
862 | C_STRUCT aiMatrix3x3 *mat, |
863 | const C_STRUCT aiQuaternion *q); |
864 | |
865 | // -------------------------------------------------------------------------------- |
866 | /** Check if 3x3 matrices are equal. |
867 | * @param a First matrix to compare |
868 | * @param b Second matrix to compare |
869 | * @return 1 if the matrices are equal |
870 | * @return 0 if the matrices are not equal |
871 | */ |
872 | ASSIMP_API int aiMatrix3AreEqual( |
873 | const C_STRUCT aiMatrix3x3 *a, |
874 | const C_STRUCT aiMatrix3x3 *b); |
875 | |
876 | // -------------------------------------------------------------------------------- |
877 | /** Check if 3x3 matrices are equal. |
878 | * @param a First matrix to compare |
879 | * @param b Second matrix to compare |
880 | * @param epsilon Epsilon |
881 | * @return 1 if the matrices are equal |
882 | * @return 0 if the matrices are not equal |
883 | */ |
884 | ASSIMP_API int aiMatrix3AreEqualEpsilon( |
885 | const C_STRUCT aiMatrix3x3 *a, |
886 | const C_STRUCT aiMatrix3x3 *b, |
887 | const float epsilon); |
888 | |
889 | // -------------------------------------------------------------------------------- |
890 | /** Invert a 3x3 matrix. |
891 | * @param mat Matrix to invert |
892 | */ |
893 | ASSIMP_API void aiMatrix3Inverse( |
894 | C_STRUCT aiMatrix3x3 *mat); |
895 | |
896 | // -------------------------------------------------------------------------------- |
897 | /** Get the determinant of a 3x3 matrix. |
898 | * @param mat Matrix to get the determinant from |
899 | */ |
900 | ASSIMP_API ai_real aiMatrix3Determinant( |
901 | const C_STRUCT aiMatrix3x3 *mat); |
902 | |
903 | // -------------------------------------------------------------------------------- |
904 | /** Get a 3x3 rotation matrix around the Z axis. |
905 | * @param mat Receives the output matrix |
906 | * @param angle Rotation angle, in radians |
907 | */ |
908 | ASSIMP_API void aiMatrix3RotationZ( |
909 | C_STRUCT aiMatrix3x3 *mat, |
910 | const float angle); |
911 | |
912 | // -------------------------------------------------------------------------------- |
913 | /** Returns a 3x3 rotation matrix for a rotation around an arbitrary axis. |
914 | * @param mat Receives the output matrix |
915 | * @param axis Rotation axis, should be a normalized vector |
916 | * @param angle Rotation angle, in radians |
917 | */ |
918 | ASSIMP_API void aiMatrix3FromRotationAroundAxis( |
919 | C_STRUCT aiMatrix3x3 *mat, |
920 | const C_STRUCT aiVector3D *axis, |
921 | const float angle); |
922 | |
923 | // -------------------------------------------------------------------------------- |
924 | /** Get a 3x3 translation matrix. |
925 | * @param mat Receives the output matrix |
926 | * @param translation The translation vector |
927 | */ |
928 | ASSIMP_API void aiMatrix3Translation( |
929 | C_STRUCT aiMatrix3x3 *mat, |
930 | const C_STRUCT aiVector2D *translation); |
931 | |
932 | // -------------------------------------------------------------------------------- |
933 | /** Create a 3x3 matrix that rotates one vector to another vector. |
934 | * @param mat Receives the output matrix |
935 | * @param from Vector to rotate from |
936 | * @param to Vector to rotate to |
937 | */ |
938 | ASSIMP_API void aiMatrix3FromTo( |
939 | C_STRUCT aiMatrix3x3 *mat, |
940 | const C_STRUCT aiVector3D *from, |
941 | const C_STRUCT aiVector3D *to); |
942 | |
943 | // -------------------------------------------------------------------------------- |
944 | /** Construct a 4x4 matrix from a 3x3 matrix. |
945 | * @param dst Receives the output matrix |
946 | * @param mat The 3x3 matrix to use |
947 | */ |
948 | ASSIMP_API void aiMatrix4FromMatrix3( |
949 | C_STRUCT aiMatrix4x4 *dst, |
950 | const C_STRUCT aiMatrix3x3 *mat); |
951 | |
952 | // -------------------------------------------------------------------------------- |
953 | /** Construct a 4x4 matrix from scaling, rotation and position. |
954 | * @param mat Receives the output matrix. |
955 | * @param scaling The scaling for the x,y,z axes |
956 | * @param rotation The rotation as a hamilton quaternion |
957 | * @param position The position for the x,y,z axes |
958 | */ |
959 | ASSIMP_API void aiMatrix4FromScalingQuaternionPosition( |
960 | C_STRUCT aiMatrix4x4 *mat, |
961 | const C_STRUCT aiVector3D *scaling, |
962 | const C_STRUCT aiQuaternion *rotation, |
963 | const C_STRUCT aiVector3D *position); |
964 | |
965 | // -------------------------------------------------------------------------------- |
966 | /** Add 4x4 matrices. |
967 | * @param dst First addend, receives result. |
968 | * @param src Matrix to be added to 'dst'. |
969 | */ |
970 | ASSIMP_API void aiMatrix4Add( |
971 | C_STRUCT aiMatrix4x4 *dst, |
972 | const C_STRUCT aiMatrix4x4 *src); |
973 | |
974 | // -------------------------------------------------------------------------------- |
975 | /** Check if 4x4 matrices are equal. |
976 | * @param a First matrix to compare |
977 | * @param b Second matrix to compare |
978 | * @return 1 if the matrices are equal |
979 | * @return 0 if the matrices are not equal |
980 | */ |
981 | ASSIMP_API int aiMatrix4AreEqual( |
982 | const C_STRUCT aiMatrix4x4 *a, |
983 | const C_STRUCT aiMatrix4x4 *b); |
984 | |
985 | // -------------------------------------------------------------------------------- |
986 | /** Check if 4x4 matrices are equal. |
987 | * @param a First matrix to compare |
988 | * @param b Second matrix to compare |
989 | * @param epsilon Epsilon |
990 | * @return 1 if the matrices are equal |
991 | * @return 0 if the matrices are not equal |
992 | */ |
993 | ASSIMP_API int aiMatrix4AreEqualEpsilon( |
994 | const C_STRUCT aiMatrix4x4 *a, |
995 | const C_STRUCT aiMatrix4x4 *b, |
996 | const float epsilon); |
997 | |
998 | // -------------------------------------------------------------------------------- |
999 | /** Invert a 4x4 matrix. |
1000 | * @param result Matrix to invert |
1001 | */ |
1002 | ASSIMP_API void aiMatrix4Inverse( |
1003 | C_STRUCT aiMatrix4x4 *mat); |
1004 | |
1005 | // -------------------------------------------------------------------------------- |
1006 | /** Get the determinant of a 4x4 matrix. |
1007 | * @param mat Matrix to get the determinant from |
1008 | * @return The determinant of the matrix |
1009 | */ |
1010 | ASSIMP_API ai_real aiMatrix4Determinant( |
1011 | const C_STRUCT aiMatrix4x4 *mat); |
1012 | |
1013 | // -------------------------------------------------------------------------------- |
1014 | /** Returns true of the matrix is the identity matrix. |
1015 | * @param mat Matrix to get the determinant from |
1016 | * @return 1 if \p mat is an identity matrix. |
1017 | * @return 0 if \p mat is not an identity matrix. |
1018 | */ |
1019 | ASSIMP_API int aiMatrix4IsIdentity( |
1020 | const C_STRUCT aiMatrix4x4 *mat); |
1021 | |
1022 | // -------------------------------------------------------------------------------- |
1023 | /** Decompose a transformation matrix into its scaling, |
1024 | * rotational as euler angles, and translational components. |
1025 | * |
1026 | * @param mat Matrix to decompose |
1027 | * @param scaling Receives the output scaling for the x,y,z axes |
1028 | * @param rotation Receives the output rotation as a Euler angles |
1029 | * @param position Receives the output position for the x,y,z axes |
1030 | */ |
1031 | ASSIMP_API void aiMatrix4DecomposeIntoScalingEulerAnglesPosition( |
1032 | const C_STRUCT aiMatrix4x4 *mat, |
1033 | C_STRUCT aiVector3D *scaling, |
1034 | C_STRUCT aiVector3D *rotation, |
1035 | C_STRUCT aiVector3D *position); |
1036 | |
1037 | // -------------------------------------------------------------------------------- |
1038 | /** Decompose a transformation matrix into its scaling, |
1039 | * rotational split into an axis and rotational angle, |
1040 | * and it's translational components. |
1041 | * |
1042 | * @param mat Matrix to decompose |
1043 | * @param rotation Receives the rotational component |
1044 | * @param axis Receives the output rotation axis |
1045 | * @param angle Receives the output rotation angle |
1046 | * @param position Receives the output position for the x,y,z axes. |
1047 | */ |
1048 | ASSIMP_API void aiMatrix4DecomposeIntoScalingAxisAnglePosition( |
1049 | const C_STRUCT aiMatrix4x4 *mat, |
1050 | C_STRUCT aiVector3D *scaling, |
1051 | C_STRUCT aiVector3D *axis, |
1052 | ai_real *angle, |
1053 | C_STRUCT aiVector3D *position); |
1054 | |
1055 | // -------------------------------------------------------------------------------- |
1056 | /** Decompose a transformation matrix into its rotational and |
1057 | * translational components. |
1058 | * |
1059 | * @param mat Matrix to decompose |
1060 | * @param rotation Receives the rotational component |
1061 | * @param position Receives the translational component. |
1062 | */ |
1063 | ASSIMP_API void aiMatrix4DecomposeNoScaling( |
1064 | const C_STRUCT aiMatrix4x4 *mat, |
1065 | C_STRUCT aiQuaternion *rotation, |
1066 | C_STRUCT aiVector3D *position); |
1067 | |
1068 | // -------------------------------------------------------------------------------- |
1069 | /** Creates a 4x4 matrix from a set of euler angles. |
1070 | * @param mat Receives the output matrix |
1071 | * @param x Rotation angle for the x-axis, in radians |
1072 | * @param y Rotation angle for the y-axis, in radians |
1073 | * @param z Rotation angle for the z-axis, in radians |
1074 | */ |
1075 | ASSIMP_API void aiMatrix4FromEulerAngles( |
1076 | C_STRUCT aiMatrix4x4 *mat, |
1077 | float x, float y, float z); |
1078 | |
1079 | // -------------------------------------------------------------------------------- |
1080 | /** Get a 4x4 rotation matrix around the X axis. |
1081 | * @param mat Receives the output matrix |
1082 | * @param angle Rotation angle, in radians |
1083 | */ |
1084 | ASSIMP_API void aiMatrix4RotationX( |
1085 | C_STRUCT aiMatrix4x4 *mat, |
1086 | const float angle); |
1087 | |
1088 | // -------------------------------------------------------------------------------- |
1089 | /** Get a 4x4 rotation matrix around the Y axis. |
1090 | * @param mat Receives the output matrix |
1091 | * @param angle Rotation angle, in radians |
1092 | */ |
1093 | ASSIMP_API void aiMatrix4RotationY( |
1094 | C_STRUCT aiMatrix4x4 *mat, |
1095 | const float angle); |
1096 | |
1097 | // -------------------------------------------------------------------------------- |
1098 | /** Get a 4x4 rotation matrix around the Z axis. |
1099 | * @param mat Receives the output matrix |
1100 | * @param angle Rotation angle, in radians |
1101 | */ |
1102 | ASSIMP_API void aiMatrix4RotationZ( |
1103 | C_STRUCT aiMatrix4x4 *mat, |
1104 | const float angle); |
1105 | |
1106 | // -------------------------------------------------------------------------------- |
1107 | /** Returns a 4x4 rotation matrix for a rotation around an arbitrary axis. |
1108 | * @param mat Receives the output matrix |
1109 | * @param axis Rotation axis, should be a normalized vector |
1110 | * @param angle Rotation angle, in radians |
1111 | */ |
1112 | ASSIMP_API void aiMatrix4FromRotationAroundAxis( |
1113 | C_STRUCT aiMatrix4x4 *mat, |
1114 | const C_STRUCT aiVector3D *axis, |
1115 | const float angle); |
1116 | |
1117 | // -------------------------------------------------------------------------------- |
1118 | /** Get a 4x4 translation matrix. |
1119 | * @param mat Receives the output matrix |
1120 | * @param translation The translation vector |
1121 | */ |
1122 | ASSIMP_API void aiMatrix4Translation( |
1123 | C_STRUCT aiMatrix4x4 *mat, |
1124 | const C_STRUCT aiVector3D *translation); |
1125 | |
1126 | // -------------------------------------------------------------------------------- |
1127 | /** Get a 4x4 scaling matrix. |
1128 | * @param mat Receives the output matrix |
1129 | * @param scaling The scaling vector |
1130 | */ |
1131 | ASSIMP_API void aiMatrix4Scaling( |
1132 | C_STRUCT aiMatrix4x4 *mat, |
1133 | const C_STRUCT aiVector3D *scaling); |
1134 | |
1135 | // -------------------------------------------------------------------------------- |
1136 | /** Create a 4x4 matrix that rotates one vector to another vector. |
1137 | * @param mat Receives the output matrix |
1138 | * @param from Vector to rotate from |
1139 | * @param to Vector to rotate to |
1140 | */ |
1141 | ASSIMP_API void aiMatrix4FromTo( |
1142 | C_STRUCT aiMatrix4x4 *mat, |
1143 | const C_STRUCT aiVector3D *from, |
1144 | const C_STRUCT aiVector3D *to); |
1145 | |
1146 | // -------------------------------------------------------------------------------- |
1147 | /** Create a Quaternion from euler angles. |
1148 | * @param q Receives the output quaternion |
1149 | * @param x Rotation angle for the x-axis, in radians |
1150 | * @param y Rotation angle for the y-axis, in radians |
1151 | * @param z Rotation angle for the z-axis, in radians |
1152 | */ |
1153 | ASSIMP_API void aiQuaternionFromEulerAngles( |
1154 | C_STRUCT aiQuaternion *q, |
1155 | float x, float y, float z); |
1156 | |
1157 | // -------------------------------------------------------------------------------- |
1158 | /** Create a Quaternion from an axis angle pair. |
1159 | * @param q Receives the output quaternion |
1160 | * @param axis The orientation axis |
1161 | * @param angle The rotation angle, in radians |
1162 | */ |
1163 | ASSIMP_API void aiQuaternionFromAxisAngle( |
1164 | C_STRUCT aiQuaternion *q, |
1165 | const C_STRUCT aiVector3D *axis, |
1166 | const float angle); |
1167 | |
1168 | // -------------------------------------------------------------------------------- |
1169 | /** Create a Quaternion from a normalized quaternion stored |
1170 | * in a 3D vector. |
1171 | * @param q Receives the output quaternion |
1172 | * @param normalized The vector that stores the quaternion |
1173 | */ |
1174 | ASSIMP_API void aiQuaternionFromNormalizedQuaternion( |
1175 | C_STRUCT aiQuaternion *q, |
1176 | const C_STRUCT aiVector3D *normalized); |
1177 | |
1178 | // -------------------------------------------------------------------------------- |
1179 | /** Check if quaternions are equal. |
1180 | * @param a First quaternion to compare |
1181 | * @param b Second quaternion to compare |
1182 | * @return 1 if the quaternions are equal |
1183 | * @return 0 if the quaternions are not equal |
1184 | */ |
1185 | ASSIMP_API int aiQuaternionAreEqual( |
1186 | const C_STRUCT aiQuaternion *a, |
1187 | const C_STRUCT aiQuaternion *b); |
1188 | |
1189 | // -------------------------------------------------------------------------------- |
1190 | /** Check if quaternions are equal using epsilon. |
1191 | * @param a First quaternion to compare |
1192 | * @param b Second quaternion to compare |
1193 | * @param epsilon Epsilon |
1194 | * @return 1 if the quaternions are equal |
1195 | * @return 0 if the quaternions are not equal |
1196 | */ |
1197 | ASSIMP_API int aiQuaternionAreEqualEpsilon( |
1198 | const C_STRUCT aiQuaternion *a, |
1199 | const C_STRUCT aiQuaternion *b, |
1200 | const float epsilon); |
1201 | |
1202 | // -------------------------------------------------------------------------------- |
1203 | /** Normalize a quaternion. |
1204 | * @param q Quaternion to normalize |
1205 | */ |
1206 | ASSIMP_API void aiQuaternionNormalize( |
1207 | C_STRUCT aiQuaternion *q); |
1208 | |
1209 | // -------------------------------------------------------------------------------- |
1210 | /** Compute quaternion conjugate. |
1211 | * @param q Quaternion to compute conjugate, |
1212 | * receives the output quaternion |
1213 | */ |
1214 | ASSIMP_API void aiQuaternionConjugate( |
1215 | C_STRUCT aiQuaternion *q); |
1216 | |
1217 | // -------------------------------------------------------------------------------- |
1218 | /** Multiply quaternions. |
1219 | * @param dst First quaternion, receives the output quaternion |
1220 | * @param q Second quaternion |
1221 | */ |
1222 | ASSIMP_API void aiQuaternionMultiply( |
1223 | C_STRUCT aiQuaternion *dst, |
1224 | const C_STRUCT aiQuaternion *q); |
1225 | |
1226 | // -------------------------------------------------------------------------------- |
1227 | /** Performs a spherical interpolation between two quaternions. |
1228 | * @param dst Receives the quaternion resulting from the interpolation. |
1229 | * @param start Quaternion when factor == 0 |
1230 | * @param end Quaternion when factor == 1 |
1231 | * @param factor Interpolation factor between 0 and 1 |
1232 | */ |
1233 | ASSIMP_API void aiQuaternionInterpolate( |
1234 | C_STRUCT aiQuaternion *dst, |
1235 | const C_STRUCT aiQuaternion *start, |
1236 | const C_STRUCT aiQuaternion *end, |
1237 | const float factor); |
1238 | |
1239 | #ifdef __cplusplus |
1240 | } |
1241 | #endif |
1242 | |
1243 | #endif // AI_ASSIMP_H_INC |
1244 | |