glf.Vertex_v2fc4d Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of glm Show documentation
Show all versions of glm Show documentation
Java OpenGL Mathematics is a library for graphics software based on the OpenGL Shading Language specifications
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package glf;
import glm.vec._2.Vec2;
import glm.vec._4.d.Vec4d;
import java.nio.ByteBuffer;
/**
*
* @author elect
*/
public class Vertex_v2fc4d {
public static final int SIZE = Vec2.SIZE + Vec4d.SIZE;
public Vec2 position;
public Vec4d color;
public Vertex_v2fc4d(Vec2 position, Vec4d color) {
this.position = position;
this.color = color;
}
public ByteBuffer toBB(ByteBuffer bb, int index) {
return bb
.putFloat(index * SIZE + 0 * Float.BYTES, position.x)
.putFloat(index * SIZE + 1 * Float.BYTES, position.y)
.putDouble(index * SIZE + 2 * Float.BYTES + 0 * Double.BYTES, color.x)
.putDouble(index * SIZE + 2 * Float.BYTES + 1 * Double.BYTES, color.y)
.putDouble(index * SIZE + 2 * Float.BYTES + 2 * Double.BYTES, color.z)
.putDouble(index * SIZE + 2 * Float.BYTES + 3 * Double.BYTES, color.w);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy