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
pull/1/head
aramis_acg 2009-06-04 17:44:51 +00:00
parent 31f7adbed8
commit 9070dc1f3c
48 changed files with 2191 additions and 3549 deletions

View File

@ -30,8 +30,6 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
// Version // Version
// //
#if (!defined ASSIMP_JNI_EXPORT)
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,SVNRevision, 0 FILEVERSION 1,0,SVNRevision, 0
PRODUCTVERSION 1,0,SVNRevision,0 PRODUCTVERSION 1,0,SVNRevision,0
@ -54,7 +52,7 @@ BEGIN
VALUE "FileDescription", "Open Asset Import Library" VALUE "FileDescription", "Open Asset Import Library"
VALUE "FileVersion", 1,0,SVNRevision,0 VALUE "FileVersion", 1,0,SVNRevision,0
VALUE "InternalName", "assimp " VALUE "InternalName", "assimp "
VALUE "LegalCopyright", "Copyright (C) 2008" VALUE "LegalCopyright", "Copyright (C) 2006-2009"
VALUE "OriginalFilename", "assimpNN.dll" VALUE "OriginalFilename", "assimpNN.dll"
VALUE "ProductName", "Open Asset Import Library" VALUE "ProductName", "Open Asset Import Library"
VALUE "ProductVersion", 1,0,SVNRevision,0 VALUE "ProductVersion", 1,0,SVNRevision,0
@ -67,21 +65,16 @@ BEGIN
END END
END END
#endif // !!ASSIMP_JNI_EXPORT
#endif // Deutsch (Deutschland) resources #endif // Deutsch (Deutschland) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED #ifndef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Generated from the TEXTINCLUDE 3 resource. // Generated from the TEXTINCLUDE 3 resource.
// //
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED #endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1 @@
... it's under development, it doesn't work yet.

View File

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

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true" type="JAVA_MODULE">
<component name="BuildJarSettings">
<containerInfo>
<containerElement type="module" name="assimp">
<attribute name="method" value="1" />
<attribute name="URI" value="/" />
</containerElement>
</containerInfo>
<setting name="jarPath" value="J:\Programmieren\ASSIMP\assimp3\port\jAssimp\assimp.jar" />
<setting name="buildJar" value="true" />
<setting name="mainClass" value="" />
</component>
<component name="ModuleRootManager" />
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntryProperties />
</component>
</module>

View File

@ -1,2 +1,2 @@
javah -classpath ".\..\classes" -d "." "assimp.Importer" javah -classpath ".\..\java\bin" -d "." "assimp.Importer"

View File

@ -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,"<init>","");
// 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,"<init>","");
// 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);
}
}}

View File

@ -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,"<init>","");
// 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<Lassimp.Quaternion;>;");
// 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;
}
}}

View File

@ -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 <aiTypes.h>
#include <aiMesh.h>
#include <aiAnim.h>
#include <aiScene.h>
#include <aiAssert.h>
#include <aiPostProcess.h>
#include <assimp.hpp>
#include <DefaultLogger.h>
// include all jAssimp internal header files
#include "JNIEnvironment.h"
#include "JNILogger.h"
using namespace Assimp;
#include <list>
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

View File

@ -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 <boost/thread/thread.hpp>
#include <boost/thread/tss.hpp>
#include <vector>
#include <jni.h>
#include <aiAssert.h>
#include <aiMesh.h>
#include <aiScene.h>
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<quak>
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<JNIThreadData> 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

View File

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

View File

@ -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 <vector>
#include <jni.h>
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

View File

@ -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,"<init>","");
// 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);
}
}
}}

View File

@ -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.");
}
}}

View File

@ -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,"<init>","");
// 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);
}
}}

View File

@ -9,12 +9,16 @@ extern "C" {
#endif #endif
#undef assimp_Importer_PROPERTY_WAS_NOT_EXISTING #undef assimp_Importer_PROPERTY_WAS_NOT_EXISTING
#define assimp_Importer_PROPERTY_WAS_NOT_EXISTING -1L #define assimp_Importer_PROPERTY_WAS_NOT_EXISTING -1L
#undef assimp_Importer_ABI_VERSION
#define assimp_Importer_ABI_VERSION 1
/* /*
* Class: assimp_Importer * Class: assimp_Importer
* Method: _NativeInitContext * Method: _NativeInitContext
* Signature: (I)I * Signature: (I)I
*/ */
JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeInitContext JNIEXPORT jlong JNICALL Java_assimp_Importer__1NativeInitContext
(JNIEnv *, jobject, jint); (JNIEnv *, jobject, jint);
/* /*
@ -28,10 +32,10 @@ JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeFreeContext
/* /*
* Class: assimp_Importer * Class: assimp_Importer
* Method: _NativeLoad * Method: _NativeLoad
* Signature: (Ljava/lang/String;IJ)I * Signature: (Ljava/lang/String;JJ)I
*/ */
JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeLoad JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeLoad
(JNIEnv *, jobject, jstring, jint, jlong); (JNIEnv *, jobject, jstring, jlong, jlong);
/* /*
* Class: assimp_Importer * Class: assimp_Importer

View File

@ -1,13 +0,0 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* 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

View File

@ -1,13 +0,0 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* 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

View File

@ -1,13 +0,0 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* 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

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

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

View File

@ -1,121 +1,117 @@
/*
---------------------------------------------------------------------------
Open Asset Import Library (ASSIMP)
---------------------------------------------------------------------------
Copyright (c) 2006-2008, ASSIMP Development Team /* --------------------------------------------------------------------------------
*
All rights reserved. * Open Asset Import Library (ASSIMP) (http://assimp.sourceforge.net)
See the disclaimer in JNIEnvironment.h for licensing and distribution * Assimp2Java bridge
conditions. *
--------------------------------------------------------------------------- * Copyright (c) 2006-2009, ASSIMP Development Team
* All rights reserved. See the LICENSE file for more information.
*
* --------------------------------------------------------------------------------
*/ */
/** @file Implementation of the JNI API for jAssimp */ #include "jbridge_pch.h"
#include "JNIEnvironment.h"
#include "JNILogger.h"
using namespace Assimp; using namespace Assimp;
namespace Assimp {
namespace JNIBridge {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool JNIEnvironment::AttachToCurrentThread (JNIEnv* pcEnv) bool JNIEnvironment::AttachToCurrentThread (JNIEnv* pcEnv)
{ {
ai_assert(NULL != pcEnv); ai_assert(NULL != pcEnv);
// now initialize the thread-local storage // now initialize the thread-local storage
if (NULL == this->ptr.get()) if (!ptr.get()) {
{
// attach to the current thread // attach to the current thread
JavaVM* vm; JavaVM* vm;
pcEnv->GetJavaVM(&vm); pcEnv->GetJavaVM(&vm);
vm->AttachCurrentThread((void **) &pcEnv, NULL); vm->AttachCurrentThread((void **) &pcEnv, NULL);
this->ptr.reset(new JNIThreadData(pcEnv)); ptr.reset(new JNIThreadData(pcEnv));
} }
// increase the reference counter // increase the reference counter
else this->ptr->m_iNumRef++; else ptr->m_iNumRef++;
// attach the logger // attach the logger
((JNILogDispatcher*)DefaultLogger::get())->OnAttachToCurrentThread(this->ptr.get()); ((JNILogDispatcher*)DefaultLogger::get())->OnAttachToCurrentThread(ptr.get());
// get handles to all methods/fields/classes // get handles to all methods/fields/classes
this->Initialize(); Initialize();
return true; return true;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool JNIEnvironment::DetachFromCurrentThread () bool JNIEnvironment::DetachFromCurrentThread ()
{ {
ai_assert(NULL != pcEnv); ai_assert(NULL != pcEnv);
// detach the logger // detach the logger
((JNILogDispatcher*)DefaultLogger::get())->OnDetachFromCurrentThread(this->ptr.get()); ((JNILogDispatcher*)DefaultLogger::get())->OnDetachFromCurrentThread(ptr.get());
// decrease the reference counter // decrease the reference counter
if (NULL != this->ptr.get()) if (NULL != ptr.get()) {
{
this->ptr->m_iNumRef--; ptr->m_iNumRef--;
if (0 == this->ptr->m_iNumRef) if (0 == ptr->m_iNumRef) {
{
JavaVM* vm; JavaVM* vm;
this->ptr->m_pcEnv->GetJavaVM(&vm); ptr->m_pcEnv->GetJavaVM(&vm);
vm->DetachCurrentThread(); vm->DetachCurrentThread();
} }
} }
return true; return true;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
JNIThreadData* JNIEnvironment::GetThread() JNIThreadData* JNIEnvironment::GetThread()
{ {
ai_assert(NULL != this->ptr.get()); ai_assert(NULL != ptr.get());
return this->ptr.get(); return ptr.get();
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void JNIEnvironment::_java::_lang::_String::Initialize() void JNIEnvironment::_java::_lang::_String::Initialize()
{ {
JNIEnv* pcEnv = JNIEnvironment::Get()->GetThread()->m_pcEnv; JNIEnv* pcEnv = JNIEnvironment::Get()->GetThread()->m_pcEnv;
// first initialize some members // first initialize some members
if( !(this->Class = pcEnv->FindClass("java.lang.String"))) if( !(Class = pcEnv->FindClass("java.lang.String"))) {
JNIEnvironment::Get()->ThrowNativeError("Unable to get handle of class java.lang.String"); JNIEnvironment::Get()->ThrowNativeError("Can't 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( !(this->constructor_ByteArray = pcEnv->GetStaticMethodID(
this->Class,"<init>","([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,"<init>","([byte)V"))) {
JNIEnvironment::Get()->ThrowNativeError("Can't get handle of class java.lang.String");
}
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void JNIEnvironment::_java::_lang::_Array::Initialize() void JNIEnvironment::_java::_lang::_Array::Initialize()
{ {
JNIEnv* pcEnv = JNIEnvironment::Get()->GetThread()->m_pcEnv; 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[]"); 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[]"); JNIEnvironment::Get()->ThrowNativeError("Unable to get handle of class int[]");
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
jstring JNU_NewStringNative(JNIEnv *env, const char *str) jstring JNU_NewStringNative(JNIEnv *env, const char *str)
{ {
jstring result; jstring result;
jbyteArray bytes = 0; jbyteArray bytes = 0;
int len; int len;
if (env->EnsureLocalCapacity( 2) < 0) if (env->EnsureLocalCapacity( 2) < 0) {
{
return NULL; /* out of memory error */ return NULL; /* out of memory error */
} }
len = (int)::strlen(str); len = (int)::strlen(str);
bytes = env->NewByteArray(len); bytes = env->NewByteArray(len);
if (bytes != NULL) if (bytes != NULL) {
{
env->SetByteArrayRegion(bytes, 0, len, env->SetByteArrayRegion(bytes, 0, len,
(jbyte *)str); (jbyte *)str);
result = (jstring)env->NewObject(AIJ_GET_HANDLE(java.lang.String.Class), 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 */ } /* else fall through */
return NULL; return NULL;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
char *JNU_GetStringNativeChars(JNIEnv *env, jstring jstr) char *JNU_GetStringNativeChars(JNIEnv *env, jstring jstr)
{ {
jbyteArray bytes = 0; jbyteArray bytes = 0;
jthrowable exc; jthrowable exc;
char *result = 0; char *result = 0;
if (env->EnsureLocalCapacity(2) < 0) if (env->EnsureLocalCapacity(2) < 0) {
{
return 0; /* out of memory error */ return 0; /* out of memory error */
} }
bytes = (jbyteArray)env->CallObjectMethod(jstr,AIJ_GET_HANDLE(java.lang.String.getBytes)); bytes = (jbyteArray)env->CallObjectMethod(jstr,AIJ_GET_HANDLE(java.lang.String.getBytes));
exc = env->ExceptionOccurred(); exc = env->ExceptionOccurred();
if (!exc) if (!exc) {
{
jint len = env->GetArrayLength(bytes); jint len = env->GetArrayLength(bytes);
result = (char *)malloc(len + 1); result = (char *)malloc(len + 1);
if (result == 0) if (result == 0)
@ -151,36 +146,36 @@ char *JNU_GetStringNativeChars(JNIEnv *env, jstring jstr)
(jbyte *)result); (jbyte *)result);
result[len] = 0; /* NULL-terminate */ result[len] = 0; /* NULL-terminate */
} }
else else {
{
env->DeleteLocalRef(exc); env->DeleteLocalRef(exc);
} }
env->DeleteLocalRef(bytes); env->DeleteLocalRef(bytes);
return result; return result;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void JNU_CopyDataToArray(JNIEnv* pc, jarray jfl, void* data, unsigned int size) void JNU_CopyDataToArray(JNIEnv* pc, jarray jfl, void* data, unsigned int size)
{ {
void* pf; void* pf;
jboolean iscopy = FALSE; jboolean iscopy = false;
// lock the array and get direct access to its buffer // 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"); JNIEnvironment::Get()->ThrowNativeError("Unable to lock array");
}
// copy the data to the array // copy the data to the array
::memcpy(pf,data,size); memcpy(pf,data,size);
// release our reference to the array // release our reference to the array
pc->ReleasePrimitiveArrayCritical(jfl,pf,0); pc->ReleasePrimitiveArrayCritical(jfl,pf,0);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void JNU_CopyObjectArrayToVM(JNIEnv* pc, const void** in, unsigned int num, void JNU_CopyObjectArrayToVM(JNIEnv* pc, const void** in, unsigned int num,
JNIEnvironment::_Base& type, jobjectArray& out) JNIEnvironment::_Base& type, jobjectArray& out)
{ {
jobjectArray jarr = pc->NewObjectArray(num,type.Class,0); 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); jobject jobj = pc->NewObject(type.Class,type.DefaultCtor);
type.Fill(jobj,in[i]); type.Fill(jobj,in[i]);
@ -189,6 +184,3 @@ void JNU_CopyObjectArrayToVM(JNIEnv* pc, const void** in, unsigned int num,
out = jarr; out = jarr;
} }
};};

View File

@ -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,"<init>","");
#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<float[]>
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<assimp.Quaternion>
AIJ_BEGIN_CLASS(QuatKey)
AIJ_SET_CLASS_TYPE(aiQuatKey,"Lassimp.NodeAnim.KeyFrame<Lassimp.Quaternion>");
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<Lassimp.Quaternion>");
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<JNIThreadData> 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

View File

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

View File

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

View File

@ -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 <list>
// 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;
}

View File

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

View File

@ -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);
}

View File

@ -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 <DefaultLogger.h>
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

View File

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

View File

@ -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);
}
}

View File

@ -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());
}

View File

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

View File

@ -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);
}

View File

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

View File

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

View File

@ -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 <boost/thread/thread.hpp>
#include <boost/thread/tss.hpp>
#include <vector>
#include <jni.h>
#include <aiScene.h>
#include "assimp.hpp"
#include "jbridge_Environment.h"
#include "jbridge_Logger.h"

View File

@ -1,6 +1,7 @@
// Microsoft Visual C++ generated resource script. // Microsoft Visual C++ generated resource script.
// //
#include "resource.h" #include "resource.h"
#include "..\..\..\..\mkutil\revision.h"
#define APSTUDIO_READONLY_SYMBOLS #define APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -29,11 +30,9 @@ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
// Version // Version
// //
#if (defined ASSIMP_JNI_EXPORT)
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1 FILEVERSION 1,0,SVNRevision, 0
PRODUCTVERSION 1,0,0,1 PRODUCTVERSION 1,0,SVNRevision,0
FILEFLAGSMASK 0x17L FILEFLAGSMASK 0x17L
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -50,13 +49,14 @@ BEGIN
BEGIN BEGIN
VALUE "Comments", "Licensed under a 3-clause BSD license" VALUE "Comments", "Licensed under a 3-clause BSD license"
VALUE "CompanyName", "ASSIMP Development Team" VALUE "CompanyName", "ASSIMP Development Team"
VALUE "FileDescription", "ASSIMP-JNI bridge module" VALUE "FileDescription", "Assimp2Java Bridge Module"
VALUE "FileVersion", "1, 0, 0, 0" VALUE "FileVersion", 1,0,SVNRevision,0
VALUE "InternalName", "jassimp" VALUE "InternalName", "assimp "
VALUE "LegalCopyright", "Copyright (C) 2008" VALUE "LegalCopyright", "Copyright (C) 2006-2009"
VALUE "OriginalFilename", "jAssimpNN.dll" VALUE "OriginalFilename", "assimpNN.dll"
VALUE "ProductName", "ASSIMP-JNI bridge module" VALUE "ProductName", "Assimp2Java Bridge Module"
VALUE "ProductVersion", "1, 0, 0, 0" VALUE "ProductVersion", 1,0,SVNRevision,0
,0
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
@ -65,13 +65,10 @@ BEGIN
END END
END END
#endif // !!ASSIMP_JNI_EXPORT
#endif // Deutsch (Deutschland) resources #endif // Deutsch (Deutschland) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED #ifndef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="module_assimp" default="compile.module.assimp">
<dirname property="module.assimp.basedir" file="${ant.file.module_assimp}"/>
<property name="module.jdk.home.assimp" value="${project.jdk.home}"/>
<property name="module.jdk.classpath.assimp" value="${project.jdk.classpath}"/>
<property name="compiler.args.assimp" value="${compiler.args}"/>
<property name="assimp.output.dir" value="${module.assimp.basedir}/classes"/>
<property name="assimp.testoutput.dir" value="${module.assimp.basedir}/classes"/>
<path id="assimp.module.bootclasspath">
<!-- Paths to be included in compilation bootclasspath -->
</path>
<path id="assimp.module.classpath">
<path refid="${module.jdk.classpath.assimp}"/>
</path>
<patternset id="excluded.from.module.assimp">
<patternset refid="ignored.files"/>
</patternset>
<patternset id="excluded.from.compilation.assimp">
<patternset refid="excluded.from.module.assimp"/>
</patternset>
<path id="assimp.module.sourcepath">
<dirset dir="${module.assimp.basedir}">
<include name="src"/>
</dirset>
</path>
<target name="compile.module.assimp" depends="compile.module.assimp.production,compile.module.assimp.tests" description="Compile module assimp"/>
<target name="compile.module.assimp.production" description="Compile module assimp; production classes">
<mkdir dir="${assimp.output.dir}"/>
<javac2 destdir="${assimp.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memoryMaximumSize="${compiler.max.memory}" fork="true" executable="${module.jdk.home.assimp}/bin/javac">
<compilerarg line="${compiler.args.assimp}"/>
<bootclasspath refid="assimp.module.bootclasspath"/>
<classpath refid="assimp.module.classpath"/>
<src refid="assimp.module.sourcepath"/>
</javac2>
<copy todir="${assimp.output.dir}">
<fileset dir="${module.assimp.basedir}/src">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
</target>
<target name="compile.module.assimp.tests" depends="compile.module.assimp.production" description="compile module assimp; test classes" unless="skip.tests"/>
<target name="clean.module.assimp" description="cleanup module">
<delete dir="${assimp.output.dir}"/>
<delete dir="${assimp.testoutput.dir}"/>
</target>
</project>

View File

@ -0,0 +1,494 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="assimpjbridge"
ProjectGUID="{448B6B10-D4E3-4EA6-98CD-45AC82E64262}"
RootNamespace="assimp_jbridge"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="debug-dll|Win32"
OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
ConfigurationType="2"
InheritedPropertySheets=".\shared\FastSTL.vsprops;.\shared\DllShared.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(JDK_DIR)include&quot;;&quot;$(JDK_DIR)include\win32&quot;;..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ASSIMP_JBRIDGE_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="jbridge_pch.h"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\assimp-jbridge32.dll"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="debug-dll|x64"
OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
ConfigurationType="2"
InheritedPropertySheets=".\shared\FastSTL.vsprops;.\shared\DllShared.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(JDK_DIR)include&quot;;&quot;$(JDK_DIR)include\win32&quot;;..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ASSIMP_JBRIDGE_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="jbridge_pch.h"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\assimp-jbridge64.dll"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="release-dll|Win32"
OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
ConfigurationType="2"
InheritedPropertySheets=".\shared\FastSTL.vsprops;.\shared\DllShared.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(JDK_DIR)include&quot;;&quot;$(JDK_DIR)include\win32&quot;;..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ASSIMP_JBRIDGE_EXPORTS"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="jbridge_pch.h"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\assimp-jbridge32.dll"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="release-dll|x64"
OutputDirectory="./../../bin/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
IntermediateDirectory="./../../obj/$(ProjectName)_$(ConfigurationName)_$(PlatformName)"
ConfigurationType="2"
InheritedPropertySheets=".\shared\FastSTL.vsprops;.\shared\DllShared.vsprops"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;$(JDK_DIR)include&quot;;&quot;$(JDK_DIR)include\win32&quot;;..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ASSIMP_JBRIDGE_EXPORTS"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="jbridge_pch.h"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)\assimp-jbridge64.dll"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="sources"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Animation.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Bone.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_BoneAnim.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Camera.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Environment.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Environment.h"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Importer.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_IOStream.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_IOSystem.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Light.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Logger.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Logger.h"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Material.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Mesh.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_NativeException.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Node.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Scene.cpp"
>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_Texture.cpp"
>
</File>
<Filter
Name="pch"
>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_pch.cpp"
>
<FileConfiguration
Name="debug-dll|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="debug-dll|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="release-dll|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="release-dll|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\jbridge_pch.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="resources"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\res\jAssimp.rc"
>
</File>
</Filter>
<Filter
Name="javah"
>
<File
RelativePath="..\..\port\jAssimp\jni_bridge\assimp_Importer.h"
>
</File>
</Filter>
<Filter
Name="doc"
>
<File
RelativePath="..\..\port\jAssimp\README"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

File diff suppressed because it is too large Load Diff