• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Tuple4f类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.vecmath.Tuple4f的典型用法代码示例。如果您正苦于以下问题:Java Tuple4f类的具体用法?Java Tuple4f怎么用?Java Tuple4f使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: createVertexBuffer

import javax.vecmath.Tuple4f; //导入依赖的package包/类
static short createVertexBuffer(ByteBuffer buffer, BGFXVertexDecl decl, Object[]... vertices) {
	for (Object[] objects : vertices) {
		for (Object object : objects) {
			if (object instanceof Tuple2f)
				buffer.putFloat(((Tuple2f) object).getX()).putFloat(((Tuple2f) object).getY());
			else if (object instanceof Tuple3f)
				buffer.putFloat(((Tuple3f) object).getX()).putFloat(((Tuple3f) object).getY()).putFloat(((Tuple3f) object).getZ());
			else if (object instanceof Tuple4f)
				buffer.putFloat(((Tuple4f) object).getX()).putFloat(((Tuple4f) object).getY()).putFloat(((Tuple4f) object).getZ()).putFloat(((Tuple4f) object).getW());
			else if (object instanceof Integer)
				buffer.putInt(((int) object));
			else
				throw new IllegalArgumentException("Unknown type of vertex: " + object.getClass().getName() + ", valid type are:" +
					"javax.vecmath.Tuple2f/3f/4f & java.lang.Integer");
		}
	}

	if (buffer.remaining() != 0) {
		throw new RuntimeException("ByteBuffer size and number of arguments do not match");
	}

	buffer.flip();

	return createVertexBuffer(buffer, decl);
}
 
开发者ID:HuajiStudio,项目名称:ChessMaster,代码行数:26,代码来源:RenderUtil.java


示例2: putIntoBakedQuadBuilder

import javax.vecmath.Tuple4f; //导入依赖的package包/类
public void putIntoBakedQuadBuilder(UnpackedBakedQuad.Builder builder, TextureAtlasSprite sprite) {
	Vertex transformed = getTransformedVertex();
	Tuple4f positionBuffer = new Vector4f();
	transformed.getPosition(positionBuffer);
	Tuple3f normalBuffer = new Vector3f();
	transformed.getNormal(normalBuffer);
	Tuple2f uvBuffer = new Vector2f();
	transformed.getUV(uvBuffer);

	VertexFormat vertexFormat = builder.getVertexFormat();
	int elementCount = vertexFormat.getElementCount();
	for (int e = 0; e < elementCount; e++) {
		VertexFormatElement element = vertexFormat.getElement(e);
		switch (element.getUsage()) {
		case POSITION:
			builder.put(e, positionBuffer.x, positionBuffer.z, -positionBuffer.y, positionBuffer.w);
			break;
		case NORMAL:
			builder.put(e, normalBuffer.x, normalBuffer.z, -normalBuffer.y, 0);
			break;
		case UV:
			if (element.getIndex() != 0)
				break;
			builder.put(
					e,
					sprite.getInterpolatedU(uvBuffer.x * 16),
					sprite.getInterpolatedV(uvBuffer.y * 16),
					0,
					1);
			break;
		case COLOR:
			builder.put(e, 1, 1, 1, 1);
			break;
		default:
			builder.put(e);
		}
	}
}
 
开发者ID:WorldSEnder,项目名称:MCAnm,代码行数:39,代码来源:Point.java


示例3: toFloatArray4

import javax.vecmath.Tuple4f; //导入依赖的package包/类
public static <T extends Tuple4f> float[] toFloatArray4(Collection<T> tuples, float[] buffer) {
	if (buffer == null) {
		buffer = new float[tuples.size() * 4];
	}
	int d = 0;
	for (final T tuple : tuples) {
		buffer[d++] = tuple.x;
		buffer[d++] = tuple.y;
		buffer[d++] = tuple.z;
		buffer[d++] = tuple.w;
	}
	return buffer;
}
 
开发者ID:jedwards1211,项目名称:breakout,代码行数:14,代码来源:VecmathUtils.java


示例4: assertEquals

import javax.vecmath.Tuple4f; //导入依赖的package包/类
public static void assertEquals(Tuple4f expected, Tuple4f actual, float error) {
    if (expected == null) {
        assertNull(actual);
    } else {
        assertNotNull(actual);
        String errorMessage = "Expected " + expected + ", actual" + actual;
        org.junit.Assert.assertEquals(errorMessage, expected.x, actual.x, error);
        org.junit.Assert.assertEquals(errorMessage, expected.y, actual.y, error);
        org.junit.Assert.assertEquals(errorMessage, expected.z, actual.z, error);
        org.junit.Assert.assertEquals(errorMessage, expected.w, actual.w, error);
    }
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:13,代码来源:TeraAssert.java


示例5: set

import javax.vecmath.Tuple4f; //导入依赖的package包/类
/**
 * Sets the value of this vector to the values in tuple.
 *
 * @param tuple
 *            the source for the new GVector's new values
 */
public final void set(Tuple4f tuple) {
	elementData[0] = (float) tuple.x;
	elementData[1] = (float) tuple.y;
	elementData[2] = (float) tuple.z;
	elementData[3] = (float) tuple.w;
}
 
开发者ID:asura-fit,项目名称:asura-j,代码行数:13,代码来源:GfVector.java


示例6: toFloatArray

import javax.vecmath.Tuple4f; //导入依赖的package包/类
static float[] toFloatArray(Tuple4f tuple4f) {
	return new float[]{tuple4f.getX(), tuple4f.getY(), tuple4f.getZ(), tuple4f.getW()};
}
 
开发者ID:HuajiStudio,项目名称:ChessMaster,代码行数:4,代码来源:RenderUtil.java


示例7: lerp

import javax.vecmath.Tuple4f; //导入依赖的package包/类
public static Vector4f lerp(Tuple4f from, Tuple4f to, float progress)
{
    Vector4f res = new Vector4f(from);
    res.interpolate(from, to, progress);
    return res;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:7,代码来源:TRSRTransformation.java


示例8: Vertex

import javax.vecmath.Tuple4f; //导入依赖的package包/类
public Vertex(Tuple4f pos, Tuple3f norm, Tuple2f uv) {
	this.pos = new Point4f(pos);
	this.norm = new Vector3f(norm);
	this.uv = new Point2f(uv);
}
 
开发者ID:WorldSEnder,项目名称:MCAnm,代码行数:6,代码来源:Vertex.java


示例9: getPosition

import javax.vecmath.Tuple4f; //导入依赖的package包/类
/**
 * Stores this vertex's position in the target.
 */
public void getPosition(Tuple4f trgt) {
	trgt.set(this.pos);
}
 
开发者ID:WorldSEnder,项目名称:MCAnm,代码行数:7,代码来源:Vertex.java


示例10: GfVector

import javax.vecmath.Tuple4f; //导入依赖的package包/类
/**
 * Constructs a new GVector and copies the initial values from the Tuple
 *
 * @param vector
 *            the source for the new GVector's initial values
 */
public GfVector(Tuple4f tuple) {
	this(4);
	set(tuple);
}
 
开发者ID:asura-fit,项目名称:asura-j,代码行数:11,代码来源:GfVector.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SSLFilter类代码示例发布时间:2022-05-23
下一篇:
Java Base64Variant类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap