glf.Vertex_v2fc4ub 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 dev.Vec4u8;
import glm.vec._2.Vec2;
import java.nio.ByteBuffer;
/**
*
* @author GBarbieri
*/
public class Vertex_v2fc4ub {
public static final int SIZE = Vec2.SIZE + Vec4u8.SIZE;
public Vec2 position;
public Vec4u8 color;
public Vertex_v2fc4ub(Vec2 position, Vec4u8 color) {
this.position = position;
this.color = color;
}
public void toBb(ByteBuffer bb, int index) {
bb
.putFloat(index * SIZE + 0 * Float.BYTES, position.x)
.putFloat(index * SIZE + 1 * Float.BYTES, position.y)
.put(index * SIZE + 2 * Float.BYTES + 0 * Byte.BYTES, color.x)
.put(index * SIZE + 2 * Float.BYTES + 1 * Byte.BYTES, color.y)
.put(index * SIZE + 2 * Float.BYTES + 2 * Byte.BYTES, color.z)
.put(index * SIZE + 2 * Float.BYTES + 3 * Byte.BYTES, color.w);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy