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