All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mmb.engine.gl.FloatMath2Collects Maven / Gradle / Ivy

Go to download

Dependency for the MultiMachineBuilder, a voxel game about building an industrial empire in a finite world. THIS RELEASE IS NOT PLAYABLE. To play the game, donwload from >ITCH.IO LINK HERE< or >GH releases link here<

There is a newer version: 0.6
Show newest version
/**
 * 
 */
package mmb.engine.gl;

import org.joml.Vector2f;
import org.joml.Vector2fc;
import org.joml.Vector3f;
import org.joml.Vector3fc;
import org.joml.Vector4f;
import org.joml.Vector4fc;

import it.unimi.dsi.fastutil.floats.FloatCollection;
import it.unimi.dsi.fastutil.floats.FloatIterator;
import mmb.NN;

/**
 * @author oskar
 *
 */
public class FloatMath2Collects {
	//Write methods
	public static void push(Vector2fc vec, FloatCollection collect) {
		collect.add(vec.x());
		collect.add(vec.y());
	}
	public static void push(Vector3fc vec, FloatCollection collect) {
		collect.add(vec.x()); 
		collect.add(vec.y());
		collect.add(vec.z());
	}
	public static void push(Vector4fc vec, FloatCollection collect) {
		collect.add(vec.x()); 
		collect.add(vec.y());
		collect.add(vec.z());
		collect.add(vec.w());
	}
	
	//Read methods
	@NN public static Vector2f pull(Vector2f vec, FloatIterator iter) {
		vec.x = iter.nextFloat();
		vec.y = iter.nextFloat();
		return vec;
	}
	@NN public static Vector3f pull(Vector3f vec, FloatIterator iter) {
		vec.x = iter.nextFloat();
		vec.y = iter.nextFloat();
		vec.z = iter.nextFloat();
		return vec;
	}
	@NN public static Vector4f pull(Vector4f vec, FloatIterator iter) {
		vec.x = iter.nextFloat();
		vec.y = iter.nextFloat();
		vec.z = iter.nextFloat();
		vec.w = iter.nextFloat();
		return vec;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy