Skip to content

Commit

Permalink
Float3: add a put(FloatBuffer) method
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Sep 24, 2024
1 parent 9b7ebad commit 7798439
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/com/github/stephengold/joltjni/Float3.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit 7798439

Please sign in to comment.