From 77984396c397539361ad4d8971009aec527a01a5 Mon Sep 17 00:00:00 2001 From: stephengold Date: Mon, 23 Sep 2024 17:30:12 -0700 Subject: [PATCH] Float3: add a put(FloatBuffer) method --- .../com/github/stephengold/joltjni/Float3.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/com/github/stephengold/joltjni/Float3.java b/src/main/java/com/github/stephengold/joltjni/Float3.java index 4eed192a..2f575ade 100644 --- a/src/main/java/com/github/stephengold/joltjni/Float3.java +++ b/src/main/java/com/github/stephengold/joltjni/Float3.java @@ -21,6 +21,8 @@ of this software and associated documentation files (the "Software"), to deal */ package com.github.stephengold.joltjni; +import java.nio.FloatBuffer; + /** * A vector composed of 3 single-precision components, used as a storage class. * @@ -102,6 +104,18 @@ public float get(int index) { } } + /** + * Write all 3 components to the specified buffer and advance the buffer's + * position by 3. The vector is unaffected. + * + * @param storeBuffer the destination buffer (not null) + */ + public void put(FloatBuffer storeBuffer) { + storeBuffer.put(x); + storeBuffer.put(y); + storeBuffer.put(z); + } + /** * Set all 3 components to specified values. *