当前位置: 首页>>代码示例>>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;未经允许,请勿转载。