Merge with develop

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 10 years ago
commit 422977be8c

@ -43,7 +43,6 @@ default_c
*.so
*.so.*
*_debug
core
*.pc
*.gch
@ -160,6 +159,7 @@ code/build/*
code/build-2010/*
build/*
install/*
build_vc*
code/nel/tools/build_gamedata/configuration/buildsite.py
# Linux nel compile
@ -203,16 +203,7 @@ code/nel/tools/pacs/build_rbank/build_rbank
code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/skills.skill_tree
code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/xptable.xp_table
code/ryzom/tools/server/sql/ryzom_admin_default_data.sql
code/ryzom/tools/server/ryzom_ams/drupal
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/autoload
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/configs
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/cron
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/img
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/plugins
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/smarty
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/translations
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/libinclude.php
code/ryzom/tools/server/ryzom_ams/www/html/templates_c
# Linux server compile
code/ryzom/server/src/entities_game_service/entities_game_service
@ -226,11 +217,23 @@ code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service
code/ryzom/server/src/tick_service/tick_service
# WebTT temp dir
code/ryzom/tools/server/www/webtt/app/tmp
code\ryzom\tools\server\ryzom_ams\old
# AMS ignore
code/ryzom/tools/server/ryzom_ams/www/config.php
code/ryzom/tools/server/ryzom_ams/www/is_installed
code/web/public_php/ams/is_installed
code/web/docs/ams/html
code/web/public_php/ams/templates_c
code/ryzom/tools/server/ryzom_ams/drupal
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/autoload
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/configs
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/cron
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/img
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/plugins
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/smarty
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/translations
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/libinclude.php
code/ryzom/tools/server/ryzom_ams/old
#tools and external dir's
external
@ -245,3 +248,17 @@ code/nel/tools/build_gamedata/processes/ai_wmap/ai_build_wmap.cfg
code/nel/tools/build_gamedata/processes/sheets/sheets_packer.cfg
code/nel/tools/build_gamedata/processes/rbank/build_rbank.cfg
code/nel/tools/build_gamedata/processes/zone/debug_zone_dependencies.cfg
code/web/public_php/config.php
code/web/public_php/is_installed
code/web/public_php/ams/files
code/web/public_php/db_version_lib
code/web/public_php/db_version_shard
code/web/public_php/db_version_tool
code/web/public_php/db_version_web
code/web/public_php/role_service
code/web/public_php/role_support
code/web/public_php/role_domain
code/web/public_php/db_version_ring
code/web/public_php/config_user.php
code/nel/tools/build_gamedata/processes/pz/build_world_packed_col.cfg
code/nel/tools/build_gamedata/processes/cartographer/island_screenshots.cfg

@ -1,8 +1,8 @@
a409552f83cb55a5c20f867fd7bcae1d0083d01a ryzomcore_0_8_0
a409552f83cb55a5c20f867fd7bcae1d0083d01a ryzomcore_0_8_0
0000000000000000000000000000000000000000 ryzomcore_0_8_0
0000000000000000000000000000000000000000 ryzomcore_0_8_0
4eddbaff0c5e5d685db96ee3e8427aa0fd96ac83 ryzomcore_0_8_0
950d650ca92e6041611258d7e5131ccf661e4ec2 latest-graft-to-default
950d650ca92e6041611258d7e5131ccf661e4ec2 latest-merge-from-default
950d650ca92e6041611258d7e5131ccf661e4ec2 compatibility-merge
4eddbaff0c5e5d685db96ee3e8427aa0fd96ac83 ryzomcore/v0.8.0
00d9b6e29e95f56785fbf85abe60afd34674f402 ryzomcore/v0.9.0
79776c337176dd5b02e1a74fe5dfb703b91747aa ryzomcore/v0.9.1
fedf2aa443d09707beed814b0f499c6a5519cc84 ryzomcore/v0.10.0
edaa3624a56420b02ccc64c26059801a389927ee ryzomcore/v0.11.0
e3fe4855f22c3e75722e015dc33c091c340b3ad7 ryzomcore/v0.11.1
9e583b717fd63be0be9fd60b99087abf1691ea49 ryzomcore/v0.11.2

@ -0,0 +1,5 @@
Ryzom Core is the open-source project related to Ryzom Game. Written in C++, Ryzom Core contains the whole code (client, server, tools) used to make the commercial MMORPG Ryzom. Ryzom Core is a toolkit for the development of massively multiplayer online universes. It provides the base technologies and a set of development methodologies for the development of both client and server code.
Ryzom Core is open source and released under the terms of the GNU Affero General Public License 3.0 (GNU/AGPLv3) for the source code and the Creative Commons Attributions-ShareAlike 3.0 (CC-BY-SA) for the art assets. Which means you can create your own game using Ryzom Core, for more information on doing so check out Creating Your Own Game Using Ryzom Core.

@ -1,8 +1,8 @@
#-----------------------------------------------------------------------------
#
# NeL
# Authors: Nevrax and the NeL Community
# Version: 0.9.0
# Ryzom Core
# Authors: Nevrax and the Ryzom Core Community
# Version: 0.11.2
#
# Notes:
# * Changing install location: add -DCMAKE_INSTALL_PREFIX:PATH=/my/new/path
@ -47,8 +47,8 @@ CHECK_OUT_OF_SOURCE()
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(RyzomCore CXX C)
SET(NL_VERSION_MAJOR 0)
SET(NL_VERSION_MINOR 9)
SET(NL_VERSION_PATCH 0)
SET(NL_VERSION_MINOR 11)
SET(NL_VERSION_PATCH 2)
SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}")
#-----------------------------------------------------------------------------
@ -112,16 +112,20 @@ IF(WITH_STATIC_LIBXML2)
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
ENDIF(WITH_STATIC_LIBXML2)
IF(WITH_LIBXML2_ICONV)
FIND_PACKAGE(Iconv REQUIRED)
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
ENDIF(WITH_LIBXML2_ICONV)
IF(WITH_STATIC)
# libxml2 could need winsock2 library
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
# on Mac OS X libxml2 requires iconv and liblzma
IF(APPLE)
FIND_PACKAGE(Iconv REQUIRED)
FIND_PACKAGE(LibLZMA REQUIRED)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES} ${LIBLZMA_LIBRARIES})
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
ENDIF(APPLE)
ENDIF(WITH_STATIC)
@ -131,6 +135,13 @@ IF(FINAL_VERSION)
ADD_DEFINITIONS(-DFINAL_VERSION=1)
ENDIF(FINAL_VERSION)
IF(WITH_SSE2)
ADD_DEFINITIONS(-DNL_HAS_SSE2)
IF(WITH_SSE3)
ADD_DEFINITIONS(-DNL_HAS_SSE3)
ENDIF(WITH_SSE3)
ENDIF(WITH_SSE2)
IF(WITH_QT)
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
ENDIF(WITH_QT)
@ -145,9 +156,11 @@ IF(WITH_NEL)
FIND_PACKAGE(Luabind REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
IF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
SET(CURL_STATIC ON)
ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
ELSE((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
SET(CURL_STATIC OFF)
ENDIF((WIN32 OR CURL_LIBRARIES MATCHES "\\.a") AND WITH_STATIC_CURL)
IF(CURL_STATIC)
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
@ -190,6 +203,10 @@ IF(WITH_TOOLS)
ADD_SUBDIRECTORY(tool)
ENDIF(WITH_TOOLS)
IF(WITH_STUDIO)
ADD_SUBDIRECTORY(studio)
ENDIF(WITH_STUDIO)
# To build the documention, you will have to enable it
# and then do the equivalent of "make DoxygenDoc".
IF(BUILD_DOCUMENTATION)
@ -217,30 +234,31 @@ IF(WITH_NEL_TESTS)
ENDIF(WITH_NEL_TESTS)
# packaging information
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NeL MMORPG Framework")
SET(CPACK_PACKAGE_VENDOR "NeL")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ryzom Core MMORPG Framework")
SET(CPACK_PACKAGE_VENDOR "Ryzom Core")
SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README)
SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING)
SET(CPACK_PACKAGE_VERSION_MAJOR "${NL_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${NL_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${NL_VERSION_PATCH}")
SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};NeL;ALL;/")
SET(CPACK_PACKAGE_EXECUTABLES "nel${NL_VERSION}" "nel")
SET(CPACK_PACKAGE_EXECUTABLES "ryzomcore${NL_VERSION}" "ryzomcore")
SET(CPACK_SET_DESTDIR TRUE)
# NSIS Specific Packing Setup
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "NeL")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "RyzomCore")
SET(CPACK_NSIS_MODIFY_PATH "ON")
SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico)
SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp)
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} NeL")
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} RyzomCore")
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel\\\\wiki")
SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com")
## Source Packages
SET(CPACK_PACKAGE_FILE_NAME "nel-${NL_VERSION}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "nel-${NL_VERSION}")
SET(CPACK_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "ryzomcore-${NL_VERSION}")
IF(WIN32)
#SET(CPACK_GENERATOR "NSIS")
SET(CPACK_GENERATOR "NSIS;ZIP")

@ -26,63 +26,46 @@ IF(TARGET_CPU STREQUAL "armv7")
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
SET(TOOLCHAIN_ARCH "arm")
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "armv5")
SET(LIBRARY_ARCHITECTURE "armeabi")
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
SET(TOOLCHAIN_ARCH "arm")
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "x86")
SET(LIBRARY_ARCHITECTURE "x86")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
SET(TOOLCHAIN_ARCH "x86")
SET(TOOLCHAIN_PREFIX "x86")
SET(GCC_TOOLCHAIN_PREFIX "x86")
SET(TOOLCHAIN_BIN_PREFIX "i686")
SET(MINIMUM_NDK_TARGET 9)
ELSEIF(TARGET_CPU STREQUAL "mips")
SET(LIBRARY_ARCHITECTURE "mips")
SET(CMAKE_SYSTEM_PROCESSOR "mips")
SET(TOOLCHAIN_ARCH "mips")
SET(TOOLCHAIN_PREFIX "mipsel-linux-android")
SET(GCC_TOOLCHAIN_PREFIX "mipsel-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
SET(MINIMUM_NDK_TARGET 9)
ENDIF(TARGET_CPU STREQUAL "armv7")
SET(ANDROID_COMPILER "GCC")
IF(NDK_TOOLCHAIN_VERSION STREQUAL "clang")
SET(ANDROID_COMPILER "clang")
SET(CLANG_TOOLCHAIN_PREFIX "llvm")
SET(CLANG ON)
ELSE()
SET(GCC_TOOLCHAIN_VERSION ${NDK_TOOLCHAIN_VERSION})
ENDIF()
IF(NOT NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
ENDIF(NOT NDK_TARGET)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-*")
IF(_TOOLCHAIN_VERSIONS)
LIST(SORT _TOOLCHAIN_VERSIONS)
LIST(REVERSE _TOOLCHAIN_VERSIONS)
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
STRING(REGEX REPLACE ".+${TOOLCHAIN_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
LIST(APPEND NDK_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
ENDFOREACH(_TOOLCHAIN_VERSION)
ENDIF(_TOOLCHAIN_VERSIONS)
IF(NOT NDK_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF(NOT NDK_TOOLCHAIN_VERSIONS)
IF(NDK_TOOLCHAIN_VERSION)
LIST(FIND NDK_TOOLCHAIN_VERSIONS "${NDK_TOOLCHAIN_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
ENDIF(_INDEX EQUAL -1)
ELSE(NDK_TOOLCHAIN_VERSION)
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
ENDIF(NDK_TOOLCHAIN_VERSION)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${NDK_TOOLCHAIN_VERSION}")
IF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_HOST "windows")
SET(TOOLCHAIN_BIN_SUFFIX ".exe")
@ -94,33 +77,73 @@ ELSEIF(CMAKE_HOST_UNIX)
SET(TOOLCHAIN_BIN_SUFFIX "")
ENDIF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-${NDK_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
MACRO(SEARCH_TOOLCHAIN _COMPILER)
SET(${_COMPILER}_TOOLCHAIN_VERSIONS)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-*")
IF(_TOOLCHAIN_VERSIONS)
LIST(SORT _TOOLCHAIN_VERSIONS)
LIST(REVERSE _TOOLCHAIN_VERSIONS)
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
STRING(REGEX REPLACE ".+${_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF()
ENDFOREACH()
ENDIF()
IF(NOT ${_COMPILER}_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android ${_COMPILER} toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF()
IF(${_COMPILER}_TOOLCHAIN_VERSIONS)
LIST(FIND ${_COMPILER}_TOOLCHAIN_VERSIONS "${${_COMPILER}_TOOLCHAIN_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
ENDIF()
ELSE()
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
ENDIF()
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
IF(NOT EXISTS "${${_COMPILER}_TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 ${_COMPILER}_TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES)
ENDIF()
ENDMACRO()
IF(CLANG)
SEARCH_TOOLCHAIN(CLANG)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use clang ${CLANG_TOOLCHAIN_VERSION}")
ENDIF()
SEARCH_TOOLCHAIN(GCC)
IF(NOT EXISTS "${TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES)
ENDIF(NOT EXISTS "${TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${GCC_TOOLCHAIN_VERSION}")
MESSAGE(STATUS "Found Android LLVM toolchain in ${CLANG_TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android GCC toolchain in ${GCC_TOOLCHAIN_ROOT}")
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
MESSAGE(STATUS "Found Android toolchain in ${TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}")
# include dirs
SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include")
SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
IF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
IF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# NDK version >= 8b
SET(STL_DIR "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
ENDIF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
SET(STL_DIR "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
ENDIF(EXISTS "${STL_DIR}/${GCC_TOOLCHAIN_VERSION}")
# Determine bin prefix for toolchain
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}")
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}")
IF(_TOOLCHAIN_BIN_PREFIXES)
LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX)
STRING(REGEX REPLACE "${TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}")
STRING(REGEX REPLACE "${GCC_TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}")
ENDIF(_TOOLCHAIN_BIN_PREFIXES)
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
@ -128,22 +151,48 @@ SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
SET(STL_INCLUDE_CPU_DIR "${STL_LIBRARY_DIR}/include")
SET(STL_LIBRARY "${STL_LIBRARY_DIR}/libgnustl_static.a")
SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
MESSAGE(STATUS "STL include dir: ${STL_INCLUDE_DIR}")
MESSAGE(STATUS "STL library dir: ${STL_LIBRARY_DIR}")
SET(CMAKE_FIND_ROOT_PATH ${CLANG_TOOLCHAIN_ROOT} ${GCC_TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
INCLUDE_DIRECTORIES(${STL_INCLUDE_DIR} ${STL_INCLUDE_CPU_DIR})
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
SET(${_NAME} ${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX})
IF("${_BINARY}" MATCHES "clang")
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
ELSE()
SET(${_NAME} ${GCC_TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
ENDIF()
ENDMACRO(SET_TOOLCHAIN_BINARY)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
# Force the compilers to GCC for Android
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
IF(CLANG)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER clang)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER clang++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} clang)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} clang)
MESSAGE(STATUS "Using clang compiler")
ELSE()
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)
MESSAGE(STATUS "Using GCC compiler")
ENDIF()
SET_TOOLCHAIN_BINARY(CMAKE_STRIP strip)
SET_TOOLCHAIN_BINARY(CMAKE_AR ar)
SET_TOOLCHAIN_BINARY(CMAKE_LINKER ld)
SET_TOOLCHAIN_BINARY(CMAKE_NM nm)
SET_TOOLCHAIN_BINARY(CMAKE_OBJCOPY objcopy)
SET_TOOLCHAIN_BINARY(CMAKE_OBJDUMP objdump)
SET_TOOLCHAIN_BINARY(CMAKE_RANLIB ranlib)

@ -1,49 +1,52 @@
# - Find DirectInput
# Find the DirectSound includes and libraries
#
# MAXSDK_DIR - 3DSMAX SDK root directory
# MAXSDK_INCLUDE_DIR - where to find baseinterface.h
# MAXSDK_LIBRARIES - List of libraries when using 3DSMAX.
# MAXSDK_FOUND - True if MAX SDK found.
if(MAXSDK_INCLUDE_DIR)
# Already in cache, be silent
set(MAXSDK_FIND_QUIETLY TRUE)
# Already in cache, be silent
SET(MAXSDK_FIND_QUIETLY TRUE)
endif(MAXSDK_INCLUDE_DIR)
find_path(MAXSDK_INCLUDE_DIR max.h
FIND_PATH(MAXSDK_DIR
"include/maxversion.h"
HINTS
"$ENV{MAXSDK_DIR}"
PATHS
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/include"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/include"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include"
"C:/3dsmax7/maxsdk/include"
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk"
)
find_path(MAXSDK_CS_INCLUDE_DIR bipexp.h
PATHS
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/include/CS"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/include/CS"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/include/CS"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/include/CS"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/include/CS"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/include/CS"
"C:/3dsmax7/maxsdk/include/CS"
FIND_PATH(MAXSDK_INCLUDE_DIR
max.h
HINTS
${MAXSDK_DIR}/include
)
FIND_PATH(MAXSDK_CS_INCLUDE_DIR bipexp.h
HINTS
${MAXSDK_DIR}/include/CS
)
IF(TARGET_X64)
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/x64/lib)
ELSE(TARGET_X64)
SET(MAXSDK_LIBRARY_DIRS ${MAXSDK_DIR}/lib)
ENDIF(TARGET_X64)
MACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME}
PATHS
"$ENV{ADSK_3DSMAX_SDK_2012}/maxsdk/lib"
"$ENV{3DSMAX_2011_SDK_PATH}/maxsdk/lib"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2010 SDK/maxsdk/lib"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2009 SDK/maxsdk/lib"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 2008 SDK/maxsdk/lib"
"$ENV{PROGRAMFILES}/Autodesk/3ds Max 9 SDK/maxsdk/lib"
"C:/3dsmax7/maxsdk/lib"
)
NAMES ${MYLIBRARYNAME}
HINTS
${MAXSDK_LIBRARY_DIRS}
)
ENDMACRO(FIND_3DS_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_3DS_LIBRARY(MAXSDK_CORE_LIBRARY core)

@ -52,12 +52,6 @@ IF(DXSDK_DIR)
FIND_DXSDK_LIBRARY(DXSDK_XAUDIO_LIBRARY x3daudio)
FIND_DXSDK_LIBRARY(DXSDK_D3DX9_LIBRARY d3dx9)
FIND_DXSDK_LIBRARY(DXSDK_D3D9_LIBRARY d3d9)
#FIND_DXSDK_LIBRARY(DXSDK_MESH_LIBRARY mesh)
#FIND_DXSDK_LIBRARY(DXSDK_MAXUTIL_LIBRARY maxutil)
#FIND_DXSDK_LIBRARY(DXSDK_MAXSCRIPT_LIBRARY maxscrpt)
#FIND_DXSDK_LIBRARY(DXSDK_PARAMBLK2_LIBRARY paramblk2)
#FIND_DXSDK_LIBRARY(DXSDK_BMM_LIBRARY bmm)
ENDIF(DXSDK_DIR)
# Handle the QUIETLY and REQUIRED arguments and set DXSDK_FOUND to TRUE if

@ -23,8 +23,15 @@ FIND_PATH(FMOD_INCLUDE_DIR
PATH_SUFFIXES fmod fmod3
)
IF(TARGET_X64)
SET(FMOD_LIBRARY_NAMES fmod64 fmod)
ELSE(TARGET_X64)
SET(FMOD_LIBRARY_NAMES fmodvc fmod)
ENDIF(TARGET_X64)
FIND_LIBRARY(FMOD_LIBRARY
NAMES fmod fmodvc libfmod fmod64
NAMES
${FMOD_LIBRARY_NAMES}
PATHS
$ENV{FMOD_DIR}/lib
/usr/local/lib

@ -1,4 +1,4 @@
# - Try to find Iconv on Mac OS X
# - Try to find Iconv
# Once done this will define
#
# ICONV_FOUND - system has Iconv
@ -6,78 +6,59 @@
# ICONV_LIBRARIES - Link these to use Iconv
# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
#
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
IF(APPLE)
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
# Already in cache, be silent
SET(ICONV_FIND_QUIETLY TRUE)
ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
# Already in cache, be silent
SET(ICONV_FIND_QUIETLY TRUE)
ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
FIND_PATH(ICONV_INCLUDE_DIR iconv.h HINTS /sw/include/ PATHS /opt/local)
IF(APPLE)
FIND_PATH(ICONV_INCLUDE_DIR iconv.h
PATHS
/opt/local/include/
NO_CMAKE_SYSTEM_PATH
)
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c PATHS /opt/local)
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c
PATHS
/opt/local/lib/
NO_CMAKE_SYSTEM_PATH
)
ENDIF(APPLE)
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
SET(ICONV_FOUND TRUE)
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
FIND_PATH(ICONV_INCLUDE_DIR iconv.h PATHS /opt/local/include /sw/include)
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
IF(ICONV_FOUND)
check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
if(ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif(ICONV_HAVE_WERROR)
check_c_source_compiles("
#include <iconv.h>
int main(){
iconv_t conv = 0;
const char* in = 0;
size_t ilen = 0;
char* out = 0;
size_t olen = 0;
iconv(conv, &in, &ilen, &out, &olen);
return 0;
}
" ICONV_SECOND_ARGUMENT_IS_CONST )
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
ENDIF(ICONV_FOUND)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
string(REGEX REPLACE "(.*)/include/?" "\\1" ICONV_INCLUDE_BASE_DIR "${ICONV_INCLUDE_DIR}")
IF(ICONV_FOUND)
IF(NOT ICONV_FIND_QUIETLY)
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
ENDIF(NOT ICONV_FIND_QUIETLY)
ELSE(ICONV_FOUND)
IF(Iconv_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Iconv")
ENDIF(Iconv_FIND_REQUIRED)
ENDIF(ICONV_FOUND)
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c HINTS "${ICONV_INCLUDE_BASE_DIR}/lib" PATHS /opt/local/lib)
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
SET(ICONV_FOUND TRUE)
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
IF(ICONV_FOUND)
check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
if(ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif(ICONV_HAVE_WERROR)
check_c_source_compiles("
#include <iconv.h>
int main(){
iconv_t conv = 0;
const char* in = 0;
size_t ilen = 0;
char* out = 0;
size_t olen = 0;
iconv(conv, &in, &ilen, &out, &olen);
return 0;
}
" ICONV_SECOND_ARGUMENT_IS_CONST )
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
ENDIF(ICONV_FOUND)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
IF(ICONV_FOUND)
IF(NOT ICONV_FIND_QUIETLY)
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
ENDIF(NOT ICONV_FIND_QUIETLY)
ELSE(ICONV_FOUND)
IF(Iconv_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Iconv")
ENDIF(Iconv_FIND_REQUIRED)
ENDIF(ICONV_FOUND)
MARK_AS_ADVANCED(
ICONV_INCLUDE_DIR
ICONV_LIBRARIES
ICONV_SECOND_ARGUMENT_IS_CONST
)
ENDIF(APPLE)
MARK_AS_ADVANCED(
ICONV_INCLUDE_DIR
ICONV_LIBRARIES
ICONV_SECOND_ARGUMENT_IS_CONST
)

@ -38,7 +38,7 @@ ELSEIF(WIN32)
ENDIF(UNIX)
FIND_LIBRARY(LIBOVR_LIBRARY
NAMES ovr
NAMES ovr libovr
PATHS
$ENV{LIBOVR_DIR}/${LIBOVR_LIBRARY_BUILD_PATH}
/usr/local/lib

@ -12,6 +12,12 @@ MACRO(FIND_CORRECT_LUA_VERSION)
SET(LUA52_LIBRARY "liblua5.2")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
IF(NOT LUALIB_FOUND)
# fedora (v20)
SET(LUA52_LIBRARY "liblua-5.2")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
ENDIF(NOT LUALIB_FOUND)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.2")
FIND_PACKAGE(Lua52 REQUIRED)
@ -63,14 +69,48 @@ FIND_PATH(LUABIND_INCLUDE_DIR
/opt/include
)
SET(LIBRARY_NAME_RELEASE luabind libluabind)
SET(LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd)
SET(LIBRARY_NAME_RELEASE)
SET(LIBRARY_NAME_DEBUG)
IF(WITH_LUA52)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua52)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua52d)
ENDIF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua52)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua52d)
ENDIF()
IF(WITH_LUA51)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua51)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua51d)
ENDIF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua51)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua51d)
ENDIF()
IF(WITH_LUA50)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua50)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua50d)
ENDIF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua50)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua50d)
ENDIF()
IF(WITH_STLPORT)
SET(LIBRARY_NAME_RELEASE luabind_stlport ${LIBRARY_NAME_RELEASE})
SET(LIBRARY_NAME_DEBUG luabind_stlportd ${LIBRARY_NAME_DEBUG})
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlportd)
ENDIF(WITH_STLPORT)
# generic libraries names
LIST(APPEND LIBRARY_NAME_RELEASE luabind libluabind)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd)
FIND_LIBRARY(LUABIND_LIBRARY_RELEASE
NAMES ${LIBRARY_NAME_RELEASE}
PATHS

@ -57,13 +57,15 @@ ENDMACRO(DETECT_EXPRESS_VERSION)
IF(MSVC12)
DETECT_VC_VERSION("12.0")
SET(MSVC_TOOLSET "120")
IF(NOT MSVC12_REDIST_DIR)
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC11_REDIST_DIR)
ENDIF(NOT MSVC12_REDIST_DIR)
ELSEIF(MSVC11)
DETECT_VC_VERSION("11.0")
SET(MSVC_TOOLSET "110")
IF(NOT MSVC11_REDIST_DIR)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
@ -71,6 +73,7 @@ ELSEIF(MSVC11)
ENDIF(NOT MSVC11_REDIST_DIR)
ELSEIF(MSVC10)
DETECT_VC_VERSION("10.0")
SET(MSVC_TOOLSET "100")
IF(NOT MSVC10_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
@ -78,8 +81,10 @@ ELSEIF(MSVC10)
ENDIF(NOT MSVC10_REDIST_DIR)
ELSEIF(MSVC90)
DETECT_VC_VERSION("9.0")
SET(MSVC_TOOLSET "90")
ELSEIF(MSVC80)
DETECT_VC_VERSION("8.0")
SET(MSVC_TOOLSET "80")
ENDIF(MSVC12)
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable

@ -13,7 +13,7 @@
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE)
ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ELSE()
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
PATH_SUFFIXES mysql
@ -33,7 +33,7 @@ ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
PATHS
$ENV{ProgramFiles}/MySQL/*/lib/opt
$ENV{SystemDrive}/MySQL/*/lib/opt)
ELSE(WIN32 AND MSVC)
ELSE()
FIND_LIBRARY(MYSQL_LIBRARY_RELEASE NAMES mysqlclient
PATHS
/usr/lib
@ -51,31 +51,30 @@ ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
/usr/local/lib/mysql
/opt/local/lib/mysql5/mysql
)
ENDIF(WIN32 AND MSVC)
ENDIF()
IF(MYSQL_INCLUDE_DIR)
IF(MYSQL_LIBRARY_RELEASE)
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE})
IF(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_DEBUG})
ELSE(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_RELEASE})
ENDIF(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE} debug ${MYSQL_LIBRARY_DEBUG})
ELSE()
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARY_RELEASE})
ENDIF()
FIND_PACKAGE(OpenSSL)
IF(OPENSSL_FOUND)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
ENDIF(MYSQL_LIBRARY_RELEASE)
ENDIF(MYSQL_INCLUDE_DIR)
ENDIF()
ENDIF()
ENDIF()
IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_FOUND TRUE)
MESSAGE(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ELSE()
SET(MYSQL_FOUND FALSE)
MESSAGE(STATUS "MySQL not found.")
ENDIF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ENDIF()
MARK_AS_ADVANCED(MYSQL_LIBRARY_RELEASE MYSQL_LIBRARY_DEBUG)
ENDIF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
ENDIF()

@ -55,10 +55,12 @@ FIND_LIBRARY(SQUISH_LIBRARY_DEBUG
IF(SQUISH_INCLUDE_DIR)
IF(SQUISH_LIBRARY_RELEASE)
SET(SQUISH_FOUND "YES")
SET(SQUISH_LIBRARIES "optimized;${SQUISH_LIBRARY_RELEASE}")
IF(SQUISH_LIBRARY_DEBUG)
SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_DEBUG}")
ELSE(SQUISH_LIBRARY_DEBUG)
SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_RELEASE}")
MESSAGE("Debug Squish NOT found, using the release version!")
ENDIF(SQUISH_LIBRARY_DEBUG)
ENDIF(SQUISH_LIBRARY_RELEASE)
ENDIF(SQUISH_INCLUDE_DIR)

@ -68,6 +68,10 @@ ENDIF(WINSDKCURRENT_VERSION_INCLUDE)
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
IF(NOT WINSDKENV_DIR)
SET(WINSDKENV_DIR $ENV{WindowsSDKDir})
ENDIF(NOT WINSDKENV_DIR)
MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
# Search version in headers
@ -78,7 +82,6 @@ MACRO(FIND_WINSDK_VERSION_HEADERS)
)
IF(_MSI_FILE)
# Look for Windows SDK 8.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8")
@ -181,7 +184,7 @@ MACRO(USE_CURRENT_WINSDK)
# Look for Windows.h because there are several paths
IF(EXISTS ${_INCLUDE}/Windows.h)
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
MESSAGE(STATUS "Found Windows SDK from include environment variable in ${WINSDK_DIR}")
MESSAGE(STATUS "Found Windows SDK in INCLUDE environment variable: ${WINSDK_DIR}")
BREAK()
ENDIF(EXISTS ${_INCLUDE}/Windows.h)
ENDFOREACH(_INCLUDE)
@ -280,6 +283,13 @@ FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
${WINSDK_DIR}/Include
)
# directory where OpenGL headers are found
FIND_PATH(WINSDK_OPENGL_INCLUDE_DIR GL.h
HINTS
${WINSDK_DIR}/Include/gl
${WINSDK_DIR}/Include
)
# directory where all libraries are found
FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
HINTS
@ -303,7 +313,7 @@ FIND_PROGRAM(WINSDK_MIDL midl
IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_FOUND ON)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR})
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR} ${WINSDK_OPENGL_INCLUDE_DIR})
SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS})

@ -13,38 +13,44 @@ IF(SOURCE_DIR)
IF(NOT ROOT_DIR AND SOURCE_DIR)
SET(ROOT_DIR ${SOURCE_DIR})
ENDIF(NOT ROOT_DIR AND SOURCE_DIR)
ENDIF()
IF(NOT SOURCE_DIR AND ROOT_DIR)
SET(SOURCE_DIR ${ROOT_DIR})
ENDIF(NOT SOURCE_DIR AND ROOT_DIR)
ELSE(SOURCE_DIR)
ENDIF()
ELSE()
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
ENDIF(SOURCE_DIR)
ENDIF()
MACRO(NOW RESULT)
IF (WIN32)
EXECUTE_PROCESS(COMMAND "wmic" "os" "get" "localdatetime" OUTPUT_VARIABLE DATETIME)
IF(NOT DATETIME MATCHES "ERROR")
STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}")
ENDIF(NOT DATETIME MATCHES "ERROR")
ENDIF()
ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME)
STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}")
ELSE (WIN32)
ELSE()
MESSAGE(SEND_ERROR "date not implemented")
SET(${RESULT} "0000-00-00 00:00:00")
ENDIF (WIN32)
ENDIF()
ENDMACRO(NOW)
IF(EXISTS "${ROOT_DIR}/.svn/")
FIND_PACKAGE(Subversion)
FIND_PACKAGE(Subversion QUIET)
IF(SUBVERSION_FOUND)
Subversion_WC_INFO(${ROOT_DIR} ER)
SET(REVISION ${ER_WC_REVISION})
ENDIF(SUBVERSION_FOUND)
FIND_PACKAGE(TortoiseSVN QUIET)
IF(TORTOISESVN_FOUND)
TORTOISESVN_GET_REVISION(${ROOT_DIR} REVISION)
ENDIF(TORTOISESVN_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.svn/")
IF(EXISTS "${ROOT_DIR}/.hg/")
@ -55,8 +61,8 @@ IF(EXISTS "${ROOT_DIR}/.hg/")
SET(REVISION ${ER_WC_REVISION})
SET(CHANGESET ${ER_WC_CHANGESET})
SET(BRANCH ${ER_WC_BRANCH})
ENDIF(MERCURIAL_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.hg/")
ENDIF()
ENDIF()
# if processing exported sources, use "revision" file if exists
IF(SOURCE_DIR AND NOT DEFINED REVISION)
@ -64,8 +70,8 @@ IF(SOURCE_DIR AND NOT DEFINED REVISION)
IF(EXISTS ${REVISION_FILE})
FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1)
MESSAGE(STATUS "Read revision ${REVISION} from file")
ENDIF(EXISTS ${REVISION_FILE})
ENDIF(SOURCE_DIR AND NOT DEFINED REVISION)
ENDIF()
ENDIF()
IF(SOURCE_DIR AND DEFINED REVISION)
IF(EXISTS ${SOURCE_DIR}/revision.h.in)
@ -73,5 +79,5 @@ IF(SOURCE_DIR AND DEFINED REVISION)
NOW(BUILD_DATE)
CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different
ENDIF(EXISTS ${SOURCE_DIR}/revision.h.in)
ENDIF(SOURCE_DIR AND DEFINED REVISION)
ENDIF()
ENDIF()

@ -6,6 +6,9 @@ IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
# Declare CMAKE_CONFIGURATION_TYPES before PROJECT
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
###
# Helper macro that generates .pc and installs it.
# Argument: name - the name of the .pc package, e.g. "nel-pacs.pc"
@ -118,13 +121,13 @@ MACRO(NL_DEFAULT_PROPS name label)
ENDIF(NL_LIB_PREFIX)
ENDIF(${type} STREQUAL SHARED_LIBRARY)
IF(${type} STREQUAL EXECUTABLE AND WIN32)
IF(${type} STREQUAL EXECUTABLE AND WIN32 AND NOT MINGW)
SET_TARGET_PROPERTIES(${name} PROPERTIES
VERSION ${NL_VERSION}
SOVERSION ${NL_VERSION_MAJOR}
COMPILE_FLAGS "/GA"
LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}")
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32)
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32 AND NOT MINGW)
ENDMACRO(NL_DEFAULT_PROPS)
###
@ -229,6 +232,10 @@ Remove the CMakeCache.txt file and try again from another folder, e.g.:
ENDMACRO(CHECK_OUT_OF_SOURCE)
MACRO(NL_SETUP_DEFAULT_OPTIONS)
IF(WITH_QT)
OPTION(WITH_STUDIO "Build Core Studio" OFF )
ENDIF(WITH_QT)
###
# Features
###
@ -248,6 +255,16 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
ELSE(WITH_STATIC)
OPTION(WITH_STATIC_LIBXML2 "With static libxml2" OFF)
ENDIF(WITH_STATIC)
IF (WITH_STATIC)
OPTION(WITH_STATIC_CURL "With static curl" ON )
ELSE(WITH_STATIC)
OPTION(WITH_STATIC_CURL "With static curl" OFF)
ENDIF(WITH_STATIC)
IF(APPLE)
OPTION(WITH_LIBXML2_ICONV "With libxml2 using iconv" ON )
ELSE(APPLE)
OPTION(WITH_LIBXML2_ICONV "With libxml2 using iconv" OFF)
ENDIF(APPLE)
OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF)
IF(WIN32)
OPTION(WITH_EXTERNAL "With provided external." ON )
@ -324,6 +341,13 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
OPTION(WITH_LIBOVR "With LibOVR support" OFF)
OPTION(WITH_LIBVR "With LibVR support" OFF)
OPTION(WITH_PERFHUD "With NVIDIA PerfHUD support" OFF)
OPTION(WITH_SSE2 "With SSE2" ON )
OPTION(WITH_SSE3 "With SSE3" ON )
IF(NOT MSVC)
OPTION(WITH_GCC_FPMATH_BOTH "With GCC -mfpmath=both" OFF)
ENDIF(NOT MSVC)
ENDMACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
MACRO(NL_SETUP_NELNS_DEFAULT_OPTIONS)
@ -349,6 +373,7 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
###
OPTION(WITH_LUA51 "Build Ryzom Core using Lua 5.1" ON )
OPTION(WITH_LUA52 "Build Ryzom Core using Lua 5.2" OFF)
OPTION(WITH_RYZOM_CLIENT_UAC "Ask to run as Administrator" OFF)
ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS)
@ -373,8 +398,6 @@ MACRO(NL_SETUP_BUILD)
# Debug = NL_DEBUG
# Release = NL_RELEASE
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(NL_BUILD_MODE "NL_DEBUG")
ELSE(CMAKE_BUILD_TYPE MATCHES "Debug")
@ -545,9 +568,15 @@ MACRO(NL_SETUP_BUILD)
# Ignore default include paths
ADD_PLATFORM_FLAGS("/X")
IF(MSVC11)
IF(MSVC12)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# /Ox is working with VC++ 2010, but custom optimizations don't exist
# /Ox is working with VC++ 2013, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC11)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# /Ox is working with VC++ 2012, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
@ -569,9 +598,9 @@ MACRO(NL_SETUP_BUILD)
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}")
ELSE(MSVC11)
ELSE(MSVC12)
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
ENDIF(MSVC11)
ENDIF(MSVC12)
ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250")
@ -614,6 +643,14 @@ MACRO(NL_SETUP_BUILD)
ENDIF(CLANG)
ENDIF(WIN32)
IF(WITH_SSE3)
ADD_PLATFORM_FLAGS("-msse3")
ENDIF(WITH_SSE3)
IF(WITH_GCC_FPMATH_BOTH)
ADD_PLATFORM_FLAGS("-mfpmath=both")
ENDIF(WITH_GCC_FPMATH_BOTH)
IF(APPLE)
IF(NOT XCODE)
IF(CMAKE_OSX_ARCHITECTURES)
@ -875,9 +912,9 @@ MACRO(NL_SETUP_BUILD)
ENDIF(APPLE)
# Fix "relocation R_X86_64_32 against.." error on x64 platforms
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW)
ADD_PLATFORM_FLAGS("-fPIC")
ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS)
ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW)
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48")

@ -83,4 +83,3 @@ IF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN)
ENDIF(WITH_NEL_TOOLS)
ADD_SUBDIRECTORY(tools)
ENDIF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN)

@ -71,7 +71,7 @@ public:
// For clipTrav. cleared at beginning of CClipTrav::traverse
void clearVisibleList();
// For ClipTrav only. NB: list is cleared at begininng of traverse(). NB: only CTransform are supported
// For ClipTrav only. NB: list is cleared at beginning of traverse(). NB: only CTransform are supported
void addVisibleModel(CTransform *model)
{
_VisibleList[_CurrentNumVisibleModels]= model;

@ -31,6 +31,7 @@ namespace NL3D
class UDriver;
class UScene;
class CTextureUser;
//-----------------------------------------------------------------------------------------------------------
//---------------------------------------- CBloomEffect -----------------------------------------------------
@ -52,19 +53,14 @@ public:
// Destructor
~CBloomEffect();
// Called after the Driver initialization to indicate if OpenGL or Direct3D is used.
// They are some differences in bloom algorithm depending on this API choice.
// If bloom effect is activated and supported, private method init() is called to initialize
// textures and materials.
// initBloomEffect = false => directx
// initBloomEffect = true => opengl
void init(bool initBloomEffect);
// Called after the Driver initialization.
void init();
// must be called before init
void setDriver(UDriver *driver) { _Driver = driver; }
UDriver* getDriver() const { return _Driver; }
// must be called before initBloom
// must be called before applyBloom
void setScene(UScene *scene) { _Scene = scene; }
UScene* getScene() const { return _Scene; }
@ -76,6 +72,9 @@ public:
void setDensityBloom(uint8 densityBloom) { _DensityBloom = densityBloom; }
uint8 getDensityBloom() const { return _DensityBloom; }
// Applies bloom to the current render target
void applyBloom();
// Called at the beginning of renderAll method in the main loop, if window has been resized,
// reinitialize bloom textures according to new window size.
// The bloom texture (_InitText attribute) which is used as render target during scene render
@ -83,11 +82,11 @@ public:
// If window size exceeds 256*256 the textures used to apply blur are reinitialized with
// 256*256 size. If a dimension is less than 256, the texture is initialized with the nearer
// power of 2, lower than this window dimension.
void initBloom();
// void initBloom();
// Called at the end of renderAll method in the main loop, recover stretched texture, apply
// both blur passes, and the blending operation between initial render target and the blured one.
void endBloom();
// void endBloom();
// In OpenGL, the use of FBO implies that Z buffer values of scene render have been stored in
// a depth render target. Then, to display 3D interfaces, we must display them in the same FBO,
@ -95,15 +94,12 @@ public:
// This method is called at the end of interfaces display in the main loop, to display final render target
// (with added interfaces) in the color frame buffer.
// NB : In Direct3D, the final render target is displayed at the end of endBloom call.
void endInterfacesDisplayBloom();
// void endInterfacesDisplayBloom();
private:
// Initialize textures and materials.
void init();
// Initialize a bloom texture with new dimensions.
void initTexture(NLMISC::CSmartPtr<NL3D::ITexture> & tex, bool isMode2D, uint32 width, uint32 height);
// void initTexture(NLMISC::CSmartPtr<NL3D::ITexture> & tex, bool isMode2D, uint32 width, uint32 height);
// Called in endBloom method to build a blurred texture. Two passes (then two calls)
// are necessary : horizontal and vertical.
@ -130,6 +126,7 @@ private:
// density of bloom
uint8 _DensityBloom;
/*
// render target textures
// used to display scene
NLMISC::CSmartPtr<NL3D::ITexture> _InitText;
@ -140,13 +137,12 @@ private:
NLMISC::CSmartPtr<NL3D::ITexture> _BlurHorizontalTex;
// original render target
NLMISC::CSmartPtr<NL3D::ITexture> _OriginalRenderTarget;
*/
// materials
// used to display first texture in doBlur passes.
NL3D::UMaterial _BlurMat;
// used to display final render target texture in endInterfacesDisplayBloom call (OpenGL).
NL3D::UMaterial _DisplayInitMat;
// used to blend initial scene render target texture and blur texture according to a
// dest+src - dest*src blend operation.
NL3D::UMaterial _DisplayBlurMat;
@ -156,21 +152,24 @@ private:
// quads
NLMISC::CQuadUV _BlurQuad;
NLMISC::CQuadUV _DisplayQuad;
// openGL or Direct3D?
bool _InitBloomEffect;
// textures and materials already initialized?
bool _Init;
// current window dimensions
uint32 _WndWidth;
uint32 _WndHeight;
/*uint32 _WndWidth;
uint32 _WndHeight;*/
// Temporary variables used during applyBloom(...) ->
// current blur texture dimensions
uint32 _BlurWidth;
uint32 _BlurHeight;
// used as stretched texture from _InitText, as displayed texture in first blur pass,
// and as render target in second blur pass.
CTextureUser *_BlurFinalTex;
// used as render target in first blur pass, and as displayed texture on second blur pass.
CTextureUser *_BlurHorizontalTex;
// <-
};
} // NL3D

@ -290,7 +290,7 @@ public:
* \param matrix transformation matrix
* \param hotspot position of string origine
*/
void render3D (IDriver& driver,CMatrix matrix,THotSpot hotspot = MiddleMiddle);
void render3D (IDriver& driver, const CMatrix &matrix, THotSpot hotspot = MiddleMiddle);
};

@ -42,9 +42,6 @@
namespace NLMISC
{
class IEventEmitter;
struct IMouseDevice;
struct IKeyboardDevice;
struct IInputDeviceManager;
class CRect;
class CLog;
}
@ -75,6 +72,7 @@ struct IOcclusionQuery;
/// A Graphic Mode descriptor.
struct GfxMode
{
std::string DisplayDevice;
bool OffScreen;
bool Windowed;
uint16 Width;
@ -93,7 +91,7 @@ struct GfxMode
Frequency = 0;
AntiAlias = -1;
}
GfxMode(uint16 w, uint16 h, uint8 d, bool windowed = true, bool offscreen = false, uint frequency = 0, sint8 aa = -1);
GfxMode(uint16 w, uint16 h, uint8 d, bool windowed = true, bool offscreen = false, uint frequency = 0, sint8 aa = -1, const std::string &displayDevice = std::string());
};
// ****************************************************************************
@ -182,7 +180,7 @@ public:
IDriver();
virtual ~IDriver();
virtual bool init(uint windowIcon = 0, emptyProc exitFunc = 0) = 0;
virtual bool init(uintptr_t windowIcon = 0, emptyProc exitFunc = 0) = 0;
/// Deriver should calls IDriver::release() first, to destroy all driver components (textures, shaders, VBuffers).
virtual bool release();
@ -495,7 +493,7 @@ public:
*
* NB: you must setupViewMatrix() BEFORE setupModelMatrix(), or else undefined results.
*/
virtual void setupViewMatrix(const CMatrix &mtx)=0;
virtual void setupViewMatrix(const CMatrix &mtx) = 0;
/** setup the view matrix (inverse of camera matrix).
* Extended: give a cameraPos (mtx.Pos() is not taken into account but for getViewMatrix()),
@ -869,29 +867,6 @@ public:
/// x and y must be between 0.0 and 1.0
virtual void setMousePos(float x, float y) = 0;
/** Enable / disable low level mouse. This allow to take advantage of some options (speed of the mouse, automatic wrapping)
* It returns a interface to these parameters when it is supported, or NULL otherwise
* The interface pointer is valid as long as the low level mouse is enabled.
* A call to disable the mouse returns NULL, and restore the default mouse behavior
* NB : - In this mode the mouse cursor isn't drawn.
* - Calls to showCursor have no effects
* - Calls to setCapture have no effects
*/
virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool exclusive) = 0;
/** Enable / disable a low level keyboard.
* Such a keyboard can only send KeyDown and KeyUp event. It just consider the keyboard as a
* gamepad with lots of buttons...
* This returns a interface to some parameters when it is supported, or NULL otherwise.
* The interface pointer is valid as long as the low level keyboard is enabled.
* A call to disable the keyboard returns NULL, and restore the default keyboard behavior
*/
virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable) = 0;
/** Get the delay in ms for mouse double clicks.
*/
virtual uint getDoubleClickDelay(bool hardwareMouse) = 0;
/** If true, capture the mouse to force it to stay under the window.
* NB : this has no effects if a low level mouse is used
*/
@ -908,11 +883,6 @@ public:
// Change default scale for all cursors
virtual void setCursorScale(float scale) = 0;
/** Check whether there is a low level device manager available, and get its interface. Return NULL if not available
* From this interface you can deal with mouse and keyboard as above, but you can also manage game device (joysticks, joypads ...)
*/
virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager() = 0;
// @}
@ -1005,6 +975,9 @@ public:
) = 0;
// @}
/// Hack for bloom
virtual bool textureCoordinateAlternativeMode() const = 0;
/// \name Render state: Polygon mode
@ -1341,7 +1314,7 @@ public:
* NB: if implementation does not support it, 0 may be returned. OpenGL ones return the Texture ID.
* NB: unlike isTextureExist(), this method is not thread safe.
*/
virtual uint getTextureHandle(const ITexture&tex) = 0;
virtual uintptr_t getTextureHandle(const ITexture&tex) = 0;
// see if the Multiply-Add Tex Env operator is supported (see CMaterial::Mad)
virtual bool supportMADOperator() const = 0;
@ -1449,7 +1422,6 @@ protected:
private:
bool _StaticMemoryToVRAM;
};
// --------------------------------------------------

@ -34,7 +34,7 @@
#include "nel/3d/vertex_stream_manager.h"
#include "nel/3d/async_texture_manager.h"
#include "nel/3d/lod_character_manager.h"
#include "nel/3d/render_target_manager.h"
namespace NL3D
{
@ -71,6 +71,7 @@ protected:
bool _WindowInit;
CMatrixContext _CurrentMatrixContext;
CFontManager _FontManager;
CRenderTargetManager _RenderTargetManager;
// Components List.
typedef CPtrSet<CTextureUser> TTextureSet;
typedef CPtrSet<CTextContextUser> TTextContextSet;
@ -108,6 +109,11 @@ protected:
CMaterial _MatTextInternal;
CMaterial _MatTextStretchInternal;
// Default render target for effect pipeline
CTextureUser *_EffectRenderTarget;
UMaterial _MatRenderTarget;
CMaterial _MatRenderTargetInt;
NLMISC::CQuadUV _RenderTargetQuad;
// StaticInit
static bool _StaticInit;
@ -123,7 +129,7 @@ public:
/// \name Object
// @{
CDriverUser (uint windowIcon, UDriver::TDriver driver, emptyProc exitFunc = 0);
CDriverUser (uintptr_t windowIcon, UDriver::TDriver driver, emptyProc exitFunc = 0);
virtual ~CDriverUser();
// @}
@ -241,6 +247,16 @@ public:
// @}
/// Get the render target manager
virtual CRenderTargetManager &getRenderTargetManager() { return _RenderTargetManager; }
/// Set a texture the size of the window as render target
virtual void beginDefaultRenderTarget(uint32 width = 0, uint32 height = 0);
/// Draw the render target to the back buffer
virtual void endDefaultRenderTarget(UScene *scene);
/// \name Components gestion for Interface 2D/3D.
// @{
@ -410,21 +426,6 @@ public:
virtual bool fillBuffer (CBitmap &bitmap);
// @}
/// \name Mouse / Keyboards / Game devices
// @{
virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool exclusive);
//
virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable);
virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager();
/**
* wrapper for IEventEmitter::emulateMouseRawMode()
*/
virtual void emulateMouseRawMode(bool enable);
virtual uint getDoubleClickDelay(bool hardwareMouse);
/// show cursor if b is true, or hide it if b is false
virtual void showCursor (bool b);
/// x and y must be between 0.0 and 1.0

@ -24,8 +24,11 @@
#include "nel/misc/geom_ext.h"
#include "nel/misc/line.h"
#ifdef NL_OS_WINDOWS
#if defined (NL_COMP_MINGW)
# define NL3D_GL_DLL_NAME "libnel_drv_opengl_win"
# define NL3D_GLES_DLL_NAME "libnel_drv_opengles_win"
# define NL3D_D3D_DLL_NAME "libnel_drv_direct3d_win"
#elif defined (NL_OS_WINDOWS)
# define NL3D_GL_DLL_NAME "nel_drv_opengl_win"
# define NL3D_GLES_DLL_NAME "nel_drv_opengles_win"
# define NL3D_D3D_DLL_NAME "nel_drv_direct3d_win"

@ -0,0 +1,84 @@
/**
* \file fxaa.h
* \brief CFXAA
* \date 2014-08-03 21:41GMT
* \author Jan Boon (Kaetemi)
* CFXAA
*/
/*
* Copyright (C) 2014 by authors
*
* This file is part of NL3D.
* NL3D is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* NL3D is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
* Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef NL3D_FXAA_H
#define NL3D_FXAA_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
#include <nel/misc/smart_ptr.h>
#include <nel/misc/geom_ext.h>
// Project includes
#include <nel/3d/u_material.h>
#include <nel/3d/vertex_buffer.h>
#define NL_STEREO_MAX_USER_CAMERAS 8
namespace NL3D {
class ITexture;
class CTextureUser;
class CPixelProgram;
class CVertexProgram;
/**
* \brief CFXAA
* \date 2014-08-03 21:41GMT
* \author Jan Boon (Kaetemi)
* CFXAA
*/
class CFXAA
{
public:
CFXAA(NL3D::UDriver *driver);
virtual ~CFXAA();
/// Apply effect to current render target. Render target must be managed by render target manager
virtual void applyEffect();
private:
UDriver *m_Driver;
NL3D::UMaterial m_Mat;
// NL3D::CVertexBuffer m_VB;
NLMISC::CQuadUV m_QuadUV;
CVertexProgram *m_VP;
CPixelProgram *m_PP;
uint m_Width;
uint m_Height;
}; /* class CFXAA */
} /* namespace NL3D */
#endif /* #ifndef NL3D_FXAA_H */
/* end of file */

@ -108,281 +108,6 @@ public:
};
// ***************************************************************************
// ***************************************************************************
// SSE Matrix
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM)
/** For fast vector/point multiplication. Special usage for Skinning.
* NB: SSE is no more used (no speed gain, some memory problem), but keep it for possible future usage.
*/
class CMatrix3x4SSE
{
public:
// Order them in memory column first, for SSE column multiplication.
float a11, a21, a31, a41;
float a12, a22, a32, a42;
float a13, a23, a33, a43;
float a14, a24, a34, a44;
// Copy from a matrix.
void set(const CMatrix &mat)
{
const float *m =mat.get();
a11= m[0]; a12= m[4]; a13= m[8] ; a14= m[12];
a21= m[1]; a22= m[5]; a23= m[9] ; a24= m[13];
a31= m[2]; a32= m[6]; a33= m[10]; a34= m[14];
// not used.
a41= 0 ; a42= 0 ; a43= 0 ; a44= 1;
}
// mulSetvector. NB: in should be different as v!! (else don't work).
void mulSetVector(const CVector &vin, CVector &vout)
{
__asm
{
mov eax, vin
mov ebx, this
mov edi, vout
// Load in vector in op[0]
movss xmm0, [eax]vin.x
movss xmm1, [eax]vin.y
movss xmm2, [eax]vin.z
// Expand op[0] to op[1], op[2], op[3]
shufps xmm0, xmm0, 0
shufps xmm1, xmm1, 0
shufps xmm2, xmm2, 0
// Mul each vector with 3 Matrix column
mulps xmm0, [ebx]this.a11
mulps xmm1, [ebx]this.a12
mulps xmm2, [ebx]this.a13
// Add each column vector.
addps xmm0, xmm1
addps xmm0, xmm2
// write the result.
movss [edi]vout.x, xmm0
shufps xmm0, xmm0, 33
movss [edi]vout.y, xmm0
movhlps xmm0, xmm0
movss [edi]vout.z, xmm0
}
}
// mulSetpoint. NB: in should be different as v!! (else don't work).
void mulSetPoint(const CVector &vin, CVector &vout)
{
__asm
{
mov eax, vin
mov ebx, this
mov edi, vout
// Load in vector in op[0]
movss xmm0, [eax]vin.x
movss xmm1, [eax]vin.y
movss xmm2, [eax]vin.z
// Expand op[0] to op[1], op[2], op[3]
shufps xmm0, xmm0, 0
shufps xmm1, xmm1, 0
shufps xmm2, xmm2, 0
// Mul each vector with 3 Matrix column
mulps xmm0, [ebx]this.a11
mulps xmm1, [ebx]this.a12
mulps xmm2, [ebx]this.a13
// Add each column vector.
addps xmm0, xmm1
addps xmm0, xmm2
// Add Matrix translate column vector
addps xmm0, [ebx]this.a14
// write the result.
movss [edi]vout.x, xmm0
shufps xmm0, xmm0, 33
movss [edi]vout.y, xmm0
movhlps xmm0, xmm0
movss [edi]vout.z, xmm0
}
}
// mulSetvector. NB: vin should be different as v!! (else don't work).
void mulSetVector(const CVector &vin, float scale, CVector &vout)
{
__asm
{
mov eax, vin
mov ebx, this
mov edi, vout
// Load in vector in op[0]
movss xmm0, [eax]vin.x
movss xmm1, [eax]vin.y
movss xmm2, [eax]vin.z
// Load scale in op[0]
movss xmm3, scale
// Expand op[0] to op[1], op[2], op[3]
shufps xmm0, xmm0, 0
shufps xmm1, xmm1, 0
shufps xmm2, xmm2, 0
shufps xmm3, xmm3, 0
// Store vertex column in other regs.
movaps xmm5, xmm0
movaps xmm6, xmm1
movaps xmm7, xmm2
// Mul each vector with 3 Matrix column
mulps xmm0, [ebx]this.a11
mulps xmm1, [ebx]this.a12
mulps xmm2, [ebx]this.a13
// Add each column vector.
addps xmm0, xmm1
addps xmm0, xmm2
// mul final result with scale
mulps xmm0, xmm3
// store it in xmm4 for future use.
movaps xmm4, xmm0
}
}
// mulSetpoint. NB: vin should be different as v!! (else don't work).
void mulSetPoint(const CVector &vin, float scale, CVector &vout)
{
__asm
{
mov eax, vin
mov ebx, this
mov edi, vout
// Load in vector in op[0]
movss xmm0, [eax]vin.x
movss xmm1, [eax]vin.y
movss xmm2, [eax]vin.z
// Load scale in op[0]
movss xmm3, scale
// Expand op[0] to op[1], op[2], op[3]
shufps xmm0, xmm0, 0
shufps xmm1, xmm1, 0
shufps xmm2, xmm2, 0
shufps xmm3, xmm3, 0
// Store vertex column in other regs.
movaps xmm5, xmm0
movaps xmm6, xmm1
movaps xmm7, xmm2
// Mul each vector with 3 Matrix column
mulps xmm0, [ebx]this.a11
mulps xmm1, [ebx]this.a12
mulps xmm2, [ebx]this.a13
// Add each column vector.
addps xmm0, xmm1
addps xmm0, xmm2
// Add Matrix translate column vector
addps xmm0, [ebx]this.a14
// mul final result with scale
mulps xmm0, xmm3
// store it in xmm4 for future use.
movaps xmm4, xmm0
}
}
// mulAddvector. NB: vin should be different as v!! (else don't work).
void mulAddVector(const CVector &/* vin */, float scale, CVector &vout)
{
__asm
{
mov ebx, this
mov edi, vout
// Load vin vector loaded in mulSetVector
movaps xmm0, xmm5
movaps xmm1, xmm6
movaps xmm2, xmm7
// Load scale in op[0]
movss xmm3, scale
// Expand op[0] to op[1], op[2], op[3]
shufps xmm3, xmm3, 0
// Mul each vector with 3 Matrix column
mulps xmm0, [ebx]this.a11
mulps xmm1, [ebx]this.a12
mulps xmm2, [ebx]this.a13
// Add each column vector.
addps xmm0, xmm1
addps xmm0, xmm2
// mul final result with scale
mulps xmm0, xmm3
// Add result, with prec sum.
addps xmm0, xmm4
// store it in xmm4 for future use.
movaps xmm4, xmm0
// write the result.
movss [edi]vout.x, xmm0
shufps xmm0, xmm0, 33
movss [edi]vout.y, xmm0
movhlps xmm0, xmm0
movss [edi]vout.z, xmm0
}
}
// mulAddpoint. NB: vin should be different as v!! (else don't work).
void mulAddPoint(const CVector &/* vin */, float scale, CVector &vout)
{
__asm
{
mov ebx, this
mov edi, vout
// Load vin vector loaded in mulSetPoint
movaps xmm0, xmm5
movaps xmm1, xmm6
movaps xmm2, xmm7
// Load scale in op[0]
movss xmm3, scale
// Expand op[0] to op[1], op[2], op[3]
shufps xmm3, xmm3, 0
// Mul each vector with 3 Matrix column
mulps xmm0, [ebx]this.a11
mulps xmm1, [ebx]this.a12
mulps xmm2, [ebx]this.a13
// Add each column vector.
addps xmm0, xmm1
addps xmm0, xmm2
// Add Matrix translate column vector
addps xmm0, [ebx]this.a14
// mul final result with scale
mulps xmm0, xmm3
// Add result, with prec sum.
addps xmm0, xmm4
// store it in xmm4 for future use.
movaps xmm4, xmm0
// write the result.
movss [edi]vout.x, xmm0
shufps xmm0, xmm0, 33
movss [edi]vout.y, xmm0
movhlps xmm0, xmm0
movss [edi]vout.z, xmm0
}
}
};
#else // NL_OS_WINDOWS
/// dummy CMatrix3x4SSE for non windows platform
class CMatrix3x4SSE : public CMatrix3x4 { };
#endif
} // NL3D

@ -1178,9 +1178,6 @@ private:
CPSMultiMap<uint32, CPSLocatedBindable *>::M TLBMap;
TLBMap _LBMap;
float _AutoLODStartDistPercent;
uint8 _AutoLODDegradationExponent;
CPSAttribMaker<NLMISC::CRGBA> *_ColorAttenuationScheme;
NLMISC::CRGBA _GlobalColor;
NLMISC::CRGBA _GlobalColorLighted;
@ -1206,6 +1203,11 @@ private:
bool _HiddenAtCurrentFrame : 1;
bool _HiddenAtPreviousFrame : 1;
// The two following members have been moved after the bitfield to workaround a MSVC 64-bit compiler bug (fixed in VS2013)
// For more info, see: http://connect.microsoft.com/VisualStudio/feedback/details/777184/c-compiler-bug-vtable-pointer-put-at-wrong-offset-in-64-bit-mode
float _AutoLODStartDistPercent;
uint8 _AutoLODDegradationExponent;
static bool _SerialIdentifiers;
static bool _ForceDisplayBBox;

@ -0,0 +1,83 @@
/**
* \file render_target_manager.h
* \brief CRenderTargetManager
* \date 2014-07-30 21:30GMT
* \author Jan Boon (Kaetemi)
* CRenderTargetManager
*/
/*
* Copyright (C) 2013 by authors
*
* This file is part of NL3D.
* NL3D is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* NL3D is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
* Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef NL3D_RENDER_TARGET_MANAGER_H
#define NL3D_RENDER_TARGET_MANAGER_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
#include <nel/misc/smart_ptr.h>
#include <nel/misc/geom_ext.h>
// Project includes
#include <nel/3d/u_texture.h>
namespace NL3D {
class UDriver;
class ITexture;
class CTextureUser;
class CDriverUser;
struct CRenderTargetDescInt;
/**
* \brief CRenderTargetManager
* \date 2013-07-03 20:17GMT
* \author Jan Boon (Kaetemi)
* CRenderTargetManager
* Usage: Call 'getRenderTarget' when you start using a render target,
* call 'recycledRenderTarget' when the render target can be recycled.
* At end of frame call cleanup.
* Assumes semi-constant render target quantity between frames,
* except on changes of resolution or feature settings.
*/
class CRenderTargetManager
{
public:
CRenderTargetManager();
~CRenderTargetManager();
NL3D::CTextureUser *getRenderTarget(uint width, uint height, bool mode2D = false, UTexture::TUploadFormat format = UTexture::Auto);
void recycleRenderTarget(NL3D::CTextureUser *renderTarget);
void cleanup();
private:
friend class CDriverUser;
NL3D::UDriver *m_Driver;
std::vector<CRenderTargetDescInt *> m_RenderTargets;
}; /* class CRenderTargetManager */
} /* namespace NL3D */
#endif /* #ifndef NL3D_RENDER_TARGET_MANAGER_H */
/* end of file */

@ -139,7 +139,7 @@ public:
* \param renderPart : The part of the scene that must be rendered
* \param newRender true If scene render is beginning. Otherwise other parts of the scene have already been rendered.
*/
void traverse(UScene::TRenderPart renderPart, bool newRender);
void traverse(UScene::TRenderPart renderPart, bool newRender, bool generateShadows);
//@}
/// \name RenderList.

@ -157,7 +157,7 @@ public:
* \param doHrcPass set it to false to indicate that the CHrcTrav have not to be traversed. Useful to optimize if
* you know that NONE of your models have moved (a good example is a shoot of the scene from different cameras).
*/
void render(bool doHrcPass=true);
void render(bool doHrcPass = true);
/** Begin Part Rendering
* During beginPartRender()/endPartRender(), you can ask other scene to render their part, but you should
@ -171,10 +171,10 @@ public:
* WARNING: always must begin rendering with at least UScene::RenderOpaque, else shadows won't work
* WARNING: assert-crash if a part in 'rp' has already been rendered since the last beginPartRender()
*/
void renderPart(UScene::TRenderPart rp, bool doHrcPass=true);
void renderPart(UScene::TRenderPart rp, bool doHrcPass = true, bool doTrav = true, bool keepTrav = false);
/** End Part Rendering (commit model creation and deletion that were asked during rendering)
*/
void endPartRender();
void endPartRender(bool keepTrav = false);
//@}

@ -96,8 +96,8 @@ public:
// render methods
virtual void render(bool updateWaitingInstances = true, bool restoreMatrixContextAfterRender = true);
virtual void beginPartRender();
virtual void renderPart(TRenderPart rp);
virtual void endPartRender(bool updateWaitingInstances = true, bool restoreMatrixContextAfterRender = true);
virtual void renderPart(TRenderPart rp, bool doHrcPass = true, bool doTrav = true, bool keepTrav = false);
virtual void endPartRender(bool updateWaitingInstances = true, bool restoreMatrixContextAfterRender = true, bool keepTrav = true);
// update async loading whithout a call to render
virtual void updateWaitingInstances(double ellapsedTime);

@ -54,7 +54,7 @@ public:
// The index of the skin rdrPass
uint16 RdrPassIndex;
// The texture id of the specular texture. This is the sort Key.
uint32 SpecId;
uintptr_t SpecId;
bool operator<(const CSkinSpecularRdrPass &o) const
{

@ -65,10 +65,17 @@ public:
/// Sets driver and generates necessary render targets
virtual void setDriver(NL3D::UDriver *driver);
void releaseTextures();
/*void releaseTextures();
void initTextures();
void setTextures();
void verifyTextures();
void verifyTextures();*/
void getTextures();
void recycleTextures();
/// Attach the driver to the display
virtual bool attachToDisplay();
/// Detach the driver from the display
virtual void detachFromDisplay();
/// Gets the required screen resolution for this device
virtual bool getScreenResolution(uint &width, uint &height);
@ -76,6 +83,8 @@ public:
virtual void updateCamera(uint cid, const NL3D::UCamera *camera);
/// Get the frustum to use for clipping
virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const;
/// Get the original frustum of the camera
virtual void getOriginalFrustum(uint cid, NL3D::UCamera *camera) const;
/// Is there a next pass
virtual bool nextPass();
@ -92,11 +101,18 @@ public:
virtual bool wantClear();
/// The 3D scene
virtual bool wantScene();
/// Scene post processing effects
virtual bool wantSceneEffects();
/// Interface within the 3D scene
virtual bool wantInterface3D();
/// 2D Interface
virtual bool wantInterface2D();
/// Is this the first 3D scene of the frame
virtual bool isSceneFirst();
/// Is this the last 3D scene of the frame
virtual bool isSceneLast();
/// Returns true if a new render target was set, always fase if not using render targets
virtual bool beginRenderTarget();
/// Returns true if a render target was fully drawn, always false if not using render targets
@ -116,9 +132,7 @@ private:
CFrustum m_Frustum[NL_STEREO_MAX_USER_CAMERAS];
CMatrix m_CameraMatrix[NL_STEREO_MAX_USER_CAMERAS];
NLMISC::CSmartPtr<NL3D::ITexture> m_LeftTex;
NL3D::CTextureUser *m_LeftTexU;
NLMISC::CSmartPtr<NL3D::ITexture> m_RightTex;
NL3D::CTextureUser *m_RightTexU;
NL3D::UMaterial m_Mat;
NLMISC::CQuadUV m_QuadUV;

@ -95,12 +95,19 @@ public:
/// Sets driver and generates necessary render targets
virtual void setDriver(NL3D::UDriver *driver) = 0;
/// Attach the driver to the display, return true if attached
virtual bool attachToDisplay() = 0;
/// Detach the driver from the display
virtual void detachFromDisplay() = 0;
/// Gets the required screen resolution for this device
virtual bool getScreenResolution(uint &width, uint &height) = 0;
/// Set latest camera position etcetera
virtual void updateCamera(uint cid, const NL3D::UCamera *camera) = 0;
/// Get the frustum to use for clipping
virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const = 0;
/// Get the original frustum of the camera
virtual void getOriginalFrustum(uint cid, NL3D::UCamera *camera) const = 0;
/// Is there a next pass
virtual bool nextPass() = 0;
@ -117,17 +124,25 @@ public:
virtual bool wantClear() = 0;
/// The 3D scene
virtual bool wantScene() = 0;
/// Scene post processing effects
virtual bool wantSceneEffects() = 0;
/// Interface within the 3D scene
virtual bool wantInterface3D() = 0;
/// 2D Interface
virtual bool wantInterface2D() = 0;
/// Is this the first 3D scene of the frame
virtual bool isSceneFirst() = 0;
/// Is this the last 3D scene of the frame
virtual bool isSceneLast() = 0;
/// Returns true if a new render target was set, always fase if not using render targets
virtual bool beginRenderTarget() = 0;
/// Returns true if a render target was fully drawn, always false if not using render targets
virtual bool endRenderTarget() = 0;
static const char *getLibraryName(CStereoDeviceInfo::TStereoDeviceLibrary library);
// List all devices. Device creation factories are no longer valid after re-calling this function
static void listDevices(std::vector<CStereoDeviceInfo> &devicesOut);
static IStereoDisplay *createDevice(const CStereoDeviceInfo &deviceInfo);
static void releaseUnusedLibraries();

@ -53,6 +53,9 @@ public:
/// Get the HMD orientation
virtual NLMISC::CQuat getOrientation() const = 0;
/// Set the GUI reference
virtual void setInterfaceMatrix(const NL3D::CMatrix &matrix) = 0;
/// Get GUI center (1 = width, 1 = height, 0 = center)
virtual void getInterface2DShift(uint cid, float &x, float &y, float distance) const = 0;

@ -44,7 +44,7 @@
#ifndef NL3D_STEREO_OVR_H
#define NL3D_STEREO_OVR_H
#ifdef HAVE_LIBOVR
#ifdef HAVE_LIBOVR_02
#include <nel/misc/types_nl.h>
@ -91,6 +91,8 @@ public:
virtual void updateCamera(uint cid, const NL3D::UCamera *camera);
/// Get the frustum to use for clipping
virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const;
/// Get the original frustum of the camera
virtual void getOriginalFrustum(uint cid, NL3D::UCamera *camera) const;
/// Is there a next pass
virtual bool nextPass();
@ -121,6 +123,9 @@ public:
/// Get the HMD orientation
virtual NLMISC::CQuat getOrientation() const;
/// Set the GUI reference
virtual void setInterfaceMatrix(const NL3D::CMatrix &matrix);
/// Get GUI center (1 = width, 1 = height, 0 = center)
virtual void getInterface2DShift(uint cid, float &x, float &y, float distance) const;
@ -132,33 +137,37 @@ public:
/// Set the scale of the game in units per meter
virtual void setScale(float s);
static void listDevices(std::vector<CStereoDeviceInfo> &devicesOut);
static bool isLibraryInUse();
static void releaseLibrary();
/// Calculates internal camera information based on the reference camera
void initCamera(uint cid, const NL3D::UCamera *camera);
/// Render GUI
void renderGUI();
/// Checks if the device used by this class was actually created
bool isDeviceCreated();
static void listDevices(std::vector<CStereoDeviceInfo> &devicesOut);
static bool isLibraryInUse();
static void releaseLibrary();
private:
CStereoOVRDevicePtr *m_DevicePtr;
int m_Stage;
int m_SubStage;
CViewport m_RegularViewport;
CViewport m_LeftViewport;
CViewport m_RightViewport;
CFrustum m_ClippingFrustum[NL_STEREO_MAX_USER_CAMERAS];
CFrustum m_LeftFrustum[NL_STEREO_MAX_USER_CAMERAS];
CFrustum m_RightFrustum[NL_STEREO_MAX_USER_CAMERAS];
CFrustum m_OriginalFrustum[NL_STEREO_MAX_USER_CAMERAS];
CMatrix m_CameraMatrix[NL_STEREO_MAX_USER_CAMERAS];
CMatrix m_InterfaceCameraMatrix;
mutable bool m_OrientationCached;
mutable NLMISC::CQuat m_OrientationCache;
UDriver *m_Driver;
NLMISC::CSmartPtr<NL3D::ITexture> m_BarrelTex;
NL3D::CTextureUser *m_BarrelTexU;
NL3D::CTextureUser *m_SceneTexture;
NL3D::UMaterial m_BarrelMat;
NL3D::CTextureUser *m_GUITexture;
NLMISC::CQuadUV m_BarrelQuadLeft;
NLMISC::CQuadUV m_BarrelQuadRight;
NLMISC::CRefPtr<CPixelProgramOVR> m_PixelProgram;

@ -0,0 +1,225 @@
/**
* \file stereo_ovr.h
* \brief CStereoOVR
* \date 2014-08-04 16:21GMT
* \author Jan Boon (Kaetemi)
* CStereoOVR
*/
/*
* Copyright (C) 2014 by authors
*
* This file is part of NL3D.
* NL3D is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* NL3D is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
* Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*
* Linking this library statically or dynamically with other modules
* is making a combined work based on this library. Thus, the terms
* and conditions of the GNU General Public License cover the whole
* combination.
*
* As a special exception, the copyright holders of this library give
* you permission to link this library with the Oculus SDK to produce
* an executable, regardless of the license terms of the Oculus SDK,
* and distribute linked combinations including the two, provided that
* you also meet the terms and conditions of the license of the Oculus
* SDK. You must obey the GNU General Public License in all respects
* for all of the code used other than the Oculus SDK. If you modify
* this file, you may extend this exception to your version of the
* file, but you are not obligated to do so. If you do not wish to do
* so, delete this exception statement from your version.
*/
#ifndef NL3D_STEREO_OVR_04_H
#define NL3D_STEREO_OVR_04_H
#ifdef HAVE_LIBOVR
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
#include <nel/misc/smart_ptr.h>
#include <nel/misc/geom_ext.h>
// Project includes
#include <nel/3d/stereo_hmd.h>
#include <nel/3d/frustum.h>
#include <nel/3d/viewport.h>
#include <nel/3d/u_material.h>
#include <nel/3d/u_driver.h>
#include <nel/3d/index_buffer.h>
#include <nel/3d/vertex_buffer.h>
struct ovrHmdDesc_;
typedef const ovrHmdDesc_ *ovrHmd;
namespace NL3D {
class ITexture;
class CTextureUser;
class CStereoOVRDeviceFactory;
#define NL_STEREO_MAX_USER_CAMERAS 8
#define NL_OVR_EYE_COUNT 2
/**
* \brief CStereoOVR
* \date 2014-08-04 16:21GMT
* \author Jan Boon (Kaetemi)
* CStereoOVR
*/
class CStereoOVR : public IStereoHMD
{
public:
CStereoOVR(const CStereoOVRDeviceFactory *factory);
virtual ~CStereoOVR();
/// Sets driver and generates necessary render targets
virtual void setDriver(NL3D::UDriver *driver);
/// Attach the driver to the display
virtual bool attachToDisplay();
/// Detach the driver from the display
virtual void detachFromDisplay();
/// Gets the required screen resolution for this device
virtual bool getScreenResolution(uint &width, uint &height);
/// Set latest camera position etcetera
virtual void updateCamera(uint cid, const NL3D::UCamera *camera);
/// Get the frustum to use for clipping
virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const;
/// Get the original frustum of the camera
virtual void getOriginalFrustum(uint cid, NL3D::UCamera *camera) const;
/// Is there a next pass
virtual bool nextPass();
/// Gets the current viewport
virtual const NL3D::CViewport &getCurrentViewport() const;
/// Gets the current camera frustum
virtual const NL3D::CFrustum &getCurrentFrustum(uint cid) const;
/// Gets the current camera frustum
virtual void getCurrentFrustum(uint cid, NL3D::UCamera *camera) const;
/// Gets the current camera matrix
virtual void getCurrentMatrix(uint cid, NL3D::UCamera *camera) const;
/// At the start of a new render target
virtual bool wantClear();
/// The 3D scene
virtual bool wantScene();
/// Scene post processing effects
virtual bool wantSceneEffects();
/// Interface within the 3D scene
virtual bool wantInterface3D();
/// 2D Interface
virtual bool wantInterface2D();
/// Is this the first 3D scene of the frame
virtual bool isSceneFirst();
/// Is this the last 3D scene of the frame
virtual bool isSceneLast();
/// Returns true if a new render target was set, always fase if not using render targets
virtual bool beginRenderTarget();
/// Returns true if a render target was fully drawn, always false if not using render targets
virtual bool endRenderTarget();
/// Get the HMD orientation
virtual NLMISC::CQuat getOrientation() const;
/// Set the GUI reference
virtual void setInterfaceMatrix(const NL3D::CMatrix &matrix);
/// Get GUI center (1 = width, 1 = height, 0 = center)
virtual void getInterface2DShift(uint cid, float &x, float &y, float distance) const;
/// Set the head model, eye position relative to orientation point
virtual void setEyePosition(const NLMISC::CVector &v);
/// Get the head model, eye position relative to orientation point
virtual const NLMISC::CVector &getEyePosition() const;
/// Set the scale of the game in units per meter
virtual void setScale(float s);
/// Calculates internal camera information based on the reference camera
void initCamera(uint cid, const NL3D::UCamera *camera);
/// Render GUI
void renderGUI();
/// Checks if the device used by this class was actually created
bool isDeviceCreated();
static void listDevices(std::vector<CStereoDeviceInfo> &devicesOut);
static bool isLibraryInUse();
static void releaseLibrary();
private:
ovrHmd m_DevicePtr;
bool m_DebugDevice;
int m_Stage;
int m_SubStage;
CViewport m_RegularViewport;
CViewport m_EyeViewport[NL_OVR_EYE_COUNT];
CFrustum m_EyeFrustumBase[NL_OVR_EYE_COUNT];
uint m_RenderTargetWidth;
uint m_RenderTargetHeight;
NLMISC::CVector2f m_EyeUVScaleOffset[NL_OVR_EYE_COUNT][2];
float m_EyeViewAdjustX[NL_OVR_EYE_COUNT];
CVertexBuffer m_VB[NL_OVR_EYE_COUNT];
CIndexBuffer m_IB[NL_OVR_EYE_COUNT];
uint32 m_NbTris[NL_OVR_EYE_COUNT];
CFrustum m_ClippingFrustum[NL_STEREO_MAX_USER_CAMERAS];
CFrustum m_LeftFrustum[NL_STEREO_MAX_USER_CAMERAS];
CFrustum m_RightFrustum[NL_STEREO_MAX_USER_CAMERAS];
CFrustum m_OriginalFrustum[NL_STEREO_MAX_USER_CAMERAS];
CMatrix m_CameraMatrix[NL_STEREO_MAX_USER_CAMERAS];
CMatrix m_InterfaceCameraMatrix;
mutable bool m_OrientationCached;
mutable NLMISC::CQuat m_OrientationCache;
UDriver *m_Driver;
CTextureUser *m_GUITexture;
NL3D::CTextureUser *m_SceneTexture;
UMaterial m_UnlitMat;
UDriver::CMode m_OriginalMode;
sint32 m_OriginalWinPosX;
sint32 m_OriginalWinPosY;
bool m_AttachedDisplay;
/*
NL3D::UMaterial m_BarrelMat;
NLMISC::CQuadUV m_BarrelQuadLeft;
NLMISC::CQuadUV m_BarrelQuadRight;
NLMISC::CRefPtr<CPixelProgramOVR> m_PixelProgram;*/
NLMISC::CVector m_EyePosition;
float m_Scale;
}; /* class CStereoOVR */
} /* namespace NL3D */
#endif /* HAVE_LIBOVR */
#endif /* #ifndef NL3D_STEREO_OVR_04_H */
/* end of file */

@ -82,6 +82,8 @@ public:
void setShaded (bool b) { _Shaded = b; }
void setShadeOutline (bool b) { _ShadeOutline = b; }
void setShadeExtent (float shext) { _ShadeExtent = shext; }
/// The alpha of the shade is multiplied at each draw with the alpha of the color. Default: (0,0,0,255)
@ -107,6 +109,8 @@ public:
bool getShaded() const { return _Shaded; }
bool getShadeOutline() const { return _ShadeOutline; }
bool getKeep800x600Ratio() const {return _Keep800x600Ratio;}
NLMISC::CRGBA getShadeColor () const { return _ShadeColor; }
@ -138,15 +142,30 @@ public:
{
nlassert (index < _CacheStrings.size());
CComputedString &rCS = _CacheStrings[index];
if(_Shaded)
if (_Shaded)
{
CRGBA bkup = rCS.Color;
CRGBA bkup = rCS.Color;
rCS.Color = _ShadeColor;
rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
rCS.render2D (*_Driver, x+_ShadeExtent, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ);
if (_ShadeOutline)
{
float rext = _ShadeExtent * 0.7071f;
rCS.render2D(*_Driver, x+rext, z-rext, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x-rext, z-rext, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x-rext, z+rext, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x+rext, z+rext, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x+_ShadeExtent, z, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x-_ShadeExtent, z, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ);
}
else
{
rCS.render2D(*_Driver, x+_ShadeExtent, z-_ShadeExtent, _HotSpot, _ScaleX, _ScaleZ);
}
rCS.Color= bkup;
}
rCS.render2D (*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ);
rCS.render2D(*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ);
}
/** Clip and print a string that is in the cache (it leaves the string in the cache)
@ -161,7 +180,22 @@ public:
CRGBA bkup = rCS.Color;
rCS.Color= _ShadeColor;
rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z-_ShadeExtent, xmin, ymin, xmax, ymax);
if (_ShadeOutline)
{
float rext = _ShadeExtent * 0.7071f;
rCS.render2DClip(*_Driver, rdrBuffer, x+rext, z-rext, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x-rext, z-rext, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x-rext, z+rext, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x+rext, z+rext, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x-_ShadeExtent, z, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x, z+_ShadeExtent, xmin, ymin, xmax, ymax);
rCS.render2DClip(*_Driver, rdrBuffer, x, z-_ShadeExtent, xmin, ymin, xmax, ymax);
}
else
{
rCS.render2DClip(*_Driver, rdrBuffer, x+_ShadeExtent, z-_ShadeExtent, xmin, ymin, xmax, ymax);
}
rCS.Color= bkup;
}
rCS.render2DClip (*_Driver, rdrBuffer, x, z, xmin, ymin, xmax, ymax);
@ -174,12 +208,27 @@ public:
{
nlassert (index < _CacheStrings.size());
CComputedString &rCS = _CacheStrings[index];
if(_Shaded)
if (_Shaded)
{
CRGBA bkup = rCS.Color;
rCS.Color= _ShadeColor;
rCS.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax);
if (_ShadeOutline)
{
float rext = _ShadeExtent * 0.7071f;
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rext, y-rext, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rext, y-rext, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-rext, y+rext, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+rext, y+rext, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x-_ShadeExtent, y, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y+_ShadeExtent, depth, xmin, ymin, xmax, ymax);
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax);
}
else
{
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x+_ShadeExtent, y-_ShadeExtent, depth, xmin, ymin, xmax, ymax);
}
rCS.Color= bkup;
}
rCS.render2DUnProjected (*_Driver, renderBuffer, frustum, scaleMatrix, x, y, depth, xmin, ymin, xmax, ymax);
@ -194,17 +243,32 @@ public:
_FontManager->computeString (ucstr, _FontGen, _Color, _FontSize, _Driver, _TempString, _Keep800x600Ratio);
// draw shaded
if(_Shaded)
if (_Shaded)
{
CRGBA bkup = _TempString.Color;
_TempString.Color= _ShadeColor;
_TempString.Color = _ShadeColor;
_TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
_TempString.render2D (*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
_TempString.Color= bkup;
if (_ShadeOutline)
{
float rext = _ShadeExtent * 0.7071f;
_TempString.render2D(*_Driver,x+rext,z-rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-rext,z-rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-rext,z+rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x+rext,z+rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x+_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
}
else
{
_TempString.render2D(*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
}
_TempString.Color = bkup;
}
// draw
_TempString.render2D (*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ);
_TempString.render2D(*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ);
}
/// Directly print a string
@ -218,17 +282,32 @@ public:
_FontManager->computeString (str, _FontGen, _Color, _FontSize, _Driver, _TempString, _Keep800x600Ratio);
// draw shaded
if(_Shaded)
if (_Shaded)
{
CRGBA bkup = _TempString.Color;
_TempString.Color = _ShadeColor;
_TempString.Color.A = (uint8)((uint(bkup.A) * uint(_ShadeColor.A)+1)>>8);
_TempString.render2D (*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
_TempString.Color= bkup;
if (_ShadeOutline)
{
float rext = _ShadeExtent * 0.7071f;
_TempString.render2D(*_Driver,x+rext,z-rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-rext,z-rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-rext,z+rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x+rext,z+rext,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x+_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x-_ShadeExtent,z,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z+_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
_TempString.render2D(*_Driver,x,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
}
else
{
_TempString.render2D(*_Driver,x+_ShadeExtent,z-_ShadeExtent,_HotSpot,_ScaleX,_ScaleZ);
}
_TempString.Color = bkup;
}
// draw
_TempString.render2D (*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ);
_TempString.render2D(*_Driver, x, z, _HotSpot, _ScaleX, _ScaleZ);
}
/// Get computed string from index
@ -317,6 +396,9 @@ private:
/// true if text is shaded
bool _Shaded;
/// true if shade appears as an outline
bool _ShadeOutline;
/// shade's extent (shadow size)
float _ShadeExtent;

@ -64,19 +64,21 @@ public:
/// \name Text look.
// @{
void setColor(NLMISC::CRGBA color);
void setFontSize(uint32 fontSize) ;
uint32 getFontSize() const ;
void setHotSpot(THotSpot hotSpot) ;
THotSpot getHotSpot() const ;
void setScaleX(float scaleX) ;
void setScaleY(float scaleY) ;
float getScaleX() const ;
float getScaleY() const ;
void setShaded(bool b) ;
bool getShaded() const ;
void setShadeExtent(float shext) ;
void setShadeColor (NLMISC::CRGBA sc);
NLMISC::CRGBA getShadeColor () const;
void setFontSize(uint32 fontSize);
uint32 getFontSize() const;
void setHotSpot(THotSpot hotSpot);
THotSpot getHotSpot() const;
void setScaleX(float scaleX);
void setScaleY(float scaleY);
float getScaleX() const;
float getScaleY() const;
void setShaded(bool b);
bool getShaded() const;
void setShadeOutline(bool b);
bool getShadeOutline() const;
void setShadeExtent(float shext) ;
void setShadeColor (NLMISC::CRGBA sc);
NLMISC::CRGBA getShadeColor () const;
void setKeep800x600Ratio(bool keep);
bool getKeep800x600Ratio() const;
// @}

@ -86,6 +86,11 @@ public:
_BitmapName[bitmapType]=name;
}
std::string getFileName (TBitmap bitmapType) const
{
return _BitmapName[bitmapType];
}
/// Get the additional orientation (CCW) for alpha texture.
uint8 getRotAlpha ()
{
@ -161,6 +166,9 @@ public:
{
return _Name;
};
std::set<std::string> getTileSets() const{ return _TileSet; }
void setName (const std::string& name);
void addTileSet (const std::string& name);
void removeTileSet (const std::string& name);
@ -169,6 +177,8 @@ public:
return _TileSet.find (name)!=_TileSet.end();
}
void clear(){ _TileSet.clear(); }
void serial(class NLMISC::IStream &f) throw(NLMISC::EStream);
private:

@ -218,7 +218,7 @@ protected:
date*= previous->OODeltaTime;
NLMISC::clamp(date, 0,1);
date = this->ease(previous, date);
date = this->ease(previous, (float)date);
float hb[4];
this->computeHermiteBasis(date, hb);

@ -35,9 +35,6 @@
namespace NLMISC
{
struct IMouseDevice;
struct IKeyboardDevice;
struct IInputDeviceManager;
class CLog;
}
@ -63,6 +60,7 @@ class U3dMouseListener;
class ULight;
class UAnimationSet;
class UWaterEnvMap;
class CRenderTargetManager;
typedef void (*emptyProc)(void);
@ -94,6 +92,7 @@ public:
/// A Graphic Mode descriptor.
struct CMode
{
std::string DisplayDevice;
bool Windowed;
uint16 Width;
uint16 Height;
@ -110,8 +109,9 @@ public:
Frequency = 0;
AntiAlias = -1;
}
CMode(uint16 w, uint16 h, uint8 d, bool windowed= true, uint frequency = 0, sint8 aa = -1)
CMode(uint16 w, uint16 h, uint8 d, bool windowed= true, uint frequency = 0, sint8 aa = -1, const std::string &displayDevice = std::string())
{
DisplayDevice = displayDevice;
Windowed = windowed;
Width = w;
Height = h;
@ -309,6 +309,16 @@ public:
// @}
/// Get the render target manager
virtual CRenderTargetManager &getRenderTargetManager() =0;
/// Set a texture of specified size or of the size of the window as render target
virtual void beginDefaultRenderTarget(uint32 width = 0, uint32 height = 0) =0;
/// Draw the render target to the back buffer
virtual void endDefaultRenderTarget(UScene *scene) =0;
/// \name Components gestion for Interface 2D/3D.
// @{
@ -556,36 +566,6 @@ public:
/// \name Mouse / Keyboard / Gamedevices
// @{
/** Enable / disable low level mouse. This allow to take advantage of some options (speed of the mouse, automatic wrapping)
* It returns a interface to these parameters when it is supported, or NULL otherwise
* The interface pointer is valid as long as the low level mouse is enabled.
* A call to disable the mouse returns NULL, and restore the default mouse behaviour
* NB : - In this mode the mouse cursor isn't drawn.
* - Calls to showCursor have no effects
* - Calls to setCapture have no effects
*/
virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool hardware) = 0;
/** Enable / disable a low level keyboard.
* This returns a interface to some parameters when it is supported, or NULL otherwise.
* The interface pointer is valid as long as the low level keyboard is enabled.
* A call to disable the keyboard returns NULL, and restore the default keyboard behaviour.
*/
virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable) = 0;
/** Check whether there is a low level device manager available, and get its interface. Return NULL if not available.
* From this interface you can deal with mouse and keyboard as above, but you can also manage game devices (joysticks, joypads ...)
*/
virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager() = 0;
/**
* wrapper for IEventEmitter::emulateMouseRawMode()
*/
virtual void emulateMouseRawMode(bool enable) = 0;
// get delay used for mouse double click
virtual uint getDoubleClickDelay(bool hardwareMouse) = 0;
/** show cursor if b is true, or hide it if b is false
* NB: This has no effects if a low level mouse is used.
*/
@ -845,8 +825,8 @@ public:
/**
* This is the static function which build a UDriver, the root for all 3D functions.
*/
static UDriver *createDriver(uint windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0);
static UDriver *createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc = 0);
static UDriver *createDriver(uintptr_t windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0);
static UDriver *createDriver(uintptr_t windowIcon, TDriver driver, emptyProc exitFunc = 0);
/**
* Purge static memory

@ -134,14 +134,17 @@ public:
/** Render a part (see render() for what it does)
* beginPartRender() must have been called
* \param renderPart a combination of UScene::TRenderPart flags, allow to choose which part of the scene must be rendered
* \param doHrcPass set it to false to indicate that the CHrcTrav have not to be traversed. Useful to optimize if
* you know that NONE of your models have moved (a good example is a shoot of the scene from different cameras).
* \param doTrav set to false when processing a second frame for stereo rending to avoid unnecessary traversals.
* WARNING: always must begin rendering with at least UScene::RenderOpaque, else shadows won't work
* WARNING: assert-crash if a part in 'rp' has already been rendered since the last beginPartRender()
*/
virtual void renderPart(UScene::TRenderPart rp) =0;
virtual void renderPart(UScene::TRenderPart rp, bool doHrcPass = true, bool doTrav = true, bool keepTrav = false) =0;
/** End Part Rendering (commit model creation and deletion that were asked during rendering)
*/
virtual void endPartRender(bool updateWaitingInstances = true, bool restoreMatrixContextAfterRender = true) =0;
virtual void endPartRender(bool updateWaitingInstances = true, bool restoreMatrixContextAfterRender = true, bool keepTrav = false) =0;
/** Update waiting instances and igs that are loaded asynchronously

@ -174,6 +174,15 @@ public:
* \return the shade state
*/
virtual bool getShaded () const = 0;
/**
* set the shade states
* \param the shade state
*/
virtual void setShadeOutline (bool b) = 0;
/**
* \return the shade state
*/
virtual bool getShadeOutline () const = 0;
/**
* set the shadow's size
* \param the shade extent

@ -87,6 +87,8 @@ public:
// Set as a type
void setType (CFormLoader &loader, const char *filename);
void setType (TEntryType type);
// Set as a dfn
void setDfn (CFormLoader &loader, const char *filename);
@ -160,6 +162,10 @@ public:
NLMISC::CSmartPtr<CFormDfn> Parent;
};
void addEntry( const std::string &name );
void removeEntry( uint idx );
// ** IO functions
void write (xmlDocPtr root, const char *filename);

@ -440,21 +440,24 @@ public:
// From UFormElm
bool isAtom () const;
bool getValue (std::string &resultname, TEval evaluate) const;
bool getValue (sint8 &resultname, TEval evaluate) const;
bool getValue (uint8 &resultname, TEval evaluate) const;
bool getValue (sint16 &resultname, TEval evaluate) const;
bool getValue (uint16 &resultname, TEval evaluate) const;
bool getValue (sint32 &resultname, TEval evaluate) const;
bool getValue (uint32 &resultname, TEval evaluate) const;
bool getValue (float &resultname, TEval evaluate) const;
bool getValue (double &resultname, TEval evaluate) const;
bool getValue (bool &resultname, TEval evaluate) const;
bool getValue (NLMISC::CRGBA &resultname, TEval evaluate) const;
bool getValue (std::string &result, TEval evaluate) const;
bool getValue (sint8 &result, TEval evaluate) const;
bool getValue (uint8 &result, TEval evaluate) const;
bool getValue (sint16 &result, TEval evaluate) const;
bool getValue (uint16 &result, TEval evaluate) const;
bool getValue (sint32 &result, TEval evaluate) const;
bool getValue (uint32 &result, TEval evaluate) const;
bool getValue (float &result, TEval evaluate) const;
bool getValue (double &result, TEval evaluate) const;
bool getValue (bool &result, TEval evaluate) const;
bool getValue (NLMISC::CRGBA &result, TEval evaluate) const;
// Set the value, the elt been used
void setValue (const char *value);
// Get the raw value. Does not care about any parent or default values
void getValue (std::string &result) const;
private:
// The value
std::string Value;

@ -68,6 +68,8 @@ namespace NLGUI
return _GlobalInstance;
}
void getActionHandlers( std::vector< std::string > &handlers );
/// return pointer to action handler or null if it doesn't exist
IActionHandler *getActionHandler(const std::string &name) const
{

@ -50,6 +50,8 @@ namespace NLGUI
// see interface.txt for meaning of auto
_ToolTipParentPosRef= Hotspot_TTAuto;
_ToolTipPosRef= Hotspot_TTAuto;
_EventX = 0;
_EventY = 0;
resizer = false;
}
@ -70,6 +72,9 @@ namespace NLGUI
bool handleEvent (const NLGUI::CEventDescriptor &event);
sint32 getEventX() { return _EventX; }
sint32 getEventY() { return _EventY; }
virtual CCtrlBase *getSubCtrl (sint32 /* x */, sint32 /* y */) { return this; }
/// Debug
@ -171,7 +176,9 @@ namespace NLGUI
THotSpot _ToolTipPosRefAlt : 6;
protected:
void convertTooltipHotSpot(const char *prop, THotSpot &parentHS, THotSpot &childHS);
void convertTooltipHotSpot(const char *prop, THotSpot &HS );
static std::string TooltipHotSpotToString( THotSpot parent, THotSpot child );
static std::string TooltipHotSpotToString( THotSpot HS );
void mapAHString( const std::string &key, const std::string &value );
std::string getAHString( const std::string &key ) const;
@ -179,6 +186,9 @@ namespace NLGUI
static std::map< std::string, std::map< std::string, std::string > > AHCache;
bool resizer;
sint32 _EventX;
sint32 _EventY;
};
}

@ -51,6 +51,7 @@ namespace NLGUI
// Init part
virtual bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup);
virtual void checkCoords();
virtual void updateCoords();
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
@ -126,6 +127,7 @@ namespace NLGUI
void onRemoved();
void onWidgetDeleted( CInterfaceElement *e );
void moveBy( sint32 x, sint32 y );
protected:

@ -60,7 +60,7 @@ namespace NLGUI
void setText(uint i, const ucstring &text);
void insertText(uint i, const ucstring &text);
const ucstring &getText(uint i) const;
const uint &getTextId(uint i) const;
uint getTextId(uint i) const;
uint getTextPos(uint nId) const;
const ucstring &getTexture(uint i) const;
void removeText(uint nPos);

@ -55,9 +55,7 @@ namespace NLGUI
static void forceLink();
protected:
sint64 getVal() { if (_Modulo == 0) return (_Number.getSInt64() / _Divisor);
else return (_Number.getSInt64() / _Divisor)%_Modulo; }
sint64 getVal();
protected:

@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string>
#include <vector>
namespace NLGUI
{
@ -24,7 +25,7 @@ namespace NLGUI
public:
/// Notifies the watcher about the change
virtual void selectionChanged( std::string &newSelection ) = 0;
virtual void selectionChanged() = 0;
};
}

@ -283,6 +283,10 @@ namespace NLGUI
sint32 _ViewTextDeltaX;
CViewText* getVT() const{ return _ViewText; }
void createViewText();
private:
void setupDisplayText();
void makeTopWindow();

@ -0,0 +1,53 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2014 Laszlo Kis-Adam
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef GROUP_EDITBOX_DECOR
#define GROUP_EDITBOX_DECOR
#include "nel/gui/group_editbox.h"
namespace NLGUI
{
/// Decorated CGroupEditBox
class CGroupEditBoxDecor : public CGroupEditBox
{
public:
DECLARE_UI_CLASS( CGroupEditBoxDecor )
CGroupEditBoxDecor( const TCtorParam &param );
~CGroupEditBoxDecor();
void moveBy( sint32 x, sint32 y );
void setIdRecurse( const std::string &newID );
std::string getProperty( const std::string &name ) const;
void setProperty( const std::string &name, const std::string &value );
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
bool parse( xmlNodePtr cur, CInterfaceGroup *parent );
void draw();
void updateCoords();
static void forceLink();
private:
class EBDPrivate *_Pvt;
};
}
#endif

@ -17,7 +17,6 @@
#ifndef CL_GROUP_HTML_H
#define CL_GROUP_HTML_H
#define CURL_STATICLIB 1
#include <curl/curl.h>
#include "nel/misc/types_nl.h"
@ -107,7 +106,7 @@ namespace NLGUI
void refresh();
// submit form
void submitForm (uint formId, const char *submitButtonName);
void submitForm (uint formId, const char *submitButtonType, const char *submitButtonName, const char *submitButtonValue, sint32 x, sint32 y);
// Browse error
void browseError (const char *msg);
@ -285,7 +284,7 @@ namespace NLGUI
void addImage(const char *image, bool globalColor, bool reloadImg=false);
// Add a text area in the current paragraph
CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content);
CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content, uint maxlength);
// Add a combo box in the current paragraph
CDBGroupComboBox *addComboBox(const std::string &templateName, const char *name);
@ -328,7 +327,11 @@ namespace NLGUI
bool _BrowseNextTime;
bool _PostNextTime;
uint _PostFormId;
std::string _PostFormSubmitType;
std::string _PostFormSubmitButton;
std::string _PostFormSubmitValue;
sint32 _PostFormSubmitX;
sint32 _PostFormSubmitY;
// Browsing..
bool _Browsing;
@ -528,7 +531,7 @@ namespace NLGUI
CCellParams () : BgColor(0,0,0,0)
{
Align = CGroupCell::Left;
VAlign = CGroupCell::Top;
VAlign = CGroupCell::Middle;
LeftMargin = 0;
NoWrap = false;
}
@ -557,6 +560,7 @@ namespace NLGUI
std::string _TextAreaName;
uint _TextAreaRow;
uint _TextAreaCols;
uint _TextAreaMaxLength;
// current mode is in select option
bool _SelectOption;

@ -381,6 +381,7 @@ namespace NLGUI
bool _CloseSubMenuUsingPopModal;
bool _Shadow;
bool _ShadowOutline;
bool _Formatted;
uint8 _Space;
sint32 _FontSize;

@ -78,6 +78,9 @@ namespace NLGUI
// The Width you want in pixel. This is the <td width="100"> parameter
sint32 WidthWanted;
sint32 ColSpan;
sint32 RowSpan;
sint32 TableColumnIndex;
// The min height of the cell
sint32 Height;
@ -142,6 +145,7 @@ namespace NLGUI
// Table borders
sint32 Border;
NLMISC::CRGBA BorderColor;
sint32 CellPadding;
sint32 CellSpacing;
@ -191,13 +195,14 @@ namespace NLGUI
WidthMax = 0;
WidthWanted = 0;
TableRatio = 0;
Height = 0;
RowSpan = 1;
}
sint32 Width;
sint32 Height;
sint32 WidthWanted;
sint32 WidthMax;
float TableRatio;
sint32 RowSpan;
};
// Table row

@ -117,6 +117,7 @@ namespace NLGUI
editorSelected = false;
serializable = true;
_EditorSelectable = true;
}
// dtor
@ -233,6 +234,9 @@ namespace NLGUI
virtual void setActive (bool state);
void setXReal( sint32 x ){ _XReal = x; }
void setYReal( sint32 y ){ _YReal = y; }
void setX (sint32 x) { _X = x; }
void setXAndInvalidateCoords (sint32 x) { _X = x; invalidateCoords(); }
@ -488,8 +492,12 @@ namespace NLGUI
void setEditorSelected( bool b ){ editorSelected = b; }
bool isEditorSelected() const{ return editorSelected; }
void parsePosParent( const std::string &id );
void setPosParent( const std::string &id );
void getPosParent( std::string &id ) const;
void parseSizeParent( const std::string &id );
void setSizeParent( const std::string &id );
void getSizeParent( std::string &id ) const;
void setSerializable( bool b ){ serializable = b; }
bool IsSerializable() const{ return serializable; }
@ -505,11 +513,35 @@ namespace NLGUI
/// Called when the widget is deleted,
/// so other widgets in the group can check if it belongs to them
virtual void onWidgetDeleted( CInterfaceElement *e ){}
virtual void onWidgetDeleted( CInterfaceElement *e );
/// Move the element by x in the X direction and y in the Y direction
// Uses real coordinates
virtual void moveBy( sint32 x, sint32 y )
{
_XReal += x;
_YReal += y;
}
/// Retrieves the coordinates of the specified hotspot
void getHSCoords( const THotSpot &hs, sint32 &x, sint32 &y ) const;
/// Tells which hotspot is the closest to the specified element
void getClosestHotSpot( const CInterfaceElement *other, THotSpot &hs );
/// Aligns the element to the other element specified
void alignTo( CInterfaceElement *other );
/// Specifies if the widget can be selected in the editor
void setEditorSelectable( bool b ){ _EditorSelectable = b; }
/// Tells if the widget can be selected in the editor
bool isEditorSelectable() const{ return _EditorSelectable; }
protected:
bool editorSelected;
bool _EditorSelectable;
static bool editorMode;

@ -14,19 +14,22 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef WIDGET_ADD_WATCHER
#define WIDGET_ADD_WATCHER
#ifndef IFACE_FACTORY
#define IFACE_FACTORY
#include <string>
namespace NLGUI
{
class IWidgetAdditionWatcher
class CViewBase;
/// Simple interface element ( widget ) factory
class CInterfaceFactory
{
public:
virtual void widgetAdded( const std::string &name ) = 0;
static CViewBase* createClass( const std::string &name );
};
}
#endif
#endif

@ -57,6 +57,7 @@ namespace NLGUI
CInterfaceElement* findFromShortId(const std::string &id);
/// Dynamic creation
virtual void addElement (CInterfaceElement *child, sint eltOrder = -1 );
virtual void addView (CViewBase *child , sint eltOrder = -1);
virtual void addCtrl (CCtrlBase *child, sint eltOrder = -1);
virtual void addGroup (CInterfaceGroup *child, sint eltOrder = -1);
@ -79,6 +80,9 @@ namespace NLGUI
bool delElement (const std::string &id, bool noWarning=false);
bool delElement (CInterfaceElement *pIE, bool noWarning=false);
// Take the element from the group, but don't delete it!
CInterfaceElement* takeElement( CInterfaceElement *e );
uint getNumGroup() const { return (uint)_ChildrenGroups.size(); }
CInterfaceGroup *getGroup(uint index) const;
@ -324,6 +328,17 @@ namespace NLGUI
void onWidgetDeleted( CInterfaceElement *e );
void moveBy( sint32 x, sint32 y );
// Blows up the group, moves it's children to it's parent
bool explode();
/// Adjusts the group's size so that all elements are fully inside the borders
void spanElements();
/// Aligns the elements - used for forming groups
void alignElements();
protected:
void makeNewClip (sint32 &oldClipX, sint32 &oldClipY, sint32 &oldClipW, sint32 &oldClipH);

@ -150,16 +150,17 @@ namespace NLGUI
sint32 TxId_E_Open, W_E_Open, H_E_Open;
sint32 TxId_M_Open, W_M_Open, H_M_Open;
sint32 TxId_TL_HighLight;
sint32 TxId_T_HighLight;
sint32 TxId_TR_HighLight;
sint32 TxId_L_HighLight;
sint32 TxId_R_HighLight;
sint32 TxId_BL_HighLight;
sint32 TxId_B_HighLight;
sint32 TxId_BR_HighLight;
sint32 HeaderH;
sint32 TxId_TL_HighLight, W_TL_HighLight, H_TL_HighLight;
sint32 TxId_T_HighLight, W_T_HighLight, H_T_HighLight;
sint32 TxId_TR_HighLight, W_TR_HighLight, H_TR_HighLight;
sint32 TxId_L_HighLight, W_L_HighLight, H_L_HighLight;
sint32 TxId_R_HighLight, W_R_HighLight, H_R_HighLight;
sint32 TxId_BL_HighLight, W_BL_HighLight, H_BL_HighLight;
sint32 TxId_B_HighLight, W_B_HighLight, H_B_HighLight;
sint32 TxId_BR_HighLight, W_BR_HighLight, H_BR_HighLight;
sint32 HeaderH;
sint32 InsetT; // Offset height of top texture
};
// ***************************************************************************

@ -28,6 +28,7 @@
#include "nel/gui/proc.h"
#include "nel/gui/widget_manager.h"
#include "nel/gui/link_data.h"
#include "nel/gui/variable_data.h"
namespace NLGUI
{
@ -100,20 +101,6 @@ namespace NLGUI
virtual void setupOptions() = 0;
};
struct VariableData
{
std::string entry;
std::string type;
std::string value;
uint32 size;
VariableData()
{
size = 0;
}
};
CInterfaceParser();
virtual ~CInterfaceParser();
@ -353,7 +340,15 @@ namespace NLGUI
std::map< std::string, std::string > pointerSettings;
std::map< std::string, std::map< std::string, std::string > > keySettings;
std::string _WorkDir;
public:
/// Sets the working directory, where files should be looked for
void setWorkDir( const std::string &workdir ){ _WorkDir = workdir; }
/// Looks up a file in either the working directory or using CPath::lookup
std::string lookup( const std::string &file );
void initLUA();
void uninitLUA();
bool isLuaInitialized() const{ return luaInitialized; }
@ -378,6 +373,7 @@ namespace NLGUI
void setEditorMode( bool b ){ editorMode = b; }
void setVariable( const VariableData &v );
bool serializeVariables( xmlNodePtr parentNode ) const;
bool serializeProcs( xmlNodePtr parentNode ) const;
bool serializePointerSettings( xmlNodePtr parentNode ) const;

@ -47,6 +47,15 @@ namespace NLGUI
_VolatileValue = NULL;
}
/// Tells if this property has a value
bool hasValue() const
{
if( _VolatileValue != NULL )
return true;
else
return false;
}
NLMISC::CCDBNodeLeaf* getNodePtr() const
{
return _VolatileValue;

@ -25,6 +25,8 @@ extern "C"
#include "WWWInit.h"
}
#include "nel/misc/rgba.h"
namespace NLGUI
{
class CCtrlBaseButton;
@ -79,6 +81,7 @@ namespace NLGUI
HTML_ATTR(TABLE,ALIGN) = 0,
HTML_ATTR(TABLE,BGCOLOR),
HTML_ATTR(TABLE,BORDER),
HTML_ATTR(TABLE,BORDERCOLOR),
HTML_ATTR(TABLE,CELLPADDING),
HTML_ATTR(TABLE,CELLSPACING),
HTML_ATTR(TABLE,CLASS),
@ -189,6 +192,7 @@ namespace NLGUI
HTML_ATTR(TEXTAREA,DISABLED),
HTML_ATTR(TEXTAREA,ID),
HTML_ATTR(TEXTAREA,LANG),
HTML_ATTR(TEXTAREA,MAXLENGTH),
HTML_ATTR(TEXTAREA,NAME),
HTML_ATTR(TEXTAREA,READONLY),
HTML_ATTR(TEXTAREA,ROWS),

@ -285,8 +285,7 @@ namespace NLGUI
class CLuaHashMapTraits
{
public:
static const size_t bucket_size = 4;
static const size_t min_buckets = 8;
enum { bucket_size = 4, min_buckets = 8, };
CLuaHashMapTraits()
{}

@ -23,6 +23,7 @@
#include "nel/misc/types_nl.h"
#include "nel/gui/proc.h"
#include "nel/gui/link_data.h"
#include "nel/gui/variable_data.h"
namespace NLGUI
{
@ -83,11 +84,13 @@ namespace NLGUI
virtual void removeLinkData( uint32 id ) = 0;
virtual bool getLinkData( uint32 id, SLinkData &linkData ) = 0;
virtual void updateLinkData( uint32 id, const SLinkData &linkData ) = 0;
virtual void setVariable( const VariableData &v ) = 0;
virtual bool serializeVariables( xmlNodePtr parentNode ) const = 0;
virtual bool serializeProcs( xmlNodePtr parentNode ) const = 0;
virtual bool serializePointerSettings( xmlNodePtr parentNode ) const = 0;
virtual bool serializeKeySettings( xmlNodePtr parentNode ) const = 0;
virtual CViewBase* createClass( const std::string &name ) = 0;
virtual void setWorkDir( const std::string &workdir ) = 0;
};
}

@ -14,27 +14,33 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef _READPIC_H_
#define _READPIC_H_
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#ifndef ROOT_GROUP_H
#define ROOT_GROUP_H
#include <string>
#include <vector>
#include <map>
#include <nel/misc/types_nl.h>
#include <nel/misc/rgba.h>
#include "nel/gui/interface_group.h"
//============================================================
// API.
//============================================================
namespace NLGUI
{
class CRootGroup : public CInterfaceGroup
{
public:
CRootGroup(const TCtorParam &param);
virtual ~CRootGroup();
bool PIC_LoadPic(std::string Path, std::vector<NLMISC::CBGRA> &Tampon, uint &Width, uint &Height);
virtual CInterfaceElement* getElement (const std::string &id);
virtual void addGroup (CInterfaceGroup *child, sint eltOrder = -1);
virtual bool delGroup (CInterfaceGroup *child, bool dontDelete = false);
private:
std::map< std::string, CInterfaceGroup* > _Accel;
};
}
#endif

@ -0,0 +1,41 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef VARIABLE_DATA_H
#define VARIABLE_DATA_H
#include "nel/misc/types_nl.h"
namespace NLGUI
{
struct VariableData
{
std::string entry;
std::string type;
std::string value;
uint32 size;
VariableData()
{
size = 0;
}
};
}
#endif

@ -59,6 +59,8 @@ namespace NLGUI
/// get buttons state
NLMISC::TMouseButton getButtonState() const { return _Buttons; }
static const sint32 InvalidCoord = 0x80000000;
protected:
// (x,y) is from the TopLeft corner of the window
sint32 _PointerX; // Current pointer position (raw, before snapping)

@ -286,6 +286,12 @@ namespace NLGUI
*/
void flush ();
/// Retrives a texture
bool getTexture( NLMISC::CBitmap &bm, const std::string &name );
/// Retrieve the texture names
void getTextureNames( std::vector< std::string > &textures );
/**
* get a texture file pointer from a string name. O(logN)
* \param id : the id of the texture

@ -48,7 +48,7 @@ namespace NLGUI
/// Constructor
CViewText (const std::string& id, const std::string Text="", sint FontSize=12,
NLMISC::CRGBA Color=NLMISC::CRGBA(255,255,255), bool Shadow=false);
NLMISC::CRGBA Color=NLMISC::CRGBA(255,255,255), bool Shadow=false, bool ShadowOutline=false);
virtual ~CViewText();
@ -83,6 +83,7 @@ namespace NLGUI
void setFontSize (sint nFontSize);
void setColor (const NLMISC::CRGBA &color);
void setShadow (bool bShadow);
void setShadowOutline (bool bShadowOutline);
void setShadowColor (const NLMISC::CRGBA &color);
void setLineMaxW (sint nMaxW, bool invalidate=true);
void setMultiLine (bool bMultiLine);
@ -102,6 +103,7 @@ namespace NLGUI
sint getFontSize() const;
NLMISC::CRGBA getColor() { return _Color; }
bool getShadow() { return _Shadow; }
bool getShadowOutline() { return _ShadowOutline; }
NLMISC::CRGBA getShadowColor() { return _ShadowColor; }
sint getLineMaxW() const { return _LineMaxW; }
bool getMultiLine() const { return _MultiLine; }
@ -202,7 +204,11 @@ namespace NLGUI
REFLECT_EXPORT_END
virtual void serial(NLMISC::IStream &f);
virtual void serial(NLMISC::IStream &f);
// Sets the parent element
// See the comment at the field
void setParentElm( CInterfaceElement *parent ){ _ParentElm = parent; }
protected:
std::string _HardtextFormat;
@ -225,6 +231,7 @@ namespace NLGUI
NLMISC::CRGBA _Color;
/// the shadow mode
bool _Shadow;
bool _ShadowOutline;
/// the case mode
TCaseMode _CaseMode;
/// the text shadow color
@ -379,6 +386,9 @@ namespace NLGUI
/// Dynamic tooltips
std::vector<CCtrlToolTip*> _Tooltips;
// Parent element is the element where this text belongs to
// For example: text button
CInterfaceElement *_ParentElm;
private:
void setup ();

@ -75,6 +75,16 @@ namespace NLGUI
virtual void process() = 0;
};
// Interface for event handlers that can be called when widgets are added or moved
class IWidgetWatcher
{
public:
IWidgetWatcher(){}
virtual ~IWidgetWatcher(){}
virtual void onWidgetAdded( const std::string &name ) = 0;
virtual void onWidgetMoved( const std::string &oldid, const std::string &newid ) = 0;
};
/// Frame render times
struct SInterfaceTimes
{
@ -333,6 +343,12 @@ namespace NLGUI
bool handleEvent( const CEventDescriptor &evnt );
bool handleSystemEvent( const CEventDescriptor &evnt );
bool handleKeyboardEvent( const CEventDescriptor &evnt );
bool handleMouseEvent( const CEventDescriptor &evnt );
bool handleMouseMoveEvent( const CEventDescriptor &eventDesc );
// Relative move of pointer
@ -487,18 +503,34 @@ namespace NLGUI
IParser* getParser() const{ return parser; }
std::string& getCurrentEditorSelection(){ return currentEditorSelection; }
void setCurrentEditorSelection( const std::string &name );
/// Retrieves the Id of the currently selected widgets
void getEditorSelection( std::vector< std::string > &selection );
/// Adds the widget with the specified Id to the selected widgets
void selectWidget( const std::string &name );
/// Clears the selection
void clearEditorSelection();
void notifySelectionWatchers();
void registerSelectionWatcher( IEditorSelectionWatcher *watcher );
void unregisterSelectionWatcher( IEditorSelectionWatcher *watcher );
void notifyAdditionWatchers( const std::string &widgetName );
void registerAdditionWatcher( IWidgetAdditionWatcher *watcher );
void unregisterAdditionWatcher( IWidgetAdditionWatcher *watcher );
void onWidgetAdded( const std::string &id );
void onWidgetMoved( const std::string &oldid, const std::string &newid );
void registerWidgetWatcher( IWidgetWatcher *watcher );
void unregisterWidgetWatcher( IWidgetWatcher *watcher );
CInterfaceElement* addWidgetToGroup( std::string &group, std::string &widgetClass, std::string &widgetName );
void setGroupSelection( bool b ){ _GroupSelection = b; }
bool groupSelection();
bool unGroupSelection();
void setMultiSelection( bool b ){ multiSelection = b; }
bool createNewGUI( const std::string &project, const std::string &window );
private:
CWidgetManager();
~CWidgetManager();
@ -526,6 +558,11 @@ namespace NLGUI
NLMISC::CRefPtr< CViewBase > _CapturedView;
NLMISC::CRefPtr< CInterfaceElement > draggedElement; // the element that we're currently dragging
bool startDragging();
void stopDragging();
// What is under pointer
std::vector< CViewBase* > _ViewsUnderPointer;
std::vector< CCtrlBase* > _CtrlsUnderPointer;
@ -583,10 +620,12 @@ namespace NLGUI
std::vector< INewScreenSizeHandler* > newScreenSizeHandlers;
std::vector< IOnWidgetsDrawnHandler* > onWidgetsDrawnHandlers;
std::vector< IEditorSelectionWatcher* > selectionWatchers;
std::vector< IWidgetAdditionWatcher* > additionWatchers;
std::vector< IWidgetWatcher* > widgetWatchers;
std::string currentEditorSelection;
std::vector< std::string > editorSelection;
bool _GroupSelection;
bool multiSelection;
uint32 _WidgetCount;
};
}

@ -88,6 +88,8 @@ namespace NLMISC
virtual void setNoAssert(bool noAssert) =0;
virtual bool getAlreadyCreateSharedAmongThreads() =0;
virtual void setAlreadyCreateSharedAmongThreads(bool b) =0;
virtual bool isWindowedApplication() = 0;
virtual void setWindowedApplication(bool b = true) = 0;
//@}
protected:
/// Called by derived class to finalize initialisation of context
@ -131,6 +133,8 @@ namespace NLMISC
virtual void setNoAssert(bool noAssert);
virtual bool getAlreadyCreateSharedAmongThreads();
virtual void setAlreadyCreateSharedAmongThreads(bool b);
virtual bool isWindowedApplication();
virtual void setWindowedApplication(bool b);
private:
/// Singleton registry
@ -147,7 +151,7 @@ namespace NLMISC
bool DebugNeedAssert;
bool NoAssert;
bool AlreadyCreateSharedAmongThreads;
bool WindowedApplication;
};
/** This class implements the context interface for the a library module.
@ -184,6 +188,9 @@ namespace NLMISC
virtual void setNoAssert(bool noAssert);
virtual bool getAlreadyCreateSharedAmongThreads();
virtual void setAlreadyCreateSharedAmongThreads(bool b);
virtual bool isWindowedApplication();
virtual void setWindowedApplication(bool b);
private:
/// Pointer to the application context.
INelContext *_ApplicationContext;

@ -0,0 +1,327 @@
/*
Copyright (c) 2009-2014, Jan BOON
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NLMISC_CALLBACK_H
#define NLMISC_CALLBACK_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
#include <nel/misc/debug.h>
// Project includes
namespace NLMISC {
#define NLMISC_CALLBACK_TEMPLATE \
/** \
* \brief NLMISC_CALLBACK_ARGS_CLASS \
* \date 2009-03-03 18:09GMT \
* \author Jan BOON \
* Callback template \
*/ \
template<typename TReturn NLMISC_CALLBACK_ARGS_TYPENAME> \
class NLMISC_CALLBACK_ARGS_CLASS \
{ \
/* Very simple reference counting callback base */ \
class CCallbackBase \
{ \
public: \
CCallbackBase() : m_RefCount(0) \
{ \
\
} \
\
virtual ~CCallbackBase() \
{ \
nlassert(!m_RefCount); \
} \
\
void refAdd() \
{ \
++m_RefCount; \
} \
\
void refRemove() \
{ \
--m_RefCount; \
if (!m_RefCount) \
delete this; \
} \
\
virtual TReturn callback(NLMISC_CALLBACK_ARGS_DECL) = 0; \
\
virtual bool equals(const CCallbackBase *callbackBase) = 0; \
\
/* disable copy */ \
CCallbackBase(const CCallbackBase &); \
CCallbackBase &operator=(const CCallbackBase &); \
\
private: \
uint m_RefCount; \
}; \
\
typedef TReturn TCallbackFunction(NLMISC_CALLBACK_ARGS_DECL); \
class CCallbackFunction : public CCallbackBase \
{ \
public: \
CCallbackFunction(TCallbackFunction *callbackFunction) : m_CallbackFunction(callbackFunction) \
{ \
nlassert(m_CallbackFunction); \
} \
\
virtual ~CCallbackFunction() \
{ \
m_CallbackFunction = NULL; \
} \
\
virtual TReturn callback(NLMISC_CALLBACK_ARGS_DECL) \
{ \
return m_CallbackFunction(NLMISC_CALLBACK_ARGS_IMPL); \
} \
\
virtual bool equals(const CCallbackBase *callbackBase) \
{ \
const CCallbackFunction *callbackFunction = \
dynamic_cast<const CCallbackFunction *>(callbackBase); \
if (!callbackFunction) return false; \
return m_CallbackFunction == callbackFunction->m_CallbackFunction; \
} \
\
private: \
TCallbackFunction *m_CallbackFunction; \
}; \
\
template<typename TClass> \
class CCallbackMethod : public CCallbackBase \
{ \
typedef TReturn (TClass::*TCallbackMethod)(NLMISC_CALLBACK_ARGS_DECL); \
public: \
CCallbackMethod(TClass *callbackObject, TCallbackMethod callbackMethod) : m_CallbackObject(callbackObject), m_CallbackMethod(callbackMethod) \
{ \
nlassert(m_CallbackObject); \
nlassert(m_CallbackMethod); \
} \
\
virtual ~CCallbackMethod() \
{ \
m_CallbackObject = NULL; \
m_CallbackMethod = NULL; \
} \
\
virtual TReturn callback(NLMISC_CALLBACK_ARGS_DECL) \
{ \
return (m_CallbackObject->*m_CallbackMethod)(NLMISC_CALLBACK_ARGS_IMPL); \
} \
\
virtual bool equals(const CCallbackBase *callbackBase) \
{ \
const CCallbackMethod *callbackMethod = \
dynamic_cast<const CCallbackMethod *>(callbackBase); \
if (!callbackMethod) return false; \
return m_CallbackObject == callbackMethod->m_CallbackObject \
&& m_CallbackMethod == callbackMethod->m_CallbackMethod; \
} \
\
private: \
TClass *m_CallbackObject; \
TCallbackMethod m_CallbackMethod; \
}; \
\
public: \
CCallback() : m_CallbackBase(NULL) \
{ \
\
} \
\
CCallback(TCallbackFunction *callbackFunction) : m_CallbackBase(new CCallbackFunction(callbackFunction)) \
{ \
nlassert(m_CallbackBase); \
m_CallbackBase->refAdd(); \
} \
\
template<typename TClass> \
CCallback(TClass *callbackObject, TReturn (TClass::*callbackMethod)(NLMISC_CALLBACK_ARGS_DECL)) : m_CallbackBase(new CCallbackMethod<TClass>(callbackObject, callbackMethod)) \
{ \
nlassert(m_CallbackBase); \
m_CallbackBase->refAdd(); \
} \
\
CCallback(const CCallback &callback) \
{ \
m_CallbackBase = callback.m_CallbackBase; \
if (m_CallbackBase) \
m_CallbackBase->refAdd(); \
} \
\
CCallback &operator=(const CCallback &callback) \
{ \
if (m_CallbackBase != callback.m_CallbackBase) \
{ \
if (m_CallbackBase) \
m_CallbackBase->refRemove(); \
m_CallbackBase = callback.m_CallbackBase; \
if (m_CallbackBase) \
m_CallbackBase->refAdd(); \
} \
return *this; \
} \
\
~CCallback() \
{ \
if (m_CallbackBase) \
{ \
m_CallbackBase->refRemove(); \
m_CallbackBase = NULL; \
} \
} \
\
TReturn callback(NLMISC_CALLBACK_ARGS_DECL) \
{ \
nlassert(m_CallbackBase); \
return m_CallbackBase->callback(NLMISC_CALLBACK_ARGS_IMPL); \
} \
\
TReturn operator()(NLMISC_CALLBACK_ARGS_DECL) \
{ \
nlassert(m_CallbackBase); \
return m_CallbackBase->callback(NLMISC_CALLBACK_ARGS_IMPL); \
} \
\
bool valid() const \
{ \
return m_CallbackBase != NULL; \
} \
\
operator bool() const \
{ \
return m_CallbackBase != NULL; \
} \
\
bool operator==(const CCallback &callback) \
{ \
return m_CallbackBase->equals(callback.m_CallbackBase); \
} \
\
private: \
CCallbackBase *m_CallbackBase; \
\
}; /* class CCallback */ \
template<typename TReturn, typename TArgsA = void, typename TArgsB = void, typename TArgsC = void, typename TArgsD = void, typename TArgsE = void, typename TArgsF = void, typename TArgsG = void, typename TDummy = void>
class CCallback;
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, void, void, void, void, void, void, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME
#define NLMISC_CALLBACK_ARGS_DECL
#define NLMISC_CALLBACK_ARGS_IMPL
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, void, void, void, void, void, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA
#define NLMISC_CALLBACK_ARGS_IMPL argsA
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, void, void, void, void, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB
#define NLMISC_CALLBACK_ARGS_IMPL argsA, argsB
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, void, void, void, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC
#define NLMISC_CALLBACK_ARGS_IMPL argsA, argsB, argsC
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, TArgsD, void, void, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC, typename TArgsD
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC, TArgsD argsD
#define NLMISC_CALLBACK_ARGS_IMPL argsA, argsB, argsC, argsD
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, TArgsD, TArgsE, void, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC, typename TArgsD, typename TArgsE
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC, TArgsD argsD, TArgsE argsE
#define NLMISC_CALLBACK_ARGS_IMPL argsA, argsB, argsC, argsD, argsE
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, TArgsD, TArgsE, TArgsF, void, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC, typename TArgsD, typename TArgsE, typename TArgsF
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC, TArgsD argsD, TArgsE argsE, TArgsF argsF
#define NLMISC_CALLBACK_ARGS_IMPL argsA, argsB, argsC, argsD, argsE, argsF
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#define NLMISC_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, TArgsD, TArgsE, TArgsF, TArgsG, void>
#define NLMISC_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC, typename TArgsD, typename TArgsE, typename TArgsF, typename TArgsG
#define NLMISC_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC, TArgsD argsD, TArgsE argsE, TArgsF argsF, TArgsG argsG
#define NLMISC_CALLBACK_ARGS_IMPL argsA, argsB, argsC, argsD, argsE, argsF, argsG
NLMISC_CALLBACK_TEMPLATE
#undef NLMISC_CALLBACK_ARGS_CLASS
#undef NLMISC_CALLBACK_ARGS_TYPENAME
#undef NLMISC_CALLBACK_ARGS_DECL
#undef NLMISC_CALLBACK_ARGS_IMPL
#undef NLMISC_CALLBACK_ARGS_CLASSNAME
#undef NLMISC_CALLBACK_TEMPLATE
} /* namespace NLMISC */
#endif /* #ifndef NLMISC_CALLBACK_H */
/* end of file */

@ -69,8 +69,7 @@ public:
class CClassIdHashMapTraits
{
public:
static const size_t bucket_size = 4;
static const size_t min_buckets = 8;
enum { bucket_size = 4, min_buckets = 8, };
inline size_t operator() ( const CClassId& classId ) const
{
return ((((uint64)classId >> 32)|0xFFFFFFFF) ^ (((uint64)classId|0xFFFFFFFF) & 0xFFFFFFFF));

@ -347,7 +347,7 @@ std::string formatThousands(const std::string& s);
/// This function executes a program in the background and returns instantly (used for example to launch services in AES).
/// The program will be launched in the current directory
bool launchProgram (const std::string &programName, const std::string &arguments);
bool launchProgram (const std::string &programName, const std::string &arguments, bool log = true);
/// This function kills a program using his pid (on unix, it uses the kill() POSIX function)
bool killProgram(uint32 pid);

@ -350,8 +350,10 @@ void setCrashAlreadyReported(bool state);
*/
// removed because we always check assert (even in release mode) #if defined (NL_OS_WINDOWS) && defined (NL_DEBUG)
#if defined (NL_OS_WINDOWS)
#define NLMISC_BREAKPOINT __debugbreak();
#if defined(NL_OS_WINDOWS)
#define NLMISC_BREAKPOINT __debugbreak()
#elif defined(NL_OS_UNIX) && defined(NL_COMP_GCC)
#define NLMISC_BREAKPOINT __builtin_trap()
#else
#define NLMISC_BREAKPOINT abort()
#endif

@ -1,202 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_DI_EVENT_EMITTER_H
#define NL_DI_EVENT_EMITTER_H
#include "types_nl.h"
#ifdef NL_OS_WINDOWS
#define DIRECTINPUT_VERSION 0x0800
#include "input_device_server.h"
#include "input_device_manager.h"
#include "event_emitter.h"
#include "smart_ptr.h"
#include "events.h"
#include "rect.h"
#include "game_device.h"
#define NOMINMAX
#include <windows.h>
#include <dinput.h>
namespace NLMISC
{
class CWinEventEmitter;
class CDIKeyboard;
class CDIMouse;
struct IMouseDevice;
struct IKeyboardDevice;
//
struct EDirectInput : public EInputDevice
{
EDirectInput(const char *reason) : EInputDevice(reason) {}
};
//
struct EDirectInputLibNotFound : public EDirectInput
{
EDirectInputLibNotFound() : EDirectInput("can't found the direct input dll") {}
};
//
struct EDirectInputInitFailed : public EDirectInput
{
EDirectInputInitFailed() : EDirectInput("Direct input initialization failed") {}
};
//
struct EDirectInputCooperativeLevelFailed : public EDirectInput
{
EDirectInputCooperativeLevelFailed() : EDirectInput("Direct Input Device Cooperative level couldn't be set") {}
};
// Class to represent Direct Inputs events
struct CDIEvent : public IInputDeviceEvent
{
virtual bool operator < (const IInputDeviceEvent &ide) const
{
// just compare the dates
return Datas.dwTimeStamp < (safe_cast<const CDIEvent *>(&ide))->Datas.dwTimeStamp;
}
DIDEVICEOBJECTDATA Datas;
};
/**
* This manage events by using DirectInput8.
* This should be polled regularly.
* This can be mixed with a CWinEmitter (for example, you may have mouse using direct input, and keyboard using standard messages)
* \author Nicolas Vizerie
* \author Nevrax France
* \date 2002
*/
class CDIEventEmitter : public IEventEmitter, public IInputDeviceManager
{
public:
/** Build a Direct Input Event Emitter object. An exception containing the reason is thrown if the initialization failed.
* The obtained object must be released by deleting it.
* \param hinst the instance of the application.
* \param hwnd the main window of the application.
* \param we A windows eventsemitter. Can be NULL. Needed if you want to mix WIN32 events and Direct Input events
* (for example, a Direct Input Mouse and a Win32 Keyboard)
*/
static CDIEventEmitter *create(HINSTANCE hinst, HWND hwnd, CWinEventEmitter *we);
~CDIEventEmitter();
public:
/// This poll the direct input state, directly storing the result in the given server, or keeping the result in internal server if NULL.
void poll(CEventServer *server = NULL);
///\name From IDeviceManager, access to devices
//@{
// Test if a mouse has been created (by a call to getMouseDeivce)
virtual bool isMouseCreated() { return _Mouse != NULL; }
/** Create the mouse device if needed (one active at a time for that object, repeated calls returns the same pointer) and get an interface on it. An exception if thrown if it couldn't be obtained.
* If this object has a pointer on a win32 emiter, Win32 mouse messages are replaced by this mouse messages.
*/
virtual IMouseDevice *getMouseDevice(bool hardware) throw(EInputDevice);
/// remove the direct input mouse
virtual void releaseMouse();
/** Create the keyboard device if needed (one active at a time for that object, repeated calls returns the same pointer) and get an interface on it.
* If this object has a pointer on a win32 emiter, Win32 keyboard messages are replaced by this keyboard messages.
* NB: A direct input has no notion of localization or key combinations. See keyboard_device.h for more infos
*/
virtual IKeyboardDevice *getKeyboardDevice() throw(EInputDevice);
/// remove the direct input keyboard
virtual void releaseKeyboard();
// Enumerates current game devices (gamepads, joystick etc.). The result is stored in the given vector
virtual void enumerateGameDevice(TDeviceDescVect &descs) throw(EInputDevice);
// Create the given game device from its instance name. It also means that it will begin to sends inputs
virtual IGameDevice *createGameDevice(const std::string &instanceName) throw(EInputDevice);
// Release the given game device
virtual void releaseGameDevice(IGameDevice *);
//@}
/// from IEventEmitter
virtual void submitEvents(CEventServer &server, bool allWindows);
virtual void emulateMouseRawMode(bool enable);
// Build a TMouseButton value from the current buttons state
TMouseButton buildButtonsFlags() const;
// Build a TMouseButton value (but with no mouse values)
TMouseButton buildKeyboardButtonFlags() const
{
return (TMouseButton) (buildButtonsFlags() & (ctrlButton|shiftButton|altButton));
}
//================================================================
//================================================================
//================================================================
private:
typedef HRESULT (WINAPI * TPDirectInput8Create) (HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, LPUNKNOWN punkOuter);
// Private internal server message, used to stored all messages internally before to dispatch them, when no server is supplied to poll(...
class CDIEventServer : CEventServer
{
friend class CDIEventEmitter;
public:
void setServer (CEventServer *server)
{
_Server = server;
}
private:
bool pumpEvent(CEvent *event)
{
CEventServer::pumpEvent(event);
_Server->postEvent (event);
return false;
}
private:
CEventServer *_Server;
};
private:
HWND _hWnd;
TMouseButton _ButtonsFlags;
NLMISC::CRefPtr<CWinEventEmitter> _WE;
static HMODULE _DirectInputLibHandle;
static TPDirectInput8Create _PDirectInput8Create;
static uint _NumCreatedInterfaces;
private:
static bool loadLib();
static void unloadLib();
//====
private:
CDIEventServer _InternalServer;
CInputDeviceServer _DeviceServer;
IDirectInput8 *_DInput8;
CDIMouse *_Mouse;
CDIKeyboard *_Keyboard;
private:
CDIEventEmitter(HWND hwnd, CWinEventEmitter *we);
};
} // NLMISC
#endif // NL_WINDOWS
#endif // NL_DX_EVENT_EMITTER_H
/* End of dx_event_emitter.h */

@ -22,6 +22,21 @@
#ifdef NL_OS_WINDOWS // for win32 os only
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#ifndef _WIN32_WINDOWS
# define _WIN32_WINDOWS 0x0410
#endif
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0400
#endif
#ifndef WINVER
# define WINVER 0x0400
#endif
#ifndef NOMINMAX
# define NOMINMAX
#endif
#include <windows.h>

@ -575,8 +575,7 @@ public:
// Traits for hash_map using CEntityId
struct CEntityIdHashMapTraits
{
static const size_t bucket_size = 4;
static const size_t min_buckets = 8;
enum { bucket_size = 4, min_buckets = 8, };
CEntityIdHashMapTraits() { }
size_t operator() (const NLMISC::CEntityId &id ) const
{

@ -49,19 +49,6 @@ public:
* \param server
*/
virtual void submitEvents(CEventServer & server, bool allWindows) = 0;
/**
* Instruct the event emitter to send CGDMouseMove instead of CEventMouseMove.
*
* On windows, the mouse device can be set into RawMode. Using this mode,
* CGDMouseMove events (only containing the raw movement delta) are emitted
* instead of the normal CEventMouseMove events (containing the mouse position).
*
* On Linux and Mac OS X, there is no MouseDevice implementation, all the
* events are created by the event emitter. So the event emitter has to
* emulate the mouse raw mode.
*/
virtual void emulateMouseRawMode(bool) = 0;
};

@ -47,7 +47,6 @@ public:
const IEventEmitter *getEmitter(uint index) const;
/// From IEventEmitter. This call submitEvents on all the emitters
virtual void submitEvents(CEventServer &server, bool allWindows);
virtual void emulateMouseRawMode(bool enable);
virtual bool copyTextToClipboard(const ucstring &text);
virtual bool pasteTextFromClipboard(ucstring &text);

@ -53,7 +53,8 @@ public:
uint getNumAllocatedBlocks() const { return _NumAlloc; }
private:
class CChunk;
class CNode
class NL_ALIGN(NL_DEFAULT_MEMORY_ALIGNMENT) CNode
{
public:
CChunk *Chunk; // the Chunk this node belongs to.

@ -1,114 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_GAME_DEVICE_H
#define NL_GAME_DEVICE_H
#include "types_nl.h"
#include "input_device.h"
#include <string>
#include <vector>
namespace NLMISC
{
/// Describe a game device
struct CGameDeviceDesc
{
// type of the device
enum TDevType { GamePad, Joystick, DontKnow, DevTypeLast } DevType;
// Friendly name for the instance. For example, "Joystick 1."
std::string InstanceName;
// Friendly name for the product
std::string ProductName;
// Tells whether this device is connected
bool Connected;
};
// a list of game device description
typedef std::vector<CGameDeviceDesc> TDeviceDescVect;
/// for devices comparison. The 'Connected' field is ignored.
inline bool operator == (const CGameDeviceDesc &lhs, const CGameDeviceDesc &rhs)
{
return lhs.InstanceName == rhs.InstanceName && lhs.ProductName == rhs.ProductName;
}
//
inline bool operator != (const CGameDeviceDesc &lhs, const CGameDeviceDesc &rhs)
{
return !(lhs == rhs);
}
/**
* This abstract a joystick or gamepad
* \author Nicolas Vizerie
* \author Nevrax France
* \date 2002
*/
struct IGameDevice : public IInputDevice
{
enum TAxis { XAxis = 0, YAxis, ZAxis, /* translation */
RXAxis, RYAxis, RZAxis, /* rotations */
MaxNumAxis
};
/// Get a general description of this device
virtual const CGameDeviceDesc &getDescription() const = 0;
///\name Controls presence
//@{
// returns the number of buttons available on this game device
virtual uint getNumButtons() const = 0;
/** Check if the given axe is present on this game device
* NB : only absolute axis are managed
*/
virtual bool hasAxis(TAxis axis) const = 0;
// Check the number of sliders presents on this game device
virtual uint getNumSliders() const = 0;
// Check the number of point of views controls present on this game device
virtual uint getNumPOV() const = 0;
//@}
///\name Controls names. Must ensure that controls are present before calling these methods.
//@{
virtual const char *getButtonName(uint index) const = 0;
virtual const char *getAxisName(TAxis axis) const = 0;
virtual const char *getSliderName(uint index) const = 0;
virtual const char *getPOVName(uint index) const = 0;
//@}
///\name Controls state. Must ensure that controls are present before calling these methods.
//@{
// Return true if the given button is pushed.
virtual bool getButtonState(uint index) const = 0;
// Return a value in [-1, 1] for a translation axis, or an orientation.
virtual float getAxisValue(TAxis axis) const = 0;
// Return a value in [0, 1]
virtual float getSliderPos(uint index) const = 0;
// Return a CCW angle in degrees
virtual float getPOVAngle(uint index) const = 0;
//@}
};
} // NLMISC
#endif // NL_GAME_DEVICE_H
/* End of GAME_device.h */

@ -1,209 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_GAME_DEVICE_EVENT_H
#define NL_GAME_DEVICE_EVENT_H
#include "types_nl.h"
#include "events.h"
#include "game_device.h"
namespace NLMISC
{
struct IMouseDevice;
struct IGameDevice;
const CClassId EventGDMouseMove(0x12142bc4, 0x43c73e74);
const CClassId EventGDButtonDownId(0x57141957, 0x3efb143a);
const CClassId EventGDButtonUpId(0x16105e06, 0x302536b2);
const CClassId EventGDAxisMovedId(0x073306, 0x41173626);
const CClassId EventGDSliderMovedId(0x68776586, 0x394a6916);
const CClassId EventGDPOVChanged(0x362851b9, 0x395c4d61);
//==========================================================================================
/// A raw mouse move message, expressed in mickeys (relative values)
class CGDMouseMove : public CEvent
{
public:
IMouseDevice *MD;
sint X, Y;
public:
CGDMouseMove(IEventEmitter *emitter, IMouseDevice *md, sint x, sint y) : CEvent(emitter, EventGDMouseMove), MD(md), X(x), Y(y)
{}
virtual CEvent *clone() const {return new CGDMouseMove(*this);}
};
//==========================================================================================
/**
* An event from a game device (joystick, joypad ...)
*/
class CGameDeviceEvent : public CEvent
{
public:
/// the game device this event come from
IGameDevice *GameDevice;
public:
CGameDeviceEvent(
IGameDevice *gameDevice,
IEventEmitter *emitter,
const CClassId &classId
)
: CEvent(emitter, classId),
GameDevice(gameDevice)
{}
};
//==========================================================================================
/** A button state has changed
*/
class CGDButton : public CGameDeviceEvent
{
public:
// index of the buttons that has been pushed
uint ButtonIndex;
bool Pushed;
public:
///
CGDButton(
uint buttonIndex,
bool pushed,
IGameDevice *gameDevice,
IEventEmitter *emitter,
const CClassId &classId
)
: CGameDeviceEvent(gameDevice, emitter, classId),
ButtonIndex(buttonIndex),
Pushed(pushed)
{}
};
//==========================================================================================
/** A button has been pushed
*/
class CGDButtonDown : public CGDButton
{
public:
///
CGDButtonDown(uint buttonIndex, IGameDevice *gameDevice, IEventEmitter *emitter)
: CGDButton(buttonIndex, true, gameDevice, emitter, EventGDButtonDownId)
{}
virtual CEvent *clone() const {return new CGDButtonDown(*this);}
};
//==========================================================================================
/** A button has been released
*/
class CGDButtonUp : public CGDButton
{
public:
///
CGDButtonUp(uint buttonIndex, IGameDevice *gameDevice, IEventEmitter *emitter)
: CGDButton(buttonIndex, false, gameDevice, emitter, EventGDButtonUpId)
{}
virtual CEvent *clone() const {return new CGDButtonUp(*this);}
};
//==========================================================================================
/// An axis has moved
class CGDAxisMoved : public CGameDeviceEvent
{
public:
IGameDevice::TAxis Axis;
// current position of the axis, ranges from -1.f to 1.f
float Value;
public:
CGDAxisMoved(
IGameDevice::TAxis axis,
float value,
IGameDevice *gameDevice,
IEventEmitter *emitter
)
: CGameDeviceEvent(gameDevice, emitter, EventGDAxisMovedId),
Axis(axis),
Value(value)
{}
virtual CEvent *clone() const {return new CGDAxisMoved(*this);}
};
//==========================================================================================
/// A slider position has changed
class CGDSliderMoved : public CGameDeviceEvent
{
public:
uint SliderIndex;
// current position of the slider, ranges from 0.f to 1.f
float SliderPos;
public:
CGDSliderMoved(
float sliderPos,
uint sliderIndex,
IGameDevice *gameDevice,
IEventEmitter *emitter
)
: CGameDeviceEvent(gameDevice, emitter, EventGDSliderMovedId),
SliderIndex(sliderIndex),
SliderPos(sliderPos)
{}
virtual CEvent *clone() const {return new CGDSliderMoved(*this);}
};
//==========================================================================================
/// A point of view control changed
class CGDPOVChanged : public CGameDeviceEvent
{
public:
uint POVIndex;
bool Centered;
// The POV angle, in degrees (CW)
float POVAngle;
public:
CGDPOVChanged(
bool centered,
float povAngle,
uint povIndex,
IGameDevice *gameDevice,
IEventEmitter *emitter
)
: CGameDeviceEvent(gameDevice, emitter, EventGDPOVChanged),
POVIndex(povIndex),
Centered(centered),
POVAngle(povAngle)
{}
virtual CEvent *clone() const {return new CGDPOVChanged(*this);}
};
} // NLMISC
#endif // NL_GAME_DEVICE_EVENT_H
/* End of game_device_event.h */

@ -42,11 +42,7 @@ class CGtkDisplayer : public NLMISC::CWindowDisplayer
{
public:
CGtkDisplayer (const char *displayerName = "") : CWindowDisplayer(displayerName)
{
needSlashR = false;
createLabel ("@Clear|CLEAR");
}
CGtkDisplayer (const char *displayerName = "");
virtual ~CGtkDisplayer ();

@ -74,7 +74,7 @@
namespace NLMISC
{
#ifdef NL_OS_WINDOWS
#ifdef NL_COMP_VC
// Visual C++ warning : ebp maybe modified
# pragma warning(disable:4731)
#endif

@ -232,6 +232,9 @@ private:
// If not NULL, binary mode detected, use this stream in serials
IStream *_BinaryStream;
// System dependant structure for locale
void* _Locale;
};

@ -1,84 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_INPUT_DEVICE_H
#define NL_INPUT_DEVICE_H
#include "types_nl.h"
namespace NLMISC
{
class CEventServer;
class CInputDeviceServer;
struct IInputDeviceEvent;
/**
* Base class that wrap to a device
* \author Nicolas Vizerie
* \author Nevrax France
* \date 2002
*/
struct IInputDevice
{
/** Set the buffer size for this device (the number of samples it can retains).
* This return true if the size could be set
*/
virtual bool setBufferSize(uint size) = 0;
/// Get the buffer size for this device
virtual uint getBufferSize() const = 0;
///\name Device server specifics. You usually don't want to call these
//@{
/** For device server usage :
* Called at the beginning of each events retrieval.
* If a device doesn't support buffered datas, the state changes can be directly send to the event server.
* The default does nothing.
*/
virtual void begin(CEventServer * /* server */) {}
/** For device server usage :
* Poll all events from that device, and notify them to the given device server, so that they can be sorted between devices.
* This retrieves messages, but do not process them.
*/
virtual void poll(CInputDeviceServer *dev) = 0;
/** For device server usage :
* Process an event (eventually update this device state), and translate the message to a IEventServerMessage
*/
virtual void submit(IInputDeviceEvent *deviceEvent, CEventServer *server) = 0;
/** For device server usage :
* Says that the next message is for another device, or that it is the last message that will be received.
* This allow to pack several messages in one (for example, to sum up mouse moves until a click occurs)
* The default does nothing.
* The next message can be used to get a time stamp for example. It may be NULL is no next message is available
*/
virtual void transitionOccured(CEventServer * /* server */, const IInputDeviceEvent * /* nextMessage */) {}
//@}
// dtor
virtual ~IInputDevice() {}
};
} // NLMISC
#endif // NL_INPUT_DEVICE_H
/* End of input_device.h */

@ -1,69 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_INPUT_DEVICE_MANAGER_H
#define NL_INPUT_DEVICE_MANAGER_H
#include "types_nl.h"
#include "game_device.h"
#include "common.h"
namespace NLMISC
{
struct IMouseDevice;
struct IKeyboardDevice;
struct EInputDevice : public Exception
{
EInputDevice(const char *reason) : Exception(reason) {}
};
/** Interface for objects that give low level access to devices (mouse, keyboard, joypads and joysticks).
* Generally an object implementing this interface will send the appropriate events when a device is 'created'.
* (Example of implementation : a direct input event emitter)
*/
struct IInputDeviceManager
{
// Test if a mouse has been created (by a call to getMouseDeivce)
virtual bool isMouseCreated() = 0;
/// Create the low level mouse device if needed (one active at a time for that object, repeated calls returns the same pointer). An exception if thrown if it couldn't be obtained.
virtual IMouseDevice *getMouseDevice(bool hardware) throw(EInputDevice) = 0;
/// remove the low level mouse
virtual void releaseMouse() = 0;
/// Create the low level keyboard device if needed (one active at a time for that object, repeated calls returns the same pointer). An exception if thrown if it couldn't be obtained.
virtual IKeyboardDevice *getKeyboardDevice() throw(EInputDevice) = 0;
/// remove the low level keyboard
virtual void releaseKeyboard() = 0;
// Enumerates current game devices (gamepads, joystick etc.). The result is stored in the given vector
virtual void enumerateGameDevice(TDeviceDescVect &descs) throw(EInputDevice) = 0;
// Create the given game device interface from its instance name. It also means that it will begin to sends events.
virtual IGameDevice *createGameDevice(const std::string &instanceName) throw(EInputDevice) = 0;
// Release the given game device.
virtual void releaseGameDevice(IGameDevice *gd) = 0;
};
} // NLMISC
#endif // NL_INPUT_DEVICE_MANAGER_H
/* End of device_manager.h */

@ -1,84 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_INPUT_DEVICE_SERVER_H
#define NL_INPUT_DEVICE_SERVER_H
#include "types_nl.h"
#include <vector>
namespace NLMISC
{
class CEventServer;
struct IInputDevice;
struct IInputDeviceEvent;
/** Base class for an input device server. Unlike an event server, it manages several devices, and can sort their events (by date for example).
* It keeps a list of active devices.
* It can poll datas from every active device.
* It can sort devices messages to submit them in correct order to a CEventServer.
*/
class CInputDeviceServer
{
public:
/// register a device into this device server.
void registerDevice(IInputDevice *device);
/// remove a device from this server (but does not delete it).
void removeDevice(IInputDevice *device);
// returns the number of registered devices
uint getNumDevices() const { return (uint)_Devices.size(); }
// return a device
IInputDevice *getDevice(uint index) { return _Devices[index]; }
/// Test whether the given device is handled by this server.
bool isDevice(IInputDevice *device) const;
/// Retrieve datas from the devices, and submit them to the given CEventServer.
void poll(CEventServer *server);
/// Allow an input device to register an event. The event will then be deleted by this server
void submitEvent(IInputDeviceEvent *deviceEvent);
// dtor
virtual ~CInputDeviceServer() {}
private:
typedef std::vector<IInputDevice *> TDeviceCont;
typedef std::vector<IInputDeviceEvent *> TEventCont;
private:
TDeviceCont _Devices;
TEventCont _Events;
};
/** An event from an input device.
*/
struct IInputDeviceEvent
{
IInputDevice *Emitter; // the input device that emitted that event
// Used to sort events by time stamp.
virtual bool operator < (const IInputDeviceEvent &IInputDeviceEvent) const = 0;
virtual ~IInputDeviceEvent() {}
};
} // NLMISC
#endif // NL_INPUT_DEVICE_SERVER_H
/* End of input_device_server.h */

@ -27,6 +27,21 @@
#include "nel/misc/mem_stream.h"
#include "nel/misc/dummy_window.h"
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
#ifndef _WIN32_WINDOWS
# define _WIN32_WINDOWS 0x0410
#endif
#ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0400
#endif
#ifndef WINVER
# define WINVER 0x0400
#endif
#ifndef NOMINMAX
# define NOMINMAX
#endif
#include <windows.h>
namespace NLMISC
@ -220,7 +235,7 @@ private:
static TOldWinProcMap _OldWinProcMap;
bool initInternal(HINSTANCE hInstance, HWND ownerWindow, uint32 localId, uint32 foreignId = NULL);
bool initInternal(HINSTANCE hInstance, HWND ownerWindow, uint32 localId, uint32 foreignId = 0);
private:
static LRESULT CALLBACK listenerProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

@ -1,63 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_KEYBOARD_DEVICE_H
#define NL_KEYBOARD_DEVICE_H
#include "types_nl.h"
#include "events.h"
#include "input_device.h"
namespace NLMISC
{
/** Gives access to low level keyboard parameters
* - 'Shift' messages are replaced by RShift and LShift msg.
* - 'Control' messages are replaced by 'RControl' and 'LControl' msg.
* - 'Menu' (alternate) messages are replaced by 'RMenu' and 'LMenu' msg.
*/
struct IKeyboardDevice : public IInputDevice
{
/// Max number of supported keys
enum { NumKeys = 256 };
/// Get the delay before key repeat, in milliseconds
virtual uint getKeyRepeatDelay() const = 0;
/// Get the delay before key repeat, in milliseconds
virtual void setKeyRepeatDelay(uint delay) = 0;
/// Get the period before key repeat, in milliseconds
virtual uint getKeyRepeatPeriod() const = 0;
/// Get the period before key repeat, in milliseconds
virtual void setKeyRepeatPeriod(uint period) = 0;
/// Set a set of keys for which repetition is disabled
virtual void disableRepetition(const TKey *keyTab, uint numKey) = 0;
/// Get the number of disabled keys
virtual uint getNumDisabledRepetition() const = 0;
/** Get the disabled keys and stores in the given tab.
* NB: must ensure the destination table has the right size
* \see getNumDisabledKeys()
*/
virtual void getDisabledRepetitions(TKey *destTab) const = 0;
};
} // NLMISC
#endif // NL_KEYBOARD_DEVICE_H
/* End of keyboard_device.h */

@ -53,7 +53,8 @@ class CPlane;
* \author Nevrax France
* \date 2000
*/
class CMatrix
class NL_ALIGN_SSE2 CMatrix
{
public:
/// Rotation Order.

@ -1,130 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_MOUSE_DEVICE_H
#define NL_MOUSE_DEVICE_H
#include "types_nl.h"
#include "input_device.h"
namespace NLMISC
{
class CRect;
/// An interface to a low level mouse device
struct IMouseDevice : public IInputDevice
{
enum TAxisMode { Raw, Clamped, AxisModeLast };
enum TAxis { XAxis = 0, YAxis = 1, AxisLast };
enum TMessageMode { NormalMode, RawMode, MessageModeLast };
///\name Messages
//@{
/** Tells what messages should be sent :
* DEFAULT is 'raw' messages
* Raw messages : - no clamping nor frames applied
* - no speed applied
* - no factor applied
* - CGDMouseMove messages are sent
* - Move expressed in mickeys
* Normal messages : - CEventMouseMove messages are sent
* - A frame may clamp one or both axis
* - The mouse speed can be changed
*/
virtual void setMessagesMode(TMessageMode mode) = 0;
/// retrieve what kinds of messages are sent
virtual TMessageMode getMessagesMode() const = 0;
//@}
///\name Mouse MOVE, valid only
//@{
/** Set the mode of axis of the mouse. This can be raw, or clamped. In clamped mode, a frame is used to limit the move.
* NB : invalid in raw message mode
* \see setMouseFrame(const CRect &rect)
*/
virtual void setMouseMode(TAxis axis, TAxisMode axisMode) = 0;
/** returns the mode of the mouse for the given axis.
* NB : invalid in raw message mode
*/
virtual TAxisMode getMouseMode(TAxis axis) const = 0;
/** Set the mouse speed. It must be in the ]0, +inf] range, 1 gives the natural mouse speed.
* NB : invalid in raw message mode
*/
virtual void setMouseSpeed(float speed) = 0;
/** Get the mouse speed.
* NB : invalid in raw message mode
*/
virtual float getMouseSpeed() const = 0;
/** Set the mouse acceleration. It is the threshold in mickey, when start the acceleration. 0 means not acceleration.
*/
virtual void setMouseAcceleration(uint speed) = 0;
/** Get the mouse acceleration.
*/
virtual uint getMouseAcceleration() const = 0;
/** Set the current frame in which the mouse can move, expressed in pixels.
* NB do not forget to call setMouseFactors if you want the results to be reported in the 0-1 range.
* NB : invalid in raw message mode.
* \see setMouseFactors
*/
virtual void setMouseFrame(const CRect &rect) = 0;
/** Gives factor by which the mouse coordinates must be multiplied before an event is sent.
* The default factor is 1.
* NB : invalid in raw message mode.
*
* Example : this set a frame of 800x600 and reports event in the [0, 1] range.
* \code
* mouse->setMouseFrame(800, 600);
* mouse->setMouseMode(XAxis, IMouseDevice::Clamped);
* mouse->setMouseMode(YAxis, IMouseDevice::Clamped);
* mouse->setFactors(1.f / 800, 1.f / 600);
* \endcode
*/
virtual void setFactors(float xFactor, float yFactor) = 0;
/** Get the x factor, use to multiply the mouse position before an event is sent.
* NB : invalid in raw message mode.
* \see setFactors()
*/
virtual float getXFactor() const = 0;
/** Get the y factor, use to multiply the mouse position before an event is sent.
* NB : invalid in raw message mode.
* \see setFactors()
*/
virtual float getYFactor() const = 0;
//@}
// Get the current frame used for limiting mouse movements
virtual const CRect &getMouseFrame() const = 0;
// Set the maximum delay for a double click to be taken in account (in ms).
virtual void setDoubleClickDelay(uint ms) = 0;
// Get the maximum delay for double click (in ms)
virtual uint getDoubleClickDelay() const = 0;
// Force the position of the mouse, expressed in pixels
virtual void setMousePos(float x, float y) = 0;
/// From a delta of a mouse position input (eg from CEventMouseMove), deduce delta in mickeys (eg: like received from a CGDMouseMove)
virtual void convertStdMouseMoveInMickeys(float &dx, float &dy) const = 0;
};
} // NLMISC
#endif // NL_MOUSE_DEVICE_H
/* End of u_mouse_device.h */

@ -28,7 +28,11 @@
# endif
#elif defined(NL_OS_UNIX)
# include <pthread.h> // PThread
# include <semaphore.h> // PThread POSIX semaphores
# ifdef NL_OS_MAC
# include <dispatch/dispatch.h>
# else
# include <semaphore.h> // PThread POSIX semaphores
# endif
# include <unistd.h>
# define __forceinline
# ifdef NL_OS_MAC
@ -532,8 +536,10 @@ private:
#ifdef NL_OS_WINDOWS
TNelRtlCriticalSection _Cs;
#elif defined NL_OS_UNIX
sem_t _Sem;
#elif defined(NL_OS_MAC)
dispatch_semaphore_t _Sem;
#elif defined(NL_OS_UNIX)
sem_t _Sem;
#else
# error "No fair mutex implementation for this OS"
#endif

@ -178,6 +178,9 @@ private:
// Error message
std::string _ErrorString;
// System dependant structure for locale
void* _Locale;
};

@ -29,6 +29,12 @@
# endif // NLMISC_HEAP_ALLOCATION_NDEBUG
#endif // NL_USE_DEFAULT_MEMORY_MANAGER
#ifndef NL_OV_USE_NEW_ALLOCATOR
# ifdef NL_HAS_SSE2
# define NL_OV_USE_NEW_ALLOCATOR
# endif // NL_HAS_SSE2
#endif // NL_OV_USE_NEW_ALLOCATOR
namespace NLMISC {

@ -200,6 +200,10 @@ public:
*/
void getFileListByName(const std::string &extension, const std::string &name, std::vector<std::string> &filenames);
/** Create a list of file having the requested string in the path and the requested extension.
*/
void getFileListByPath(const std::string &extension, const std::string &path, std::vector<std::string> &filenames);
/** Make a path relative to another if possible, else doesn't change it.
* \param basePath is the base path to be relative to.
* \param relativePath is the path to make relative to basePath.
@ -339,7 +343,7 @@ public:
/** Adds a search path.
* The path is a directory "c:/temp" all files in the directory will be included (and recursively if asked)
*
* Alternative directories are not pre-cached (instead of non Alternative files) and will used when a file is not found in the standard directories.
* Alternative directories are not pre-cached (instead of non Alternative files) and will be used when a file is not found in the standard directories.
* For example, local data will be in the cached directories and server repository files will be in the Alternative files. If a new file is not
* found in the local data, we'll try to find it on the repository.
*
@ -492,6 +496,10 @@ public:
*/
static void getFileListByName(const std::string &extension, const std::string &name, std::vector<std::string> &filenames);
/** Create a list of file having the requested string in the path and the requested extension
*/
static void getFileListByPath(const std::string &extension, const std::string &path, std::vector<std::string> &filenames);
/** Make a path relative to another if possible, else doesn't change it.
* \param basePath is the base path to be relative to.
* \param relativePath is the path to make relative to basePath.
@ -499,6 +507,13 @@ public:
*/
static bool makePathRelative (const char *basePath, std::string &relativePath);
/** Make path absolute
* \param relativePath - The relative path
* \param directory - the directory to which the path is relative to
* returns the absolute path, or empty if something went wrong.
*/
static std::string makePathAbsolute (const std::string &relativePath, const std::string &directory );
/** If File in this list is added more than one in an addSearchPath, it doesn't launch a warning.
*/
static void addIgnoredDoubleFile(const std::string &ignoredFile);

@ -21,25 +21,38 @@
namespace NLMISC {
/** Display a custom message box.
#if FINAL_VERSION
#define NL_REPORT_SYNCHRONOUS false
#define NL_REPORT_DEFAULT NLMISC::ReportAbort
#else
#define NL_REPORT_SYNCHRONOUS true
#define NL_REPORT_DEFAULT NLMISC::ReportBreak
#endif
enum TReportResult
{
// See also crash_report_widget.h EReturnValue
ReportAlwaysIgnore = 21,
ReportIgnore = 22,
ReportAbort = 23,
ReportBreak = 24
};
/** Display a crash report
*
* \param title set the title of the report. If empty, it'll display "NeL report".
* \param header message displayed before the edit text box. If empty, it displays the default message.
* \param body message displayed in the edit text box. This string will be sent by email.
* \param debugButton 0 for disabling it, 1 for enable with default behaviors (generate a breakpoint), 2 for enable with no behavior
* \param title set the title of the report. If empty, it'll display "NeL report"
* \param subject extended title of the report
* \param body message displayed in the edit text box. This string will be sent to the crash report tool
* \param attachment binary file to attach. This is a filename
* \param synchronous use system() and wait for the crash tool exit code, passes -dev flag; otherwise return defaultResult immediately
* \param sendReport hide 'dont send' button, or auto enable 'send report' checkbox
*
*
*
* \return the button clicked or error
* \return the button clicked or defaultResult
*/
TReportResult report(const std::string &title, const std::string &subject, const std::string &body, const std::string &attachment, bool synchronous, bool sendReport, TReportResult defaultResult);
enum TReportResult { ReportDebug, ReportIgnore, ReportQuit, ReportError };
TReportResult report (const std::string &title, const std::string &header, const std::string &subject, const std::string &body, bool enableCheckIgnore, uint debugButton, bool ignoreButton, sint quitButton, bool sendReportButton, bool &ignoreNextTime, const std::string &attachedFile = "");
/** call this in the main of your appli to enable email: setReportEmailFunction (sendEmail);
*/
void setReportEmailFunction (void *emailFunction);
/// Set the Url of the web service used to post crash reports to. String is copied
void setReportPostUrl(const char *postUrl);
} // NLMISC

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save