-
Notifications
You must be signed in to change notification settings - Fork 736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrating Unigine 3D Engine to Java #889
Comments
Please try to follow this guide: https://github.com/bytedeco/javacpp/wiki/Mapping-Recipes And let me know where you are having problems with it. Thanks! |
Well okay i started with small includes now,
UnigineVector.h file is here: Or you can get Unigine Free SDK. Why EOF Error occurs ? I checked all braces. My generator file: import org.bytedeco.javacpp.*;
import org.bytedeco.javacpp.annotation.*;
import org.bytedeco.javacpp.tools.*;
@Properties(
value = @Platform(
value = "windows-x86_64",
includepath = {"C:\\Users\\Administrator\\Unigine SDK Browser\\sdks\\community_windows_2.11.0.2\\include"},
linkpath = {"C:\\Users\\Administrator\\Unigine SDK Browser\\sdks\\community_windows_2.11.0.2\\lib"},
include = {"UnigineBase.h","UnigineMemory.h","Unigine.h","UnigineApp.h","UnigineVector.h"},
preload = {"Unigine_x64d","UnigineWrapper_x64d","EditorCore_x64d"},
link = {"UnigineWin64"}
),
target = "UnigineWrapper"
)
@Namespace("Unigine")
public class NativeLibraryConfig implements InfoMapper {
public void map(InfoMap infoMap) {
//infoMap.put(new Info("data::Blob<float>").pointerTypes("FloatBlob"));
//infoMap.put(new Info("UNIGINE_EXPORT").javaNames("processFloatBlob"));
//infoMap.put(new Info("quat::RawValuesTag").javaNames("quatRawValuesTag"));
infoMap.put(new Info("Unigine::SystemDialog").pointerTypes("UnigineSystemDialogP"));
infoMap.put(new Info("Unigine::SystemDialog").valueTypes("UnigineSystemDialog"));
infoMap.put(new Info("Unigine::SystemDialog").javaNames("UnigineSystemDialogK"));
infoMap.put(new Info("Unigine::SystemDialog").javaText("UnigineSystemDialog"));
infoMap.put(new Info("UNIGINE_INLINE", "ZEXPORT", "z_const", "zlib_version").cppTypes().annotations());
}
} |
Might be caused by |
I have found the location of decleration on UnigineBasic.h UNIGINE_ALIGNED4(), UNIGINE_ALIGNED8(), UNIGINE_ALIGNED16() /* So i will try Right ? |
I have tried this but same error :
Exception in thread "main" org.bytedeco.javacpp.tools.ParserException: C:\Users\Administrator\Unigine SDK Browser\sdks\community_windows_2.11.0.2\include\UnigineVector.h:1409:Unexpected token 'EOF' Do you have skype ? sorry |
The problem seems on VectorHelper class. Here is the problem class:
}; |
When i remove the VectorHelper class , error disappears but CPU Usage reached to %50
|
Could you try to isolate which line makes it fail? |
I got new UnigineVector.h It generated The problem seems I changed it to: PATCH 2:
This works but |
It would be good to make javacpp utils like modulating header files. |
…without names (issue bytedeco/javacpp-presets#889)
Thanks! I fixed this issue in commit bytedeco/javacpp@6d84ea7.
You'll need create instances and give them valid names in Java:
I fully agree. We just need someone that has some time to work on this, see bytedeco/javacpp#51. |
Okay now , when i tried the Wrapper , I got error Unigine::SystemDialog put into generated Java code.How can i fix this kind of issues ? Why there is no filter? There is no keyword "::" in Java as we know , javacpp can replace automatically from also PtrUnigine::SystemDialog
|
Redefining an infoMap.put(new Info("Unigine::SystemDialog").pointerTypes("UnigineSystemDialogP")
.valueTypes("UnigineSystemDialog")
.javaNames("UnigineSystemDialogK")
.javaText("UnigineSystemDialog")); |
Okay now ,
}
|
|
Okay now I have NativeLibrary.java But , its 1MB , all classes generated into 1 file. My NativeLibraryConfig.java : |
Be sure to set the |
Give them valid names, see above #889 (comment) |
Nice , now @namespace("Unigine") @properties(inherit = org.unigine.presets.UnigineConfig.class) Properties class is Unigine::Properties class file What to put to "infomap.put" rename class name from Properties to UnigineProperties ? i put I got public class APIInterface extends Pointer { public native int isNull(); i dont know how to fix method collision with javacpp and unigine org.unigine.Node class
AXIS is undefined. I tried But this also didnt work. in C++ side AXIS is defined in enum AXIS But JavaCPP cant get enum type Thanks |
It's with Info.pointerTypes, like this: |
To rename methods, we can use Info.javaNames, like this: You'll need to include "UnigineMathLib.h" in the |
Hi , i have downloaded Unigine 3D Engine
https://unigine.com/get-unigine
Then i wanted to make Binding to Java
I have made the Java File
I got error on 3 files "UnigineString.h" , "UnigineType.h" , "UnigineVector.h"
//"UnigineString.h"
//UnigineString.h:334:Could not parse declaration at '(' 334
//"UnigineType.h"
//UnigineVector.h:1410:Unexpected token 'EOF'
//"UnigineVector.h"
//UnigineType.h:422:Unexpected token 'EOF'
import org.bytedeco.javacpp.;
import org.bytedeco.javacpp.annotation.;
import org.bytedeco.javacpp.tools.*;
//"UnigineString.h"
//UnigineString.h:334:Could not parse declaration at '(' 334
//"UnigineType.h"
//UnigineVector.h:1410:Unexpected token 'EOF'
//"UnigineVector.h"
//UnigineType.h:422:Unexpected token 'EOF'
@properties(
value = @platform(
includepath = {"C:\Users\Administrator\Unigine SDK Browser\sdks\community_windows_2.11.0.2\include"},
// preloadpath = {"/path/to/deps/"},
linkpath = {"C:\Users\Administrator\Unigine SDK Browser\sdks\community_windows_2.11.0.2\lib"},
include = {"Unigine.h","UnigineApp.h","UnigineAsyncQueue.h","UnigineBase.h","UnigineBiMap.h","UnigineBounds.h",
"UnigineCallback.h","UnigineCamera.h","UnigineChecksum.h","UnigineCompress.h","UnigineConfig.h",
"UnigineConsole.h","UnigineControls.h","UnigineDecals.h","UnigineDir.h","UnigineEditor.h",
"UnigineEllipsoid.h","UnigineEngine.h","UnigineFactory.h","UnigineFfp.h","UnigineFields.h",
"UnigineFileSystem.h","UnigineFunction.h","UnigineGame.h","UnigineGeodetics.h",
"UnigineGeodeticsTransformer.h","UnigineGeometry.h","UnigineGui.h","UnigineGUID.h","UnigineHash.h",
"UnigineHashMap.h","UnigineHashSet.h","UnigineImage.h"
,"UnigineInput.h","UnigineInterface.h","UnigineInterpreter.h","UnigineJson.h","UnigineLights.h",
"UnigineLog.h","UnigineLogic.h","UnigineMap.h","UnigineMaterial.h","UnigineMaterials.h","UnigineMath2d.h",
"UnigineMathLib.h","UnigineMemory.h","UnigineMesh.h","UnigineMeshDynamic.h","UnigineNode.h","UnigineNodes.h",
"UnigineObjects.h","UniginePackageUng.h","UniginePair.h","UniginePath.h","UniginePathFinding.h",
"UniginePhysicals.h","UniginePhysics.h","UniginePlayers.h","UniginePlugin.h","UniginePrimitives.h",
"UnigineProfiler.h","UnigineProperties.h","UniginePtr.h","UnigineRegExp.h","UnigineRender.h",
"UnigineRenderContext.h","UnigineResource.h","UnigineSet.h","UnigineShader.h","UnigineSort.h","UnigineSounds.h",
"UnigineSplash.h","UnigineSplineGraph.h","UnigineStreams.h","UnigineSystemInfo.h","UnigineTextures.h",
"UnigineThread.h","UnigineTileset.h","UnigineTilesetFile.h","UnigineTimer.h","UnigineTree.h",
"UnigineUlon.h","UnigineUserInterface.h","UnigineUtils.h","UnigineViewport.h","UnigineVisualizer.h",
"UnigineWidgets.h","UnigineWorld.h","UnigineWorlds.h","UnigineXml.h"
},
)
public class NativeLibraryConfig implements InfoMapper {
public void map(InfoMap infoMap) {
//infoMap.put(new Info("data::Blob").pointerTypes("FloatBlob"));
infoMap.put(new Info("UNIGINE_EXPORT").javaNames("processFloatBlob"));
infoMap.put(new Info("quat::RawValuesTag").javaNames("quatRawValuesTag"));
}
}
Here is the command i have tried:
java -jar javacpp-1.5.4-SNAPSHOT.jar NativeLibraryConfig.java -d out
Here is the patched some include files:
https://wetransfer.com/downloads/11afac9e45795c53f51413df62dbf13620200530235405/4485400d897c9ea18d7858a2aca7308720200530235428/e2c70f
I donno what to do ? How to fix "UnigineString.h" , "UnigineType.h" , "UnigineVector.h" files.
1.44 MB 1 big Java file i got out when i disable "UnigineString.h" , "UnigineType.h" , "UnigineVector.h"
But how to fix the issue ?
or i am at wrong way to convert the problem?
The text was updated successfully, but these errors were encountered: