本文整理汇总了Java中org.lwjgl.util.vector.Vector3f.add方法的典型用法代码示例。如果您正苦于以下问题:Java Vector3f.add方法的具体用法?Java Vector3f.add怎么用?Java Vector3f.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.util.vector.Vector3f
的用法示例。
在下文中一共展示了Vector3f.add方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: averageNormals
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
/**
* Computes the average of the normals supplied.
* @param normals The normals, located at the same position, that should be averaged
*/
private Vector3f averageNormals(Vector3f[] normals) {
Vector3f sum = new Vector3f();
for(int i = 0; i < normals.length; i++) {
if(normals[i] != null) {
Vector3f.add(sum, normals[i], sum);
}
}
sum.normalise();
return sum;
}
示例2: move
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
/**
* Moves the camera in the specified direction by the specified distance
* @param direction The direction to move in world space
* @param distance The distance to move in world space
*/
public void move(Vector3f direction, float distance) {
// Create a copy of the direction to avoid modifying the original TODO: fix temp
Vector3f deltaMovement = new Vector3f(direction);
// Scale the direction to be the length of the specified distance
deltaMovement.normalise();
deltaMovement.scale(distance);
// Add the movement to the camera's position
Vector3f.add(position, deltaMovement, position);
}
示例3: add
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
public static Colour add(Colour colour1, Colour colour2, Colour dest) {
if (dest == null) {
return new Colour(Vector3f.add(colour1.col, colour2.col, null));
} else {
Vector3f.add(colour1.col, colour2.col, dest.col);
return dest;
}
}
示例4: averageTangents
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
public void averageTangents(){
if(tangents.isEmpty()){
return;
}
for(Vector3f tangent : tangents){
Vector3f.add(averagedTangent, tangent, averagedTangent);
}
averagedTangent.normalise();
}
示例5: add
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
public static Colour add(Colour colour1, Colour colour2, Colour dest) {
if (dest == null) {
return new Colour(Vector3f.add(colour1.col, colour2.col, null));
} else {
Vector3f.add(colour1.col, colour2.col, dest.col);
return dest;
}
}
示例6: translate
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
public void translate(Vector3f translationVector){
for (Vertex vertex : vertices){
Vector3f.add(vertex.position, translationVector, vertex.position);
}
}
示例7: func_178407_a
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
private void func_178407_a(Vector3f p_178407_1_, BlockPartRotation partRotation)
{
if (partRotation != null)
{
Matrix4f matrix4f = this.getMatrixIdentity();
Vector3f vector3f = new Vector3f(0.0F, 0.0F, 0.0F);
switch (partRotation.axis)
{
case X:
Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), matrix4f, matrix4f);
vector3f.set(0.0F, 1.0F, 1.0F);
break;
case Y:
Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), matrix4f, matrix4f);
vector3f.set(1.0F, 0.0F, 1.0F);
break;
case Z:
Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), matrix4f, matrix4f);
vector3f.set(1.0F, 1.0F, 0.0F);
}
if (partRotation.rescale)
{
if (Math.abs(partRotation.angle) == 22.5F)
{
vector3f.scale(field_178418_a);
}
else
{
vector3f.scale(field_178417_b);
}
Vector3f.add(vector3f, new Vector3f(1.0F, 1.0F, 1.0F), vector3f);
}
else
{
vector3f.set(1.0F, 1.0F, 1.0F);
}
this.rotateScale(p_178407_1_, new Vector3f(partRotation.origin), matrix4f, vector3f);
}
}
示例8: getPointOnRay
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
private Vector3f getPointOnRay(Vector3f ray, float distance) {
Vector3f camPos = camera.getPosition();
Vector3f start = new Vector3f(camPos.x, camPos.y, camPos.z);
Vector3f scaledRay = new Vector3f(ray.x * distance, ray.y * distance, ray.z * distance);
return Vector3f.add(start, scaledRay, null);
}
示例9: getPointOnRay
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
public Vector3f getPointOnRay(float distance) {
Vector3f scaledRay = new Vector3f(direction.x * distance, direction.y * distance, direction.z * distance);
return Vector3f.add(origin, scaledRay, null);
}
示例10: func_178407_a
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
private void func_178407_a(Vector3f p_178407_1_, BlockPartRotation partRotation)
{
if (partRotation != null)
{
Matrix4f matrix4f = this.getMatrixIdentity();
Vector3f vector3f = new Vector3f(0.0F, 0.0F, 0.0F);
switch (FaceBakery.FaceBakery$1.field_178399_b[partRotation.axis.ordinal()])
{
case 1:
Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), matrix4f, matrix4f);
vector3f.set(0.0F, 1.0F, 1.0F);
break;
case 2:
Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), matrix4f, matrix4f);
vector3f.set(1.0F, 0.0F, 1.0F);
break;
case 3:
Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), matrix4f, matrix4f);
vector3f.set(1.0F, 1.0F, 0.0F);
}
if (partRotation.rescale)
{
if (Math.abs(partRotation.angle) == 22.5F)
{
vector3f.scale(field_178418_a);
}
else
{
vector3f.scale(field_178417_b);
}
Vector3f.add(vector3f, new Vector3f(1.0F, 1.0F, 1.0F), vector3f);
}
else
{
vector3f.set(1.0F, 1.0F, 1.0F);
}
this.rotateScale(p_178407_1_, new Vector3f(partRotation.origin), matrix4f, vector3f);
}
}
示例11: rotatePart
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
private void rotatePart(Vector3f p_178407_1_, @Nullable BlockPartRotation partRotation)
{
if (partRotation != null)
{
Matrix4f matrix4f = this.getMatrixIdentity();
Vector3f vector3f = new Vector3f(0.0F, 0.0F, 0.0F);
switch (partRotation.axis)
{
case X:
Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), matrix4f, matrix4f);
vector3f.set(0.0F, 1.0F, 1.0F);
break;
case Y:
Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), matrix4f, matrix4f);
vector3f.set(1.0F, 0.0F, 1.0F);
break;
case Z:
Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), matrix4f, matrix4f);
vector3f.set(1.0F, 1.0F, 0.0F);
}
if (partRotation.rescale)
{
if (Math.abs(partRotation.angle) == 22.5F)
{
vector3f.scale(SCALE_ROTATION_22_5);
}
else
{
vector3f.scale(SCALE_ROTATION_GENERAL);
}
Vector3f.add(vector3f, new Vector3f(1.0F, 1.0F, 1.0F), vector3f);
}
else
{
vector3f.set(1.0F, 1.0F, 1.0F);
}
this.rotateScale(p_178407_1_, new Vector3f(partRotation.origin), matrix4f, vector3f);
}
}
示例12: rotatePart
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
private void rotatePart(Vector3f p_178407_1_, @Nullable BlockPartRotation partRotation)
{
if (partRotation != null)
{
Matrix4f matrix4f = this.getMatrixIdentity();
Vector3f vector3f = new Vector3f(0.0F, 0.0F, 0.0F);
switch (partRotation.axis)
{
case X:
Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(1.0F, 0.0F, 0.0F), matrix4f, matrix4f);
vector3f.set(0.0F, 1.0F, 1.0F);
break;
case Y:
Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(0.0F, 1.0F, 0.0F), matrix4f, matrix4f);
vector3f.set(1.0F, 0.0F, 1.0F);
break;
case Z:
Matrix4f.rotate(partRotation.angle * 0.017453292F, new Vector3f(0.0F, 0.0F, 1.0F), matrix4f, matrix4f);
vector3f.set(1.0F, 1.0F, 0.0F);
}
if (partRotation.rescale)
{
if (Math.abs(partRotation.angle) == 22.5F)
{
vector3f.scale(SCALE_ROTATION_22_5);
}
else
{
vector3f.scale(SCALE_ROTATION_GENERAL);
}
Vector3f.add(vector3f, new Vector3f(1.0F, 1.0F, 1.0F), vector3f);
}
else
{
vector3f.set(1.0F, 1.0F, 1.0F);
}
this.rotateScale(p_178407_1_, new Vector3f(partRotation.origin), matrix4f, vector3f);
}
}
示例13: getWorldPosition
import org.lwjgl.util.vector.Vector3f; //导入方法依赖的package包/类
/**
* Calculates a position for the sun, based on the light direction. The
* distance of the sun from the camera is fairly arbitrary, although care
* should be taken to ensure it doesn't get rendered outside the skybox.
*
* @param camPos - The camera's position.
* @return The 3D world position of the sun.
*/
public Vector3f getWorldPosition(Vector3f camPos) {
Vector3f sunPos = new Vector3f(lightDirection);
sunPos.negate();
sunPos.scale(SUN_DIS);
return Vector3f.add(camPos, sunPos, null);
}