Skip to content

Commit

Permalink
IndexedMesh: add 2 native getters
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Feb 3, 2024
1 parent 83fe904 commit dfe728a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023 jMonkeyEngine
* Copyright (c) 2019-2024 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -480,6 +480,10 @@ private static void splitTriangle(
// *************************************************************************
// native private methods

native private static int countTriangles(long meshId);

native private static int countVertices(long meshId);

native private static long createByte(ByteBuffer indices,
FloatBuffer vertexPositions, int numTriangles, int numVertices,
int vertexStride, int indexStride);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020 jMonkeyEngine
* Copyright (c) 2019-2024 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -36,6 +36,34 @@
#include "com_jme3_bullet_collision_shapes_infos_IndexedMesh.h"
#include "jmeBulletUtil.h"

/*
* Class: com_jme3_bullet_collision_shapes_infos_IndexedMesh
* Method: countTriangles
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_com_jme3_bullet_collision_shapes_infos_IndexedMesh_countTriangles
(JNIEnv *pEnv, jclass, jlong meshId) {
btIndexedMesh * const pMesh = reinterpret_cast<btIndexedMesh *> (meshId);
NULL_CHK(pEnv, pMesh, "The btIndexedMesh does not exist.", 0);

jint result = pMesh->m_numTriangles;
return result;
}

/*
* Class: com_jme3_bullet_collision_shapes_infos_IndexedMesh
* Method: countVertices
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_com_jme3_bullet_collision_shapes_infos_IndexedMesh_countVertices
(JNIEnv *pEnv, jclass, jlong meshId) {
btIndexedMesh * const pMesh = reinterpret_cast<btIndexedMesh *> (meshId);
NULL_CHK(pEnv, pMesh, "The btIndexedMesh does not exist.", 0);

jint result = pMesh->m_numVertices;
return result;
}

/*
* Class: com_jme3_bullet_collision_shapes_infos_IndexedMesh
* Method: createByte
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dfe728a

Please sign in to comment.