42using AiArrayDestroyCB = void (*)(uint8_t nbuffer,
const void **buffers,
const void *userData);
44AI_API AtArray*
AiArray(uint32_t nelements, uint8_t nkeys,
int type, ...);
45AI_API AtArray*
AiArrayAllocate(uint32_t nelements, uint8_t nkeys, uint8_t type);
46AI_API AtArray*
AiArrayMakeShared(uint32_t nelements, uint8_t nkeys, uint8_t type,
const void** buffers,
AiArrayDestroyCB callback=
nullptr,
void *callback_data=
nullptr);
48AI_API AtArray*
AiArrayConvert(uint32_t nelements, uint8_t nkeys, uint8_t type,
const void* data);
49AI_API
void AiArrayResize(AtArray* array, uint32_t nelements, uint8_t nkeys);
51AI_API
bool AiArraySetKey(AtArray* array, uint8_t key,
const void* data);
77AI_API AI_PURE
bool AiArrayGetBool (
const AtArray* a, uint32_t i);
78AI_API AI_PURE uint8_t AiArrayGetByte (
const AtArray* a, uint32_t i);
79AI_API AI_PURE
int AiArrayGetInt (
const AtArray* a, uint32_t i);
80AI_API AI_PURE uint32_t AiArrayGetUInt (
const AtArray* a, uint32_t i);
81AI_API AI_PURE
float AiArrayGetFlt (
const AtArray* a, uint32_t i);
82AI_API AI_PURE
AtRGB AiArrayGetRGB (
const AtArray* a, uint32_t i);
83AI_API AI_PURE
AtRGBA AiArrayGetRGBA (
const AtArray* a, uint32_t i);
84AI_API AI_PURE
AtVector2 AiArrayGetVec2 (
const AtArray* a, uint32_t i);
85AI_API AI_PURE
AtVector AiArrayGetVec (
const AtArray* a, uint32_t i);
86AI_API AI_PURE
AtMatrix AiArrayGetMtx (
const AtArray* a, uint32_t i);
87AI_API AI_PURE
AtString AiArrayGetStr (
const AtArray* a, uint32_t i);
88AI_API AI_PURE
void* AiArrayGetPtr (
const AtArray* a, uint32_t i);
89AI_API AI_PURE AtArray* AiArrayGetArray(
const AtArray* a, uint32_t i);
101AI_API
bool AiArraySetBool (AtArray* a, uint32_t i,
bool val);
102AI_API
bool AiArraySetByte (AtArray* a, uint32_t i, uint8_t val);
103AI_API
bool AiArraySetInt (AtArray* a, uint32_t i,
int val);
104AI_API
bool AiArraySetUInt (AtArray* a, uint32_t i, uint32_t val);
105AI_API
bool AiArraySetFlt (AtArray* a, uint32_t i,
float val);
106AI_API
bool AiArraySetRGB (AtArray* a, uint32_t i,
AtRGB val);
107AI_API
bool AiArraySetRGBA (AtArray* a, uint32_t i,
AtRGBA val);
108AI_API
bool AiArraySetVec2 (AtArray* a, uint32_t i,
AtVector2 val);
109AI_API
bool AiArraySetVec (AtArray* a, uint32_t i,
AtVector val);
110AI_API
bool AiArraySetMtx (AtArray* a, uint32_t i,
AtMatrix val);
111AI_API
bool AiArraySetStr (AtArray* a, uint32_t i,
AtString val);
112AI_API
bool AiArraySetPtr (AtArray* a, uint32_t i,
void* val);
113AI_API
bool AiArraySetArray(AtArray* a, uint32_t i, AtArray* val);
118#ifdef AI_CPU_COMPILER
120inline bool AiArraySetStr(AtArray* a, uint32_t i,
const char* val)
122 return AiArraySetStr(a, i,
AtString(val));
140inline AtArray*
AiArray(uint32_t nelements, uint8_t nkeys,
int type,
AtVector v1) {
141 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf3>(v1));
144 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf3>(v1), reinterpret_type<POD_tempf3>(v2));
147 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf3>(v1), reinterpret_type<POD_tempf3>(v2), reinterpret_type<POD_tempf3>(v3));
150 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf3>(v1), reinterpret_type<POD_tempf3>(v2), reinterpret_type<POD_tempf3>(v3), reinterpret_type<POD_tempf3>(v4));
153 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf3>(v1), reinterpret_type<POD_tempf3>(v2), reinterpret_type<POD_tempf3>(v3), reinterpret_type<POD_tempf3>(v4), reinterpret_type<POD_tempf3>(v5));
156inline AtArray*
AiArray(uint32_t nelements, uint8_t nkeys,
int type,
AtVector2 v1) {
157 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf2>(v1));
160 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf2>(v1), reinterpret_type<POD_tempf2>(v2));
163 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf2>(v1), reinterpret_type<POD_tempf2>(v2), reinterpret_type<POD_tempf2>(v3));
166 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf2>(v1), reinterpret_type<POD_tempf2>(v2), reinterpret_type<POD_tempf2>(v3), reinterpret_type<POD_tempf2>(v4));
169 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf2>(v1), reinterpret_type<POD_tempf2>(v2), reinterpret_type<POD_tempf2>(v3), reinterpret_type<POD_tempf2>(v4), reinterpret_type<POD_tempf2>(v5));
172inline AtArray*
AiArray(uint32_t nelements, uint8_t nkeys,
int type,
AtRGB v1) {
173 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf3>(v1));
175inline AtArray*
AiArray(uint32_t nelements, uint8_t nkeys,
int type,
AtRGB v1,
AtRGB v2) {
176 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf3>(v1), reinterpret_type<POD_tempf3>(v2));
179 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf3>(v1), reinterpret_type<POD_tempf3>(v2), reinterpret_type<POD_tempf3>(v3));
182 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf3>(v1), reinterpret_type<POD_tempf3>(v2), reinterpret_type<POD_tempf3>(v3), reinterpret_type<POD_tempf3>(v4));
185 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf3>(v1), reinterpret_type<POD_tempf3>(v2), reinterpret_type<POD_tempf3>(v3), reinterpret_type<POD_tempf3>(v4), reinterpret_type<POD_tempf3>(v5));
188inline AtArray*
AiArray(uint32_t nelements, uint8_t nkeys,
int type,
AtRGBA v1) {
189 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf4>(v1));
191inline AtArray*
AiArray(uint32_t nelements, uint8_t nkeys,
int type,
AtRGBA v1,
AtRGBA v2) {
192 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf4>(v1), reinterpret_type<POD_tempf4>(v2));
195 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf4>(v1), reinterpret_type<POD_tempf4>(v2), reinterpret_type<POD_tempf4>(v3));
198 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf4>(v1), reinterpret_type<POD_tempf4>(v2), reinterpret_type<POD_tempf4>(v3), reinterpret_type<POD_tempf4>(v4));
201 return AiArray(nelements, nkeys, type, reinterpret_type<POD_tempf4>(v1), reinterpret_type<POD_tempf4>(v2), reinterpret_type<POD_tempf4>(v3), reinterpret_type<POD_tempf4>(v4), reinterpret_type<POD_tempf4>(v5));
DLL export prefix for API functions (necessary for multi-platform development)
Color types and utilities.
Matrix math type and methods.
AtString class for fast comparisons.
Vector math types, operators and utilities.
Arnold String allows for fast string comparisons.
Definition: ai_string.h:54
AI_API void AiArrayUnmapConst(const AtArray *array)
Notifies the array that reading is finished.
Definition: ai_array.cpp:323
AI_API AI_PURE AtRGBA AiArrayInterpolateRGBA(const AtArray *array, float time, uint32_t idx)
Interpolate an AtRGBA at a given time from an array.
Definition: ai_array.cpp:444
void(*)(uint8_t nbuffer, const void **buffers, const void *userData) AiArrayDestroyCB
Shared array callback function that is passed to the client to notify him it can release the buffers ...
Definition: ai_array.h:42
AI_API AtArray * AiArrayCopy(const AtArray *array)
Create a copy of an array.
Definition: ai_array.cpp:169
AI_API const void * AiArrayMapKeyConst(const AtArray *array, uint8_t key)
Obtains a const pointer to a specific key in the internal array data for reading.
Definition: ai_array.cpp:291
AI_API AtArray * AiArrayConvert(uint32_t nelements, uint8_t nkeys, uint8_t type, const void *data)
Create an array and initialize it from an existing data buffer.
Definition: ai_array.cpp:138
AI_API AI_PURE size_t AiArrayGetKeySize(const AtArray *array)
Get the total size in bytes of the data for one key.
Definition: ai_array.cpp:379
AI_API AtArray * AiArray(uint32_t nelements, uint8_t nkeys, int type,...)
Create an array and initialize it with supplied data.
Definition: ai_array.cpp:94
AI_API AI_PURE uint8_t AiArrayGetNumKeys(const AtArray *array)
Get the number of keys.
Definition: ai_array.cpp:346
AI_API void AiArrayDestroy(AtArray *array)
Deallocate an array object.
Definition: ai_array.cpp:61
AI_API AI_PURE uint32_t AiArrayGetNumElements(const AtArray *array)
Get the number of elements on each key of the array.
Definition: ai_array.cpp:335
AI_API AI_PURE AtMatrix AiArrayInterpolateMtx(const AtArray *array, float time, uint32_t idx)
Interpolate a matrix at a given time from an array.
Definition: ai_array.cpp:418
AI_API void * AiArrayMap(AtArray *array)
Obtains a pointer to the internal array data for construction.
Definition: ai_array.cpp:238
AI_API AtArray * AiArrayAllocate(uint32_t nelements, uint8_t nkeys, uint8_t type)
Create an empty (uninitialized) array of the specified type.
Definition: ai_array.cpp:29
AI_API const void * AiArrayMapConst(const AtArray *array)
Obtains a pointer to the internal array data for reading.
Definition: ai_array.cpp:255
AI_API AtArray * AiArrayMakeShared(uint32_t nelements, uint8_t nkeys, uint8_t type, const void **buffers, AiArrayDestroyCB callback=nullptr, void *callback_data=nullptr)
Create a shared read only array holding buffer pointing to the key buffers allocated by the client.
Definition: ai_array.cpp:51
AI_API AI_PURE float AiArrayInterpolateFlt(const AtArray *array, float time, uint32_t idx)
Interpolate a float at a given time from an array.
Definition: ai_array.cpp:405
AI_API AI_PURE AtRGB AiArrayInterpolateRGB(const AtArray *array, float time, uint32_t idx)
Interpolate a color at a given time from an array.
Definition: ai_array.cpp:431
AI_API AI_PURE AtVector AiArrayInterpolateVec(const AtArray *array, float time, uint32_t idx)
Interpolate a vector at a given time from an array.
Definition: ai_array.cpp:392
AI_API bool AiArraySetKey(AtArray *array, uint8_t key, const void *data)
Initializes data for all the elements in a specific key of an array.
Definition: ai_array.cpp:205
AI_API AI_PURE uint8_t AiArrayGetType(const AtArray *array)
Get the type of array elements.
Definition: ai_array.cpp:357
AI_API void * AiArrayMapKey(AtArray *array, uint8_t key)
Obtains a pointer to a specific key in the internal array data for construction.
Definition: ai_array.cpp:273
AI_API void AiArrayUnmap(AtArray *array)
Notifies the array that construction is finished.
Definition: ai_array.cpp:307
AI_API AI_PURE size_t AiArrayGetDataSize(const AtArray *array)
Get the total size in bytes of the data buffer for this array.
Definition: ai_array.cpp:368
AI_API void AiArrayResize(AtArray *array, uint32_t nelements, uint8_t nkeys)
Resize an existing array contents in place.
Definition: ai_array.cpp:153
Definition: ai_matrix.h:30
RGB color + alpha.
Definition: ai_color.h:267
RGB color.
Definition: ai_color.h:32
2D point
Definition: ai_vector.h:255
3D point (single precision)
Definition: ai_vector.h:30
Definition: ai_array.h:136
Definition: ai_array.h:137
Definition: ai_array.h:138