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


Java Vector3f.add方法代码示例

本文整理汇总了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;
   }
 
开发者ID:camilne,项目名称:open-world,代码行数:15,代码来源:Region.java

示例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);
   }
 
开发者ID:camilne,项目名称:open-world,代码行数:17,代码来源:Camera.java

示例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;
	}
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:9,代码来源:Colour.java

示例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();
}
 
开发者ID:TheThinMatrix,项目名称:OpenGL-Animation,代码行数:10,代码来源:Vertex.java

示例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;
    }
}
 
开发者ID:GryPLOfficial,项目名称:EcoSystem-Official,代码行数:9,代码来源:Colour.java

示例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);
	}
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:6,代码来源:Shape.java

示例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);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:46,代码来源:FaceBakery.java

示例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);
}
 
开发者ID:Essentria,项目名称:Elgin-Plant-Game,代码行数:7,代码来源:MousePicker.java

示例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);
}
 
开发者ID:Essentria,项目名称:Elgin-Plant-Game,代码行数:5,代码来源:Ray.java

示例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);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:46,代码来源:FaceBakery.java

示例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);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:46,代码来源:FaceBakery.java

示例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);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:44,代码来源:FaceBakery.java

示例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);
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:15,代码来源:Sun.java


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