1 /*
2  * Copyright (c) 2009-2010 jMonkeyEngine
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  *   notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  *   notice, this list of conditions and the following disclaimer in the
14  *   documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of 'jMonkeyEngine' nor the names of its contributors
17  *   may be used to endorse or promote products derived from this software
18  *   without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 #include <jni.h>
33 
34 /**
35  * Author: Normen Hansen
36  */
37 
38 class jmeClasses {
39 public:
40     static void initJavaClasses(JNIEnv* env);
41 //    static JNIEnv* env;
42     static JavaVM* vm;
43     static jclass PhysicsSpace;
44     static jmethodID PhysicsSpace_preTick;
45     static jmethodID PhysicsSpace_postTick;
46     static jmethodID PhysicsSpace_addCollisionEvent;
47     static jclass PhysicsGhostObject;
48     static jmethodID PhysicsGhostObject_addOverlappingObject;
49 
50     static jclass Vector3f;
51     static jmethodID Vector3f_set;
52     static jmethodID Vector3f_getX;
53     static jmethodID Vector3f_getY;
54     static jmethodID Vector3f_getZ;
55     static jmethodID Vector3f_toArray;
56     static jfieldID Vector3f_x;
57     static jfieldID Vector3f_y;
58     static jfieldID Vector3f_z;
59 
60     static jclass Quaternion;
61     static jmethodID Quaternion_set;
62     static jmethodID Quaternion_getX;
63     static jmethodID Quaternion_getY;
64     static jmethodID Quaternion_getZ;
65     static jmethodID Quaternion_getW;
66     static jfieldID Quaternion_x;
67     static jfieldID Quaternion_y;
68     static jfieldID Quaternion_z;
69     static jfieldID Quaternion_w;
70 
71     static jclass Matrix3f;
72     static jmethodID Matrix3f_get;
73     static jmethodID Matrix3f_set;
74     static jfieldID Matrix3f_m00;
75     static jfieldID Matrix3f_m01;
76     static jfieldID Matrix3f_m02;
77     static jfieldID Matrix3f_m10;
78     static jfieldID Matrix3f_m11;
79     static jfieldID Matrix3f_m12;
80     static jfieldID Matrix3f_m20;
81     static jfieldID Matrix3f_m21;
82     static jfieldID Matrix3f_m22;
83 
84     static jclass PhysicsRay_Class;
85     static jmethodID PhysicsRay_newSingleResult;
86     static jfieldID PhysicsRay_normalInWorldSpace;
87     static jfieldID PhysicsRay_hitfraction;
88     static jfieldID PhysicsRay_collisionObject;
89     static jclass PhysicsRay_listresult;
90     static jmethodID PhysicsRay_addmethod;
91 
92     static jclass DebugMeshCallback;
93     static jmethodID DebugMeshCallback_addVector;
94 
95     static void throwNPE(JNIEnv* env);
96 private:
jmeClasses()97     jmeClasses(){};
~jmeClasses()98     ~jmeClasses(){};
99 };