Merge with develop

--HG--
branch : feature-light_cycle
hg/feature/light_cycle
kaetemi 10 years ago
commit 8e5a515968

@ -14,6 +14,8 @@
**.font = native
**.scheme = native
**.tpl = native
**.xsd = native
**.dox = native

@ -5,3 +5,6 @@
fedf2aa443d09707beed814b0f499c6a5519cc84 ryzomcore/v0.10.0
edaa3624a56420b02ccc64c26059801a389927ee ryzomcore/v0.11.0
e3fe4855f22c3e75722e015dc33c091c340b3ad7 ryzomcore/v0.11.1
9e583b717fd63be0be9fd60b99087abf1691ea49 ryzomcore/v0.11.2
bfe5628e14a024ba7ea32e4b326ae433a07856b9 ryzomcore/v0.11.3
9a6120735daa97c96ac5d85ca35c7f21f607bd87 ryzomcore/v0.12.0

@ -1,8 +1,8 @@
#-----------------------------------------------------------------------------
#
# NeL
# Authors: Nevrax and the NeL Community
# Version: 0.11.1
# Ryzom Core
# Authors: Nevrax and the Ryzom Core Community
# Version: 0.12.0
#
# 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 11)
SET(NL_VERSION_PATCH 1)
SET(NL_VERSION_MINOR 12)
SET(NL_VERSION_PATCH 0)
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)
@ -152,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)
@ -228,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,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(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/lib/
NO_CMAKE_SYSTEM_PATH
)
ENDIF(APPLE)
FIND_PATH(ICONV_INCLUDE_DIR iconv.h PATHS /opt/local/include /sw/include)
string(REGEX REPLACE "(.*)/include/?" "\\1" ICONV_INCLUDE_BASE_DIR "${ICONV_INCLUDE_DIR}")
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)
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)
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c PATHS /opt/local)
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
)

@ -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

@ -69,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"
@ -252,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 )
@ -360,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)
@ -384,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")
@ -556,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}")
@ -580,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")

@ -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)

@ -493,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()),
@ -1422,7 +1422,6 @@ protected:
private:
bool _StaticMemoryToVRAM;
};
// --------------------------------------------------

@ -54,11 +54,13 @@ public:
/** generate and return a bitmap
* \param c the unicode char
* \param size size of the generated font in ??? format
* \param embolden set embolden style (bold)
* \param oblique set oblique style (slanted, italic)
* \param width width of the generated bitmap, this value is set by this function
* \param height height of the generated bitmap, this value is set by this function
* \param pitch pitch of the generated bitmap (+ or - the number of bytes per row), this value is set by this function
*/
uint8 *getBitmap (ucchar c, uint32 size, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex);
uint8 *getBitmap (ucchar c, uint32 size, bool embolden, bool oblique, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex);
/** returns the width and height of a character using a specific size and
*

@ -102,6 +102,8 @@ public:
* \param fontGen font generator
* \param color primitive blocks color
* \param fontSize font size
* \param embolden font style bold
* \param oblique font style slanted (italic)
* \param desc display descriptor (screen size, font ratio)
* \param output computed string
* \param keep800x600Ratio true if you want that CFontManager look at Driver window size, and resize fontSize so it keeps same size...
@ -110,6 +112,8 @@ public:
CFontGenerator *fontGen,
const NLMISC::CRGBA &color,
uint32 fontSize,
bool embolden,
bool oblique,
IDriver *driver,
CComputedString& output,
bool keep800x600Ratio= true);
@ -121,6 +125,8 @@ public:
CFontGenerator *fontGen,
const NLMISC::CRGBA &color,
uint32 fontSize,
bool embolden,
bool oblique,
IDriver *driver,
CComputedString &output,
bool keep800x600Ratio= true);
@ -132,6 +138,8 @@ public:
CFontGenerator *fontGen,
const NLMISC::CRGBA &color,
uint32 fontSize,
bool embolden,
bool oblique,
IDriver *driver,
CComputedString &output,
bool keep800x600Ratio= true);

@ -74,6 +74,10 @@ public:
void setFontSize (uint32 fontSize) { _FontSize = fontSize; }
void setEmbolden (bool b) { _Embolden = b; }
void setOblique (bool b) { _Oblique = b; }
void setHotSpot (CComputedString::THotSpot hotSpot) { _HotSpot = hotSpot; }
void setScaleX (float scaleX) { _ScaleX = scaleX; }
@ -101,6 +105,10 @@ public:
uint32 getFontSize () const { return _FontSize; }
bool getEmbolden () const { return _Embolden; }
bool getOblique () const { return _Oblique; }
CComputedString::THotSpot getHotSpot() const { return _HotSpot; }
float getScaleX() const { return _ScaleX; }
@ -240,7 +248,7 @@ public:
nlassert(_FontGen);
// compute the string just one time
_FontManager->computeString (ucstr, _FontGen, _Color, _FontSize, _Driver, _TempString, _Keep800x600Ratio);
_FontManager->computeString (ucstr, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, _TempString, _Keep800x600Ratio);
// draw shaded
if (_Shaded)
@ -279,7 +287,7 @@ public:
// compute the string just one time
char *str;
NLMISC_CONVERT_VARGS (str, format, NLMISC::MaxCStringSize);
_FontManager->computeString (str, _FontGen, _Color, _FontSize, _Driver, _TempString, _Keep800x600Ratio);
_FontManager->computeString (str, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, _TempString, _Keep800x600Ratio);
// draw shaded
if (_Shaded)
@ -334,7 +342,7 @@ public:
*/
void computeString (const std::string& s, CComputedString& output)
{
_FontManager->computeString (s, _FontGen, _Color, _FontSize, _Driver, output, _Keep800x600Ratio);
_FontManager->computeString (s, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio);
}
/**
@ -345,12 +353,12 @@ public:
*/
void computeString (const ucstring& s, CComputedString& output)
{
_FontManager->computeString (s, _FontGen, _Color, _FontSize, _Driver, output, _Keep800x600Ratio);
_FontManager->computeString (s, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio);
}
void computeStringInfo (const ucstring& s, CComputedString& output)
{
_FontManager->computeStringInfo (s, _FontGen, _Color, _FontSize, _Driver, output, _Keep800x600Ratio);
_FontManager->computeStringInfo (s, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, output, _Keep800x600Ratio);
}
/// Debug : write to the disk the texture cache
@ -381,6 +389,10 @@ private:
/// Font size;
uint32 _FontSize;
bool _Embolden;
bool _Oblique;
/// Current text color
NLMISC::CRGBA _Color;

@ -66,6 +66,10 @@ public:
void setColor(NLMISC::CRGBA color);
void setFontSize(uint32 fontSize);
uint32 getFontSize() const;
void setEmbolden(bool b);
bool getEmbolden() const;
void setOblique(bool b);
bool getOblique() const;
void setHotSpot(THotSpot hotSpot);
THotSpot getHotSpot() const;
void setScaleX(float scaleX);

@ -43,6 +43,8 @@ public:
ucchar Char;
CFontGenerator *FontGenerator;
sint Size;
bool Embolden;
bool Oblique;
// The less recently used infos
@ -66,6 +68,8 @@ public:
ucchar Char;
CFontGenerator *FontGenerator;
sint Size;
bool Embolden;
bool Oblique;
uint32 getVal();
//bool operator < (const SLetterKey&k) const;

@ -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);

@ -137,6 +137,24 @@ public:
* \return the font size
*/
virtual uint32 getFontSize () const = 0;
/**
* set embolden (bold) state
* \param embolden the embbolden state
*/
virtual void setEmbolden (bool b) = 0;
/**
* \return the embolden state
*/
virtual bool getEmbolden () const = 0;
/**
* set oblique (italic) state
* \param oblique the oblique state
*/
virtual void setOblique (bool b) = 0;
/**
* \return the oblique state
*/
virtual bool getOblique () const = 0;
/**
* set the hot spot
* \param fonSize the font size

@ -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
@ -181,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()); }

@ -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:

@ -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"
@ -103,11 +102,14 @@ namespace NLGUI
// Browse
virtual void browse (const char *url);
// parse html string using libxml2 parser
virtual bool parseHtml(std::string htmlString);
// Refresh
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);
@ -200,6 +202,7 @@ namespace NLGUI
int luaBeginElement(CLuaState &ls);
int luaEndElement(CLuaState &ls);
int luaShowDiv(CLuaState &ls);
int luaParseHtml(CLuaState &ls);
REFLECT_EXPORT_START(CGroupHTML, CGroupScrollText)
REFLECT_LUA_METHOD("browse", luaBrowse)
@ -211,6 +214,7 @@ namespace NLGUI
REFLECT_LUA_METHOD("beginElement", luaBeginElement)
REFLECT_LUA_METHOD("endElement", luaEndElement)
REFLECT_LUA_METHOD("showDiv", luaShowDiv)
REFLECT_LUA_METHOD("parseHtml", luaParseHtml)
REFLECT_STRING("url", getURL, setURL)
REFLECT_FLOAT("timeout", getTimeout, setTimeout)
REFLECT_EXPORT_END
@ -229,7 +233,7 @@ namespace NLGUI
virtual void addText (const char * buf, int len);
// A link has been parsed
virtual void addLink (uint element_number, uint attribute_number, HTChildAnchor *anchor, const BOOL *present, const char **value);
virtual void addLink (uint element_number, const BOOL *present, const char **value);
// A new begin HTML element has been parsed (<IMG> for exemple)
virtual void beginElement (uint element_number, const BOOL *present, const char **value);
@ -252,6 +256,10 @@ namespace NLGUI
// the current request is terminated
virtual void requestTerminated(HTRequest *request);
// libxml2 html parser functions
void htmlElement(xmlNode *node, int element_number);
void htmlWalkDOM(xmlNode *a_node);
// Get Home URL
virtual std::string home();
@ -328,7 +336,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;
@ -422,6 +434,38 @@ namespace NLGUI
return _FontSize.back();
}
std::vector<uint> _FontWeight;
inline uint getFontWeight() const
{
if (_FontWeight.empty())
return 400;
return _FontWeight.back();
}
std::vector<bool> _FontOblique;
inline uint getFontOblique() const
{
if (_FontOblique.empty())
return false;
return _FontOblique.back();
}
std::vector<bool> _FontUnderlined;
inline uint getFontUnderlined() const
{
if (_FontUnderlined.empty())
return false;
return _FontUnderlined.back();
}
std::vector<bool> _FontStrikeThrough;
inline uint getFontStrikeThrough() const
{
if (_FontStrikeThrough.empty())
return false;
return _FontStrikeThrough.back();
}
// Current link
std::vector<std::string> _Link;
inline const char *getLink() const
@ -541,6 +585,26 @@ namespace NLGUI
};
std::vector<CCellParams> _CellParams;
class CStyleParams
{
public:
CStyleParams () : TextColor(255,255,255,255)
{
FontSize=10;
FontWeight=400;
FontOblique=false;
Underlined=false;
StrikeThrough=false;
}
uint FontSize;
uint FontWeight;
bool FontOblique;
NLMISC::CRGBA TextColor;
bool Underlined;
bool StrikeThrough;
};
// Indentation
uint _Indent;
@ -610,8 +674,16 @@ namespace NLGUI
typedef std::map<uint32, NLMISC::CRefPtr<CGroupHTML> > TGroupHtmlByUIDMap;
static TGroupHtmlByUIDMap _GroupHtmlByUID;
private:
// read style attribute
void getStyleParams(const std::string &styleString, CStyleParams &style, bool inherit = true);
// load and render local html file (from bnp for example)
void doBrowseLocalFile(const std::string &filename);
// render html string as new browser page
bool renderHtmlString(const std::string &html);
private:
// decode all HTML entities
static ucstring decodeHTMLEntities(const ucstring &str);
@ -642,6 +714,7 @@ namespace NLGUI
void checkImageDownload();
void addImageDownload(const std::string &url, CViewBase *img);
std::string localImageName(const std::string &url);
std::string getAbsoluteUrl(const std::string &url);
bool isTrustedDomain(const std::string &domain);
void setImage(CViewBase *view, const std::string &file);

@ -117,6 +117,7 @@ namespace NLGUI
editorSelected = false;
serializable = true;
_EditorSelectable = true;
}
// dtor
@ -531,9 +532,16 @@ namespace NLGUI
/// 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;

@ -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;
@ -216,6 +218,13 @@ namespace NLGUI
HTML_ATTR(DIV,STYLE),
};
enum
{
HTML_ATTR(SPAN,CLASS) = 0,
HTML_ATTR(SPAN,ID),
HTML_ATTR(SPAN,STYLE),
};
#undef HTML_ATTR

@ -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()
{}

@ -81,6 +81,8 @@ namespace NLGUI
void setText (const ucstring &text);
void setFontSize (sint nFontSize);
void setEmbolden (bool nEmbolden);
void setOblique (bool nOblique);
void setColor (const NLMISC::CRGBA &color);
void setShadow (bool bShadow);
void setShadowOutline (bool bShadowOutline);
@ -101,6 +103,8 @@ namespace NLGUI
ucstring getText() const { return _Text; }
sint getFontSize() const;
bool getEmbolden() { return _Embolden; }
bool getOblique() { return _Oblique; }
NLMISC::CRGBA getColor() { return _Color; }
bool getShadow() { return _Shadow; }
bool getShadowOutline() { return _ShadowOutline; }
@ -125,6 +129,8 @@ namespace NLGUI
uint getLastLineW () const;
void setUnderlined (bool underlined) { _Underlined = underlined; }
bool getUnderlined () const { return _Underlined; }
void setStrikeThrough (bool linethrough) { _StrikeThrough = linethrough; }
bool getStrikeThrough () const { return _StrikeThrough; }
// true if the viewText is a single line clamped.
bool isSingleLineTextClamped() const {return _SingleLineTextClamped;}
@ -220,6 +226,8 @@ namespace NLGUI
NL3D::UTextContext::CStringInfo _Info;
/// the font size
sint _FontSize;
bool _Embolden;
bool _Oblique;
// width of the font in pixel. Just a Hint for tabing format (computed with '_')
uint _FontWidth;
// height of the font in pixel.
@ -374,6 +382,7 @@ namespace NLGUI
bool _TextSelection : 1;
bool _InvalidTextContext : 1;
bool _Underlined : 1;
bool _StrikeThrough : 1;
bool _ContinuousUpdate : 1;
bool _Setuped : 1;

@ -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,6 +151,7 @@ namespace NLMISC
bool DebugNeedAssert;
bool NoAssert;
bool AlreadyCreateSharedAmongThreads;
bool WindowedApplication;
};
/** This class implements the context interface for the a library module.
@ -183,6 +188,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:
/// Pointer to the application context.

@ -61,8 +61,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

@ -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,13 +575,16 @@ 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
{
uint64 hash64 = id.getUniqueId();
return size_t(hash64) ^ size_t( hash64 >> 32 );
#if (HAVE_X86_64)
return (size_t)hash64;
#else
return (size_t)hash64 ^ (size_t)(hash64 >> 32);
#endif
//return size_t(id.getShortId());
}
bool operator() (const NLMISC::CEntityId &id1, const NLMISC::CEntityId &id2) const

@ -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 ();

@ -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

@ -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

@ -39,9 +39,9 @@ class CPThread : public IThread
public:
enum TThreadState
{
ThreadStateNone,
ThreadStateRunning,
ThreadStateFinished,
ThreadStateNone,
ThreadStateRunning,
ThreadStateFinished,
};
/// Constructor

@ -343,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.
*
@ -507,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

@ -248,8 +248,7 @@ private :
class CSheetIdHashMapTraits
{
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 CSheetId& sheetId ) const
{
return sheetId.asInt() >> 5;

@ -937,21 +937,21 @@ inline CSString operator+(const CSString& s0,const CSString& s1)
*/
inline CSString operator+(char s0,const CSString& s1)
{
return CSString(s0)+s1;
return CSString(s0) + s1.c_str();
}
inline CSString operator+(const char* s0,const CSString& s1)
{
return CSString(s0)+s1;
return CSString(s0) + s1.c_str();
}
#ifndef NL_COMP_VC10
#if !defined(NL_COMP_VC) || (NL_COMP_VC_VERSION <= 100)
// TODO: check if it can be disabled for other compilers too
inline CSString operator+(const std::string& s0,const CSString& s1)
{
return s0+static_cast<const std::string&>(s1);
}
#endif // NL_COMP_VC10
#endif
} // NLMISC

@ -20,6 +20,7 @@
#include "types_nl.h"
#include <cstdio>
#include <cstring>
#include <cstdarg>
#include <errno.h>
@ -264,6 +265,40 @@ inline bool fromString(const std::string &str, bool &val)
return true;
}
inline bool fromString(const char *str, uint32 &val) { if (strstr(str, "-") != NULL) { val = 0; return false; } char *end; unsigned long v; errno = 0; v = strtoul(str, &end, 10); if (errno || v > UINT_MAX || end == str) { val = 0; return false; } else { val = (uint32)v; return true; } }
inline bool fromString(const char *str, sint32 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > INT_MAX || v < INT_MIN || end == str) { val = 0; return false; } else { val = (sint32)v; return true; } }
inline bool fromString(const char *str, uint8 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > UCHAR_MAX || v < 0 || end == str) { val = 0; return false; } else { val = (uint8)v; return true; } }
inline bool fromString(const char *str, sint8 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SCHAR_MAX || v < SCHAR_MIN || end == str) { val = 0; return false; } else { val = (sint8)v; return true; } }
inline bool fromString(const char *str, uint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > USHRT_MAX || v < 0 || end == str) { val = 0; return false; } else { val = (uint16)v; return true; } }
inline bool fromString(const char *str, sint16 &val) { char *end; long v; errno = 0; v = strtol(str, &end, 10); if (errno || v > SHRT_MAX || v < SHRT_MIN || end == str) { val = 0; return false; } else { val = (sint16)v; return true; } }
inline bool fromString(const char *str, uint64 &val) { bool ret = sscanf(str, "%"NL_I64"u", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const char *str, sint64 &val) { bool ret = sscanf(str, "%"NL_I64"d", &val) == 1; if (!ret) val = 0; return ret; }
inline bool fromString(const char *str, float &val) { bool ret = sscanf(str, "%f", &val) == 1; if (!ret) val = 0.0f; return ret; }
inline bool fromString(const char *str, double &val) { bool ret = sscanf(str, "%lf", &val) == 1; if (!ret) val = 0.0; return ret; }
inline bool fromString(const char *str, bool &val)
{
switch (str[0])
{
case '1':
case 't':
case 'y':
case 'T':
case 'Y':
val = true;
return true;
case '0':
case 'f':
case 'n':
case 'F':
case 'N':
val = false;
return true;
}
return false;
}
inline bool fromString(const std::string &str, std::string &val) { val = str; return true; }
// stl vectors of bool use bit reference and not real bools, so define the operator for bit reference

@ -39,8 +39,7 @@ typedef const std::string *TStringId;
// Traits for hash_map using CStringId
struct CStringIdHashMapTraits
{
static const size_t bucket_size = 4;
static const size_t min_buckets = 8;
enum { bucket_size = 4, min_buckets = 8, };
CStringIdHashMapTraits() { }
size_t operator() (const NLMISC::TStringId &stringId) const
{

@ -77,6 +77,10 @@ public:
/// Get desktop current color depth without using UDriver.
static uint getCurrentColorDepth();
/// Detect whether the current process is a windowed application. Return true if definitely yes, false if unknown
static bool detectWindowedApplication();
};
} // NLMISC

@ -53,7 +53,10 @@
# endif
# ifdef _MSC_VER
# define NL_COMP_VC
# if _MSC_VER >= 1700
# if _MSC_VER >= 1800
# define NL_COMP_VC12
# define NL_COMP_VC_VERSION 120
# elif _MSC_VER >= 1700
# define NL_COMP_VC11
# define NL_COMP_VC_VERSION 110
# elif _MSC_VER >= 1600
@ -414,6 +417,12 @@ extern void operator delete[](void *p) throw();
# define CHashMap stdext::hash_map
# define CHashSet stdext::hash_set
# define CHashMultiMap stdext::hash_multimap
#elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 100)
# include <unordered_map>
# include <unordered_set>
# define CHashMap ::std::unordered_map
# define CHashSet ::std::unordered_set
# define CHashMultiMap ::std::unordered_multimap
#elif defined(NL_COMP_GCC) // GCC4
# include <ext/hash_map>
# include <ext/hash_set>
@ -454,7 +463,11 @@ typedef uint16 ucchar;
// To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234)
#ifdef NL_COMP_VC
# if (NL_COMP_VC_VERSION >= 80)
# if (NL_COMP_VC_VERSION >= 120)
# define INT64_CONSTANT(c) (c##LL)
# define SINT64_CONSTANT(c) (c##LL)
# define UINT64_CONSTANT(c) (c##ULL)
# elif (NL_COMP_VC_VERSION >= 80)
# define INT64_CONSTANT(c) (c##LL)
# define SINT64_CONSTANT(c) (c##LL)
# define UINT64_CONSTANT(c) (c##LL)

@ -355,8 +355,7 @@ namespace NLMISC
// Traits for hash_map using CEntityId
struct CUCStringHashMapTraits
{
static const size_t bucket_size = 4;
static const size_t min_buckets = 8;
enum { bucket_size = 4, min_buckets = 8, };
CUCStringHashMapTraits() { }
size_t operator() (const ucstring &id ) const
{
@ -364,7 +363,7 @@ struct CUCStringHashMapTraits
}
bool operator() (const ucstring &id1, const ucstring &id2) const
{
return id1.size() < id2.size();
return id1 < id2;
}
};

@ -0,0 +1,74 @@
// Public domain hash functions
#ifndef NLMISC_WANG_HASH_H
#define NLMISC_WANG_HASH_H
#include "types_nl.h"
namespace NLMISC {
// http://burtleburtle.net/bob/hash/integer.html
inline uint32 wangHash(uint32 a)
{
a = (a ^ 61) ^ (a >> 16);
a = a + (a << 3);
a = a ^ (a >> 4);
a = a * 0x27d4eb2d;
a = a ^ (a >> 15);
return a;
}
// http://naml.us/blog/2012/03
inline uint64 wangHash64(uint64 key)
{
key = (~key) + (key << 21); // key = (key << 21) - key - 1;
key = key ^ (key >> 24);
key = (key + (key << 3)) + (key << 8); // key * 265
key = key ^ (key >> 14);
key = (key + (key << 2)) + (key << 4); // key * 21
key = key ^ (key >> 28);
key = key + (key << 31);
return key;
}
// http://naml.us/blog/2012/03 Inverse 64-bit wang hash
inline uint64 wangHash64Inv(uint64 key)
{
uint64 tmp;
// Invert key = key + (key << 31)
tmp = key - (key << 31);
key = key - (tmp << 31);
// Invert key = key ^ (key >> 28)
tmp = key^key >> 28;
key = key^tmp >> 28;
// Invert key *= 21
key *= 14933078535860113213u;
// Invert key = key ^ (key >> 14)
tmp = key^key >> 14;
tmp = key^tmp >> 14;
tmp = key^tmp >> 14;
key = key^tmp >> 14;
// Invert key *= 265
key *= 15244667743933553977u;
// Invert key = key ^ (key >> 24)
tmp = key^key >> 24;
key = key^tmp >> 24;
// Invert key = (~key) + (key << 21)
tmp = ~key;
tmp = ~(key - (tmp << 21));
tmp = ~(key - (tmp << 21));
key = ~(key - (tmp << 21));
return key;
}
} /* namespace NLMISC */
#endif // NLMISC_WANG_HASH_H

@ -21,8 +21,19 @@
#ifdef NL_OS_WINDOWS
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#ifndef NL_COMP_MINGW
#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>
@ -46,11 +57,7 @@ class CWinDisplayer : public NLMISC::CWindowDisplayer
{
public:
CWinDisplayer (const char *displayerName = "") : CWindowDisplayer(displayerName), Exit(false)
{
needSlashR = true;
createLabel ("@Clear|CLEAR");
}
CWinDisplayer(const char *displayerName = "");
virtual ~CWinDisplayer ();

@ -31,7 +31,7 @@ public:
~CXMLAutoPtr() { destroy(); }
operator const char *() const { return _Value; }
operator bool() const { return _Value != NULL; }
operator std::string() const { return std::string(_Value); }
inline std::string str() const { return _Value; }
bool operator ! () const { return _Value == NULL; }
operator const unsigned char *() const { return (const unsigned char *) _Value; }
char operator * () const { nlassert(_Value); return *_Value; }

@ -218,13 +218,13 @@ public:
static bool isServiceInitialized() { return _Instance != NULL; }
/// Returns the current service short name (ie: TS)
const std::string &getServiceShortName () const { return _ShortName; };
const std::string &getServiceShortName () const { return _ShortName; }
/// Returns the current service long name (ie: test_serivce)
const std::string &getServiceLongName () const { return _LongName; };
const std::string &getServiceLongName () const { return _LongName; }
/// Returns the current service alias name setted by AES
const std::string &getServiceAliasName () const { return _AliasName; };
const std::string &getServiceAliasName () const { return _AliasName; }
/// Returns the current service unified name that is alias/short-id or short-id if alias is empty
std::string getServiceUnifiedName () const;
@ -242,10 +242,10 @@ public:
uint32 getLaunchingDate () const;
/// Return true if this service don't use the NS (naming service)
bool getDontUseNS() const { return _DontUseNS; };
bool getDontUseNS() const { return _DontUseNS; }
/// Return true if this service don't use the AES (admin executor service)
bool getDontUseAES() const { return _DontUseAES; };
bool getDontUseAES() const { return _DontUseAES; }
/// Returns arguments of the program pass from the user to the program using parameters (ie: "myprog param1 param2")
const NLMISC::CVectorSString &getArgs () const { return _Args; }

@ -42,8 +42,7 @@ namespace NLSOUND {
template <class Pointer>
struct THashPtr : public std::unary_function<const Pointer &, size_t>
{
static const size_t bucket_size = 4;
static const size_t min_buckets = 8;
enum { bucket_size = 4, min_buckets = 8, };
size_t operator () (const Pointer &ptr) const
{
//CHashSet<uint>::hasher h;

@ -71,6 +71,19 @@ struct CContextMatcher
return memcmp(JokersValues, other.JokersValues, sizeof(uint32)*NbJoker) == 0;
}
bool operator<(const CContextMatcher &other) const
{
if (UseRandom)
if (RandomValue != other.RandomValue)
return RandomValue < other.RandomValue;
int cmp = memcmp(JokersValues, other.JokersValues, sizeof(uint32) * NbJoker);
if (cmp != 0)
return cmp < 0;
return false;
}
size_t getHashValue() const
{
return size_t(HashValue);
@ -82,18 +95,16 @@ struct CContextMatcher
struct CHash : public std::unary_function<CContextMatcher, size_t>
{
static const size_t bucket_size = 4;
static const size_t min_buckets = 8;
enum { bucket_size = 4, min_buckets = 8, };
size_t operator () (const CContextMatcher &patternMatcher) const
{
return patternMatcher.getHashValue();
}
bool operator() (const CContextMatcher &patternMatcher1, const CContextMatcher &patternMatcher2) const
{
return patternMatcher1.getHashValue() < patternMatcher2.getHashValue();
return patternMatcher1 < patternMatcher2;
}
};
};

@ -79,16 +79,16 @@ int main(int argc, char **argv)
// 4th is the size of the font. 5th is a pointer to the video driver.
// 6th is the resulting computed string.
CComputedString csRotation;
fontManager.computeString ("cs Rotation", tc.getFontGenerator(), CRGBA(255,255,255), 70, CNELU::Driver, csRotation);
fontManager.computeString ("cs Rotation", tc.getFontGenerator(), CRGBA(255,255,255), 70, false, false, CNELU::Driver, csRotation);
CComputedString cs3d;
fontManager.computeString ("cs 3d", tc.getFontGenerator(), CRGBA(255,127,0), 75, CNELU::Driver, cs3d);
fontManager.computeString ("cs 3d", tc.getFontGenerator(), CRGBA(255,127,0), 75, false, false, CNELU::Driver, cs3d);
// generate an Unicode string.
ucstring ucs("cs Unicode String");
CComputedString csUnicode;
fontManager.computeString (ucs, tc.getFontGenerator(), CRGBA(32,64,127), 75, CNELU::Driver, csUnicode);
fontManager.computeString (ucs, tc.getFontGenerator(), CRGBA(32,64,127), 75, false, false, CNELU::Driver, csUnicode);
// look at event example
CNELU::EventServer.addEmitter(CNELU::Driver->getEventEmitter());

@ -543,14 +543,14 @@ ColorPickerPopup::ColorPickerPopup(int width, bool withColorDialog,
setMouseTracking(true);
cols = width;
if (withColorDialog)
if (withColorDialog)
{
moreButton = new ColorPickerButton(this);
moreButton->setFixedWidth(24);
moreButton->setFixedHeight(21);
moreButton->setFrameRect(QRect(2, 2, 20, 17));
connect(moreButton, SIGNAL(clicked()), SLOT(getColorFromDialog()));
}
}
else
{
moreButton = 0;

@ -18,11 +18,16 @@
#include <stdlib.h>
// contains all debug features
#include "nel/misc/debug.h"
#include <nel/misc/debug.h>
#include <nel/misc/report.h>
using namespace NLMISC;
void repeatederror()
{
// hit always ignore to surpress this error for the duration of the program
nlassert(false && "hit always ignore");
}
int main (int /* argc */, char ** /* argv */)
int main(int /* argc */, char ** /* argv */)
{
// all debug functions have different behaviors in debug and in release mode.
// in general, in debug mode, all debug functions are active, they display
@ -36,20 +41,24 @@ int main (int /* argc */, char ** /* argv */)
// in release mode, this function does nothing by default. you have to add a displayer
// manually, or put true in the parameter to say to the function that you want it to
// add the default displayers
createDebug ();
NLMISC::createDebug();
// enable the crash report tool
NLMISC::INelContext::getInstance().setWindowedApplication(true);
NLMISC::setReportPostUrl("http://ryzomcore.org/crash_report/");
// display debug information, that will be skipped in release mode.
nldebug ("nldebug() %d", 1);
nldebug("nldebug() %d", 1);
// display the string
nlinfo ("nlinfo() %d", 2);
nlinfo("nlinfo() %d", 2);
// when something not normal, but that the program can manage, occurs, call nlwarning()
nlwarning ("nlwarning() %d", 3);
nlwarning("nlwarning() %d", 3);
// nlassert() is like assert but do more powerful things. in release mode, the test is
// not executed and nothing will happen. (Press F5 in Visual C++ to continue the execution)
nlassert (true == false);
nlassert(true == false);
// in a switch case or when you want that the program never executes a part of code, use stop.
// in release, nlstop does nothing. in debug mode,
@ -61,16 +70,20 @@ int main (int /* argc */, char ** /* argv */)
// occurs. (In Visual C++ press F5 to continue)
try
{
nlerror ("nlerror() %d", 4);
nlerror("nlerror() %d", 4);
}
catch(const EFatalError &)
catch (const NLMISC::EFatalError &)
{
// just continue...
nlinfo ("nlerror() generated an EFatalError exception, just ignore it");
nlinfo("nlerror() generated an EFatalError exception, just ignore it");
}
// keep repeating the same error
for (int i = 0; i < 32; ++i)
repeatederror();
printf("\nPress <return> to exit\n");
getchar ();
getchar();
return EXIT_SUCCESS;
}

@ -98,8 +98,7 @@ struct CClient
struct TInetAddressHash
{
static const size_t bucket_size = 4;
static const size_t min_buckets = 8;
enum { bucket_size = 4, min_buckets = 8, };
inline bool operator() (const NLNET::CInetAddress &x1, const NLNET::CInetAddress &x2) const
{

@ -1327,6 +1327,10 @@ const D3DFORMAT FinalPixelFormat[ITexture::UploadFormatCount][CDriverD3D::FinalP
bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) throw(EBadDisplay)
{
H_AUTO_D3D(CDriver3D_setDisplay);
if (!mode.OffScreen)
NLMISC::INelContext::getInstance().setWindowedApplication(true);
if (!_D3D)
return false;
#ifndef NL_NO_ASM
@ -1509,9 +1513,6 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
}
}
// _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &parameters, &_DeviceInterface);
// Check some caps
D3DCAPS9 caps;
if (_DeviceInterface->GetDeviceCaps(&caps) == D3D_OK)

@ -67,6 +67,16 @@ IF(UNIX AND NOT APPLE)
ADD_DEFINITIONS(-DHAVE_XCURSOR)
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xcursor_LIB})
ENDIF(X11_Xcursor_FOUND)
IF(X11_Xext_FOUND)
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xext_LIB})
ENDIF(X11_Xext_FOUND)
# libraries needed to be linked while linking to static X11 libraries
FIND_LIBRARY(XCB_LIBRARY
NAMES xcb
HINTS ${X11_LIB_SEARCH_PATH})
IF(XCB_LIBRARY)
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XCB_LIBRARY})
ENDIF(XCB_LIBRARY)
ENDIF(UNIX AND NOT APPLE)
IF(WITH_PCH)

@ -435,11 +435,7 @@ bool CDriverGL::setupDisplay()
glViewport(0,0,_CurrentMode.Width,_CurrentMode.Height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef USE_OPENGLES
glOrthof(0.f,_CurrentMode.Width,_CurrentMode.Height,0.f,-1.0f,1.0f);
#else
glOrtho(0,_CurrentMode.Width,_CurrentMode.Height,0,-1.0f,1.0f);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
#ifndef USE_OPENGLES
@ -725,11 +721,7 @@ bool CDriverGL::activeFrameBufferObject(ITexture * tex)
}
else
{
#ifdef USE_OPENGLES
nglBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);
#else
nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
#endif
return true;
}
}
@ -2178,7 +2170,7 @@ void CDriverGL::flush()
// ***************************************************************************
void CDriverGL::setSwapVBLInterval(uint interval)
{
H_AUTO_OGL(CDriverGL_setSwapVBLInterval)
H_AUTO_OGL(CDriverGL_setSwapVBLInterval);
if (!_Initialized)
return;

@ -40,6 +40,24 @@ extern "C" {
#define GL_ADD_SIGNED_EXT GL_ADD_SIGNED
#define GL_INTERPOLATE_EXT GL_INTERPOLATE
#define GL_BUMP_ENVMAP_ATI GL_INTERPOLATE
#define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER_OES
#define GL_RENDERBUFFER_EXT GL_RENDERBUFFER_OES
#define GL_DEPTH24_STENCIL8_EXT GL_DEPTH24_STENCIL8_OES
#define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES
#define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0_OES
#define GL_DEPTH_ATTACHMENT_EXT GL_DEPTH_ATTACHMENT_OES
#define GL_STENCIL_ATTACHMENT_EXT GL_STENCIL_ATTACHMENT_OES
#define GL_ARRAY_BUFFER_ARB GL_ARRAY_BUFFER
#define GL_TEXTURE0_ARB GL_TEXTURE0
#define GL_ALPHA8 GL_ALPHA
#define GL_LUMINANCE8_ALPHA8 GL_LUMINANCE_ALPHA
#define GL_LUMINANCE8 GL_LUMINANCE
#define GL_RGBA8 GL_RGBA
#define GL_RGB8 GL_RGB
#define GL_STATIC_DRAW_ARB GL_STATIC_DRAW
#define GL_DYNAMIC_DRAW_ARB GL_DYNAMIC_DRAW
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES
@ -48,6 +66,31 @@ extern "C" {
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES
#define nglGenRenderbuffersEXT nglGenRenderbuffersOES
#define nglBindRenderbufferEXT nglBindRenderbufferOES
#define nglDeleteRenderbuffersEXT nglDeleteRenderbuffersOES
#define nglRenderbufferStorageEXT nglRenderbufferStorageOES
#define nglGenFramebuffersEXT nglGenFramebuffersOES
#define nglBindFramebufferEXT nglBindFramebufferOES
#define nglFramebufferTexture2DEXT nglFramebufferTexture2DOES
#define nglFramebufferRenderbufferEXT nglFramebufferRenderbufferOES
#define nglCheckFramebufferStatusEXT nglCheckFramebufferStatusOES
#define nglDeleteBuffersARB glDeleteBuffers
#define nglIsBufferARB glIsBuffer
#define nglDeleteRenderbuffersEXT nglDeleteRenderbuffersOES
#define nglBindFramebufferEXT nglBindFramebufferOES
#define nglDeleteFramebuffersEXT nglDeleteFramebuffersOES
#define nglUnmapBufferARB nglUnmapBufferOES
#define nglActiveTextureARB glActiveTexture
#define nglClientActiveTextureARB glClientActiveTexture
#define nglBindBufferARB glBindBuffer
#define nglGenBuffersARB glGenBuffers
#define nglBufferDataARB glBufferData
#define glFrustum glFrustumf
#define glOrtho glOrthof
#define glDepthRange glDepthRangef
#else
#if defined(NL_OS_MAC)

@ -403,7 +403,7 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
// Must setup textures each frame. (need to test if touched).
// Must separate texture setup and texture activation in 2 "for"...
// because setupTexture() may disable all stage.
if (matShader != CMaterial::Water
if (matShader != CMaterial::Water
&& ((matShader != CMaterial::Program) || (_LastSetuppedPP->features().MaterialFlags & CProgramFeatures::TextureStages))
)
{

@ -37,19 +37,11 @@ void CDriverGL::setFrustum(float left, float right, float bottom, float top, flo
if (perspective)
{
#ifdef USE_OPENGLES
glFrustumf(left,right,bottom,top,znear,zfar);
#else
glFrustum(left,right,bottom,top,znear,zfar);
#endif
}
else
{
#ifdef USE_OPENGLES
glOrthof(left,right,bottom,top,znear,zfar);
#else
glOrtho(left,right,bottom,top,znear,zfar);
#endif
}
_ProjMatDirty = true;

@ -155,11 +155,7 @@ void CDriverGLStates::forceDefaults(uint nbStages)
for(stage=0;stage<nbStages; stage++)
{
// disable texturing.
#ifdef USE_OPENGLES
glActiveTexture(GL_TEXTURE0+stage);
#else
nglActiveTextureARB(GL_TEXTURE0_ARB+stage);
#endif
glDisable(GL_TEXTURE_2D);
@ -188,13 +184,8 @@ void CDriverGLStates::forceDefaults(uint nbStages)
}
// ActiveTexture current texture to 0.
#ifdef USE_OPENGLES
glActiveTexture(GL_TEXTURE0);
glClientActiveTexture(GL_TEXTURE0);
#else
nglActiveTextureARB(GL_TEXTURE0_ARB);
nglClientActiveTextureARB(GL_TEXTURE0_ARB);
#endif
_CurrentActiveTextureARB= 0;
_CurrentClientActiveTextureARB= 0;
@ -622,11 +613,7 @@ void CDriverGLStates::updateDepthRange()
float delta = _ZBias * (_DepthRangeFar - _DepthRangeNear);
#ifdef USE_OPENGLES
glDepthRangef(delta + _DepthRangeNear, delta + _DepthRangeFar);
#else
glDepthRange(delta + _DepthRangeNear, delta + _DepthRangeFar);
#endif
}
// ***************************************************************************
@ -767,7 +754,7 @@ void CDriverGLStates::setTextureMode(TTextureMode texMode)
{
glDisable(GL_TEXTURE_2D);
}
else if(oldTexMode == TextureRect)
else if (oldTexMode == TextureRect)
{
#ifndef USE_OPENGLES
if(_TextureRectangleSupported)
@ -780,7 +767,7 @@ void CDriverGLStates::setTextureMode(TTextureMode texMode)
glDisable(GL_TEXTURE_2D);
}
}
else if(oldTexMode == TextureCubeMap)
else if (oldTexMode == TextureCubeMap)
{
if(_TextureCubeMapSupported)
{
@ -835,11 +822,7 @@ void CDriverGLStates::activeTextureARB(uint stage)
if( _CurrentActiveTextureARB != stage )
{
#ifdef USE_OPENGLES
glActiveTexture(GL_TEXTURE0+stage);
#else
nglActiveTextureARB(GL_TEXTURE0_ARB+stage);
#endif
_CurrentActiveTextureARB= stage;
}
@ -850,11 +833,7 @@ void CDriverGLStates::forceActiveTextureARB(uint stage)
{
H_AUTO_OGL(CDriverGLStates_forceActiveTextureARB);
#ifdef USE_OPENGLES
glActiveTexture(GL_TEXTURE0+stage);
#else
nglActiveTextureARB(GL_TEXTURE0_ARB+stage);
#endif
_CurrentActiveTextureARB= stage;
}
@ -958,11 +937,7 @@ void CDriverGLStates::clientActiveTextureARB(uint stage)
if( _CurrentClientActiveTextureARB != stage )
{
#ifdef USE_OPENGLES
glClientActiveTexture(GL_TEXTURE0+stage);
#else
nglClientActiveTextureARB(GL_TEXTURE0_ARB+stage);
#endif
_CurrentClientActiveTextureARB= stage;
}
}
@ -1121,11 +1096,7 @@ void CDriverGLStates::forceBindARBVertexBuffer(uint objectID)
{
H_AUTO_OGL(CDriverGLStates_forceBindARBVertexBuffer)
#ifdef USE_OPENGLES
glBindBuffer(GL_ARRAY_BUFFER, objectID);
#else
nglBindBufferARB(GL_ARRAY_BUFFER_ARB, objectID);
#endif
_CurrARBVertexBuffer = objectID;
}

@ -93,19 +93,6 @@ CTextureDrvInfosGL::~CTextureDrvInfosGL()
{
_Driver->_TextureUsed[TextureUsedIdx] = NULL;
}
#ifdef USE_OPENGLES
if (InitFBO)
{
nglDeleteFramebuffersOES(1, &FBOId);
if(AttachDepthStencil)
{
nglDeleteRenderbuffersOES(1, &DepthFBOId);
if(!UsePackedDepthStencil)
nglDeleteRenderbuffersOES(1, &StencilFBOId);
}
}
#endif
}
CDepthStencilFBO::CDepthStencilFBO(CDriverGL *driver, uint width, uint height)
@ -175,56 +162,9 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex)
AttachDepthStencil = !((CTextureBloom*)tex)->isMode2D();
}
#ifdef USE_OPENGLES
// generate IDs
nglGenFramebuffersOES(1, &FBOId);
if(AttachDepthStencil)
{
nglGenRenderbuffersOES(1, &DepthFBOId);
if(UsePackedDepthStencil)
StencilFBOId = DepthFBOId;
else
nglGenRenderbuffersOES(1, &StencilFBOId);
}
//nldebug("3D: using depth %d and stencil %d", DepthFBOId, StencilFBOId);
// initialize FBO
nglBindFramebufferOES(GL_FRAMEBUFFER_OES, FBOId);
nglFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, TextureMode, ID, 0);
// attach depth/stencil render to FBO
// note: for some still unkown reason it's impossible to add
// a stencil buffer as shown in the respective docs (see
// opengl.org extension registry). Until a safe approach to add
// them is found, there will be no attached stencil for the time
// being, aside of using packed depth+stencil buffers.
if(AttachDepthStencil)
{
if(UsePackedDepthStencil)
{
//nldebug("3D: using packed depth stencil");
nglBindRenderbufferOES(GL_RENDERBUFFER_OES, StencilFBOId);
nglRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH24_STENCIL8_OES, tex->getWidth(), tex->getHeight());
}
else
{
nglBindRenderbufferOES(GL_RENDERBUFFER_OES, DepthFBOId);
nglRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT24_OES, tex->getWidth(), tex->getHeight());
/*
nglBindRenderbufferEXT(GL_RENDERBUFFER_OES, StencilFBOId);
nglRenderbufferStorageEXT(GL_RENDERBUFFER_OES, GL_STENCIL_INDEX8_EXT, tex->getWidth(), tex->getHeight());
*/
}
nglFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, DepthFBOId);
nldebug("3D: glFramebufferRenderbufferExt(depth:24) = %X", nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
nglFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_STENCIL_ATTACHMENT_OES, GL_RENDERBUFFER_OES, StencilFBOId);
nldebug("3D: glFramebufferRenderbufferExt(stencil:8) = %X", nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
}
#else
// generate IDs
nglGenFramebuffersEXT(1, &FBOId);
//nldebug("3D: using depth %d and stencil %d", DepthFBOId, StencilFBOId);
// initialize FBO
@ -253,15 +193,10 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex)
GL_RENDERBUFFER_EXT, DepthStencilFBO->StencilFBOId);
nldebug("3D: glFramebufferRenderbufferExt(stencil:8) = %X", nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT));
}
#endif
// check status
GLenum status;
#ifdef USE_OPENGLES
status = (GLenum) nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES);
#else
status = (GLenum) nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
#endif
GLenum status = (GLenum) nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
switch(status) {
#ifdef GL_FRAMEBUFFER_COMPLETE_EXT
case GL_FRAMEBUFFER_COMPLETE_EXT:
@ -361,11 +296,8 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex)
// clean up resources if allocation failed
if (!InitFBO)
{
#ifdef USE_OPENGLES
nglDeleteFramebuffersOES(1, &FBOId);
#else
nglDeleteFramebuffersEXT(1, &FBOId);
#endif
if (AttachDepthStencil)
{
DepthStencilFBO = NULL;
@ -385,22 +317,14 @@ bool CTextureDrvInfosGL::activeFrameBufferObject(ITexture * tex)
if(initFrameBufferObject(tex))
{
glBindTexture(TextureMode, 0);
#ifdef USE_OPENGLES
nglBindFramebufferOES(GL_FRAMEBUFFER_OES, FBOId);
#else
nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBOId);
#endif
}
else
return false;
}
else
{
#ifdef USE_OPENGLES
nglBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);
#else
nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
#endif
}
return true;
@ -508,11 +432,7 @@ GLint CDriverGL::getGlTextureFormat(ITexture& tex, bool &compressed)
break;
}
#ifdef USE_OPENGLES
return GL_RGBA;
#else
return GL_RGBA8;
#endif
}
// ***************************************************************************
@ -521,11 +441,7 @@ static GLint getGlSrcTextureFormat(ITexture &tex, GLint glfmt)
H_AUTO_OGL(getGlSrcTextureFormat)
// Is destination format is alpha or lumiance ?
#ifdef USE_OPENGLES
if ((glfmt==GL_ALPHA)||(glfmt==GL_LUMINANCE_ALPHA)||(glfmt==GL_LUMINANCE))
#else
if ((glfmt==GL_ALPHA8)||(glfmt==GL_LUMINANCE8_ALPHA8)||(glfmt==GL_LUMINANCE8))
#endif
{
switch(tex.getPixelFormat())
{
@ -578,19 +494,9 @@ uint CDriverGL::computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const
H_AUTO_OGL(CDriverGL_computeMipMapMemoryUsage)
switch(glfmt)
{
#ifdef GL_RGBA8
case GL_RGBA8: return w*h* 4;
#endif
#ifdef GL_RGBA
case GL_RGBA: return w*h* 4;
#endif
// Well this is ugly, but simple :). GeForce 888 is stored as 32 bits.
#ifdef GL_RGB8
case GL_RGB8: return w*h* 4;
#endif
#ifdef GL_RGB
case GL_RGB: return w*h* 4;
#endif
#ifdef GL_RGBA4
case GL_RGBA4: return w*h* 2;
#endif
@ -600,24 +506,9 @@ uint CDriverGL::computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const
#ifdef GL_RGB5
case GL_RGB5: return w*h* 2;
#endif
#ifdef GL_LUMINANCE8
case GL_LUMINANCE8: return w*h* 1;
#endif
#ifdef GL_LUMINANCE
case GL_LUMINANCE: return w*h* 1;
#endif
#ifdef GL_ALPHA8
case GL_ALPHA8: return w*h* 1;
#endif
#ifdef GL_ALPHA
case GL_ALPHA: return w*h* 1;
#endif
#ifdef GL_LUMINANCE8_ALPHA8
case GL_LUMINANCE8_ALPHA8: return w*h* 2;
#endif
#ifdef GL_LUMINANCE_ALPHA
case GL_LUMINANCE_ALPHA: return w*h* 2;
#endif
#ifdef GL_COMPRESSED_RGB_S3TC_DXT1_EXT
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return w*h /2;
#endif

@ -1216,11 +1216,7 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff
GLuint vertexBufferID;
glGetError();
#ifdef USE_OPENGLES
glGenBuffers(1, &vertexBufferID);
#else
nglGenBuffersARB(1, &vertexBufferID);
#endif
if (glGetError() != GL_NO_ERROR) return NULL;
_Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID);
@ -1229,7 +1225,8 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff
{
case CVertexBuffer::AGPVolatile:
#ifdef USE_OPENGLES
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STREAM_DRAW);
// TODO: GL_STREAM_DRAW doesn't exist in OpenGL ES 1.x
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
#else
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STREAM_DRAW_ARB);
#endif
@ -1259,11 +1256,7 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff
}
if (glGetError() != GL_NO_ERROR)
{
#ifdef USE_OPENGLES
glDeleteBuffers(1, &vertexBufferID);
#else
nglDeleteBuffersARB(1, &vertexBufferID);
#endif
return NULL;
}
@ -1306,13 +1299,10 @@ void CVertexArrayRangeARB::updateLostBuffers()
{
nlassert((*it)->_VertexObjectId);
GLuint id = (GLuint) (*it)->_VertexObjectId;
#ifdef USE_OPENGLES
nlassert(glIsBuffer(id));
glDeleteBuffers(1, &id);
#else
nlassert(nglIsBufferARB(id));
nglDeleteBuffersARB(1, &id);
#endif
(*it)->_VertexObjectId = 0;
(*it)->VB->setLocation(CVertexBuffer::NotResident);
}
@ -1361,13 +1351,8 @@ CVertexBufferHardARB::~CVertexBufferHardARB()
if (_VertexObjectId)
{
GLuint id = (GLuint) _VertexObjectId;
#ifdef USE_OPENGLES
nlassert(glIsBuffer(id));
glDeleteBuffers(1, &id);
#else
nlassert(nglIsBufferARB(id));
nglDeleteBuffersARB(1, &id);
#endif
}
if (_VertexArrayRange)
{
@ -1412,12 +1397,7 @@ void *CVertexBufferHardARB::lock()
}
// recreate a vb
GLuint vertexBufferID;
#ifdef USE_OPENGLES
glGenBuffers(1, &vertexBufferID);
#else
nglGenBuffersARB(1, &vertexBufferID);
#endif
if (glGetError() != GL_NO_ERROR)
{
@ -1429,42 +1409,30 @@ void *CVertexBufferHardARB::lock()
{
case CVertexBuffer::AGPVolatile:
#ifdef USE_OPENGLES
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STREAM_DRAW);
// TODO: GL_STREAM_DRAW doesn't exist in OpenGL ES 1.x
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
#else
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STREAM_DRAW_ARB);
#endif
break;
case CVertexBuffer::StaticPreferred:
if (_Driver->getStaticMemoryToVRAM())
#ifdef USE_OPENGLES
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_STATIC_DRAW);
#else
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB);
#endif
else
#ifdef USE_OPENGLES
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
#else
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
#endif
break;
// case CVertexBuffer::AGPPreferred:
default:
#ifdef USE_OPENGLES
glBufferData(GL_ARRAY_BUFFER, size, NULL, GL_DYNAMIC_DRAW);
#else
nglBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB);
#endif
break;
}
if (glGetError() != GL_NO_ERROR)
{
_Driver->incrementResetCounter();
#ifdef USE_OPENGLES
glDeleteBuffers(1, &vertexBufferID);
#else
nglDeleteBuffersARB(1, &vertexBufferID);
#endif
return &_DummyVB[0];;
}
_VertexObjectId = vertexBufferID;
@ -1567,12 +1535,10 @@ void CVertexBufferHardARB::unlock()
#ifdef USE_OPENGLES
if (_Driver->_Extensions.OESMapBuffer)
#endif
{
unmapOk = nglUnmapBufferOES(GL_ARRAY_BUFFER);
unmapOk = nglUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
}
#else
unmapOk = nglUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
#endif
#ifdef NL_DEBUG
_Unmapping = false;

@ -453,7 +453,6 @@ bool CDriverGL::setupEXTVertexShader(const CVPParser::TProgram &program, GLuint
// clear last error
GLenum glError = glGetError();
//variants[EVSSecondaryColorVariant] = nglGenSymbolsEXT(GL_VECTOR_EXT, GL_VARIANT_EXT, GL_NORMALIZED_RANGE_EXT, 1);
//variants[EVSSecondaryColorVariant] = nglGenSymbolsEXT(GL_VECTOR_EXT, GL_VARIANT_EXT, GL_NORMALIZED_RANGE_EXT, 1);
// allocate the symbols

@ -603,6 +603,9 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
{
H_AUTO_OGL(CDriverGL_setDisplay)
if (!mode.OffScreen)
NLMISC::INelContext::getInstance().setWindowedApplication(true);
_win = EmptyWindow;
_CurrentMode = mode;
@ -627,12 +630,15 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
// Offscreen mode ?
if (_CurrentMode.OffScreen)
{
if (!createWindow(mode))
return false;
if (!createWindow(mode)) return false;
HWND tmpHWND = _win;
int width = mode.Width;
int height = mode.Height;
#ifdef USE_OPENGLES
// TODO: implement for OpenGL ES 1.x
#else
// resize the window
RECT rc;
SetRect (&rc, 0, 0, width, height);
@ -910,6 +916,7 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
_hDC = NULL;
return false;
}
#endif
}
else
{
@ -1479,7 +1486,7 @@ bool CDriverGL::createWindow(const GfxMode &mode)
[[CocoaApplicationDelegate alloc] initWithDriver:this];
// set the application delegate, this will handle window/app close events
[NSApp setDelegate:appDelegate];
[NSApp setDelegate:(id<NSFileManagerDelegate>)appDelegate];
// bind the close button of the window to applicationShouldTerminate
id closeButton = [cocoa_window standardWindowButton:NSWindowCloseButton];

@ -270,28 +270,14 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
return false;
}
// first event about mouse movement after setting to emulateRawMode
if(_setToEmulateRawMode &&
(event.type == NSMouseMoved ||
event.type == NSLeftMouseDragged ||
event.type == NSRightMouseDragged))
{
// do not report because it reflects wrapping pointer to 0.5/0.5
_setToEmulateRawMode = false;
return false;
}
// convert the modifiers for nel to pass them with the events
NLMISC::TKeyButton modifiers =
modifierFlagsToNelKeyButton([event modifierFlags]);
NLMISC::TKeyButton modifiers = modifierFlagsToNelKeyButton([event modifierFlags]);
switch(event.type)
{
case NSLeftMouseDown:
{
server->postEvent(new NLMISC::CEventMouseDown(
mousePos.x, mousePos.y,
(NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this));
server->postEvent(new NLMISC::CEventMouseDown(mousePos.x, mousePos.y, (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this));
}
break;
case NSLeftMouseUp:
@ -319,15 +305,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
{
NLMISC::CEvent* nelEvent;
// when emulating raw mode, send the delta in a CGDMouseMove event
if(_emulateRawMode)
nelEvent = new NLMISC::CGDMouseMove(
this, NULL /* no mouse device */, event.deltaX, -event.deltaY);
// normally send position in a CEventMouseMove
else
nelEvent = new NLMISC::CEventMouseMove(
mousePos.x, mousePos.y, (NLMISC::TMouseButton)modifiers, this);
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, (NLMISC::TMouseButton)modifiers, this);
server->postEvent(nelEvent);
break;
@ -336,15 +314,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
{
NLMISC::CEvent* nelEvent;
// when emulating raw mode, send the delta in a CGDMouseMove event
if(_emulateRawMode)
nelEvent = new NLMISC::CGDMouseMove(
this, NULL /* no mouse device */, event.deltaX, -event.deltaY);
// normally send position in a CEventMouseMove
else
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y,
(NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this);
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), this);
server->postEvent(nelEvent);
break;
@ -353,15 +323,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
{
NLMISC::CEvent* nelEvent;
// when emulating raw mode, send the delta in a CGDMouseMove event
if(_emulateRawMode)
nelEvent = new NLMISC::CGDMouseMove(
this, NULL /* no mouse device */, event.deltaX, -event.deltaY);
// normally send position in a CEventMouseMove
else
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y,
(NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), this);
nelEvent = new NLMISC::CEventMouseMove(mousePos.x, mousePos.y, (NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), this);
server->postEvent(nelEvent);
break;
@ -434,12 +396,6 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
}
}
if(_emulateRawMode && _driver && (event.type == NSMouseMoved ||
event.type == NSLeftMouseDragged || event.type == NSRightMouseDragged))
{
_driver->setMousePos(0.5, 0.5);
}
return true;
}
@ -492,17 +448,4 @@ void CCocoaEventEmitter::submitEvents(CEventServer& server, bool /* allWins */)
_server = &server;
}
void CCocoaEventEmitter::emulateMouseRawMode(bool enable)
{
_emulateRawMode = enable;
if(_emulateRawMode)
{
_setToEmulateRawMode = true;
if(_driver)
_driver->setMousePos(0.5, 0.5);
}
}
}

@ -31,8 +31,6 @@ namespace NLMISC
class CCocoaEventEmitter : public IEventEmitter
{
bool _emulateRawMode;
bool _setToEmulateRawMode;
bool _eventLoop;
NL3D::IDriver* _driver;
CocoaOpenGLView* _glView;
@ -42,8 +40,6 @@ class CCocoaEventEmitter : public IEventEmitter
public:
CCocoaEventEmitter() :
_emulateRawMode(false),
_setToEmulateRawMode(false),
_driver(NULL),
_glView(nil),
_server(NULL) { }

@ -100,7 +100,6 @@ private:
std::map<TKey, bool> _PressedKeys;
XIM _im;
XIC _ic;
bool _emulateRawMode;
NL3D::IDriver* _driver;
CUnixEventServer _InternalServer;
ucstring _CopiedString;

@ -109,10 +109,6 @@ void UDriver::purgeMemory()
// ***************************************************************************
// ***************************************************************************
bool CDriverUser::_StaticInit= false;
// ***************************************************************************
CDriverUser::CDriverUser (uintptr_t windowIcon, TDriver driver, emptyProc exitFunc)
{
@ -122,16 +118,7 @@ CDriverUser::CDriverUser (uintptr_t windowIcon, TDriver driver, emptyProc exitFu
nlassert((uint)IDriver::iconCount == (uint)UDriver::iconCount);
// Static Initialisation.
if(!_StaticInit)
{
_StaticInit= true;
// Register basic serial.
NL3D::registerSerial3d();
// Register basic csene.
CScene::registerBasics();
}
NL3D::init3d();
_Driver = NULL;

@ -31,6 +31,7 @@ using namespace std;
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_SYNTHESIS_H
// for freetype 2.0
#ifdef FTERRORS_H
@ -171,7 +172,7 @@ void CFontGenerator::getSizes (ucchar c, uint32 size, uint32 &width, uint32 &hei
height = _Face->glyph->metrics.height >> 6;
}
uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex)
uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, bool embolden, bool oblique, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex)
{
FT_Error error;
@ -209,6 +210,16 @@ uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, uint32 &width, uint32 &
return NULL;
}
if (embolden)
{
FT_GlyphSlot_Embolden(_Face->glyph);
}
if (oblique)
{
FT_GlyphSlot_Oblique(_Face->glyph);
}
// convert to an anti-aliased bitmap
error = FT_Render_Glyph (_Face->glyph, ft_render_mode_normal);
if (error)
@ -389,7 +400,7 @@ void CFontGenerator::getSizes (ucchar c, uint32 size, uint32 &width, uint32 &hei
HFONT hFont = NULL;
uint32 CurrentFontSize = 0;
uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex)
uint8 *CFontGenerator::getBitmap (ucchar c, uint32 size, bool embolden, bool oblique, uint32 &width, uint32 &height, uint32 &pitch, sint32 &left, sint32 &top, sint32 &advx, uint32 &glyphIndex)
{
/* FT_Error error;

@ -64,6 +64,8 @@ void CFontManager::computeString (const std::string &s,
CFontGenerator *fontGen,
const NLMISC::CRGBA &color,
uint32 fontSize,
bool embolden,
bool oblique,
IDriver *driver,
CComputedString &output,
bool keep800x600Ratio)
@ -71,7 +73,7 @@ void CFontManager::computeString (const std::string &s,
// static to avoid reallocation
static ucstring ucs;
ucs= s;
computeString(ucs, fontGen, color, fontSize, driver, output, keep800x600Ratio);
computeString(ucs, fontGen, color, fontSize, embolden, oblique, driver, output, keep800x600Ratio);
}
@ -80,6 +82,8 @@ void CFontManager::computeString (const ucstring &s,
CFontGenerator *fontGen,
const NLMISC::CRGBA &color,
uint32 fontSize,
bool embolden,
bool oblique,
IDriver *driver,
CComputedString &output,
bool keep800x600Ratio)
@ -147,6 +151,8 @@ void CFontManager::computeString (const ucstring &s,
k.Char = s[i];
k.FontGenerator = fontGen;
k.Size = fontSize;
k.Embolden = embolden;
k.Oblique = oblique;
CTextureFont::SLetterInfo *pLI = pTexFont->getLetterInfo (k);
if(pLI != NULL)
{
@ -227,6 +233,8 @@ void CFontManager::computeStringInfo ( const ucstring &s,
CFontGenerator *fontGen,
const NLMISC::CRGBA &color,
uint32 fontSize,
bool embolden,
bool oblique,
IDriver *driver,
CComputedString &output,
bool keep800x600Ratio )
@ -259,6 +267,8 @@ void CFontManager::computeStringInfo ( const ucstring &s,
k.Char = s[i];
k.FontGenerator = fontGen;
k.Size = fontSize;
k.Embolden = embolden;
k.Oblique = oblique;
pLI = pTexFont->getLetterInfo (k);
if(pLI != NULL)
{

@ -19,19 +19,35 @@
#include "nel/3d/init_3d.h"
#include <cfloat>
#include "nel/3d/scene.h"
#include "nel/3d/register_3d.h"
namespace
{
static bool _Initialized = false;
}
namespace NL3D
{
void init3d ()
{
if( _Initialized )
return;
// Init for windows
#ifdef NL_OS_WINDOWS
// Enable FPU exceptions
// Enable divid by zero and overflow exception
_control87 (_EM_INVALID|_EM_DENORMAL/*|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM);
//_control87 (_EM_INVALID|_EM_DENORMAL/*|_EM_ZERODIVIDE|_EM_OVERFLOW*/|_EM_UNDERFLOW|_EM_INEXACT, _MCW_EM);
#endif // NL_OS_WINDOWS
NL3D::registerSerial3d();
CScene::registerBasics();
_Initialized = true;
}
} // NL3D

@ -583,7 +583,6 @@ void CLandscape::setDriver(IDriver *drv)
// Does the driver has sufficient requirements for Vegetable???
// only if VP supported by GPU, and Only if max vertices allowed.
_DriverOkForVegetable = _VertexShaderOk && (_Driver->getMaxVerticesByVertexBufferHard()>=(uint)NL3D_LANDSCAPE_VEGETABLE_MAX_AGP_VERTEX_MAX);
}
}

@ -611,7 +611,6 @@ void CLandscapeVBAllocator::setupVBFormatAndVertexProgram(bool withVertexProgr
nlverify(_Driver->compileVertexProgram(_VertexProgram[1]));
}
}
}

@ -392,7 +392,6 @@ bool CMeshVPWindTree::begin(IDriver *driver, CScene *scene, CMeshBaseInstance *m
sint numPls= renderTrav->getNumVPLights()-1;
clamp(numPls, 0, CRenderTrav::MaxVPLight-1);
// Enable normalize only if requested by user. Because lighting don't manage correct "scale lighting"
uint idVP= (SpecularLighting?2:0) + (driver->isForceNormalize()?1:0) ;
// correct VP id for correct unmber of pls.
@ -523,7 +522,7 @@ void CMeshVPWindTree::beginMBRInstance(IDriver *driver, CScene *scene, CMeshBase
idVP = numPls*4 + idVP;
// re-activate VP if idVP different from last setup
if(idVP != _LastMBRIdVP)
if (idVP != _LastMBRIdVP)
{
_LastMBRIdVP= idVP;
driver->activeVertexProgram(_VertexProgram[_LastMBRIdVP]);

@ -277,6 +277,8 @@ void CPSUtil::print(IDriver *driver, const std::string &text, CFontGenerator &fg
&fg,
col,
16,
false,
false,
driver,
cptedString);

@ -158,7 +158,7 @@ CScene::CScene(bool bSmallScene) : LightTrav(bSmallScene)
_MaxSkeletonsInNotCLodForm= 20;
_FilterRenderFlags= std::numeric_limits<uint32>::max();
_FilterRenderFlags = std::numeric_limits<uint32>::max();
_NextRenderProfile= false;
@ -592,11 +592,9 @@ void CScene::renderPart(UScene::TRenderPart rp, bool doHrcPass, bool doTrav, boo
//
nlassert(CurrentCamera);
// update models.
updateModels();
// Use the camera to setup Clip / Render pass.
float left, right, bottom, top, znear, zfar;
CurrentCamera->getFrustum(left, right, bottom, top, znear, zfar);

@ -244,7 +244,7 @@ void CShadowMapManager::addShadowReceiver(CTransform *model)
void CShadowMapManager::renderGenerate(CScene *scene)
{
H_AUTO( NL3D_ShadowManager_Generate );
// Each frame, do a small garbage collector for unused free textures.
garbageShadowTextures(scene);

@ -31,6 +31,8 @@ CTextContext::CTextContext()
_FontGen = NULL;
_FontSize = 12;
_Embolden = false;
_Oblique = false;
_Color = NLMISC::CRGBA(0,0,0);
@ -81,7 +83,7 @@ uint32 CTextContext::textPush (const char *format, ...)
// compute the string.
uint32 index = _CacheFreePlaces[_CacheNbFreePlaces-1];
CComputedString &strToFill = _CacheStrings[index];
_FontManager->computeString (str, _FontGen, _Color, _FontSize, _Driver, strToFill, _Keep800x600Ratio);
_FontManager->computeString (str, _FontGen, _Color, _FontSize, _Embolden, _Oblique, _Driver, strToFill, _Keep800x600Ratio);
_CacheNbFreePlaces--;
@ -109,7 +111,7 @@ uint32 CTextContext::textPush (const ucstring &str)
nlassert (index < _CacheStrings.size());
CComputedString &strToFill = _CacheStrings[index];
_FontManager->computeString (str, _FontGen, _Color
, _FontSize, _Driver, strToFill, _Keep800x600Ratio);
, _FontSize, _Embolden, _Oblique, _Driver, strToFill, _Keep800x600Ratio);
_CacheNbFreePlaces--;

@ -100,6 +100,30 @@ uint32 CTextContextUser::getFontSize() const
return _TextContext.getFontSize();
}
void CTextContextUser::setEmbolden(bool b)
{
H_AUTO2;
_TextContext.setEmbolden(b);
}
bool CTextContextUser::getEmbolden() const
{
H_AUTO2;
return _TextContext.getEmbolden();
}
void CTextContextUser::setOblique(bool b)
{
H_AUTO2;
_TextContext.setOblique(b);
}
bool CTextContextUser::getOblique() const
{
H_AUTO2;
return _TextContext.getOblique();
}
void CTextContextUser::setHotSpot(THotSpot hotSpot)
{
H_AUTO2;

@ -47,11 +47,14 @@ const int NbLine[TEXTUREFONT_NBCATEGORY] = { 4, 6, 4, 1 }; // Based on textsize
// ---------------------------------------------------------------------------
inline uint32 CTextureFont::SLetterKey::getVal()
{
// this limits Size to 6bits
// Large sizes already render wrong when many
// different glyphs are used due to limited texture atlas
uint8 eb = ((uint)Embolden) + ((uint)Oblique << 1);
if (FontGenerator == NULL)
return Char + ((Size&255)<<16);
return Char + ((Size&255)<<16) + (eb << 22);
else
return Char + ((Size&255)<<16) + ((FontGenerator->getUID()&0xFF)<<24);
return Char + ((Size&255)<<16) + (eb << 22) + ((FontGenerator->getUID()&0xFF)<<24);
}
// ---------------------------------------------------------------------------
@ -86,6 +89,8 @@ CTextureFont::CTextureFont()
rLetter.Char = 0xffff;
rLetter.FontGenerator = NULL;
rLetter.Size= 0;
rLetter.Embolden = false;
rLetter.Oblique = false;
// The less recently used infos
if (j < Letters[i].size()-1)
@ -164,7 +169,7 @@ void CTextureFont::rebuildLetter (sint cat, sint x, sint y)
sint posy = catTopY + y * Categories[cat];
uint32 pitch = 0;
uint8 *bitmap = rLetter.FontGenerator->getBitmap ( rLetter.Char, rLetter.Size,
uint8 *bitmap = rLetter.FontGenerator->getBitmap ( rLetter.Char, rLetter.Size, rLetter.Embolden, rLetter.Oblique,
rLetter.CharWidth, rLetter.CharHeight,
pitch, rLetter.Left, rLetter.Top,
rLetter.AdvX, rLetter.GlyphIndex );
@ -303,7 +308,7 @@ CTextureFont::SLetterInfo* CTextureFont::getLetterInfo (SLetterKey& k)
// \todo mat : Temp !!! Try to use freetype cache
uint32 nPitch, nGlyphIndex;
sint32 nLeft, nTop, nAdvX;
k.FontGenerator->getBitmap (k.Char, k.Size, width, height, nPitch, nLeft, nTop,
k.FontGenerator->getBitmap (k.Char, k.Size, k.Embolden, k.Oblique, width, height, nPitch, nLeft, nTop,
nAdvX, nGlyphIndex );
// Add 1 pixel space for black border to get correct category
@ -323,6 +328,8 @@ CTextureFont::SLetterInfo* CTextureFont::getLetterInfo (SLetterKey& k)
k2.Char = Back[cat]->Char;
k2.FontGenerator = Back[cat]->FontGenerator;
k2.Size = Back[cat]->Size;
k2.Embolden = Back[cat]->Embolden;
k2.Oblique = Back[cat]->Oblique;
itAccel = Accel.find (k2.getVal());
if (itAccel != Accel.end())
@ -336,6 +343,8 @@ CTextureFont::SLetterInfo* CTextureFont::getLetterInfo (SLetterKey& k)
Back[cat]->Char = k.Char;
Back[cat]->FontGenerator = k.FontGenerator;
Back[cat]->Size = k.Size;
Back[cat]->Embolden = k.Embolden;
Back[cat]->Oblique = k.Oblique;
Back[cat]->CharWidth = width;
Back[cat]->CharHeight = height;
Back[cat]->Top = nTop;

@ -113,7 +113,7 @@ CTransform::CTransform()
_StateFlags= IsOpaque | IsUserLightable;
// By default, always allow rendering of Transform Models.
_RenderFilterType= std::numeric_limits<uint32>::max();
_RenderFilterType = std::numeric_limits<uint32>::max();
// By default, don't suport fast intersection detection
_SupportFastIntersect= false;

@ -17,7 +17,86 @@
#include "std3d.h"
#include "nel/3d/vertex_program_parse.h"
enum TArguments
{
#ifdef NL_LITTLE_ENDIAN
ADD = 1094992928,
ARL = 1095912480,
BFC0 = 1111900976,
BFC1 = 1111900977,
COL0 = 1129270320,
COL1 = 1129270321,
DP3 = 1146106656,
DP4 = 1146106912,
DST = 1146311712,
END = 1162757152,
EXP = 1163415584,
EXPP = 1163415632,
FOGC = 1179600707,
HPOS = 1213222739,
LIT = 1279874080,
LOG = 1280263968,
MAD = 1296122912,
MAX = 1296128032,
MIN = 1296649760,
MOV = 1297045024,
MUL = 1297435680,
NRML = 1314016588,
OPOS = 1330663251,
PSIZ = 1347635546,
RCP = 1380143136,
RSQ = 1381191968,
SGE = 1397179680,
SLT = 1397511200,
TEX0 = 1413830704,
TEX1 = 1413830705,
TEX2 = 1413830706,
TEX3 = 1413830707,
TEX4 = 1413830708,
TEX5 = 1413830709,
TEX6 = 1413830710,
TEX7 = 1413830711,
WGHT = 1464289364,
#else
ADD = 541344833,
ARL = 541872705,
BFC0 = 809715266,
BFC1 = 826492482,
COL0 = 810307395,
COL1 = 827084611,
DP3 = 540233796,
DP4 = 540299332,
DST = 542397252,
END = 541347397,
EXP = 542136389,
EXPP = 1347442757,
FOGC = 1128746822,
HPOS = 1397706824,
LIT = 542394700,
LOG = 541544268,
MAD = 541344077,
MAX = 542654797,
MIN = 542001485,
MOV = 542527309,
MUL = 541873485,
NRML = 1280135758,
OPOS = 1397706831,
PSIZ = 1514754896,
RCP = 542131026,
RSQ = 542200658,
SGE = 541411155,
SLT = 542395475,
TEX0 = 811091284,
TEX1 = 827868500,
TEX2 = 844645716,
TEX3 = 861422932,
TEX4 = 878200148,
TEX5 = 894977364,
TEX6 = 911754580,
TEX7 = 928531796,
WGHT = 1414022999,
#endif
};
//=====================================
bool CVPParser::parseWriteMask(uint &mask, std::string &errorOutput)
@ -256,23 +335,23 @@ bool CVPParser::parseInputRegister(CVPOperand &operand, std::string &errorOutput
strValue |= ((uint32) *_CurrChar) << (8 * (3 - k));
++_CurrChar;
}
switch (strValue)
switch ((TArguments)strValue)
{
case 'OPOS': operand.Value.InputRegisterValue = CVPOperand::IPosition; break;
case 'WGHT': operand.Value.InputRegisterValue = CVPOperand::IWeight; break;
case 'NRML': operand.Value.InputRegisterValue = CVPOperand::INormal; break;
case 'COL0': operand.Value.InputRegisterValue = CVPOperand::IPrimaryColor; break;
case 'COL1': operand.Value.InputRegisterValue = CVPOperand::ISecondaryColor; break;
case 'FOGC': operand.Value.InputRegisterValue = CVPOperand::IFogCoord; break;
case OPOS: operand.Value.InputRegisterValue = CVPOperand::IPosition; break;
case WGHT: operand.Value.InputRegisterValue = CVPOperand::IWeight; break;
case NRML: operand.Value.InputRegisterValue = CVPOperand::INormal; break;
case COL0: operand.Value.InputRegisterValue = CVPOperand::IPrimaryColor; break;
case COL1: operand.Value.InputRegisterValue = CVPOperand::ISecondaryColor; break;
case FOGC: operand.Value.InputRegisterValue = CVPOperand::IFogCoord; break;
// texture argument
case 'TEX0':
case 'TEX1':
case 'TEX2':
case 'TEX3':
case 'TEX4':
case 'TEX5':
case 'TEX6':
case 'TEX7':
case TEX0:
case TEX1:
case TEX2:
case TEX3:
case TEX4:
case TEX5:
case TEX6:
case TEX7:
operand.Value.InputRegisterValue = (CVPOperand::EInputRegister) (((CVPOperand::ITex0 + strValue) & 0xff) - '0');
break;
default:
@ -384,23 +463,23 @@ bool CVPParser::parseOutputRegister(CVPOperand &operand, std::string &errorOutpu
++_CurrChar;
}
// convert to enum
switch(strValue)
switch((TArguments)strValue)
{
case 'HPOS': operand.Value.OutputRegisterValue = CVPOperand::OHPosition; break;
case 'COL0': operand.Value.OutputRegisterValue = CVPOperand::OPrimaryColor; break;
case 'COL1': operand.Value.OutputRegisterValue = CVPOperand::OSecondaryColor; break;
case 'BFC0': operand.Value.OutputRegisterValue = CVPOperand::OBackFacePrimaryColor; break;
case 'BFC1': operand.Value.OutputRegisterValue = CVPOperand::OBackFaceSecondaryColor; break;
case 'FOGC': operand.Value.OutputRegisterValue = CVPOperand::OFogCoord; break;
case 'PSIZ': operand.Value.OutputRegisterValue = CVPOperand::OPointSize; break;
case 'TEX0': operand.Value.OutputRegisterValue = CVPOperand::OTex0; break;
case 'TEX1': operand.Value.OutputRegisterValue = CVPOperand::OTex1; break;
case 'TEX2': operand.Value.OutputRegisterValue = CVPOperand::OTex2; break;
case 'TEX3': operand.Value.OutputRegisterValue = CVPOperand::OTex3; break;
case 'TEX4': operand.Value.OutputRegisterValue = CVPOperand::OTex4; break;
case 'TEX5': operand.Value.OutputRegisterValue = CVPOperand::OTex5; break;
case 'TEX6': operand.Value.OutputRegisterValue = CVPOperand::OTex6; break;
case 'TEX7': operand.Value.OutputRegisterValue = CVPOperand::OTex7; break;
case HPOS: operand.Value.OutputRegisterValue = CVPOperand::OHPosition; break;
case COL0: operand.Value.OutputRegisterValue = CVPOperand::OPrimaryColor; break;
case COL1: operand.Value.OutputRegisterValue = CVPOperand::OSecondaryColor; break;
case BFC0: operand.Value.OutputRegisterValue = CVPOperand::OBackFacePrimaryColor; break;
case BFC1: operand.Value.OutputRegisterValue = CVPOperand::OBackFaceSecondaryColor; break;
case FOGC: operand.Value.OutputRegisterValue = CVPOperand::OFogCoord; break;
case PSIZ: operand.Value.OutputRegisterValue = CVPOperand::OPointSize; break;
case TEX0: operand.Value.OutputRegisterValue = CVPOperand::OTex0; break;
case TEX1: operand.Value.OutputRegisterValue = CVPOperand::OTex1; break;
case TEX2: operand.Value.OutputRegisterValue = CVPOperand::OTex2; break;
case TEX3: operand.Value.OutputRegisterValue = CVPOperand::OTex3; break;
case TEX4: operand.Value.OutputRegisterValue = CVPOperand::OTex4; break;
case TEX5: operand.Value.OutputRegisterValue = CVPOperand::OTex5; break;
case TEX6: operand.Value.OutputRegisterValue = CVPOperand::OTex6; break;
case TEX7: operand.Value.OutputRegisterValue = CVPOperand::OTex7; break;
default:
errorOutput = "Can't read index for output register.";
return false;
@ -753,9 +832,9 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
{
instrStr |= (uint32) ' ';
}
switch (instrStr)
switch ((TArguments)instrStr)
{
case 'ARL ':
case ARL:
instr.Opcode = CVPInstruction::ARL;
if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar())
@ -764,7 +843,7 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
return false;
}
break;
case 'RSQ ':
case RSQ:
instr.Opcode = CVPInstruction::RSQ;
if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar())
@ -773,8 +852,8 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
return false;
}
break;
case 'EXP ':
case 'EXPP':
case EXP:
case EXPP:
instr.Opcode = CVPInstruction::EXPP;
if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar())
@ -789,7 +868,7 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
return false;
}*/
break;
case 'LOG ':
case LOG:
instr.Opcode = CVPInstruction::LOG;
if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar())
@ -805,7 +884,7 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
}
*/
break;
case 'RCP ':
case RCP:
instr.Opcode = CVPInstruction::RCP;
if (!parseOp2(instr, errorOutput)) return false;
if (!instr.Src1.Swizzle.isScalar())
@ -815,60 +894,60 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput
}
break;
/////////////////
case 'MOV ':
case MOV:
instr.Opcode = CVPInstruction::MOV;
if (!parseOp2(instr, errorOutput)) return false;
break;
case 'LIT ':
case LIT:
instr.Opcode = CVPInstruction::LIT;
if (!parseOp2(instr, errorOutput)) return false;
break;
/////////////////
case 'MAD ':
case MAD:
instr.Opcode = CVPInstruction::MAD;
if (!parseOp4(instr, errorOutput)) return false;
break;
/////////////////
case 'ADD ':
case ADD:
instr.Opcode = CVPInstruction::ADD;
if (!parseOp3(instr, errorOutput)) return false;
break;
/////////////////
case 'MUL ':
case MUL:
instr.Opcode = CVPInstruction::MUL;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'DP3 ':
case DP3:
instr.Opcode = CVPInstruction::DP3;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'DP4 ':
case DP4:
instr.Opcode = CVPInstruction::DP4;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'DST ':
case DST:
instr.Opcode = CVPInstruction::DST;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'MIN ':
case MIN:
instr.Opcode = CVPInstruction::MIN;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'MAX ':
case MAX:
instr.Opcode = CVPInstruction::MAX;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'SLT ':
case SLT:
instr.Opcode = CVPInstruction::SLT;
if (!parseOp3(instr, errorOutput)) return false;
break;
case 'SGE ':
case SGE:
instr.Opcode = CVPInstruction::SGE;
if (!parseOp3(instr, errorOutput)) return false;
break;
/////////////////
case 'END ':
case END:
endEncountered = true;
return true;
break;

@ -44,19 +44,19 @@ NLMISC_COMMAND(setWaterPool, "Setup a pool of water in the water pool manager",
}
if (numArgs == 3)
{
whmb.FilterWeight = ::atof(args[2].c_str());
NLMISC::fromString(args[2], whmb.FilterWeight);
}
if (numArgs == 4)
{
whmb.UnitSize = ::atof(args[3].c_str());
NLMISC::fromString(args[3], whmb.UnitSize);
}
if (numArgs == 5)
{
whmb.WaveIntensity = ::atof(args[4].c_str());
NLMISC::fromString(args[4], whmb.WaveIntensity);
}
if (numArgs == 4)
{
whmb.WavePeriod = ::atof(args[5].c_str());
NLMISC::fromString(args[5], whmb.WavePeriod);
}
// create the water pool
GetWaterPoolManager().createWaterPool(whmb);

@ -73,7 +73,7 @@ pair<string, uint32> CZoneSearch::getZoneName(uint x, uint y, uint cx, uint cy)
sprintf(name, "%d_%c%c.zonel", zoneY, firstLetter, secondLetter);
return make_pair<string, uint32>(string(name), distance);
return std::pair<string, uint32>(string(name), distance);
}

@ -707,7 +707,7 @@ bool CFormDfn::getEntryIndexByName (uint &entry, const std::string &name) const
}
entryIndex++;
}
entry=std::numeric_limits<uint>::max();
entry = std::numeric_limits<uint>::max();
return false;
}

@ -231,7 +231,7 @@ bool CFormElm::isAtom () const
const CType* CFormElm::getType ()
{
warning (false, "getType", "This node is not an atom.");
return 0;
return NULL;
}
// ***************************************************************************

@ -6,7 +6,7 @@ SOURCE_GROUP("src" FILES ${SRC})
NL_TARGET_LIB(nelgui ${SRC} ${HEADERS})
INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${LIBWWW_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${LIBWWW_INCLUDE_DIR} ${CURL_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(nelgui nelmisc nel3d ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBWWW_LIBRARIES} ${CURL_LIBRARIES})
SET_TARGET_PROPERTIES(nelgui PROPERTIES LINK_INTERFACE_LIBRARIES "")

@ -701,6 +701,11 @@ namespace NLGUI
//pIM->submitEvent ("button_click:"+getId());
}
*/
// top-right corner is EventX=0, EventY=0
_EventX = eventDesc.getX() - _XReal;
_EventY = (_YReal + _HReal) - eventDesc.getY();
runLeftClickAction();
if (CWidgetManager::getInstance()->getCapturePointerLeft() == NULL) return true; // event handler may release cpature from this object (if it is removed for example)

@ -519,17 +519,17 @@ namespace NLGUI
// Read Action handlers
prop = (char*) xmlGetProp( node, (xmlChar*)"onscroll" );
if (prop) _AHOnScroll = NLMISC::strlwr(prop);
if (prop) _AHOnScroll = NLMISC::strlwr(prop.str());
prop = (char*) xmlGetProp( node, (xmlChar*)"params" );
if (prop) _AHOnScrollParams = string((const char*)prop);
//
prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollend" );
if (prop) _AHOnScrollEnd = NLMISC::strlwr(prop);
if (prop) _AHOnScrollEnd = NLMISC::strlwr(prop.str());
prop = (char*) xmlGetProp( node, (xmlChar*)"end_params" );
if (prop) _AHOnScrollEndParams = string((const char*)prop);
//
prop = (char*) xmlGetProp( node, (xmlChar*)"onscrollcancel" );
if (prop) _AHOnScrollCancel = NLMISC::strlwr(prop);
if (prop) _AHOnScrollCancel = NLMISC::strlwr(prop.str());
prop = (char*) xmlGetProp( node, (xmlChar*)"cancel_params" );
if (prop) _AHOnScrollCancelParams = string((const char*)prop);
@ -538,9 +538,9 @@ namespace NLGUI
prop = (char*) xmlGetProp( node, (xmlChar*)"target" );
if (prop)
{
CInterfaceGroup *group = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(prop));
CInterfaceGroup *group = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(prop.str()));
if(group == NULL)
group = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(this->getId(), prop));
group = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(this->getId(), prop.str()));
if(group != NULL)
setTarget (group);

@ -868,6 +868,15 @@ namespace NLGUI
}
}
// ***************************************************************************
void CCtrlTextButton::checkCoords()
{
if( _ViewText != NULL )
_ViewText->checkCoords();
CCtrlBaseButton::checkCoords();
}
// ***************************************************************************
void CCtrlTextButton::updateCoords()

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

Loading…
Cancel
Save