Skip to content

Commit

Permalink
library: javadoc and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Apr 28, 2024
1 parent 3802942 commit 218f245
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ private void createShape() {
setMargin(margin);

assert !hasBvh(shapeId);
if (bvh == null) {
if (bvh == null) { // Create an untracked native object:
this.bvh = new BoundingValueHierarchy(this);
} else {
long bvhId = bvh.nativeId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ protected BoundingValueHierarchy() {
}

/**
* Instantiate a reference to the hierarchy of the specified
* MeshCollisionShape. Used internally.
* Instantiate an (untracked) reference to the hierarchy of the specified
* {@code MeshCollisionShape}.
*
* @param meshShape the pre-existing shape (not null)
*/
Expand All @@ -89,7 +89,11 @@ public BoundingValueHierarchy(MeshCollisionShape meshShape) {
}

/**
* Instantiate a hierarchy from serialized bytes.
* Instantiate a (tracked) hierarchy from serialized bytes.
* <p>
* If the bytes weren't generated on the current {@code Platform} with the
* same floating-point precision, the results are undefined (likely a JVM
* crash).
*
* @param bytes the serialized bytes (not null, unaffected)
*/
Expand All @@ -115,6 +119,11 @@ public boolean isCompressed() {

/**
* Serialize this hierarchy to a byte array.
* <p>
* Serialization can be used to avoid re-generating the BVH of a
* `MeshCollisionShape` each time it is instantiated. The resulting bytes
* are specific to a particular `MeshCollisionShape`. They are also specific
* to the current {@code Platform} and floating-point precision.
*
* @return a new array containing serialized bytes (not null)
*/
Expand Down

0 comments on commit 218f245

Please sign in to comment.