JAssimp: fix simple code analysis issues.
parent
106bf19992
commit
3087ebb93a
|
@ -54,6 +54,26 @@ import java.util.List;
|
|||
* {@link AiMesh} for a description and comparison of these APIs.
|
||||
*/
|
||||
public final class AiAnimation {
|
||||
/**
|
||||
* Name.
|
||||
*/
|
||||
private final String m_name;
|
||||
|
||||
/**
|
||||
* Duration.
|
||||
*/
|
||||
private final double m_duration;
|
||||
|
||||
/**
|
||||
* Ticks per second.
|
||||
*/
|
||||
private final double m_ticksPerSecond;
|
||||
|
||||
/**
|
||||
* Bone animation channels.
|
||||
*/
|
||||
private final List<AiNodeAnim> m_nodeAnims = new ArrayList<AiNodeAnim>();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -151,29 +171,5 @@ public final class AiAnimation {
|
|||
*/
|
||||
public List<AiMeshAnim> getMeshChannels() {
|
||||
throw new UnsupportedOperationException("not implemented yet");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*/
|
||||
private final String m_name;
|
||||
|
||||
|
||||
/**
|
||||
* Duration.
|
||||
*/
|
||||
private final double m_duration;
|
||||
|
||||
|
||||
/**
|
||||
* Ticks per second.
|
||||
*/
|
||||
private final double m_ticksPerSecond;
|
||||
|
||||
|
||||
/**
|
||||
* Bone animation channels.
|
||||
*/
|
||||
private final List<AiNodeAnim> m_nodeAnims = new ArrayList<AiNodeAnim>();
|
||||
}
|
||||
}
|
|
@ -55,6 +55,24 @@ import java.util.List;
|
|||
* writable and may be modified.
|
||||
*/
|
||||
public final class AiBone {
|
||||
/**
|
||||
* Name of the bone.
|
||||
*/
|
||||
private String m_name;
|
||||
|
||||
|
||||
/**
|
||||
* Bone weights.
|
||||
*/
|
||||
private final List<AiBoneWeight> m_boneWeights =
|
||||
new ArrayList<AiBoneWeight>();
|
||||
|
||||
|
||||
/**
|
||||
* Offset matrix.
|
||||
*/
|
||||
private Object m_offsetMatrix;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
|
@ -114,24 +132,5 @@ public final class AiBone {
|
|||
AiWrapperProvider<V3, M4, C, N, Q> wrapperProvider) {
|
||||
|
||||
return (M4) m_offsetMatrix;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Name of the bone.
|
||||
*/
|
||||
private String m_name;
|
||||
|
||||
|
||||
/**
|
||||
* Bone weights.
|
||||
*/
|
||||
private final List<AiBoneWeight> m_boneWeights =
|
||||
new ArrayList<AiBoneWeight>();
|
||||
|
||||
|
||||
/**
|
||||
* Offset matrix.
|
||||
*/
|
||||
private Object m_offsetMatrix;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,16 @@ import java.nio.ByteBuffer;
|
|||
* modify the underlying mesh.
|
||||
*/
|
||||
public final class AiColor {
|
||||
/**
|
||||
* Wrapped buffer.
|
||||
*/
|
||||
private final ByteBuffer m_buffer;
|
||||
|
||||
/**
|
||||
* Offset into m_buffer.
|
||||
*/
|
||||
private final int m_offset;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -147,16 +157,4 @@ public final class AiColor {
|
|||
return "[" + getRed() + ", " + getGreen() + ", " + getBlue() + ", " +
|
||||
getAlpha() + "]";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wrapped buffer.
|
||||
*/
|
||||
private final ByteBuffer m_buffer;
|
||||
|
||||
|
||||
/**
|
||||
* Offset into m_buffer.
|
||||
*/
|
||||
private final int m_offset;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,17 @@ import java.util.Set;
|
|||
* properties (i.e., properties starting with <code>TEX_</code>).
|
||||
*/
|
||||
public final class AiMaterial {
|
||||
/**
|
||||
* List of properties.
|
||||
*/
|
||||
private final List<Property> m_properties = new ArrayList<Property>();
|
||||
|
||||
/**
|
||||
* Number of textures for each type.
|
||||
*/
|
||||
private final Map<AiTextureType, Integer> m_numTextures =
|
||||
new EnumMap<AiTextureType, Integer>(AiTextureType.class);
|
||||
|
||||
/**
|
||||
* Enumerates all supported material properties.
|
||||
*/
|
||||
|
@ -1185,18 +1196,5 @@ public final class AiMaterial {
|
|||
@SuppressWarnings("unused")
|
||||
private void setTextureNumber(int type, int number) {
|
||||
m_numTextures.put(AiTextureType.fromRawValue(type), number);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* List of properties.
|
||||
*/
|
||||
private final List<Property> m_properties = new ArrayList<Property>();
|
||||
|
||||
|
||||
/**
|
||||
* Number of textures for each type.
|
||||
*/
|
||||
private final Map<AiTextureType, Integer> m_numTextures =
|
||||
new EnumMap<AiTextureType, Integer>(AiTextureType.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,6 +153,89 @@ public final class AiMesh {
|
|||
private final int SIZEOF_V3D = Jassimp.NATIVE_AIVEKTOR3D_SIZE;
|
||||
|
||||
|
||||
/**
|
||||
* The primitive types used by this mesh.
|
||||
*/
|
||||
private final Set<AiPrimitiveType> m_primitiveTypes =
|
||||
EnumSet.noneOf(AiPrimitiveType.class);
|
||||
|
||||
|
||||
/**
|
||||
* Number of vertices in this mesh.
|
||||
*/
|
||||
private int m_numVertices = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Number of faces in this mesh.
|
||||
*/
|
||||
private int m_numFaces = 0;
|
||||
|
||||
/**
|
||||
* Material used by this mesh.
|
||||
*/
|
||||
private int m_materialIndex = -1;
|
||||
|
||||
/**
|
||||
* The name of the mesh.
|
||||
*/
|
||||
private String m_name = "";
|
||||
|
||||
/**
|
||||
* Buffer for vertex position data.
|
||||
*/
|
||||
private ByteBuffer m_vertices = null;
|
||||
|
||||
/**
|
||||
* Buffer for faces/ indices.
|
||||
*/
|
||||
private ByteBuffer m_faces = null;
|
||||
|
||||
|
||||
/**
|
||||
* Index structure for m_faces.<p>
|
||||
*
|
||||
* Only used by meshes that are not pure triangular
|
||||
*/
|
||||
private ByteBuffer m_faceOffsets = null;
|
||||
|
||||
/**
|
||||
* Buffer for normals.
|
||||
*/
|
||||
private ByteBuffer m_normals = null;
|
||||
|
||||
/**
|
||||
* Buffer for tangents.
|
||||
*/
|
||||
private ByteBuffer m_tangents = null;
|
||||
|
||||
/**
|
||||
* Buffer for bitangents.
|
||||
*/
|
||||
private ByteBuffer m_bitangents = null;
|
||||
|
||||
/**
|
||||
* Vertex colors.
|
||||
*/
|
||||
private ByteBuffer[] m_colorsets =
|
||||
new ByteBuffer[JassimpConfig.MAX_NUMBER_COLORSETS];
|
||||
|
||||
/**
|
||||
* Number of UV components for each texture coordinate set.
|
||||
*/
|
||||
private int[] m_numUVComponents = new int[JassimpConfig.MAX_NUMBER_TEXCOORDS];
|
||||
|
||||
/**
|
||||
* Texture coordinates.
|
||||
*/
|
||||
private ByteBuffer[] m_texcoords =
|
||||
new ByteBuffer[JassimpConfig.MAX_NUMBER_TEXCOORDS];
|
||||
|
||||
/**
|
||||
* Bones.
|
||||
*/
|
||||
private final List<AiBone> m_bones = new ArrayList<AiBone>();
|
||||
|
||||
/**
|
||||
* This class is instantiated via JNI, no accessible constructor.
|
||||
*/
|
||||
|
@ -1335,99 +1418,4 @@ public final class AiMesh {
|
|||
}
|
||||
}
|
||||
// }}
|
||||
|
||||
|
||||
/**
|
||||
* The primitive types used by this mesh.
|
||||
*/
|
||||
private final Set<AiPrimitiveType> m_primitiveTypes =
|
||||
EnumSet.noneOf(AiPrimitiveType.class);
|
||||
|
||||
|
||||
/**
|
||||
* Number of vertices in this mesh.
|
||||
*/
|
||||
private int m_numVertices = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Number of faces in this mesh.
|
||||
*/
|
||||
private int m_numFaces = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Material used by this mesh.
|
||||
*/
|
||||
private int m_materialIndex = -1;
|
||||
|
||||
|
||||
/**
|
||||
* The name of the mesh.
|
||||
*/
|
||||
private String m_name = "";
|
||||
|
||||
|
||||
/**
|
||||
* Buffer for vertex position data.
|
||||
*/
|
||||
private ByteBuffer m_vertices = null;
|
||||
|
||||
|
||||
/**
|
||||
* Buffer for faces/ indices.
|
||||
*/
|
||||
private ByteBuffer m_faces = null;
|
||||
|
||||
|
||||
/**
|
||||
* Index structure for m_faces.<p>
|
||||
*
|
||||
* Only used by meshes that are not pure triangular
|
||||
*/
|
||||
private ByteBuffer m_faceOffsets = null;
|
||||
|
||||
|
||||
/**
|
||||
* Buffer for normals.
|
||||
*/
|
||||
private ByteBuffer m_normals = null;
|
||||
|
||||
|
||||
/**
|
||||
* Buffer for tangents.
|
||||
*/
|
||||
private ByteBuffer m_tangents = null;
|
||||
|
||||
|
||||
/**
|
||||
* Buffer for bitangents.
|
||||
*/
|
||||
private ByteBuffer m_bitangents = null;
|
||||
|
||||
|
||||
/**
|
||||
* Vertex colors.
|
||||
*/
|
||||
private ByteBuffer[] m_colorsets =
|
||||
new ByteBuffer[JassimpConfig.MAX_NUMBER_COLORSETS];
|
||||
|
||||
|
||||
/**
|
||||
* Number of UV components for each texture coordinate set.
|
||||
*/
|
||||
private int[] m_numUVComponents = new int[JassimpConfig.MAX_NUMBER_TEXCOORDS];
|
||||
|
||||
|
||||
/**
|
||||
* Texture coordinates.
|
||||
*/
|
||||
private ByteBuffer[] m_texcoords =
|
||||
new ByteBuffer[JassimpConfig.MAX_NUMBER_TEXCOORDS];
|
||||
|
||||
|
||||
/**
|
||||
* Bones.
|
||||
*/
|
||||
private final List<AiBone> m_bones = new ArrayList<AiBone>();
|
||||
}
|
||||
|
|
|
@ -55,6 +55,34 @@ import java.util.Map;
|
|||
* the imported scene consists of only a single root node without children.
|
||||
*/
|
||||
public final class AiNode {
|
||||
/**
|
||||
* Parent node.
|
||||
*/
|
||||
private final AiNode m_parent;
|
||||
|
||||
|
||||
/**
|
||||
* Mesh references.
|
||||
*/
|
||||
private final int[] m_meshReferences;
|
||||
|
||||
|
||||
/**
|
||||
* List of children.
|
||||
*/
|
||||
private final List<AiNode> m_children = new ArrayList<AiNode>();
|
||||
|
||||
/**
|
||||
* List of metadata entries.
|
||||
*/
|
||||
private final Map<String, AiMetadataEntry> m_metaData = new HashMap<String, AiMetadataEntry>();
|
||||
|
||||
|
||||
/**
|
||||
* Buffer for transformation matrix.
|
||||
*/
|
||||
private final Object m_transformationMatrix;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -214,34 +242,5 @@ public final class AiNode {
|
|||
/**
|
||||
* Name.
|
||||
*/
|
||||
private final String m_name;
|
||||
|
||||
|
||||
/**
|
||||
* Parent node.
|
||||
*/
|
||||
private final AiNode m_parent;
|
||||
|
||||
|
||||
/**
|
||||
* Mesh references.
|
||||
*/
|
||||
private final int[] m_meshReferences;
|
||||
|
||||
|
||||
/**
|
||||
* List of children.
|
||||
*/
|
||||
private final List<AiNode> m_children = new ArrayList<AiNode>();
|
||||
|
||||
/**
|
||||
* List of metadata entries.
|
||||
*/
|
||||
private final Map<String, AiMetadataEntry> m_metaData = new HashMap<String, AiMetadataEntry>();
|
||||
|
||||
|
||||
/**
|
||||
* Buffer for transformation matrix.
|
||||
*/
|
||||
private final Object m_transformationMatrix;
|
||||
private final String m_name;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,17 @@ import java.nio.ByteBuffer;
|
|||
* modify the underlying mesh/animation.
|
||||
*/
|
||||
public final class AiQuaternion {
|
||||
/**
|
||||
* Wrapped buffer.
|
||||
*/
|
||||
private final ByteBuffer m_buffer;
|
||||
|
||||
|
||||
/**
|
||||
* Offset into m_buffer.
|
||||
*/
|
||||
private final int m_offset;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -150,17 +161,5 @@ public final class AiQuaternion {
|
|||
public String toString() {
|
||||
return "[" + getX() + ", " + getY() + ", " + getZ() + ", " +
|
||||
getW() + "]";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wrapped buffer.
|
||||
*/
|
||||
private final ByteBuffer m_buffer;
|
||||
|
||||
|
||||
/**
|
||||
* Offset into m_buffer.
|
||||
*/
|
||||
private final int m_offset;
|
||||
}
|
||||
}
|
|
@ -60,6 +60,44 @@ import java.util.Set;
|
|||
*/
|
||||
public final class Jassimp {
|
||||
|
||||
/**
|
||||
* The native interface.
|
||||
*
|
||||
* @param filename the file to load
|
||||
* @param postProcessing post processing flags
|
||||
* @return the loaded scene, or null if an error occurred
|
||||
* @throws IOException if an error occurs
|
||||
*/
|
||||
private static native AiScene aiImportFile(String filename,
|
||||
long postProcessing, AiIOSystem<?> ioSystem) throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
* The active wrapper provider.
|
||||
*/
|
||||
private static AiWrapperProvider<?, ?, ?, ?, ?> s_wrapperProvider =
|
||||
new AiBuiltInWrapperProvider();
|
||||
|
||||
|
||||
/**
|
||||
* The library loader to load the native library.
|
||||
*/
|
||||
private static JassimpLibraryLoader s_libraryLoader =
|
||||
new JassimpLibraryLoader();
|
||||
|
||||
/**
|
||||
* Status flag if the library is loaded.
|
||||
*
|
||||
* Volatile to avoid problems with double checked locking.
|
||||
*
|
||||
*/
|
||||
private static volatile boolean s_libraryLoaded = false;
|
||||
|
||||
/**
|
||||
* Lock for library loading.
|
||||
*/
|
||||
private static final Object s_libraryLoadingLock = new Object();
|
||||
|
||||
/**
|
||||
* The default wrapper provider using built in types.
|
||||
*/
|
||||
|
@ -222,7 +260,7 @@ public final class Jassimp {
|
|||
* @param data the matrix data
|
||||
* @return the wrapped matrix
|
||||
*/
|
||||
static Object wrapMatrix(float[] data) {
|
||||
private static Object wrapMatrix(float[] data) {
|
||||
return s_wrapperProvider.wrapMatrix4f(data);
|
||||
}
|
||||
|
||||
|
@ -237,7 +275,7 @@ public final class Jassimp {
|
|||
* @param blue blue component
|
||||
* @return the wrapped color
|
||||
*/
|
||||
static Object wrapColor3(float red, float green, float blue) {
|
||||
private static Object wrapColor3(float red, float green, float blue) {
|
||||
return wrapColor4(red, green, blue, 1.0f);
|
||||
}
|
||||
|
||||
|
@ -253,7 +291,7 @@ public final class Jassimp {
|
|||
* @param alpha alpha component
|
||||
* @return the wrapped color
|
||||
*/
|
||||
static Object wrapColor4(float red, float green, float blue, float alpha) {
|
||||
private static Object wrapColor4(float red, float green, float blue, float alpha) {
|
||||
ByteBuffer temp = ByteBuffer.allocate(4 * 4);
|
||||
temp.putFloat(red);
|
||||
temp.putFloat(green);
|
||||
|
@ -274,7 +312,7 @@ public final class Jassimp {
|
|||
* @param z z component
|
||||
* @return the wrapped vector
|
||||
*/
|
||||
static Object wrapVec3(float x, float y, float z) {
|
||||
private static Object wrapVec3(float x, float y, float z) {
|
||||
ByteBuffer temp = ByteBuffer.allocate(3 * 4);
|
||||
temp.putFloat(x);
|
||||
temp.putFloat(y);
|
||||
|
@ -295,7 +333,7 @@ public final class Jassimp {
|
|||
* @param name the name of the node
|
||||
* @return the wrapped matrix
|
||||
*/
|
||||
static Object wrapSceneNode(Object parent, Object matrix, int[] meshRefs,
|
||||
private static Object wrapSceneNode(Object parent, Object matrix, int[] meshRefs,
|
||||
String name) {
|
||||
|
||||
return s_wrapperProvider.wrapSceneNode(parent, matrix, meshRefs, name);
|
||||
|
@ -327,48 +365,9 @@ public final class Jassimp {
|
|||
s_libraryLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The native interface.
|
||||
*
|
||||
* @param filename the file to load
|
||||
* @param postProcessing post processing flags
|
||||
* @return the loaded scene, or null if an error occurred
|
||||
* @throws IOException if an error occurs
|
||||
*/
|
||||
private static native AiScene aiImportFile(String filename,
|
||||
long postProcessing, AiIOSystem<?> ioSystem) throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
* The active wrapper provider.
|
||||
*/
|
||||
private static AiWrapperProvider<?, ?, ?, ?, ?> s_wrapperProvider =
|
||||
new AiBuiltInWrapperProvider();
|
||||
|
||||
|
||||
/**
|
||||
* The library loader to load the native library.
|
||||
*/
|
||||
private static JassimpLibraryLoader s_libraryLoader =
|
||||
new JassimpLibraryLoader();
|
||||
|
||||
/**
|
||||
* Status flag if the library is loaded.
|
||||
*
|
||||
* Volatile to avoid problems with double checked locking.
|
||||
*
|
||||
*/
|
||||
private static volatile boolean s_libraryLoaded = false;
|
||||
|
||||
/**
|
||||
* Lock for library loading.
|
||||
*/
|
||||
private static final Object s_libraryLoadingLock = new Object();
|
||||
|
||||
|
||||
/**
|
||||
* Pure static class, no accessible constructor.
|
||||
*/
|
||||
|
@ -384,5 +383,4 @@ public final class Jassimp {
|
|||
public static int NATIVE_UINT_SIZE;
|
||||
public static int NATIVE_DOUBLE_SIZE;
|
||||
public static int NATIVE_LONG_SIZE;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue