private static void buildTransFormationMatrices(AINodeAnim aiNodeAnim, Node node) { int numFrames = aiNodeAnim.mNumPositionKeys(); AIVectorKey.Buffer positionKeys = aiNodeAnim.mPositionKeys(); AIVectorKey.Buffer scalingKeys = aiNodeAnim.mScalingKeys(); AIQuatKey.Buffer rotationKeys = aiNodeAnim.mRotationKeys(); for (int i = 0; i < numFrames; i++) { AIVectorKey aiVecKey = positionKeys.get(i); AIVector3D vec = aiVecKey.mValue(); Matrix4f transfMat = new Matrix4f().translate(vec.x(), vec.y(), vec.z()); AIQuatKey quatKey = rotationKeys.get(i); AIQuaternion aiQuat = quatKey.mValue(); Quaternionf quat = new Quaternionf(aiQuat.x(), aiQuat.y(), aiQuat.z(), aiQuat.w()); transfMat.rotate(quat); if (i < aiNodeAnim.mNumScalingKeys()) { aiVecKey = scalingKeys.get(i); vec = aiVecKey.mValue(); transfMat.scale(vec.x(), vec.y(), vec.z()); } node.addTransformation(transfMat); } }
/** * Proceses the vertices of a mesh. * * @param aiMesh - AIMesh to process vertices for. * @param vertices - List of vertices to add processed vertices to. */ private static void processVertices(AIMesh aiMesh, List<Float> vertices) { AIVector3D.Buffer aiVertices = aiMesh.mVertices(); while(aiVertices.remaining() > 0) { AIVector3D aiVertex = aiVertices.get(); vertices.add(aiVertex.x()); vertices.add(aiVertex.y()); vertices.add(aiVertex.z()); } }
/** * Proceses the texture coordinates of a mesh. * * @param aiMesh - AIMesh to process texture coordinates for. * @param textures - List of texture coordinates to add * processed coordinates to. */ private static void processTextureCoordinates(AIMesh aiMesh, List<Float> textures) { AIVector3D.Buffer aiTextures = aiMesh.mTextureCoords(0); int numTextCoords = aiTextures != null ? aiTextures.remaining() : 0; for (int i = 0; i < numTextCoords; i++) { AIVector3D textCoord = aiTextures.get(); textures.add(textCoord.x()); textures.add(1 - textCoord.y()); } }
/** * Proceses the normals of a mesh. * * @param aiMesh - AIMesh to process normals for. * @param normals - List of normals to add processed normals to. */ private static void processNormals(AIMesh aiMesh, List<Float> normals) { AIVector3D.Buffer aiNormals = aiMesh.mNormals(); while(aiNormals != null && aiNormals.remaining() > 0) { AIVector3D aiVertex = aiNormals.get(); normals.add(aiVertex.x()); normals.add(aiVertex.y()); normals.add(aiVertex.z()); } }
private static void processVertices(AIMesh aiMesh, List<Float> vertices) { AIVector3D.Buffer aiVertices = aiMesh.mVertices(); while (aiVertices.remaining() > 0) { AIVector3D aiVertex = aiVertices.get(); vertices.add(aiVertex.x()); vertices.add(aiVertex.y()); vertices.add(aiVertex.z()); } }
private static void processNormals(AIMesh aiMesh, List<Float> normals) { AIVector3D.Buffer aiVertices = aiMesh.mVertices(); while (aiVertices.remaining() > 0) { AIVector3D aiVertex = aiVertices.get(); normals.add(aiVertex.x()); normals.add(aiVertex.y()); normals.add(aiVertex.z()); } }
private static void processTextureCoordinates(AIMesh aiMesh, List<Float> textures) { AIVector3D.Buffer textCoords = aiMesh.mTextureCoords(0); int numTextCoords = textCoords != null ? textCoords.remaining() : 0; for (int i = 0; i < numTextCoords; i++) { AIVector3D textCoord = textCoords.get(); textures.add(textCoord.x()); textures.add(1 - textCoord.y()); } }
protected static void processNormals(AIMesh aiMesh, List<Float> normals) { AIVector3D.Buffer aiNormals = aiMesh.mNormals(); while (aiNormals != null && aiNormals.remaining() > 0) { AIVector3D aiNormal = aiNormals.get(); normals.add(aiNormal.x()); normals.add(aiNormal.y()); normals.add(aiNormal.z()); } }
protected static void processTextCoords(AIMesh aiMesh, List<Float> textures) { AIVector3D.Buffer textCoords = aiMesh.mTextureCoords(0); int numTextCoords = textCoords != null ? textCoords.remaining() : 0; for (int i = 0; i < numTextCoords; i++) { AIVector3D textCoord = textCoords.get(); textures.add(textCoord.x()); textures.add(1 - textCoord.y()); } }
protected static void processVertices(AIMesh aiMesh, List<Float> vertices) { AIVector3D.Buffer aiVertices = aiMesh.mVertices(); while (aiVertices.remaining() > 0) { AIVector3D aiVertex = aiVertices.get(); vertices.add(aiVertex.x()); vertices.add(aiVertex.y()); vertices.add(aiVertex.z()); } }
private static void processNormals(AIMesh aiMesh, List<Float> normals) { AIVector3D.Buffer aiNormals = aiMesh.mNormals(); while (aiNormals != null && aiNormals.remaining() > 0) { AIVector3D aiNormal = aiNormals.get(); normals.add(aiNormal.x()); normals.add(aiNormal.y()); normals.add(aiNormal.z()); } }
private static void processTextCoords(AIMesh aiMesh, List<Float> textures) { AIVector3D.Buffer textCoords = aiMesh.mTextureCoords(0); int numTextCoords = textCoords != null ? textCoords.remaining() : 0; for (int i = 0; i < numTextCoords; i++) { AIVector3D textCoord = textCoords.get(); textures.add(textCoord.x()); textures.add(1 - textCoord.y()); } }
public static Vector3f fromAssimp(AIVector3D aiVector3D) { return new Vector3f(aiVector3D.x(), aiVector3D.y(), aiVector3D.z()); }