Added interface headers generated by javah
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@29 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
0634e2af29
commit
d228356efb
|
@ -44,7 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <string>
|
||||
|
||||
#include "../include/assimp.hpp"
|
||||
#include "../include/aiAssert.h"
|
||||
#include "../include/aiScene.h"
|
||||
#include "../include/aiPostProcess.h"
|
||||
#include "BaseImporter.h"
|
||||
#include "BaseProcess.h"
|
||||
#include "DefaultIOStream.h"
|
||||
|
@ -177,11 +179,27 @@ void Importer::SetIOHandler( IOSystem* pIOHandler)
|
|||
}
|
||||
return;
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Validate post process step flags
|
||||
bool ValidateFlags(unsigned int pFlags)
|
||||
{
|
||||
if (pFlags & aiProcess_GenSmoothNormals &&
|
||||
pFlags & aiProcess_GenNormals)
|
||||
{
|
||||
DefaultLogger::get()->error("aiProcess_GenSmoothNormals and aiProcess_GenNormals "
|
||||
"may not be specified together");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Reads the given file and returns its contents if successful.
|
||||
const aiScene* Importer::ReadFile( const std::string& pFile, unsigned int pFlags)
|
||||
{
|
||||
// validate the flags
|
||||
ai_assert(ValidateFlags(pFlags));
|
||||
|
||||
// first check if the file is accessable at all
|
||||
if( !mIOHandler->Exists( pFile))
|
||||
{
|
||||
|
|
|
@ -54,6 +54,15 @@ namespace Assimp
|
|||
class SplitLargeMeshesProcess_Triangle;
|
||||
class SplitLargeMeshesProcess_Vertex;
|
||||
|
||||
// NOTE: If you change these limits, don't forget to also change the
|
||||
// corresponding values in the Assimp ports
|
||||
|
||||
// **********************************************************
|
||||
// Java: PostProcessStep.java,
|
||||
// PostProcessStep.DEFAULT_VERTEX_SPLIT_LIMIT
|
||||
// PostProcessStep.DEFAULT_TRIANGLE_SPLIT_LIMIT
|
||||
// **********************************************************
|
||||
|
||||
// default limit for vertices
|
||||
#define AI_SLM_DEFAULT_MAX_VERTICES 1000000
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
javah -classpath ".\..\..\port\jAssimp\classes" -d "." "assimp.Importer"
|
||||
javah -classpath ".\..\..\port\jAssimp\classes" -d "." "assimp.Material"
|
||||
javah -classpath ".\..\..\port\jAssimp\classes" -d "." "assimp.Node"
|
||||
javah -classpath ".\..\..\port\jAssimp\classes" -d "." "assimp.Scene"
|
||||
javah -classpath ".\..\..\port\jAssimp\classes" -d "." "assimp.Mesh"
|
||||
javah -classpath ".\..\..\port\jAssimp\classes" -d "." "assimp.Texture"
|
|
@ -0,0 +1,37 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class assimp_Importer */
|
||||
|
||||
#ifndef _Included_assimp_Importer
|
||||
#define _Included_assimp_Importer
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: assimp_Importer
|
||||
* Method: _NativeInitContext
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeInitContext
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: assimp_Importer
|
||||
* Method: _NativeFreeContext
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeFreeContext
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: assimp_Importer
|
||||
* Method: _NativeLoad
|
||||
* Signature: (Ljava/lang/String;II)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_assimp_Importer__1NativeLoad
|
||||
(JNIEnv *, jobject, jstring, jint, jint);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,13 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class assimp_Material */
|
||||
|
||||
#ifndef _Included_assimp_Material
|
||||
#define _Included_assimp_Material
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,17 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class assimp_Mesh */
|
||||
|
||||
#ifndef _Included_assimp_Mesh
|
||||
#define _Included_assimp_Mesh
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#undef assimp_Mesh_MAX_NUMBER_OF_TEXTURECOORDS
|
||||
#define assimp_Mesh_MAX_NUMBER_OF_TEXTURECOORDS 4L
|
||||
#undef assimp_Mesh_MAX_NUMBER_OF_COLOR_SETS
|
||||
#define assimp_Mesh_MAX_NUMBER_OF_COLOR_SETS 4L
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,13 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class assimp_Node */
|
||||
|
||||
#ifndef _Included_assimp_Node
|
||||
#define _Included_assimp_Node
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,45 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class assimp_Scene */
|
||||
|
||||
#ifndef _Included_assimp_Scene
|
||||
#define _Included_assimp_Scene
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: assimp_Scene
|
||||
* Method: _NativeGetNumMeshes
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_assimp_Scene__1NativeGetNumMeshes
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: assimp_Scene
|
||||
* Method: _NativeGetNumAnimations
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_assimp_Scene__1NativeGetNumAnimations
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: assimp_Scene
|
||||
* Method: _NativeGetNumTextures
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_assimp_Scene__1NativeGetNumTextures
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: assimp_Scene
|
||||
* Method: _NativeGetNumMaterials
|
||||
* Signature: (I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_assimp_Scene__1NativeGetNumMaterials
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,21 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class assimp_Texture */
|
||||
|
||||
#ifndef _Included_assimp_Texture
|
||||
#define _Included_assimp_Texture
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: assimp_Texture
|
||||
* Method: _NativeMapColorData
|
||||
* Signature: ([B)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_assimp_Texture__1NativeMapColorData
|
||||
(JNIEnv *, jobject, jbyteArray);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -218,6 +218,15 @@ struct aiBone
|
|||
*/
|
||||
#define AI_MAX_NUMBER_OF_TEXTURECOORDS 0x4
|
||||
|
||||
// NOTE (Aramis): If you change these values, make sure that you also
|
||||
// change the corresponding values in all Assimp ports.
|
||||
|
||||
// **********************************************************
|
||||
// Java: Mesh.java,
|
||||
// Mesh.MAX_NUMBER_OF_TEXTURECOORDS
|
||||
// Mesh.MAX_NUMBER_OF_COLOR_SETS
|
||||
// **********************************************************
|
||||
|
||||
#endif // !! AI_MAX_NUMBER_OF_TEXTURECOORDS
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
@ -68,8 +68,8 @@ enum aiPostProcessSteps
|
|||
* the DirectX coordinate system. By default the data is returned in a right-handed
|
||||
* coordinate space which for example OpenGL prefers. In this space, +X points to the
|
||||
* right, +Y points towards the viewer and and +Z points upwards. In the DirectX
|
||||
* coordinate space +X points to the right, +Y points upwards and +Z points
|
||||
* away from the viewer.
|
||||
* coordinate space +X points to the right, +Y points upwards and +Z points
|
||||
* away from the viewer.
|
||||
*/
|
||||
aiProcess_ConvertToLeftHanded = 4,
|
||||
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4" relativePaths="true" type="JAVA_MODULE">
|
||||
<component name="BuildJarSettings">
|
||||
<containerInfo />
|
||||
<setting name="jarPath" value="J:\Programmieren\ASSIMP\assimp2\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" />
|
||||
|
|
|
@ -1,11 +1,67 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
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.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
package assimp;
|
||||
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: Alex
|
||||
* Date: 22.05.2008
|
||||
* Time: 13:05:35
|
||||
* To change this template use File | Settings | File Templates.
|
||||
* An animation consists of keyframe data for a number of bones. For each
|
||||
* bone affected by the animation a separate series of data is given.
|
||||
*
|
||||
* @author Aramis (Alexander Gessler)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Animation {
|
||||
public class Animation extends IMappable {
|
||||
/**
|
||||
* Construction from a given object and array index
|
||||
*
|
||||
* @param parent Must be valid, null is not allowed
|
||||
* @param index Valied index in the parent's list
|
||||
*/
|
||||
public Animation(Object parent, int index) {
|
||||
super(parent, index);
|
||||
}
|
||||
|
||||
protected void OnMap() throws NativeError {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
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.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
package assimp;
|
||||
|
||||
|
||||
/**
|
||||
* Defines base behaviour for all sub objects of <code>Mesh</code>.
|
||||
*
|
||||
* @author Aramis (Alexander Gessler)
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class IMappable {
|
||||
|
||||
/**
|
||||
* Index of the mapped object in the parent Mesh
|
||||
*/
|
||||
private int m_iArrayIndex = 0;
|
||||
|
||||
/**
|
||||
* Reference to the parent of the object
|
||||
*/
|
||||
private Object m_parent = null;
|
||||
|
||||
|
||||
/**
|
||||
* Construction from a given parent object and array index
|
||||
* @param parent Must be valid, null is not allowed
|
||||
* @param index Valied index in the parent's list
|
||||
*/
|
||||
public IMappable(Object parent, int index) {
|
||||
m_parent = parent;
|
||||
m_iArrayIndex = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called as a request to the object to map all of its
|
||||
* data into the address space of the Java virtual machine.
|
||||
* After this method has been called the class instance must
|
||||
* be ready to be used without an underyling native aiScene
|
||||
* @throws NativeError
|
||||
*/
|
||||
protected abstract void OnMap() throws NativeError;
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the index ofthe mappable object in the parent mesh
|
||||
* @return Value between 0 and n-1
|
||||
*/
|
||||
public int getArrayIndex() {
|
||||
return m_iArrayIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide access to the parent
|
||||
* @return Never null ...
|
||||
*/
|
||||
public Object getParent() {
|
||||
return m_parent;
|
||||
}
|
||||
}
|
|
@ -67,7 +67,8 @@ public class Importer {
|
|||
|
||||
/**
|
||||
* Unique number representing the address of the internal
|
||||
* Assimp::Importer object.
|
||||
* Assimp::Importer object. For 64 bit platforms it is something else ..
|
||||
* at least it is guaranted to be unique ;-)
|
||||
*/
|
||||
private int m_iNativeHandle = 0xffffffff;
|
||||
|
||||
|
@ -191,11 +192,28 @@ public class Importer {
|
|||
|
||||
// we need to build a path that is valid for the current OS
|
||||
char sep = System.getProperty("file.separator").charAt(0);
|
||||
if(sep != '\\') this.path.replace('\\',sep);
|
||||
if(sep != '/') this.path.replace('/',sep);
|
||||
if(sep != '\\') this.path = this.path.replace('\\',sep);
|
||||
if(sep != '/') this.path = this.path.replace('/',sep);
|
||||
|
||||
// need to build a list of postprocess step as bitflag combination
|
||||
// Of course, this could have been implemented directly. However,
|
||||
// I've used the PostProcessStep enumeration to make debugging easier.
|
||||
int flags = 0;
|
||||
|
||||
for (PostProcessStep step : m_vPPSteps) {
|
||||
if (step.equals(PostProcessStep.CalcTangentSpace)) flags |= 0x1;
|
||||
else if (step.equals(PostProcessStep.JoinIdenticalVertices)) flags |= 0x2;
|
||||
else if (step.equals(PostProcessStep.ConvertToLeftHanded)) flags |= 0x4;
|
||||
else if (step.equals(PostProcessStep.Triangulate)) flags |= 0x8;
|
||||
else if (step.equals(PostProcessStep.KillNormals)) flags |= 0x10;
|
||||
else if (step.equals(PostProcessStep.GenFaceNormals)) flags |= 0x20;
|
||||
else if (step.equals(PostProcessStep.GenSmoothNormals)) flags |= 0x40;
|
||||
else if (step.equals(PostProcessStep.SplitLargeMeshes)) flags |= 0x80;
|
||||
}
|
||||
|
||||
// now load the mesh
|
||||
if(0xffffffff == this._NativeLoad(this.path,this.m_vPPSteps) || ! this.scene.construct()) {
|
||||
if(0xffffffff == this._NativeLoad(this.path,flags,this.m_iNativeHandle) ||
|
||||
! this.scene.construct()) {
|
||||
this.scene = null;
|
||||
this.path = null;
|
||||
return null;
|
||||
|
@ -234,7 +252,7 @@ public class Importer {
|
|||
super.finalize();
|
||||
|
||||
// be sure that native resources are deallocated properly
|
||||
if (0xffffffff == _NativeFreeContext()) {
|
||||
if (0xffffffff == _NativeFreeContext(this.m_iNativeHandle)) {
|
||||
throw new NativeError("Unable to destroy the native library context");
|
||||
}
|
||||
return;
|
||||
|
@ -272,14 +290,14 @@ public class Importer {
|
|||
* to assimp will be successful after this method has been called.
|
||||
* @return 0xffffffff if an error occured
|
||||
*/
|
||||
private native int _NativeFreeContext();
|
||||
private native int _NativeFreeContext(int iContext);
|
||||
|
||||
/**
|
||||
* JNI bridge call. For internal use only
|
||||
* The method loads the model into memory, but does not map it into the VM
|
||||
* @param path Path (valid separators for the OS) to the model to be loaded
|
||||
* @param steps List of postprocess steps to be executed
|
||||
* @param flags List of postprocess steps to be executed
|
||||
* @return 0xffffffff if an error occured
|
||||
*/
|
||||
private native int _NativeLoad(String path,Vector< PostProcessStep > steps);
|
||||
private native int _NativeLoad(String path,int flags, int iContext);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,68 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
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.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
package assimp;
|
||||
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: Alex
|
||||
* Date: 22.05.2008
|
||||
* Time: 13:05:05
|
||||
* To change this template use File | Settings | File Templates.
|
||||
* Class to wrap materials. Materials are represented in ASSIMP as a list of
|
||||
* key/value pairs, the key being a <code>String</code> and the value being
|
||||
* a binary buffer.
|
||||
*
|
||||
* @author Aramis (Alexander Gessler)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Material {
|
||||
public class Material extends IMappable {
|
||||
/**
|
||||
* Construction from a given parent object and array index
|
||||
*
|
||||
* @param parent Must be valid, null is not allowed
|
||||
* @param index Valied index in the parent's list
|
||||
*/
|
||||
public Material(Object parent, int index) {
|
||||
super(parent, index);
|
||||
}
|
||||
|
||||
protected void OnMap() throws NativeError {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,91 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
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.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
package assimp;
|
||||
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: Alex
|
||||
* Date: 22.05.2008
|
||||
* Time: 13:04:42
|
||||
* To change this template use File | Settings | File Templates.
|
||||
* A mesh represents a geometry or model with a single material.
|
||||
* <p/>
|
||||
* It usually consists of a number of vertices and a series of primitives/faces
|
||||
* referencing the vertices. In addition there might be a series of bones, each
|
||||
* of them addressing a number of vertices with a certain weight. Vertex data
|
||||
* is presented in channels with each channel containing a single per-vertex
|
||||
* information such as a set of texture coords or a normal vector.
|
||||
* <p/>
|
||||
* Note that not all mesh data channels must be there. E.g. most models
|
||||
* don't contain vertex colors, so this data channel is often not filled.
|
||||
*
|
||||
* @author Aramis (Alexander Gessler)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Mesh {
|
||||
public class Mesh extends IMappable {
|
||||
|
||||
/**
|
||||
* Defines the maximum number of UV(W) channels that are available
|
||||
* for a mesh. If a loader finds more channels in a file, some
|
||||
* will be skipped
|
||||
*/
|
||||
private static final int MAX_NUMBER_OF_TEXTURECOORDS = 0x4;
|
||||
|
||||
/**
|
||||
* Defines the maximum number of vertex color channels that are
|
||||
* available for a mesh. If a loader finds more channels in a file,
|
||||
* some will be skipped
|
||||
*/
|
||||
private static final int MAX_NUMBER_OF_COLOR_SETS = 0x4;
|
||||
|
||||
/**
|
||||
* Construction from a given parent object and array index
|
||||
*
|
||||
* @param parent Parent object
|
||||
* @param index Valied index in the parent's list
|
||||
*/
|
||||
public Mesh(Object parent, int index) {
|
||||
super(parent, index);
|
||||
}
|
||||
|
||||
|
||||
protected void OnMap() throws NativeError {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ import java.util.Vector;
|
|||
* multiple meshes, animations, materials and embedded textures.
|
||||
* And it defines the scenegraph of the asset (the hierarchy of all
|
||||
* meshes, ...).
|
||||
*
|
||||
* <p/>
|
||||
* An instance of this class is returned by Importer.readFile().
|
||||
*
|
||||
* @author Aramis (Alexander Gessler)
|
||||
|
@ -57,52 +57,155 @@ import java.util.Vector;
|
|||
*/
|
||||
public class Scene {
|
||||
|
||||
// NOTE: use Vector's to be able to use the constructor for initialisation
|
||||
private Vector<Mesh> m_vMeshes;
|
||||
private Vector<Texture> m_vTextures;
|
||||
private Vector<Material> m_vMaterials;
|
||||
private Vector<Animation> m_vAnimations;
|
||||
private Node m_rootNode;
|
||||
private Node m_rootNode = null;
|
||||
private Importer imp = null;
|
||||
|
||||
/** Get the mesh list
|
||||
private Scene() {
|
||||
}
|
||||
|
||||
protected Scene(Importer imp) {
|
||||
this.imp = imp;
|
||||
}
|
||||
|
||||
public final Importer getImporter() {
|
||||
return this.imp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mesh list
|
||||
*
|
||||
* @return mesh list
|
||||
*/
|
||||
public Vector<Mesh> getMeshes() {
|
||||
public final Vector<Mesh> getMeshes() {
|
||||
return m_vMeshes;
|
||||
}
|
||||
|
||||
/** Get the texture list
|
||||
/**
|
||||
* Get the texture list
|
||||
*
|
||||
* @return Texture list
|
||||
*/
|
||||
public Vector<Texture> getTextures() {
|
||||
public final Vector<Texture> getTextures() {
|
||||
return m_vTextures;
|
||||
}
|
||||
|
||||
/** Get the material list
|
||||
/**
|
||||
* Get the material list
|
||||
*
|
||||
* @return Material list
|
||||
*/
|
||||
public Vector<Material> getMaterials() {
|
||||
public final Vector<Material> getMaterials() {
|
||||
return m_vMaterials;
|
||||
}
|
||||
|
||||
/** Get the animation list
|
||||
/**
|
||||
* Get the animation list
|
||||
*
|
||||
* @return Animation list
|
||||
*/
|
||||
public Vector<Animation> getAnimations() {
|
||||
public final Vector<Animation> getAnimations() {
|
||||
return m_vAnimations;
|
||||
}
|
||||
|
||||
/** Get the root node of the scenegraph
|
||||
/**
|
||||
* Get the root node of the scenegraph
|
||||
*
|
||||
* @return Root node
|
||||
*/
|
||||
public Node getRootNode() {
|
||||
public final Node getRootNode() {
|
||||
return m_rootNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to initialize the class instance. Called by Importer. Will maybe
|
||||
* be replaced with a RAII solution ...
|
||||
* @return true if we're successful
|
||||
*/
|
||||
protected boolean construct() {
|
||||
|
||||
int i;
|
||||
|
||||
// load all meshes
|
||||
int iTemp = this._NativeGetNumMeshes(imp.hashCode());
|
||||
if (0xffffffff == iTemp) return false;
|
||||
this.m_vMeshes.setSize(iTemp);
|
||||
|
||||
// Mesh, Animation, Texture, Material and Node constructors
|
||||
// throw exceptions if they fail
|
||||
try {
|
||||
|
||||
for (i = 0; i < iTemp; ++i) {
|
||||
this.m_vMeshes.set(i, new Mesh(this, i));
|
||||
}
|
||||
|
||||
// load all animations
|
||||
iTemp = this._NativeGetNumAnimations(imp.hashCode());
|
||||
if (0xffffffff == iTemp) return false;
|
||||
this.m_vAnimations.setSize(iTemp);
|
||||
|
||||
for (i = 0; i < iTemp; ++i) {
|
||||
this.m_vAnimations.set(i, new Animation(this, i));
|
||||
}
|
||||
|
||||
// load all textures
|
||||
iTemp = this._NativeGetNumTextures(imp.hashCode());
|
||||
if (0xffffffff == iTemp) return false;
|
||||
this.m_vTextures.setSize(iTemp);
|
||||
|
||||
for (i = 0; i < iTemp; ++i) {
|
||||
this.m_vTextures.set(i, new Texture(this, i));
|
||||
}
|
||||
|
||||
// load all materials
|
||||
iTemp = this._NativeGetNumMaterials(imp.hashCode());
|
||||
if (0xffffffff == iTemp) return false;
|
||||
this.m_vMaterials.setSize(iTemp);
|
||||
|
||||
for (i = 0; i < iTemp; ++i) {
|
||||
this.m_vMaterials.set(i, new Material(this, i));
|
||||
}
|
||||
|
||||
// now load all nodes
|
||||
//this.m_rootNode = new Node(this, 0xffffffff);
|
||||
|
||||
}
|
||||
catch (Exception ex) {
|
||||
// LOG
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** JNI bridge function - for internal use only
|
||||
* Retrieve the number of meshes in a scene
|
||||
* @param context Current importer context (imp.hashCode)
|
||||
* @return Number of meshes in the scene that belongs to the context
|
||||
*/
|
||||
private native int _NativeGetNumMeshes(int context);
|
||||
|
||||
/** JNI bridge function - for internal use only
|
||||
* Retrieve the number of animations in a scene
|
||||
* @param context Current importer context (imp.hashCode)
|
||||
* @return Number of animations in the scene that belongs to the context
|
||||
*/
|
||||
private native int _NativeGetNumAnimations(int context);
|
||||
|
||||
/** JNI bridge function - for internal use only
|
||||
* Retrieve the number of textures in a scene
|
||||
* @param context Current importer context (imp.hashCode)
|
||||
* @return Number of textures in the scene that belongs to the context
|
||||
*/
|
||||
private native int _NativeGetNumTextures(int context);
|
||||
|
||||
/** JNI bridge function - for internal use only
|
||||
* Retrieve the number of materials in a scene
|
||||
* @param context Current importer context (imp.hashCode)
|
||||
* @return Number of materials in the scene that belongs to the context
|
||||
*/
|
||||
private native int _NativeGetNumMaterials(int context);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
package assimp;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
|
@ -57,13 +56,24 @@ import java.awt.*;
|
|||
* @author Aramis (Alexander Gessler)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Texture {
|
||||
public class Texture extends IMappable {
|
||||
|
||||
private int width = 0;
|
||||
private int height = 0;
|
||||
|
||||
private Color[] data = null;
|
||||
|
||||
/**
|
||||
* Construction from a given parent object and array index
|
||||
*
|
||||
* @param parent Must be valid, null is not allowed
|
||||
* @param index Valied index in the parent's list
|
||||
*/
|
||||
public Texture(Object parent, int index) {
|
||||
super(parent, index);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve the height of the texture image
|
||||
*
|
||||
|
@ -96,7 +106,7 @@ public class Texture {
|
|||
// map the color data in memory if required ...
|
||||
if (null == data) {
|
||||
try {
|
||||
this.MapColorData();
|
||||
this.OnMap();
|
||||
} catch (NativeError nativeError) {
|
||||
return Color.black;
|
||||
}
|
||||
|
@ -108,7 +118,8 @@ public class Texture {
|
|||
* Internal helper function to map the native texture data into
|
||||
* a <code>java.awt.Color</code> array
|
||||
*/
|
||||
private void MapColorData() throws NativeError {
|
||||
@Override
|
||||
protected void OnMap() throws NativeError {
|
||||
final int iNumPixels = width * height;
|
||||
|
||||
// first allocate the output array
|
||||
|
@ -119,7 +130,7 @@ public class Texture {
|
|||
|
||||
// and copy the native color data to it
|
||||
if (0xffffffff == this._NativeMapColorData(temp)) {
|
||||
throw new NativeError("Unable to map aiTexture into Java-VM");
|
||||
throw new NativeError("Unable to map aiTexture into the Java-VM");
|
||||
}
|
||||
|
||||
// now convert the temporary representation to a Color array
|
||||
|
|
|
@ -178,10 +178,10 @@
|
|||
</component>
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://J:/Programmieren/ASSIMP/ASSIMP/port/jAssimp/assimp.iml" filepath="J:/Programmieren/ASSIMP/ASSIMP/port/jAssimp/assimp.iml" />
|
||||
<module fileurl="file://J:/Programmieren/ASSIMP/assimp2/port/jAssimp/assimp.iml" filepath="J:/Programmieren/ASSIMP/assimp2/port/jAssimp/assimp.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" assert-keyword="false" jdk-15="false" project-jdk-name="1.6" />
|
||||
<component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" />
|
||||
<component name="RmicSettings">
|
||||
<option name="IS_EANABLED" value="false" />
|
||||
<option name="DEBUGGING_INFO" value="true" />
|
||||
|
|
|
@ -763,6 +763,30 @@
|
|||
<Filter
|
||||
Name="jAssimp"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\code\jAssimp\assimp_Importer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\jAssimp\assimp_Material.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\jAssimp\assimp_Mesh.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\jAssimp\assimp_Node.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\jAssimp\assimp_Scene.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\jAssimp\assimp_Texture.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
@ -948,7 +972,7 @@
|
|||
Name="jAssimp"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\code\JNICalls.cpp"
|
||||
RelativePath="..\..\code\jAssimp\JNICalls.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
|
|
Loading…
Reference in New Issue