prepare for removal of hardcoded struct and primitive sizes.
added getter to determine struct and primitive sizes. (cleanup in the java code can be done later.)pull/517/head
parent
d2d41a8aee
commit
79768ddc14
|
@ -1344,7 +1344,55 @@ JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getVKeysize
|
|||
(JNIEnv *env, jclass jClazz)
|
||||
{
|
||||
const int res = sizeof(aiVectorKey);
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getQKeysize
|
||||
(JNIEnv *env, jclass jClazz)
|
||||
{
|
||||
const int res = sizeof(aiQuatKey);
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getV3Dsize
|
||||
(JNIEnv *env, jclass jClazz)
|
||||
{
|
||||
const int res = sizeof(aiVector3D);
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getfloatsize
|
||||
(JNIEnv *env, jclass jClazz)
|
||||
{
|
||||
const int res = sizeof(float);
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getintsize
|
||||
(JNIEnv *env, jclass jClazz)
|
||||
{
|
||||
const int res = sizeof(int);
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getuintsize
|
||||
(JNIEnv *env, jclass jClazz)
|
||||
{
|
||||
const int res = sizeof(unsigned int);
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getdoubletsize
|
||||
(JNIEnv *env, jclass jClazz)
|
||||
{
|
||||
const int res = sizeof(double);
|
||||
return res;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getlongsize
|
||||
(JNIEnv *env, jclass jClazz)
|
||||
{
|
||||
const int res = sizeof(long);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,20 @@ extern "C" {
|
|||
#endif
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getVKeysize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getQKeysize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getV3Dsize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getfloatsize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getintsize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getuintsize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getdoublesize
|
||||
(JNIEnv *, jclass);
|
||||
JNIEXPORT jint JNICALL Java_jassimp_Jassimp_getlongsize
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: jassimp_Jassimp
|
||||
|
|
|
@ -140,13 +140,17 @@ public final class AiMesh {
|
|||
/**
|
||||
* Number of bytes per float value.
|
||||
*/
|
||||
private static final int SIZEOF_FLOAT = 4;
|
||||
|
||||
|
||||
private static final int SIZEOF_FLOAT = Jassimp.NATIVE_FLOAT_SIZE;
|
||||
|
||||
/**
|
||||
* Number of bytes per int value.
|
||||
*/
|
||||
private static final int SIZEOF_INT = 4;
|
||||
private static final int SIZEOF_INT = Jassimp.NATIVE_INT_SIZE;
|
||||
|
||||
/**
|
||||
* Size of an AiVector3D in the native world.
|
||||
*/
|
||||
private static final int SIZEOF_V3D = Jassimp.NATIVE_AIVEKTOR3D_SIZE;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -70,17 +70,17 @@ public final class AiNodeAnim {
|
|||
/**
|
||||
* Size of one position key entry.
|
||||
*/
|
||||
private static final int POS_KEY_SIZE = Jassimp.getVKeysize();
|
||||
private static final int POS_KEY_SIZE = Jassimp.NATIVE_AIVEKTORKEY_SIZE;
|
||||
|
||||
/**
|
||||
* Size of one rotation key entry.
|
||||
*/
|
||||
private static final int ROT_KEY_SIZE = 24;
|
||||
private static final int ROT_KEY_SIZE = Jassimp.NATIVE_AIQUATKEY_SIZE;
|
||||
|
||||
/**
|
||||
* Size of one scaling key entry.
|
||||
*/
|
||||
private static final int SCALE_KEY_SIZE = Jassimp.getVKeysize();
|
||||
private static final int SCALE_KEY_SIZE = Jassimp.NATIVE_AIVEKTORKEY_SIZE;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -97,12 +97,47 @@ public final class Jassimp {
|
|||
|
||||
|
||||
/**
|
||||
* Returns the size of a struct.<p>
|
||||
* Returns the size of a struct or ptimitive.<p>
|
||||
*
|
||||
* @return the result of sizeof call
|
||||
*/
|
||||
public static native int getVKeysize();
|
||||
|
||||
/**
|
||||
* @see #getVKeysize
|
||||
*/
|
||||
public static native int getQKeysize();
|
||||
|
||||
/**
|
||||
* @see #getVKeysize
|
||||
*/
|
||||
public static native int getV3Dsize();
|
||||
|
||||
/**
|
||||
* @see #getVKeysize
|
||||
*/
|
||||
public static native int getfloatsize();
|
||||
|
||||
/**
|
||||
* @see #getVKeysize
|
||||
*/
|
||||
public static native int getintsize();
|
||||
|
||||
/**
|
||||
* @see #getVKeysize
|
||||
*/
|
||||
public static native int getuintsize();
|
||||
|
||||
/**
|
||||
* @see #getVKeysize
|
||||
*/
|
||||
public static native int getboublesize();
|
||||
|
||||
/**
|
||||
* @see #getVKeysize
|
||||
*/
|
||||
public static native int getlongsize();
|
||||
|
||||
/**
|
||||
* Returns a human readable error description.<p>
|
||||
*
|
||||
|
@ -256,8 +291,24 @@ public final class Jassimp {
|
|||
/* nothing to do */
|
||||
}
|
||||
|
||||
|
||||
public static final int NATIVE_AIVEKTORKEY_SIZE;
|
||||
public static final int NATIVE_AIQUATKEY_SIZE;
|
||||
public static final int NATIVE_AIVEKTOR3D_SIZE;
|
||||
public static final int NATIVE_FLOAT_SIZE;
|
||||
public static final int NATIVE_INT_SIZE;
|
||||
public static final int NATIVE_UINT_SIZE;
|
||||
public static final int NATIVE_DOUBLE_SIZE;
|
||||
public static final int NATIVE_LONG_SIZE;
|
||||
|
||||
static {
|
||||
System.loadLibrary("jassimp");
|
||||
NATIVE_AIVEKTORKEY_SIZE = getVKeysize();
|
||||
NATIVE_AIQUATKEY_SIZE = getQKeysize();
|
||||
NATIVE_AIVEKTOR3D_SIZE = getV3Dsize();
|
||||
NATIVE_FLOAT_SIZE = getfloatsize();
|
||||
NATIVE_INT_SIZE = getintsize();
|
||||
NATIVE_UINT_SIZE = getuintsize();
|
||||
NATIVE_DOUBLE_SIZE = getdoublesize();
|
||||
NATIVE_LONG_SIZE = getlongsize();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue