Java 类org.lwjgl.assimp.AIVector3D 实例源码

项目:lwjglbook    文件:AnimMeshesLoader.java   
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);
    }
}
项目:lwjglbook    文件:AnimMeshesLoader.java   
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);
    }
}
项目:Mass    文件:StaticMeshLoader.java   
/**
 * 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());
    }
}
项目:Mass    文件:StaticMeshLoader.java   
/**
 * 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());
    }
}
项目:Mass    文件:StaticMeshLoader.java   
/**
 * 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());
    }
}
项目:JavaGraphicsEngine    文件:AssimpLoader.java   
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());
    }
}
项目:JavaGraphicsEngine    文件:AssimpLoader.java   
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());
    }
}
项目:JavaGraphicsEngine    文件:AssimpLoader.java   
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());
    }
}
项目:lwjglbook    文件:StaticMeshesLoader.java   
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());
    }
}
项目:lwjglbook    文件:StaticMeshesLoader.java   
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());
    }
}
项目:lwjglbook    文件:StaticMeshesLoader.java   
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());
    }
}
项目:lwjglbook    文件:StaticMeshesLoader.java   
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());
    }
}
项目:lwjglbook    文件:StaticMeshesLoader.java   
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());
    }
}
项目:lwjglbook    文件:StaticMeshesLoader.java   
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());
    }
}
项目:lwjglbook    文件:StaticMeshesLoader.java   
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());
    }
}
项目:lwjglbook    文件:StaticMeshesLoader.java   
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());
    }
}
项目:lwjglbook    文件:StaticMeshesLoader.java   
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());
    }
}
项目:Assimp-Tutorial-LWJGL-3    文件:Vector3f.java   
public static Vector3f fromAssimp(AIVector3D aiVector3D) {
    return new Vector3f(aiVector3D.x(), aiVector3D.y(), aiVector3D.z());
}