void Matrix4_to_btTransform(JNIEnv * const &jenv, btTransform &target, jobject &source) { matrix4_ensurefields(jenv, source); jfloatArray valArray = (jfloatArray) jenv->GetObjectField(source, matrix4_val); jfloat * elements = jenv->GetFloatArrayElements(valArray, NULL); target.setFromOpenGLMatrix(elements); jenv->ReleaseFloatArrayElements(valArray, elements, JNI_ABORT); jenv->DeleteLocalRef(valArray); }
void btTransform_to_Matrix4(JNIEnv * const &jenv, jobject &target, const btTransform &source) { matrix4_ensurefields(jenv, target); jfloatArray valArray = (jfloatArray) jenv->GetObjectField(target, matrix4_val); jfloat * elements = jenv->GetFloatArrayElements(valArray, NULL); source.getOpenGLMatrix(elements); jenv->ReleaseFloatArrayElements(valArray, elements, 0); jenv->DeleteLocalRef(valArray); }
void btTransform_to_Matrix4(JNIEnv * const &jenv, jobject &target, const btTransform &source) { matrix4_ensurefields(jenv, target); jfloatArray valArray = (jfloatArray) jenv->GetObjectField(target, matrix4_val); jfloat * elements = jenv->GetFloatArrayElements(valArray, NULL); ATTRIBUTE_ALIGNED16(btScalar dst[16]); source.getOpenGLMatrix(dst); memcpy(elements, dst, sizeof(btScalar)*16); jenv->ReleaseFloatArrayElements(valArray, elements, 0); jenv->DeleteLocalRef(valArray); }