-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcom_kAIS_KAIMyEntity_NativeFunc.cpp
252 lines (201 loc) · 9.21 KB
/
com_kAIS_KAIMyEntity_NativeFunc.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
#include "com_kAIS_KAIMyEntity_NativeFunc.h"
#include "KAIMyEntitySaba.h"
using namespace KAIMyEntitySaba;
JNIEXPORT jstring JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetVersion(JNIEnv* env, jobject obj)
{
return env->NewStringUTF("vr-1.0");
}
JNIEXPORT jbyte JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_ReadByte(JNIEnv* env, jobject obj, jlong data, jlong pos)
{
return (unsigned char)*(((unsigned char*)data) + pos);
}
JNIEXPORT void JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_CopyDataToByteBuffer(JNIEnv* env, jobject obj, jobject buffer, jlong data, jlong length)
{
unsigned char* p = (unsigned char*)env->GetDirectBufferAddress(buffer);
for (int i = 0; i < length; ++i)
(*(p + i)) = (*((unsigned char*)data + i));
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_LoadModelPMX(JNIEnv* env, jobject obj, jstring filename, jstring dir, jlong layerCount)
{
return (unsigned long long)LoadModelPMX(env->GetStringUTFChars(filename, JNI_FALSE), env->GetStringUTFChars(dir, JNI_FALSE), layerCount);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_LoadModelPMD(JNIEnv* env, jobject obj, jstring filename, jstring dir, jlong layerCount)
{
return (unsigned long long)LoadModelPMD(env->GetStringUTFChars(filename, JNI_FALSE), env->GetStringUTFChars(dir, JNI_FALSE), layerCount);
}
JNIEXPORT void JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_DeleteModel(JNIEnv* env, jobject obj, jlong model)
{
DeleteModel((Model*)model);
}
JNIEXPORT void JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_UpdateModel(JNIEnv* env, jobject obj, jlong model)
{
UpdateModel((Model*)model);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetVertexCount(JNIEnv* env, jobject obj, jlong model)
{
return GetVertexCount((Model*)model);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetPoss(JNIEnv* env, jobject obj, jlong model)
{
return (unsigned long long)GetPoss((Model*)model);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetNormals(JNIEnv* env, jobject obj, jlong model)
{
return (unsigned long long)GetNormals((Model*)model);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetUVs(JNIEnv* env, jobject obj, jlong model)
{
return (unsigned long long)GetUVs((Model*)model);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetIndexElementSize(JNIEnv* env, jobject obj, jlong model)
{
return GetIndexElementSize((Model*)model);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetIndexCount(JNIEnv* env, jobject obj, jlong model)
{
return GetIndexCount((Model*)model);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetIndices(JNIEnv* env, jobject obj, jlong model)
{
return (unsigned long long)GetIndices((Model*)model);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialCount(JNIEnv* env, jobject obj, jlong model)
{
return GetMaterialCount((Model*)model);
}
JNIEXPORT jstring JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialTex(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return env->NewStringUTF(GetMaterialTex((Model*)model, pos));
}
JNIEXPORT jstring JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialSpTex(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return env->NewStringUTF(GetMaterialSpTex((Model*)model, pos));
}
JNIEXPORT jstring JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialToonTex(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return env->NewStringUTF(GetMaterialToonTex((Model*)model, pos));
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialAmbient(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return (unsigned long long)GetMaterialAmbient((Model*)model, pos);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialDiffuse(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return (unsigned long long)GetMaterialDiffuse((Model*)model, pos);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialSpecular(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return (unsigned long long)GetMaterialSpecular((Model*)model, pos);
}
JNIEXPORT jfloat JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialSpecularPower(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return GetMaterialSpecularPower((Model*)model, pos);
}
JNIEXPORT jfloat JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialAlpha(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return GetMaterialAlpha((Model*)model, pos);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialTextureMulFactor(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return (unsigned long long)GetMaterialTextureMulFactor((Model*)model, pos);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialTextureAddFactor(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return (unsigned long long)GetMaterialTextureAddFactor((Model*)model, pos);
}
JNIEXPORT jint JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialSpTextureMode(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return GetMaterialSpTextureMode((Model*)model, pos);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialSpTextureMulFactor(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return (unsigned long long)GetMaterialSpTextureMulFactor((Model*)model, pos);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialSpTextureAddFactor(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return (unsigned long long)GetMaterialSpTextureAddFactor((Model*)model, pos);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialToonTextureMulFactor(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return (unsigned long long)GetMaterialToonTextureMulFactor((Model*)model, pos);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialToonTextureAddFactor(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return (unsigned long long)GetMaterialToonTextureAddFactor((Model*)model, pos);
}
JNIEXPORT jboolean JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetMaterialBothFace(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return GetMaterialBothFace((Model*)model, pos) ? JNI_TRUE : JNI_FALSE;
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetSubMeshCount(JNIEnv* env, jobject obj, jlong model)
{
return GetSubMeshCount((Model*)model);
}
JNIEXPORT jint JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetSubMeshMaterialID(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return GetSubMeshMaterialID((Model*)model, pos);
}
JNIEXPORT jint JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetSubMeshBeginIndex(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return GetSubMeshBeginIndex((Model*)model, pos);
}
JNIEXPORT jint JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetSubMeshVertexCount(JNIEnv* env, jobject obj, jlong model, jlong pos)
{
return GetSubMeshVertexCount((Model*)model, pos);
}
JNIEXPORT void JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_ChangeModelAnim(JNIEnv* env, jobject obj, jlong model, jlong anim, jlong layer)
{
ChangeModelAnim((Model*)model, (saba::VMDAnimation*)anim, layer);
}
JNIEXPORT void JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_ResetModelPhysics(JNIEnv* env, jobject obj, jlong model)
{
ResetModelPhysics((Model*)model);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_CreateMat(JNIEnv* env, jobject obj)
{
return (unsigned long long)CreateMat();
}
JNIEXPORT void JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_DeleteMat(JNIEnv* env, jobject obj, jlong mat)
{
DeleteMat((glm::mat4*)mat);
}
JNIEXPORT void JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetRightHandMat(JNIEnv* env, jobject obj, jlong model, jlong mat)
{
GetRightHandMat((Model*)model, (glm::mat4*)mat);
}
JNIEXPORT void JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetLeftHandMat(JNIEnv* env, jobject obj, jlong model, jlong mat)
{
GetLeftHandMat((Model*)model, (glm::mat4*)mat);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_LoadTexture(JNIEnv* env, jobject obj, jstring filename)
{
return (unsigned long long)LoadTexture(env->GetStringUTFChars(filename, JNI_FALSE));
}
JNIEXPORT void JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_DeleteTexture(JNIEnv* env, jobject obj, jlong tex)
{
DeleteTexture((Texture*)tex);
}
JNIEXPORT jint JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetTextureX(JNIEnv* env, jobject obj, jlong tex)
{
return GetTextureX((Texture*)tex);
}
JNIEXPORT jint JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetTextureY(JNIEnv* env, jobject obj, jlong tex)
{
return GetTextureY((Texture*)tex);
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_GetTextureData(JNIEnv* env, jobject obj, jlong tex)
{
return (unsigned long long)GetTextureData((Texture*)tex);
}
JNIEXPORT jboolean JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_TextureHasAlpha(JNIEnv* env, jobject obj, jlong tex)
{
return TextureHasAlpha((Texture*)tex) ? JNI_TRUE : JNI_FALSE;
}
JNIEXPORT jlong JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_LoadAnimation(JNIEnv* env, jobject obj, jlong model, jstring filename)
{
return (unsigned long long)LoadAnimation((Model*)model, env->GetStringUTFChars(filename, JNI_FALSE));
}
JNIEXPORT void JNICALL Java_com_kAIS_KAIMyEntity_NativeFunc_DeleteAnimation(JNIEnv* env, jobject obj, jlong anim)
{
DeleteAnimation((saba::VMDAnimation*)anim);
}