Added ASSIMP_API to aiCreateQuaternionFromMatrix and aiDecomposeMatrix.
Added aiDecomposeMatrix to PyAssimp. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@410 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
e4cddb9e9d
commit
b2ffa9dd1b
|
@ -368,13 +368,13 @@ ASSIMP_API void aiSetImportPropertyString(const char* szName,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void aiCreateQuaternionFromMatrix(aiQuaternion* quat,const aiMatrix3x3* mat)
|
ASSIMP_API void aiCreateQuaternionFromMatrix(aiQuaternion* quat,const aiMatrix3x3* mat)
|
||||||
{
|
{
|
||||||
*quat = aiQuaternion(*mat);
|
*quat = aiQuaternion(*mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void aiDecomposeMatrix(const aiMatrix4x4* mat, aiVector3D* scaling,
|
ASSIMP_API void aiDecomposeMatrix(const aiMatrix4x4* mat, aiVector3D* scaling,
|
||||||
aiQuaternion* rotation,aiVector3D* position)
|
aiQuaternion* rotation,aiVector3D* position)
|
||||||
{
|
{
|
||||||
mat->Decompose(*scaling,*rotation,*position);
|
mat->Decompose(*scaling,*rotation,*position);
|
||||||
|
|
|
@ -181,12 +181,12 @@ ASSIMP_API void aiSetImportPropertyString(const char* szName,
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @see aiQuaternion(const aiMatrix3x3& pRotMatrix)
|
/** @see aiQuaternion(const aiMatrix3x3& pRotMatrix)
|
||||||
*/
|
*/
|
||||||
void aiCreateQuaternionFromMatrix(C_STRUCT aiQuaternion* quat,const C_STRUCT aiMatrix3x3* mat);
|
ASSIMP_API void aiCreateQuaternionFromMatrix(C_STRUCT aiQuaternion* quat,const C_STRUCT aiMatrix3x3* mat);
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/** @see aiMatrix4x4::Decompose (aiVector3D&, aiQuaternion&, aiVector3D&) const;
|
/** @see aiMatrix4x4::Decompose (aiVector3D&, aiQuaternion&, aiVector3D&) const;
|
||||||
*/
|
*/
|
||||||
void aiDecomposeMatrix(const C_STRUCT aiMatrix4x4* mat,
|
ASSIMP_API void aiDecomposeMatrix(const C_STRUCT aiMatrix4x4* mat,
|
||||||
C_STRUCT aiVector3D* scaling,
|
C_STRUCT aiVector3D* scaling,
|
||||||
C_STRUCT aiQuaternion* rotation,
|
C_STRUCT aiQuaternion* rotation,
|
||||||
C_STRUCT aiVector3D* position);
|
C_STRUCT aiVector3D* position);
|
||||||
|
|
|
@ -96,6 +96,10 @@ class aiTuple:
|
||||||
return self._GetData(c)
|
return self._GetData(c)
|
||||||
|
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
|
if isinstance(index, slice):
|
||||||
|
indices = index.indices(len(self))
|
||||||
|
return [self.__getitem__(i) for i in range(*indices)]
|
||||||
|
|
||||||
if index < 0 or index >= self._GetSize():
|
if index < 0 or index >= self._GetSize():
|
||||||
raise IndexError("aiTuple index out of range")
|
raise IndexError("aiTuple index out of range")
|
||||||
return self._GetData(index)
|
return self._GetData(index)
|
||||||
|
@ -103,6 +107,9 @@ class aiTuple:
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return int(self._GetSize())
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str([x for x in self])
|
return str([x for x in self])
|
||||||
|
|
||||||
|
@ -218,7 +225,7 @@ def aiGetMaterialString(material, key):
|
||||||
byref(out))
|
byref(out))
|
||||||
|
|
||||||
if (r != AI_SUCCESS):
|
if (r != AI_SUCCESS):
|
||||||
raise AssimpError("aiGetMaterialFloatArray failed!")
|
raise AssimpError("aiGetMaterialString failed!")
|
||||||
|
|
||||||
return str(out.data)
|
return str(out.data)
|
||||||
|
|
||||||
|
@ -249,3 +256,16 @@ def GetMaterialProperties(material):
|
||||||
result[key] = value
|
result[key] = value
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def aiDecomposeMatrix(matrix):
|
||||||
|
if not isinstance(matrix, structs.Matrix4x4):
|
||||||
|
raise AssimpError("aiDecomposeMatrix failed: Not a aiMatrix4x4!")
|
||||||
|
|
||||||
|
scaling = structs.Vector3D()
|
||||||
|
rotation = structs.Quaternion()
|
||||||
|
position = structs.Vector3D()
|
||||||
|
|
||||||
|
from ctypes import byref, pointer
|
||||||
|
_assimp_lib.dll.aiDecomposeMatrix(pointer(matrix), byref(scaling), byref(rotation), byref(position))
|
||||||
|
return scaling._init(), rotation._init(), position._init()
|
Loading…
Reference in New Issue