浏览代码

Merge pull request #517 from arris69/FixJava_final

Fix java final (afterparty)
Alexander Gessler 10 年之前
父节点
当前提交
dcc8aa092a

+ 51 - 3
port/jassimp/jassimp-native/src/jassimp.cpp

@@ -284,7 +284,7 @@ static bool copyBuffer(JNIEnv *env, jobject jMesh, const char* jBufferName, void
 
 	if (env->GetDirectBufferCapacity(jBuffer) != size)
 	{
-		lprintf("invalid direct buffer, expected %u, got %u\n", size, env->GetDirectBufferCapacity(jBuffer));
+		lprintf("invalid direct buffer, expected %u, got %llu\n", size, env->GetDirectBufferCapacity(jBuffer));
 		return false;
 	}
 
@@ -315,7 +315,7 @@ static bool copyBufferArray(JNIEnv *env, jobject jMesh, const char* jBufferName,
 
 	if (env->GetDirectBufferCapacity(jBuffer) != size)
 	{
-		lprintf("invalid direct buffer, expected %u, got %u\n", size, env->GetDirectBufferCapacity(jBuffer));
+		lprintf("invalid direct buffer, expected %u, got %llu\n", size, env->GetDirectBufferCapacity(jBuffer));
 		return false;
 	}
 
@@ -839,7 +839,7 @@ static bool loadMaterials(JNIEnv *env, const aiScene* cScene, jobject& jScene)
 	{
 		const aiMaterial* cMaterial = cScene->mMaterials[m];
 
-		lprintf("converting material ...\n", m);
+		lprintf("converting material %d ...\n", m);
 
 		jobject jMaterial = NULL;
 
@@ -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_getdoublesize
+  (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;
 }
 

+ 14 - 0
port/jassimp/jassimp-native/src/jassimp.h

@@ -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

+ 8 - 4
port/jassimp/jassimp/src/jassimp/AiMesh.java

@@ -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;
     
     
     /**

+ 3 - 3
port/jassimp/jassimp/src/jassimp/AiNodeAnim.java

@@ -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;
     
     
     /**

+ 53 - 2
port/jassimp/jassimp/src/jassimp/Jassimp.java

@@ -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 getdoublesize();
+
+    /**
+     * @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();
     }
 }