当前位置: 首页>>代码示例>>Java>>正文


Java Matrix4f.mul方法代码示例

本文整理汇总了Java中org.lwjgl.util.vector.Matrix4f.mul方法的典型用法代码示例。如果您正苦于以下问题:Java Matrix4f.mul方法的具体用法?Java Matrix4f.mul怎么用?Java Matrix4f.mul使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.util.vector.Matrix4f的用法示例。


在下文中一共展示了Matrix4f.mul方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processTransforms

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private void processTransforms(String jointName, String[] rawData, KeyFrameData[] keyFrames, boolean root){
	FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
	float[] matrixData = new float[16];
	for(int i=0;i<keyFrames.length;i++){
		for(int j=0;j<16;j++){
			matrixData[j] = Float.parseFloat(rawData[i*16 + j]);
		}
		buffer.clear();
		buffer.put(matrixData);
		buffer.flip();
		Matrix4f transform = new Matrix4f();
		transform.load(buffer);
		transform.transpose();
		if(root){
			//because up axis in Blender is different to up axis in game
			Matrix4f.mul(CORRECTION, transform, transform);
		}
		keyFrames[i].addJointTransform(new JointTransformData(jointName, transform));
	}
}
 
开发者ID:TheThinMatrix,项目名称:OpenGL-Animation,代码行数:21,代码来源:AnimationLoader.java

示例2: getProjectionViewMatrix

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
@Override
public Matrix4f getProjectionViewMatrix() {
	if(reflected){
		return Matrix4f.mul(projectionMatrix, reflectedMatrix, null);
	}else{
		return Matrix4f.mul(projectionMatrix, viewMatrix, null);
	}
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:9,代码来源:Camera.java

示例3: extractMainJointData

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private JointData extractMainJointData(XmlNode jointNode, boolean isRoot){
	String nameId = jointNode.getAttribute("id");
	int index = boneOrder.indexOf(nameId);
	String[] matrixData = jointNode.getChild("matrix").getData().split(" ");
	Matrix4f matrix = new Matrix4f();
	matrix.load(convertData(matrixData));
	matrix.transpose();
	if(isRoot){
		//because in Blender z is up, but in our game y is up.
		Matrix4f.mul(CORRECTION, matrix, matrix);
	}
	jointCount++;
	return new JointData(index, nameId, matrix);
}
 
开发者ID:TheThinMatrix,项目名称:OpenGL-Animation,代码行数:15,代码来源:SkeletonLoader.java

示例4: getProjectionViewMatrix

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
@Override
public Matrix4f getProjectionViewMatrix() {
    if (reflected) {
        return Matrix4f.mul(projectionMatrix, reflectedMatrix, null);
    } else {
        return Matrix4f.mul(projectionMatrix, viewMatrix, null);
    }
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:9,代码来源:Camera.java

示例5: calculateMvpMatrix

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private Matrix4f calculateMvpMatrix(Sun sun, ICamera camera) {
	Matrix4f modelMatrix = new Matrix4f();
	Vector3f sunPos = sun.getWorldPosition(camera.getPosition());
	Matrix4f.translate(sunPos, modelMatrix, modelMatrix);
	Matrix4f modelViewMat = applyViewMatrix(modelMatrix, camera.getViewMatrix());
	Matrix4f.scale(new Vector3f(sun.getScale(), sun.getScale(), sun.getScale()), modelViewMat, modelViewMat);
	return Matrix4f.mul(camera.getProjectionMatrix(), modelViewMat, null);
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:9,代码来源:SunRenderer.java

示例6: applyViewMatrix

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
/**
 * Check the particle tutorial for explanations of this. Basically we remove
 * the rotation effect of the view matrix, so that the sun quad is always
 * facing the camera.
 * 
 * @param modelMatrix
 * @param viewMatrix
 * @return The model-view matrix.
 */
private Matrix4f applyViewMatrix(Matrix4f modelMatrix, Matrix4f viewMatrix) {
	modelMatrix.m00 = viewMatrix.m00;
	modelMatrix.m01 = viewMatrix.m10;
	modelMatrix.m02 = viewMatrix.m20;
	modelMatrix.m10 = viewMatrix.m01;
	modelMatrix.m11 = viewMatrix.m11;
	modelMatrix.m12 = viewMatrix.m21;
	modelMatrix.m20 = viewMatrix.m02;
	modelMatrix.m21 = viewMatrix.m12;
	modelMatrix.m22 = viewMatrix.m22;
	return Matrix4f.mul(viewMatrix, modelMatrix, null);
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:22,代码来源:SunRenderer.java

示例7: updateViewMatrix

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private void updateViewMatrix() {
	viewMatrix.setIdentity();
	Matrix4f.rotate((float) Math.toRadians(180), new Vector3f(0, 0, 1), viewMatrix, viewMatrix);
	Matrix4f.rotate((float) Math.toRadians(pitch), new Vector3f(1, 0, 0), viewMatrix, viewMatrix);
	Matrix4f.rotate((float) Math.toRadians(yaw), new Vector3f(0, 1, 0), viewMatrix, viewMatrix);
	Vector3f negativeCameraPos = new Vector3f(-center.x, -center.y, -center.z);
	Matrix4f.translate(negativeCameraPos, viewMatrix, viewMatrix);

	Matrix4f.mul(projectionMatrix, viewMatrix, projectionViewMatrix);
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:11,代码来源:CubeMapCamera.java

示例8: rotate

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
public static synchronized Matrix4f rotate(Matrix4f mat, Quat4 rot){
	rot.quatToMatrix4f(ROT_MAT);
	return Matrix4f.mul(mat, ROT_MAT, mat);
	//return rotateXYZ(mat, new Vec3f().set(rot));
}
 
开发者ID:LapisSea,项目名称:OpenGL-Bullet-engine,代码行数:6,代码来源:MatrixUtil.java

示例9: getProjectionViewMatrix

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
@Override
public Matrix4f getProjectionViewMatrix() {
	return Matrix4f.mul(projectionMatrix, viewMatrix, null);
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyTerrain,代码行数:5,代码来源:Camera.java

示例10: getProjectionViewMatrix

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
@Override
public Matrix4f getProjectionViewMatrix() {
	// TODO Auto-generated method stub
	return Matrix4f.mul(projectionMatrix, viewMatrix, null);
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:6,代码来源:Camera.java

示例11: applyPoseToJoints

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
/**
 * This is the method where the animator calculates and sets those all-
 * important "joint transforms" that I talked about so much in the tutorial.
 * 
 * This method applies the current pose to a given joint, and all of its
 * descendants. It does this by getting the desired local-transform for the
 * current joint, before applying it to the joint. Before applying the
 * transformations it needs to be converted from local-space to model-space
 * (so that they are relative to the model's origin, rather than relative to
 * the parent joint). This can be done by multiplying the local-transform of
 * the joint with the model-space transform of the parent joint.
 * 
 * The same thing is then done to all the child joints.
 * 
 * Finally the inverse of the joint's bind transform is multiplied with the
 * model-space transform of the joint. This basically "subtracts" the
 * joint's original bind (no animation applied) transform from the desired
 * pose transform. The result of this is then the transform required to move
 * the joint from its original model-space transform to it's desired
 * model-space posed transform. This is the transform that needs to be
 * loaded up to the vertex shader and used to transform the vertices into
 * the current pose.
 * 
 * @param currentPose
 *            - a map of the local-space transforms for all the joints for
 *            the desired pose. The map is indexed by the name of the joint
 *            which the transform corresponds to.
 * @param joint
 *            - the current joint which the pose should be applied to.
 * @param parentTransform
 *            - the desired model-space transform of the parent joint for
 *            the pose.
 */
private void applyPoseToJoints(Map<String,Matrix4f> currentPose, Joint joint, Matrix4f parentTransform){
	Matrix4f currentLocalTransform=currentPose.get(joint.name);
	Matrix4f currentTransform=Matrix4f.mul(parentTransform, currentLocalTransform, null);
	for(Joint childJoint:joint.children){
		applyPoseToJoints(currentPose, childJoint, currentTransform);
	}
	Matrix4f.mul(currentTransform, joint.getInverseBindTransform(), currentTransform);
	joint.setAnimationTransform(currentTransform);
}
 
开发者ID:LapisSea,项目名称:OpenGL-Bullet-engine,代码行数:43,代码来源:Animator.java

示例12: getLocalTransform

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
/**
 * In this method the bone-space transform matrix is constructed by
 * translating an identity matrix using the position variable and then
 * applying the rotation. The rotation is applied by first converting the
 * quaternion into a rotation matrix, which is then multiplied with the
 * transform matrix.
 * 
 * @return This bone-space joint transform as a matrix. The exact same
 *         transform as represented by the position and rotation in this
 *         instance, just in matrix form.
 */
protected Matrix4f getLocalTransform(){
	Matrix4f matrix=new Matrix4f();
	matrix.translate(position);
	Matrix4f.mul(matrix, rotation.toRotationMatrix(), matrix);
	return matrix;
}
 
开发者ID:LapisSea,项目名称:OpenGL-Bullet-engine,代码行数:18,代码来源:JointTransform.java

示例13: calcInverseBindTransform

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
/**
 * This is called during set-up, after the joints hierarchy has been
 * created. This calculates the model-space bind transform of this joint
 * like so: </br>
 * </br>
 * {@code bindTransform = parentBindTransform * localBindTransform}</br>
 * </br>
 * where "bindTransform" is the model-space bind transform of this joint,
 * "parentBindTransform" is the model-space bind transform of the parent
 * joint, and "localBindTransform" is the bone-space bind transform of this
 * joint. It then calculates and stores the inverse of this model-space bind
 * transform, for use when calculating the final animation transform each
 * frame. It then recursively calls the method for all of the children
 * joints, so that they too calculate and store their inverse bind-pose
 * transform.
 * 
 * @param parentBindTransform
 *            - the model-space bind transform of the parent joint.
 */
protected void calcInverseBindTransform(Matrix4f parentBindTransform){
	Matrix4f bindTransform=Matrix4f.mul(parentBindTransform, localBindTransform, null);
	Matrix4f.invert(bindTransform, inverseBindTransform);
	for(Joint child:children){
		child.calcInverseBindTransform(bindTransform);
	}
}
 
开发者ID:LapisSea,项目名称:OpenGL-Bullet-engine,代码行数:27,代码来源:Joint.java

示例14: applyPoseToJoints

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
/**
 * This is the method where the animator calculates and sets those all-
 * important "joint transforms" that I talked about so much in the tutorial.
 * 
 * This method applies the current pose to a given joint, and all of its
 * descendants. It does this by getting the desired local-transform for the
 * current joint, before applying it to the joint. Before applying the
 * transformations it needs to be converted from local-space to model-space
 * (so that they are relative to the model's origin, rather than relative to
 * the parent joint). This can be done by multiplying the local-transform of
 * the joint with the model-space transform of the parent joint.
 * 
 * The same thing is then done to all the child joints.
 * 
 * Finally the inverse of the joint's bind transform is multiplied with the
 * model-space transform of the joint. This basically "subtracts" the
 * joint's original bind (no animation applied) transform from the desired
 * pose transform. The result of this is then the transform required to move
 * the joint from its original model-space transform to it's desired
 * model-space posed transform. This is the transform that needs to be
 * loaded up to the vertex shader and used to transform the vertices into
 * the current pose.
 * 
 * @param currentPose
 *            - a map of the local-space transforms for all the joints for
 *            the desired pose. The map is indexed by the name of the joint
 *            which the transform corresponds to.
 * @param joint
 *            - the current joint which the pose should be applied to.
 * @param parentTransform
 *            - the desired model-space transform of the parent joint for
 *            the pose.
 */
private void applyPoseToJoints(Map<String, Matrix4f> currentPose, Joint joint, Matrix4f parentTransform) {
	Matrix4f currentLocalTransform = currentPose.get(joint.name);
	Matrix4f currentTransform = Matrix4f.mul(parentTransform, currentLocalTransform, null);
	for (Joint childJoint : joint.children) {
		applyPoseToJoints(currentPose, childJoint, currentTransform);
	}
	Matrix4f.mul(currentTransform, joint.getInverseBindTransform(), currentTransform);
	joint.setAnimationTransform(currentTransform);
}
 
开发者ID:TheThinMatrix,项目名称:OpenGL-Animation,代码行数:43,代码来源:Animator.java

示例15: getLocalTransform

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
/**
 * In this method the bone-space transform matrix is constructed by
 * translating an identity matrix using the position variable and then
 * applying the rotation. The rotation is applied by first converting the
 * quaternion into a rotation matrix, which is then multiplied with the
 * transform matrix.
 * 
 * @return This bone-space joint transform as a matrix. The exact same
 *         transform as represented by the position and rotation in this
 *         instance, just in matrix form.
 */
protected Matrix4f getLocalTransform() {
	Matrix4f matrix = new Matrix4f();
	matrix.translate(position);
	Matrix4f.mul(matrix, rotation.toRotationMatrix(), matrix);
	return matrix;
}
 
开发者ID:TheThinMatrix,项目名称:OpenGL-Animation,代码行数:18,代码来源:JointTransform.java


注:本文中的org.lwjgl.util.vector.Matrix4f.mul方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。