Sample Application for mixing Android and Libgdx. This project is geared towards integrating 3D interactions and Android UI, and NOT towards building complex 3D application.
There are three main modules in the project
- libcore3d: A pure Java module that contains any 3D scenes and animations we want to show
- desktop-app: A pure Java desktop application(depends on libcore3d) that can be run to test your 3D scenes without needing to build the Android application
- app: The Android application(depends on libcore3d)
- Import into Android Studio using Gradle and let it set up the initial project
- In your
Run Configurations
, along with the usual Android build, aRun Desktop Application
should have been created that will let you execute the desktop app
- Core3d is where the bulk of the 3D application lies. This includes setup of the scene, lighting, materials, models etc as well as exposed methods to manipulate whatever specifically is needed for the animation. Both the Desktop and Android applications will create an instance of this class and use it to render in their respective
View
- CubeAnimationFragment is the Android
Fragment
which is used to display whatver 3D code is set up inCore3D
- Whenever
libgdx
version is updated, run the gradle taskapp:copyNativeLibs
to copy the updated native libraries into the Android jniLibs as well - All the native libs together use a little more than 4MB in the final APK. This can be reduced in two ways - If you're not planning to have 3D animations or manipulations on text, remove the
freetype
dependencies since they will not be needed. On top of this, you can employ ABI splits, or opt to not include since target platforms to reduce your build size. Check out thecopyNativeLibs
gradle task inapp/build.gradle
to remove whatever platforms you don't want to support
- Make this a general framework that can be used to implement 3D animations in Android
- Tie this to Android Views and ViewGroups to automatically create powerful View level 3D animations
- See if a custom, lightweight scene graph library can be used to replace libgdx