From 9070dc1f3cb38aecd2da3fff0e0f9368d633be0e Mon Sep 17 00:00:00 2001 From: aramis_acg Date: Thu, 4 Jun 2009 17:44:51 +0000 Subject: [PATCH] Further work on jAssimp. Still WIP and NOT USABLE, but interface getting stable now, most JNI code written. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@433 67173fc5-114c-0410-ac8e-9d2fd5bffc1f --- code/res/assimp.rc | 9 +- port/jAssimp/DONT_USE_JASSIMP_YET | 1 + port/jAssimp/README | 54 + port/jAssimp/assimp.iml | 26 - port/jAssimp/jni_bridge/BuildHeader.bat | 2 +- port/jAssimp/jni_bridge/JNIAnimation.cpp | 0 port/jAssimp/jni_bridge/JNIBone.cpp | 81 - port/jAssimp/jni_bridge/JNIBoneAnim.cpp | 53 - port/jAssimp/jni_bridge/JNICalls.cpp | 316 --- port/jAssimp/jni_bridge/JNIEnvironment.h | 516 ----- port/jAssimp/jni_bridge/JNIIOStream.cpp | 0 port/jAssimp/jni_bridge/JNIIOSystem.cpp | 0 port/jAssimp/jni_bridge/JNILogger.cpp | 166 -- port/jAssimp/jni_bridge/JNILogger.h | 142 -- port/jAssimp/jni_bridge/JNIMaterial.cpp | 0 port/jAssimp/jni_bridge/JNIMesh.cpp | 212 --- port/jAssimp/jni_bridge/JNINativeError.cpp | 53 - port/jAssimp/jni_bridge/JNINode.cpp | 0 port/jAssimp/jni_bridge/JNIScene.cpp | 96 - port/jAssimp/jni_bridge/JNITexture.cpp | 0 port/jAssimp/jni_bridge/assimp_Importer.h | 10 +- .../assimp_Importer_DefaultIOStream.h | 13 - .../assimp_Importer_DefaultIOSystem.h | 13 - .../jni_bridge/assimp_Importer_Property.h | 13 - port/jAssimp/jni_bridge/jbridge_Animation.cpp | 41 + port/jAssimp/jni_bridge/jbridge_Bone.cpp | 66 + port/jAssimp/jni_bridge/jbridge_BoneAnim.cpp | 56 + port/jAssimp/jni_bridge/jbridge_Camera.cpp | 14 + ...nvironment.cpp => jbridge_Environment.cpp} | 122 +- port/jAssimp/jni_bridge/jbridge_Environment.h | 506 +++++ port/jAssimp/jni_bridge/jbridge_IOStream.cpp | 14 + port/jAssimp/jni_bridge/jbridge_IOSystem.cpp | 14 + port/jAssimp/jni_bridge/jbridge_Importer.cpp | 283 +++ port/jAssimp/jni_bridge/jbridge_Light.cpp | 14 + port/jAssimp/jni_bridge/jbridge_Logger.cpp | 102 + port/jAssimp/jni_bridge/jbridge_Logger.h | 114 ++ port/jAssimp/jni_bridge/jbridge_Material.cpp | 14 + port/jAssimp/jni_bridge/jbridge_Mesh.cpp | 129 ++ .../jni_bridge/jbridge_NativeException.cpp | 36 + port/jAssimp/jni_bridge/jbridge_Node.cpp | 14 + port/jAssimp/jni_bridge/jbridge_Scene.cpp | 88 + port/jAssimp/jni_bridge/jbridge_Texture.cpp | 14 + port/jAssimp/jni_bridge/jbridge_pch.cpp | 15 + port/jAssimp/jni_bridge/jbridge_pch.h | 31 + port/jAssimp/jni_bridge/res/jAssimp.rc | 25 +- port/jAssimp/module_assimp.xml | 62 - workspaces/vc8/assimp_jbridge.vcproj | 494 +++++ workspaces/vc8/jAssimp.vcproj | 1696 ----------------- 48 files changed, 2191 insertions(+), 3549 deletions(-) create mode 100644 port/jAssimp/DONT_USE_JASSIMP_YET delete mode 100644 port/jAssimp/assimp.iml delete mode 100644 port/jAssimp/jni_bridge/JNIAnimation.cpp delete mode 100644 port/jAssimp/jni_bridge/JNIBone.cpp delete mode 100644 port/jAssimp/jni_bridge/JNIBoneAnim.cpp delete mode 100644 port/jAssimp/jni_bridge/JNICalls.cpp delete mode 100644 port/jAssimp/jni_bridge/JNIEnvironment.h delete mode 100644 port/jAssimp/jni_bridge/JNIIOStream.cpp delete mode 100644 port/jAssimp/jni_bridge/JNIIOSystem.cpp delete mode 100644 port/jAssimp/jni_bridge/JNILogger.cpp delete mode 100644 port/jAssimp/jni_bridge/JNILogger.h delete mode 100644 port/jAssimp/jni_bridge/JNIMaterial.cpp delete mode 100644 port/jAssimp/jni_bridge/JNIMesh.cpp delete mode 100644 port/jAssimp/jni_bridge/JNINativeError.cpp delete mode 100644 port/jAssimp/jni_bridge/JNINode.cpp delete mode 100644 port/jAssimp/jni_bridge/JNIScene.cpp delete mode 100644 port/jAssimp/jni_bridge/JNITexture.cpp delete mode 100644 port/jAssimp/jni_bridge/assimp_Importer_DefaultIOStream.h delete mode 100644 port/jAssimp/jni_bridge/assimp_Importer_DefaultIOSystem.h delete mode 100644 port/jAssimp/jni_bridge/assimp_Importer_Property.h create mode 100644 port/jAssimp/jni_bridge/jbridge_Animation.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_Bone.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_BoneAnim.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_Camera.cpp rename port/jAssimp/jni_bridge/{JNIEnvironment.cpp => jbridge_Environment.cpp} (65%) create mode 100644 port/jAssimp/jni_bridge/jbridge_Environment.h create mode 100644 port/jAssimp/jni_bridge/jbridge_IOStream.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_IOSystem.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_Importer.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_Light.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_Logger.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_Logger.h create mode 100644 port/jAssimp/jni_bridge/jbridge_Material.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_Mesh.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_NativeException.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_Node.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_Scene.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_Texture.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_pch.cpp create mode 100644 port/jAssimp/jni_bridge/jbridge_pch.h delete mode 100644 port/jAssimp/module_assimp.xml create mode 100644 workspaces/vc8/assimp_jbridge.vcproj delete mode 100644 workspaces/vc8/jAssimp.vcproj diff --git a/code/res/assimp.rc b/code/res/assimp.rc index 60ceaef3d..a12f3f6ed 100644 --- a/code/res/assimp.rc +++ b/code/res/assimp.rc @@ -30,8 +30,6 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN // Version // -#if (!defined ASSIMP_JNI_EXPORT) - VS_VERSION_INFO VERSIONINFO FILEVERSION 1,0,SVNRevision, 0 PRODUCTVERSION 1,0,SVNRevision,0 @@ -54,7 +52,7 @@ BEGIN VALUE "FileDescription", "Open Asset Import Library" VALUE "FileVersion", 1,0,SVNRevision,0 VALUE "InternalName", "assimp " - VALUE "LegalCopyright", "Copyright (C) 2008" + VALUE "LegalCopyright", "Copyright (C) 2006-2009" VALUE "OriginalFilename", "assimpNN.dll" VALUE "ProductName", "Open Asset Import Library" VALUE "ProductVersion", 1,0,SVNRevision,0 @@ -67,21 +65,16 @@ BEGIN END END - -#endif // !!ASSIMP_JNI_EXPORT - #endif // Deutsch (Deutschland) resources ///////////////////////////////////////////////////////////////////////////// - #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // - ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED diff --git a/port/jAssimp/DONT_USE_JASSIMP_YET b/port/jAssimp/DONT_USE_JASSIMP_YET new file mode 100644 index 000000000..1fbca56a8 --- /dev/null +++ b/port/jAssimp/DONT_USE_JASSIMP_YET @@ -0,0 +1 @@ +... it's under development, it doesn't work yet. \ No newline at end of file diff --git a/port/jAssimp/README b/port/jAssimp/README index e69de29bb..72e36ba05 100644 --- a/port/jAssimp/README +++ b/port/jAssimp/README @@ -0,0 +1,54 @@ + +.................................................................................. +README for jAssimp +.................................................................................. + +Last updated: May 2009 + + +ABSTRACT +.................................................................................. + +jAssimp is a Java port of the full interface of the Open Asset Import Library. +It features almost everything and provides a Java interface that is quite +similar to the core C++ interface. However, some improvements on thread-safety +and type-safety were included. jAssimp doesn't provide any rendering +functionality. It loads 3d files and returns their data, but further processing +is left to the user. jAssimp has been developed and tested with JRE 1.6, but at +least JRE 1.5 should work fine as well. + +Of course, using C++ components in Java applications is not really 'portable'. +However, you can achieve acceptable portability by building the native jAssimp +modules for all platforms you wish your application to run on. The Java Runtime +will always load the right module for the right platform. + +CUSTOM BUILD +.................................................................................. + +In order to use jAssimp, you'll need to compile both the native Assimp library +and the Java bridge module (assimpjbridge) for all target platforms. + +If you're using Visual Studio 2005 or 2008 (or any later version to be supported +in future releases), go to workspaces/vc8 (or vc9 or vc10, ..), open the solution +and compile both 'assimp' and 'assimpjbridge' as 'release-dll' (Win32 and/or x64). +Note that assimpjbridge doesn't work together with -noboost builds of the core Assimp +library, in other words you'll need boost for compiling. See the 'Installation +Page' of the C/C++ documentation for more information. it's not that difficult :-) + +Makefile guys (either gcc or mingw) simply need to do a + ... to be continued + ... + +NOTE: in order to compile assimpjbridge, 'JDK DIR' must point to your local copy of +the Java Development Kit. + + +TROUBLESHOOTING +.................................................................................. + +>> assimp.Importer keeps throwing assimp.NativeException. +The native library is probably not in the root directory of your application, +or it isn't compatible with your platform. + + + diff --git a/port/jAssimp/assimp.iml b/port/jAssimp/assimp.iml deleted file mode 100644 index c208f5980..000000000 --- a/port/jAssimp/assimp.iml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/port/jAssimp/jni_bridge/BuildHeader.bat b/port/jAssimp/jni_bridge/BuildHeader.bat index dc63ce67e..29a355a26 100644 --- a/port/jAssimp/jni_bridge/BuildHeader.bat +++ b/port/jAssimp/jni_bridge/BuildHeader.bat @@ -1,2 +1,2 @@ -javah -classpath ".\..\classes" -d "." "assimp.Importer" +javah -classpath ".\..\java\bin" -d "." "assimp.Importer" diff --git a/port/jAssimp/jni_bridge/JNIAnimation.cpp b/port/jAssimp/jni_bridge/JNIAnimation.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/port/jAssimp/jni_bridge/JNIBone.cpp b/port/jAssimp/jni_bridge/JNIBone.cpp deleted file mode 100644 index 9d7968f7a..000000000 --- a/port/jAssimp/jni_bridge/JNIBone.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (ASSIMP) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2008, ASSIMP Development Team - -All rights reserved. -See the disclaimer in JNIEnvironment.h for licensing and distribution -conditions. ---------------------------------------------------------------------------- -*/ - -/** @file Implementation of the JNI API for jAssimp */ - -#include "JNIEnvironment.h" -#include "JNILogger.h" - -using namespace Assimp; - -namespace Assimp { -namespace JNIBridge { - -// ------------------------------------------------------------------------------------------------ -void JNIEnvironment::_assimp::_Bone::Initialize() -{ - JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; - - // load a handle to the class - if(!(Class = pc->FindClass("assimp.Bone"))) - JNIEnvironment::Get()->ThrowNativeError("Unable to load class assimp.Bone"); - - DefaultCtor = pc->GetMethodID(Class,"",""); - - // load all fields of the class - name = pc->GetFieldID(Class,"name", "Ljava.lang.String;"); - weights = pc->GetFieldID(Class,"weights", "[Lassimp.Bone.Weight;"); - - // check whether all fields have been loaded properly - if (!name || !weights) - JNIEnvironment::Get()->ThrowNativeError("Unable to load all fields of class assimp.Bone"); - - Weight.Initialize(); -} -// ------------------------------------------------------------------------------------------------ -void JNIEnvironment::_assimp::_Bone::Fill(jobject obj,const aiBone* pcSrc) -{ - JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; -} - - -// ------------------------------------------------------------------------------------------------ -void JNIEnvironment::_assimp::_Bone::_Weight::Initialize() -{ - JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; - - // load a handle to the class - if(!(Class = pc->FindClass("assimp.Bone.Weight"))) - JNIEnvironment::Get()->ThrowNativeError("Unable to load class assimp.Bone.Weights"); - - DefaultCtor = pc->GetMethodID(Class,"",""); - - // load all fields of the class - index = pc->GetFieldID(Class,"index", "I"); - weight = pc->GetFieldID(Class,"weight", "F"); - - // check whether all fields have been loaded properly - if (!index || !weight) - JNIEnvironment::Get()->ThrowNativeError("Unable to load all fields of class assimp.Bone.Weight"); -} -// ------------------------------------------------------------------------------------------------ -void JNIEnvironment::_assimp::_Bone::_Weight::Fill(jobject obj,const aiVertexWeight* pcSrc) -{ - JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; - - pc->SetIntField(obj,index,(jint)pcSrc->mVertexId); - pc->SetFloatField(obj,index,(jfloat)pcSrc->mWeight); -} - - -}} \ No newline at end of file diff --git a/port/jAssimp/jni_bridge/JNIBoneAnim.cpp b/port/jAssimp/jni_bridge/JNIBoneAnim.cpp deleted file mode 100644 index bbdeffbbf..000000000 --- a/port/jAssimp/jni_bridge/JNIBoneAnim.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (ASSIMP) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2008, ASSIMP Development Team - -All rights reserved. -See the disclaimer in JNIEnvironment.h for licensing and distribution -conditions. ---------------------------------------------------------------------------- -*/ - -/** @file Implementation of the JNI API for jAssimp */ - -#include "JNIEnvironment.h" -#include "JNILogger.h" - -using namespace Assimp; - -namespace Assimp { -namespace JNIBridge { - -// ------------------------------------------------------------------------------------------------ -void JNIEnvironment::_assimp::_BoneAnim::Initialize() -{ - JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; - - // load a handle to the class - if(!(Class = pc->FindClass("assimp.BoneAnim"))) - JNIEnvironment::Get()->ThrowNativeError("Unable to load class assimp.BoneAnim"); - - DefaultCtor = pc->GetMethodID(Class,"",""); - - // load all fields of the class - mName = pc->GetFieldID(Class,"mName","Lassimp.Node;"); - mPosKeys = pc->GetFieldID(Class,"mPosKeys", "[Lassimp.BoneAnim.Keyframe<[F>;"); - mScalingKeys = pc->GetFieldID(Class,"mScalingKeys","[Lassimp.BoneAnim.Keyframe<[F>;"); - mQuatKeys = pc->GetFieldID(Class,"mQuatKeys","[Lassimp.BoneAnim.Keyframe;"); - - - - // check whether all fields have been loaded properly - if (!mName || !mPosKeys || !mScalingKeys || !mQuatKeys) - JNIEnvironment::Get()->ThrowNativeError("Unable to load all fields of class assimp.BoneAnim"); -} -// ------------------------------------------------------------------------------------------------ -void JNIEnvironment::_assimp::_BoneAnim::Fill(jobject obj,const aiNodeAnim* pcSrc) -{ - JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; - -} -}} \ No newline at end of file diff --git a/port/jAssimp/jni_bridge/JNICalls.cpp b/port/jAssimp/jni_bridge/JNICalls.cpp deleted file mode 100644 index 63f3942e6..000000000 --- a/port/jAssimp/jni_bridge/JNICalls.cpp +++ /dev/null @@ -1,316 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (ASSIMP) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2008, ASSIMP Development Team - -All rights reserved. - -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the following -conditions are met: - -* Redistributions of source code must retain the above - copyright notice, this list of conditions and the - following disclaimer. - -* Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -* Neither the name of the ASSIMP team, nor the names of its - contributors may be used to endorse or promote products - derived from this software without specific prior - written permission of the ASSIMP Development Team. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- -*/ - -/** @file Implementation of the JNI API for jAssimp */ - - -// include the header files generated by javah -#include "assimp_Importer.h" - -// include assimp -#include -#include -#include -#include -#include -#include -#include -#include - -// include all jAssimp internal header files -#include "JNIEnvironment.h" -#include "JNILogger.h" - -using namespace Assimp; - -#include - -namespace Assimp { -namespace JNIBridge { - -// used as error return code -#define AI_JNI_ERROR_RETURN 0xffffffff - -// typedef for a jassimp context, used to uniquely identify -// the Importer object which belongs to a java Importer - -typedef uint64_t JASSIMP_CONTEXT; - -#if (defined _DEBUG) - - typedef std::list< JASSIMP_CONTEXT > ImporterContextList; - static ImporterContextList g_listActiveContexts; - -// ------------------------------------------------------------------------------------------------ -/* Used in debug builds to validate a context -*/ -bool jValidateContext (JASSIMP_CONTEXT context) -{ - for (ImporterContextList::const_iterator - i = g_listActiveContexts.begin(); - i != g_listActiveContexts.end();++i) - { - if (context == *i)return true; - } - DefaultLogger::get()->error("[jnibridge] Invalid context"); - return false; -} - -// ------------------------------------------------------------------------------------------------ -/* Used in debug builds to validate a given scene -*/ -bool jValidateScene (const aiScene* scene) -{ - if (!scene) - { - DefaultLogger::get()->error("[jnibridge] No asset loaded at the moment"); - return false; - } - return true; -} - -#endif // ! ASSIMP_DEBUG - -// ------------------------------------------------------------------------------------------------ -/* Used in debug builds to validate a given scene -*/ -Assimp::Importer* jGetValidImporterScenePair (JASSIMP_CONTEXT jvmcontext) -{ -#if (defined _DEBUG) - if (!jValidateContext((JASSIMP_CONTEXT)jvmcontext))return NULL; -#endif // ! ASSIMP_DEBUG - - // get the importer instance from the context - Assimp::Importer* pcImp = (Assimp::Importer*)jvmcontext; - -#if (defined _DEBUG) - if (!jValidateScene(pcImp->GetScene()))return NULL; -#endif // ! ASSIMP_DEBUG - return pcImp; -} - -// ------------------------------------------------------------------------------------------------ -/* - * Class: assimp_Importer - * Method: _NativeInitContext - * Signature: ()I - */ -JNIEXPORT jlong JNICALL Java_assimp_Importer__1NativeInitContext - (JNIEnv * jvmenv, jobject jvmthis) -{ - // 2^64-1 indicates error - JASSIMP_CONTEXT context = 0xffffffffffffffffL; - - // create a new Importer instance - Assimp::Importer* pcImp = new Assimp::Importer(); - context = (JASSIMP_CONTEXT)(uintptr_t)pcImp; - -#if (defined _DEBUG) - g_listActiveContexts.push_back(context); -#endif // ! ASSIMP_DEBUG - - // need to setup the logger - JNILogDispatcher* pcLogger; - if (DefaultLogger::isNullLogger()) - { - pcLogger = new JNILogDispatcher(); - DefaultLogger::set (pcLogger); - } - else - { - JNILogDispatcher* pcLogger = ( JNILogDispatcher* )DefaultLogger::get(); - pcLogger->AddRef(); - } - - // setup the JNI environment ... - // simply setup the newest JNIEnv* - if(!JNIEnvironment::Get()->AttachToCurrentThread(jvmenv)) - return 0xffffffffffffffffL; - - return context; -} - -// ------------------------------------------------------------------------------------------------ -/* - * Class: assimp_Importer - * Method: _NativeFreeContext - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeFreeContext - (JNIEnv * jvmenv, jobject jvmthis, jlong jvmcontext) -{ - -#if (defined _DEBUG) - if (!jValidateContext((JASSIMP_CONTEXT)jvmcontext))return AI_JNI_ERROR_RETURN; -#endif // ! ASSIMP_DEBUG - - // delete the Importer instance - Assimp::Importer* pcImp = (Assimp::Importer*)jvmcontext; - delete pcImp; - -#if (defined _DEBUG) - g_listActiveContexts.remove(jvmcontext); -#endif // ! ASSIMP_DEBUG - - JNIEnvironment::Get()->DetachFromCurrentThread(); - return 0; -} - -// ------------------------------------------------------------------------------------------------ -/* - * Class: assimp_Importer - * Method: _NativeLoad - * Signature: (Ljava/lang/String;II)I - */ -JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeLoad - (JNIEnv *jvmenv, jobject jvmthis, jstring jvmpath, jint jvmflags, jlong jvmcontext) -{ - jint iRet = 0; - -#if (defined _DEBUG) - if (!jValidateContext((JASSIMP_CONTEXT)jvmcontext))return AI_JNI_ERROR_RETURN; -#endif // ! ASSIMP_DEBUG - - // get the path from the jstring - const char* szPath = JNU_GetStringNativeChars(jvmenv,jvmpath); - if (!szPath) - { - DefaultLogger::get()->error("[jnibridge] Unable to get path string from the java vm"); - return AI_JNI_ERROR_RETURN; - } - // get the importer instance from the context - Assimp::Importer* pcImp = (Assimp::Importer*)jvmcontext; - const aiScene* pcOut; - - // and load the file. The aiScene object itself remains accessible - // via Importer.GetScene(). - if(!(pcOut = pcImp->ReadFile(std::string(szPath),(unsigned int)jvmflags))) - { - DefaultLogger::get()->error("[jnibridge] Unable to load asset"); - - // release the path again - free((void*)szPath); - return AI_JNI_ERROR_RETURN; - } - - // release the path again - ::free((void*)szPath); - - // allocate a new assimp.Scene object to be returned by the importer - jobject jScene; - if(!(jScene = jvmenv->AllocObject(AIJ_GET_HANDLE(assimp.Importer.Class)))) - { - DefaultLogger::get()->error("[jnibridge] Unable to allocate output scene"); - return AI_JNI_ERROR_RETURN; - } - - // fill the assimp.Scene instance - JNIEnvironment::Get()->assimp.Scene.Fill(jScene,pcOut); - - // and store it in the Importer instance - jvmenv->SetObjectField(jvmthis,AIJ_GET_HANDLE(assimp.Importer.scene),jScene); - return iRet; -} - -// ------------------------------------------------------------------------------------------------ -/* - * Class: assimp_Importer - * Method: _NativeSetPropertyInt - * Signature: (Ljava/lang/String;IJ)I - */ -JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeSetPropertyInt - (JNIEnv * jvmenv, jobject _this, jstring name, jint value, jlong jvmcontext) -{ -#if (defined _DEBUG) - if (!jValidateContext((JASSIMP_CONTEXT)jvmcontext))return AI_JNI_ERROR_RETURN; -#endif // ! ASSIMP_DEBUG - - Assimp::Importer* pcImp = (Assimp::Importer*)jvmcontext; - const char* sz = JNU_GetStringNativeChars(jvmenv,name); - pcImp->SetPropertyInteger(sz,(int)value,NULL); - ::free((void*)sz); - return 0; -} - - -// ------------------------------------------------------------------------------------------------ -/* - * Class: assimp_Importer - * Method: _NativeSetPropertyFloat - * Signature: (Ljava/lang/String;FJ)I - */ -JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeSetPropertyFloat - (JNIEnv * jvmenv, jobject _this, jstring name, jfloat value, jlong jvmcontext) -{ -#if (defined _DEBUG) - if (!jValidateContext((JASSIMP_CONTEXT)jvmcontext))return AI_JNI_ERROR_RETURN; -#endif // ! ASSIMP_DEBUG - - Assimp::Importer* pcImp = (Assimp::Importer*)jvmcontext; - const char* sz = JNU_GetStringNativeChars(jvmenv,name); - pcImp->SetPropertyFloat(sz,(float)value,NULL); - ::free((void*)sz); - return 0; -} - -// ------------------------------------------------------------------------------------------------ -/* - * Class: assimp_Importer - * Method: _NativeSetPropertyString - * Signature: (Ljava/lang/String;Ljava/lang/String;J)I - */ -JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeSetPropertyString - (JNIEnv * jvmenv, jobject _this, jstring name, jstring value, jlong jvmcontext) -{ -#if (defined _DEBUG) - if (!jValidateContext((JASSIMP_CONTEXT)jvmcontext))return AI_JNI_ERROR_RETURN; -#endif // ! ASSIMP_DEBUG - - Assimp::Importer* pcImp = (Assimp::Importer*)jvmcontext; - const char* sz = JNU_GetStringNativeChars(jvmenv,name); - const char* sz2 = JNU_GetStringNativeChars(jvmenv,value); - pcImp->SetPropertyString(sz,sz2,NULL); - ::free((void*)sz);::free((void*)sz2); - return 0; -} - -}; //! namespace JNIBridge -}; //! namespace Assimp diff --git a/port/jAssimp/jni_bridge/JNIEnvironment.h b/port/jAssimp/jni_bridge/JNIEnvironment.h deleted file mode 100644 index b3a649c66..000000000 --- a/port/jAssimp/jni_bridge/JNIEnvironment.h +++ /dev/null @@ -1,516 +0,0 @@ -/* -Open Asset Import Library (ASSIMP) ----------------------------------------------------------------------- - -Copyright (c) 2006-2008, ASSIMP Development Team -All rights reserved. - -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the -following conditions are met: - -* Redistributions of source code must retain the above - copyright notice, this list of conditions and the - following disclaimer. - -* Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -* Neither the name of the ASSIMP team, nor the names of its - contributors may be used to endorse or promote products - derived from this software without specific prior - written permission of the ASSIMP Development Team. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ----------------------------------------------------------------------- -*/ - -#if (!defined AI_JNIENVIRONMENT_H_INCLUDED) -#define AI_JNIENVIRONMENT_H_INCLUDED - - -#include -#include - -#include -#include - -#include -#include -#include - - -namespace Assimp { -namespace JNIBridge { - - -#define AIJ_GET_HANDLE(__handle__) \ - (JNIEnvironment::Get()-> __handle__) - -#define AIJ_GET_DEFAULT_CTOR_HANDLE(__handle__) \ - (JNIEnvironment::Get()-> __handle__ . DefaultCtor) - -#define AIJ_GET_CLASS_HANDLE(__handle__) \ - (JNIEnvironment::Get()-> __handle__.Class) - -// --------------------------------------------------------------------------- -/** @class JNIThreadData - * @brief Manages a list of JNI data structures that are - * private to a thread. - */ - // --------------------------------------------------------------------------- -struct JNIThreadData -{ - //! Default constructor - JNIThreadData() : m_pcEnv(NULL), m_iNumRef(1) {} - - //! Construction from an existing JNIEnv - JNIThreadData(JNIEnv* env) : m_pcEnv(env), m_iNumRef(1) {} - - //! JNI environment, is attached to the thread - JNIEnv* m_pcEnv; - - //! Number of Importer instances that have been - //! created by this thread - unsigned int m_iNumRef; -}; - - -// --------------------------------------------------------------------------- -/** @class JNIEnvironment - * @brief Helper class to manage the JNI environment for multithreaded - * use of the library. - */ -// --------------------------------------------------------------------------- -class JNIEnvironment -{ -private: - - JNIEnvironment() : m_iRefCnt(1) {} - -public: - - //! Create the JNI environment class - //! refcnt = 1 - static JNIEnvironment* Create() - { - if (NULL == s_pcEnv) - { - s_pcEnv = new JNIEnvironment(); - } - else s_pcEnv->AddRef(); - return s_pcEnv; - } - - //! static getter for the singleton instance - //! doesn't hange the reference counter - static JNIEnvironment* Get() - { - ai_assert(NULL != s_pcEnv); - return s_pcEnv; - } - - //! COM-style reference counting mechanism - unsigned int AddRef() - { - return ++this->m_iRefCnt; - } - - //! COM-style reference counting mechanism - unsigned int Release() - { - unsigned int iNew = --this->m_iRefCnt; - if (0 == iNew)delete this; - return iNew; - } - - //! Attach to the current thread - bool AttachToCurrentThread (JNIEnv* pcEnv); - - //! Detach from the current thread - bool DetachFromCurrentThread (); - - //! Get the thread local data of the current thread - JNIThreadData* GetThread(); - - //! Throw an NativeEror exception with the specified error message - //! The error message is optional. - void ThrowNativeError(const char* msg = NULL); - -public: - - - struct _java - { - inline void Initialize() - { - lang.Initialize(); - } - - struct _lang - { - inline void Initialize() - { - String.Initialize(); - } - - struct _String - { - void Initialize(); - - //! Handle to the java.lang.String class - static jclass Class; - - //! Handle to the java.lang.String.getBytes() class - static jmethodID getBytes; - - //! Handle to the java.lang.String.String(byte[]) c'tor - static jmethodID constructor_ByteArray; - - } String; - - - struct _Array - { - void Initialize(); - - jclass FloatArray_Class; - jclass IntArray_Class; - - } Array; - - } lang; - } java; - - - struct _Base - { - virtual void Fill(jobject obj,const void* pcSrc) = 0; - - jclass Class; - jmethodID DefaultCtor; - }; - -#define AIJ_SET_INPUT_TYPE(__type__) \ - \ - void Fill(jobject obj,const __type__* pcSrc); \ - \ - inline void Fill(jobject obj,const void* pcSrc) \ - {Fill(obj,(const __type__*)pcSrc);} - - //! Represents the JNI interface to the package assimp - struct _assimp - { - //! Initializes the package assimp for use with jAssimp - inline void Initialize() - { - // the NativeException class must be initialized first as it - // is used by all other class initializers - NativeException.Initialize(); - - // now initialize all other classes, the rder doesn't care. - Scene.Initialize(); - Importer.Initialize(); - Mesh.Initialize(); - Bone.Initialize(); - Animation.Initialize(); - BoneAnim.Initialize(); - Texture.Initialize(); - CompressedTexture.Initialize(); - Matrix3x3.Initialize(); - Matrix4x4.Initialize(); - Quaternion.Initialize(); - Node.Initialize(); - Material.Initialize(); - }; - - //! Represents the JNI interface to class assimp.NativeException - struct _NativeException - { - void Initialize(); - - jclass Class; - - } NativeException; - - - //! Represents the JNI interface to class assimp.Importer - struct _Importer - { - void Initialize(); - - jclass Class; - - jfieldID scene; - - } Importer; - - - //! Represents the JNI interface to class assimp.Scene - struct _Scene : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiScene); - - - jfieldID m_vMeshes; - jfieldID m_vTextures; - jfieldID m_vMaterials; - jfieldID m_vAnimations; - jfieldID m_rootNode; - jfieldID flags; - - } Scene; - - - //! Represents the JNI interface to class assimp.Mesh - struct _Mesh : public _Base - { - AIJ_SET_INPUT_TYPE(aiMesh); - void Initialize(); - - jfieldID m_vVertices; - jfieldID m_vTangents; - jfieldID m_vBitangents; - jfieldID m_vNormals; - jfieldID m_avUVs; - jfieldID m_vFaces; - jfieldID m_avColors; - jfieldID m_aiNumUVComponents; - jfieldID m_vBones; - jfieldID m_iMaterialIndex; - - } Mesh; - - //! Represents the JNI interface to class assimp.Bone - struct _Bone : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiBone); - - jfieldID name; - jfieldID weights; - - - //! Represents the JNI interface to class assimp.Bone.Weight - struct _Weight : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiVertexWeight); - - jfieldID index; - jfieldID weight; - - } Weight; - - } Bone; - - //! Represents the JNI interface to class assimp.Animation - struct _Animation : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiAnimation); - - jfieldID name; - jfieldID mDuration; - jfieldID mTicksPerSecond; - jfieldID boneAnims; - - } Animation; - - //! Represents the JNI interface to class assimp.BoneAnim - struct _BoneAnim : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiNodeAnim); - - //! Represents the JNI interface to class assimp.BoneAnim.KeyFrame - struct _KeyFrame - { - jclass Class; - - jmethodID DefaultCtor; - - jfieldID time; - jfieldID value; - - } KeyFrame; - - jfieldID mName; - jfieldID mQuatKeys; - jfieldID mPosKeys; - jfieldID mScalingKeys; - - } BoneAnim; - - //! Represents the JNI interface to class assimp.Texture - struct _Texture : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiTexture); - - jfieldID width; - jfieldID height; - jfieldID data; - - } Texture; - - //! Represents the JNI interface to class assimp.CompressedTexture - struct _CompressedTexture : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiTexture); - - jfieldID m_format; - - } CompressedTexture; - - //! Represents the JNI interface to class assimp.Material - struct _Material : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiMaterial); - - //! Represents the JNI interface to class assimp.Material.Property - struct _Property : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiMaterialProperty); - - jfieldID key; - jfieldID value; - - } Property; - jfieldID properties; - - } Material; - - //! Represents the JNI interface to class assimp.Matrix4x4 - struct _Matrix4x4 : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiMatrix4x4); - jfieldID coeff; - - } Matrix4x4; - - //! Represents the JNI interface to class assimp.Matrix3x3 - struct _Matrix3x3 : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiMatrix3x3); - jfieldID coeff; - - } Matrix3x3; - - //! Represents the JNI interface to class assimp.Quaternion - struct _Quaternion : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiQuaternion); - - jfieldID x; - jfieldID y; - jfieldID z; - jfieldID w; - - } Quaternion; - - //! Represents the JNI interface to class assimp.Node - struct _Node : public _Base - { - void Initialize(); - AIJ_SET_INPUT_TYPE(aiNode); - - jfieldID meshIndices; - jfieldID nodeTransform; - jfieldID name; - jfieldID children; - jfieldID parent; - - } Node; - - } assimp; - - inline void Initialize() - { - assimp.Initialize(); - java.Initialize(); - } - -private: - - //! Singleton instance - static JNIEnvironment* s_pcEnv; - - //! TLS data - boost::thread_specific_ptr ptr; - - //! Reference counter of the whole class - unsigned int m_iRefCnt; -}; - -// --------------------------------------------------------------------------- -/** @brief Helper function to copy data to a Java array - * - * @param pc JNI env handle - * @param jfl Java array - * @param data Input data - * @param size Size of data to be copied, in bytes - */ -void JNU_CopyDataToArray(JNIEnv* pc, jarray jfl, void* data, unsigned int size); - -// --------------------------------------------------------------------------- -/** @brief Helper function to create a java.lang.String from - * a native char*. - * - * This function has been taken from - * http://java.sun.com/docs/books/jni/html/other.html#26021 - * I am not sure whether it is really necessary, but I trust the source - */ -jstring JNU_NewStringNative(JNIEnv *env, const char *str); - - -// --------------------------------------------------------------------------- -/** @brief Helper function to create a char* from - * a managed jstring - * - * This function has been taken from - * http://java.sun.com/docs/books/jni/html/other.html#26021 - * I am not sure whether it is really necessary, but I trust the source - */ -char* JNU_GetStringNativeChars(JNIEnv *env, jstring jstr); - - -// --------------------------------------------------------------------------- -/** @brief Helper function to copy a whole object array to the VM - * - * @param pc JNI env handle - * @param in Input object array - * @param num Size of input array - * @param type Type of input - * @param out Output object - */ -// --------------------------------------------------------------------------- -void JNU_CopyObjectArrayToVM(JNIEnv* pc, const void** in, unsigned int num, - JNIEnvironment::_Base& type, jobjectArray& out); - -};}; - - -#endif //! AI_JNIENVIRONMENT_H_INCLUDED - - diff --git a/port/jAssimp/jni_bridge/JNIIOStream.cpp b/port/jAssimp/jni_bridge/JNIIOStream.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/port/jAssimp/jni_bridge/JNIIOSystem.cpp b/port/jAssimp/jni_bridge/JNIIOSystem.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/port/jAssimp/jni_bridge/JNILogger.cpp b/port/jAssimp/jni_bridge/JNILogger.cpp deleted file mode 100644 index 04492d707..000000000 --- a/port/jAssimp/jni_bridge/JNILogger.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (ASSIMP) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2008, ASSIMP Development Team - -All rights reserved. - -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the following -conditions are met: - -* Redistributions of source code must retain the above - copyright notice, this list of conditions and the - following disclaimer. - -* Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -* Neither the name of the ASSIMP team, nor the names of its - contributors may be used to endorse or promote products - derived from this software without specific prior - written permission of the ASSIMP Development Team. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- -*/ - -/** @file Implementation of the JNI API for jAssimp */ - -#if (defined ASSIMP_JNI_EXPORT) - - -// include assimp -#include "../../include/aiTypes.h" -#include "../../include/aiMesh.h" -#include "../../include/aiAnim.h" -#include "../../include/aiScene.h" -#include "../../include/aiAssert.h" -#include "../../include/aiPostProcess.h" -#include "../../include/assimp.hpp" - -#include "../../include/DefaultLogger.h" - -#include "JNIEnvironment.h" -#include "JNILogger.h" - -using namespace Assimp; - - -namespace Assimp { -namespace JNIBridge { - - -// ------------------------------------------------------------------------------------------------ -bool JNILogDispatcher::OnAttachToCurrentThread(JNIThreadData* pcData) -{ - ai_assert(NULL != pcData); - //this->AddRef(); - done at another position - - // there is much error handling code in this function. - // However, it is not impossible that the jAssimp package - // loaded by the JVM is incomplete ... - JNIEnv* jvmenv = JNIEnvironment::Get()->GetThread()->m_pcEnv; - - // get a handle to the assimp.DefaultLogger class - if (NULL == this->m_pcClass) - { - if( NULL == (this->m_pcClass = jvmenv->FindClass("assimp.DefaultLogger"))) - { - return false; - } - } - // get handles to the logging functions - if (NULL == this->m_pcMethodError) - { - if( NULL == (this->m_pcMethodError = jvmenv->GetStaticMethodID( - this->m_pcClass,"_NativeCallWriteError","(Ljava/lang/String;)V"))) - { - return false; - } - } - if (NULL == this->m_pcMethodWarn) - { - if( NULL == (this->m_pcMethodWarn = jvmenv->GetStaticMethodID( - this->m_pcClass,"_NativeCallWriteWarn","(Ljava/lang/String;)V"))) - { - return false; - } - } - if (NULL == this->m_pcMethodInfo) - { - if( NULL == (this->m_pcMethodInfo = jvmenv->GetStaticMethodID( - this->m_pcClass,"_NativeCallWriteInfo","(Ljava/lang/String;)V"))) - { - return false; - } - } - if (NULL == this->m_pcMethodDebug) - { - if( NULL == (this->m_pcMethodDebug = jvmenv->GetStaticMethodID( - this->m_pcClass,"_NativeCallWriteDebug","(Ljava/lang/String;)V"))) - { - return false; - } - } - return true; -} -// ------------------------------------------------------------------------------------------------ -bool JNILogDispatcher::OnDetachFromCurrentThread(JNIThreadData* pcData) -{ - ai_assert(NULL != pcData); - - this->Release(); - return true; -} -// ------------------------------------------------------------------------------------------------ -void JNILogDispatcher::debug(const std::string &message) -{ - JNIEnv* jvmenv = JNIEnvironment::Get()->GetThread()->m_pcEnv; - jstring jstr = JNU_NewStringNative(jvmenv,message.c_str()); - jvmenv->CallStaticVoidMethod(this->m_pcClass,this->m_pcMethodDebug,jstr); - jvmenv->DeleteLocalRef(jstr); -} -// ------------------------------------------------------------------------------------------------ -void JNILogDispatcher::info(const std::string &message) -{ - JNIEnv* jvmenv = JNIEnvironment::Get()->GetThread()->m_pcEnv; - jstring jstr = JNU_NewStringNative(jvmenv,message.c_str()); - jvmenv->CallStaticVoidMethod(this->m_pcClass,this->m_pcMethodInfo,jstr); - jvmenv->DeleteLocalRef(jstr); -} -// ------------------------------------------------------------------------------------------------ -void JNILogDispatcher::warn(const std::string &message) -{ - JNIEnv* jvmenv = JNIEnvironment::Get()->GetThread()->m_pcEnv; - jstring jstr = JNU_NewStringNative(jvmenv,message.c_str()); - jvmenv->CallStaticVoidMethod(this->m_pcClass,this->m_pcMethodWarn,jstr); - jvmenv->DeleteLocalRef(jstr); -} -// ------------------------------------------------------------------------------------------------ -void JNILogDispatcher::error(const std::string &message) -{ - JNIEnv* jvmenv = JNIEnvironment::Get()->GetThread()->m_pcEnv; - jstring jstr = JNU_NewStringNative(jvmenv,message.c_str()); - jvmenv->CallStaticVoidMethod(this->m_pcClass,this->m_pcMethodError,jstr); - jvmenv->DeleteLocalRef(jstr); -} - - -};}; - -#endif // jni \ No newline at end of file diff --git a/port/jAssimp/jni_bridge/JNILogger.h b/port/jAssimp/jni_bridge/JNILogger.h deleted file mode 100644 index 025ec4db3..000000000 --- a/port/jAssimp/jni_bridge/JNILogger.h +++ /dev/null @@ -1,142 +0,0 @@ -/* -Open Asset Import Library (ASSIMP) ----------------------------------------------------------------------- - -Copyright (c) 2006-2008, ASSIMP Development Team -All rights reserved. - -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the -following conditions are met: - -* Redistributions of source code must retain the above - copyright notice, this list of conditions and the - following disclaimer. - -* Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -* Neither the name of the ASSIMP team, nor the names of its - contributors may be used to endorse or promote products - derived from this software without specific prior - written permission of the ASSIMP Development Team. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ----------------------------------------------------------------------- -*/ - -#if (!defined AI_JNILOGGER_H_INCLUDED) -#define AI_JNILOGGER_H_INCLUDED - - -#include "../../../include/Logger.h" -#include "../../../include/DefaultLogger.h" -#include - -#include - -namespace Assimp { -namespace JNIBridge { - -// --------------------------------------------------------------------------- -class IOStream; -struct LogStreamInfo; - - -// --------------------------------------------------------------------------- -/** @class JNILogDispatcher - * @brief Logging system implementation that is used to send all - * log messages generated by native code to the Java logging system. - */ -class JNILogDispatcher : public Logger -{ - friend class JNIEnvironment; - -public: - - //! Default constructor - JNILogDispatcher() : m_iRefCnt(1) {} - - /** @brief Logs a debug message */ - void debug(const std::string &message); - - /** @brief Logs an info message */ - void info(const std::string &message); - - /** @brief Logs a warning message */ - void warn(const std::string &message); - - /** @brief Logs an error message */ - void error(const std::string &message); - - /** @brief Log severity setter */ - void setLogSeverity(LogSeverity log_severity) {} - - /** @brief Detach a still attached stream from logger */ - void attachStream(LogStream *pStream, unsigned int severity) {} - - /** @brief Detach a still attached stream from logger */ - void detatchStream(LogStream *pStream, unsigned int severity) {} - - //! COM-style reference counting mechanism - unsigned int AddRef() - { - return ++this->m_iRefCnt; - } - - //! COM-style reference counting mechanism - unsigned int Release() - { - unsigned int iNew = --this->m_iRefCnt; - if (0 == iNew) - { - delete this; - // don't forget to reset the logger to the default implementation - DefaultLogger::set(NULL); - } - return iNew; - } - -private: - - //! Called by JNIEnvironment - bool OnAttachToCurrentThread(JNIThreadData* pcData); - bool OnDetachFromCurrentThread(JNIThreadData* pcData); - -private: - - //! Handle to assimp.DefaultLogger class - jclass m_pcClass; - - //! Handle to the static assimp.DefaultLogger._NativeCallWriteError() method - jmethodID m_pcMethodError; - - //! Handle to the static assimp.DefaultLogger._NativeCallWriteInfo() method - jmethodID m_pcMethodInfo; - - //! Handle to the static assimp.DefaultLogger._NativeCallWriteDebug() method - jmethodID m_pcMethodDebug; - - //! Handle to the static assimp.DefaultLogger._NativeCallWriteWarn() method - jmethodID m_pcMethodWarn; - - //! Reference counter of the logger - unsigned int m_iRefCnt; -}; - -};}; - -#endif // AI_JNILOGGER_H_INCLUDED \ No newline at end of file diff --git a/port/jAssimp/jni_bridge/JNIMaterial.cpp b/port/jAssimp/jni_bridge/JNIMaterial.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/port/jAssimp/jni_bridge/JNIMesh.cpp b/port/jAssimp/jni_bridge/JNIMesh.cpp deleted file mode 100644 index 8c45e4d4c..000000000 --- a/port/jAssimp/jni_bridge/JNIMesh.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (ASSIMP) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2008, ASSIMP Development Team - -All rights reserved. - -Redistribution and use of this software in source and binary forms, -with or without modification, are permitted provided that the following -conditions are met: - -* Redistributions of source code must retain the above - copyright notice, this list of conditions and the - following disclaimer. - -* Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -* Neither the name of the ASSIMP team, nor the names of its - contributors may be used to endorse or promote products - derived from this software without specific prior - written permission of the ASSIMP Development Team. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- -*/ - -/** @file Implementation of the JNI API for jAssimp */ - -#include "JNIEnvironment.h" -#include "JNILogger.h" - -using namespace Assimp; - -namespace Assimp { -namespace JNIBridge { - -// ------------------------------------------------------------------------------------------------ -void JNIEnvironment::_assimp::_Mesh::Initialize() -{ - JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; - - // load a handle to the class - if(!(this->Class = pc->FindClass("assimp.Mesh"))) - JNIEnvironment::Get()->ThrowNativeError("Unable to load class assimp.mesh"); - - DefaultCtor = pc->GetMethodID(Class,"",""); - - // load all fields of the class - this->m_vVertices = pc->GetFieldID(Class,"m_vVertices","[F"); - this->m_vNormals = pc->GetFieldID(Class,"m_vNormals","[F"); - this->m_vTangents = pc->GetFieldID(Class,"m_vTangents","[F"); - this->m_vBitangents = pc->GetFieldID(Class,"m_vBitangents","[F"); - this->m_avColors = pc->GetFieldID(Class,"m_avColors","[[F"); - this->m_avUVs = pc->GetFieldID(Class,"m_avColors","[[F"); - this->m_vFaces = pc->GetFieldID(Class,"m_vFaces","[I"); - this->m_vBones = pc->GetFieldID(Class,"m_vBones","[Lassimp.Bone;"); - - this->m_aiNumUVComponents = pc->GetFieldID(Class,"m_aiNumUVComponents","[I"); - this->m_iMaterialIndex = pc->GetFieldID(Class,"m_iMaterialIndex","I"); - - // check whether all fields have been loaded properly - if (!this->m_vVertices || !this->m_vNormals || !this->m_vTangents || - !this->m_vBitangents || !this->m_avColors || !this->m_avUVs || - !this->m_vFaces || !this->m_vBones || !this->m_aiNumUVComponents || - !this->m_iMaterialIndex) - { - JNIEnvironment::Get()->ThrowNativeError("Unable to load all fields of class assimp.mesh"); - } -} -// ------------------------------------------------------------------------------------------------ -void JNIEnvironment::_assimp::_Mesh::Fill(jobject obj,const aiMesh* pcSrc) -{ - JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; - - // set the material index - pc->SetIntField(obj,this->m_iMaterialIndex,pcSrc->mMaterialIndex); - - - // allocate the arrays and fill them - const unsigned int size = pcSrc->mNumVertices*12; - const unsigned int size2 = pcSrc->mNumVertices*3; - - // copy vertex positions - if (pcSrc->HasPositions()) - { - jfloatArray jfl = pc->NewFloatArray(size2); - JNU_CopyDataToArray(pc,jfl,pcSrc->mVertices,size); - - pc->SetObjectField(obj,this->m_vVertices,jfl); - } - // copy vertex normals - if (pcSrc->HasNormals()) - { - // allocate and copy data - jfloatArray jfl = pc->NewFloatArray(size2); - JNU_CopyDataToArray(pc,jfl,pcSrc->mNormals,size); - - pc->SetObjectField(obj,this->m_vNormals,jfl); - } - // copy tangents and bitangents - if (pcSrc->HasTangentsAndBitangents()) - { - jfloatArray jfl = pc->NewFloatArray(size2); - JNU_CopyDataToArray(pc,jfl,pcSrc->mTangents,size); - - pc->SetObjectField(obj,this->m_vTangents,jfl); - - jfl = pc->NewFloatArray(size2); - JNU_CopyDataToArray(pc,jfl,pcSrc->mBitangents,size); - pc->SetObjectField(obj,this->m_vBitangents,jfl); - } - // copy texture coordinates - if (pcSrc->HasTextureCoords(0)) - { - jobjectArray jobjarr = pc->NewObjectArray(AI_MAX_NUMBER_OF_TEXTURECOORDS, - AIJ_GET_HANDLE(java.lang.Array.FloatArray_Class),0); - - unsigned int channel = 0; - while (pcSrc->HasTextureCoords(channel)) - { - jfloatArray jfl = pc->NewFloatArray(size2); - JNU_CopyDataToArray(pc,jfl,pcSrc->mTextureCoords[channel],size); - - pc->SetObjectArrayElement(jobjarr,channel,jfl); - ++channel; - } - - // set the corresponding field in the java object - pc->SetObjectField(obj,this->m_avUVs,jobjarr); - - jobjarr = (jobjectArray) pc->NewIntArray(AI_MAX_NUMBER_OF_TEXTURECOORDS); - pc->SetIntArrayRegion((jintArray)jobjarr,0,channel,(const jint*)&pcSrc->mNumUVComponents); - pc->SetObjectField(obj,this->m_aiNumUVComponents,jobjarr); - } - // copy vertex colors - if (pcSrc->HasVertexColors(0)) - { - const unsigned int size = pcSrc->mNumVertices<<4; - const unsigned int size2 = pcSrc->mNumVertices<<2; - - jobjectArray jobjarr = pc->NewObjectArray(AI_MAX_NUMBER_OF_COLOR_SETS, - AIJ_GET_HANDLE(java.lang.Array.FloatArray_Class),0); - - unsigned int channel = 0; - while (pcSrc->HasVertexColors(channel)) - { - jfloatArray jfl = pc->NewFloatArray(size2); - JNU_CopyDataToArray(pc,jfl,pcSrc->mColors[channel],size); - - pc->SetObjectArrayElement(jobjarr,channel,jfl); - ++channel; - } - - // set the corresponding field in the java object - pc->SetObjectField(obj,this->m_avColors,jobjarr); - } - - - // copy faces - if (0 < pcSrc->mNumFaces) // just for safety - { - const unsigned int size = pcSrc->mNumFaces*12; - const unsigned int size2 = pcSrc->mNumFaces*3; - - // allocate and copy data - jintArray jil = pc->NewIntArray(size2); - - uint32_t* pf; - jboolean iscopy = FALSE; - - if(!(pf = (uint32_t*)pc->GetPrimitiveArrayCritical(jil,&iscopy))) - JNIEnvironment::Get()->ThrowNativeError("Unable to lock face array"); - - const aiFace* const pcEnd = pcSrc->mFaces+pcSrc->mNumFaces; - for (const aiFace* pcCur = pcSrc->mFaces;pcCur != pcEnd;++pcCur) - { - ai_assert(3 == pcCur->mNumIndices); - *pf++ = pcCur->mIndices[0]; - *pf++ = pcCur->mIndices[1]; - *pf++ = pcCur->mIndices[2]; - } - - pc->ReleasePrimitiveArrayCritical(jil,pf,0); - pc->SetObjectField(obj,this->m_vFaces,jil); - } - - // copy bones - if (pcSrc->mNumBones) - { - jobjectArray ja; - JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mBones,pcSrc->mNumBones, - AIJ_GET_HANDLE(assimp.Bone),ja); - pc->SetObjectField(obj,m_vBones,ja); - } -} - -}} \ No newline at end of file diff --git a/port/jAssimp/jni_bridge/JNINativeError.cpp b/port/jAssimp/jni_bridge/JNINativeError.cpp deleted file mode 100644 index 6f680b7a7..000000000 --- a/port/jAssimp/jni_bridge/JNINativeError.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (ASSIMP) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2008, ASSIMP Development Team - -All rights reserved. -See the disclaimer in JNIEnvironment.h for licensing and distribution -conditions. ---------------------------------------------------------------------------- -*/ - -/** @file Implementation of the JNI API for jAssimp */ - -#include "JNIEnvironment.h" -#include "JNILogger.h" - -using namespace Assimp; - -namespace Assimp { -namespace JNIBridge { - -// ------------------------------------------------------------------------------------------------ -void JNIEnvironment::_assimp::_NativeException::Initialize() -{ - // get a handle to the JNI context for this thread - JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; - - // load a handle to the class - if(!(this->Class = pc->FindClass("assimp.NativeException"))) - { - // if this fails we have no exception class we could use ... - // throw an java.lang.Error instance - this->Class = pc->FindClass("java.lang.Exception"); - pc->ThrowNew(this->Class,"Unable to load class assimp.NativeException (severe failure!)"); - this->Class = NULL; - } -} - - -// ------------------------------------------------------------------------------------------------ -void JNIEnvironment::ThrowNativeError(const char* msg /*= NULL*/) -{ - // get a handle to the JNI context for this thread - JNIEnv* pc = this->GetThread()->m_pcEnv; - - // throw a new NativeException - pc->ThrowNew(this->assimp.NativeException.Class, - msg ? msg - : "An unspecified error occured in the native interface to Assimp."); -} -}} \ No newline at end of file diff --git a/port/jAssimp/jni_bridge/JNINode.cpp b/port/jAssimp/jni_bridge/JNINode.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/port/jAssimp/jni_bridge/JNIScene.cpp b/port/jAssimp/jni_bridge/JNIScene.cpp deleted file mode 100644 index a933d5321..000000000 --- a/port/jAssimp/jni_bridge/JNIScene.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (ASSIMP) ---------------------------------------------------------------------------- - -Copyright (c) 2006-2008, ASSIMP Development Team - -All rights reserved. -See the disclaimer in JNIEnvironment.h for licensing and distribution -conditions. ---------------------------------------------------------------------------- -*/ - -/** @file Implementation of the JNI API for jAssimp */ - -#include "JNIEnvironment.h" -#include "JNILogger.h" - -using namespace Assimp; - -namespace Assimp { -namespace JNIBridge { - -// ------------------------------------------------------------------------------------------------ -void JNIEnvironment::_assimp::_Scene::Initialize() -{ - JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; - - // load a handle to the class - if(!(Class = pc->FindClass("assimp.Scene"))) - JNIEnvironment::Get()->ThrowNativeError("Unable to load class assimp.Scene"); - - DefaultCtor = pc->GetMethodID(Class,"",""); - - // load all fields of the class - m_rootNode = pc->GetFieldID(Class,"m_rootNode","Lassimp.Node;"); - m_vAnimations = pc->GetFieldID(Class,"m_vAnimations","[Lassimp.Animation;"); - m_vMaterials = pc->GetFieldID(Class,"m_vMaterials","[Lassimp.Material;"); - m_vMeshes = pc->GetFieldID(Class,"m_vMeshes","[Lassimp.Mesh;"); - m_vTextures = pc->GetFieldID(Class,"m_vTextures","[Lassimp.Texture;"); - flags = pc->GetFieldID(Class,"flags","I"); - - - // check whether all fields have been loaded properly - if (!m_vAnimations || !m_rootNode || !m_vMaterials || !m_vMeshes || !m_vTextures || !flags) - JNIEnvironment::Get()->ThrowNativeError("Unable to load all fields of class assimp.Scene"); -} -// ------------------------------------------------------------------------------------------------ -void JNIEnvironment::_assimp::_Scene::Fill(jobject obj,const aiScene* pcSrc) -{ - JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; - jobjectArray ja; - - // copy meshes - if (pcSrc->mNumMeshes) - { - JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mMeshes,pcSrc->mNumMeshes, - AIJ_GET_HANDLE(assimp.Mesh),ja); - pc->SetObjectField(obj,m_vMeshes,ja); - } - - // copy textures - if (pcSrc->mNumTextures) - { - JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mTextures,pcSrc->mNumTextures, - AIJ_GET_HANDLE(assimp.Texture),ja); - pc->SetObjectField(obj,m_vTextures,ja); - } - - // copy materials - if (pcSrc->mNumMeshes) - { - JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mMaterials,pcSrc->mNumMaterials, - AIJ_GET_HANDLE(assimp.Material),ja); - pc->SetObjectField(obj,m_vMaterials,ja); - } - - // copy animations - if (pcSrc->mNumAnimations) - { - JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mAnimations,pcSrc->mNumAnimations, - AIJ_GET_HANDLE(assimp.Animation),ja); - pc->SetObjectField(obj,m_vAnimations,ja); - } - - // copy flags - pc->SetIntField(obj,flags,(jint)pcSrc->mFlags); - - // copy the root node - jobject root = pc->NewObject(AIJ_GET_CLASS_HANDLE(assimp.Node), - AIJ_GET_DEFAULT_CTOR_HANDLE(assimp.Node)); - - AIJ_GET_HANDLE(assimp.Node).Fill(root,pcSrc->mRootNode); - pc->SetObjectField(obj,m_rootNode,root); -} -}} \ No newline at end of file diff --git a/port/jAssimp/jni_bridge/JNITexture.cpp b/port/jAssimp/jni_bridge/JNITexture.cpp deleted file mode 100644 index e69de29bb..000000000 diff --git a/port/jAssimp/jni_bridge/assimp_Importer.h b/port/jAssimp/jni_bridge/assimp_Importer.h index 547bb0163..00766a7df 100644 --- a/port/jAssimp/jni_bridge/assimp_Importer.h +++ b/port/jAssimp/jni_bridge/assimp_Importer.h @@ -9,12 +9,16 @@ extern "C" { #endif #undef assimp_Importer_PROPERTY_WAS_NOT_EXISTING #define assimp_Importer_PROPERTY_WAS_NOT_EXISTING -1L + +#undef assimp_Importer_ABI_VERSION +#define assimp_Importer_ABI_VERSION 1 + /* * Class: assimp_Importer * Method: _NativeInitContext * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeInitContext +JNIEXPORT jlong JNICALL Java_assimp_Importer__1NativeInitContext (JNIEnv *, jobject, jint); /* @@ -28,10 +32,10 @@ JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeFreeContext /* * Class: assimp_Importer * Method: _NativeLoad - * Signature: (Ljava/lang/String;IJ)I + * Signature: (Ljava/lang/String;JJ)I */ JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeLoad - (JNIEnv *, jobject, jstring, jint, jlong); + (JNIEnv *, jobject, jstring, jlong, jlong); /* * Class: assimp_Importer diff --git a/port/jAssimp/jni_bridge/assimp_Importer_DefaultIOStream.h b/port/jAssimp/jni_bridge/assimp_Importer_DefaultIOStream.h deleted file mode 100644 index 4394acc20..000000000 --- a/port/jAssimp/jni_bridge/assimp_Importer_DefaultIOStream.h +++ /dev/null @@ -1,13 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class assimp_Importer_DefaultIOStream */ - -#ifndef _Included_assimp_Importer_DefaultIOStream -#define _Included_assimp_Importer_DefaultIOStream -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __cplusplus -} -#endif -#endif diff --git a/port/jAssimp/jni_bridge/assimp_Importer_DefaultIOSystem.h b/port/jAssimp/jni_bridge/assimp_Importer_DefaultIOSystem.h deleted file mode 100644 index 8197b8f06..000000000 --- a/port/jAssimp/jni_bridge/assimp_Importer_DefaultIOSystem.h +++ /dev/null @@ -1,13 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class assimp_Importer_DefaultIOSystem */ - -#ifndef _Included_assimp_Importer_DefaultIOSystem -#define _Included_assimp_Importer_DefaultIOSystem -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __cplusplus -} -#endif -#endif diff --git a/port/jAssimp/jni_bridge/assimp_Importer_Property.h b/port/jAssimp/jni_bridge/assimp_Importer_Property.h deleted file mode 100644 index 435c4b4e1..000000000 --- a/port/jAssimp/jni_bridge/assimp_Importer_Property.h +++ /dev/null @@ -1,13 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class assimp_Importer_Property */ - -#ifndef _Included_assimp_Importer_Property -#define _Included_assimp_Importer_Property -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __cplusplus -} -#endif -#endif diff --git a/port/jAssimp/jni_bridge/jbridge_Animation.cpp b/port/jAssimp/jni_bridge/jbridge_Animation.cpp new file mode 100644 index 000000000..63cdb7836 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Animation.cpp @@ -0,0 +1,41 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; + +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_Animation::Initialize() +{ + AIJ_LOAD_CLASS(); + + AIJ_LOAD_FIELD(name); + AIJ_LOAD_FIELD(mDuration); + AIJ_LOAD_FIELD(mTicksPerSecond); + AIJ_LOAD_FIELD(nodeAnims); +} +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_Animation::Fill(jobject obj,const aiAnimation* pcSrc) +{ + jobjectArray ja; + JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; + pc->SetObjectField(obj,name,JNU_NewStringNative(pc,pcSrc->mName.data)); + pc->SetDoubleField(obj,mDuration,pcSrc->mDuration); + pc->SetDoubleField(obj,mTicksPerSecond,pcSrc->mTicksPerSecond); + + // copy node animations + if (pcSrc->mNumChannels) { + JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mChannels,pcSrc->mNumChannels, + AIJ_GET_HANDLE(assimp.NodeAnim),ja); + pc->SetObjectField(obj,nodeAnims,ja); + } +} diff --git a/port/jAssimp/jni_bridge/jbridge_Bone.cpp b/port/jAssimp/jni_bridge/jbridge_Bone.cpp new file mode 100644 index 000000000..d2deb48a1 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Bone.cpp @@ -0,0 +1,66 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; + + +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_Bone::Initialize() +{ + AIJ_LOAD_CLASS(); + + AIJ_LOAD_FIELD(name); + AIJ_LOAD_FIELD(weights); + + Weight.Initialize(); +} +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_Bone::Fill(jobject obj,const aiBone* pcSrc) +{ + JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; + + // copy bone weights + if (pcSrc->mNumWeights) { + + jobjectArray jarr = pc->NewObjectArray(pcSrc->mNumWeights,Weight.Class,0); + for (unsigned int i = 0; i < pcSrc->mNumWeights;++i) { + jobject jobj = pc->NewObject(Weight.Class,Weight.DefaultCtor); + + Weight.Fill(jobj,&pcSrc->mWeights[i]); + pc->SetObjectArrayElement(jarr,i,jobj); + } + pc->SetObjectField(obj,weights,jarr); + } + pc->SetObjectField(obj,name,JNU_NewStringNative(pc,pcSrc->mName.data)); + + jobject matrix = pc->NewObject(AIJ_GET_CLASS_HANDLE(assimp.Matrix4x4),AIJ_GET_DEFAULT_CTOR_HANDLE(assimp.Matrix4x4)); + AIJ_GET_HANDLE(assimp.Matrix4x4).Fill(matrix,&pcSrc->mOffsetMatrix); + pc->SetObjectField(obj,name,matrix); +} + +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_Bone::_Weight::Initialize() +{ + AIJ_LOAD_CLASS(); + AIJ_LOAD_FIELD(index); + AIJ_LOAD_FIELD(weight); +} + +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_Bone::_Weight::Fill(jobject obj,const aiVertexWeight* pcSrc) +{ + JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; + + pc->SetIntField(obj,index,(jint)pcSrc->mVertexId); + pc->SetFloatField(obj,weight,(jfloat)pcSrc->mWeight); +} diff --git a/port/jAssimp/jni_bridge/jbridge_BoneAnim.cpp b/port/jAssimp/jni_bridge/jbridge_BoneAnim.cpp new file mode 100644 index 000000000..01f01f838 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_BoneAnim.cpp @@ -0,0 +1,56 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; + +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_NodeAnim::Initialize() +{ + AIJ_LOAD_CLASS(); + + AIJ_LOAD_FIELD(mName); + AIJ_LOAD_FIELD(mPosKeys); + AIJ_LOAD_FIELD(mScalingKeys); + AIJ_LOAD_FIELD(mQuatKeys); + + VectorKey.Initialize(); + QuatKey.Initialize(); +} +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_NodeAnim::Fill(jobject obj,const aiNodeAnim* pcSrc) +{ + jobjectArray ja; + JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; + pc->SetObjectField(obj,mName,JNU_NewStringNative(pc,pcSrc->mNodeName.data)); + + // copy position keys + if (pcSrc->mNumPositionKeys) { + JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mPositionKeys,pcSrc->mNumPositionKeys, + AIJ_GET_HANDLE(assimp.NodeAnim.VectorKey),ja); + pc->SetObjectField(obj,mPosKeys,ja); + } + + // copy scaling keys + if (pcSrc->mNumScalingKeys) { + JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mScalingKeys,pcSrc->mNumScalingKeys, + AIJ_GET_HANDLE(assimp.NodeAnim.VectorKey),ja); + pc->SetObjectField(obj,mScalingKeys,ja); + } + + // copy rotation keys + if (pcSrc->mNumRotationKeys) { + JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mRotationKeys,pcSrc->mNumRotationKeys, + AIJ_GET_HANDLE(assimp.NodeAnim.QuatKey),ja); + pc->SetObjectField(obj,mQuatKeys,ja); + } +} diff --git a/port/jAssimp/jni_bridge/jbridge_Camera.cpp b/port/jAssimp/jni_bridge/jbridge_Camera.cpp new file mode 100644 index 000000000..4445a04c8 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Camera.cpp @@ -0,0 +1,14 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; diff --git a/port/jAssimp/jni_bridge/JNIEnvironment.cpp b/port/jAssimp/jni_bridge/jbridge_Environment.cpp similarity index 65% rename from port/jAssimp/jni_bridge/JNIEnvironment.cpp rename to port/jAssimp/jni_bridge/jbridge_Environment.cpp index ee738d1f2..35165c29b 100644 --- a/port/jAssimp/jni_bridge/JNIEnvironment.cpp +++ b/port/jAssimp/jni_bridge/jbridge_Environment.cpp @@ -1,121 +1,117 @@ -/* ---------------------------------------------------------------------------- -Open Asset Import Library (ASSIMP) ---------------------------------------------------------------------------- -Copyright (c) 2006-2008, ASSIMP Development Team - -All rights reserved. -See the disclaimer in JNIEnvironment.h for licensing and distribution -conditions. ---------------------------------------------------------------------------- -*/ - -/** @file Implementation of the JNI API for jAssimp */ - -#include "JNIEnvironment.h" -#include "JNILogger.h" +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ +#include "jbridge_pch.h" using namespace Assimp; -namespace Assimp { -namespace JNIBridge { - // ------------------------------------------------------------------------------------------------ bool JNIEnvironment::AttachToCurrentThread (JNIEnv* pcEnv) { ai_assert(NULL != pcEnv); // now initialize the thread-local storage - if (NULL == this->ptr.get()) - { + if (!ptr.get()) { // attach to the current thread JavaVM* vm; pcEnv->GetJavaVM(&vm); vm->AttachCurrentThread((void **) &pcEnv, NULL); - this->ptr.reset(new JNIThreadData(pcEnv)); + ptr.reset(new JNIThreadData(pcEnv)); } // increase the reference counter - else this->ptr->m_iNumRef++; + else ptr->m_iNumRef++; // attach the logger - ((JNILogDispatcher*)DefaultLogger::get())->OnAttachToCurrentThread(this->ptr.get()); - + ((JNILogDispatcher*)DefaultLogger::get())->OnAttachToCurrentThread(ptr.get()); // get handles to all methods/fields/classes - this->Initialize(); - + Initialize(); return true; } + // ------------------------------------------------------------------------------------------------ bool JNIEnvironment::DetachFromCurrentThread () { ai_assert(NULL != pcEnv); // detach the logger - ((JNILogDispatcher*)DefaultLogger::get())->OnDetachFromCurrentThread(this->ptr.get()); + ((JNILogDispatcher*)DefaultLogger::get())->OnDetachFromCurrentThread(ptr.get()); // decrease the reference counter - if (NULL != this->ptr.get()) - { - this->ptr->m_iNumRef--; - if (0 == this->ptr->m_iNumRef) - { + if (NULL != ptr.get()) { + + ptr->m_iNumRef--; + if (0 == ptr->m_iNumRef) { + JavaVM* vm; - this->ptr->m_pcEnv->GetJavaVM(&vm); + ptr->m_pcEnv->GetJavaVM(&vm); vm->DetachCurrentThread(); } } return true; } + // ------------------------------------------------------------------------------------------------ JNIThreadData* JNIEnvironment::GetThread() { - ai_assert(NULL != this->ptr.get()); - return this->ptr.get(); + ai_assert(NULL != ptr.get()); + return ptr.get(); } + // ------------------------------------------------------------------------------------------------ void JNIEnvironment::_java::_lang::_String::Initialize() { JNIEnv* pcEnv = JNIEnvironment::Get()->GetThread()->m_pcEnv; // first initialize some members - if( !(this->Class = pcEnv->FindClass("java.lang.String"))) - JNIEnvironment::Get()->ThrowNativeError("Unable to get handle of class java.lang.String"); - - if( !(this->getBytes = pcEnv->GetMethodID(this->Class,"getBytes","()[byte"))) - JNIEnvironment::Get()->ThrowNativeError("Unable to get handle of class java.lang.String"); + if( !(Class = pcEnv->FindClass("java.lang.String"))) { + JNIEnvironment::Get()->ThrowNativeError("Can't get handle of class java.lang.String"); + } - if( !(this->constructor_ByteArray = pcEnv->GetStaticMethodID( - this->Class,"","([byte)V"))) - JNIEnvironment::Get()->ThrowNativeError("Unable to get handle of class java.lang.String"); + if( !(getBytes = pcEnv->GetMethodID(Class,"getBytes","()[byte"))) { + JNIEnvironment::Get()->ThrowNativeError("Can't get handle of class java.lang.String"); + } + + if( !(constructor_ByteArray = pcEnv->GetStaticMethodID(Class,"","([byte)V"))) { + JNIEnvironment::Get()->ThrowNativeError("Can't get handle of class java.lang.String"); + } } + // ------------------------------------------------------------------------------------------------ void JNIEnvironment::_java::_lang::_Array::Initialize() { JNIEnv* pcEnv = JNIEnvironment::Get()->GetThread()->m_pcEnv; - if( !(this->FloatArray_Class = pcEnv->FindClass("[F"))) + if( !(FloatArray_Class = pcEnv->FindClass("[F"))) JNIEnvironment::Get()->ThrowNativeError("Unable to get handle of class float[]"); - if( !(this->IntArray_Class = pcEnv->FindClass("[I"))) + if( !(IntArray_Class = pcEnv->FindClass("[I"))) JNIEnvironment::Get()->ThrowNativeError("Unable to get handle of class int[]"); } + // ------------------------------------------------------------------------------------------------ jstring JNU_NewStringNative(JNIEnv *env, const char *str) { jstring result; jbyteArray bytes = 0; int len; - if (env->EnsureLocalCapacity( 2) < 0) - { + if (env->EnsureLocalCapacity( 2) < 0) { return NULL; /* out of memory error */ } + len = (int)::strlen(str); bytes = env->NewByteArray(len); - if (bytes != NULL) - { + if (bytes != NULL) { + env->SetByteArrayRegion(bytes, 0, len, (jbyte *)str); result = (jstring)env->NewObject(AIJ_GET_HANDLE(java.lang.String.Class), @@ -125,21 +121,20 @@ jstring JNU_NewStringNative(JNIEnv *env, const char *str) } /* else fall through */ return NULL; } + // ------------------------------------------------------------------------------------------------ char *JNU_GetStringNativeChars(JNIEnv *env, jstring jstr) { jbyteArray bytes = 0; jthrowable exc; char *result = 0; - if (env->EnsureLocalCapacity(2) < 0) - { + if (env->EnsureLocalCapacity(2) < 0) { return 0; /* out of memory error */ } bytes = (jbyteArray)env->CallObjectMethod(jstr,AIJ_GET_HANDLE(java.lang.String.getBytes)); exc = env->ExceptionOccurred(); - if (!exc) - { + if (!exc) { jint len = env->GetArrayLength(bytes); result = (char *)malloc(len + 1); if (result == 0) @@ -151,36 +146,36 @@ char *JNU_GetStringNativeChars(JNIEnv *env, jstring jstr) (jbyte *)result); result[len] = 0; /* NULL-terminate */ } - else - { + else { env->DeleteLocalRef(exc); } env->DeleteLocalRef(bytes); return result; } + // ------------------------------------------------------------------------------------------------ void JNU_CopyDataToArray(JNIEnv* pc, jarray jfl, void* data, unsigned int size) { void* pf; - jboolean iscopy = FALSE; + jboolean iscopy = false; // lock the array and get direct access to its buffer - if(!(pf = pc->GetPrimitiveArrayCritical(jfl,&iscopy))) + if(!(pf = pc->GetPrimitiveArrayCritical(jfl,&iscopy))) { JNIEnvironment::Get()->ThrowNativeError("Unable to lock array"); - + } // copy the data to the array - ::memcpy(pf,data,size); + memcpy(pf,data,size); // release our reference to the array pc->ReleasePrimitiveArrayCritical(jfl,pf,0); } + // ------------------------------------------------------------------------------------------------ void JNU_CopyObjectArrayToVM(JNIEnv* pc, const void** in, unsigned int num, JNIEnvironment::_Base& type, jobjectArray& out) { jobjectArray jarr = pc->NewObjectArray(num,type.Class,0); - for (unsigned int i = 0; i < num;++i) - { + for (unsigned int i = 0; i < num;++i) { jobject jobj = pc->NewObject(type.Class,type.DefaultCtor); type.Fill(jobj,in[i]); @@ -189,6 +184,3 @@ void JNU_CopyObjectArrayToVM(JNIEnv* pc, const void** in, unsigned int num, out = jarr; } -};}; - - diff --git a/port/jAssimp/jni_bridge/jbridge_Environment.h b/port/jAssimp/jni_bridge/jbridge_Environment.h new file mode 100644 index 000000000..6860b09c2 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Environment.h @@ -0,0 +1,506 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#ifndef INCLUDED_JBRIDGE_ENVIRONMENT_H +#define INCLUDED_JBRIDGE_ENVIRONMENT_H + +namespace Assimp { +namespace jbridge { + +// ----------------------------------------------------------------------------------------- +// Nasty macros. One day I'll probably switch to a generic and beautiful solution, but +// this day is still far, far away +// ----------------------------------------------------------------------------------------- + +#define _AI_CONCAT(a,b) a ## b +#define AI_CONCAT(a,b) _AI_CONCAT(a,b) + +#define AIJ_GET_JNIENV() JNIEnvironment::Get()->GetThread()->m_pcEnv + +#define AIJ_BEGIN_CLASS(name) \ + struct AI_CONCAT(_,name) : public _Base { \ + void Initialize(); \ + +#define AIJ_END_CLASS(name) \ + } name ; + +#define AIJ_SET_FIELD_TYPE(field,type) \ + const char* AI_CONCAT(QueryFieldString_,field) () { \ + return type; \ + } \ + jfieldID field; + +#define AIJ_SET_CLASS_TYPE(ctype,jtype) \ + const char* QueryClassString() { \ + return jtype; \ + } \ + void Fill(jobject obj,const ctype* pcSrc); \ + \ + inline void Fill(jobject obj,const void* pcSrc) { \ + Fill(obj,(const ctype*)pcSrc); \ + } + +#define AIJ_LOAD_CLASS() \ + JNIEnv* pc = AIJ_GET_JNIENV(); \ + \ + if(!(Class = pc->FindClass(QueryClassString()))) { \ + JNIEnvironment::Get()->ThrowNativeError(std::string("Failed to load class ") + \ + QueryClassString()); \ + } \ + DefaultCtor = pc->GetMethodID(Class,"",""); + +#define AIJ_LOAD_FIELD(name) { \ + const char* t = AI_CONCAT(QueryFieldString_,name)(); \ + name = pc->GetFieldID(Class,# name,t); \ + if (!name) \ + JNIEnvironment::Get()->ThrowNativeError(std::string("Failed to load ") + \ + QueryClassString() + "#" + t); \ + } + +// ----------------------------------------------------------------------------------------- +// ----------------------------------------------------------------------------------------- + +#define AIJ_GET_HANDLE(h) (JNIEnvironment::Get()->h) +#define AIJ_GET_DEFAULT_CTOR_HANDLE(h) (JNIEnvironment::Get()->h.DefaultCtor) +#define AIJ_GET_CLASS_HANDLE(h) (JNIEnvironment::Get()->h.Class) + +// ----------------------------------------------------------------------------------------- +// ----------------------------------------------------------------------------------------- +/** + * @brief Manages a list of JNI data structures private to a thread. + */ +struct JNIThreadData +{ + //! Default constructor + JNIThreadData() + : m_pcEnv(NULL), m_iNumRef(1) {} + + //! Construction from an existing JNIEnv + JNIThreadData(JNIEnv* env) : m_pcEnv(env), m_iNumRef(1) {} + + //! JNI environment, is attached to the thread + JNIEnv* m_pcEnv; + + //! Number of Importer instances that have been created by this thread + unsigned int m_iNumRef; +}; + + +// ----------------------------------------------------------------------------------------- +/** @brief Helper class to manage the JNI environment for multithreaded calls. + * + * It's not so simple. Java users have to create multiple instances of assimp.Importer + * to access Assimp from multiple threads, but we need to synchronize everything to a + * single Java logging implementation. + */ +class JNIEnvironment +{ +private: + + JNIEnvironment() + : m_iRefCnt(1) {} + +public: + + /** Attach a new thread to the environment */ + static JNIEnvironment* Create() { + if (NULL == s_pcEnv) { + s_pcEnv = new JNIEnvironment(); + } + else s_pcEnv->AddRef(); + return s_pcEnv; + } + + /** Static getter */ + static JNIEnvironment* Get() { + ai_assert(NULL != s_pcEnv); + return s_pcEnv; + } + + /** Add a reference to the environment */ + unsigned int AddRef() { + return ++m_iRefCnt; + } + + /** Remove a reference from the environment */ + unsigned int Release() { + + const unsigned int iNew = --m_iRefCnt; + if (0 == iNew) { + delete this; + } + return iNew; + } + + /** Attach a JNIEnv to the current thread */ + bool AttachToCurrentThread (JNIEnv* pcEnv); + + /** Detach from the current thread */ + bool DetachFromCurrentThread (); + + /** Get the thread local data of the current thread */ + JNIThreadData* GetThread(); + + /** Throw an NativeException exception with the specified error message + * The error message itself is optional. */ + void ThrowNativeError(const std::string& msg = std::string("Unknown error")); + +public: + + + // ------------------------------------------------------------------------------------ + // Reflects the part of the Java class library which we need for our dealings + // + struct _java + { + void Initialize() { + lang.Initialize(); + } + + struct _lang + { + void Initialize() { + String.Initialize(); + } + + struct _String + { + void Initialize(); + + //! Handle to the java.lang.String class + static jclass Class; + + //! Handle to the java.lang.String.getBytes() class + static jmethodID getBytes; + + //! Handle to the java.lang.String.String(byte[]) c'tor + static jmethodID constructor_ByteArray; + + } String; + + struct _Array { + void Initialize(); + + jclass FloatArray_Class; + jclass IntArray_Class; + + } Array; + + } lang; + } java; + + struct _Base { + virtual void Fill(jobject obj,const void* pcSrc) {} + + //! Handle to class + jclass Class; + + //! Handle to default c'tor + jmethodID DefaultCtor; + }; + + // ------------------------------------------------------------------------------------ + // Reflects the classes of the assimp package. + // + struct _assimp + { + //! Initializes the package assimp for use with our bridge module + inline void Initialize() { + + // The NativeException class must be initialized first as it + // is used by all other class initializion routines + NativeException.Initialize(); + Importer.Initialize(); + + // now initialize all other classes, the order doesn't care. + Face.Initialize(); + Scene.Initialize(); + Importer.Initialize(); + Mesh.Initialize(); + Bone.Initialize(); + Animation.Initialize(); + NodeAnim.Initialize(); + Texture.Initialize(); + CompressedTexture.Initialize(); + Matrix3x3.Initialize(); + Matrix4x4.Initialize(); + Quaternion.Initialize(); + Node.Initialize(); + Material.Initialize(); + Camera.Initialize(); + Light.Initialize(); + }; + + //! Represents the JNI interface to class assimp.NativeException + AIJ_BEGIN_CLASS(NativeException) + AIJ_END_CLASS(NativeException) + + //! Represents the JNI interface to class assimp.Importer + AIJ_BEGIN_CLASS(Importer) + AIJ_SET_CLASS_TYPE(Assimp::Importer,"assimp.Importer"); + AIJ_SET_FIELD_TYPE(scene,"Lassimp.Scene"); + + AIJ_END_CLASS(Importer) + + //! Represents the JNI interface to class assimp.Scene + AIJ_BEGIN_CLASS(Scene) + AIJ_SET_CLASS_TYPE(aiScene,"assimp.Scene"); + + AIJ_SET_FIELD_TYPE(m_vTextures,"[Lassimp.Texture"); + AIJ_SET_FIELD_TYPE(m_vCameras,"[Lassimp.Camera"); + AIJ_SET_FIELD_TYPE(m_vLights,"[Lassimp.Light"); + AIJ_SET_FIELD_TYPE(m_vMeshes,"[Lassimp.Mesh"); + AIJ_SET_FIELD_TYPE(m_vMaterials,"[Lassimp.Material"); + AIJ_SET_FIELD_TYPE(m_vAnimations,"[Lassimp.Animation"); + AIJ_SET_FIELD_TYPE(m_rootNode,"[Lassimp.Node"); + AIJ_SET_FIELD_TYPE(flags,"I"); + + AIJ_END_CLASS(Scene) + + //! Represents the JNI interface to class assimp.Mesh + AIJ_BEGIN_CLASS(Mesh) + AIJ_SET_CLASS_TYPE(aiMesh,"assimp.Mesh"); + + AIJ_SET_FIELD_TYPE(m_iPrimitiveTypes,"I"); + AIJ_SET_FIELD_TYPE(m_vVertices,"[[F"); + AIJ_SET_FIELD_TYPE(m_vTangents,"[[F"); + AIJ_SET_FIELD_TYPE(m_vBitangents,"[[F"); + AIJ_SET_FIELD_TYPE(m_vNormals,"[[F"); + AIJ_SET_FIELD_TYPE(m_avUVs,"[[F"); + AIJ_SET_FIELD_TYPE(m_vFaces,"[[F"); + AIJ_SET_FIELD_TYPE(m_avColors,"[[F"); + AIJ_SET_FIELD_TYPE(m_aiNumUVComponents,"[I"); + AIJ_SET_FIELD_TYPE(m_vBones,"[Lassimp.Bone"); + AIJ_SET_FIELD_TYPE(m_iMaterialIndex,"I"); + AIJ_END_CLASS(Mesh) + + //! Represents the JNI interface to class assimp.Face + AIJ_BEGIN_CLASS(Face) + AIJ_SET_CLASS_TYPE(aiFace,"assimp.Face"); + + AIJ_SET_FIELD_TYPE(indices,"LI"); + AIJ_END_CLASS(Face) + + //! Represents the JNI interface to class assimp.Bone + AIJ_BEGIN_CLASS(Bone) + AIJ_SET_CLASS_TYPE(aiBone,"assimp.Bone"); + + AIJ_SET_FIELD_TYPE(name,"Ljava.lang.String"); + AIJ_SET_FIELD_TYPE(weights,"[Lassimp.Bone.Weight"); + + //! Represents the JNI interface to class assimp.Bone.Weight + AIJ_BEGIN_CLASS(Weight) + AIJ_SET_CLASS_TYPE(aiVertexWeight,"assimp.Bone.Weight"); + + AIJ_SET_FIELD_TYPE(index,"I"); + AIJ_SET_FIELD_TYPE(weight,"F"); + AIJ_END_CLASS(Weight) + AIJ_END_CLASS(Bone) + + //! Represents the JNI interface to class assimp.Animation + AIJ_BEGIN_CLASS(Animation) + AIJ_SET_CLASS_TYPE(aiAnimation,"assimp.Animation"); + + AIJ_SET_FIELD_TYPE(name,"Ljava.lang.String"); + AIJ_SET_FIELD_TYPE(mDuration,"D"); + AIJ_SET_FIELD_TYPE(mTicksPerSecond,"D"); + AIJ_SET_FIELD_TYPE(nodeAnims,"[Lassimp.NodeAnim"); + AIJ_END_CLASS(Animation) + + //! Represents the JNI interface to class assimp.NodeAnim + AIJ_BEGIN_CLASS(NodeAnim) + AIJ_SET_CLASS_TYPE(aiNodeAnim,"assimp.NodeAnim"); + + //! Represents the JNI interface to class assimp.BoneAnim.KeyFrame + AIJ_BEGIN_CLASS(VectorKey) + AIJ_SET_CLASS_TYPE(aiVectorKey,"Lassimp.NodeAnim.KeyFrame<[F>"); + + AIJ_SET_FIELD_TYPE(time,"D"); + AIJ_SET_FIELD_TYPE(value,"[F"); + AIJ_END_CLASS(VectorKey) + + //! Represents the JNI interface to class assimp.BoneAnim.KeyFrame + AIJ_BEGIN_CLASS(QuatKey) + AIJ_SET_CLASS_TYPE(aiQuatKey,"Lassimp.NodeAnim.KeyFrame"); + + AIJ_SET_FIELD_TYPE(time,"D"); + AIJ_SET_FIELD_TYPE(value,"Lassimp.Quaternion"); + AIJ_END_CLASS(QuatKey) + + AIJ_SET_FIELD_TYPE(mName,"Ljava.lang.String"); + AIJ_SET_FIELD_TYPE(mQuatKeys,"[Lassimp.NodeAnim.KeyFrame"); + AIJ_SET_FIELD_TYPE(mPosKeys, "[Lassimp.NodeAnim.KeyFrame<[F>"); + AIJ_SET_FIELD_TYPE(mScalingKeys,"[Lassimp.NodeAnim.KeyFrame<[F>"); + AIJ_END_CLASS(NodeAnim) + + //! Represents the JNI interface to class assimp.Texture + AIJ_BEGIN_CLASS(Texture) + AIJ_SET_CLASS_TYPE(aiTexture,"assimp.Texture"); + + AIJ_SET_FIELD_TYPE(width,"I"); + AIJ_SET_FIELD_TYPE(height,"I"); + AIJ_SET_FIELD_TYPE(data,"[b"); + AIJ_END_CLASS(Texture) + + //! Represents the JNI interface to class assimp.CompressedTexture + AIJ_BEGIN_CLASS(CompressedTexture) + AIJ_SET_CLASS_TYPE(aiTexture,"assimp.CompressedTexture"); + AIJ_SET_FIELD_TYPE(m_format,"Ljava.lang.String"); + AIJ_END_CLASS(CompressedTexture) + + //! Represents the JNI interface to class assimp.Material + AIJ_BEGIN_CLASS(Material) + AIJ_SET_CLASS_TYPE(aiMaterial,"assimp.Material"); + + //! Represents the JNI interface to class assimp.Material.Property + AIJ_BEGIN_CLASS(Property) + AIJ_SET_CLASS_TYPE(aiMaterialProperty,"assimp.Material.Property"); + + AIJ_SET_FIELD_TYPE(key,"L.java.lang.String"); + AIJ_SET_FIELD_TYPE(value,"Ljava.lang.Object"); + AIJ_END_CLASS(Property) + + AIJ_SET_FIELD_TYPE(properties,"[Lassimp.Material.Property"); + AIJ_END_CLASS(Material) + + //! Represents the JNI interface to class assimp.Matrix4x4 + AIJ_BEGIN_CLASS(Matrix4x4) + AIJ_SET_CLASS_TYPE(aiMatrix4x4,"assimp.Matrix4x4"); + AIJ_SET_FIELD_TYPE(coeff,"[F"); + AIJ_END_CLASS(Matrix4x4) + + //! Represents the JNI interface to class assimp.Matrix3x3 + AIJ_BEGIN_CLASS(Matrix3x3) + AIJ_SET_CLASS_TYPE(aiMatrix3x3,"assimp.Matrix3x3"); + AIJ_SET_FIELD_TYPE(coeff,"[F"); + AIJ_END_CLASS(Matrix3x3) + + //! Represents the JNI interface to class assimp.Quaternion + AIJ_BEGIN_CLASS(Quaternion) + AIJ_SET_CLASS_TYPE(aiQuaternion,"assimp.Quaternion"); + + AIJ_SET_FIELD_TYPE(x,"F"); + AIJ_SET_FIELD_TYPE(y,"F"); + AIJ_SET_FIELD_TYPE(z,"F"); + AIJ_SET_FIELD_TYPE(w,"F"); + AIJ_END_CLASS(Quaternion) + + //! Represents the JNI interface to class assimp.Node + AIJ_BEGIN_CLASS(Node) + AIJ_SET_CLASS_TYPE(aiNode,"assimp.Node"); + + AIJ_SET_FIELD_TYPE(meshIndices,"[I"); + AIJ_SET_FIELD_TYPE(name,"Ljava.lang.String"); + AIJ_SET_FIELD_TYPE(children,"[Lassimp.Node"); + AIJ_SET_FIELD_TYPE(nodeTransform,"Lassimp.Matrix4x4"); + AIJ_SET_FIELD_TYPE(parent,"Lassimp.Node"); + AIJ_END_CLASS(Node) + + //! Represents the JNI interface to class assimp.Camera + AIJ_BEGIN_CLASS(Camera) + AIJ_SET_CLASS_TYPE(aiCamera,"assimp.Camera"); + + AIJ_SET_FIELD_TYPE(mName,"Ljava.lang.String"); + AIJ_SET_FIELD_TYPE(mPosition,"[F"); + AIJ_SET_FIELD_TYPE(mUp,"[F"); + AIJ_SET_FIELD_TYPE(mLookAt,"[F"); + AIJ_SET_FIELD_TYPE(mHorizontalFOV,"F"); + AIJ_SET_FIELD_TYPE(mClipPlaneNear,"F"); + AIJ_SET_FIELD_TYPE(mClipPlaneFar,"F"); + AIJ_SET_FIELD_TYPE(mAspect,"F"); + AIJ_END_CLASS(Camera) + + //! Represents the JNI interface to class assimp.Light + AIJ_BEGIN_CLASS(Light) + AIJ_SET_CLASS_TYPE(aiLight,"assimp.Light"); + + AIJ_SET_FIELD_TYPE(mName,"[I"); + AIJ_SET_FIELD_TYPE(mType,"I"); + AIJ_SET_FIELD_TYPE(mPosition,"[F"); + AIJ_SET_FIELD_TYPE(mDirection,"[F"); + AIJ_SET_FIELD_TYPE(mAttenuationConstant,"F"); + AIJ_SET_FIELD_TYPE(mAttenuationLinear,"F"); + AIJ_SET_FIELD_TYPE(mAttenuationQuadratic,"F"); + AIJ_SET_FIELD_TYPE(mColorDiffuse,"[F"); + AIJ_SET_FIELD_TYPE(mColorSpecular,"[F"); + AIJ_SET_FIELD_TYPE(mColorAmbient,"[F"); + AIJ_SET_FIELD_TYPE(mAngleInnerCone,"F"); + AIJ_SET_FIELD_TYPE(mAngleOuterCone,"F"); + AIJ_END_CLASS(Light) + } assimp; + + //! Master initialization of all stuff we need + void Initialize() + { + assimp.Initialize(); + java.Initialize(); + } + +private: + + //! Singleton instance + static JNIEnvironment* s_pcEnv; + + //! TLS data + boost::thread_specific_ptr ptr; + + //! Reference counter of the whole class + unsigned int m_iRefCnt; +}; + +// --------------------------------------------------------------------------- +/** @brief Helper function to copy data to a Java array + * + * @param pc JNI env handle + * @param jfl Java array + * @param data Input data + * @param size Size of data to be copied, in bytes + */ +void JNU_CopyDataToArray(JNIEnv* pc, jarray jfl, void* data, unsigned int size); + +// --------------------------------------------------------------------------- +/** @brief Helper function to create a java.lang.String from a native char*. + * + * This function has been taken from + * http://java.sun.com/docs/books/jni/html/other.html#26021 + */ +jstring JNU_NewStringNative(JNIEnv *env, const char *str); + +// --------------------------------------------------------------------------- +/** @brief Helper function to create a char* from a managed jstring + * + * This function has been taken from + * http://java.sun.com/docs/books/jni/html/other.html#26021 + */ +char* JNU_GetStringNativeChars(JNIEnv *env, jstring jstr); + +// --------------------------------------------------------------------------- +/** @brief Helper function to copy a whole object array to the VM + * + * @param pc JNI env handle + * @param in Input object array + * @param num Size of input array + * @param type Type of input + * @param out Output object + */ +// --------------------------------------------------------------------------- +void JNU_CopyObjectArrayToVM(JNIEnv* pc, const void** in, unsigned int num, + JNIEnvironment::_Base& type, jobjectArray& out); + +}} // end namespaces + +using namespace Assimp; +using namespace Assimp::jbridge; + +#include "jbridge_Logger.h" +#endif //! AI_JNIENVIRONMENT_H_INCLUDED + diff --git a/port/jAssimp/jni_bridge/jbridge_IOStream.cpp b/port/jAssimp/jni_bridge/jbridge_IOStream.cpp new file mode 100644 index 000000000..4445a04c8 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_IOStream.cpp @@ -0,0 +1,14 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; diff --git a/port/jAssimp/jni_bridge/jbridge_IOSystem.cpp b/port/jAssimp/jni_bridge/jbridge_IOSystem.cpp new file mode 100644 index 000000000..4445a04c8 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_IOSystem.cpp @@ -0,0 +1,14 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; diff --git a/port/jAssimp/jni_bridge/jbridge_Importer.cpp b/port/jAssimp/jni_bridge/jbridge_Importer.cpp new file mode 100644 index 000000000..31e321f09 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Importer.cpp @@ -0,0 +1,283 @@ +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; + +// include the header files generated by javah +#include "assimp_Importer.h" +#include + +// used as error return code +#define AI_JNI_ERROR_RETURN 0xffffffff + +//////////////////////////////////////////////////////////////////////////////////// +/* typedef for a jassimp context, used to identify the Importer object which + * belongs to a particular java Importer. + */ +//////////////////////////////////////////////////////////////////////////////////// + +typedef uint64_t JASSIMP_CONTEXT; + +#ifdef JASSIMP_DEBUG_CHECKS + typedef std::list< JASSIMP_CONTEXT > ImporterContextList; + static ImporterContextList g_listActiveContexts; + +// ------------------------------------------------------------------------------------------------ +/* DEBUG: Check the validity of a particular context. +*/ +bool jValidateContext (JASSIMP_CONTEXT context) +{ + ImporterContextList::const_iterator t = std::find( g_listActiveContexts.begin(),g_listActiveContexts.end(),context); + if (t != g_listActiveContexts.end() { + return true; + } + + DefaultLogger::get()->error("[jnibridge] Invalid context"); + return false; +} + +// ------------------------------------------------------------------------------------------------ +/* DEBUG: Check the validity of a particular scene +*/ +bool jValidateScene (const aiScene* scene) +{ + if (!scene) { + DefaultLogger::get()->error("[jnibridge] There's not asset"); + return false; + } + return true; +} +#endif // ! ASSIMP_DEBUG + +// ------------------------------------------------------------------------------------------------ +/* Get the #Assimp::Importer for a particular JASSIMP_CONTEXT +*/ +Assimp::Importer* jGetValidImporterScenePair (JASSIMP_CONTEXT jvmcontext) +{ +#ifdef JASSIMP_DEBUG_CHECKS + if (!jValidateContext((JASSIMP_CONTEXT)jvmcontext)) { + return NULL; + } +#endif // ! ASSIMP_DEBUG + + // get the importer instance from the context + Assimp::Importer* pcImp = (Assimp::Importer*)jvmcontext; + +#ifdef DEBUG + if (!jValidateScene(pcImp->GetScene())) { + return NULL; + } +#endif // ! ASSIMP_DEBUG + return pcImp; +} + +// ------------------------------------------------------------------------------------------------ +/* +* Class: assimp_Importer +* Method: _NativeInitContext +* Signature: ()I +*/ +JNIEXPORT jlong JNICALL Java_assimp_Importer__1NativeInitContext +(JNIEnv * jvmenv, jobject jvmthis, jint version) { + // 2^64-1 indicates error + JASSIMP_CONTEXT context = 0xffffffffffffffffL; + + if (version != assimp_Importer_ABI_VERSION) { + return context; + } + + // create a new Importer instance + Assimp::Importer* pcImp = new Assimp::Importer(); + context = (JASSIMP_CONTEXT)(uintptr_t)pcImp; + +#ifdef JASSIMP_DEBUG_CHECKS + g_listActiveContexts.push_back(context); +#endif // ! ASSIMP_DEBUG + + // need to setup the logger ... or did we already initialize it? + JNILogDispatcher* pcLogger; + if (DefaultLogger::isNullLogger()) { + pcLogger = new JNILogDispatcher(); + DefaultLogger::set (pcLogger); + } + else { + JNILogDispatcher* pcLogger = ( JNILogDispatcher* )DefaultLogger::get(); + pcLogger->AddRef(); + } + + // setup the JNI environment + if(!JNIEnvironment::Get()->AttachToCurrentThread(jvmenv)) { + return 0xffffffffffffffffL; + } + + // return our native context handle to the caller + return context; +} + +// ------------------------------------------------------------------------------------------------ +/* +* Class: assimp_Importer +* Method: _NativeFreeContext +* Signature: (I)I +*/ +JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeFreeContext +(JNIEnv * jvmenv, jobject jvmthis, jlong jvmcontext) +{ + +#ifdef JASSIMP_DEBUG_CHECKS + if (!jValidateContext((JASSIMP_CONTEXT)jvmcontext)) { + return AI_JNI_ERROR_RETURN; + } +#endif // ! ASSIMP_DEBUG + + // delete the underlying Importer instance + Assimp::Importer* pcImp = (Assimp::Importer*)jvmcontext; + delete pcImp; + +#ifdef JASSIMP_DEBUG_CHECKS + g_listActiveContexts.remove(jvmcontext); +#endif // ! ASSIMP_DEBUG + + JNIEnvironment::Get()->DetachFromCurrentThread(); + return 0; +} + +// ------------------------------------------------------------------------------------------------ +/* +* Class: assimp_Importer +* Method: _NativeLoad +* Signature: (Ljava/lang/String;II)I +*/ +JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeLoad +(JNIEnv *jvmenv, jobject jvmthis, jstring jvmpath, jint jvmflags, jlong jvmcontext) +{ + jint iRet = 0; + +#ifdef JASSIMP_DEBUG_CHECKS + if (!jValidateContext((JASSIMP_CONTEXT)jvmcontext)) { + return AI_JNI_ERROR_RETURN; + } +#endif // ! ASSIMP_DEBUG + + // get the path from the jstring + const char* szPath = JNU_GetStringNativeChars(jvmenv,jvmpath); + if (!szPath) { + DefaultLogger::get()->error("[jnibridge] Unable to get path string from the java vm"); + return AI_JNI_ERROR_RETURN; + } + // get the importer instance from the context + Assimp::Importer* pcImp = (Assimp::Importer*)jvmcontext; + const aiScene* pcOut; + + // and load the file. The aiScene object itself remains accessible via Importer.GetScene(). + if(!(pcOut = pcImp->ReadFile(std::string(szPath),(unsigned int)jvmflags))) { + + DefaultLogger::get()->error("[jnibridge] Unable to load asset"); + free((void*)szPath); + return AI_JNI_ERROR_RETURN; + } + + free((void*)szPath); + + // allocate a new assimp.Scene object to be returned by the importer + jobject jScene; + if(!(jScene = jvmenv->AllocObject(AIJ_GET_HANDLE(assimp.Importer.Class)))) { + + DefaultLogger::get()->error("[jnibridge] Unable to allocate output scene"); + return AI_JNI_ERROR_RETURN; + } + + // fill the assimp.Scene instance with our data ... + JNIEnvironment::Get()->assimp.Scene.Fill(jScene,pcOut); + + // ... and store it in the Importer instance + jvmenv->SetObjectField(jvmthis,AIJ_GET_HANDLE(assimp.Importer.scene),jScene); + + // .. and finally we don't need th scene anymore + pcImp->FreeScene(); + return iRet; +} + +// ------------------------------------------------------------------------------------------------ +/* +* Class: assimp_Importer +* Method: _NativeSetPropertyInt +* Signature: (Ljava/lang/String;IJ)I +*/ +JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeSetPropertyInt +(JNIEnv * jvmenv, jobject _this, jstring name, jint value, jlong jvmcontext) +{ +#ifdef JASSIMP_DEBUG_CHECKS + if (!jValidateContext((JASSIMP_CONTEXT)jvmcontext)) { + return AI_JNI_ERROR_RETURN; + } +#endif // ! ASSIMP_DEBUG + + Assimp::Importer* pcImp = (Assimp::Importer*)jvmcontext; + const char* sz = JNU_GetStringNativeChars(jvmenv,name); + + // set the property + pcImp->SetPropertyInteger(sz,(int)value,NULL); + free((void*)sz); + return 0; +} + + +// ------------------------------------------------------------------------------------------------ +/* +* Class: assimp_Importer +* Method: _NativeSetPropertyFloat +* Signature: (Ljava/lang/String;FJ)I +*/ +JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeSetPropertyFloat +(JNIEnv * jvmenv, jobject _this, jstring name, jfloat value, jlong jvmcontext) +{ +#ifdef JASSIMP_DEBUG_CHECKS + if (!jValidateContext((JASSIMP_CONTEXT)jvmcontext)) { + return AI_JNI_ERROR_RETURN; + } +#endif // ! ASSIMP_DEBUG + + Assimp::Importer* pcImp = (Assimp::Importer*)jvmcontext; + const char* sz = JNU_GetStringNativeChars(jvmenv,name); + + // set the property + pcImp->SetPropertyFloat(sz,(float)value,NULL); + free((void*)sz); + return 0; +} + +// ------------------------------------------------------------------------------------------------ +/* +* Class: assimp_Importer +* Method: _NativeSetPropertyString +* Signature: (Ljava/lang/String;Ljava/lang/String;J)I +*/ +JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeSetPropertyString +(JNIEnv * jvmenv, jobject _this, jstring name, jstring value, jlong jvmcontext) +{ +#ifdef JASSIMP_DEBUG_CHECKS + if (!jValidateContext((JASSIMP_CONTEXT)jvmcontext)) { + return AI_JNI_ERROR_RETURN; + } +#endif // ! ASSIMP_DEBUG + + Assimp::Importer* pcImp = (Assimp::Importer*)jvmcontext; + const char* sz = JNU_GetStringNativeChars(jvmenv,name); + const char* sc = JNU_GetStringNativeChars(jvmenv,value); + + // set the property + pcImp->SetPropertyString(sz,sc,NULL); + free((void*)sz); + free((void*)sc); + return 0; +} diff --git a/port/jAssimp/jni_bridge/jbridge_Light.cpp b/port/jAssimp/jni_bridge/jbridge_Light.cpp new file mode 100644 index 000000000..4445a04c8 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Light.cpp @@ -0,0 +1,14 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; diff --git a/port/jAssimp/jni_bridge/jbridge_Logger.cpp b/port/jAssimp/jni_bridge/jbridge_Logger.cpp new file mode 100644 index 000000000..e260f01aa --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Logger.cpp @@ -0,0 +1,102 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; + + +// ------------------------------------------------------------------------------------------------ +bool JNILogDispatcher::OnAttachToCurrentThread(JNIThreadData* pcData) +{ + ai_assert(NULL != pcData); + //this->AddRef(); - done at another location + + // There is much error handling code in this function. We do it to be absolutely sure that the + // interface is of the same version on both sides. + JNIEnv* jvmenv = AIJ_GET_JNIENV(); + + // get a handle to the assimp.DefaultLogger class + if (!m_pcClass) { + if( NULL == (m_pcClass = jvmenv->FindClass("assimp.DefaultLogger"))) { + return false; + } + } + // get handles to the logging functions + if (!m_pcMethodError) { + if( !(m_pcMethodError = jvmenv->GetStaticMethodID(m_pcClass,"_NativeCallWriteError","(Ljava/lang/String;)V"))) { + return false; + } + } + if (!m_pcMethodWarn) { + if( !(m_pcMethodWarn = jvmenv->GetStaticMethodID(m_pcClass,"_NativeCallWriteWarn","(Ljava/lang/String;)V"))) { + return false; + } + } + if (!m_pcMethodInfo) { + if( !(m_pcMethodInfo = jvmenv->GetStaticMethodID(m_pcClass,"_NativeCallWriteInfo","(Ljava/lang/String;)V"))) { + return false; + } + } + if (!m_pcMethodDebug) { + if( !(m_pcMethodDebug = jvmenv->GetStaticMethodID(m_pcClass,"_NativeCallWriteDebug","(Ljava/lang/String;)V"))) { + return false; + } + } + return true; +} + +// ------------------------------------------------------------------------------------------------ +bool JNILogDispatcher::OnDetachFromCurrentThread(JNIThreadData* pcData) +{ + Release(); + return true; +} + +// ------------------------------------------------------------------------------------------------ +void JNILogDispatcher::debug(const std::string &message) +{ + JNIEnv* jvmenv = AIJ_GET_JNIENV(); + jstring jstr = JNU_NewStringNative(jvmenv,message.c_str()); + + jvmenv->CallStaticVoidMethod(m_pcClass,m_pcMethodDebug,jstr); + jvmenv->DeleteLocalRef(jstr); +} + +// ------------------------------------------------------------------------------------------------ +void JNILogDispatcher::info(const std::string &message) +{ + JNIEnv* jvmenv = AIJ_GET_JNIENV(); + jstring jstr = JNU_NewStringNative(jvmenv,message.c_str()); + + jvmenv->CallStaticVoidMethod(m_pcClass,m_pcMethodInfo,jstr); + jvmenv->DeleteLocalRef(jstr); +} + +// ------------------------------------------------------------------------------------------------ +void JNILogDispatcher::warn(const std::string &message) +{ + JNIEnv* jvmenv = AIJ_GET_JNIENV(); + jstring jstr = JNU_NewStringNative(jvmenv,message.c_str()); + + jvmenv->CallStaticVoidMethod(m_pcClass,m_pcMethodWarn,jstr); + jvmenv->DeleteLocalRef(jstr); +} + +// ------------------------------------------------------------------------------------------------ +void JNILogDispatcher::error(const std::string &message) +{ + JNIEnv* jvmenv = AIJ_GET_JNIENV(); + jstring jstr = JNU_NewStringNative(jvmenv,message.c_str()); + + jvmenv->CallStaticVoidMethod(m_pcClass,m_pcMethodError,jstr); + jvmenv->DeleteLocalRef(jstr); +} diff --git a/port/jAssimp/jni_bridge/jbridge_Logger.h b/port/jAssimp/jni_bridge/jbridge_Logger.h new file mode 100644 index 000000000..8abd1e6a1 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Logger.h @@ -0,0 +1,114 @@ +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +/** @file jbridge_Logger.h + * Declaration of a log dispatching service to send all log messages to Java + */ +#ifndef INCLUDED_JBRIDGE_LOGGER_H +#define INCLUDED_JBRIDGE_LOGGER_H + +#include + +namespace Assimp { +namespace jbridge { + +// --------------------------------------------------------------------------- +class IOStream; +struct LogStreamInfo; + +// --------------------------------------------------------------------------- +/** @class JNILogDispatcher + * @brief Logging system implementation that is used to send all + * log messages generated by native code to the Java logging system. + */ +class JNILogDispatcher : public Logger +{ + friend class JNIEnvironment; + +public: + + //! Default constructor + JNILogDispatcher() + : m_iRefCnt(1) {} + + /** @brief Logs a debug message */ + void OnDebug(const char* msg); + + /** @brief Logs an info message */ + void OnInfo(const char* msg); + + /** @brief Logs a warning message */ + void OnWarn(const char* msg); + + /** @brief Logs an error message */ + void OnError(const char* msg); + + /** @brief Log severity setter */ + void setLogSeverity(LogSeverity log_severity) {} + + /** @brief Detach a still attached stream from logger */ + bool attachStream(LogStream *pStream, unsigned int severity) { + return false; + } + + /** @brief Detach a still attached stream from logger */ + bool detatchStream(LogStream *pStream, unsigned int severity) { + return false; + } + + //! COM-style reference counting mechanism + unsigned int AddRef() + { + return ++m_iRefCnt; + } + + //! COM-style reference counting mechanism + unsigned int Release() + { + const unsigned int n = --m_iRefCnt; + if (n == 0) + { + delete this; + // don't forget to reset the logger to the default implementation + DefaultLogger::set(NULL); + } + return n; + } + +private: + + //! Called by JNIEnvironment + bool OnAttachToCurrentThread(JNIThreadData* pcData); + bool OnDetachFromCurrentThread(JNIThreadData* pcData); + +private: + + //! Handle to assimp.DefaultLogger class + jclass m_pcClass; + + //! Handle to the static assimp.DefaultLogger._NativeCallWriteError() method + jmethodID m_pcMethodError; + + //! Handle to the static assimp.DefaultLogger._NativeCallWriteInfo() method + jmethodID m_pcMethodInfo; + + //! Handle to the static assimp.DefaultLogger._NativeCallWriteDebug() method + jmethodID m_pcMethodDebug; + + //! Handle to the static assimp.DefaultLogger._NativeCallWriteWarn() method + jmethodID m_pcMethodWarn; + + //! Reference counter of the logger + unsigned int m_iRefCnt; +}; +}} + +#endif // !! INCLUDED_JBRIDGE_LOGGER_H diff --git a/port/jAssimp/jni_bridge/jbridge_Material.cpp b/port/jAssimp/jni_bridge/jbridge_Material.cpp new file mode 100644 index 000000000..4445a04c8 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Material.cpp @@ -0,0 +1,14 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; diff --git a/port/jAssimp/jni_bridge/jbridge_Mesh.cpp b/port/jAssimp/jni_bridge/jbridge_Mesh.cpp new file mode 100644 index 000000000..74a872bd7 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Mesh.cpp @@ -0,0 +1,129 @@ + +/** @file Implementation of the JNI API for jAssimp */ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; + + +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_Mesh::Initialize() +{ + AIJ_LOAD_CLASS(); + + AIJ_LOAD_FIELD(m_iPrimitiveTypes); + AIJ_LOAD_FIELD(m_vVertices); + AIJ_LOAD_FIELD(m_vBitangents); + AIJ_LOAD_FIELD(m_vTangents); + AIJ_LOAD_FIELD(m_vNormals); + AIJ_LOAD_FIELD(m_avUVs); + AIJ_LOAD_FIELD(m_vFaces); + AIJ_LOAD_FIELD(m_avColors); + AIJ_LOAD_FIELD(m_aiNumUVComponents); + AIJ_LOAD_FIELD(m_vBones); + AIJ_LOAD_FIELD(m_iMaterialIndex); +} +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_Mesh::Fill(jobject obj,const aiMesh* pcSrc) +{ + jobjectArray ja; + JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; + + pc->SetIntField(obj,m_iMaterialIndex,pcSrc->mMaterialIndex); + const unsigned int vsize = pcSrc->mNumVertices*12, nsize = pcSrc->mNumVertices*3; + + // copy vertex positions + if (pcSrc->HasPositions()) { + jfloatArray jfl = pc->NewFloatArray(nsize); + JNU_CopyDataToArray(pc,jfl,pcSrc->mVertices,vsize); + + pc->SetObjectField(obj,m_vVertices,jfl); + } + + // copy vertex normals + if (pcSrc->HasNormals()) { + jfloatArray jfl = pc->NewFloatArray(nsize); + JNU_CopyDataToArray(pc,jfl,pcSrc->mNormals,vsize); + + pc->SetObjectField(obj,m_vNormals,jfl); + } + + // copy tangents and bitangents + if (pcSrc->HasTangentsAndBitangents()) { + jfloatArray jfl = pc->NewFloatArray(nsize); + JNU_CopyDataToArray(pc,jfl,pcSrc->mTangents,vsize); + pc->SetObjectField(obj,m_vTangents,jfl); + + + jfl = pc->NewFloatArray(nsize); + JNU_CopyDataToArray(pc,jfl,pcSrc->mBitangents,vsize); + pc->SetObjectField(obj,m_vBitangents,jfl); + } + + + // copy texture coordinates + if (pcSrc->HasTextureCoords(0)) { + jobjectArray jobjarr = pc->NewObjectArray(AI_MAX_NUMBER_OF_TEXTURECOORDS, + AIJ_GET_HANDLE(java.lang.Array.FloatArray_Class),0); + + unsigned int channel = 0; + while (pcSrc->HasTextureCoords(channel)) { + jfloatArray jfl = pc->NewFloatArray(nsize); + JNU_CopyDataToArray(pc,jfl,pcSrc->mTextureCoords[channel],vsize); + + pc->SetObjectArrayElement(jobjarr,channel,jfl); + ++channel; + } + + // set the corresponding field in the java object + pc->SetObjectField(obj,m_avUVs,jobjarr); + + jobjarr = (jobjectArray) pc->NewIntArray(AI_MAX_NUMBER_OF_TEXTURECOORDS); + pc->SetIntArrayRegion((jintArray)jobjarr,0,channel,(const jint*)&pcSrc->mNumUVComponents); + pc->SetObjectField(obj,m_aiNumUVComponents,jobjarr); + } + // copy vertex colors + if (pcSrc->HasVertexColors(0)) { + jobjectArray jobjarr = pc->NewObjectArray(AI_MAX_NUMBER_OF_COLOR_SETS, + AIJ_GET_HANDLE(java.lang.Array.FloatArray_Class),0); + + unsigned int channel = 0; + while (pcSrc->HasVertexColors(channel)) { + + jfloatArray jfl = pc->NewFloatArray(pcSrc->mNumVertices*4); + JNU_CopyDataToArray(pc,jfl,pcSrc->mColors[channel],pcSrc->mNumVertices*16); + + pc->SetObjectArrayElement(jobjarr,channel,jfl); + ++channel; + } + + // set the corresponding field in the java object + pc->SetObjectField(obj,m_avColors,jobjarr); + } + + // copy faces + if (pcSrc->mNumFaces) { + JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mFaces,pcSrc->mNumFaces, + AIJ_GET_HANDLE(assimp.Face),ja); + pc->SetObjectField(obj,m_vFaces,ja); + } + + // copy bones + if (pcSrc->mNumBones) { + + JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mBones,pcSrc->mNumBones, + AIJ_GET_HANDLE(assimp.Bone),ja); + pc->SetObjectField(obj,m_vBones,ja); + } +} + diff --git a/port/jAssimp/jni_bridge/jbridge_NativeException.cpp b/port/jAssimp/jni_bridge/jbridge_NativeException.cpp new file mode 100644 index 000000000..fc49f3a39 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_NativeException.cpp @@ -0,0 +1,36 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; + +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_NativeException::Initialize() +{ + // get a handle to the JNI context for this thread + JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; + + // and load a handle to the class + if(!(Class = pc->FindClass("assimp.NativeException"))) { + pc->ThrowNew(pc->FindClass("java.lang.Exception"),"Unable to load class assimp.NativeException"); // :-) + } +} + +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::ThrowNativeError(const std::string& msg) +{ + // get a handle to the JNI context for this thread ... + JNIEnv* pc = GetThread()->m_pcEnv; + + // and throw a new assimp.NativeException + pc->ThrowNew(assimp.NativeException.Class,msg.c_str()); +} diff --git a/port/jAssimp/jni_bridge/jbridge_Node.cpp b/port/jAssimp/jni_bridge/jbridge_Node.cpp new file mode 100644 index 000000000..fb7881587 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Node.cpp @@ -0,0 +1,14 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; \ No newline at end of file diff --git a/port/jAssimp/jni_bridge/jbridge_Scene.cpp b/port/jAssimp/jni_bridge/jbridge_Scene.cpp new file mode 100644 index 000000000..7fe4cbc36 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Scene.cpp @@ -0,0 +1,88 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; + +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_Scene::Initialize() +{ + AIJ_LOAD_CLASS(); + + AIJ_LOAD_FIELD(m_rootNode); + AIJ_LOAD_FIELD(m_vAnimations); + AIJ_LOAD_FIELD(m_vMaterials); + AIJ_LOAD_FIELD(m_vMeshes); + AIJ_LOAD_FIELD(m_vTextures); + AIJ_LOAD_FIELD(m_vLights); + AIJ_LOAD_FIELD(m_vCameras); + AIJ_LOAD_FIELD(flags); +} + +// ------------------------------------------------------------------------------------------------ +void JNIEnvironment::_assimp::_Scene::Fill(jobject obj,const aiScene* pcSrc) +{ + JNIEnv* pc = JNIEnvironment::Get()->GetThread()->m_pcEnv; + jobjectArray ja; + + // copy meshes + if (pcSrc->mNumMeshes) { + JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mMeshes,pcSrc->mNumMeshes, + AIJ_GET_HANDLE(assimp.Mesh),ja); + pc->SetObjectField(obj,m_vMeshes,ja); + } + + // copy textures + if (pcSrc->mNumTextures) { + JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mTextures,pcSrc->mNumTextures, + AIJ_GET_HANDLE(assimp.Texture),ja); + pc->SetObjectField(obj,m_vTextures,ja); + } + + // copy materials + if (pcSrc->mNumMeshes) { + JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mMaterials,pcSrc->mNumMaterials, + AIJ_GET_HANDLE(assimp.Material),ja); + pc->SetObjectField(obj,m_vMaterials,ja); + } + + // copy animations + if (pcSrc->mNumAnimations) { + JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mAnimations,pcSrc->mNumAnimations, + AIJ_GET_HANDLE(assimp.Animation),ja); + pc->SetObjectField(obj,m_vAnimations,ja); + } + + // copy lights + if (pcSrc->mNumLights) { + JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mLights,pcSrc->mNumLights, + AIJ_GET_HANDLE(assimp.Light),ja); + pc->SetObjectField(obj,m_vLights,ja); + } + + // copy cameras + if (pcSrc->mNumCameras) { + JNU_CopyObjectArrayToVM(pc,(const void**)pcSrc->mCameras,pcSrc->mNumCameras, + AIJ_GET_HANDLE(assimp.Camera),ja); + pc->SetObjectField(obj,m_vCameras,ja); + } + + // copy scene flags + pc->SetIntField(obj,flags,(jint)pcSrc->mFlags); + + // copy the root node + jobject root = pc->NewObject(AIJ_GET_CLASS_HANDLE(assimp.Node), + AIJ_GET_DEFAULT_CTOR_HANDLE(assimp.Node)); + + AIJ_GET_HANDLE(assimp.Node).Fill(root,pcSrc->mRootNode); + pc->SetObjectField(obj,m_rootNode,root); +} diff --git a/port/jAssimp/jni_bridge/jbridge_Texture.cpp b/port/jAssimp/jni_bridge/jbridge_Texture.cpp new file mode 100644 index 000000000..fb7881587 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_Texture.cpp @@ -0,0 +1,14 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" +using namespace Assimp; \ No newline at end of file diff --git a/port/jAssimp/jni_bridge/jbridge_pch.cpp b/port/jAssimp/jni_bridge/jbridge_pch.cpp new file mode 100644 index 000000000..b7aa6d768 --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_pch.cpp @@ -0,0 +1,15 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#include "jbridge_pch.h" + +// PCH unit \ No newline at end of file diff --git a/port/jAssimp/jni_bridge/jbridge_pch.h b/port/jAssimp/jni_bridge/jbridge_pch.h new file mode 100644 index 000000000..633c14a1e --- /dev/null +++ b/port/jAssimp/jni_bridge/jbridge_pch.h @@ -0,0 +1,31 @@ + +/* -------------------------------------------------------------------------------- + * + * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net) + * Assimp2Java bridge + * + * Copyright (c) 2006-2009, ASSIMP Development Team + * All rights reserved. See the LICENSE file for more information. + * + * -------------------------------------------------------------------------------- + */ + +#ifdef DEBUG +# define JASSIMP_DEBUG_CHECKS +#endif + +// Assimp's public headers don't include it anymore, but we need it for uint64_t +#include "Compiler/pstdint.h" + +#include +#include + +#include +#include + +#include +#include "assimp.hpp" + +#include "jbridge_Environment.h" +#include "jbridge_Logger.h" + diff --git a/port/jAssimp/jni_bridge/res/jAssimp.rc b/port/jAssimp/jni_bridge/res/jAssimp.rc index d3a1398f3..f509e0c39 100644 --- a/port/jAssimp/jni_bridge/res/jAssimp.rc +++ b/port/jAssimp/jni_bridge/res/jAssimp.rc @@ -1,6 +1,7 @@ // Microsoft Visual C++ generated resource script. // #include "resource.h" +#include "..\..\..\..\mkutil\revision.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// @@ -29,11 +30,9 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN // Version // -#if (defined ASSIMP_JNI_EXPORT) - VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 + FILEVERSION 1,0,SVNRevision, 0 + PRODUCTVERSION 1,0,SVNRevision,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -50,13 +49,14 @@ BEGIN BEGIN VALUE "Comments", "Licensed under a 3-clause BSD license" VALUE "CompanyName", "ASSIMP Development Team" - VALUE "FileDescription", "ASSIMP-JNI bridge module" - VALUE "FileVersion", "1, 0, 0, 0" - VALUE "InternalName", "jassimp" - VALUE "LegalCopyright", "Copyright (C) 2008" - VALUE "OriginalFilename", "jAssimpNN.dll" - VALUE "ProductName", "ASSIMP-JNI bridge module" - VALUE "ProductVersion", "1, 0, 0, 0" + VALUE "FileDescription", "Assimp2Java Bridge Module" + VALUE "FileVersion", 1,0,SVNRevision,0 + VALUE "InternalName", "assimp " + VALUE "LegalCopyright", "Copyright (C) 2006-2009" + VALUE "OriginalFilename", "assimpNN.dll" + VALUE "ProductName", "Assimp2Java Bridge Module" + VALUE "ProductVersion", 1,0,SVNRevision,0 + ,0 END END BLOCK "VarFileInfo" @@ -65,13 +65,10 @@ BEGIN END END -#endif // !!ASSIMP_JNI_EXPORT - #endif // Deutsch (Deutschland) resources ///////////////////////////////////////////////////////////////////////////// - #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // diff --git a/port/jAssimp/module_assimp.xml b/port/jAssimp/module_assimp.xml deleted file mode 100644 index 7a06ca3d9..000000000 --- a/port/jAssimp/module_assimp.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/workspaces/vc8/assimp_jbridge.vcproj b/workspaces/vc8/assimp_jbridge.vcproj new file mode 100644 index 000000000..490c3fdf7 --- /dev/null +++ b/workspaces/vc8/assimp_jbridge.vcproj @@ -0,0 +1,494 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/workspaces/vc8/jAssimp.vcproj b/workspaces/vc8/jAssimp.vcproj deleted file mode 100644 index 33c58e969..000000000 --- a/workspaces/vc8/jAssimp.vcproj +++ /dev/null @@ -1,1696 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -