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

Java Matrix3f类代码示例

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

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



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

示例1: init

import org.joml.Matrix3f; //导入依赖的package包/类
@Override
public boolean init()
{
    if (!initDisplay())
        return false;
    this.texCoordTransform = new Matrix3f();
    this.model = new Matrix4f();
    this.initVBO();
    try
    {
        this.initShaderProgram(new ShaderProgram(IOUtils.inToStr(this.getClass().getResourceAsStream("/assets/opengb/shaders/base.vert")), IOUtils.inToStr(this.getClass().getResourceAsStream("/assets/opengb/shaders/base.frag"))));
    } catch (IOException e)
    {
        throw new RuntimeException(e); // This shouldn't be possible
    }
    texture = new Texture();
    texture.create(Constants.SCREEN_W, Constants.SCREEN_H, screenBuffer);
    glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    return true;
}
 
开发者ID:Thog,项目名称:OpenGB,代码行数:23,代码来源:Screen.java


示例2: testObObTipToTip

import org.joml.Matrix3f; //导入依赖的package包/类
public static void testObObTipToTip() {
    Vector3f c0 = new Vector3f();
    float EPSILON = 1E-4f;
    /* Position the second box so that they "almost" intersect */
    float a = (float) Math.sqrt(1 + 1) + (float) Math.sqrt(1 + 1);
    Vector3f c1 = new Vector3f(a + EPSILON, 0, 0);
    Matrix3f m = new Matrix3f().rotateXYZ(0, (float) Math.toRadians(45.0), 0);
    Vector3f ux0 = m.getColumn(0, new Vector3f());
    Vector3f uy0 = m.getColumn(1, new Vector3f());
    Vector3f uz0 = m.getColumn(2, new Vector3f());
    Vector3f ux1 = m.getColumn(0, new Vector3f());
    Vector3f uy1 = m.getColumn(1, new Vector3f());
    Vector3f uz1 = m.getColumn(2, new Vector3f());
    Vector3f hs = new Vector3f(1);
    boolean intersects = Intersectionf.testObOb(c0, ux0, uy0, uz0, hs, c1, ux1, uy1, uz1, hs);
    assertFalse(intersects); // <- they do not intersect
    /* Position the second box so that they do intersect */
    c1 = new Vector3f((float) Math.sqrt(2) * 2 - EPSILON, 0, 0);
    intersects = Intersectionf.testObOb(c0, ux0, uy0, uz0, hs, c1, ux1, uy1, uz1, hs);
    assertTrue(intersects); // <- they do intersect
}
 
开发者ID:JOML-CI,项目名称:JOML,代码行数:22,代码来源:IntersectionfTest.java


示例3: testObOb

import org.joml.Matrix3f; //导入依赖的package包/类
public static void testObOb() {
    float a = (float) (Math.sqrt(2.0*2.0 + 2.0*2.0) + Math.sqrt(0.5*0.5 + 0.5*0.5));
    float EPSILON = 1E-4f;
    Vector3f c0 = new Vector3f(0, 0, a - EPSILON);
    Vector3f hs0 = new Vector3f(0.5f, 0.5f, 0.5f);
    Vector3f c1 = new Vector3f(0, 0, 0);
    Vector3f hs1 = new Vector3f(2, 0.5f, 2);
    Matrix3f m = new Matrix3f().rotateY((float) Math.toRadians(45));
    Vector3f ux0 = m.getColumn(0, new Vector3f());
    Vector3f uy0 = m.getColumn(1, new Vector3f());
    Vector3f uz0 = m.getColumn(2, new Vector3f());
    Vector3f ux1 = m.getColumn(0, new Vector3f());
    Vector3f uy1 = m.getColumn(1, new Vector3f());
    Vector3f uz1 = m.getColumn(2, new Vector3f());
    boolean intersects = Intersectionf.testObOb(c0, ux0, uy0, uz0, hs0, c1, ux1, uy1, uz1, hs1);
    assertTrue(intersects); // <- they DO intersect
    c0 = new Vector3f(0, 0, a + EPSILON);
    intersects = Intersectionf.testObOb(c0, ux0, uy0, uz0, hs0, c1, ux1, uy1, uz1, hs1);
    assertFalse(intersects); // <- they do not intersect
}
 
开发者ID:JOML-CI,项目名称:JOML,代码行数:21,代码来源:IntersectionfTest.java


示例4: renderParticles

import org.joml.Matrix3f; //导入依赖的package包/类
private void renderParticles(Window window, Camera camera, Scene scene) {
    particlesShaderProgram.bind();

    particlesShaderProgram.setUniform("texture_sampler", 0);
    Matrix4f projectionMatrix = window.getProjectionMatrix();
    particlesShaderProgram.setUniform("projectionMatrix", projectionMatrix);

    Matrix4f viewMatrix = camera.getViewMatrix();
    IParticleEmitter[] emitters = scene.getParticleEmitters();
    int numEmitters = emitters != null ? emitters.length : 0;

    glDepthMask(false);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE);

    Matrix3f aux = new Matrix3f();
    for (int i = 0; i < numEmitters; i++) {
        IParticleEmitter emitter = emitters[i];
        InstancedMesh mesh = (InstancedMesh) emitter.getBaseParticle().getMesh();

        Texture text = mesh.getMaterial().getTexture();
        particlesShaderProgram.setUniform("numCols", text.getNumCols());
        particlesShaderProgram.setUniform("numRows", text.getNumRows());

        mesh.renderListInstanced(emitter.getParticles(), true, transformation, viewMatrix, null);
    }

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glDepthMask(true);

    particlesShaderProgram.unbind();
}
 
开发者ID:justjanne,项目名称:SteamAudio-Java,代码行数:32,代码来源:Renderer.java


示例5: toDirectBuffer

import org.joml.Matrix3f; //导入依赖的package包/类
/**
 * Stores matrix in a direct buffer.
 *
 * @param matrix Matrix to be stored in a direct buffer.
 * @return Direct buffer containing matrix.
 */
public static FloatBuffer toDirectBuffer(Matrix3f matrix) {
    FloatBuffer buffer = createFloatBuffer(9);
    matrix.get(buffer);
    buffer.flip();
    return buffer;
}
 
开发者ID:WarpOrganization,项目名称:warp,代码行数:13,代码来源:BufferTools.java


示例6: setUniform

import org.joml.Matrix3f; //导入依赖的package包/类
public void setUniform(String uniformName, Matrix3f value) {
	int loc = getUniformLocation(uniformName);
	
	if(loc != -1) {
		setUniform(getUniformLocation(uniformName), value);
	}
}
 
开发者ID:urstruktur,项目名称:zierfisch,代码行数:8,代码来源:Shader.java


示例7: setMatrix3f

import org.joml.Matrix3f; //导入依赖的package包/类
/**
 * <p>
 * Set a {@code mat3} value.
 * </p>
 *
 * @param name The name of the uniform in the shader.
 * @param value The value of the uniform.
 */
public final void setMatrix3f(String name, Matrix3f value)
{
	if(!ShaderInternal.hasUniform(asset.shader, name) || !ShaderInternal.getUniformType(asset.shader, name).equals("mat3"))
	{
		Logger.logWarning("Shader: " + getShader().getName() + " does not contain a mat3 with the name: " + name);
		return;
	}
	
	asset.values.put(name, value);
}
 
开发者ID:Snakybo,项目名称:TorchEngine,代码行数:19,代码来源:Material.java


示例8: renderParticles

import org.joml.Matrix3f; //导入依赖的package包/类
private void renderParticles(Window window, Camera camera, Scene scene) {
    particlesShaderProgram.bind();

    particlesShaderProgram.setUniform("texture_sampler", 0);
    Matrix4f projectionMatrix = transformation.getProjectionMatrix();
    particlesShaderProgram.setUniform("projectionMatrix", projectionMatrix);

    Matrix4f viewMatrix = transformation.getViewMatrix();
    IParticleEmitter[] emitters = scene.getParticleEmitters();
    int numEmitters = emitters != null ? emitters.length : 0;

    glDepthMask(false);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE);

    Matrix3f aux = new Matrix3f();
    for (int i = 0; i < numEmitters; i++) {
        IParticleEmitter emitter = emitters[i];
        InstancedMesh mesh = (InstancedMesh)emitter.getBaseParticle().getMesh();

        Texture text = mesh.getMaterial().getTexture();
        particlesShaderProgram.setUniform("numCols", text.getNumCols());
        particlesShaderProgram.setUniform("numRows", text.getNumRows());

        mesh.renderListInstanced(emitter.getParticles(), true, transformation, viewMatrix, null);
    }

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glDepthMask(true);

    particlesShaderProgram.unbind();
}
 
开发者ID:lwjglgamedev,项目名称:lwjglbook,代码行数:32,代码来源:Renderer.java


示例9: MatrixStack

import org.joml.Matrix3f; //导入依赖的package包/类
public MatrixStack(int size) {
    this.size = size;
    this.composeMatrixStack = new Matrix4f[size];
    this.rotationMatrixStack = new Matrix3f[size];
    fill();
}
 
开发者ID:WarpOrganization,项目名称:warp,代码行数:7,代码来源:MatrixStack.java


示例10: fill

import org.joml.Matrix3f; //导入依赖的package包/类
private void fill() {
    for (int i = 0; i < this.size; i++) {
        composeMatrixStack[i] = new Matrix4f();
        rotationMatrixStack[i] = new Matrix3f();
    }
}
 
开发者ID:WarpOrganization,项目名称:warp,代码行数:7,代码来源:MatrixStack.java


示例11: setTopRotation

import org.joml.Matrix3f; //导入依赖的package包/类
public void setTopRotation(Matrix3f rotationMatrix) {
    topRotationMatrix().set(rotationMatrix);
}
 
开发者ID:WarpOrganization,项目名称:warp,代码行数:4,代码来源:MatrixStack.java


示例12: topRotationMatrix

import org.joml.Matrix3f; //导入依赖的package包/类
/**
 * @return A rotation matrix of the topMatrix matrix.
 */
public Matrix3f topRotationMatrix() {
    return rotationMatrixStack[top];
}
 
开发者ID:WarpOrganization,项目名称:warp,代码行数:7,代码来源:MatrixStack.java


示例13: updateCaches

import org.joml.Matrix3f; //导入依赖的package包/类
public void updateCaches(Matrix4f transformMatrix, Matrix3f rotationMatrix) {
    this.transformCache.set(transformMatrix);
    this.rotationCache.set(rotationMatrix);
    this.dirty = false;
}
 
开发者ID:WarpOrganization,项目名称:warp,代码行数:6,代码来源:TransformProperty.java


示例14: getCachedNonrelativeRotation

import org.joml.Matrix3f; //导入依赖的package包/类
public Matrix3f getCachedNonrelativeRotation() {
    return rotationCache;
}
 
开发者ID:WarpOrganization,项目名称:warp,代码行数:4,代码来源:TransformProperty.java


示例15: getInertia

import org.joml.Matrix3f; //导入依赖的package包/类
public Matrix3f getInertia() {
    return inertia;
}
 
开发者ID:WarpOrganization,项目名称:warp,代码行数:4,代码来源:SimplePhysicsProperty.java


示例16: setInertia

import org.joml.Matrix3f; //导入依赖的package包/类
public void setInertia(Matrix3f inertia) {
    this.inertia.set(inertia);
}
 
开发者ID:WarpOrganization,项目名称:warp,代码行数:4,代码来源:SimplePhysicsProperty.java


示例17: render

import org.joml.Matrix3f; //导入依赖的package包/类
public static void render()
{
	glDepthFunc(GL_LEQUAL);
	
	ShaderInternal.bind(material.getShader());
	
	Matrix4f viewMatrix = Camera.getCurrentCamera().getViewMatrix();
	viewMatrix = new Matrix4f(new Matrix3f(viewMatrix));
	
	material.setMatrix4f("_view", viewMatrix);
	material.setMatrix4f("_projection", Camera.getCurrentCamera().getProjection());
	
	MaterialInternal.update(material);
	
	glBindVertexArray(vao.get(0));
	glDrawArrays(GL_TRIANGLES, 0, 36);
	glBindVertexArray(0);
	
	ShaderInternal.unbind();
	
	glDepthFunc(GL_LESS);
}
 
开发者ID:Snakybo,项目名称:TorchEngine,代码行数:23,代码来源:Skybox.java


示例18: update

import org.joml.Matrix3f; //导入依赖的package包/类
public static void update(Material material)
{
	for(Map.Entry<String, Object> property : material.asset.values.entrySet())
	{
		String type = ShaderInternal.getUniformType(material.asset.shader, property.getKey());
		
		if(type != null)
		{
			int loc = ShaderInternal.getUniformLocation(material.getShader(), property.getKey());
			Object value = property.getValue();
			
			if(type.startsWith("sampler"))
			{
				Texture texture = (Texture)value;
				int samplerSlotId = material.asset.textureSamplerSlotIds.indexOf(texture);
				TextureInternal.bind(texture, samplerSlotId);
				glUniform1i(loc, samplerSlotId);
			}
			else
			{
				switch(type)
				{
				case "int":
					glUniform1i(loc, (int)value);
					break;
				case "float":
					glUniform1f(loc, (float)value);
					break;
				case "vec2":
					Vector2f vec2 = (Vector2f)value;
					glUniform2f(loc, vec2.x, vec2.y);
					break;
				case "vec3":
					Vector3f vec3 = (Vector3f)value;
					glUniform3f(loc, vec3.x, vec3.y, vec3.z);
					break;
				case "vec4":
					Vector4f vec4 = (Vector4f)value;
					glUniform4f(loc, vec4.x, vec4.y, vec4.z, vec4.w);
					break;
				case "mat3":
					Matrix3f mat3 = (Matrix3f)value;
					glUniformMatrix3fv(loc, false, mat3.get(BufferUtils.createFloatBuffer(9)));
					break;
				case "mat4":
					Matrix4f mat4 = (Matrix4f)value;
					glUniformMatrix4fv(loc, false, mat4.get(BufferUtils.createFloatBuffer(16)));
					break;
				}
			}
		}
	}
}
 
开发者ID:Snakybo,项目名称:TorchEngine,代码行数:54,代码来源:MaterialInternal.java


示例19: testObOb45Slide

import org.joml.Matrix3f; //导入依赖的package包/类
public static void testObOb45Slide() {
    Vector3f c0 = new Vector3f();
    float EPSILON = 1E-4f;
    /*
     * Position the second box right over the first one so that they "almost" intersect/slide
     */
    // 2a^2 = c^2 = (2+0.5)^2 <-- length of a (box A + box B) squared
    // a^2 = (2+0.5)^2/2 -> a = 1.5/sqrt(2)
    float a = (float) (2.5 / Math.sqrt(2));
    Vector3f c1 = new Vector3f(-a - EPSILON, a + EPSILON, 0);
    Matrix3f m = new Matrix3f().rotateZ((float) Math.toRadians(45.0));
    Vector3f ux0 = m.getColumn(0, new Vector3f());
    Vector3f uy0 = m.getColumn(1, new Vector3f());
    Vector3f uz0 = m.getColumn(2, new Vector3f());
    Vector3f ux1 = m.getColumn(0, new Vector3f());
    Vector3f uy1 = m.getColumn(1, new Vector3f());
    Vector3f uz1 = m.getColumn(2, new Vector3f());
    Vector3f hs0 = new Vector3f(2);
    Vector3f hs1 = new Vector3f(0.5f);
    boolean intersects = Intersectionf.testObOb(c0, ux0, uy0, uz0, hs0, c1, ux1, uy1, uz1, hs1);
    assertFalse(intersects); // <- they do not intersect
    c1 = new Vector3f(-a + EPSILON, a - EPSILON, 0);
    intersects = Intersectionf.testObOb(c0, ux0, uy0, uz0, hs0, c1, ux1, uy1, uz1, hs1);
    assertTrue(intersects); // <- they do intersect
    c1 = new Vector3f(-a - EPSILON, -a - EPSILON, 0);
    intersects = Intersectionf.testObOb(c0, ux0, uy0, uz0, hs0, c1, ux1, uy1, uz1, hs1);
    assertFalse(intersects); // <- they do intersect
    c1 = new Vector3f(-a + EPSILON, -a + EPSILON, 0);
    intersects = Intersectionf.testObOb(c0, ux0, uy0, uz0, hs0, c1, ux1, uy1, uz1, hs1);
    assertTrue(intersects); // <- they do intersect
    c1 = new Vector3f(a + EPSILON, -a - EPSILON, 0);
    intersects = Intersectionf.testObOb(c0, ux0, uy0, uz0, hs0, c1, ux1, uy1, uz1, hs1);
    assertFalse(intersects); // <- they do intersect
    c1 = new Vector3f(a - EPSILON, -a + EPSILON, 0);
    intersects = Intersectionf.testObOb(c0, ux0, uy0, uz0, hs0, c1, ux1, uy1, uz1, hs1);
    assertTrue(intersects); // <- they do intersect
    c1 = new Vector3f(a + EPSILON, a + EPSILON, 0);
    intersects = Intersectionf.testObOb(c0, ux0, uy0, uz0, hs0, c1, ux1, uy1, uz1, hs1);
    assertFalse(intersects); // <- they do intersect
    c1 = new Vector3f(a - EPSILON, a - EPSILON, 0);
    intersects = Intersectionf.testObOb(c0, ux0, uy0, uz0, hs0, c1, ux1, uy1, uz1, hs1);
    assertTrue(intersects); // <- they do intersect
}
 
开发者ID:JOML-CI,项目名称:JOML,代码行数:44,代码来源:IntersectionfTest.java


示例20: getMatrix3f

import org.joml.Matrix3f; //导入依赖的package包/类
/**
 * <p>
 * Get a {@code mat3} value.
 * </p>
 *
 * @param name The name of the uniform in the shader.
 * @return The value of the uniform.
 */
public final Matrix3f getMatrix3f(String name)
{
	return get(Matrix3f.class, name);
}
 
开发者ID:Snakybo,项目名称:TorchEngine,代码行数:13,代码来源:Material.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Keys类代码示例发布时间:2022-05-23
下一篇:
Java Sound类代码示例发布时间: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