當前位置: 首頁>>代碼示例>>Java>>正文


Java Vector3f類代碼示例

本文整理匯總了Java中org.lwjgl.util.vector.Vector3f的典型用法代碼示例。如果您正苦於以下問題:Java Vector3f類的具體用法?Java Vector3f怎麽用?Java Vector3f使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Vector3f類屬於org.lwjgl.util.vector包,在下文中一共展示了Vector3f類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getViewVector

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
protected Vector3f getViewVector(Entity entityIn, double partialTicks)
{
    float f = (float)((double)entityIn.prevRotationPitch + (double)(entityIn.rotationPitch - entityIn.prevRotationPitch) * partialTicks);
    float f1 = (float)((double)entityIn.prevRotationYaw + (double)(entityIn.rotationYaw - entityIn.prevRotationYaw) * partialTicks);

    if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 2)
    {
        f += 180.0F;
    }

    float f2 = MathHelper.cos(-f1 * 0.017453292F - (float)Math.PI);
    float f3 = MathHelper.sin(-f1 * 0.017453292F - (float)Math.PI);
    float f4 = -MathHelper.cos(-f * 0.017453292F);
    float f5 = MathHelper.sin(-f * 0.017453292F);
    return new Vector3f(f3 * f4, f5, f2 * f4);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:17,代碼來源:RenderGlobal.java

示例2: parsePosition

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
private Vector3f parsePosition(JsonObject object, String memberName)
{
    JsonArray jsonarray = JsonUtils.getJsonArray(object, memberName);

    if (jsonarray.size() != 3)
    {
        throw new JsonParseException("Expected 3 " + memberName + " values, found: " + jsonarray.size());
    }
    else
    {
        float[] afloat = new float[3];

        for (int i = 0; i < afloat.length; ++i)
        {
            afloat[i] = JsonUtils.getFloat(jsonarray.get(i), memberName + "[" + i + "]");
        }

        return new Vector3f(afloat[0], afloat[1], afloat[2]);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:BlockPart.java

示例3: parseRotation

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
private BlockPartRotation parseRotation(JsonObject p_178256_1_)
{
    BlockPartRotation blockpartrotation = null;

    if (p_178256_1_.has("rotation"))
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(p_178256_1_, "rotation");
        Vector3f vector3f = this.parsePosition(jsonobject, "origin");
        vector3f.scale(0.0625F);
        EnumFacing.Axis enumfacing$axis = this.parseAxis(jsonobject);
        float f = this.parseAngle(jsonobject);
        boolean flag = JsonUtils.getBoolean(jsonobject, "rescale", false);
        blockpartrotation = new BlockPartRotation(vector3f, enumfacing$axis, f, flag);
    }

    return blockpartrotation;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:18,代碼來源:BlockPart.java

示例4: makeBakedQuad

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade)
{
    int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade);
    EnumFacing enumfacing = getFacingFromVertexData(aint);

    if (uvLocked)
    {
        this.func_178409_a(aint, enumfacing, face.blockFaceUV, sprite);
    }

    if (partRotation == null)
    {
        this.func_178408_a(aint, enumfacing);
    }

    return new BakedQuad(aint, face.tintIndex, enumfacing);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:18,代碼來源:FaceBakery.java

示例5: deserialize

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
public BlockPart deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = p_deserialize_1_.getAsJsonObject();
    Vector3f vector3f = this.parsePositionFrom(jsonobject);
    Vector3f vector3f1 = this.parsePositionTo(jsonobject);
    BlockPartRotation blockpartrotation = this.parseRotation(jsonobject);
    Map<EnumFacing, BlockPartFace> map = this.parseFacesCheck(p_deserialize_3_, jsonobject);

    if (jsonobject.has("shade") && !JsonUtils.isBoolean(jsonobject, "shade"))
    {
        throw new JsonParseException("Expected shade to be a Boolean");
    }
    else
    {
        boolean flag = JsonUtils.getBoolean(jsonobject, "shade", true);
        return new BlockPart(vector3f, vector3f1, map, blockpartrotation, flag);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:BlockPart.java

示例6: convertDataToArrays

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
private static float convertDataToArrays(List<Vertex> vertices, List<Vector2f> textures,
		List<Vector3f> normals, float[] verticesArray, float[] texturesArray,
		float[] normalsArray) {
	float furthestPoint = 0;
	for (int i = 0; i < vertices.size(); i++) {
		Vertex currentVertex = vertices.get(i);
		if (currentVertex.getLength() > furthestPoint) {
			furthestPoint = currentVertex.getLength();
		}
		Vector3f position = currentVertex.getPosition();
		Vector2f textureCoord = textures.get(currentVertex.getTextureIndex());
		Vector3f normalVector = normals.get(currentVertex.getNormalIndex());
		verticesArray[i * 3] = position.x;
		verticesArray[i * 3 + 1] = position.y;
		verticesArray[i * 3 + 2] = position.z;
		texturesArray[i * 2] = textureCoord.x;
		texturesArray[i * 2 + 1] = 1 - textureCoord.y;
		normalsArray[i * 3] = normalVector.x;
		normalsArray[i * 3 + 1] = normalVector.y;
		normalsArray[i * 3 + 2] = normalVector.z;
	}
	return furthestPoint;
}
 
開發者ID:marcioz98,項目名稱:MRCEngine,代碼行數:24,代碼來源:OBJFileLoader.java

示例7: makeBakedQuad

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade)
{
    int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade);
    EnumFacing enumfacing = getFacingFromVertexData(aint);

    if (uvLocked)
    {
        this.func_178409_a(aint, enumfacing, face.blockFaceUV, sprite);
    }

    if (partRotation == null)
    {
        this.func_178408_a(aint, enumfacing);
    }

    return new BakedQuad(aint, face.tintIndex, enumfacing, sprite);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:18,代碼來源:FaceBakery.java

示例8: parsePosition

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
private Vector3f parsePosition(JsonObject p_178251_1_, String p_178251_2_)
{
    JsonArray jsonarray = JsonUtils.getJsonArray(p_178251_1_, p_178251_2_);

    if (jsonarray.size() != 3)
    {
        throw new JsonParseException("Expected 3 " + p_178251_2_ + " values, found: " + jsonarray.size());
    }
    else
    {
        float[] afloat = new float[3];

        for (int i = 0; i < afloat.length; ++i)
        {
            afloat[i] = JsonUtils.getFloat(jsonarray.get(i), p_178251_2_ + "[" + i + "]");
        }

        return new Vector3f(afloat[0], afloat[1], afloat[2]);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:21,代碼來源:BlockPart.java

示例9: sub

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
public static Colour sub(Colour colLeft, Colour colRight, Colour dest) {
	if (dest == null) {
		return new Colour(Vector3f.sub(colLeft.col, colRight.col, null));
	} else {
		Vector3f.sub(colLeft.col, colRight.col, dest.col);
		return dest;
	}
}
 
開發者ID:TheThinMatrix,項目名稱:LowPolyWater,代碼行數:9,代碼來源:Colour.java

示例10: createViewMatrix

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
public static Matrix4f createViewMatrix(Camera camera) {
	Matrix4f viewMatrix = new Matrix4f();
	viewMatrix.setIdentity();
	Matrix4f.rotate((float) Math.toRadians(camera.getPitch()), new Vector3f(1, 0, 0), viewMatrix, viewMatrix);
	Matrix4f.rotate((float) Math.toRadians(camera.getYaw()), new Vector3f(0, 1, 0), viewMatrix, viewMatrix);
	Vector3f cameraPos = camera.getPosition();
	Vector3f negativeCameraPos = new Vector3f(-cameraPos.x, -cameraPos.y, -cameraPos.z);
	Matrix4f.translate(negativeCameraPos, viewMatrix, viewMatrix);
	return viewMatrix;
}
 
開發者ID:DevipriyaSarkar,項目名稱:Terrain,代碼行數:11,代碼來源:Maths.java

示例11: processVertex

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
private static void processVertex(String[] vertexData, List<Integer> indices, List<Vector2f> textures, 
		List<Vector3f> normals, float[] textureArray, float[] normalsArray) {
	int currentVertexPointer = Integer.parseInt(vertexData[0]) - 1;	// obj file starts index at 1 and not 0
	indices.add(currentVertexPointer);
	Vector2f currentTex = textures.get(Integer.parseInt(vertexData[1]) - 1);
	textureArray[currentVertexPointer * 2] = currentTex.x;
	textureArray[currentVertexPointer * 2 + 1] = 1 - currentTex.y;	// OpenGL starts at top left and blender at bottom left
	Vector3f currentNorm = normals.get(Integer.parseInt(vertexData[2]) - 1);
	normalsArray[currentVertexPointer * 3] = currentNorm.x;
	normalsArray[currentVertexPointer * 3 + 1] = currentNorm.y;
	normalsArray[currentVertexPointer * 3 + 2] = currentNorm.z;
}
 
開發者ID:DevipriyaSarkar,項目名稱:Terrain,代碼行數:13,代碼來源:OBJLoader.java

示例12: parsePositionTo

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
private Vector3f parsePositionTo(JsonObject object)
{
    Vector3f vector3f = this.parsePosition(object, "to");

    if (vector3f.x >= -16.0F && vector3f.y >= -16.0F && vector3f.z >= -16.0F && vector3f.x <= 32.0F && vector3f.y <= 32.0F && vector3f.z <= 32.0F)
    {
        return vector3f;
    }
    else
    {
        throw new JsonParseException("\'to\' specifier exceeds the allowed boundaries: " + vector3f);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:14,代碼來源:BlockPart.java

示例13: func_178394_a

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
private List<BlockPart> func_178394_a(int p_178394_1_, String p_178394_2_, TextureAtlasSprite p_178394_3_)
{
    Map<EnumFacing, BlockPartFace> map = Maps.<EnumFacing, BlockPartFace>newHashMap();
    map.put(EnumFacing.SOUTH, new BlockPartFace((EnumFacing)null, p_178394_1_, p_178394_2_, new BlockFaceUV(new float[] {0.0F, 0.0F, 16.0F, 16.0F}, 0)));
    map.put(EnumFacing.NORTH, new BlockPartFace((EnumFacing)null, p_178394_1_, p_178394_2_, new BlockFaceUV(new float[] {16.0F, 0.0F, 0.0F, 16.0F}, 0)));
    List<BlockPart> list = Lists.<BlockPart>newArrayList();
    list.add(new BlockPart(new Vector3f(0.0F, 0.0F, 7.5F), new Vector3f(16.0F, 16.0F, 8.5F), map, (BlockPartRotation)null, true));
    list.addAll(this.func_178397_a(p_178394_3_, p_178394_2_, p_178394_1_));
    return list;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:11,代碼來源:ItemModelGenerator.java

示例14: rotateScale

import org.lwjgl.util.vector.Vector3f; //導入依賴的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:SkidJava,項目名稱:BaseClient,代碼行數:10,代碼來源:FaceBakery.java

示例15: bakeGeometry

import org.lwjgl.util.vector.Vector3f; //導入依賴的package包/類
public void bakeGeometry(List<Vector3f> faces, List<Vector3f> vertexData, List<Vector2f> uvData, List<Vector3f> normalData)
{
	for (Vector3f faceData : faces)
	{
		int vertexIndex = (int) (faceData.getX() - 1);
		int uvIndex = (int) (faceData.getY() - 1);
		int normalIndex = (int) (faceData.getZ() - 1);
		this.vertices.add(new Vertex(vertexData.get(vertexIndex), uvData.get(uvIndex), normalData.get(normalIndex)));
	}
}
 
開發者ID:V0idWa1k3r,項目名稱:VoidApi,代碼行數:11,代碼來源:WavefrontObject.java


注:本文中的org.lwjgl.util.vector.Vector3f類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。