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


Java Matrix4f.transform方法代码示例

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


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

示例1: update

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
public void update(){
		viewDistance.update();
		prevPos.set(pos);
		
		MOVE.set(0, 0, 0);
		if(Keyboard.isKeyDown(Keyboard.KEY_D)) MOVE.addX(1);
		if(Keyboard.isKeyDown(Keyboard.KEY_A)) MOVE.addX(-1);
		
		if(Keyboard.isKeyDown(Keyboard.KEY_SPACE)) MOVE.addY(1);
		if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) MOVE.addY(-1);
		
		if(Keyboard.isKeyDown(Keyboard.KEY_S)) MOVE.addZ(1);
		if(Keyboard.isKeyDown(Keyboard.KEY_W)) MOVE.addZ(-1);
		
		Vector4f vec4=new Vector4f(MOVE.x, MOVE.y, MOVE.z, 1);
		Matrix4f mat=new Matrix4f();
		EFF_POS.set(rot).mul(-1);
		EFF_POS.x=0;
		MatrixUtil.rotate(mat, EFF_POS);
		
		Matrix4f.transform(mat, vec4, vec4);
		MOVE.x=vec4.x;
		MOVE.y=vec4.y;
		MOVE.z=vec4.z;
//		MOVE.mul(100);
//		if(EntityCrazyCube.CAM!=null&&false){
//			pos.set(EntityCrazyCube.CAM.pos);
//		}else
		pos.add(MOVE);
		viewDistance.setValue((viewDistance.getValue()+viewDistanceWanted)/2);
	}
 
开发者ID:LapisSea,项目名称:OpenGL-Bullet-engine,代码行数:32,代码来源:Camera.java

示例2: rotateScale

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private void rotateScale(Vector3f position, Vector3f rotationOrigin, Matrix4f rotationMatrix, Vector3f scale)
{
    Vector4f vector4f = new Vector4f(position.x - rotationOrigin.x, position.y - rotationOrigin.y, position.z - rotationOrigin.z, 1.0F);
    Matrix4f.transform(rotationMatrix, vector4f, vector4f);
    vector4f.x *= scale.x;
    vector4f.y *= scale.y;
    vector4f.z *= scale.z;
    position.set(vector4f.x + rotationOrigin.x, vector4f.y + rotationOrigin.y, vector4f.z + rotationOrigin.z);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:10,代码来源:FaceBakery.java

示例3: toWorldCoords

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private Vector3f toWorldCoords(Vector4f eyeCoords) {
	Matrix4f invertedView = Matrix4f.invert(viewMatrix, null);
	Vector4f rayWorld = Matrix4f.transform(invertedView, eyeCoords, null);
	Vector3f mouseRay = new Vector3f(rayWorld.x, rayWorld.y, rayWorld.z);
	mouseRay.normalise();
	return mouseRay;
}
 
开发者ID:Essentria,项目名称:Elgin-Plant-Game,代码行数:8,代码来源:MousePicker.java

示例4: readPositions

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private void readPositions() {
	String positionsId = meshData.getChild("vertices").getChild("input").getAttribute("source").substring(1);
	XmlNode positionsData = meshData.getChildWithAttribute("source", "id", positionsId).getChild("float_array");
	int count = Integer.parseInt(positionsData.getAttribute("count"));
	String[] posData = positionsData.getData().split(" ");
	for (int i = 0; i < count/3; i++) {
		float x = Float.parseFloat(posData[i * 3]);
		float y = Float.parseFloat(posData[i * 3 + 1]);
		float z = Float.parseFloat(posData[i * 3 + 2]);
		Vector4f position = new Vector4f(x, y, z, 1);
		Matrix4f.transform(CORRECTION, position, position);
		vertices.add(new Vertex(vertices.size(), new Vector3f(position.x, position.y, position.z), vertexWeights.get(vertices.size())));
	}
}
 
开发者ID:TheThinMatrix,项目名称:OpenGL-Animation,代码行数:15,代码来源:GeometryLoader.java

示例5: readNormals

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private void readNormals() {
	String normalsId = meshData.getChild("polylist").getChildWithAttribute("input", "semantic", "NORMAL")
			.getAttribute("source").substring(1);
	XmlNode normalsData = meshData.getChildWithAttribute("source", "id", normalsId).getChild("float_array");
	int count = Integer.parseInt(normalsData.getAttribute("count"));
	String[] normData = normalsData.getData().split(" ");
	for (int i = 0; i < count/3; i++) {
		float x = Float.parseFloat(normData[i * 3]);
		float y = Float.parseFloat(normData[i * 3 + 1]);
		float z = Float.parseFloat(normData[i * 3 + 2]);
		Vector4f norm = new Vector4f(x, y, z, 0f);
		Matrix4f.transform(CORRECTION, norm, norm);
		normals.add(new Vector3f(norm.x, norm.y, norm.z));
	}
}
 
开发者ID:TheThinMatrix,项目名称:OpenGL-Animation,代码行数:16,代码来源:GeometryLoader.java

示例6: convertToScreenSpace

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private Vector2f convertToScreenSpace(Vector3f worldPos, Matrix4f viewMat, Matrix4f projectionMat) {
	Vector4f coords = new Vector4f(worldPos.x, worldPos.y, worldPos.z, 1f);
	Matrix4f.transform(viewMat, coords, coords);
	Matrix4f.transform(projectionMat, coords, coords);
	if (coords.w <= 0) {
		return null;
	}
	//no need for conversion below
	return new Vector2f(coords.x / coords.w, coords.y / coords.w);
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:11,代码来源:FlareManager.java

示例7: toEyeCoords

import org.lwjgl.util.vector.Matrix4f; //导入方法依赖的package包/类
private Vector4f toEyeCoords(Vector4f clipCoords) {
	Matrix4f invertedProjection = Matrix4f.invert(projectionMatrix, null);
	Vector4f eyeCoords = Matrix4f.transform(invertedProjection, clipCoords, null);
	return new Vector4f(eyeCoords.x, eyeCoords.y, -1f, 0f);
}
 
开发者ID:Essentria,项目名称:Elgin-Plant-Game,代码行数:6,代码来源:MousePicker.java


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