Ndk Build:在内容更改时动态编译JNI C ++文件

时间:2016-07-15 06:25:40

标签: android c++ android-ndk

在下面的代码中,模型文件经常从webservices添加。那么如何在没有ndk-build的情况下每次动态编译它并手动重新编译以生成so文件。

JNIEXPORT void JNICALL JNIFUNCTION_DEMO(demoInitialise(JNIEnv* env,   jobject object)) {

 const char *model0file = "Data/models/moon.obj";
 const char *model1file = "Data/models/T_REX.obj";

 models[0].patternID = arwAddMarker("single;Data/hiro.patt;80");
 arwSetMarkerOptionBool(models[0].patternID, ARW_MARKER_OPTION_SQUARE_USE_CONT_POSE_ESTIMATION, false);
 arwSetMarkerOptionBool(models[0].patternID, ARW_MARKER_OPTION_FILTERED, true);

 models[0].obj = glmReadOBJ2(model0file, 0, 0); // context 0, don't read textures yet.
 if (!models[0].obj) {
 LOGE("Error loading model from file '%s'.", model0file);
 exit(-1);
 }

 glmScale(models[0].obj, 0.035f);
 //glmRotate(models[0].obj, 3.14159f / 2.0f, 1.0f, 0.0f, 0.0f);
 glmCreateArrays(models[0].obj, GLM_SMOOTH | GLM_MATERIAL | GLM_TEXTURE);
 models[0].visible = false;

 models[1].patternID = arwAddMarker("single;Data/kanji.patt;80");
 arwSetMarkerOptionBool(models[1].patternID, ARW_MARKER_OPTION_SQUARE_USE_CONT_POSE_ESTIMATION, false);
 arwSetMarkerOptionBool(models[1].patternID, ARW_MARKER_OPTION_FILTERED, true);

 models[1].obj = glmReadOBJ2(model1file, 0, 0); // context 0, don't read textures yet.
 if (!models[1].obj) {
 LOGE("Error loading model from file '%s'.", model1file);
 exit(-1);
 }

0 个答案:

没有答案