From bcf3e45ff68a071afa248a659ab5dd1bd6a44a88 Mon Sep 17 00:00:00 2001 From: Jason Hooks Date: Wed, 18 Jan 2012 22:00:03 -0500 Subject: [PATCH 01/19] Proper buffer designation --- apps/openmw/mwrender/npcanimation.cpp | 1 + components/nifogre/ogre_nif_loader.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 0ff679507c..063ecbc841 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -79,6 +79,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, MWWorld::Environment& _env,O } textmappings = NIFLoader::getSingletonPtr()->getTextIndices(smodel); insert->attachObject(base); + if(female) insert->scale(race->data.height.female, race->data.height.female, race->data.height.female); diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 92a5713a3a..4c28656429 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -220,7 +220,7 @@ void NIFLoader::createMaterial(const String &name, //Hardware Skinning code, textures may be the wrong color if enabled - /*if(!mSkel.isNull()){ + /* if(!mSkel.isNull()){ material->removeAllTechniques(); Ogre::Technique* tech = material->createTechnique(); @@ -358,7 +358,7 @@ void NIFLoader::createOgreSubMesh(NiTriShape *shape, const String &material, std HardwareVertexBufferSharedPtr vbuf = HardwareBufferManager::getSingleton().createVertexBuffer( VertexElement::getTypeSize(VET_FLOAT3), - numVerts, HardwareBuffer::HBU_STATIC_WRITE_ONLY, false); + numVerts, HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, false); if(flip) { @@ -391,7 +391,7 @@ void NIFLoader::createOgreSubMesh(NiTriShape *shape, const String &material, std decl->addElement(nextBuf, 0, VET_FLOAT3, VES_NORMAL); vbuf = HardwareBufferManager::getSingleton().createVertexBuffer( VertexElement::getTypeSize(VET_FLOAT3), - numVerts, HardwareBuffer::HBU_STATIC_WRITE_ONLY, false); + numVerts, HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, false); if(flip) { From a301fc355e13fd906152b9d2db2145e220b7316a Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Sun, 29 Jan 2012 23:28:05 +0400 Subject: [PATCH 02/19] Feature #162 - Need to create app bundle using CMake, not by hand In progress. Still need to handle dynamically loaded libs (Ogre & Qt plugins) --- CMakeLists.txt | 129 +++++++++++++++++++++++++++---------- apps/openmw/CMakeLists.txt | 4 -- 2 files changed, 96 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 723d10b347..156035ccbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,38 @@ project(OpenMW) -IF (APPLE) - set(APP_BUNDLE_DIR "${OpenMW_BINARY_DIR}/OpenMW.app") +if (APPLE) + set(APP_BUNDLE_NAME "${CMAKE_PROJECT_NAME}.app") + + set(APP_BUNDLE_DIR "${OpenMW_BINARY_DIR}/${APP_BUNDLE_NAME}") # using 10.6 sdk set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk") -ENDIF (APPLE) + + # This override needed to handle cases where some dependencies already fixed up, + # so BundleUtilities cannot find them + + #function(gp_resolve_item_override context item exepath dirs resolved_item resolved) + # message(STATUS "gp_resolve_item_override for ${item} with ${exepath} and ${dirs}") + # if(item MATCHES "@executable_path" AND resolved) + # if (item MATCHES "Frameworks") # if it is a framework + # # get last segment of path + # get_filename_component(fname "${item}" NAME_WE) + # # now cycle through dirs + # find_library(ri NAMES ${fname} PATHS ${exepath} ${dirs}) + # if (ri) + # message(STATUS "found ${ri} for ${item}") + # set(${resolved_item_var} ri) + # endif() + # endif() + # endif() + #endfunction(gp_resolve_item_override) + + #gp_resolve_item_override("" "@executable_path/../Frameworks/Ogre.framework" + # /Users/corristo/Projects/OpenMW/build/OpenMW.app/Contents/MacOS + # "" + # "" + # "") +endif (APPLE) # Macros @@ -268,36 +295,6 @@ if (CMAKE_COMPILER_IS_GNUCC) add_definitions (-Wall) endif (CMAKE_COMPILER_IS_GNUCC) -# Apple bundling -# TODO REWRITE! -if (APPLE) - set(MISC_FILES - ${APP_BUNDLE_DIR}/Contents/MacOS/openmw.cfg - ${APP_BUNDLE_DIR}/Contents/MacOS/plugins.cfg) - - set(OGRE_PLUGINS - ${APP_BUNDLE_DIR}/Contents/Plugins/*) - -install(FILES ${MISC_FILES} DESTINATION ../MacOS) -install(DIRECTORY "${APP_BUNDLE_DIR}/Contents/Plugins" DESTINATION ..) -install(DIRECTORY "${APP_BUNDLE_DIR}/Contents/Resources/resources" DESTINATION ../Resources) -set(CPACK_GENERATOR "Bundle") -set(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/files/mac/Info.plist") -set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/files/mac/openmw.icns") -set(CPACK_BUNDLE_NAME "OpenMW") -set(CPACK_PACKAGE_VERSION ${OPENMW_VERSION}) -set(CPACK_PACKAGE_VERSION_MAJOR ${OPENMW_VERSION_MAJOR}) -set(CPACK_PACKAGE_VERSION_MINOR ${OPENMW_VERSION_MINO}) -set(CPACK_PACKAGE_VERSION_PATCH ${OPENMW_VERSION_RELEASE}) - -include(CPack) - -set(CMAKE_EXE_LINKER_FLAGS "-arch i386") -set(CMAKE_CXX_FLAGS "-arch i386") - -endif (APPLE) - - if(DPKG_PROGRAM) SET(CMAKE_INSTALL_PREFIX "/usr") @@ -405,3 +402,69 @@ if (WIN32) #set_target_properties(openmw PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") #set_target_properties(openmw PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS") endif() + +# Apple bundling +# TODO REWRITE! +if (APPLE) + set(MISC_FILES + ${APP_BUNDLE_DIR}/Contents/MacOS/openmw.cfg + ${APP_BUNDLE_DIR}/Contents/MacOS/plugins.cfg) + + set(OGRE_PLUGINS + ${APP_BUNDLE_DIR}/Contents/Plugins/*) + +#install(FILES ${MISC_FILES} DESTINATION ../MacOS) +#install(DIRECTORY "${APP_BUNDLE_DIR}/Contents/Plugins" DESTINATION ..) +#install(DIRECTORY "${APP_BUNDLE_DIR}/Contents/Resources/resources" DESTINATION ../Resources) +install(DIRECTORY "${APP_BUNDLE_DIR}" DESTINATION . COMPONENT Runtime) +set(CPACK_GENERATOR "DragNDrop") +# set(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/files/mac/Info.plist") +# set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/files/mac/openmw.icns") +# set(CPACK_BUNDLE_NAME "OpenMW") +set(CPACK_PACKAGE_VERSION ${OPENMW_VERSION}) +set(CPACK_PACKAGE_VERSION_MAJOR ${OPENMW_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${OPENMW_VERSION_MINO}) +set(CPACK_PACKAGE_VERSION_PATCH ${OPENMW_VERSION_RELEASE}) + +set(APPS "\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_NAME}") +set(DIRS "") + +INSTALL(CODE " + set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES}) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set(CMAKE_SYSTEM_FRAMEWORK_PATH ${CMAKE_SYSTEM_FRAMEWORK_PATH}) + + set(OPENMW_RESOLVED_ITEMS \"\") + + function(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var) + if(item MATCHES \"@executable_path\" AND NOT \${\${resolved_var}}) + if (item MATCHES \"Frameworks\") # if it is a framework + # get last segment of path + get_filename_component(fname \"\${item}\" NAME_WE) + find_library(ri NAMES \${fname} PATHS \${exepath} \${dirs} /Library/Frameworks) + if (ri) + message(STATUS \"found \${ri} for \${item}\") + string(REGEX REPLACE \"^.*/Frameworks/.*\\\\.framework\" \"\" item_part \${item}) + set(ri \"\${ri}\${item_part}\") + set(\${resolved_item_var} \${ri} PARENT_SCOPE) + set(\${resolved_var} 1 PARENT_SCOPE) + set(OPENMW_RESOLVED_ITEMS \${_OPENMW_RESOLVED_ITEMS} \${ri}) + endif() + else() + # code path for standard (non-framework) libs (ogre & qt pugins) + endif() + endif() + endfunction(gp_resolve_item_override) + + cmake_policy(SET CMP0009 OLD) + set(BU_CHMOD_BUNDLE_ITEMS ON) + include(BundleUtilities) + fixup_bundle(\"${APPS}\" \"\" \"${DIRS}\") + " COMPONENT Runtime) + +include(CPack) + +set(CMAKE_EXE_LINKER_FLAGS "-arch i386") +set(CMAKE_CXX_FLAGS "-arch i386") + +endif (APPLE) \ No newline at end of file diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index e9e548c0ec..d8fe3deb5b 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -86,10 +86,6 @@ target_link_libraries(openmw if(APPLE) find_library(CARBON_FRAMEWORK Carbon) target_link_libraries(openmw ${CARBON_FRAMEWORK}) - install(TARGETS openmw - BUNDLE DESTINATION . - RUNTIME DESTINATION ../MacOS - COMPONENT Runtime) endif(APPLE) if(DPKG_PROGRAM) From 705b2955a0c522036fba85cea90df982900d16cb Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Mon, 30 Jan 2012 00:28:02 +0400 Subject: [PATCH 03/19] Feature #162 - Need to create app bundle using CMake, not by hand. In progress, working towards plugins support. --- CMakeLists.txt | 57 ++++++++++++++++---------------------------- files/mac/Info.plist | 2 +- 2 files changed, 21 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 156035ccbd..740ec83bd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,31 +7,6 @@ if (APPLE) # using 10.6 sdk set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk") - - # This override needed to handle cases where some dependencies already fixed up, - # so BundleUtilities cannot find them - - #function(gp_resolve_item_override context item exepath dirs resolved_item resolved) - # message(STATUS "gp_resolve_item_override for ${item} with ${exepath} and ${dirs}") - # if(item MATCHES "@executable_path" AND resolved) - # if (item MATCHES "Frameworks") # if it is a framework - # # get last segment of path - # get_filename_component(fname "${item}" NAME_WE) - # # now cycle through dirs - # find_library(ri NAMES ${fname} PATHS ${exepath} ${dirs}) - # if (ri) - # message(STATUS "found ${ri} for ${item}") - # set(${resolved_item_var} ri) - # endif() - # endif() - # endif() - #endfunction(gp_resolve_item_override) - - #gp_resolve_item_override("" "@executable_path/../Frameworks/Ogre.framework" - # /Users/corristo/Projects/OpenMW/build/OpenMW.app/Contents/MacOS - # "" - # "" - # "") endif (APPLE) # Macros @@ -227,6 +202,13 @@ include_directories("." link_directories(${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR}) +if(APPLE) + # List used Ogre plugins + SET(USED_OGRE_PLUGINS "RenderSystem_GL" + "Plugin_OctreeSceneManager" + "Plugin_ParticleFX") +endif(APPLE) + add_subdirectory( extern/caelum ) add_subdirectory( extern/mygui_3.0.1 ) @@ -270,22 +252,17 @@ if (APPLE) "${OpenMW_BINARY_DIR}/plugins.cfg") configure_file(${OpenMW_SOURCE_DIR}/files/mac/Info.plist - "${APP_BUNDLE_DIR}/Contents/Info.plist" COPYONLY) + "${APP_BUNDLE_DIR}/Contents/Info.plist") configure_file(${OpenMW_SOURCE_DIR}/files/mac/openmw.icns "${APP_BUNDLE_DIR}/Contents/Resources/OpenMW.icns" COPYONLY) - # prepare plugins - configure_file(${OGRE_PLUGIN_DIR}/RenderSystem_GL.dylib - "${APP_BUNDLE_DIR}/Contents/Plugins/RenderSystem_GL.dylib" COPYONLY) - - configure_file(${OGRE_PLUGIN_DIR}/Plugin_OctreeSceneManager.dylib - "${APP_BUNDLE_DIR}/Contents/Plugins/Plugin_OctreeSceneManager.dylib" COPYONLY) - - configure_file(${OGRE_PLUGIN_DIR}/Plugin_ParticleFX.dylib - "${APP_BUNDLE_DIR}/Contents/Plugins/Plugin_ParticleFX.dylib" COPYONLY) - + foreach(plugin ${USED_OGRE_PLUGINS}) + configure_file("${OGRE_PLUGIN_DIR}/${plugin}.dylib" + "${APP_BUNDLE_DIR}/Contents/Plugins/${plugin}.dylib" + COPYONLY) + endforeach() endif (APPLE) @@ -427,6 +404,12 @@ set(CPACK_PACKAGE_VERSION_MINOR ${OPENMW_VERSION_MINO}) set(CPACK_PACKAGE_VERSION_PATCH ${OPENMW_VERSION_RELEASE}) set(APPS "\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_NAME}") +set(PLUGINS "") + +foreach(plugin ${USED_OGRE_PLUGINS}) + set(PLUGINS ${PLUGINS} "\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_NAME}/Contents/Plugins/${plugin}.dylib") +endforeach() + set(DIRS "") INSTALL(CODE " @@ -459,7 +442,7 @@ INSTALL(CODE " cmake_policy(SET CMP0009 OLD) set(BU_CHMOD_BUNDLE_ITEMS ON) include(BundleUtilities) - fixup_bundle(\"${APPS}\" \"\" \"${DIRS}\") + fixup_bundle(\"${APPS}\" \"${PLUGINS}\" \"${DIRS}\") " COMPONENT Runtime) include(CPack) diff --git a/files/mac/Info.plist b/files/mac/Info.plist index 1872425e7c..bc7efd0754 100644 --- a/files/mac/Info.plist +++ b/files/mac/Info.plist @@ -19,7 +19,7 @@ CFBundleSignature ???? CFBundleVersion - 0.10 + ${OPENMW_VERSION} CSResourcesFileMapped LSRequiresCarbon From 4fe31fbd61d112fd01838027c1e64c88c01ec69f Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Sun, 29 Jan 2012 23:08:02 +0100 Subject: [PATCH 04/19] Simple windows packaging with CPack (NSIS) --- CMakeLists.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 723d10b347..b221811484 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -351,6 +351,34 @@ if(DPKG_PROGRAM) include(CPack) endif(DPKG_PROGRAM) +if(WIN32) + FILE(GLOB files "${OpenMW_BINARY_DIR}/Release/*.*") + INSTALL(FILES ${files} DESTINATION ".") + INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "." RENAME "openmw.cfg") + INSTALL(FILES "${OpenMW_BINARY_DIR}/launcher.cfg" "${OpenMW_BINARY_DIR}/launcher.qss" DESTINATION ".") + INSTALL(FILES "${OpenMW_BINARY_DIR}/vcredist_x86.exe" DESTINATION "redist") + INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ".") + + SET(CPACK_GENERATOR "NSIS") + SET(CPACK_PACKAGE_NAME "OpenMW") + SET(CPACK_PACKAGE_VENDOR "OpenMW.org") + SET(CPACK_PACKAGE_VERSION ${OPENMW_VERSION}) + SET(CPACK_PACKAGE_VERSION_MAJOR ${OPENMW_VERSION_MAJOR}) + SET(CPACK_PACKAGE_VERSION_MINOR ${OPENMW_VERSION_MINO}) + SET(CPACK_PACKAGE_VERSION_PATCH ${OPENMW_VERSION_RELEASE}) + SET(CPACK_PACKAGE_EXECUTABLES "openmw;OpenMW;esmtool;Esmtool;omwlauncher;OpenMW Launcher") + SET(CPACK_PACKAGE_DESCRIPTION_FILE "${OpenMW_SOURCE_DIR}/readme.txt") + SET(CPACK_RESOURCE_FILE_LICENSE "${OpenMW_SOURCE_DIR}/GPL3.txt") + SET(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") + SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\redist\\\\vcredist_x86.exe\\\" /q'" ) + SET(CPACK_NSIS_DISPLAY_NAME "OpenMW") + SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.openmw.org") + SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.openmw.org") + SET(CPACK_NSIS_INSTALLED_ICON_NAME "omwlauncher.exe") + + include(CPack) +endif(WIN32) + # Components add_subdirectory (components) From 72c4f752127ced4508e791d367fee8af8ccbe58d Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Sun, 29 Jan 2012 23:12:40 +0100 Subject: [PATCH 05/19] Only install redist if it exists --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b221811484..40752c7f57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -356,7 +356,6 @@ if(WIN32) INSTALL(FILES ${files} DESTINATION ".") INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "." RENAME "openmw.cfg") INSTALL(FILES "${OpenMW_BINARY_DIR}/launcher.cfg" "${OpenMW_BINARY_DIR}/launcher.qss" DESTINATION ".") - INSTALL(FILES "${OpenMW_BINARY_DIR}/vcredist_x86.exe" DESTINATION "redist") INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ".") SET(CPACK_GENERATOR "NSIS") @@ -370,12 +369,16 @@ if(WIN32) SET(CPACK_PACKAGE_DESCRIPTION_FILE "${OpenMW_SOURCE_DIR}/readme.txt") SET(CPACK_RESOURCE_FILE_LICENSE "${OpenMW_SOURCE_DIR}/GPL3.txt") SET(CPACK_NSIS_EXECUTABLES_DIRECTORY ".") - SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\redist\\\\vcredist_x86.exe\\\" /q'" ) SET(CPACK_NSIS_DISPLAY_NAME "OpenMW") SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.openmw.org") SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.openmw.org") SET(CPACK_NSIS_INSTALLED_ICON_NAME "omwlauncher.exe") + if(EXISTS "${OpenMW_BINARY_DIR}/vcredist_x86.exe") + INSTALL(FILES "${OpenMW_BINARY_DIR}/vcredist_x86.exe" DESTINATION "redist") + SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait '\\\"$INSTDIR\\\\redist\\\\vcredist_x86.exe\\\" /q'" ) + endif(EXISTS "${OpenMW_BINARY_DIR}/vcredist_x86.exe") + include(CPack) endif(WIN32) From 472d88e2c558f5dbcf96cf99f1b8b026b8506efb Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Wed, 1 Feb 2012 20:48:13 +0400 Subject: [PATCH 06/19] Feature #162 - Need to create app bundle using CMake, not by hand WIP --- CMakeLists.txt | 104 +++++++++++++++++++---------------- apps/launcher/CMakeLists.txt | 18 ++++++ 2 files changed, 74 insertions(+), 48 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 740ec83bd0..50ed5e1c19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -381,69 +381,77 @@ if (WIN32) endif() # Apple bundling -# TODO REWRITE! if (APPLE) set(MISC_FILES ${APP_BUNDLE_DIR}/Contents/MacOS/openmw.cfg ${APP_BUNDLE_DIR}/Contents/MacOS/plugins.cfg) - set(OGRE_PLUGINS - ${APP_BUNDLE_DIR}/Contents/Plugins/*) + #install(FILES ${MISC_FILES} DESTINATION ../MacOS) + #install(DIRECTORY "${APP_BUNDLE_DIR}/Contents/Plugins" DESTINATION ..) + #install(DIRECTORY "${APP_BUNDLE_DIR}/Contents/Resources/resources" DESTINATION ../Resources) + install(DIRECTORY "${APP_BUNDLE_DIR}" USE_SOURCE_PERMISSIONS DESTINATION . COMPONENT Runtime) + set(CPACK_GENERATOR "DragNDrop") + # set(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/files/mac/Info.plist") + # set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/files/mac/openmw.icns") + # set(CPACK_BUNDLE_NAME "OpenMW") + set(CPACK_PACKAGE_VERSION ${OPENMW_VERSION}) + set(CPACK_PACKAGE_VERSION_MAJOR ${OPENMW_VERSION_MAJOR}) + set(CPACK_PACKAGE_VERSION_MINOR ${OPENMW_VERSION_MINO}) + set(CPACK_PACKAGE_VERSION_PATCH ${OPENMW_VERSION_RELEASE}) -#install(FILES ${MISC_FILES} DESTINATION ../MacOS) -#install(DIRECTORY "${APP_BUNDLE_DIR}/Contents/Plugins" DESTINATION ..) -#install(DIRECTORY "${APP_BUNDLE_DIR}/Contents/Resources/resources" DESTINATION ../Resources) -install(DIRECTORY "${APP_BUNDLE_DIR}" DESTINATION . COMPONENT Runtime) -set(CPACK_GENERATOR "DragNDrop") -# set(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/files/mac/Info.plist") -# set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/files/mac/openmw.icns") -# set(CPACK_BUNDLE_NAME "OpenMW") -set(CPACK_PACKAGE_VERSION ${OPENMW_VERSION}) -set(CPACK_PACKAGE_VERSION_MAJOR ${OPENMW_VERSION_MAJOR}) -set(CPACK_PACKAGE_VERSION_MINOR ${OPENMW_VERSION_MINO}) -set(CPACK_PACKAGE_VERSION_PATCH ${OPENMW_VERSION_RELEASE}) + set(APPS "\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_NAME}") + set(PLUGINS "") -set(APPS "\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_NAME}") -set(PLUGINS "") + # Scan Plugins dir for *.dylibs + file(GLOB ALL_PLUGINS "${APP_BUNDLE_DIR}/Contents/Plugins/*.dylib") -foreach(plugin ${USED_OGRE_PLUGINS}) - set(PLUGINS ${PLUGINS} "\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_NAME}/Contents/Plugins/${plugin}.dylib") -endforeach() + foreach(PLUGIN ${ALL_PLUGINS}) + get_filename_component(PLUGIN_FILENAME ${PLUGIN} NAME) + set(PLUGINS ${PLUGINS} "\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_NAME}/Contents/Plugins/${PLUGIN_FILENAME}") + endforeach() -set(DIRS "") + #For now, search unresolved dependencies only in default system paths, so if you put unresolveable (i.e. with @executable_path in id name) lib or framework somewhere else, it would fail + set(DIRS "") -INSTALL(CODE " - set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES}) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - set(CMAKE_SYSTEM_FRAMEWORK_PATH ${CMAKE_SYSTEM_FRAMEWORK_PATH}) + # Overriding item resolving during installation, it needed if + # some library already has be "fixed up", i.e. its id name contains @executable_path, + # but library is not embedded in bundle. For example, it's Ogre.framework from Ogre SDK. + # Current implementation of GetPrerequsities/BundleUtilities doesn't handle that case. + # + # Current limitations: + # 1. Handles only frameworks, not simple libs + INSTALL(CODE " + set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES}) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set(CMAKE_SYSTEM_FRAMEWORK_PATH ${CMAKE_SYSTEM_FRAMEWORK_PATH}) - set(OPENMW_RESOLVED_ITEMS \"\") + set(OPENMW_RESOLVED_ITEMS \"\") - function(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var) - if(item MATCHES \"@executable_path\" AND NOT \${\${resolved_var}}) - if (item MATCHES \"Frameworks\") # if it is a framework - # get last segment of path - get_filename_component(fname \"\${item}\" NAME_WE) - find_library(ri NAMES \${fname} PATHS \${exepath} \${dirs} /Library/Frameworks) - if (ri) - message(STATUS \"found \${ri} for \${item}\") - string(REGEX REPLACE \"^.*/Frameworks/.*\\\\.framework\" \"\" item_part \${item}) - set(ri \"\${ri}\${item_part}\") - set(\${resolved_item_var} \${ri} PARENT_SCOPE) - set(\${resolved_var} 1 PARENT_SCOPE) - set(OPENMW_RESOLVED_ITEMS \${_OPENMW_RESOLVED_ITEMS} \${ri}) + function(gp_resolve_item_override context item exepath dirs resolved_item_var resolved_var) + if(item MATCHES \"@executable_path\" AND NOT \${\${resolved_var}}) + if (item MATCHES \"Frameworks\") # if it is a framework + # get last segment of path + get_filename_component(fname \"\${item}\" NAME_WE) + find_library(ri NAMES \${fname} PATHS \${exepath} \${dirs} /Library/Frameworks) + if (ri) + message(STATUS \"found \${ri} for \${item}\") + string(REGEX REPLACE \"^.*/Frameworks/.*\\\\.framework\" \"\" item_part \${item}) + set(ri \"\${ri}\${item_part}\") + set(\${resolved_item_var} \${ri} PARENT_SCOPE) + set(\${resolved_var} 1 PARENT_SCOPE) + set(OPENMW_RESOLVED_ITEMS \${_OPENMW_RESOLVED_ITEMS} \${ri}) + endif() + else() + # code path for standard (non-framework) libs (ogre & qt pugins) endif() - else() - # code path for standard (non-framework) libs (ogre & qt pugins) endif() - endif() - endfunction(gp_resolve_item_override) + endfunction(gp_resolve_item_override) - cmake_policy(SET CMP0009 OLD) - set(BU_CHMOD_BUNDLE_ITEMS ON) - include(BundleUtilities) - fixup_bundle(\"${APPS}\" \"${PLUGINS}\" \"${DIRS}\") - " COMPONENT Runtime) + cmake_policy(SET CMP0009 OLD) + set(BU_CHMOD_BUNDLE_ITEMS ON) + include(BundleUtilities) + fixup_bundle(\"${APPS}\" \"${PLUGINS}\" \"${DIRS}\") + " COMPONENT Runtime) include(CPack) diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index 2fc3189fc0..235bec6ab3 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -49,6 +49,17 @@ QT4_WRAP_CPP(MOC_SRCS ${LAUNCHER_HEADER_MOC}) include(${QT_USE_FILE}) +# list here plugins that can't be detected statically, but loaded in runtime +# it needed for packaging automatisation +#set(USED_QT_PLUGINS imageformats/libqgif +# imageformats/libqico +# imageformats/libqjpeg +# imageformats/libqmng +# imageformats/libqsvg +# imageformats/libqtga +# imageformats/libqtiff) +# It seems that launcher works without this plugins, but it loads them into memory if they exists + # Main executable add_executable(omwlauncher ${LAUNCHER} @@ -73,6 +84,13 @@ if (APPLE) "${APP_BUNDLE_DIR}/../launcher.qss") configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss "${APP_BUNDLE_DIR}/../launcher.cfg") + + # copy used QT plugins into ${APP_BUNDLE_DIR}/Contents/Plugins + #foreach(PLUGIN ${USED_QT_PLUGINS}) + # get_filename_component(PLUGIN_FILENAME ${PLUGIN} NAME) + # configure_file("${QT_PLUGINS_DIR}/${PLUGIN}.dylib" "${APP_BUNDLE_DIR}/Contents/Plugins/${PLUGIN_FILENAME}.dylib" COPYONLY) + #endforeach() + else() configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launcher.qss") From ee021548050d15219096dba07854f3f932c76603 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 4 Feb 2012 10:48:15 +0100 Subject: [PATCH 07/19] lights without a mesh were not rendered --- apps/openmw/mwclass/light.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp index 3890899b0e..0009c575b1 100644 --- a/apps/openmw/mwclass/light.cpp +++ b/apps/openmw/mwclass/light.cpp @@ -23,19 +23,19 @@ namespace MWClass assert (ref->base != NULL); const std::string &model = ref->base->model; - + + MWRender::Objects& objects = renderingInterface.getObjects(); + objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false); + if (!model.empty()) - { - MWRender::Objects& objects = renderingInterface.getObjects(); - objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false); objects.insertMesh(ptr, "meshes\\" + model); - const int color = ref->base->data.color; - const float r = ((color >> 0) & 0xFF) / 255.0f; - const float g = ((color >> 8) & 0xFF) / 255.0f; - const float b = ((color >> 16) & 0xFF) / 255.0f; - const float radius = float (ref->base->data.radius); - objects.insertLight (ptr, r, g, b, radius); - } + + const int color = ref->base->data.color; + const float r = ((color >> 0) & 0xFF) / 255.0f; + const float g = ((color >> 8) & 0xFF) / 255.0f; + const float b = ((color >> 16) & 0xFF) / 255.0f; + const float radius = float (ref->base->data.radius); + objects.insertLight (ptr, r, g, b, radius); } void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics, MWWorld::Environment& environment) const @@ -43,13 +43,12 @@ namespace MWClass ESMS::LiveCellRef *ref = ptr.get(); - - const std::string &model = ref->base->model; assert (ref->base != NULL); + const std::string &model = ref->base->model; + if(!model.empty()){ physics.insertObjectPhysics(ptr, "meshes\\" + model); } - } void Light::enable (const MWWorld::Ptr& ptr, MWWorld::Environment& environment) const From c471aa950f89bf674a49d7ea2f5a385643954eb5 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 6 Feb 2012 09:42:24 +0100 Subject: [PATCH 08/19] re-enabled batching for statics; fixed a misplaced assert --- apps/openmw/mwclass/static.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwclass/static.cpp b/apps/openmw/mwclass/static.cpp index 946da311da..24d36dc1e1 100644 --- a/apps/openmw/mwclass/static.cpp +++ b/apps/openmw/mwclass/static.cpp @@ -15,11 +15,11 @@ namespace MWClass assert (ref->base != NULL); const std::string &model = ref->base->model; - + if (!model.empty()) { MWRender::Objects& objects = renderingInterface.getObjects(); - objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false); + objects.insertBegin(ptr, ptr.getRefData().isEnabled(), true); objects.insertMesh(ptr, "meshes\\" + model); } } @@ -29,13 +29,12 @@ namespace MWClass ESMS::LiveCellRef *ref = ptr.get(); - - const std::string &model = ref->base->model; assert (ref->base != NULL); + const std::string &model = ref->base->model; + if(!model.empty()){ physics.insertObjectPhysics(ptr, "meshes\\" + model); } - } std::string Static::getName (const MWWorld::Ptr& ptr) const From e1600d9a2a57b235c8b6b2851cd62fa96928e57d Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 6 Feb 2012 10:29:18 +0100 Subject: [PATCH 09/19] fixed movable object cleanup for ordinary objects --- apps/openmw/mwrender/objects.cpp | 19 ++++++++++++++++++- apps/openmw/mwrender/objects.hpp | 9 +++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index 1e3b4dda0e..d04751ff3f 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -23,6 +23,17 @@ bool Objects::lightOutQuadInLin = false; int Objects::uniqueID = 0; +void Objects::clearSceneNode (Ogre::SceneNode *node) +{ + /// \todo This should probably be moved into OpenEngine at some point. + for (int i=node->numAttachedObjects()-1; i>=0; --i) + { + Ogre::MovableObject *object = node->getAttachedObject (i); + node->detachObject (object); + mRend.getScene()->destroyMovableObject (object); + } +} + void Objects::setMwRoot(Ogre::SceneNode* root){ mMwRoot = root; } @@ -59,6 +70,7 @@ void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){ // Rotates first around z, then y, then x insert->setOrientation(xr*yr*zr); + if (!enabled) insert->setVisible (false); ptr.getRefData().setBaseNode(insert); @@ -145,6 +157,7 @@ bool Objects::deleteObject (const MWWorld::Ptr& ptr) mCellSceneNodes.begin()); iter!=mCellSceneNodes.end(); ++iter) if (iter->second==parent) { + clearSceneNode (base); base->removeAndDestroyAllChildren(); mRend.getScene()->destroySceneNode (base); ptr.getRefData().setBaseNode (0); @@ -161,13 +174,16 @@ void Objects::removeCell(MWWorld::Ptr::CellStore* store){ if(mCellSceneNodes.find(store) != mCellSceneNodes.end()) { Ogre::SceneNode* base = mCellSceneNodes[store]; + + for (int i=0; inumChildren(); ++i) + clearSceneNode (static_cast (base->getChild (i))); + base->removeAndDestroyAllChildren(); mCellSceneNodes.erase(store); mRend.getScene()->destroySceneNode(base); base = 0; } - if(mSG.find(store) != mSG.end()) { Ogre::StaticGeometry* sg = mSG[store]; @@ -176,6 +192,7 @@ void Objects::removeCell(MWWorld::Ptr::CellStore* store){ sg = 0; } } + void Objects::buildStaticGeometry(ESMS::CellStore& cell){ if(mSG.find(&cell) != mSG.end()) { diff --git a/apps/openmw/mwrender/objects.hpp b/apps/openmw/mwrender/objects.hpp index 6cd465fdda..737f9acec6 100644 --- a/apps/openmw/mwrender/objects.hpp +++ b/apps/openmw/mwrender/objects.hpp @@ -1,11 +1,12 @@ #ifndef _GAME_RENDER_OBJECTS_H #define _GAME_RENDER_OBJECTS_H -#include "components/esm_store/cell_store.hpp" +#include + +#include #include "../mwworld/refdata.hpp" #include "../mwworld/ptr.hpp" -#include namespace MWRender{ @@ -30,6 +31,10 @@ class Objects{ static float lightQuadraticRadiusMult; static bool lightOutQuadInLin; + + void clearSceneNode (Ogre::SceneNode *node); + ///< Remove all movable objects from \a node. + public: Objects(OEngine::Render::OgreRenderer& _rend): mRend(_rend){} ~Objects(){} From 784c6fe0ffc0e645c97485c1b4cce6aa2f4ff6b2 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 6 Feb 2012 10:41:13 +0100 Subject: [PATCH 10/19] some cleanup --- apps/openmw/mwrender/objects.cpp | 115 ++++++++++++++++--------------- apps/openmw/mwrender/objects.hpp | 8 +-- 2 files changed, 64 insertions(+), 59 deletions(-) diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index d04751ff3f..4e2a3caab2 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -1,11 +1,11 @@ #include "objects.hpp" + #include + #include -using namespace Ogre; using namespace MWRender; - bool Objects::lightConst = false; float Objects::lightConstValue = 0.0f; @@ -30,14 +30,17 @@ void Objects::clearSceneNode (Ogre::SceneNode *node) { Ogre::MovableObject *object = node->getAttachedObject (i); node->detachObject (object); - mRend.getScene()->destroyMovableObject (object); + mRenderer.getScene()->destroyMovableObject (object); } } -void Objects::setMwRoot(Ogre::SceneNode* root){ +void Objects::setMwRoot(Ogre::SceneNode* root) +{ mMwRoot = root; } -void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){ + +void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_) +{ Ogre::SceneNode* root = mMwRoot; Ogre::SceneNode* cellnode; if(mCellSceneNodes.find(ptr.getCell()) == mCellSceneNodes.end()) @@ -60,91 +63,91 @@ void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){ f = ptr.getCellRef().pos.rot; // Rotate around X axis - Quaternion xr(Radian(-f[0]), Vector3::UNIT_X); + Ogre::Quaternion xr(Ogre::Radian(-f[0]), Ogre::Vector3::UNIT_X); // Rotate around Y axis - Quaternion yr(Radian(-f[1]), Vector3::UNIT_Y); + Ogre::Quaternion yr(Ogre::Radian(-f[1]), Ogre::Vector3::UNIT_Y); // Rotate around Z axis - Quaternion zr(Radian(-f[2]), Vector3::UNIT_Z); + Ogre::Quaternion zr(Ogre::Radian(-f[2]), Ogre::Vector3::UNIT_Z); - // Rotates first around z, then y, then x + // Rotates first around z, then y, then x insert->setOrientation(xr*yr*zr); if (!enabled) insert->setVisible (false); ptr.getRefData().setBaseNode(insert); - isStatic = static_; - - + mIsStatic = static_; } -void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh){ + +void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh) +{ Ogre::SceneNode* insert = ptr.getRefData().getBaseNode(); assert(insert); NifOgre::NIFLoader::load(mesh); - Entity *ent = mRend.getScene()->createEntity(mesh); + Ogre::Entity *ent = mRenderer.getScene()->createEntity(mesh); - if(!isStatic) + if(!mIsStatic) { insert->attachObject(ent); } else { Ogre::StaticGeometry* sg = 0; - if(mSG.find(ptr.getCell()) == mSG.end()) + if(mStaticGeometry.find(ptr.getCell()) == mStaticGeometry.end()) { uniqueID = uniqueID +1; - sg = mRend.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID)); + sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID)); //Create the scenenode and put it in the map - mSG[ptr.getCell()] = sg; + mStaticGeometry[ptr.getCell()] = sg; } else { - sg = mSG[ptr.getCell()]; + sg = mStaticGeometry[ptr.getCell()]; } sg->addEntity(ent,insert->_getDerivedPosition(),insert->_getDerivedOrientation(),insert->_getDerivedScale()); sg->setRegionDimensions(Ogre::Vector3(100000,10000,100000)); - - mRend.getScene()->destroyEntity(ent); + mRenderer.getScene()->destroyEntity(ent); } - - } -void Objects::insertLight (const MWWorld::Ptr& ptr, float r, float g, float b, float radius){ - Ogre::SceneNode* insert = mRend.getScene()->getSceneNode(ptr.getRefData().getHandle()); + +void Objects::insertLight (const MWWorld::Ptr& ptr, float r, float g, float b, float radius) +{ + Ogre::SceneNode* insert = mRenderer.getScene()->getSceneNode(ptr.getRefData().getHandle()); assert(insert); - Ogre::Light *light = mRend.getScene()->createLight(); + Ogre::Light *light = mRenderer.getScene()->createLight(); light->setDiffuseColour (r, g, b); float cval=0.0f, lval=0.0f, qval=0.0f; if(lightConst) cval = lightConstValue; - if(!lightOutQuadInLin) - { - if(lightLinear) - radius *= lightLinearRadiusMult; - if(lightQuadratic) - radius *= lightQuadraticRadiusMult; - if(lightLinear) - lval = lightLinearValue / pow(radius, lightLinearMethod); - if(lightQuadratic) - qval = lightQuadraticValue / pow(radius, lightQuadraticMethod); - } - else - { - // FIXME: - // Do quadratic or linear, depending if we're in an exterior or interior - // cell, respectively. Ignore lightLinear and lightQuadratic. - } + if(!lightOutQuadInLin) + { + if(lightLinear) + radius *= lightLinearRadiusMult; + if(lightQuadratic) + radius *= lightQuadraticRadiusMult; - light->setAttenuation(10*radius, cval, lval, qval); + if(lightLinear) + lval = lightLinearValue / pow(radius, lightLinearMethod); + if(lightQuadratic) + qval = lightQuadraticValue / pow(radius, lightQuadraticMethod); + } + else + { + // FIXME: + // Do quadratic or linear, depending if we're in an exterior or interior + // cell, respectively. Ignore lightLinear and lightQuadratic. + } - insert->attachObject(light); + light->setAttenuation(10*radius, cval, lval, qval); + + insert->attachObject(light); } bool Objects::deleteObject (const MWWorld::Ptr& ptr) @@ -159,7 +162,7 @@ bool Objects::deleteObject (const MWWorld::Ptr& ptr) { clearSceneNode (base); base->removeAndDestroyAllChildren(); - mRend.getScene()->destroySceneNode (base); + mRenderer.getScene()->destroySceneNode (base); ptr.getRefData().setBaseNode (0); return true; } @@ -170,7 +173,8 @@ bool Objects::deleteObject (const MWWorld::Ptr& ptr) return true; } -void Objects::removeCell(MWWorld::Ptr::CellStore* store){ +void Objects::removeCell(MWWorld::Ptr::CellStore* store) +{ if(mCellSceneNodes.find(store) != mCellSceneNodes.end()) { Ogre::SceneNode* base = mCellSceneNodes[store]; @@ -180,23 +184,24 @@ void Objects::removeCell(MWWorld::Ptr::CellStore* store){ base->removeAndDestroyAllChildren(); mCellSceneNodes.erase(store); - mRend.getScene()->destroySceneNode(base); + mRenderer.getScene()->destroySceneNode(base); base = 0; } - if(mSG.find(store) != mSG.end()) + if(mStaticGeometry.find(store) != mStaticGeometry.end()) { - Ogre::StaticGeometry* sg = mSG[store]; - mSG.erase(store); - mRend.getScene()->destroyStaticGeometry (sg); + Ogre::StaticGeometry* sg = mStaticGeometry[store]; + mStaticGeometry.erase(store); + mRenderer.getScene()->destroyStaticGeometry (sg); sg = 0; } } -void Objects::buildStaticGeometry(ESMS::CellStore& cell){ - if(mSG.find(&cell) != mSG.end()) +void Objects::buildStaticGeometry(ESMS::CellStore& cell) +{ + if(mStaticGeometry.find(&cell) != mStaticGeometry.end()) { - Ogre::StaticGeometry* sg = mSG[&cell]; + Ogre::StaticGeometry* sg = mStaticGeometry[&cell]; sg->build(); } } diff --git a/apps/openmw/mwrender/objects.hpp b/apps/openmw/mwrender/objects.hpp index 737f9acec6..d58455b9f3 100644 --- a/apps/openmw/mwrender/objects.hpp +++ b/apps/openmw/mwrender/objects.hpp @@ -11,11 +11,11 @@ namespace MWRender{ class Objects{ - OEngine::Render::OgreRenderer &mRend; + OEngine::Render::OgreRenderer &mRenderer; std::map mCellSceneNodes; - std::map mSG; + std::map mStaticGeometry; Ogre::SceneNode* mMwRoot; - bool isStatic; + bool mIsStatic; static int uniqueID; static bool lightConst; static float lightConstValue; @@ -36,7 +36,7 @@ class Objects{ ///< Remove all movable objects from \a node. public: - Objects(OEngine::Render::OgreRenderer& _rend): mRend(_rend){} + Objects(OEngine::Render::OgreRenderer& renderer): mRenderer (renderer){} ~Objects(){} void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_); void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh); From 0b0254d30e053c370d31c1eef5cc27a75819ae18 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 6 Feb 2012 10:48:14 +0100 Subject: [PATCH 11/19] spelling fix --- apps/openmw/mwscript/controlextensions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwscript/controlextensions.cpp b/apps/openmw/mwscript/controlextensions.cpp index 893af259fc..5289be24a3 100644 --- a/apps/openmw/mwscript/controlextensions.cpp +++ b/apps/openmw/mwscript/controlextensions.cpp @@ -48,7 +48,7 @@ namespace MWScript bool enabled = context.getWorld().toggleCollisionMode(); - context.report (enabled ? "Collsion -> On" : "Collision -> Off"); + context.report (enabled ? "Collision -> On" : "Collision -> Off"); } }; From c4e028effe9f02fe5efb3c47647a3b7bc6aede95 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 6 Feb 2012 10:48:58 +0100 Subject: [PATCH 12/19] fixing a faulty include --- apps/openmw/mwscript/controlextensions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwscript/controlextensions.cpp b/apps/openmw/mwscript/controlextensions.cpp index 5289be24a3..384e13e450 100644 --- a/apps/openmw/mwscript/controlextensions.cpp +++ b/apps/openmw/mwscript/controlextensions.cpp @@ -1,5 +1,5 @@ -#include "statsextensions.hpp" +#include "controlextensions.hpp" #include From 597e670eef30025c1e49303dc5ed0afaf87a5304 Mon Sep 17 00:00:00 2001 From: gugus Date: Wed, 8 Feb 2012 00:32:22 +0100 Subject: [PATCH 13/19] corrected the light problem --- apps/openmw/mwrender/renderingmanager.cpp | 13 +++++++++---- apps/openmw/mwrender/renderingmanager.hpp | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index c5cf8be5d9..bc33951e7e 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -54,10 +54,12 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const cameraPitchNode->attachObject(mRendering.getCamera()); mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode); + mSun = 0; } RenderingManager::~RenderingManager () { + //TODO: destroy mSun? delete mPlayer; delete mSkyManager; } @@ -204,12 +206,15 @@ void RenderingManager::configureAmbient(ESMS::CellStore &mCell // Create a "sun" that shines light downwards. It doesn't look // completely right, but leave it for now. - Ogre::Light *light = mRendering.getScene()->createLight(); + if(!mSun) + { + mSun = mRendering.getScene()->createLight(); + } Ogre::ColourValue colour; colour.setAsABGR (mCell.cell->ambi.sunlight); - light->setDiffuseColour (colour); - light->setType(Ogre::Light::LT_DIRECTIONAL); - light->setDirection(0,-1,0); + mSun->setDiffuseColour (colour); + mSun->setType(Ogre::Light::LT_DIRECTIONAL); + mSun->setDirection(0,-1,0); } // Switch through lighting modes. diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index 084f89cb09..ca5d95a3f1 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -118,6 +118,7 @@ class RenderingManager: private RenderingInterface { int mAmbientMode; Ogre::ColourValue mAmbientColor; + Ogre::Light* mSun; /// Root node for all objects added to the scene. This is rotated so /// that the OGRE coordinate system matches that used internally in From 4fcb72105424a81a3ffb33f80be9d667b05d1576 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 10 Feb 2012 14:59:22 +0100 Subject: [PATCH 14/19] openengine update (physics crash workaround --- libs/openengine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/openengine b/libs/openengine index 6c7e5d00e4..4a188f2820 160000 --- a/libs/openengine +++ b/libs/openengine @@ -1 +1 @@ -Subproject commit 6c7e5d00e4f5bf954afe15f10e56f03520abfee4 +Subproject commit 4a188f2820c037ca4ad8ef35492d3857ea8d7df8 From 17b1546dc1694b5419287c7b7d8c5e86a39e83e3 Mon Sep 17 00:00:00 2001 From: Pieter van der Kloet Date: Fri, 10 Feb 2012 19:17:49 +0100 Subject: [PATCH 15/19] Changed the way screenshots are created (Bug #191) --- apps/openmw/engine.cpp | 22 ++++++++++++++++++++++ apps/openmw/engine.hpp | 3 +++ apps/openmw/mwinput/inputmanager.cpp | 15 +-------------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index ee3a6181ae..3579977b04 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -462,6 +462,28 @@ void OMW::Engine::activate() } } +void OMW::Engine::screenshot() +{ + // Count screenshots. + int shotCount = 0; + + const std::string screenshotPath = mCfgMgr.getLocalConfigPath().string(); + + // Find the first unused filename with a do-while + std::ostringstream stream; + do + { + // Reset the stream + stream.str(""); + stream.clear(); + + stream << screenshotPath << "screenshot" << std::setw(3) << std::setfill('0') << shotCount++ << ".png"; + + } while (boost::filesystem::exists(stream.str())); + + mOgre->screenshot(stream.str()); +} + void OMW::Engine::setCompileAll (bool all) { mCompileAll = all; diff --git a/apps/openmw/engine.hpp b/apps/openmw/engine.hpp index 02d108f0ab..88eea728e9 100644 --- a/apps/openmw/engine.hpp +++ b/apps/openmw/engine.hpp @@ -152,6 +152,9 @@ namespace OMW /// Activate the focussed object. void activate(); + /// Write screenshot to file. + void screenshot(); + /// Compile all scripts (excludign dialogue scripts) at startup? void setCompileAll (bool all); diff --git a/apps/openmw/mwinput/inputmanager.cpp b/apps/openmw/mwinput/inputmanager.cpp index e0c819a71a..a5d590b856 100644 --- a/apps/openmw/mwinput/inputmanager.cpp +++ b/apps/openmw/mwinput/inputmanager.cpp @@ -83,27 +83,14 @@ namespace MWInput MWGui::WindowManager &windows; OMW::Engine& mEngine; - // Count screenshots. - int shotCount; - /* InputImpl Methods */ - // Write screenshot to file. void screenshot() { - - // Find the first unused filename with a do-while - char buf[50]; - do - { - snprintf(buf, 50, "screenshot%03d.png", shotCount++); - } while (boost::filesystem::exists(buf)); - - ogre.screenshot(buf); + mEngine.screenshot(); } - /* toggleInventory() is called when the user presses the button to toggle the inventory screen. */ void toggleInventory() { From bc71fb47e018d2c23ce77483d9da646c43bcb7d0 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 10 Feb 2012 21:24:33 +0100 Subject: [PATCH 16/19] minor fix --- apps/openmw/mwinput/inputmanager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/openmw/mwinput/inputmanager.cpp b/apps/openmw/mwinput/inputmanager.cpp index a5d590b856..88534dddae 100644 --- a/apps/openmw/mwinput/inputmanager.cpp +++ b/apps/openmw/mwinput/inputmanager.cpp @@ -170,8 +170,7 @@ namespace MWInput poller(input), player(_player), windows(_windows), - mEngine (engine), - shotCount(0) + mEngine (engine) { using namespace OEngine::Input; using namespace OEngine::Render; From a0ac6e51502368792ee8ddfa3b650dd7366b3760 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 12 Feb 2012 12:35:29 +0100 Subject: [PATCH 17/19] cells were sometimes not fully loaded --- apps/openmw/mwworld/cells.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwworld/cells.cpp b/apps/openmw/mwworld/cells.cpp index 143ce557b5..079c888aa6 100644 --- a/apps/openmw/mwworld/cells.cpp +++ b/apps/openmw/mwworld/cells.cpp @@ -63,10 +63,11 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y) result = mExteriors.insert (std::make_pair ( std::make_pair (x, y), Ptr::CellStore (cell))).first; - - result->second.load (mStore, mReader); } + if (result->second.mState!=Ptr::CellStore::State_Loaded) + result->second.load (mStore, mReader); + return &result->second; } @@ -79,10 +80,11 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getInterior (const std::string& name) const ESM::Cell *cell = mStore.cells.findInt (name); result = mInteriors.insert (std::make_pair (name, Ptr::CellStore (cell))).first; - - result->second.load (mStore, mReader); } + if (result->second.mState!=Ptr::CellStore::State_Loaded) + result->second.load (mStore, mReader); + return &result->second; } From 8829d46bda4f09e365cd97b842abdfe4ef571286 Mon Sep 17 00:00:00 2001 From: Lukasz Gromanowski Date: Sun, 12 Feb 2012 15:45:08 +0100 Subject: [PATCH 18/19] Clean up compilation warnings. Clan up compilation warnings like "variable ... set but not used" introduced in some older and recent commits. Signed-off-by: Lukasz Gromanowski --- apps/esmtool/esmtool_cmd.c | 18 +++++++++--------- apps/openmw/mwgui/journalwindow.cpp | 4 ++-- apps/openmw/mwrender/animation.cpp | 2 +- apps/openmw/mwrender/npcanimation.cpp | 2 +- components/nif/data.hpp | 4 ++-- components/nifogre/ogre_nif_loader.cpp | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/esmtool/esmtool_cmd.c b/apps/esmtool/esmtool_cmd.c index d6556d9e71..3fce77de2b 100644 --- a/apps/esmtool/esmtool_cmd.c +++ b/apps/esmtool/esmtool_cmd.c @@ -926,13 +926,13 @@ int update_arg(void *field, char **orig_field, const char *long_opt, char short_opt, const char *additional_error) { - char *stop_char = 0; - const char *val = value; - int found; + //char *stop_char = 0; + //const char *val = value; + //int found; FIX_UNUSED (field); - stop_char = 0; - found = 0; + //stop_char = 0; + //found = 0; if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given))) { @@ -955,8 +955,8 @@ int update_arg(void *field, char **orig_field, (*prev_given)++; if (field_given) (*field_given)++; - if (possible_values) - val = possible_values[found]; + //if (possible_values) + //val = possible_values[found]; switch(arg_type) { default: @@ -996,7 +996,7 @@ cmdline_parser_internal ( int override; int initialize; - int check_required; + //int check_required; int check_ambiguity; char *optarg; @@ -1008,7 +1008,7 @@ cmdline_parser_internal ( override = params->override; initialize = params->initialize; - check_required = params->check_required; + //check_required = params->check_required; check_ambiguity = params->check_ambiguity; if (initialize) diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index 457a075827..3f3c89f39e 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -32,8 +32,8 @@ book formatText(std::string text,book mBook,int maxLine, int lineSize) mBook.pages.pop_back(); } - std::string::iterator wordBegin = text.begin(); - std::string::iterator wordEnd; + //std::string::iterator wordBegin = text.begin(); + //std::string::iterator wordEnd; std::string cText = text; diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 5a9731d2d1..056550e747 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -499,7 +499,7 @@ namespace MWRender{ std::vector quats = iter->getQuat(); std::vector ttime = iter->gettTime(); - std::vector::iterator ttimeiter = ttime.begin(); + //std::vector::iterator ttimeiter = ttime.begin(); std::vector rtime = iter->getrTime(); int rindexJ = 0; diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 863f7577b7..fe48aa3218 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -267,7 +267,7 @@ void NpcAnimation::runAnimation(float timepassed){ } handleAnimationTransforms(); - Ogre::Vector3 current = insert->_getWorldAABB().getCenter(); + //Ogre::Vector3 current = insert->_getWorldAABB().getCenter(); std::vector*>::iterator shapepartsiter = shapeparts.begin(); std::vector::iterator entitypartsiter = entityparts.begin(); diff --git a/components/nif/data.hpp b/components/nif/data.hpp index 9e28e15344..df90797586 100644 --- a/components/nif/data.hpp +++ b/components/nif/data.hpp @@ -473,7 +473,7 @@ void read(NIFFile *nif) int vertCount = nif->getInt(); nif->getByte(); int magic = nif->getInt(); - int type = nif->getInt(); + /*int type =*/ nif->getInt(); for(int i = 0; i < vertCount; i++){ float x = nif->getFloat(); @@ -485,7 +485,7 @@ void read(NIFFile *nif) for(int i=1; igetInt(); - type = nif->getInt(); + /*type =*/ nif->getInt(); std::vector current; std::vector currentTime; for(int i = 0; i < magic; i++){ diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index c62f59ea3d..2662f0c97a 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -1150,7 +1150,7 @@ void NIFLoader::loadResource(Resource *resource) char suffix = name.at(name.length() - 2); bool addAnim = true; bool hasAnim = false; - bool baddin = false; + //bool baddin = false; bNiTri = true; if(suffix == '*') @@ -1168,7 +1168,7 @@ void NIFLoader::loadResource(Resource *resource) } else if(suffix == '>') { - baddin = true; + //baddin = true; bNiTri = true; std::string sub = name.substr(name.length() - 6, 4); From 5a42c6c6f59242f447a30c3ef9c4721db21f54cd Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Mon, 13 Feb 2012 10:31:43 +0400 Subject: [PATCH 19/19] Feature #162 - Need to create app bundle using CMake, not by hand WIP. Removed libpng dependency from launcher --- CMakeLists.txt | 15 +++++++++------ apps/launcher/CMakeLists.txt | 6 +++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 50ed5e1c19..ef31dae076 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -382,14 +382,17 @@ endif() # Apple bundling if (APPLE) - set(MISC_FILES - ${APP_BUNDLE_DIR}/Contents/MacOS/openmw.cfg - ${APP_BUNDLE_DIR}/Contents/MacOS/plugins.cfg) + set(INSTALL_SUBDIR OpenMW) #install(FILES ${MISC_FILES} DESTINATION ../MacOS) #install(DIRECTORY "${APP_BUNDLE_DIR}/Contents/Plugins" DESTINATION ..) #install(DIRECTORY "${APP_BUNDLE_DIR}/Contents/Resources/resources" DESTINATION ../Resources) - install(DIRECTORY "${APP_BUNDLE_DIR}" USE_SOURCE_PERMISSIONS DESTINATION . COMPONENT Runtime) + install(DIRECTORY "${APP_BUNDLE_DIR}" USE_SOURCE_PERMISSIONS DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) + install(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) + install(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" RENAME "openmw.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) + + install(FILES "${OpenMW_BINARY_DIR}/plugins.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) + install(FILES "${OpenMW_BINARY_DIR}/launcher.qss" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime) set(CPACK_GENERATOR "DragNDrop") # set(CPACK_BUNDLE_PLIST "${CMAKE_SOURCE_DIR}/files/mac/Info.plist") # set(CPACK_BUNDLE_ICON "${CMAKE_SOURCE_DIR}/files/mac/openmw.icns") @@ -399,7 +402,7 @@ if (APPLE) set(CPACK_PACKAGE_VERSION_MINOR ${OPENMW_VERSION_MINO}) set(CPACK_PACKAGE_VERSION_PATCH ${OPENMW_VERSION_RELEASE}) - set(APPS "\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_NAME}") + set(APPS "\${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR}/${APP_BUNDLE_NAME}") set(PLUGINS "") # Scan Plugins dir for *.dylibs @@ -407,7 +410,7 @@ if (APPLE) foreach(PLUGIN ${ALL_PLUGINS}) get_filename_component(PLUGIN_FILENAME ${PLUGIN} NAME) - set(PLUGINS ${PLUGINS} "\${CMAKE_INSTALL_PREFIX}/${APP_BUNDLE_NAME}/Contents/Plugins/${PLUGIN_FILENAME}") + set(PLUGINS ${PLUGINS} "\${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR}/${APP_BUNDLE_NAME}/Contents/Plugins/${PLUGIN_FILENAME}") endforeach() #For now, search unresolved dependencies only in default system paths, so if you put unresolveable (i.e. with @executable_path in id name) lib or framework somewhere else, it would fail diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index 235bec6ab3..e46a062055 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -41,8 +41,8 @@ source_group(launcher FILES ${LAUNCHER} ${LAUNCHER_HEADER} ${LAUNCHER_HEADER_MOC find_package(Qt4 REQUIRED) set(QT_USE_QTGUI 1) -find_package(PNG REQUIRED) -include_directories(${PNG_INCLUDE_DIR}) +#find_package(PNG REQUIRED) +#include_directories(${PNG_INCLUDE_DIR}) QT4_ADD_RESOURCES(RCC_SRCS resources.qrc) QT4_WRAP_CPP(MOC_SRCS ${LAUNCHER_HEADER_MOC}) @@ -71,7 +71,7 @@ target_link_libraries(omwlauncher ${Boost_LIBRARIES} ${OGRE_LIBRARIES} ${QT_LIBRARIES} - ${PNG_LIBRARY} +# ${PNG_LIBRARY} components )