static void se_setRoot(JNIEnv* env, jobject obj, jstring rootName, jint index) { jstring sceneName = (jstring)env->GetObjectField(obj, sceneNameID); const char* sceneName8 = env->GetStringUTFChars(sceneName, 0); SE_Scene* scene = findScene(sceneName8); if (scene) { const char* rootName8 = env->GetStringUTFChars(rootName, 0); SE_Spatial* spatial = SE_Application::getInstance()->getSceneManager()->findSpatialByName(rootName8, index); if (!spatial) { spatial = new SE_CommonNode(SE_ID::createSpatialID()); spatial->setIsEntirety(true); spatial->setSpatialName(rootName8); spatial->setCloneIndex(index); //save spatial name to map /*SE_SpatialManager* sm = SE_Application::getInstance()->getSpatialManager(); sm->set(spatial->getSpatialName(),spatial);*/ spatial->updateWorldLayer(); spatial->updateWorldTransform(); spatial->updateBoundingVolume(); } scene->setRoot(spatial); env->ReleaseStringUTFChars(rootName, rootName8); } env->ReleaseStringUTFChars(sceneName, sceneName8); }
static void se_setRoot_II(JNIEnv* env, jobject obj, jint object) { if (object > 0) { jstring sceneName = (jstring)env->GetObjectField(obj, sceneNameID); const char* sceneName8 = env->GetStringUTFChars(sceneName, 0); SE_Scene* scene = findScene(sceneName8); if (scene) { scene->setRoot((SE_Spatial*)object); } env->ReleaseStringUTFChars(sceneName, sceneName8); } }