Ogre3D 1.8.1 Android移植

1.准备工作

系统环境:Linux Ubuntu12.04 LTS 32bit

NDK:因为官方NDK对C++异常支持不够完整,所以这里使用的是非官方版本的NDK,下载地址http://www.crystax.net/en/android/ndk/7

下载源代码:

Ogre3D 1.8.1 https://sourceforge.net/projects/ogre/files/ogre/1.8/1.8.1/ogre_src_v1-8-1.tar.bz2/download

还需要下载一些依赖的库,http://bitbucket.org/cabalistic/ogredeps,后面我们要先做这些依赖库的移植。

2.建立工作目录

建立一个叫ogre-port的工作目录,准备好了之后,结构如下:

Dependencies

--jni

OGRE

--jni

我们分两步来移植,第一步移植依赖库,都放在Dependencies/jni下面,第二步才能正确移植Ogre,Ogre的源代码都放在OGRE/jni下面。

解开下载来的ogredeps,我们需要的只有三个库,分别是FreeImage,freetype和zziplib,其他的都不需要。将这三个库拷贝到Dependencies/jni下面。

将Ogre的源代码解压,拷贝到OGRE/jni下面,准备工作就算结束了,下面可以开始具体的移植工作。

3.移植依赖库

在Dependencies/jni下创建两个文件Android.mk,Application.mk:

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
 
LOCAL_MODULE    := libzzip
LOCAL_LDLIBS    := -ldl -lz
LOCAL_SRC_FILES := zzip/dir.c zzip/err.c zzip/fetch.c zzip/file.c zzip/fseeko.c zzip/info.c zzip/memdisk.c zzip/mmapped.c zzip/plugin.c zzip/stat.c zzip/write.c zzip/zip.c
 
include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE        := libfreeimage 
LOCAL_LDLIBS        := -ldl -lz
LOCAL_C_INCLUDES    := $(LOCAL_PATH)/freeimage $(LOCAL_PATH)/freeimage/Metadata $(LOCAL_PATH)/freeimage/DeprecationManager
LOCAL_CFLAGS        += -DFREEIMAGE_LIB=1 -DPNG_STATIC=1
LOCAL_SRC_FILES        :=\
    freeimage/DeprecationManager/Deprecated.cpp\
    freeimage/DeprecationManager/DeprecationMgr.cpp\
    freeimage/FreeImage/BitmapAccess.cpp\
    freeimage/FreeImage/CacheFile.cpp\
    freeimage/FreeImage/ColorLookup.cpp\
    freeimage/FreeImage/Conversion.cpp\
    freeimage/FreeImage/ConversionFloat.cpp\
    freeimage/FreeImage/Conversion4.cpp\
    freeimage/FreeImage/Conversion8.cpp\
    freeimage/FreeImage/Conversion16_555.cpp\
    freeimage/FreeImage/Conversion16_565.cpp\
    freeimage/FreeImage/Conversion24.cpp\
    freeimage/FreeImage/Conversion32.cpp\
    freeimage/FreeImage/ConversionRGB16.cpp\
    freeimage/FreeImage/ConversionRGBF.cpp\
    freeimage/FreeImage/ConversionUINT16.cpp\
    freeimage/FreeImage/ConversionType.cpp\
    freeimage/FreeImage/FreeImage.cpp\
    freeimage/FreeImage/FreeImageIO.cpp\
    freeimage/FreeImage/GetType.cpp\
    freeimage/FreeImage/Halftoning.cpp\
    freeimage/FreeImage/J2KHelper.cpp\
    freeimage/FreeImage/MemoryIO.cpp\
    freeimage/FreeImage/MultiPage.cpp\
    freeimage/FreeImage/NNQuantizer.cpp\
    freeimage/FreeImage/PixelAccess.cpp\
    freeimage/FreeImage/Plugin.cpp\
    freeimage/FreeImage/PluginGIF.cpp\
    freeimage/FreeImage/PluginJPEG.cpp\
    freeimage/FreeImage/PluginPNG.cpp\
    freeimage/FreeImage/ToneMapping.cpp\
    freeimage/FreeImage/tmoColorConvert.cpp\
    freeimage/FreeImage/tmoDrago03.cpp\
    freeimage/FreeImage/tmoFattal02.cpp\
    freeimage/FreeImage/tmoReinhard05.cpp\
    freeimage/FreeImage/WuQuantizer.cpp\
    freeimage/FreeImage/ZLibInterface.cpp\
    freeimage/FreeImageToolkit/Background.cpp\
    freeimage/FreeImageToolkit/Colors.cpp\
    freeimage/FreeImageToolkit/Flip.cpp\
    freeimage/FreeImageToolkit/Resize.cpp\
    freeimage/FreeImageToolkit/BSplineRotate.cpp\
    freeimage/FreeImageToolkit/CopyPaste.cpp\
    freeimage/FreeImageToolkit/JPEGTransform.cpp\
    freeimage/FreeImageToolkit/Channels.cpp\
    freeimage/FreeImageToolkit/Display.cpp\
    freeimage/FreeImageToolkit/MultigridPoissonSolver.cpp\
    freeimage/FreeImageToolkit/ClassicRotate.cpp\
    freeimage/FreeImageToolkit/Rescale.cpp\
    freeimage/LibJPEG/ckconfig.c\
    freeimage/LibJPEG/jaricom.c\
    freeimage/LibJPEG/jcapimin.c\
    freeimage/LibJPEG/jcapistd.c\
    freeimage/LibJPEG/jcarith.c\
    freeimage/LibJPEG/jccoefct.c\
    freeimage/LibJPEG/jccolor.c\
    freeimage/LibJPEG/jcdctmgr.c\
    freeimage/LibJPEG/jchuff.c\
    freeimage/LibJPEG/jcinit.c\
    freeimage/LibJPEG/jcmainct.c\
    freeimage/LibJPEG/jcmarker.c\
    freeimage/LibJPEG/jcmaster.c\
    freeimage/LibJPEG/jcomapi.c\
    freeimage/LibJPEG/jconfig.txt\
    freeimage/LibJPEG/jcparam.c\
    freeimage/LibJPEG/jcprepct.c\
    freeimage/LibJPEG/jcsample.c\
    freeimage/LibJPEG/jctrans.c\
    freeimage/LibJPEG/jdapimin.c\
    freeimage/LibJPEG/jdapistd.c\
    freeimage/LibJPEG/jdarith.c\
    freeimage/LibJPEG/jdatadst.c\
    freeimage/LibJPEG/jdatasrc.c\
    freeimage/LibJPEG/jdcoefct.c\
    freeimage/LibJPEG/jdcolor.c\
    freeimage/LibJPEG/jddctmgr.c\
    freeimage/LibJPEG/jdhuff.c\
    freeimage/LibJPEG/jdinput.c\
    freeimage/LibJPEG/jdmainct.c\
    freeimage/LibJPEG/jdmarker.c\
    freeimage/LibJPEG/jdmaster.c\
    freeimage/LibJPEG/jdmerge.c\
    freeimage/LibJPEG/jdpostct.c\
    freeimage/LibJPEG/jdsample.c\
    freeimage/LibJPEG/jdtrans.c\
    freeimage/LibJPEG/jerror.c\
    freeimage/LibJPEG/jfdctflt.c\
    freeimage/LibJPEG/jfdctfst.c\
    freeimage/LibJPEG/jfdctint.c\
    freeimage/LibJPEG/jidctflt.c\
    freeimage/LibJPEG/jidctfst.c\
    freeimage/LibJPEG/jidctint.c\
    freeimage/LibJPEG/jmemmgr.c\
    freeimage/LibJPEG/jmemnobs.c\
    freeimage/LibJPEG/jquant1.c\
    freeimage/LibJPEG/jquant2.c\
    freeimage/LibJPEG/jutils.c\
    freeimage/LibJPEG/rdbmp.c\
    freeimage/LibJPEG/rdcolmap.c\
    freeimage/LibJPEG/rdgif.c\
    freeimage/LibJPEG/rdppm.c\
    freeimage/LibJPEG/rdrle.c\
    freeimage/LibJPEG/rdswitch.c\
    freeimage/LibJPEG/rdtarga.c\
    freeimage/LibJPEG/transupp.c\
    freeimage/LibJPEG/wrbmp.c\
    freeimage/LibJPEG/wrgif.c\
    freeimage/LibJPEG/wrppm.c\
    freeimage/LibJPEG/wrrle.c\
    freeimage/LibJPEG/wrtarga.c\
    freeimage/LibPNG/png.c\
    freeimage/LibPNG/pngerror.c\
    freeimage/LibPNG/pnggccrd.c\
    freeimage/LibPNG/pngget.c\
    freeimage/LibPNG/pngmem.c\
    freeimage/LibPNG/pngpread.c\
    freeimage/LibPNG/pngread.c\
    freeimage/LibPNG/pngrio.c\
    freeimage/LibPNG/pngrtran.c\
    freeimage/LibPNG/pngrutil.c\
    freeimage/LibPNG/pngset.c\
    freeimage/LibPNG/pngtrans.c\
    freeimage/LibPNG/pngvcrd.c\
    freeimage/LibPNG/pngwio.c\
    freeimage/LibPNG/pngwrite.c\
    freeimage/LibPNG/pngwtran.c\
    freeimage/LibPNG/pngwutil.c\
    freeimage/Metadata/Exif.cpp\
    freeimage/Metadata/FIRational.cpp\
    freeimage/Metadata/FreeImageTag.cpp\
    freeimage/Metadata/IPTC.cpp\
    freeimage/Metadata/TagConversion.cpp\
    freeimage/Metadata/TagLib.cpp\
    freeimage/LibOpenJPEG/bio.c\
    freeimage/LibOpenJPEG/cidx_manager.c\
    freeimage/LibOpenJPEG/cio.c\
    freeimage/LibOpenJPEG/dwt.c\
    freeimage/LibOpenJPEG/event.c\
    freeimage/LibOpenJPEG/image.c\
    freeimage/LibOpenJPEG/j2k.c\
    freeimage/LibOpenJPEG/j2k_lib.c\
    freeimage/LibOpenJPEG/jp2.c\
    freeimage/LibOpenJPEG/jpt.c\
    freeimage/LibOpenJPEG/mct.c\
    freeimage/LibOpenJPEG/mct.h\
    freeimage/LibOpenJPEG/mqc.c\
    freeimage/LibOpenJPEG/mqc.h\
    freeimage/LibOpenJPEG/openjpeg.c\
    freeimage/LibOpenJPEG/phix_manager.c\
    freeimage/LibOpenJPEG/pi.c\
    freeimage/LibOpenJPEG/ppix_manager.c\
    freeimage/LibOpenJPEG/raw.c\
    freeimage/LibOpenJPEG/t1.c\
    freeimage/LibOpenJPEG/t2.c\
    freeimage/LibOpenJPEG/tcd.c\
    freeimage/LibOpenJPEG/tgt.c\
    freeimage/LibOpenJPEG/thix_manager.c\
    freeimage/LibOpenJPEG/tpix_manager.c\

include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := libfreetype
LOCAL_C_INCLUDES    := $(LOCAL_PATH)/freetype/include $(LOCAL_PATH)/freetype/builds/unix
LOCAL_CFLAGS   := -DFT2_BUILD_LIBRARY
LOCAL_SRC_FILES     :=\
        freetype/src/autofit/autofit.c\
        freetype/src/base/ftbase.c\
        freetype/src/base/ftbbox.c\
        freetype/src/base/ftbitmap.c\
        freetype/src/base/ftfstype.c\
        freetype/src/base/ftgasp.c\
        freetype/src/base/ftglyph.c\
        freetype/src/base/ftinit.c\
        freetype/src/base/ftmm.c\
        freetype/src/base/ftpfr.c\
        freetype/src/base/ftstroke.c\
        freetype/src/base/ftsynth.c\
        freetype/src/base/ftsystem.c\
        freetype/src/base/fttype1.c\
        freetype/src/base/ftwinfnt.c\
        freetype/src/bdf/bdf.c\
        freetype/src/bzip2/ftbzip2.c\
        freetype/src/cache/ftcache.c\
        freetype/src/cff/cff.c\
        freetype/src/cid/type1cid.c\
        freetype/src/gzip/ftgzip.c\
        freetype/src/lzw/ftlzw.c\
        freetype/src/pcf/pcf.c\
        freetype/src/pfr/pfr.c\
        freetype/src/psaux/psaux.c\
        freetype/src/pshinter/pshinter.c\
        freetype/src/psnames/psmodule.c\
        freetype/src/raster/raster.c\
        freetype/src/sfnt/sfnt.c\
        freetype/src/smooth/smooth.c\
        freetype/src/truetype/truetype.c\
        freetype/src/type1/type1.c\
        freetype/src/type42/type42.c\
        freetype/src/winfonts/winfnt.c
 
 include $(BUILD_STATIC_LIBRARY)

Application.mk

APP_OPTIM := release
APP_PLATFORM := android-8
APP_PLATFORM := gnustl_static
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -DANDROID

APP_MODULES := freeimage freetype zzip

这里,依赖库都编译成静态库。

先别编译,代码还有些小的调整,

找到Dependencies / jni / zzip / _config.h这个文件,将27行注释掉,

 
  

#ifndef ZZIP_HAVE_DIRENT_H

// #define ZZIP_HAVE_DIRENT_H 1

#endif

不注释掉,后面会报错,说找不到telldir的引用。

找到Dependencies/jni/freeimage/FreeImage/Plugin.cpp这个文件,把无法移植的组件都注释掉,从224行开始

if (s_plugins) {
            /* NOTE : 
            The order used to initialize internal plugins below MUST BE the same order 
            as the one used to define the FREE_IMAGE_FORMAT enum. 
            */
            //s_plugins->AddNode(InitBMP);
            //s_plugins->AddNode(InitICO);
            s_plugins->AddNode(InitJPEG);
            //s_plugins->AddNode(InitJNG);
            //s_plugins->AddNode(InitKOALA);
            //s_plugins->AddNode(InitIFF);
            //s_plugins->AddNode(InitMNG);
            //s_plugins->AddNode(InitPNM, NULL, "PBM", "Portable Bitmap (ASCII)", "pbm", "^P1");
            //s_plugins->AddNode(InitPNM, NULL, "PBMRAW", "Portable Bitmap (RAW)", "pbm", "^P4");
            //s_plugins->AddNode(InitPCD);
            //s_plugins->AddNode(InitPCX);
            //s_plugins->AddNode(InitPNM, NULL, "PGM", "Portable Greymap (ASCII)", "pgm", "^P2");
            //s_plugins->AddNode(InitPNM, NULL, "PGMRAW", "Portable Greymap (RAW)", "pgm", "^P5");
            s_plugins->AddNode(InitPNG);
            //s_plugins->AddNode(InitPNM, NULL, "PPM", "Portable Pixelmap (ASCII)", "ppm", "^P3");
            //s_plugins->AddNode(InitPNM, NULL, "PPMRAW", "Portable Pixelmap (RAW)", "ppm", "^P6");
            //s_plugins->AddNode(InitRAS);
            //s_plugins->AddNode(InitTARGA);
            //s_plugins->AddNode(InitTIFF);
            //s_plugins->AddNode(InitWBMP);
            //s_plugins->AddNode(InitPSD);
            //s_plugins->AddNode(InitCUT);
            //s_plugins->AddNode(InitXBM);
            //s_plugins->AddNode(InitXPM);
            //s_plugins->AddNode(InitDDS);
            s_plugins->AddNode(InitGIF);
            //s_plugins->AddNode(InitHDR);
            //s_plugins->AddNode(InitG3);
            //s_plugins->AddNode(InitSGI);
            //s_plugins->AddNode(InitEXR);
            //s_plugins->AddNode(InitJ2K);
            //s_plugins->AddNode(InitJP2);
            //s_plugins->AddNode(InitPFM);
            //s_plugins->AddNode(InitPICT);
            //s_plugins->AddNode(InitRAW);
            
            // external plugin initialization

进入Dependencies目录,执行ndk-build -j4,编译比较慢,加上参数-j4可以加快编译速度,4代表你的机器的核心数。

编译完成后,把生成的静态库放到OGRE/lib目录下,链接生成ogre动态库的时候会用到。

4.移植Ogre

在OGRE/jni下面创建文件OgreBuildSettings.h,Android下某些组件不能工作,需要靠这个文件来将其禁用掉,否则编译没办法继续,内容如下:

 
  

#ifndef _Custom_Config_H_

#define _Custom_Config_H_

#define OGRE_MEMORY_ALLOCATOR OGRE_MEMORY_ALLOCATOR_STD

#define OGRE_NO_GLES3_CG_SUPPORT 1

#define OGRE_NO_GLES2_CG_SUPPORT 1

#define OGRE_NO_GLES2_GLSL_OPTIMISER 1

#endif

然后准备Make文件:

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
 
LOCAL_MODULE        := libogre
LOCAL_C_INCLUDES    := $(LOCAL_PATH)/ogre $(LOCAL_PATH)/ogre/OgreMain/include $(LOCAL_PATH)/ogre/dependencies $(LOCAL_PATH)/ogre/dependencies/freeimage $(LOCAL_PATH)/ogre/Components/RTShaderSystem/include $(LOCAL_PATH)/ogre/RenderSystems/GLES2/include $(LOCAL_PATH)/ogre/RenderSystems/GLES2/include $(LOCAL_PATH)/ogre/RenderSystems/GLES2/src/GLSLES/include $(LOCAL_PATH)/ogre/RenderSystems/GLES2/include/Android $(LOCAL_PATH)/ogre/PlugIns/ParticleFX/include $(LOCAL_PATH)/../../Dependencies/jni/freetype/include $(LOCAL_PATH)/../../Dependencies/jni/freeimage $(LOCAL_PATH)/../../Dependencies/jni
LOCAL_CFLAGS        := -DFREEIMAGE_LIB=1 -DOGRE_NONCLIENT_BUILD=1
LOCAL_LDLIBS        := -L$(LOCAL_PATH)/../lib -lfreeimage -lzzip -ldl -llog -lz -lGLESv2 -lfreetype
LOCAL_SRC_FILES        := ogre/OgreMain/src/OgreAlignedAllocator.cpp\
    ogre/OgreMain/src/OgreAnimable.cpp\
    ogre/OgreMain/src/OgreAnimation.cpp\
    ogre/OgreMain/src/OgreAnimationState.cpp\
    ogre/OgreMain/src/OgreAnimationTrack.cpp\
    ogre/OgreMain/src/OgreArchiveManager.cpp\
    ogre/OgreMain/src/OgreAutoParamDataSource.cpp\
    ogre/OgreMain/src/OgreAxisAlignedBox.cpp\
    ogre/OgreMain/src/OgreBillboard.cpp\
    ogre/OgreMain/src/OgreBillboardChain.cpp\
    ogre/OgreMain/src/OgreBillboardParticleRenderer.cpp\
    ogre/OgreMain/src/OgreBillboardSet.cpp\
    ogre/OgreMain/src/OgreBone.cpp\
    ogre/OgreMain/src/OgreBorderPanelOverlayElement.cpp\
    ogre/OgreMain/src/OgreCamera.cpp\
    ogre/OgreMain/src/OgreCodec.cpp\
    ogre/OgreMain/src/OgreColourValue.cpp\
    ogre/OgreMain/src/OgreCommon.cpp\
    ogre/OgreMain/src/OgreCompositionPass.cpp\
    ogre/OgreMain/src/OgreCompositionTargetPass.cpp\
    ogre/OgreMain/src/OgreCompositionTechnique.cpp\
    ogre/OgreMain/src/OgreCompositor.cpp\
    ogre/OgreMain/src/OgreCompositorChain.cpp\
    ogre/OgreMain/src/OgreCompositorInstance.cpp\
    ogre/OgreMain/src/OgreCompositorManager.cpp\
    ogre/OgreMain/src/OgreConfigFile.cpp\
    ogre/OgreMain/src/OgreControllerManager.cpp\
    ogre/OgreMain/src/OgreConvexBody.cpp\
    ogre/OgreMain/src/OgreDataStream.cpp\
    ogre/OgreMain/src/OgreDDSCodec.cpp\
    ogre/OgreMain/src/OgreDefaultHardwareBufferManager.cpp\
    ogre/OgreMain/src/OgreDefaultSceneQueries.cpp\
    ogre/OgreMain/src/OgreDeflate.cpp\
    ogre/OgreMain/src/OgreDepthBuffer.cpp\
    ogre/OgreMain/src/OgreDistanceLodStrategy.cpp\
    ogre/OgreMain/src/OgreDualQuaternion.cpp\
    ogre/OgreMain/src/OgreDynLib.cpp\
    ogre/OgreMain/src/OgreDynLibManager.cpp\
    ogre/OgreMain/src/OgreEdgeListBuilder.cpp\
    ogre/OgreMain/src/OgreEntity.cpp\
    ogre/OgreMain/src/OgreException.cpp\
    ogre/OgreMain/src/OgreExternalTextureSource.cpp\
    ogre/OgreMain/src/OgreExternalTextureSourceManager.cpp\
    ogre/OgreMain/src/OgreFileSystem.cpp\
    ogre/OgreMain/src/OgreFont.cpp\
    ogre/OgreMain/src/OgreFontManager.cpp\
    ogre/OgreMain/src/OgreFreeImageCodec.cpp\
    ogre/OgreMain/src/OgreFrustum.cpp\
    ogre/OgreMain/src/OgreGpuProgram.cpp\
    ogre/OgreMain/src/OgreGpuProgramManager.cpp\
    ogre/OgreMain/src/OgreGpuProgramParams.cpp\
    ogre/OgreMain/src/OgreGpuProgramUsage.cpp\
    ogre/OgreMain/src/OgreHardwareBufferManager.cpp\
    ogre/OgreMain/src/OgreHardwareIndexBuffer.cpp\
    ogre/OgreMain/src/OgreHardwareOcclusionQuery.cpp\
    ogre/OgreMain/src/OgreHardwarePixelBuffer.cpp\
    ogre/OgreMain/src/OgreHardwareVertexBuffer.cpp\
    ogre/OgreMain/src/OgreHighLevelGpuProgram.cpp\
    ogre/OgreMain/src/OgreHighLevelGpuProgramManager.cpp\
    ogre/OgreMain/src/OgreImage.cpp\
    ogre/OgreMain/src/OgreInstanceBatch.cpp\
    ogre/OgreMain/src/OgreInstanceBatchHW.cpp\
    ogre/OgreMain/src/OgreInstanceBatchHW_VTF.cpp\
    ogre/OgreMain/src/OgreInstanceBatchShader.cpp\
    ogre/OgreMain/src/OgreInstanceBatchVTF.cpp\
    ogre/OgreMain/src/OgreInstancedEntity.cpp\
    ogre/OgreMain/src/OgreInstancedGeometry.cpp\
    ogre/OgreMain/src/OgreInstanceManager.cpp\
    ogre/OgreMain/src/OgreKeyFrame.cpp\
    ogre/OgreMain/src/OgreLight.cpp\
    ogre/OgreMain/src/OgreLodStrategy.cpp\
    ogre/OgreMain/src/OgreLodStrategyManager.cpp\
    ogre/OgreMain/src/OgreLog.cpp\
    ogre/OgreMain/src/OgreLogManager.cpp\
    ogre/OgreMain/src/OgreManualObject.cpp\
    ogre/OgreMain/src/OgreMaterial.cpp\
    ogre/OgreMain/src/OgreMaterialManager.cpp\
    ogre/OgreMain/src/OgreMaterialSerializer.cpp\
    ogre/OgreMain/src/OgreMath.cpp\
    ogre/OgreMain/src/OgreMatrix3.cpp\
    ogre/OgreMain/src/OgreMatrix4.cpp\
    ogre/OgreMain/src/OgreMemoryAllocatedObject.cpp\
    ogre/OgreMain/src/OgreMemoryNedAlloc.cpp\
    ogre/OgreMain/src/OgreMemoryNedPooling.cpp\
    ogre/OgreMain/src/OgreMemoryTracker.cpp\
    ogre/OgreMain/src/OgreMesh.cpp\
    ogre/OgreMain/src/OgreMeshManager.cpp\
    ogre/OgreMain/src/OgreMeshSerializer.cpp\
    ogre/OgreMain/src/OgreMeshSerializerImpl.cpp\
    ogre/OgreMain/src/OgreMovableObject.cpp\
    ogre/OgreMain/src/OgreMovablePlane.cpp\
    ogre/OgreMain/src/OgreNode.cpp\
    ogre/OgreMain/src/OgreNumerics.cpp\
    ogre/OgreMain/src/OgreOptimisedUtil.cpp\
    ogre/OgreMain/src/OgreOptimisedUtilGeneral.cpp\
    ogre/OgreMain/src/OgreOptimisedUtilSSE.cpp\
    ogre/OgreMain/src/OgreOverlay.cpp\
    ogre/OgreMain/src/OgreOverlayContainer.cpp\
    ogre/OgreMain/src/OgreOverlayElement.cpp\
    ogre/OgreMain/src/OgreOverlayElementCommands.cpp\
    ogre/OgreMain/src/OgreOverlayElementFactory.cpp\
    ogre/OgreMain/src/OgreOverlayManager.cpp\
    ogre/OgreMain/src/OgrePanelOverlayElement.cpp\
    ogre/OgreMain/src/OgreParticle.cpp\
    ogre/OgreMain/src/OgreParticleEmitter.cpp\
    ogre/OgreMain/src/OgreParticleEmitterCommands.cpp\
    ogre/OgreMain/src/OgreParticleIterator.cpp\
    ogre/OgreMain/src/OgreParticleSystem.cpp\
    ogre/OgreMain/src/OgreParticleSystemManager.cpp\
    ogre/OgreMain/src/OgrePass.cpp\
    ogre/OgreMain/src/OgrePatchMesh.cpp\
    ogre/OgreMain/src/OgrePatchSurface.cpp\
    ogre/OgreMain/src/OgrePixelCountLodStrategy.cpp\
    ogre/OgreMain/src/OgrePixelFormat.cpp\
    ogre/OgreMain/src/OgrePlane.cpp\
    ogre/OgreMain/src/OgrePlatformInformation.cpp\
    ogre/OgreMain/src/OgrePolygon.cpp\
    ogre/OgreMain/src/OgrePose.cpp\
    ogre/OgreMain/src/OgrePrecompiledHeaders.cpp\
    ogre/OgreMain/src/OgrePredefinedControllers.cpp\
    ogre/OgreMain/src/OgrePrefabFactory.cpp\
    ogre/OgreMain/src/OgreProfiler.cpp\
    ogre/OgreMain/src/OgreProgressiveMesh.cpp\
    ogre/OgreMain/src/OgrePVRTCCodec.cpp\
    ogre/OgreMain/src/OgreQuaternion.cpp\
    ogre/OgreMain/src/OgreRectangle2D.cpp\
    ogre/OgreMain/src/OgreRenderQueue.cpp\
    ogre/OgreMain/src/OgreRenderQueueInvocation.cpp\
    ogre/OgreMain/src/OgreRenderQueueSortingGrouping.cpp\
    ogre/OgreMain/src/OgreRenderSystem.cpp\
    ogre/OgreMain/src/OgreRenderSystemCapabilities.cpp\
    ogre/OgreMain/src/OgreRenderSystemCapabilitiesManager.cpp\
    ogre/OgreMain/src/OgreRenderSystemCapabilitiesSerializer.cpp\
    ogre/OgreMain/src/OgreRenderTarget.cpp\
    ogre/OgreMain/src/OgreRenderTexture.cpp\
    ogre/OgreMain/src/OgreRenderToVertexBuffer.cpp\
    ogre/OgreMain/src/OgreRenderWindow.cpp\
    ogre/OgreMain/src/OgreResource.cpp\
    ogre/OgreMain/src/OgreResourceBackgroundQueue.cpp\
    ogre/OgreMain/src/OgreResourceGroupManager.cpp\
    ogre/OgreMain/src/OgreResourceManager.cpp\
    ogre/OgreMain/src/OgreRibbonTrail.cpp\
    ogre/OgreMain/src/OgreRoot.cpp\
    ogre/OgreMain/src/OgreRotationSpline.cpp\
    ogre/OgreMain/src/OgreSceneManager.cpp\
    ogre/OgreMain/src/OgreSceneManagerEnumerator.cpp\
    ogre/OgreMain/src/OgreSceneNode.cpp\
    ogre/OgreMain/src/OgreSceneQuery.cpp\
    ogre/OgreMain/src/OgreScriptCompiler.cpp\
    ogre/OgreMain/src/OgreScriptLexer.cpp\
    ogre/OgreMain/src/OgreScriptParser.cpp\
    ogre/OgreMain/src/OgreScriptTranslator.cpp\
    ogre/OgreMain/src/OgreSearchOps.cpp\
    ogre/OgreMain/src/OgreSerializer.cpp\
    ogre/OgreMain/src/OgreShadowCameraSetup.cpp\
    ogre/OgreMain/src/OgreShadowCameraSetupFocused.cpp\
    ogre/OgreMain/src/OgreShadowCameraSetupLiSPSM.cpp\
    ogre/OgreMain/src/OgreShadowCameraSetupPlaneOptimal.cpp\
    ogre/OgreMain/src/OgreShadowCameraSetupPSSM.cpp\
    ogre/OgreMain/src/OgreShadowCaster.cpp\
    ogre/OgreMain/src/OgreShadowTextureManager.cpp\
    ogre/OgreMain/src/OgreShadowVolumeExtrudeProgram.cpp\
    ogre/OgreMain/src/OgreSimpleRenderable.cpp\
    ogre/OgreMain/src/OgreSimpleSpline.cpp\
    ogre/OgreMain/src/OgreSkeleton.cpp\
    ogre/OgreMain/src/OgreSkeletonInstance.cpp\
    ogre/OgreMain/src/OgreSkeletonManager.cpp\
    ogre/OgreMain/src/OgreSkeletonSerializer.cpp\
    ogre/OgreMain/src/OgreSmallVector.cpp\
    ogre/OgreMain/src/OgreStaticGeometry.cpp\
    ogre/OgreMain/src/OgreStreamSerialiser.cpp\
    ogre/OgreMain/src/OgreString.cpp\
    ogre/OgreMain/src/OgreStringConverter.cpp\
    ogre/OgreMain/src/OgreStringInterface.cpp\
    ogre/OgreMain/src/OgreSubEntity.cpp\
    ogre/OgreMain/src/OgreSubMesh.cpp\
    ogre/OgreMain/src/OgreTagPoint.cpp\
    ogre/OgreMain/src/OgreTangentSpaceCalc.cpp\
    ogre/OgreMain/src/OgreTechnique.cpp\
    ogre/OgreMain/src/OgreTextAreaOverlayElement.cpp\
    ogre/OgreMain/src/OgreTexture.cpp\
    ogre/OgreMain/src/OgreTextureManager.cpp\
    ogre/OgreMain/src/OgreTextureUnitState.cpp\
    ogre/OgreMain/src/OgreUnifiedHighLevelGpuProgram.cpp\
    ogre/OgreMain/src/OgreUserObjectBindings.cpp\
    ogre/OgreMain/src/OgreUTFString.cpp\
    ogre/OgreMain/src/OgreVector2.cpp\
    ogre/OgreMain/src/OgreVector3.cpp\
    ogre/OgreMain/src/OgreVector4.cpp\
    ogre/OgreMain/src/OgreVertexIndexData.cpp\
    ogre/OgreMain/src/OgreViewport.cpp\
    ogre/OgreMain/src/OgreWindowEventUtilities.cpp\
    ogre/OgreMain/src/OgreWireBoundingBox.cpp\
    ogre/OgreMain/src/OgreWorkQueue.cpp\
    ogre/OgreMain/src/OgreZip.cpp\
    ogre/OgreMain/src/OgreStringSerialiser.cpp\
    ogre/OgreMain/src/Android/OgreTimer.cpp\
    ogre/OgreMain/src/Android/OgreConfigDialog.cpp\
    ogre/OgreMain/src/Android/OgreErrorDialog.cpp\
    ogre/OgreMain/src/Threading/OgreDefaultWorkQueueStandard.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderExIntegratedPSSM3.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderExLayeredBlending.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderExNormalMapLighting.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderExPerPixelLighting.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderExHardwareSkinning.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderFFPColour.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderFFPFog.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderFFPLighting.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderFFPRenderStateBuilder.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderFFPTexturing.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderFFPTransform.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderFunction.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderFunctionAtom.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderGenerator.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderGLSLESProgramProcessor.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderGLSLESProgramWriter.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderMaterialSerializerListener.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderParameter.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderProgram.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderProgramManager.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderProgramProcessor.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderProgramSet.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderProgramWriter.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderProgramWriterManager.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderRenderState.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderScriptTranslator.cpp\
    ogre/Components/RTShaderSystem/src/OgreShaderSubRenderState.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2Context.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2DefaultHardwareBufferManager.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2DepthBuffer.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2EngineDll.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2FBOMultiRenderTarget.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2FBORenderTexture.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2FrameBufferObject.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2GpuProgram.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2GpuProgramManager.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2HardwareBufferManager.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2HardwareIndexBuffer.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2HardwareOcclusionQuery.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2HardwarePixelBuffer.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2HardwareVertexBuffer.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2PixelFormat.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2Plugin.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2RenderSystem.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2RenderTexture.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2Support.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2Texture.cpp\
    ogre/RenderSystems/GLES2/src/OgreGLES2TextureManager.cpp\
    ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESExtSupport.cpp\
    ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESGpuProgram.cpp\
    ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESLinkProgram.cpp\
    ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESLinkProgramManager.cpp\
    ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESProgramCommon.cpp\
    ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESPreprocessor.cpp\
    ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESProgram.cpp\
    ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESProgramFactory.cpp\
    ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESProgramManagerCommon.cpp\
    ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESProgramPipeline.cpp\
    ogre/RenderSystems/GLES2/src/GLSLES/src/OgreGLSLESProgramPipelineManager.cpp\
    ogre/RenderSystems/GLES2/src/Android/OgreAndroidGLContext.cpp\
    ogre/RenderSystems/GLES2/src/Android/OgreAndroidGLSupport.cpp\
    ogre/RenderSystems/GLES2/src/Android/OgreAndroidWindow.cpp\
    ogre/PlugIns/ParticleFX/src/OgreAreaEmitter.cpp\
    ogre/PlugIns/ParticleFX/src/OgreBoxEmitter.cpp\
    ogre/PlugIns/ParticleFX/src/OgreColourFaderAffector.cpp\
    ogre/PlugIns/ParticleFX/src/OgreColourFaderAffector2.cpp\
    ogre/PlugIns/ParticleFX/src/OgreColourImageAffector.cpp\
    ogre/PlugIns/ParticleFX/src/OgreColourInterpolatorAffector.cpp\
    ogre/PlugIns/ParticleFX/src/OgreCylinderEmitter.cpp\
    ogre/PlugIns/ParticleFX/src/OgreDeflectorPlaneAffector.cpp\
    ogre/PlugIns/ParticleFX/src/OgreDirectionRandomiserAffector.cpp\
    ogre/PlugIns/ParticleFX/src/OgreEllipsoidEmitter.cpp\
    ogre/PlugIns/ParticleFX/src/OgreHollowEllipsoidEmitter.cpp\
    ogre/PlugIns/ParticleFX/src/OgreLinearForceAffector.cpp\
    ogre/PlugIns/ParticleFX/src/OgreParticleFXPlugin.cpp\
    ogre/PlugIns/ParticleFX/src/OgrePointEmitter.cpp\
    ogre/PlugIns/ParticleFX/src/OgreRingEmitter.cpp\
    ogre/PlugIns/ParticleFX/src/OgreRotationAffector.cpp\
    ogre/PlugIns/ParticleFX/src/OgreScaleAffector.cpp
 
LOCAL_STATIC_LIBRARIES := libfreeimage libft2 libzzip
 
include $(BUILD_SHARED_LIBRARY)

Application.mk

APP_OPTIM := release
APP_PLATFORM := android-8
APP_PLATFORM := gnustl_static
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -DANDROID
APP_MODULES := ogre

编译前,做一些小的修改,ogre/Components/RTShaderSystem/OgreShaderGLSLESProgramWriter.cpp,在头文件包含中加入一行:

#include “OgreLogManager.h”

进入目录OGRE,执行ndk-build -j4。到此大功告成。

5.后记

移植并不是很完美,FreeImage很多图片格式无法支持,有点遗憾。移植好的代码我放到了Github上,地址是 https://github.com/cloudstrifegit/ogre-android,欢迎指正。

你可能感兴趣的:(Ogre3D 1.8.1 Android移植)