Subversion Repository Public Repository

artic

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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
#include <android/native_window.h>
#include <android/native_window_jni.h>

#include <info_aiju_artic_ARCore.h>
#include <ARCore.h>

#if !defined(__ANDROID__)
#define __ANDROID__
#endif


#include <app.h>
#include "logger.h"
#include "ViewDrawNotifier.h"
#include <jni.h>

#define	LOG_TAG	"JNI"

JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
{
    LOG_INFO("Initializing JNI");
	jint ret=app::init(vm);
    LOG_INFO("Succeded");
	return ret;
}

JNIEXPORT void JNI_OnUnload(JavaVM* vm, void* reserved)
{

}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_Init
  (JNIEnv * env, jclass, jstring iApplicationPath,jstring iDocumentsPath)
{
	const char *app_path = env->GetStringUTFChars(iApplicationPath, 0);
	const char *doc_path = env->GetStringUTFChars(iDocumentsPath, 0);
	
	app::init_bundle(app_path);

	// use your string
	ARCore_Init(app_path,doc_path);

	env->ReleaseStringUTFChars(iApplicationPath, app_path);
	env->ReleaseStringUTFChars(iDocumentsPath, doc_path);
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_ClassifyDocuments
  (JNIEnv *, jclass)
{
	ARCore_ClassifyDocuments();
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_SetAssetManager
  (JNIEnv * env, jclass, jobject iAssetManager)
{
	app::set_asset_manager(iAssetManager);
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_PrepareData
  (JNIEnv *, jclass)
{
	//jint JNI_GetCreatedJavaVMs(JavaVM**, jsize, jsize*);
    ARCore_PrepareData();
}


JNIEXPORT jboolean JNICALL Java_info_aiju_artic_ARCore_IsDataPrepared
  (JNIEnv *, jclass)
{
	bool ret=ARCore_IsDataPrepared();
	return ret;
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_DownloadCovers
  (JNIEnv *, jclass)
{
	ARCore_DownloadCovers();
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_PrepareDataAndCovers
  (JNIEnv *, jclass,jboolean iSleepMode)
{
	ARCore_PrepareDataAndCovers(bool(iSleepMode));
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_Params
  (JNIEnv *, jclass, jstring)
{

}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_Finish
  (JNIEnv *, jclass)
{
	ARCore_Finish();
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_Resume
  (JNIEnv *, jclass)
{
	ARCore_Resume();
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_Pause
  (JNIEnv *, jclass)
{
	ARCore_Pause();
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_AppWillSuspend
  (JNIEnv *, jclass)
{
	ARCore_AppWillSuspend();
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_AppDidReactivate
  (JNIEnv *, jclass)
{
	ARCore_AppDidReactivate();
}


JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_OpenRenderer
  (JNIEnv *env, jclass)
{
	app::set_current_env(env);
    ARCore_OpenRenderer();
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_SetRenderingSurface
  (JNIEnv * env, jclass, jobject surface)
{
	ANativeWindow* window=0x0;
    if (surface != 0)
    {
        window = ANativeWindow_fromSurface(env, surface);
        LOG_INFO("Got window %p", window);
    }

    ARCore_SetRenderingSurface(window);

}


JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_SelectPack
  (JNIEnv *env, jclass, jstring iPack)
{
	const char *name = env->GetStringUTFChars(iPack, 0);

	ARCore_SelectPack(name);

	env->ReleaseStringUTFChars(iPack, name);
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_SelectRenderingCatalog
  (JNIEnv *, jclass, jint iDocument)
{
	ARCore_SelectRenderingCatalog(iDocument);
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_RendererRotateCamera
  (JNIEnv *, jclass, jfloat iValue)
{
	ARCore_RendererRotateCamera(iValue);
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_RendererElevateCamera
  (JNIEnv *, jclass, jfloat iValue)
{
	ARCore_RendererElevateCamera(iValue);
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_RendererZoomCamera
  (JNIEnv *, jclass, jfloat iValue)
{
	ARCore_RendererZoomCamera(iValue);
}

JNIEXPORT jboolean JNICALL Java_info_aiju_artic_ARCore_RendererIsInCameraMode
  (JNIEnv *, jclass)
{
	return ARCore_RendererIsInCameraMode();
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_RenderScene
  (JNIEnv *env, jclass , jfloat i, jobject iActivity)
{
	//LOG_INFO("Java_info_aiju_artic_ARCore_RenderScene Setting the current activity %x",reinterpret_cast<uintptr_t>(iActivity));
	app::set_current_env(env);
	app::set_current_activity(iActivity);
	ARCore_RenderScene(i);
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_CloseRenderer
  (JNIEnv *, jclass)
{
	ARCore_CloseRenderer();
}

JNIEXPORT jint JNICALL Java_info_aiju_artic_ARCore_GetDocumentCount
  (JNIEnv *, jclass)
{
    int ret=ARCore_GetDocumentCount();
	return ret;
}

JNIEXPORT jint JNICALL Java_info_aiju_artic_ARCore_GetDocumentId
  (JNIEnv *, jclass, jint iDocumentIndex)
{
	int ret=ARCore_GetDocumentId(iDocumentIndex);
	LOG_INFO("Request for document at index %d, and returned %d",iDocumentIndex,ret);
	return ret;

}

JNIEXPORT jint JNICALL Java_info_aiju_artic_ARCore_GetDownloadedDocumentCount
  (JNIEnv *, jclass)
{
	return ARCore_GetDownloadedDocumentCount();
}

JNIEXPORT jint JNICALL Java_info_aiju_artic_ARCore_GetDownloadedDocumentId
  (JNIEnv *, jclass, jint iIndex)
{
	return ARCore_GetDownloadedDocumentId(iIndex);
}

JNIEXPORT jboolean JNICALL Java_info_aiju_artic_ARCore_IsDownloadingDocuments
  (JNIEnv *, jclass)
{
	return ARCore_IsDownloadingDocuments();
}

JNIEXPORT jstring JNICALL Java_info_aiju_artic_ARCore_GetDocumentName
  (JNIEnv * env, jclass, jint iDocument)
{
	return env->NewStringUTF(ARCore_GetDocumentName(iDocument));
}

JNIEXPORT jstring JNICALL Java_info_aiju_artic_ARCore_GetDocumentDescription
  (JNIEnv * env, jclass, jint iDocument)
{
	return env->NewStringUTF(ARCore_GetDocumentDescription(iDocument));
}

JNIEXPORT jboolean JNICALL Java_info_aiju_artic_ARCore_IsDocumentDownloading
  (JNIEnv *, jclass, jint iDocumentId)
{
	return ARCore_IsDocumentDownloading(iDocumentId);
}

JNIEXPORT jboolean JNICALL Java_info_aiju_artic_ARCore_IsDocumentDownloaded
  (JNIEnv *, jclass, jint iDocumentId)
{
	return ARCore_IsDocumentDownloaded(iDocumentId);
}

JNIEXPORT jfloat JNICALL Java_info_aiju_artic_ARCore_GetDownloadProgress
  (JNIEnv *, jclass, jint iDocumentId)
{
	return ARCore_GetDownloadProgress(iDocumentId);
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_DownloadDocument
  (JNIEnv *, jclass, jint iDocument)
{
	LOG_INFO("Download Document %d",iDocument);
	ARCore_DownloadDocument(iDocument);
}

JNIEXPORT jboolean JNICALL Java_info_aiju_artic_ARCore_IsCoverDownloaded
  (JNIEnv *, jclass, jint iDocumentId)
{
	return ARCore_IsCoverDownloaded(iDocumentId);
}

JNIEXPORT jstring JNICALL Java_info_aiju_artic_ARCore_GetDocumentCover
  (JNIEnv * env, jclass, jint iDocument)
{
	return env->NewStringUTF(ARCore_GetDocumentCover(iDocument));
}

JNIEXPORT void JNICALL Java_info_aiju_artic_ARCore_DeleteDocument
  (JNIEnv *, jclass, jint iDocumentId)
{
	ARCore_DeleteDocument(iDocumentId);
}

static	bool	TouchedInRenderView_MustExit;
static	char	TouchedInRenderView_Link[512];

JNIEXPORT jboolean JNICALL Java_info_aiju_artic_ARCore_TouchedInRenderView
  (JNIEnv *, jclass, jfloat x, jfloat y)
{
	bool ret=ARCore_TouchedInRenderView(x,y,TouchedInRenderView_MustExit,TouchedInRenderView_Link);
	return ret;
}

JNIEXPORT jboolean JNICALL Java_info_aiju_artic_ARCore_TouchedInRenderView_1MustExit
  (JNIEnv *, jclass)
{
	return TouchedInRenderView_MustExit;
}

JNIEXPORT jstring JNICALL Java_info_aiju_artic_ARCore_TouchedInRenderView_1Link
  (JNIEnv *env, jclass)
{
	return env->NewStringUTF(TouchedInRenderView_Link);
}




Commits for artic/ARTIC/jni/info_aiju_artic_ARCore.cpp

Diff revisions: vs.
Revision Author Commited Message
3 CESAR-AIJU picture CESAR-AIJU Tue 01 Mar, 2016 17:50:10 +0000

Subiendo Proyecto Artic