mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 09:36:15 +00:00
merge from default
--HG-- branch : gsoc2011-kerozcak
This commit is contained in:
commit
87fed6cd85
576 changed files with 16127 additions and 2824 deletions
|
@ -41,10 +41,6 @@ INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
|
|||
# Force out of source builds.
|
||||
CHECK_OUT_OF_SOURCE()
|
||||
|
||||
# Variables which must be set before PROJECT
|
||||
NL_SETUP_BUILD()
|
||||
NL_SETUP_BUILD_FLAGS()
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
PROJECT(RyzomCore CXX C)
|
||||
SET(NL_VERSION_MAJOR 0)
|
||||
|
@ -52,6 +48,9 @@ SET(NL_VERSION_MINOR 8)
|
|||
SET(NL_VERSION_PATCH 0)
|
||||
SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}")
|
||||
|
||||
NL_SETUP_BUILD()
|
||||
NL_SETUP_BUILD_FLAGS()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Redirect output files
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
@ -91,20 +90,11 @@ NL_CONFIGURE_CHECKS()
|
|||
#-----------------------------------------------------------------------------
|
||||
#Platform specifics
|
||||
|
||||
SETUP_EXTERNAL()
|
||||
|
||||
IF(WIN32)
|
||||
INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
|
||||
SET(WINSOCK2_LIB ws2_32.lib)
|
||||
|
||||
FIND_PACKAGE(External REQUIRED)
|
||||
|
||||
IF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
|
||||
# convert IDE fullpath to VC++ path
|
||||
STRING(REGEX REPLACE "Common7/IDE/.+" "VC" VC_DIR ${CMAKE_MAKE_PROGRAM})
|
||||
ELSE(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
|
||||
# convert compiler fullpath to VC++ path
|
||||
STRING(REGEX REPLACE "VC/bin/.+" "VC" VC_DIR ${CMAKE_CXX_COMPILER})
|
||||
ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
|
||||
|
||||
IF(WITH_MFC)
|
||||
FIND_PACKAGE(CustomMFC REQUIRED)
|
||||
ENDIF(WITH_MFC)
|
||||
|
@ -119,20 +109,15 @@ IF(WITH_STATIC)
|
|||
# libxml2 could need winsock2 library
|
||||
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
|
||||
|
||||
# on Mac OS X libxml2 requieres iconv
|
||||
IF(APPLE)
|
||||
FIND_PACKAGE(Iconv REQUIRED)
|
||||
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
|
||||
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
|
||||
ENDIF(APPLE)
|
||||
ENDIF(WITH_STATIC)
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
FIND_PACKAGE(STLport REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR})
|
||||
IF(WIN32)
|
||||
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
|
||||
|
||||
FIND_PACKAGE(WindowsSDK REQUIRED)
|
||||
# use VC++ and Windows SDK include paths
|
||||
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR})
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake)
|
||||
|
||||
IF(FINAL_VERSION)
|
||||
|
|
|
@ -47,6 +47,10 @@ MACRO(NL_CONFIGURE_CHECKS)
|
|||
IF(WITH_DRIVER_OPENGL)
|
||||
SET(NL_OPENGL_AVAILABLE 1)
|
||||
ENDIF(WITH_DRIVER_OPENGL)
|
||||
|
||||
IF(WITH_DRIVER_OPENGLES)
|
||||
SET(NL_OPENGLES_AVAILABLE 1)
|
||||
ENDIF(WITH_DRIVER_OPENGLES)
|
||||
|
||||
IF(WITH_DRIVER_DIRECT3D)
|
||||
SET(NL_DIRECT3D_AVAILABLE 1)
|
||||
|
|
|
@ -40,17 +40,12 @@ ENDIF(WITH_STLPORT OR NOT MFC_FOUND)
|
|||
|
||||
# Only if using a custom path
|
||||
IF(CUSTOM_MFC_DIR)
|
||||
IF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
INCLUDE (CheckTypeSize)
|
||||
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
|
||||
ENDIF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# Using 32 or 64 bits libraries
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
IF(TARGET_X64)
|
||||
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
|
||||
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
ELSE(TARGET_X64)
|
||||
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
|
||||
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
ENDIF(TARGET_X64)
|
||||
|
||||
# Add MFC libraries directory to default library path
|
||||
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
|
||||
|
|
|
@ -30,16 +30,11 @@ ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
|
|||
IF(DXSDK_DIR)
|
||||
SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include")
|
||||
|
||||
IF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
INCLUDE (CheckTypeSize)
|
||||
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
|
||||
ENDIF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
IF(TARGET_X64)
|
||||
SET(DXSDK_LIBRARY_DIR "${DXSDK_DIR}/Lib/x64")
|
||||
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
ELSE(TARGET_X64)
|
||||
SET(DXSDK_LIBRARY_DIR "${DXSDK_DIR}/Lib/x86")
|
||||
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
ENDIF(TARGET_X64)
|
||||
|
||||
FIND_DXSDK_LIBRARY(DXSDK_GUID_LIBRARY dxguid)
|
||||
FIND_DXSDK_LIBRARY(DXSDK_DINPUT_LIBRARY dinput8)
|
||||
|
@ -59,7 +54,7 @@ ENDIF(DXSDK_DIR)
|
|||
# all listed variables are TRUE.
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DIRECTXSDK DEFAULT_MSG DXSDK_DIR DXSDK_GUID_LIBRARY DXSDK_DINPUT_LIBRARY)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectXSDK DEFAULT_MSG DXSDK_DIR DXSDK_GUID_LIBRARY DXSDK_DINPUT_LIBRARY)
|
||||
|
||||
MARK_AS_ADVANCED(DXSDK_INCLUDE_DIR
|
||||
DXSDK_GUID_LIBRARY
|
||||
|
|
|
@ -3,11 +3,12 @@
|
|||
# The following values are defined
|
||||
# EXTERNAL_PATH - where to find external
|
||||
# EXTERNAL_INCLUDE_PATH - where to find external includes
|
||||
# EXTERNAL_BINARY_PATH - where to find external binaries
|
||||
# EXTERNAL_LIBRARY_PATH - where to find external libraries
|
||||
# EXTERNAL_FOUND - True if the external libraries are available
|
||||
|
||||
SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH})
|
||||
SET(EXTERNAL_TEMP_FILE "include/png.h")
|
||||
SET(EXTERNAL_TEMP_FILE "include/zlib.h")
|
||||
SET(EXTERNAL_NAME "external")
|
||||
|
||||
# If using STLport preprend external_stlport
|
||||
|
@ -17,36 +18,42 @@ IF(WITH_STLPORT)
|
|||
SET(EXTERNAL_NAME "external with STLport")
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
SET(EXTERNAL_FOUND FALSE)
|
||||
FOREACH(ITEM ${EXTERNAL_TEMP_PATH})
|
||||
IF(EXISTS "${ITEM}/${EXTERNAL_TEMP_FILE}" AND NOT EXTERNAL_FOUND)
|
||||
SET(EXTERNAL_FOUND TRUE)
|
||||
# Get absolute path to avoid ..
|
||||
GET_FILENAME_COMPONENT(ITEM ${ITEM} ABSOLUTE)
|
||||
SET(EXTERNAL_PATH ${ITEM} CACHE PATH "" FORCE)
|
||||
ENDIF(EXISTS "${ITEM}/${EXTERNAL_TEMP_FILE}" AND NOT EXTERNAL_FOUND)
|
||||
ENDFOREACH(ITEM ${EXTERNAL_TEMP_PATH})
|
||||
FIND_PATH(EXTERNAL_PATH
|
||||
${EXTERNAL_TEMP_FILE}
|
||||
PATHS
|
||||
$ENV{EXTERNAL_PATH}
|
||||
${EXTERNAL_TEMP_PATH}
|
||||
/usr/local
|
||||
/usr
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
|
||||
IF(EXTERNAL_FOUND)
|
||||
IF(EXTERNAL_PATH)
|
||||
SET(EXTERNAL_FOUND TRUE)
|
||||
SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include")
|
||||
|
||||
IF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
INCLUDE (CheckTypeSize)
|
||||
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
|
||||
ENDIF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# Using 32 or 64 bits binaries
|
||||
IF(TARGET_X64)
|
||||
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64")
|
||||
ELSE(TARGET_X64)
|
||||
SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin")
|
||||
ENDIF(TARGET_X64)
|
||||
|
||||
# Using 32 or 64 bits libraries
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
IF(TARGET_X64)
|
||||
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64")
|
||||
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
ELSE(TARGET_X64)
|
||||
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib")
|
||||
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
ENDIF(TARGET_X64)
|
||||
|
||||
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}")
|
||||
# Stupid hack for FindOpenAL.cmake
|
||||
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}")
|
||||
SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}")
|
||||
ENDIF(EXTERNAL_FOUND)
|
||||
ENDIF(EXTERNAL_PATH)
|
||||
|
||||
IF(EXTERNAL_FOUND)
|
||||
IF(NOT External_FIND_QUIETLY)
|
||||
|
@ -62,4 +69,4 @@ ELSE(EXTERNAL_FOUND)
|
|||
ENDIF(External_FIND_REQUIRED)
|
||||
ENDIF(EXTERNAL_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_LIBRARY_PATH)
|
||||
MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_BINARY_PATH EXTERNAL_LIBRARY_PATH)
|
||||
|
|
83
code/CMakeModules/FindIconv.cmake
Normal file
83
code/CMakeModules/FindIconv.cmake
Normal file
|
@ -0,0 +1,83 @@
|
|||
# - Try to find Iconv on Mac OS X
|
||||
# Once done this will define
|
||||
#
|
||||
# ICONV_FOUND - system has Iconv
|
||||
# ICONV_INCLUDE_DIR - the Iconv include directory
|
||||
# ICONV_LIBRARIES - Link these to use Iconv
|
||||
# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
|
||||
#
|
||||
|
||||
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)
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
|
||||
# in cache already
|
||||
SET(LUABIND_FIND_QUIETLY TRUE)
|
||||
SET(Luabind_FIND_QUIETLY TRUE)
|
||||
ENDIF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
|
||||
|
||||
FIND_PATH(LUABIND_INCLUDE_DIR
|
||||
|
@ -22,7 +22,7 @@ FIND_PATH(LUABIND_INCLUDE_DIR
|
|||
)
|
||||
|
||||
SET(LIBRARY_NAME_RELEASE luabind libluabind)
|
||||
SET(LIBRARY_NAME_DEBUG luabind_d libluabind_d libluabindd)
|
||||
SET(LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd)
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
SET(LIBRARY_NAME_RELEASE luabind_stlport ${LIBRARY_NAME_RELEASE})
|
||||
|
@ -62,30 +62,35 @@ FIND_LIBRARY(LUABIND_LIBRARY_DEBUG
|
|||
FIND_PACKAGE(Boost REQUIRED)
|
||||
|
||||
IF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
|
||||
IF(LUABIND_LIBRARY_RELEASE)
|
||||
IF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
|
||||
# Case where both Release and Debug versions are provided
|
||||
SET(LUABIND_FOUND TRUE)
|
||||
SET(LUABIND_INCLUDE_DIR ${LUABIND_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
|
||||
IF(LUABIND_LIBRARY_DEBUG)
|
||||
SET(LUABIND_LIBRARIES "optimized;${LUABIND_LIBRARY_RELEASE};debug;${LUABIND_LIBRARY_DEBUG}")
|
||||
ELSE(LUABIND_LIBRARY_DEBUG)
|
||||
SET(LUABIND_LIBRARIES "${LUABIND_LIBRARY_RELEASE}")
|
||||
ENDIF(LUABIND_LIBRARY_DEBUG)
|
||||
ENDIF(LUABIND_LIBRARY_RELEASE)
|
||||
SET(LUABIND_LIBRARIES optimized ${LUABIND_LIBRARY_RELEASE} debug ${LUABIND_LIBRARY_DEBUG})
|
||||
ELSEIF(LUABIND_LIBRARY_RELEASE)
|
||||
# Normal case
|
||||
SET(LUABIND_FOUND TRUE)
|
||||
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_RELEASE})
|
||||
ELSEIF(LUABIND_LIBRARY_DEBUG)
|
||||
# Case where Luabind is compiled from sources (debug version is compiled by default)
|
||||
SET(LUABIND_FOUND TRUE)
|
||||
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_DEBUG})
|
||||
ENDIF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
|
||||
ENDIF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
|
||||
|
||||
IF(LUABIND_FOUND)
|
||||
SET(LUABIND_INCLUDE_DIR ${LUABIND_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
|
||||
# Check if luabind/version.hpp exists
|
||||
FIND_FILE(LUABIND_VERSION_FILE luabind/version.hpp PATHS ${LUABIND_INCLUDE_DIR})
|
||||
IF(LUABIND_VERSION_FILE)
|
||||
SET(LUABIND_DEFINITIONS "-DHAVE_LUABIND_VERSION")
|
||||
ENDIF(LUABIND_VERSION_FILE)
|
||||
IF(NOT LUABIND_FIND_QUIETLY)
|
||||
IF(NOT Luabind_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}")
|
||||
ENDIF(NOT LUABIND_FIND_QUIETLY)
|
||||
ENDIF(NOT Luabind_FIND_QUIETLY)
|
||||
ELSE(LUABIND_FOUND)
|
||||
IF(NOT LUABIND_FIND_QUIETLY)
|
||||
IF(NOT Luabind_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Warning: Unable to find Luabind!")
|
||||
ENDIF(NOT LUABIND_FIND_QUIETLY)
|
||||
ENDIF(NOT Luabind_FIND_QUIETLY)
|
||||
ENDIF(LUABIND_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(LUABIND_LIBRARY_RELEASE LUABIND_LIBRARY_DEBUG Boost_LIB_DIAGNOSTIC_DEFINITIONS)
|
||||
|
|
|
@ -71,9 +71,9 @@ IF(STLPORT_INCLUDE_DIR)
|
|||
IF(STLPORT_LIBRARY_RELEASE)
|
||||
SET(STLPORT_FOUND TRUE)
|
||||
|
||||
SET(STLPORT_LIBRARIES "optimized;${STLPORT_LIBRARY_RELEASE}")
|
||||
SET(STLPORT_LIBRARIES ${STLPORT_LIBRARY_RELEASE})
|
||||
IF(STLPORT_LIBRARY_DEBUG)
|
||||
SET(STLPORT_LIBRARIES "${STLPORT_LIBRARIES};debug;${STLPORT_LIBRARY_DEBUG}")
|
||||
SET(STLPORT_LIBRARIES optimized ${STLPORT_LIBRARIES} debug ${STLPORT_LIBRARY_DEBUG})
|
||||
ENDIF(STLPORT_LIBRARY_DEBUG)
|
||||
ENDIF(STLPORT_LIBRARY_RELEASE)
|
||||
ENDIF(STLPORT_INCLUDE_DIR)
|
||||
|
|
|
@ -9,17 +9,32 @@ IF(WINSDK_INCLUDE_DIR)
|
|||
SET(WINSDK_FIND_QUIETLY TRUE)
|
||||
ENDIF(WINSDK_INCLUDE_DIR)
|
||||
|
||||
GET_FILENAME_COMPONENT(WINSDK71_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;InstallationFolder]" ABSOLUTE CACHE)
|
||||
GET_FILENAME_COMPONENT(WINSDK71_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;ProductVersion]" NAME)
|
||||
|
||||
IF(WINSDK71_DIR)
|
||||
IF(NOT WINSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Windows SDK ${WINSDK71_VERSION} in ${WINSDK71_DIR}")
|
||||
ENDIF(NOT WINSDK_FIND_QUIETLY)
|
||||
ENDIF(WINSDK71_DIR)
|
||||
|
||||
GET_FILENAME_COMPONENT(WINSDKCURRENT_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE)
|
||||
GET_FILENAME_COMPONENT(WINSDKCURRENT_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentVersion]" NAME)
|
||||
|
||||
IF(WINSDKCURRENT_DIR)
|
||||
IF(NOT WINSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Windows SDK ${WINSDKCURRENT_VERSION} in ${WINSDKCURRENT_DIR}")
|
||||
ENDIF(NOT WINSDK_FIND_QUIETLY)
|
||||
ENDIF(WINSDKCURRENT_DIR)
|
||||
|
||||
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
|
||||
PATHS
|
||||
"[HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]/Include"
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]/Include"
|
||||
${WINSDK71_DIR}/Include
|
||||
${WINSDKCURRENT_DIR}/Include
|
||||
)
|
||||
|
||||
IF(WINSDK_INCLUDE_DIR)
|
||||
SET(WINSDK_FOUND TRUE)
|
||||
IF(NOT WINSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Windows SDK.")
|
||||
ENDIF(NOT WINSDK_FIND_QUIETLY)
|
||||
ELSE(WINSDK_INCLUDE_DIR)
|
||||
IF(NOT WINSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
# - Find zlib
|
||||
# Find the native ZLIB includes and library
|
||||
#
|
||||
# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
|
||||
# ZLIB_LIBRARIES - List of libraries when using zlib.
|
||||
# ZLIB_FOUND - True if zlib found.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2001-2009 Kitware, Inc.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file Copyright.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distributed this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
IF (ZLIB_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
SET(ZLIB_FIND_QUIETLY TRUE)
|
||||
ENDIF (ZLIB_INCLUDE_DIR)
|
||||
|
||||
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)
|
||||
|
||||
SET(ZLIB_NAMES z zlib zdll)
|
||||
FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} )
|
||||
MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR )
|
||||
|
||||
# Per-recommendation
|
||||
SET(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}")
|
||||
SET(ZLIB_LIBRARIES "${ZLIB_LIBRARY}")
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS)
|
|
@ -45,8 +45,6 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
|
|||
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
||||
LIST(APPEND ${_out_compile_flags} "-fPIC")
|
||||
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
||||
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
||||
## TODO ... ? or does it work out of the box
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES )
|
||||
|
@ -54,13 +52,23 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
|
|||
LIST(APPEND ${_out_compile_flags} " ${_PCH_include_prefix}\"${item}\"")
|
||||
ENDFOREACH(item)
|
||||
|
||||
# Required for CMake 2.6
|
||||
SET(GLOBAL_DEFINITIONS "")
|
||||
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS -D${item})
|
||||
ENDFOREACH(item)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
GET_DIRECTORY_PROPERTY(_global_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
|
||||
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
|
||||
LIST(APPEND ${_out_compile_flags} ${GLOBAL_DEFINITIONS})
|
||||
LIST(APPEND ${_out_compile_flags} ${_directory_flags})
|
||||
LIST(APPEND ${_out_compile_flags} ${_global_definitions})
|
||||
LIST(APPEND ${_out_compile_flags} ${_directory_definitions})
|
||||
LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS})
|
||||
|
||||
# Format definitions and remove duplicates
|
||||
SEPARATE_ARGUMENTS(${_out_compile_flags})
|
||||
LIST(REMOVE_DUPLICATES ${_out_compile_flags})
|
||||
ENDMACRO(_PCH_GET_COMPILE_FLAGS)
|
||||
|
||||
MACRO(_PCH_GET_PDB_FILENAME out_filename _target)
|
||||
|
@ -115,6 +123,11 @@ MACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input _output)
|
|||
ENDMACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input)
|
||||
|
||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use )
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# to do: test whether compiler flags match between target _targetName
|
||||
# and _pch_output_to_use
|
||||
|
@ -123,19 +136,17 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use )
|
|||
# for use with distcc and gcc >4.0.1 if preprocessed files are accessible
|
||||
# on all remote machines set
|
||||
# PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess
|
||||
SET(_target_cflags "${PCH_ADDITIONAL_COMPILER_FLAGS}-include ${_input} -Winvalid-pch")
|
||||
SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS}-include ${_input} -Winvalid-pch")
|
||||
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
||||
IF(MSVC)
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
||||
|
||||
SET(_target_cflags "${oldProps} /Yu\"${_input}\" /FI\"${_input}\" /Fp\"${_pch_output_to_use}\"")
|
||||
ENDIF(MSVC)
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags})
|
||||
IF(oldProps)
|
||||
SET_TARGET_PROPERTIES(${_targetName}_pch_dephelp PROPERTIES COMPILE_FLAGS ${oldProps})
|
||||
ENDIF(oldProps)
|
||||
ADD_CUSTOM_TARGET(pch_Generate_${_targetName} DEPENDS ${_pch_output_to_use})
|
||||
ADD_DEPENDENCIES(${_targetName} pch_Generate_${_targetName})
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET)
|
||||
|
|
|
@ -37,16 +37,17 @@ ENDMACRO(NL_TARGET_DRIVER)
|
|||
# Argument:
|
||||
###
|
||||
MACRO(NL_DEFAULT_PROPS name label)
|
||||
IF(NOT MSVC10)
|
||||
SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label})
|
||||
ENDIF(NOT MSVC10)
|
||||
GET_TARGET_PROPERTY(type ${name} TYPE)
|
||||
IF(${type} STREQUAL SHARED_LIBRARY)
|
||||
# Set versions only if target is a shared library
|
||||
SET_TARGET_PROPERTIES(${name} PROPERTIES
|
||||
VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR}
|
||||
INSTALL_NAME_DIR ${NL_LIB_PREFIX}
|
||||
PROJECT_LABEL ${label})
|
||||
ELSE(${type} STREQUAL SHARED_LIBRARY)
|
||||
SET_TARGET_PROPERTIES(${name} PROPERTIES
|
||||
PROJECT_LABEL ${label})
|
||||
VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR})
|
||||
IF(NL_LIB_PREFIX)
|
||||
SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX})
|
||||
ENDIF(NL_LIB_PREFIX)
|
||||
ENDIF(${type} STREQUAL SHARED_LIBRARY)
|
||||
IF(WITH_STLPORT AND WIN32)
|
||||
SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X")
|
||||
|
@ -93,6 +94,14 @@ MACRO(NL_ADD_STATIC_VID_DRIVERS name)
|
|||
TARGET_LINK_LIBRARIES(${name} nel_drv_opengl)
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WITH_DRIVER_OPENGL)
|
||||
|
||||
IF(WITH_DRIVER_OPENGLES)
|
||||
IF(WIN32)
|
||||
TARGET_LINK_LIBRARIES(${name} nel_drv_opengles_win)
|
||||
ELSE(WIN32)
|
||||
TARGET_LINK_LIBRARIES(${name} nel_drv_opengles)
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WITH_DRIVER_OPENGLES)
|
||||
ENDIF(WITH_STATIC_DRIVERS)
|
||||
ENDMACRO(NL_ADD_STATIC_VID_DRIVERS)
|
||||
|
||||
|
@ -208,6 +217,7 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
|
|||
# Drivers Support
|
||||
###
|
||||
OPTION(WITH_DRIVER_OPENGL "Build OpenGL Driver (3D)" ON )
|
||||
OPTION(WITH_DRIVER_OPENGLES "Build OpenGL ES Driver (3D)" OFF)
|
||||
OPTION(WITH_DRIVER_DIRECT3D "Build Direct3D Driver (3D)" OFF)
|
||||
OPTION(WITH_DRIVER_OPENAL "Build OpenAL Driver (Sound)" ON )
|
||||
OPTION(WITH_DRIVER_FMOD "Build FMOD Driver (Sound)" OFF)
|
||||
|
@ -278,19 +288,56 @@ MACRO(NL_SETUP_BUILD)
|
|||
ENDIF(CMAKE_BUILD_TYPE MATCHES "Release")
|
||||
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
|
||||
# Determine target CPU
|
||||
# IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||
IF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
INCLUDE (CheckTypeSize)
|
||||
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
|
||||
ENDIF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
|
||||
# Using 32 or 64 bits libraries
|
||||
SET(TARGET_X86 1)
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(ARCH "x86_64")
|
||||
SET(TARGET_X64 1)
|
||||
ADD_DEFINITIONS(-DHAVE_X86_64)
|
||||
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(ARCH "x86")
|
||||
ADD_DEFINITIONS(-DHAVE_X86)
|
||||
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# ADD_DEFINITIONS(-DHAVE_IA64)
|
||||
# ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
|
||||
|
||||
IF(WIN32)
|
||||
# don't use a /O[012x] flag if you want custom optimizations
|
||||
SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-")
|
||||
# without inlining it's unusable, use custom optimizations again
|
||||
SET(MIN_OPTIMIZATIONS "/Ob1")
|
||||
IF(MSVC10)
|
||||
# /Ox is working with VC++ 2010, but custom optimizations don't exist
|
||||
SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-")
|
||||
# without inlining it's unusable, use custom optimizations again
|
||||
SET(MIN_OPTIMIZATIONS "/Od /Ob1")
|
||||
ELSE(MSVC10)
|
||||
# don't use a /O[012x] flag if you want custom optimizations
|
||||
SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-")
|
||||
# without inlining it's unusable, use custom optimizations again
|
||||
SET(MIN_OPTIMIZATIONS "/Ob1")
|
||||
ENDIF(MSVC10)
|
||||
|
||||
SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000")
|
||||
|
||||
# Exceptions are only set for C++
|
||||
SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa")
|
||||
SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-")
|
||||
|
||||
# Common link flags
|
||||
SET(PLATFORM_LINKFLAGS "-DEBUG")
|
||||
|
||||
IF(TARGET_X64)
|
||||
# Fix a bug with Intellisense
|
||||
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64")
|
||||
# Fix a compilation error for some big C++ files
|
||||
SET(MIN_OPTIMIZATIONS "${MIN_OPTIMIZATIONS} /bigobj")
|
||||
ELSE(TARGET_X64)
|
||||
# Allows 32 bits applications to use 3 GB of RAM
|
||||
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE")
|
||||
ENDIF(TARGET_X64)
|
||||
|
||||
# Exceptions are only set for C++
|
||||
SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa")
|
||||
|
||||
SET(NL_DEBUG_CFLAGS "/MDd /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS}")
|
||||
SET(NL_RELEASE_CFLAGS "/MD /D NDEBUG ${SPEED_OPTIMIZATIONS}")
|
||||
|
@ -314,33 +361,10 @@ MACRO(NL_SETUP_BUILD)
|
|||
|
||||
SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -D_DEBUG")
|
||||
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O6")
|
||||
|
||||
ENDIF(WIN32)
|
||||
|
||||
# Determine host CPU
|
||||
IF(UNIX AND NOT WIN32)
|
||||
FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
|
||||
IF(CMAKE_UNAME)
|
||||
EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL "processor type (i386 and x86_64)")
|
||||
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
|
||||
ADD_DEFINITIONS(-DHAVE_X86_64)
|
||||
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64")
|
||||
ADD_DEFINITIONS(-DHAVE_IA64)
|
||||
ELSE(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
|
||||
ADD_DEFINITIONS(-DHAVE_X86)
|
||||
ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
|
||||
ELSE(CMAKE_UNAME) # Assume that if uname is not found that we're x86.
|
||||
ADD_DEFINITIONS(-DHAVE_X86)
|
||||
ENDIF(CMAKE_UNAME)
|
||||
ENDIF(UNIX AND NOT WIN32)
|
||||
|
||||
ENDMACRO(NL_SETUP_BUILD)
|
||||
|
||||
MACRO(NL_SETUP_BUILD_FLAGS)
|
||||
#SET(CMAKE_DEBUG_POSTFIX "_d")
|
||||
#SET(CMAKE_RELEASE_POSTFIX "_r")
|
||||
|
||||
SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE)
|
||||
SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE)
|
||||
|
||||
|
@ -472,3 +496,44 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS)
|
|||
ENDIF(NOT RYZOM_GAMES_PREFIX)
|
||||
|
||||
ENDMACRO(RYZOM_SETUP_PREFIX_PATHS)
|
||||
|
||||
MACRO(SETUP_EXTERNAL)
|
||||
IF(WIN32)
|
||||
FIND_PACKAGE(External REQUIRED)
|
||||
|
||||
INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
|
||||
IF(MSVC10)
|
||||
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0_Config;InstallDir]" ABSOLUTE)
|
||||
# VC_ROOT_DIR is set to "registry" when a key is not found
|
||||
IF(VC_ROOT_DIR MATCHES "registry")
|
||||
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE)
|
||||
IF(VC_ROOT_DIR MATCHES "registry")
|
||||
MESSAGE(FATAL_ERROR "Unable to find VC++ 2010 directory!")
|
||||
ENDIF(VC_ROOT_DIR MATCHES "registry")
|
||||
ENDIF(VC_ROOT_DIR MATCHES "registry")
|
||||
# convert IDE fullpath to VC++ path
|
||||
STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR})
|
||||
ELSE(MSVC10)
|
||||
IF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
|
||||
# convert IDE fullpath to VC++ path
|
||||
STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${CMAKE_MAKE_PROGRAM})
|
||||
ELSE(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
|
||||
# convert compiler fullpath to VC++ path
|
||||
STRING(REGEX REPLACE "VC/bin/.+" "VC" VC_DIR ${CMAKE_CXX_COMPILER})
|
||||
ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
|
||||
ENDIF(MSVC10)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(WITH_STLPORT)
|
||||
FIND_PACKAGE(STLport REQUIRED)
|
||||
INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR})
|
||||
IF(WIN32)
|
||||
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
|
||||
|
||||
FIND_PACKAGE(WindowsSDK REQUIRED)
|
||||
# use VC++ and Windows SDK include paths
|
||||
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR})
|
||||
ENDIF(WIN32)
|
||||
ENDIF(WITH_STLPORT)
|
||||
|
||||
ENDMACRO(SETUP_EXTERNAL)
|
||||
|
|
|
@ -29,4 +29,4 @@ file for for more details on license terms and other legal issues.
|
|||
Installation
|
||||
------------
|
||||
|
||||
Please check the dev.ryzom.com for more information
|
||||
Please visit http://dev.ryzom.com for more information.
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#cmakedefine HAVE_STAT64 1
|
||||
|
||||
#cmakedefine NL_OPENGL_AVAILABLE ${NL_OPENGL_AVAILABLE}
|
||||
#cmakedefine NL_OPENGLES_AVAILABLE ${NL_OPENGLES_AVAILABLE}
|
||||
#cmakedefine NL_DIRECT3D_AVAILABLE ${NL_DIRECT3D_AVAILABLE}
|
||||
|
||||
#cmakedefine NL_FMOD_AVAILABLE ${NL_FMOD_AVAILABLE}
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
bool Visible;
|
||||
|
||||
/// Precomputed Lighting.
|
||||
// If true (false by default), then the instance don't cast shadow (used by ig_lighter.exe).
|
||||
// If true (false by default), then the instance don't cast shadow (used by ig_lighter).
|
||||
bool DontCastShadow;
|
||||
// If true (false by default), then the instance's lighting will not be precomputed.
|
||||
bool AvoidStaticLightPreCompute;
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
* If 0xFF => take Ambient of the sun.
|
||||
*/
|
||||
uint8 LocalAmbientId;
|
||||
/** if true (false by default), the instance don't cast shadow, but ONLY FOR ig_lighter.exe (ig_lighter_lib)
|
||||
/** if true (false by default), the instance don't cast shadow, but ONLY FOR ig_lighter (ig_lighter_lib)
|
||||
* (zone_lighter and zone_ig_lighter ignore it).
|
||||
* This is a special trick for the "Matis Serre" where the exterior mesh cast shadow in the interior, but
|
||||
* is not visible in the interior in realTime because of cluster clipping.... omg :(
|
||||
|
|
|
@ -697,6 +697,7 @@ public:
|
|||
virtual bool addLinearFloatKey(const UKeyLinearFloat &key)
|
||||
{
|
||||
CKeyFloat k;
|
||||
k.OODeltaTime= 0.f;
|
||||
k.Value= key.Value;
|
||||
addKey(k, key.Time);
|
||||
return true;
|
||||
|
|
|
@ -142,11 +142,14 @@ namespace CEGUI
|
|||
|
||||
void captureCursor(bool capture) {
|
||||
m_Captured=capture;
|
||||
if(capture) {
|
||||
if(capture)
|
||||
{
|
||||
m_Driver->setCapture(true);
|
||||
m_Driver->showCursor(false);
|
||||
m_InputDriver.activateMouse();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Driver->setCapture(false);
|
||||
m_Driver->showCursor(true);
|
||||
m_InputDriver.deactivateMouse();
|
||||
|
@ -178,7 +181,8 @@ namespace CEGUI
|
|||
class NeLInputDriver : public NLMISC::IEventListener
|
||||
{
|
||||
public:
|
||||
NeLInputDriver() {
|
||||
NeLInputDriver()
|
||||
{
|
||||
m_MouseX=0.5f;
|
||||
m_MouseY=0.5f;
|
||||
m_Active=false;
|
||||
|
@ -189,7 +193,8 @@ namespace CEGUI
|
|||
}
|
||||
virtual ~NeLInputDriver() { ; }
|
||||
|
||||
void addToServer(NLMISC::CEventServer& server) {
|
||||
void addToServer(NLMISC::CEventServer& server)
|
||||
{
|
||||
server.addListener(NLMISC::EventMouseMoveId, this);
|
||||
server.addListener(NLMISC::EventMouseDownId, this);
|
||||
server.addListener(NLMISC::EventMouseUpId, this);
|
||||
|
@ -200,7 +205,8 @@ namespace CEGUI
|
|||
m_AsyncListener.addToServer(server);
|
||||
}
|
||||
|
||||
void removeFromServer(NLMISC::CEventServer& server) {
|
||||
void removeFromServer(NLMISC::CEventServer& server)
|
||||
{
|
||||
server.removeListener(NLMISC::EventMouseMoveId, this);
|
||||
server.removeListener(NLMISC::EventMouseDownId, this);
|
||||
server.removeListener(NLMISC::EventMouseUpId, this);
|
||||
|
@ -226,9 +232,11 @@ namespace CEGUI
|
|||
*
|
||||
* \param event An event, probably a CEventMouse or CEventKey/Char.
|
||||
*/
|
||||
virtual void operator ()(const NLMISC::CEvent& event) {
|
||||
virtual void operator ()(const NLMISC::CEvent& event)
|
||||
{
|
||||
// don't process any input if we're inactive.
|
||||
if(m_Active==false) {
|
||||
if(m_Active==false)
|
||||
{
|
||||
return; // not processing ANY input
|
||||
}
|
||||
|
||||
|
@ -236,36 +244,51 @@ namespace CEGUI
|
|||
{
|
||||
// otherwise, on with the festivities.
|
||||
// catch ALL mouse event, just in case.
|
||||
if(event==NLMISC::EventMouseDownId||event==NLMISC::EventMouseUpId||event==NLMISC::EventMouseMoveId||event==NLMISC::EventMouseDblClkId||event==NLMISC::EventMouseWheelId) {
|
||||
if(!m_MouseActive) {
|
||||
if(event==NLMISC::EventMouseDownId||event==NLMISC::EventMouseUpId||event==NLMISC::EventMouseMoveId||event==NLMISC::EventMouseDblClkId||event==NLMISC::EventMouseWheelId)
|
||||
{
|
||||
if(!m_MouseActive)
|
||||
{
|
||||
// we're not processing any mouse activity. The cursor isn't captured maybe?
|
||||
return;
|
||||
}
|
||||
|
||||
NLMISC::CEventMouse *mouseEvent=(NLMISC::CEventMouse *)&event;
|
||||
// a mouse button was pressed.
|
||||
if(event == NLMISC::EventMouseDownId) {
|
||||
if(event == NLMISC::EventMouseDownId)
|
||||
{
|
||||
// it was the left button...
|
||||
if (mouseEvent->Button & NLMISC::leftButton) {
|
||||
if (mouseEvent->Button & NLMISC::leftButton)
|
||||
{
|
||||
CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);
|
||||
// it was the right button...
|
||||
} else if (mouseEvent->Button & NLMISC::rightButton) {
|
||||
}
|
||||
else if (mouseEvent->Button & NLMISC::rightButton)
|
||||
{
|
||||
CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::RightButton);
|
||||
} else if (mouseEvent->Button & NLMISC::middleButton) {
|
||||
}
|
||||
else if (mouseEvent->Button & NLMISC::middleButton)
|
||||
{
|
||||
CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::MiddleButton);
|
||||
}
|
||||
// a mouse button was released
|
||||
} else if (event == NLMISC::EventMouseUpId) {
|
||||
}
|
||||
else if (event == NLMISC::EventMouseUpId)
|
||||
{
|
||||
// it was the left button...
|
||||
if(mouseEvent->Button & NLMISC::leftButton) {
|
||||
if(mouseEvent->Button & NLMISC::leftButton)
|
||||
{
|
||||
CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);
|
||||
// it was the right button...
|
||||
} else if (mouseEvent->Button & NLMISC::rightButton) {
|
||||
}
|
||||
else if (mouseEvent->Button & NLMISC::rightButton)
|
||||
{
|
||||
CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::RightButton);
|
||||
} else if (mouseEvent->Button & NLMISC::middleButton) {
|
||||
CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::MiddleButton);
|
||||
}
|
||||
} else if (event == NLMISC::EventMouseMoveId) {
|
||||
}
|
||||
else if (event == NLMISC::EventMouseMoveId)
|
||||
{
|
||||
// convert into screen coordinates.
|
||||
float delta_x=(float)(mouseEvent->X - m_MouseX)*m_Width;
|
||||
float delta_y=(float)((1.0f-mouseEvent->Y) - m_MouseY)*m_Height;
|
||||
|
@ -276,18 +299,26 @@ namespace CEGUI
|
|||
// and save for delta.
|
||||
m_MouseX=mouseEvent->X;
|
||||
m_MouseY=1.0f-mouseEvent->Y;
|
||||
} else if (event == NLMISC::EventMouseWheelId) {
|
||||
}
|
||||
else if (event == NLMISC::EventMouseWheelId)
|
||||
{
|
||||
NLMISC::CEventMouseWheel *ev=(NLMISC::CEventMouseWheel *)&event;
|
||||
float dir=0.0f;
|
||||
if(ev->Direction) dir=0.5f;
|
||||
else dir=-0.5f;
|
||||
CEGUI::System::getSingleton().injectMouseWheelChange(dir);
|
||||
}
|
||||
} else { // assume otherwise that it's a character.
|
||||
if(event==NLMISC::EventCharId) {
|
||||
}
|
||||
else
|
||||
{
|
||||
// assume otherwise that it's a character.
|
||||
if(event==NLMISC::EventCharId)
|
||||
{
|
||||
unsigned char c = (char)((NLMISC::CEventChar&)event).Char;
|
||||
CEGUI::System::getSingleton().injectChar((CEGUI::utf32)c);
|
||||
} else if(event==NLMISC::EventKeyDownId) {
|
||||
}
|
||||
else if(event==NLMISC::EventKeyDownId)
|
||||
{
|
||||
NLMISC::CEventKeyDown *keyvent=(NLMISC::CEventKeyDown *)&event;
|
||||
CEGUI::System::getSingleton().injectKeyDown(m_KeyMap[keyvent->Key]);
|
||||
}
|
||||
|
@ -296,7 +327,8 @@ namespace CEGUI
|
|||
catch (CEGUI::Exception) { }
|
||||
}
|
||||
|
||||
void initKeyMap() {
|
||||
void initKeyMap()
|
||||
{
|
||||
m_KeyMap[NLMISC::Key0 ]=CEGUI::Key::Zero;
|
||||
m_KeyMap[NLMISC::Key1 ]=CEGUI::Key::One;
|
||||
m_KeyMap[NLMISC::Key2 ]=CEGUI::Key::Two;
|
||||
|
|
|
@ -201,7 +201,7 @@ void loadForm (const std::vector<std::string> &sheetFilters, const std::string &
|
|||
ifile.serialCont (container);
|
||||
ifile.close ();
|
||||
}
|
||||
catch (NLMISC::Exception &e)
|
||||
catch (const NLMISC::Exception &e)
|
||||
{
|
||||
// clear the container because it can contains partially loaded sheet so we must clean it before continue
|
||||
container.clear ();
|
||||
|
@ -456,7 +456,7 @@ void loadForm (const std::vector<std::string> &sheetFilters, const std::string &
|
|||
ofile.close ();
|
||||
}
|
||||
}
|
||||
catch (NLMISC::Exception &e)
|
||||
catch (const NLMISC::Exception &e)
|
||||
{
|
||||
nlinfo ("loadForm(): Exception during saving the packed file, it will be recreated next launch (%s)", e.what());
|
||||
}
|
||||
|
@ -564,7 +564,7 @@ void loadForm2(const std::vector<std::string> &sheetFilters, const std::string &
|
|||
ifile.serialPtrCont (container);
|
||||
ifile.close ();
|
||||
}
|
||||
catch (NLMISC::Exception &e)
|
||||
catch (const NLMISC::Exception &e)
|
||||
{
|
||||
// clear the container because it can contains partially loaded sheet so we must clean it before continue
|
||||
container.clear ();
|
||||
|
@ -819,7 +819,7 @@ void loadForm2(const std::vector<std::string> &sheetFilters, const std::string &
|
|||
ofile.close ();
|
||||
}
|
||||
}
|
||||
catch (NLMISC::Exception &e)
|
||||
catch (const NLMISC::Exception &e)
|
||||
{
|
||||
nlinfo ("loadForm(): Exception during saving the packed file, it will be recreated next launch (%s)", e.what());
|
||||
}
|
||||
|
@ -925,7 +925,7 @@ void loadForm (const std::vector<std::string> &sheetFilters, const std::string &
|
|||
ifile.serialCont (container);
|
||||
ifile.close ();
|
||||
}
|
||||
catch (NLMISC::Exception &e)
|
||||
catch (const NLMISC::Exception &e)
|
||||
{
|
||||
// clear the container because it can contains partially loaded sheet so we must clean it before continue
|
||||
container.clear ();
|
||||
|
@ -1183,7 +1183,7 @@ void loadForm (const std::vector<std::string> &sheetFilters, const std::string &
|
|||
ofile.close ();
|
||||
}
|
||||
}
|
||||
catch (NLMISC::Exception &e)
|
||||
catch (const NLMISC::Exception &e)
|
||||
{
|
||||
nlinfo ("loadForm(): Exception during saving the packed file, it will be recreated next launch (%s)", e.what());
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ inline bool loadXmlPrimitiveFile(CPrimitives &primDoc, const std::string &fileNa
|
|||
// Read it
|
||||
return primDoc.read (xmlIn.getRootNode (), NLMISC::CFile::getFilename(fileName).c_str(), ligoConfig);
|
||||
}
|
||||
catch(NLMISC::Exception e)
|
||||
catch(const NLMISC::Exception &e)
|
||||
{
|
||||
nlwarning("Error reading input file '%s': '%s'", fileName.c_str(), e.what());
|
||||
return false;
|
||||
|
@ -294,7 +294,7 @@ inline bool saveXmlPrimitiveFile(CPrimitives &primDoc, const std::string &fileNa
|
|||
|
||||
// return xmlSaveFile(fileName.c_str(), xmlDoc) != -1;
|
||||
}
|
||||
catch(NLMISC::Exception e)
|
||||
catch(const NLMISC::Exception &e)
|
||||
{
|
||||
nlwarning("Error writing output file '%s': '%s'", fileName.c_str(), e.what());
|
||||
return false;
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace NLMISC
|
|||
* printf ("%d ", bar.asInt (i));
|
||||
* printf("\n");
|
||||
* }
|
||||
* catch (EConfigFile &e)
|
||||
* catch (const EConfigFile &e)
|
||||
* {
|
||||
* // Something goes wrong... catch that
|
||||
* printf ("%s\n", e.what ());
|
||||
|
|
|
@ -169,7 +169,7 @@ void setCrashAlreadyReported(bool state);
|
|||
*\endcode
|
||||
*/
|
||||
#ifdef NL_NO_DEBUG
|
||||
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
|
||||
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
# define nldebug __noop
|
||||
# else
|
||||
# define nldebug 0&&
|
||||
|
@ -184,7 +184,7 @@ void setCrashAlreadyReported(bool state);
|
|||
* Same as nldebug but it will be display in debug and in release mode.
|
||||
*/
|
||||
#ifdef NL_NO_DEBUG
|
||||
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
|
||||
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
# define nlinfo __noop
|
||||
# else
|
||||
# define nlinfo 0&&
|
||||
|
@ -212,7 +212,7 @@ void setCrashAlreadyReported(bool state);
|
|||
*/
|
||||
|
||||
#ifdef NL_NO_DEBUG
|
||||
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
|
||||
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
# define nlwarning __noop
|
||||
# else
|
||||
# define nlwarning 0&&
|
||||
|
@ -583,7 +583,11 @@ template<class T, class U> inline T type_cast(U o)
|
|||
|
||||
/** Compile time assertion
|
||||
*/
|
||||
#define nlctassert(cond) sizeof(uint[(cond) ? 1 : 0])
|
||||
#ifdef NL_ISO_CPP0X_AVAILABLE
|
||||
# define nlctassert(cond) static_assert(cond, "Compile time assert in "#cond)
|
||||
#else
|
||||
# define nlctassert(cond) sizeof(uint[(cond) ? 1 : 0])
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allow to verify an object was accessed before its destructor call.
|
||||
|
|
|
@ -238,11 +238,11 @@ namespace STRING_MANAGER
|
|||
return false;
|
||||
}
|
||||
|
||||
bool findCol(ucstring colName, uint &colIndex)
|
||||
bool findCol(const ucstring &colName, uint &colIndex)
|
||||
{
|
||||
if (Data.empty())
|
||||
return false;
|
||||
TWorksheet::TRow::iterator it = std::find(Data[0].begin(), Data[0].end(), ucstring(colName));
|
||||
TWorksheet::TRow::iterator it = std::find(Data[0].begin(), Data[0].end(), colName);
|
||||
if (it == Data[0].end())
|
||||
return false;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ struct EXmlParsingError : public EStream
|
|||
// File not found
|
||||
}
|
||||
}
|
||||
catch (Exception &e)
|
||||
catch (const Exception &e)
|
||||
{
|
||||
// Something wrong appends
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace NLMISC {
|
|||
// Close the file
|
||||
file.close ();
|
||||
}
|
||||
catch (Exception &e)
|
||||
catch (const Exception &e)
|
||||
{
|
||||
}
|
||||
\endcode
|
||||
|
|
|
@ -105,4 +105,7 @@ CHashKey getSHA1(const std::string &filename, bool forcePath = false);
|
|||
// This function get a buffer with size and returns his SHA hash key
|
||||
CHashKey getSHA1(const uint8 *buffer, uint32 size);
|
||||
|
||||
// This function get a buffer and key with size and returns his HMAC-SHA1 hash key
|
||||
CHashKey getHMacSHA1(const uint8 *text, uint32 text_len, const uint8 *key, uint32 key_len);
|
||||
|
||||
#endif // NL_SHA1_H
|
||||
|
|
|
@ -352,7 +352,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
#if defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
|
||||
#if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
|
||||
// This operator only purpose is to compare with NULL value
|
||||
template <class T>
|
||||
|
|
|
@ -945,10 +945,13 @@ inline CSString operator+(const char* s0,const CSString& s1)
|
|||
return CSString(s0)+s1;
|
||||
}
|
||||
|
||||
#ifndef NL_COMP_VC10
|
||||
// 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
|
||||
|
||||
} // NLMISC
|
||||
|
||||
|
|
|
@ -51,14 +51,10 @@
|
|||
# ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x0500 // Minimal OS = Windows 2000 (NeL is not supported on Windows 95/98)
|
||||
# endif
|
||||
# if _MSC_VER >= 1500
|
||||
# if _MSC_VER >= 1600
|
||||
# define NL_COMP_VC10
|
||||
# elif _MSC_VER >= 1500
|
||||
# define NL_COMP_VC9
|
||||
# ifndef _STLPORT_VERSION // STLport doesn't depend on MS STL features
|
||||
# if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack
|
||||
# define NL_ISO_STDTR1_AVAILABLE
|
||||
# define NL_ISO_STDTR1_HEADER(header) <header>
|
||||
# endif
|
||||
# endif
|
||||
# elif _MSC_VER >= 1400
|
||||
# define NL_COMP_VC8
|
||||
# undef nl_time
|
||||
|
@ -79,6 +75,10 @@
|
|||
# define NL_COMP_VC6
|
||||
# define NL_COMP_NEED_PARAM_ON_METHOD
|
||||
# endif
|
||||
# if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack or later
|
||||
# define NL_ISO_STDTR1_AVAILABLE
|
||||
# define NL_ISO_STDTR1_HEADER(header) <header>
|
||||
# endif
|
||||
# ifdef _DEBUG
|
||||
# define NL_DEBUG
|
||||
# elif defined (NDEBUG)
|
||||
|
@ -117,6 +117,10 @@
|
|||
# define NL_COMP_GCC
|
||||
#endif
|
||||
|
||||
#if defined(_HAS_CPP0X) || defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||
# define NL_ISO_CPP0X_AVAILABLE
|
||||
#endif
|
||||
|
||||
// gcc 3.4 introduced ISO C++ with tough template rules
|
||||
//
|
||||
// NL_ISO_SYNTAX can be used using #if NL_ISO_SYNTAX or #if !NL_ISO_SYNTAX
|
||||
|
@ -149,7 +153,7 @@
|
|||
# pragma warning (disable : 4390) // don't warn in empty block "if(exp) ;"
|
||||
# pragma warning (disable : 4996) // 'vsnprintf': This function or variable may be unsafe. Consider using vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
|
||||
// Debug : Sept 01 2006
|
||||
# if defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
|
||||
# if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
# pragma warning (disable : 4005) // don't warn on redefinitions caused by xp platform sdk
|
||||
# endif // NL_COMP_VC8 || NL_COMP_VC9
|
||||
#endif // NL_OS_WINDOWS
|
||||
|
@ -287,20 +291,18 @@ typedef unsigned int uint; // at least 32bits (depend of processor)
|
|||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifdef NL_OS_MAC
|
||||
#define NL_I64 __PRI_64_LENGTH_MODIFIER__
|
||||
#if defined(__PRI_64_LENGTH_MODIFIER__)
|
||||
# define NL_I64 __PRI_64_LENGTH_MODIFIER__
|
||||
#elif defined(__PRI64_PREFIX)
|
||||
# define NL_I64 __PRI64_PREFIX
|
||||
#else
|
||||
#define NL_I64 __PRI64_PREFIX
|
||||
# ifdef _LP64
|
||||
# define NL_I64 "l"
|
||||
# else
|
||||
# define NL_I64 "ll"
|
||||
# endif // _LP64
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifdef _LP64
|
||||
# define NL_I64 "l"
|
||||
#else
|
||||
# define NL_I64 "ll"
|
||||
#endif // _LP64
|
||||
*/
|
||||
|
||||
#endif // NL_OS_UNIX
|
||||
|
||||
// CHashMap, CHashSet and CHashMultiMap definitions
|
||||
|
@ -364,7 +366,7 @@ typedef uint16 ucchar;
|
|||
|
||||
// To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234)
|
||||
#ifdef NL_OS_WINDOWS
|
||||
# if defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
|
||||
# if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
# define INT64_CONSTANT(c) (c##LL)
|
||||
# define SINT64_CONSTANT(c) (c##LL)
|
||||
# define UINT64_CONSTANT(c) (c##LL)
|
||||
|
|
|
@ -524,7 +524,7 @@ namespace NLNET
|
|||
// run the module task command control to module task method
|
||||
(_Module->*_TaskMethod)();
|
||||
}
|
||||
catch (NLMISC::Exception e)
|
||||
catch (const NLMISC::Exception &e)
|
||||
{
|
||||
nlwarning("In module task '%s', exception '%e' thrown", typeid(this).name(), e.what());
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ CInstanceGroup* LoadInstanceGroup(const char* sFilename)
|
|||
newIG->serial (file);
|
||||
// All is good
|
||||
}
|
||||
catch (Exception &)
|
||||
catch (const Exception &)
|
||||
{
|
||||
// Cannot save the file
|
||||
delete newIG;
|
||||
|
|
|
@ -42,7 +42,6 @@ using namespace std;
|
|||
using namespace NL3D;
|
||||
using namespace NLMISC;
|
||||
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
int WINAPI WinMain( HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
|
@ -139,7 +138,7 @@ int main(int argc, char **argv)
|
|||
tc.setScaleX (scale);
|
||||
tc.setScaleZ (scale);
|
||||
tc.printAt (0.1f, 0.3f, string("printAt Scale String"));
|
||||
|
||||
|
||||
// display the same string with no scale
|
||||
tc.setHotSpot (CComputedString::TopLeft);
|
||||
tc.setScaleX (1.0f);
|
||||
|
|
|
@ -116,7 +116,7 @@ int main (int /* argc */, char ** /* argv */)
|
|||
int val = cf.getVar ("unknown_variable").asInt();
|
||||
nlinfo("unknown_variable = %d", val);
|
||||
}
|
||||
catch (EConfigFile &e)
|
||||
catch (const EConfigFile &e)
|
||||
{
|
||||
nlinfo("something goes wrong with configfile: %s", e.what());
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ int main (int /* argc */, char ** /* argv */)
|
|||
{
|
||||
nlerror ("nlerror() %d", 4);
|
||||
}
|
||||
catch(EFatalError &)
|
||||
catch(const EFatalError &)
|
||||
{
|
||||
// just continue...
|
||||
nlinfo ("nlerror() generated an EFatalError exception, just ignore it");
|
||||
|
|
|
@ -109,7 +109,7 @@ int main (int argc, char **argv)
|
|||
CInetAddress addr(LSHost+":3333");
|
||||
Client->connect(addr);
|
||||
}
|
||||
catch(ESocket &e)
|
||||
catch(const ESocket &e)
|
||||
{
|
||||
printf("%s\n", e.what());
|
||||
return 0;
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
{
|
||||
fsPort = IService::ConfigFile.getVar("FSPort").asInt();
|
||||
}
|
||||
catch ( EUnknownVar& )
|
||||
catch (const EUnknownVar&)
|
||||
{
|
||||
}
|
||||
_FServer.init(fsPort);
|
||||
|
@ -148,7 +148,7 @@ public:
|
|||
{
|
||||
fesPort = IService5::ConfigFile.getVar("FESPort").asInt();
|
||||
}
|
||||
catch ( EUnknownVar& )
|
||||
catch (const EUnknownVar&)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ void cbInit (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
|
|||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception &)
|
||||
catch (const Exception &)
|
||||
{
|
||||
// bad client version, disconnect it
|
||||
CallbackServer->disconnect (from);
|
||||
|
@ -530,7 +530,7 @@ void handleReceivedPong (CClient *client, sint64 pongTime)
|
|||
// init the UDP connection
|
||||
if (client == NULL)
|
||||
{
|
||||
uint32 session;
|
||||
uint32 session = 0;
|
||||
msgin.serial (session);
|
||||
|
||||
// Find a new udp connection, find the linked
|
||||
|
@ -568,13 +568,13 @@ void handleReceivedPong (CClient *client, sint64 pongTime)
|
|||
}
|
||||
|
||||
// Read the message
|
||||
sint64 pingTime;
|
||||
sint64 pingTime = 0;
|
||||
msgin.serial(pingTime);
|
||||
|
||||
uint32 pongNumber;
|
||||
uint32 pongNumber = 0;
|
||||
msgin.serial(pongNumber);
|
||||
|
||||
uint32 blockNumber;
|
||||
uint32 blockNumber = 0;
|
||||
msgin.serial(blockNumber);
|
||||
|
||||
// nlinfo ("receive a pong from %s pongnb %d %"NL_I64"d", CurrentInMsg->AddrFrom.asString().c_str(), pongNumber, pongTime - pingTime);
|
||||
|
@ -611,7 +611,7 @@ void sendPing ()
|
|||
// send the new ping to the client
|
||||
ReceiveTask->DataSock->sendTo (msgout.buffer(), size, GETCLIENTA(it)->Address);
|
||||
}
|
||||
catch (Exception &e)
|
||||
catch (const Exception &e)
|
||||
{
|
||||
nlwarning ("Can't send UDP packet to '%s' (%s)", GETCLIENTA(it)->Address.asString().c_str(), e.what());
|
||||
}
|
||||
|
@ -734,7 +734,7 @@ public:
|
|||
updateStat ();
|
||||
}
|
||||
}
|
||||
catch (Exception &e)
|
||||
catch (const Exception &e)
|
||||
{
|
||||
nlerrornoex ("Exception not catched: '%s'", e.what());
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ void cbInit (CMessage &msgin, TSockId from, CCallbackNetBase &netbase)
|
|||
{
|
||||
UdpSock->connect( CInetAddress (ServerAddr, UDPPort) );
|
||||
}
|
||||
catch ( Exception& e )
|
||||
catch (const Exception &e)
|
||||
{
|
||||
InfoLog->displayRawNL ("Cannot connect to remote UDP host '%s': %s", ServerAddr.c_str(), e.what() );
|
||||
exit ("");
|
||||
|
@ -291,7 +291,7 @@ int main( int argc, char **argv )
|
|||
|
||||
InfoLog->displayRawNL ("Waiting the server answer...");
|
||||
}
|
||||
catch(Exception &e)
|
||||
catch(const Exception &e)
|
||||
{
|
||||
InfoLog->displayRawNL ("Can't connect to %s:%d (%s)\n", ServerAddr.c_str(), TCPPort, e.what());
|
||||
exit ("");
|
||||
|
|
|
@ -108,7 +108,7 @@ void CReceiveTask::run()
|
|||
DataSock->receivedFrom( _ReceivedMessage.userDataW(), _DatagramLength, _ReceivedMessage.AddrFrom );
|
||||
d = CTime::getLocalTime ();
|
||||
}
|
||||
catch ( ESocket& )
|
||||
catch (const ESocket&)
|
||||
{
|
||||
// Remove the client corresponding to the address
|
||||
_ReceivedMessage.setTypeEvent( TReceivedMessage::RemoveClient );
|
||||
|
|
|
@ -371,7 +371,7 @@ int main ()
|
|||
// Remove mouse listener
|
||||
pDriver->delete3dMouseListener (plistener);
|
||||
}
|
||||
catch (Exception& e)
|
||||
catch (const Exception& e)
|
||||
{
|
||||
#ifdef NL_OS_WINDOWS
|
||||
::MessageBox (NULL, e.what(), "Test collision move", MB_OK|MB_ICONEXCLAMATION);
|
||||
|
|
|
@ -85,7 +85,7 @@ void Init()
|
|||
AudioMixer->getListener()->setOrientation( frontvec, upvec );
|
||||
|
||||
}
|
||||
catch( Exception& e )
|
||||
catch(const Exception &e)
|
||||
{
|
||||
nlerror( "Error: %s", e.what() );
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ bool CAnimationSet::loadFromFiles(const std::string &path, bool recurse /* = tru
|
|||
iFile.close();
|
||||
|
||||
}
|
||||
catch (NLMISC::EStream &e)
|
||||
catch (const NLMISC::EStream &e)
|
||||
{
|
||||
if (wantWarningMessage)
|
||||
{
|
||||
|
|
|
@ -338,7 +338,7 @@ void CAsyncFileManager3D::CMeshLoad::run()
|
|||
// Finally affect the pointer (Trans-Thread operation -> this operation must be atomic)
|
||||
*_ppShp = mesh.getShapePointer();
|
||||
}
|
||||
catch(EPathNotFound &)
|
||||
catch(const EPathNotFound &)
|
||||
{
|
||||
nlwarning ("Couldn't load '%s'", MeshName.c_str());
|
||||
*_ppShp = (IShape*)-1;
|
||||
|
@ -382,7 +382,7 @@ void CAsyncFileManager3D::CIGLoad::run (void)
|
|||
|
||||
*_ppIG = pIG;
|
||||
}
|
||||
catch(EPathNotFound &)
|
||||
catch(const EPathNotFound &)
|
||||
{
|
||||
nlwarning ("Couldn't load '%s'", _IGName.c_str());
|
||||
*_ppIG = (CInstanceGroup*)-1;
|
||||
|
@ -429,7 +429,7 @@ void CAsyncFileManager3D::CIGLoadUser::run (void)
|
|||
return;
|
||||
}
|
||||
}
|
||||
catch(EPathNotFound &)
|
||||
catch(const EPathNotFound &)
|
||||
{
|
||||
nlwarning ("Couldn't load '%s'", _IGName.c_str());
|
||||
delete pIG;
|
||||
|
|
|
@ -1600,7 +1600,7 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
|
|||
_EventEmitter.addEmitter(diee, true);
|
||||
}
|
||||
}
|
||||
catch(EDirectInput &e)
|
||||
catch(const EDirectInput &e)
|
||||
{
|
||||
nlinfo(e.what());
|
||||
}
|
||||
|
|
|
@ -485,7 +485,7 @@ NLMISC::IMouseDevice* CDriverD3D::enableLowLevelMouse(bool enable, bool exclusiv
|
|||
if (diee)
|
||||
res = diee->getMouseDevice(exclusive);
|
||||
}
|
||||
catch (EDirectInput &)
|
||||
catch (const EDirectInput &)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ NLMISC::IKeyboardDevice* CDriverD3D::enableLowLevelKeyboard(bool enable)
|
|||
if (diee)
|
||||
res = diee->getKeyboardDevice();
|
||||
}
|
||||
catch (EDirectInput &)
|
||||
catch (const EDirectInput &)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ uint CDriverD3D::getDoubleClickDelay(bool hardwareMouse)
|
|||
{
|
||||
md = diee->getMouseDevice(hardwareMouse);
|
||||
}
|
||||
catch (EDirectInput &)
|
||||
catch (const EDirectInput &)
|
||||
{
|
||||
// could not get device ..
|
||||
}
|
||||
|
|
|
@ -318,7 +318,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
|
|||
if (!mat._MatDrvInfo)
|
||||
{
|
||||
// Insert into driver list. (so it is deleted when driver is deleted).
|
||||
ItMatDrvInfoPtrList it= _MatDrvInfos.insert(_MatDrvInfos.end(), NULL);
|
||||
ItMatDrvInfoPtrList it= _MatDrvInfos.insert(_MatDrvInfos.end(), (NL3D::IMaterialDrvInfos*)NULL);
|
||||
|
||||
*it = mat._MatDrvInfo = new CMaterialDrvInfosD3D(this, it);
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ bool CDriverD3D::activeShader(CShader *shd)
|
|||
if ( !shd->_DrvInfo )
|
||||
{
|
||||
// insert into driver list. (so it is deleted when driver is deleted).
|
||||
ItShaderDrvInfoPtrList it= _ShaderDrvInfos.insert(_ShaderDrvInfos.end(), NULL);
|
||||
ItShaderDrvInfoPtrList it= _ShaderDrvInfos.insert(_ShaderDrvInfos.end(), (NL3D::IShaderDrvInfos*)NULL);
|
||||
// create and set iterator, for future deletion.
|
||||
shaderInfo = new CShaderDrvInfosD3D(this, it);
|
||||
*it= shd->_DrvInfo = shaderInfo;
|
||||
|
|
|
@ -514,7 +514,7 @@ bool CDriverD3D::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded
|
|||
if ( !tex.TextureDrvShare )
|
||||
{
|
||||
// insert into driver list. (so it is deleted when driver is deleted).
|
||||
ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), NULL);
|
||||
ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), (NL3D::CTextureDrvShare*)NULL);
|
||||
// create and set iterator, for future deletion.
|
||||
*it= tex.TextureDrvShare= new CTextureDrvShare(this, it, &tex);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
FILE(GLOB SRC *.cpp *.h *.def)
|
||||
|
||||
IF(APPLE)
|
||||
FILE(GLOB MAC_SRC mac/*.h mac/*.m mac/*.mm mac/*.cpp)
|
||||
SET(SRC ${SRC} ${MAC_SRC})
|
||||
|
|
|
@ -2508,8 +2508,13 @@ void CDriverGL::checkTextureOn() const
|
|||
GLboolean flagCM;
|
||||
GLboolean flagTR;
|
||||
glGetBooleanv(GL_TEXTURE_2D, &flag2D);
|
||||
#ifdef USE_OPENGLES
|
||||
glGetBooleanv(GL_TEXTURE_CUBE_MAP_OES, &flagCM);
|
||||
flagTR = true; // always true in OpenGL ES
|
||||
#else
|
||||
glGetBooleanv(GL_TEXTURE_CUBE_MAP_ARB, &flagCM);
|
||||
glGetBooleanv(GL_TEXTURE_RECTANGLE_NV, &flagTR);
|
||||
#endif
|
||||
switch(dgs.getTextureMode())
|
||||
{
|
||||
case CDriverGLStates::TextureDisabled:
|
||||
|
@ -2545,7 +2550,8 @@ bool CDriverGL::supportOcclusionQuery() const
|
|||
// ***************************************************************************
|
||||
bool CDriverGL::supportTextureRectangle() const
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_supportTextureRectangle)
|
||||
H_AUTO_OGL(CDriverGL_supportTextureRectangle);
|
||||
|
||||
return (_Extensions.NVTextureRectangle || _Extensions.EXTTextureRectangle || _Extensions.ARBTextureRectangle);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,22 +20,67 @@
|
|||
|
||||
#include "nel/misc/types_nl.h"
|
||||
|
||||
#ifdef NL_OS_MAC
|
||||
# define GL_GLEXT_LEGACY
|
||||
# include <OpenGL/gl.h>
|
||||
# include "mac/glext.h"
|
||||
#ifdef USE_OPENGLES
|
||||
# include <GLES/gl.h>
|
||||
# include <GLES/glext.h>
|
||||
#else
|
||||
# include <GL/gl.h>
|
||||
# include <GL/glext.h> // Please download it from http://www.opengl.org/registry/
|
||||
# if defined(NL_OS_WINDOWS)
|
||||
# include <GL/wglext.h>
|
||||
# endif
|
||||
# ifdef NL_OS_MAC
|
||||
# define GL_GLEXT_LEGACY
|
||||
# include <OpenGL/gl.h>
|
||||
# include "mac/glext.h"
|
||||
# else
|
||||
# include <GL/gl.h>
|
||||
# include <GL/glext.h>
|
||||
# if defined(NL_OS_WINDOWS)
|
||||
# include <GL/wglext.h>
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENGLES
|
||||
// OES_mapbuffer
|
||||
//==============
|
||||
typedef void* (APIENTRY * NEL_PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
|
||||
typedef GLboolean (APIENTRY * NEL_PFNGLUNMAPBUFFEROESPROC) (GLenum target);
|
||||
typedef void (APIENTRY * NEL_PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void** params);
|
||||
|
||||
typedef void (APIENTRY * NEL_PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
|
||||
|
||||
// GL_OES_framebuffer_object
|
||||
//==================================
|
||||
typedef GLboolean (APIENTRY * NEL_PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer);
|
||||
typedef void (APIENTRY * NEL_PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer);
|
||||
typedef void (APIENTRY * NEL_PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers);
|
||||
typedef void (APIENTRY * NEL_PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers);
|
||||
typedef void (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (APIENTRY * NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params);
|
||||
typedef GLboolean (APIENTRY * NEL_PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer);
|
||||
typedef void (APIENTRY * NEL_PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer);
|
||||
typedef void (APIENTRY * NEL_PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers);
|
||||
typedef void (APIENTRY * NEL_PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers);
|
||||
typedef GLenum (APIENTRY * NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target);
|
||||
typedef void (APIENTRY * NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (APIENTRY * NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (APIENTRY * NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
|
||||
typedef void (APIENTRY * NEL_PFNGLGENERATEMIPMAPOESPROC) (GLenum target);
|
||||
|
||||
// GL_OES_texture_cube_map
|
||||
//==================================
|
||||
typedef void (APIENTRY * NEL_PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param);
|
||||
typedef void (APIENTRY * NEL_PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params);
|
||||
typedef void (APIENTRY * NEL_PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param);
|
||||
typedef void (APIENTRY * NEL_PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params);
|
||||
typedef void (APIENTRY * NEL_PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
|
||||
typedef void (APIENTRY * NEL_PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
|
||||
typedef void (APIENTRY * NEL_PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRY * NEL_PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY * NEL_PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// The NEL Functions Typedefs.
|
||||
|
|
|
@ -684,7 +684,7 @@ NLMISC::IMouseDevice* CDriverGL::enableLowLevelMouse(bool enable, bool exclusive
|
|||
if (diee)
|
||||
res = diee->getMouseDevice(exclusive);
|
||||
}
|
||||
catch (EDirectInput &)
|
||||
catch (const EDirectInput &)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -722,7 +722,7 @@ NLMISC::IKeyboardDevice* CDriverGL::enableLowLevelKeyboard(bool enable)
|
|||
if (diee)
|
||||
res = diee->getKeyboardDevice();
|
||||
}
|
||||
catch (EDirectInput &)
|
||||
catch (const EDirectInput &)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -778,7 +778,7 @@ uint CDriverGL::getDoubleClickDelay(bool hardwareMouse)
|
|||
{
|
||||
md = diee->getMouseDevice(hardwareMouse);
|
||||
}
|
||||
catch (EDirectInput &)
|
||||
catch (const EDirectInput &)
|
||||
{
|
||||
// could not get device ..
|
||||
}
|
||||
|
|
|
@ -139,8 +139,13 @@ void CDriverGL::setLightInternal(uint8 num, const CLight& light)
|
|||
else
|
||||
{
|
||||
// Deactivate spot properties
|
||||
#ifdef USE_OPENGLES
|
||||
glLightf (lightNum, GL_SPOT_CUTOFF, 180.f);
|
||||
glLightf (lightNum, GL_SPOT_EXPONENT, 0.f);
|
||||
#else
|
||||
glLighti (lightNum, GL_SPOT_CUTOFF, 180);
|
||||
glLighti (lightNum, GL_SPOT_EXPONENT, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Flag this light as dirt.
|
||||
|
|
|
@ -35,10 +35,18 @@ static void convBlend(CMaterial::TBlend blend, GLenum& glenum)
|
|||
case CMaterial::srccolor: glenum=GL_SRC_COLOR; break;
|
||||
case CMaterial::invsrccolor:glenum=GL_ONE_MINUS_SRC_COLOR; break;
|
||||
// Extended Blend modes.
|
||||
#ifdef USE_OPENGLES
|
||||
case CMaterial::blendConstantColor: glenum=GL_CONSTANT_COLOR; break;
|
||||
case CMaterial::blendConstantInvColor: glenum=GL_ONE_MINUS_CONSTANT_COLOR; break;
|
||||
case CMaterial::blendConstantAlpha: glenum=GL_CONSTANT_ALPHA; break;
|
||||
case CMaterial::blendConstantInvAlpha: glenum=GL_ONE_MINUS_CONSTANT_ALPHA; break;
|
||||
#else
|
||||
case CMaterial::blendConstantColor: glenum=GL_CONSTANT_COLOR_EXT; break;
|
||||
case CMaterial::blendConstantInvColor: glenum=GL_ONE_MINUS_CONSTANT_COLOR_EXT; break;
|
||||
case CMaterial::blendConstantAlpha: glenum=GL_CONSTANT_ALPHA_EXT; break;
|
||||
case CMaterial::blendConstantInvAlpha: glenum=GL_ONE_MINUS_CONSTANT_ALPHA_EXT; break;
|
||||
#endif
|
||||
|
||||
default: nlstop;
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +145,9 @@ void CDriverGL::setTextureEnvFunction(uint stage, CMaterial& mat)
|
|||
_DriverGLStates.setTexGenMode (stage, GL_OBJECT_LINEAR);
|
||||
}
|
||||
else if(mode==CMaterial::TexCoordGenEyeSpace)
|
||||
{
|
||||
_DriverGLStates.setTexGenMode (stage, GL_EYE_LINEAR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -240,7 +250,9 @@ void CDriverGL::setTextureShaders(const uint8 *addressingModes, const CSmartPtr<
|
|||
if (glAddrMode != _CurrentTexAddrMode[stage]) // addressing mode different from the one in the device?
|
||||
{
|
||||
_DriverGLStates.activeTextureARB(stage);
|
||||
#ifndef USE_OPENGLES
|
||||
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, glAddrMode);
|
||||
#endif
|
||||
_CurrentTexAddrMode[stage] = glAddrMode;
|
||||
}
|
||||
}
|
||||
|
@ -264,7 +276,7 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
|
|||
if (!mat._MatDrvInfo)
|
||||
{
|
||||
// insert into driver list. (so it is deleted when driver is deleted).
|
||||
ItMatDrvInfoPtrList it= _MatDrvInfos.insert(_MatDrvInfos.end(), NULL);
|
||||
ItMatDrvInfoPtrList it= _MatDrvInfos.insert(_MatDrvInfos.end(), (NL3D::IMaterialDrvInfos*)NULL);
|
||||
// create and set iterator, for future deletion.
|
||||
*it= mat._MatDrvInfo= new CShaderGL(this, it);
|
||||
|
||||
|
@ -807,7 +819,7 @@ void CDriverGL::setupLightMapPass(uint pass)
|
|||
// fallBack if extension MulAdd not found. just mul factor with (Ambient+Diffuse)
|
||||
if(_LightMapNoMulAddFallBack)
|
||||
{
|
||||
// do not use consant color to blend lightmap, but incoming diffuse color, for stage0 only.
|
||||
// do not use constant color to blend lightmap, but incoming diffuse color, for stage0 only.
|
||||
GLfloat glcol[4];
|
||||
convColor(lmapFactor, glcol);
|
||||
_DriverGLStates.setEmissive(lmapFactor.getPacked(), glcol);
|
||||
|
@ -918,7 +930,11 @@ void CDriverGL::setupLightMapPass(uint pass)
|
|||
if (mat._LightMapsMulx2)
|
||||
{
|
||||
// Multiply x 2
|
||||
#ifdef USE_OPENGLES
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 2);
|
||||
#else
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 2);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1027,7 +1043,11 @@ void CDriverGL::endLightMapMultiPass()
|
|||
for (uint32 i = 0; i < (_NLightMapPerPass+1); ++i)
|
||||
{
|
||||
_DriverGLStates.activeTextureARB(i);
|
||||
#ifdef USE_OPENGLES
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 1);
|
||||
#else
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1102,13 +1122,16 @@ void CDriverGL::setupSpecularBegin()
|
|||
// todo hulud remove
|
||||
// _DriverGLStates.setTextureMode(CDriverGLStates::TextureCubeMap);
|
||||
|
||||
#ifdef USE_OPENGLES
|
||||
_DriverGLStates.setTexGenMode (1, GL_REFLECTION_MAP_OES);
|
||||
#else
|
||||
_DriverGLStates.setTexGenMode (1, GL_REFLECTION_MAP_ARB);
|
||||
#endif
|
||||
|
||||
// setup the good matrix for stage 1.
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadMatrixf( _SpecularTexMtx.get() );
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -1292,7 +1315,8 @@ void CDriverGL::setupSpecularPass(uint pass)
|
|||
_DriverGLStates.setTextureMode(CDriverGLStates::TextureDisabled);
|
||||
}
|
||||
else
|
||||
{ // Multiply texture1 by alpha_texture0 and display with add
|
||||
{
|
||||
// Multiply texture1 by alpha_texture0 and display with add
|
||||
_DriverGLStates.enableBlend(true);
|
||||
_DriverGLStates.blendFunc(GL_ONE, GL_ONE);
|
||||
|
||||
|
@ -1957,7 +1981,9 @@ void CDriverGL::endCloudMultiPass()
|
|||
nlassert(_CurrentMaterial->getShader() == CMaterial::Cloud);
|
||||
if (ATICloudShaderHandle)
|
||||
{
|
||||
#ifndef USE_OPENGLES
|
||||
glDisable(GL_FRAGMENT_SHADER_ATI);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1975,7 +2001,9 @@ sint CDriverGL::beginWaterMultiPass()
|
|||
*/
|
||||
void CDriverGL::setupWaterPassR200(const CMaterial &mat)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_setupWaterPassR200)
|
||||
H_AUTO_OGL(CDriverGL_setupWaterPassR200);
|
||||
|
||||
#ifndef USE_OPENGLES
|
||||
uint k;
|
||||
ITexture *tex = mat.getTexture(0);
|
||||
if (tex)
|
||||
|
@ -2047,6 +2075,7 @@ void CDriverGL::setupWaterPassR200(const CMaterial &mat)
|
|||
float cst[4] = { 1.f, 1.f, 1.f, 0.f };
|
||||
nglSetFragmentShaderConstantATI(GL_CON_0_ATI, cst);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -2054,7 +2083,9 @@ void CDriverGL::setupWaterPassR200(const CMaterial &mat)
|
|||
*/
|
||||
void CDriverGL::setupWaterPassARB(const CMaterial &mat)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_setupWaterPassARB)
|
||||
H_AUTO_OGL(CDriverGL_setupWaterPassARB);
|
||||
|
||||
#ifndef USE_OPENGLES
|
||||
uint k;
|
||||
ITexture *tex = mat.getTexture(0);
|
||||
if (tex)
|
||||
|
@ -2133,6 +2164,7 @@ void CDriverGL::setupWaterPassARB(const CMaterial &mat)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -2159,8 +2191,9 @@ static const float IdentityTexMat[4] = { 1.f, 0.f, 0.f, 1.f };
|
|||
// ***************************************************************************
|
||||
void CDriverGL::setupWaterPassNV20(const CMaterial &mat)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_setupWaterPassNV20)
|
||||
H_AUTO_OGL(CDriverGL_setupWaterPassNV20);
|
||||
|
||||
#ifndef USE_OPENGLES
|
||||
static bool setupDone = false;
|
||||
static CMaterial::CTexEnv texEnvReplace;
|
||||
static CMaterial::CTexEnv texEnvModulate;
|
||||
|
@ -2245,6 +2278,7 @@ void CDriverGL::setupWaterPassNV20(const CMaterial &mat)
|
|||
activateTexEnvMode(2, texEnvReplace);
|
||||
activateTexEnvMode(3, texEnvModulate);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -2272,7 +2306,9 @@ void CDriverGL::setupWaterPass(uint /* pass */)
|
|||
// ***************************************************************************
|
||||
void CDriverGL::endWaterMultiPass()
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_endWaterMultiPass)
|
||||
H_AUTO_OGL(CDriverGL_endWaterMultiPass);
|
||||
|
||||
#ifndef USE_OPENGLES
|
||||
nlassert(_CurrentMaterial->getShader() == CMaterial::Water);
|
||||
// NB : as fragment shaders / programs bypass the texture envs, no special env enum is added (c.f CTexEnvSpecial)
|
||||
if (_Extensions.NVTextureShader) return;
|
||||
|
@ -2284,6 +2320,7 @@ void CDriverGL::endWaterMultiPass()
|
|||
{
|
||||
glDisable(GL_FRAGMENT_SHADER_ATI);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // NL3D
|
||||
|
|
|
@ -15,24 +15,35 @@
|
|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdopengl.h"
|
||||
|
||||
#include "driver_opengl.h"
|
||||
|
||||
namespace NL3D {
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGL::setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_setFrustum)
|
||||
H_AUTO_OGL(CDriverGL_setFrustum);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
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;
|
||||
|
||||
// Backup znear and zfar for zbias setup
|
||||
|
|
|
@ -77,7 +77,8 @@ void CDriverGLStates::init(bool supportTextureCubeMap, bool supportTextureRect
|
|||
// ***************************************************************************
|
||||
void CDriverGLStates::forceDefaults(uint nbStages)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates_forceDefaults)
|
||||
H_AUTO_OGL(CDriverGLStates_forceDefaults);
|
||||
|
||||
// Enable / disable.
|
||||
_CurFog= false;
|
||||
_CurBlend= false;
|
||||
|
@ -86,6 +87,7 @@ void CDriverGLStates::forceDefaults(uint nbStages)
|
|||
_CurLighting= false;
|
||||
_CurZWrite= true;
|
||||
_CurStencilTest=false;
|
||||
|
||||
// setup GLStates.
|
||||
glDisable(GL_FOG);
|
||||
glDisable(GL_BLEND);
|
||||
|
@ -144,33 +146,62 @@ 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);
|
||||
|
||||
if(_TextureCubeMapSupported)
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
glDisable(GL_TEXTURE_CUBE_MAP_OES);
|
||||
glDisable(GL_TEXTURE_GEN_STR_OES);
|
||||
#else
|
||||
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||
if(_TextureRectangleSupported)
|
||||
glDisable(GL_TEXTURE_RECTANGLE_NV);
|
||||
#endif
|
||||
}
|
||||
|
||||
_TextureMode[stage]= TextureDisabled;
|
||||
|
||||
// Tex gen init
|
||||
_TexGenMode[stage] = 0;
|
||||
glDisable( GL_TEXTURE_GEN_S );
|
||||
glDisable( GL_TEXTURE_GEN_T );
|
||||
glDisable( GL_TEXTURE_GEN_R );
|
||||
glDisable( GL_TEXTURE_GEN_Q );
|
||||
|
||||
#ifndef USE_OPENGLES
|
||||
if(_TextureRectangleSupported)
|
||||
glDisable(GL_TEXTURE_RECTANGLE_NV);
|
||||
|
||||
glDisable(GL_TEXTURE_GEN_S);
|
||||
glDisable(GL_TEXTURE_GEN_T);
|
||||
glDisable(GL_TEXTURE_GEN_R);
|
||||
glDisable(GL_TEXTURE_GEN_Q);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ActiveTexture current texture to 0.
|
||||
#ifdef USE_OPENGLES
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
#else
|
||||
nglActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
_CurrentActiveTextureARB= 0;
|
||||
nglClientActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
#endif
|
||||
|
||||
_CurrentActiveTextureARB= 0;
|
||||
_CurrentClientActiveTextureARB= 0;
|
||||
|
||||
// Depth range
|
||||
_DepthRangeNear = 0.f;
|
||||
_DepthRangeFar = 1.f;
|
||||
_ZBias = 0.f;
|
||||
|
||||
#ifdef USE_OPENGLES
|
||||
glDepthRangef (0.f, 1.f);
|
||||
#else
|
||||
glDepthRange (0, 1);
|
||||
#endif
|
||||
|
||||
// Cull order
|
||||
_CullMode = CCW;
|
||||
|
@ -536,7 +567,9 @@ void CDriverGLStates::setVertexColorLighted(bool enable)
|
|||
if (_VertexColorLighted)
|
||||
{
|
||||
glEnable (GL_COLOR_MATERIAL);
|
||||
#ifndef USE_OPENGLES
|
||||
glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -558,9 +591,15 @@ void CDriverGLStates::setVertexColorLighted(bool enable)
|
|||
// ***************************************************************************
|
||||
void CDriverGLStates::updateDepthRange()
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates_updateDepthRange)
|
||||
H_AUTO_OGL(CDriverGLStates_updateDepthRange);
|
||||
|
||||
float delta = _ZBias * (_DepthRangeFar - _DepthRangeNear);
|
||||
|
||||
#ifdef USE_OPENGLES
|
||||
glDepthRangef(delta + _DepthRangeNear, delta + _DepthRangeFar);
|
||||
#else
|
||||
glDepthRange(delta + _DepthRangeNear, delta + _DepthRangeFar);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -605,10 +644,14 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode)
|
|||
|
||||
if(mode==0)
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
glDisable(GL_TEXTURE_GEN_STR_OES);
|
||||
#else
|
||||
glDisable( GL_TEXTURE_GEN_S );
|
||||
glDisable( GL_TEXTURE_GEN_T );
|
||||
glDisable( GL_TEXTURE_GEN_R );
|
||||
glDisable( GL_TEXTURE_GEN_Q );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -630,10 +673,15 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode)
|
|||
{
|
||||
glDisable( GL_TEXTURE_GEN_Q );
|
||||
}
|
||||
|
||||
// Enable All.
|
||||
#ifdef USE_OPENGLES
|
||||
glEnable(GL_TEXTURE_GEN_STR_OES);
|
||||
#else
|
||||
glEnable( GL_TEXTURE_GEN_S );
|
||||
glEnable( GL_TEXTURE_GEN_T );
|
||||
glEnable( GL_TEXTURE_GEN_R );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -649,12 +697,19 @@ void CDriverGLStates::resetTextureMode()
|
|||
|
||||
if (_TextureCubeMapSupported)
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
glDisable(GL_TEXTURE_CUBE_MAP_OES);
|
||||
#else
|
||||
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef USE_OPENGLES
|
||||
if (_TextureRectangleSupported)
|
||||
{
|
||||
glDisable(GL_TEXTURE_RECTANGLE_NV);
|
||||
}
|
||||
#endif
|
||||
|
||||
_TextureMode[_CurrentActiveTextureARB]= TextureDisabled;
|
||||
}
|
||||
|
@ -674,11 +729,13 @@ void CDriverGLStates::setTextureMode(TTextureMode texMode)
|
|||
}
|
||||
else if(oldTexMode == TextureRect)
|
||||
{
|
||||
#ifndef USE_OPENGLES
|
||||
if(_TextureRectangleSupported)
|
||||
{
|
||||
glDisable(GL_TEXTURE_RECTANGLE_NV);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
@ -687,7 +744,11 @@ void CDriverGLStates::setTextureMode(TTextureMode texMode)
|
|||
{
|
||||
if(_TextureCubeMapSupported)
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
glDisable(GL_TEXTURE_CUBE_MAP_OES);
|
||||
#else
|
||||
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -702,24 +763,30 @@ void CDriverGLStates::setTextureMode(TTextureMode texMode)
|
|||
}
|
||||
else if(texMode == TextureRect)
|
||||
{
|
||||
#ifndef USE_OPENGLES
|
||||
if(_TextureRectangleSupported)
|
||||
{
|
||||
glEnable(GL_TEXTURE_RECTANGLE_NV);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
}
|
||||
else if(texMode == TextureCubeMap)
|
||||
{
|
||||
if(_TextureCubeMapSupported)
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
glEnable(GL_TEXTURE_CUBE_MAP_OES);
|
||||
#else
|
||||
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -736,8 +803,11 @@ void CDriverGLStates::activeTextureARB(uint stage)
|
|||
|
||||
if( _CurrentActiveTextureARB != stage )
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
glActiveTexture(GL_TEXTURE0+stage);
|
||||
#else
|
||||
nglActiveTextureARB(GL_TEXTURE0_ARB+stage);
|
||||
|
||||
#endif
|
||||
|
||||
_CurrentActiveTextureARB= stage;
|
||||
}
|
||||
|
@ -748,7 +818,11 @@ 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;
|
||||
}
|
||||
|
@ -786,22 +860,25 @@ void CDriverGLStates::enableNormalArray(bool enable)
|
|||
// ***************************************************************************
|
||||
void CDriverGLStates::enableWeightArray(bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates_enableWeightArray)
|
||||
H_AUTO_OGL(CDriverGLStates_enableWeightArray);
|
||||
|
||||
if(_WeightArrayEnabled != enable)
|
||||
{
|
||||
#ifndef USE_OPENGLES
|
||||
if(enable)
|
||||
glEnableClientState(GL_VERTEX_WEIGHTING_EXT);
|
||||
else
|
||||
glDisableClientState(GL_VERTEX_WEIGHTING_EXT);
|
||||
#endif
|
||||
|
||||
_WeightArrayEnabled= enable;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates::enableColorArray(bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates_enableColorArray)
|
||||
H_AUTO_OGL(CDriverGLStates_enableColorArray);
|
||||
|
||||
if(_ColorArrayEnabled != enable)
|
||||
{
|
||||
if(enable)
|
||||
|
@ -818,32 +895,42 @@ void CDriverGLStates::enableColorArray(bool enable)
|
|||
// ***************************************************************************
|
||||
void CDriverGLStates::enableSecondaryColorArray(bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates_enableSecondaryColorArray)
|
||||
H_AUTO_OGL(CDriverGLStates_enableSecondaryColorArray);
|
||||
|
||||
if(_SecondaryColorArrayEnabled != enable)
|
||||
{
|
||||
#ifndef USE_OPENGLES
|
||||
if(enable)
|
||||
glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
|
||||
else
|
||||
glDisableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
|
||||
|
||||
#endif
|
||||
|
||||
_SecondaryColorArrayEnabled= enable;
|
||||
|
||||
#ifndef USE_OPENGLES
|
||||
// If disable
|
||||
if(!enable)
|
||||
{
|
||||
// GeForceFx Bug: Must reset Secondary color to 0 (if comes from a VP), else bugs
|
||||
nglSecondaryColor3ubEXT(0,0,0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDriverGLStates::clientActiveTextureARB(uint stage)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates_clientActiveTextureARB)
|
||||
H_AUTO_OGL(CDriverGLStates_clientActiveTextureARB);
|
||||
|
||||
if( _CurrentClientActiveTextureARB != stage )
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
glClientActiveTexture(GL_TEXTURE0+stage);
|
||||
#else
|
||||
nglClientActiveTextureARB(GL_TEXTURE0_ARB+stage);
|
||||
#endif
|
||||
_CurrentClientActiveTextureARB= stage;
|
||||
}
|
||||
}
|
||||
|
@ -851,7 +938,8 @@ void CDriverGLStates::clientActiveTextureARB(uint stage)
|
|||
// ***************************************************************************
|
||||
void CDriverGLStates::enableTexCoordArray(bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates_enableTexCoordArray)
|
||||
H_AUTO_OGL(CDriverGLStates_enableTexCoordArray);
|
||||
|
||||
if(_TexCoordArrayEnabled[_CurrentClientActiveTextureARB] != enable)
|
||||
{
|
||||
if(enable)
|
||||
|
@ -867,14 +955,16 @@ void CDriverGLStates::enableTexCoordArray(bool enable)
|
|||
// ***************************************************************************
|
||||
void CDriverGLStates::enableVertexAttribArray(uint glIndex, bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates_enableVertexAttribArray)
|
||||
H_AUTO_OGL(CDriverGLStates_enableVertexAttribArray);
|
||||
|
||||
if(_VertexAttribArrayEnabled[glIndex] != enable)
|
||||
{
|
||||
#ifndef USE_OPENGLES
|
||||
if(enable)
|
||||
glEnableClientState(glIndex+GL_VERTEX_ATTRIB_ARRAY0_NV);
|
||||
else
|
||||
glDisableClientState(glIndex+GL_VERTEX_ATTRIB_ARRAY0_NV);
|
||||
|
||||
#endif
|
||||
|
||||
_VertexAttribArrayEnabled[glIndex]= enable;
|
||||
}
|
||||
|
@ -883,15 +973,18 @@ void CDriverGLStates::enableVertexAttribArray(uint glIndex, bool enable)
|
|||
// ***************************************************************************
|
||||
void CDriverGLStates::enableVertexAttribArrayARB(uint glIndex,bool enable)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGLStates_enableVertexAttribArrayARB)
|
||||
H_AUTO_OGL(CDriverGLStates_enableVertexAttribArrayARB);
|
||||
|
||||
#ifndef NL3D_GLSTATE_DISABLE_CACHE
|
||||
if(_VertexAttribArrayEnabled[glIndex] != enable)
|
||||
#endif
|
||||
{
|
||||
#ifndef USE_OPENGLES
|
||||
if(enable)
|
||||
nglEnableVertexAttribArrayARB(glIndex);
|
||||
else
|
||||
nglDisableVertexAttribArrayARB(glIndex);
|
||||
#endif
|
||||
|
||||
_VertexAttribArrayEnabled[glIndex]= enable;
|
||||
}
|
||||
|
@ -988,7 +1081,13 @@ void CDriverGLStates::enableFog(uint enable)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,11 +20,15 @@
|
|||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/3d/vertex_buffer.h"
|
||||
|
||||
#ifdef NL_OS_MAC
|
||||
# define GL_GLEXT_LEGACY
|
||||
# include <OpenGL/gl.h>
|
||||
#ifdef USE_OPENGLES
|
||||
# include <GLES/gl.h>
|
||||
#else
|
||||
# include <GL/gl.h>
|
||||
# ifdef NL_OS_MAC
|
||||
# define GL_GLEXT_LEGACY
|
||||
# include <OpenGL/gl.h>
|
||||
# else
|
||||
# include <GL/gl.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -41,7 +45,7 @@ namespace NL3D
|
|||
- GL_ALPHA_TEST
|
||||
- GL_LIGHTING
|
||||
- GL_LIGHT0 + i .....
|
||||
- GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP_ARB.
|
||||
- GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP_ARB/OES.
|
||||
- GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_R
|
||||
- GL_COLOR_MATERIAL
|
||||
- GL_FOG
|
||||
|
|
|
@ -155,7 +155,11 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex)
|
|||
|
||||
// check status
|
||||
GLenum status;
|
||||
#ifdef USE_OPENGLES
|
||||
status = (GLenum) nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES);
|
||||
#else
|
||||
status = (GLenum) nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
#endif
|
||||
switch(status) {
|
||||
case GL_FRAMEBUFFER_COMPLETE_EXT:
|
||||
InitFBO = true;
|
||||
|
@ -197,19 +201,31 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex)
|
|||
break;
|
||||
#endif
|
||||
default:
|
||||
nlwarning("Framebuffer incomplete\n");
|
||||
nlwarning("Framebuffer incomplete status %d", (sint)status);
|
||||
//nlassert(0);
|
||||
}
|
||||
|
||||
// clean up resources if allocation failed
|
||||
if (!InitFBO)
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
nglDeleteFramebuffersOES(1, &FBOId);
|
||||
#else
|
||||
nglDeleteFramebuffersEXT(1, &FBOId);
|
||||
#endif
|
||||
if (AttachDepthStencil)
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
nglDeleteRenderbuffersOES(1, &DepthFBOId);
|
||||
#else
|
||||
nglDeleteRenderbuffersEXT(1, &DepthFBOId);
|
||||
#endif
|
||||
if(!UsePackedDepthStencil)
|
||||
#ifdef USE_OPENGLES
|
||||
nglDeleteRenderbuffersOES(1, &StencilFBOId);
|
||||
#else
|
||||
nglDeleteRenderbuffersEXT(1, &StencilFBOId);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,14 +242,22 @@ 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;
|
||||
|
@ -481,7 +505,7 @@ static inline GLenum translateMinFilterToGl(CTextureDrvInfosGL *glText)
|
|||
// ***************************************************************************
|
||||
static inline bool sameDXTCFormat(ITexture &tex, GLint glfmt)
|
||||
{
|
||||
H_AUTO_OGL(sameDXTCFormat)
|
||||
H_AUTO_OGL(sameDXTCFormat);
|
||||
if(glfmt==GL_COMPRESSED_RGB_S3TC_DXT1_EXT && tex.PixelFormat==CBitmap::DXTC1)
|
||||
return true;
|
||||
if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT1_EXT && tex.PixelFormat==CBitmap::DXTC1Alpha)
|
||||
|
@ -497,7 +521,7 @@ static inline bool sameDXTCFormat(ITexture &tex, GLint glfmt)
|
|||
// ***************************************************************************
|
||||
static inline bool isDXTCFormat(GLint glfmt)
|
||||
{
|
||||
H_AUTO_OGL(isDXTCFormat)
|
||||
H_AUTO_OGL(isDXTCFormat);
|
||||
if(glfmt==GL_COMPRESSED_RGB_S3TC_DXT1_EXT)
|
||||
return true;
|
||||
if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
|
||||
|
@ -602,7 +626,7 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded,
|
|||
{
|
||||
//nldebug("3D: creating CTextureDrvShare()");
|
||||
// insert into driver list. (so it is deleted when driver is deleted).
|
||||
ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), NULL);
|
||||
ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), (NL3D::CTextureDrvShare*)NULL);
|
||||
// create and set iterator, for future deletion.
|
||||
*it= tex.TextureDrvShare= new CTextureDrvShare(this, it, &tex);
|
||||
|
||||
|
@ -840,8 +864,13 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded,
|
|||
sint size= tex.getPixels(i).size();
|
||||
if (bUpload)
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
glCompressedTexImage2D (GL_TEXTURE_2D, i-decalMipMapResize, glfmt,
|
||||
tex.getWidth(i),tex.getHeight(i), 0, size, ptr);
|
||||
#else
|
||||
nglCompressedTexImage2DARB (GL_TEXTURE_2D, i-decalMipMapResize, glfmt,
|
||||
tex.getWidth(i),tex.getHeight(i), 0, size, ptr);
|
||||
#endif
|
||||
bAllUploaded = true;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -140,7 +140,7 @@ bool CDriverGL::setupVertexBuffer(CVertexBuffer& VB)
|
|||
// 1. Retrieve/Create driver shader.
|
||||
//==================================
|
||||
// insert into driver list. (so it is deleted when driver is deleted).
|
||||
ItVBDrvInfoPtrList it= _VBDrvInfos.insert(_VBDrvInfos.end(), NULL);
|
||||
ItVBDrvInfoPtrList it= _VBDrvInfos.insert(_VBDrvInfos.end(), (NL3D::IVBDrvInfos*)NULL);
|
||||
// create and set iterator, for future deletion.
|
||||
CVBDrvInfosGL *info = new CVBDrvInfosGL(this, it, &VB);
|
||||
*it= VB.DrvInfos = info;
|
||||
|
@ -280,8 +280,12 @@ bool CDriverGL::renderLines(CMaterial& mat, uint32 firstIndex, uint32 nlines)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
nlerror("not available in OpenGL ES 1.0, only use 16 bits indices");
|
||||
#else
|
||||
nlassert(_LastIB._Format == CIndexBuffer::Indices32);
|
||||
glDrawElements(GL_LINES,2*nlines,GL_UNSIGNED_INT,((uint32 *) _LastIB._Values)+firstIndex);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -336,8 +340,12 @@ bool CDriverGL::renderTriangles(CMaterial& mat, uint32 firstIndex, uint32 ntris)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
nlerror("not available in OpenGL ES 1.0, only use 16 bits indices");
|
||||
#else
|
||||
nlassert(_LastIB._Format == CIndexBuffer::Indices32);
|
||||
glDrawElements(GL_TRIANGLES,3*ntris,GL_UNSIGNED_INT, ((uint32 *) _LastIB._Values)+firstIndex);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -380,8 +388,12 @@ bool CDriverGL::renderSimpleTriangles(uint32 firstTri, uint32 ntris)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
nlerror("not available in OpenGL ES 1.0, only use 16 bits indices");
|
||||
#else
|
||||
nlassert(_LastIB._Format == CIndexBuffer::Indices32);
|
||||
glDrawElements(GL_TRIANGLES,3*ntris,GL_UNSIGNED_INT, ((uint32 *) _LastIB._Values)+firstTri);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Profiling.
|
||||
|
@ -608,6 +620,9 @@ bool CDriverGL::renderRawQuads(CMaterial& mat, uint32 startIndex, uint32 numQuad
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
nlerror("not available in OpenGL ES 1.0, only use 16 bits indices");
|
||||
#else
|
||||
// indices fits on 32 bits
|
||||
GLint indices[QUAD_BATCH_SIZE];
|
||||
GLint *curr = indices;
|
||||
|
@ -625,6 +640,7 @@ bool CDriverGL::renderRawQuads(CMaterial& mat, uint32 startIndex, uint32 numQuad
|
|||
}
|
||||
while(curr != end);
|
||||
glDrawElements(GL_TRIANGLES, 6 * numQuadsToDraw, GL_UNSIGNED_INT, indices);
|
||||
#endif
|
||||
}
|
||||
numLeftQuads -= numQuadsToDraw;
|
||||
currIndex += 4 * numQuadsToDraw;
|
||||
|
@ -665,10 +681,12 @@ void CDriverGL::setupUVPtr(uint stage, CVertexBufferInfo &VB, uint uvId)
|
|||
// Setup ATI VBHard or std ptr.
|
||||
switch(VB.VBMode)
|
||||
{
|
||||
#ifndef USE_OPENGLES
|
||||
case CVertexBufferInfo::HwATI:
|
||||
nglArrayObjectATI(GL_TEXTURE_COORD_ARRAY, numTexCoord, GL_FLOAT, VB.VertexSize, VB.VertexObjectId,
|
||||
(ptrdiff_t) VB.ValuePtr[CVertexBuffer::TexCoord0+uvId]);
|
||||
break;
|
||||
#endif
|
||||
case CVertexBufferInfo::HwARB:
|
||||
_DriverGLStates.bindARBVertexBuffer(VB.VertexObjectId);
|
||||
// with arb buffers, position is relative to the start of the stream
|
||||
|
@ -811,6 +829,21 @@ const uint CDriverGL::NumCoordinatesType[CVertexBuffer::NumType]=
|
|||
// ***************************************************************************
|
||||
const uint CDriverGL::GLType[CVertexBuffer::NumType]=
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
GL_FLOAT, // Double1
|
||||
GL_FLOAT, // Float1
|
||||
GL_SHORT, // Short1
|
||||
GL_FLOAT, // Double2
|
||||
GL_FLOAT, // Float2
|
||||
GL_SHORT, // Short2
|
||||
GL_FLOAT, // Double3
|
||||
GL_FLOAT, // Float3
|
||||
GL_SHORT, // Short3
|
||||
GL_FLOAT, // Double4
|
||||
GL_FLOAT, // Float4
|
||||
GL_SHORT, // Short4
|
||||
GL_UNSIGNED_BYTE // UChar4
|
||||
#else
|
||||
GL_DOUBLE, // Double1
|
||||
GL_FLOAT, // Float1
|
||||
GL_SHORT, // Short1
|
||||
|
@ -824,6 +857,7 @@ const uint CDriverGL::GLType[CVertexBuffer::NumType]=
|
|||
GL_FLOAT, // Float4
|
||||
GL_SHORT, // Short4
|
||||
GL_UNSIGNED_BYTE // UChar4
|
||||
#endif
|
||||
};
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -926,6 +960,7 @@ void CDriverGL::setupGlArraysStd(CVertexBufferInfo &vb)
|
|||
}
|
||||
}
|
||||
break;
|
||||
#ifndef USE_OPENGLES
|
||||
case CVertexBufferInfo::HwATI:
|
||||
{
|
||||
// setup vertex ptr.
|
||||
|
@ -963,9 +998,12 @@ void CDriverGL::setupGlArraysStd(CVertexBufferInfo &vb)
|
|||
nglArrayObjectATI(GL_COLOR_ARRAY, 4, GL_UNSIGNED_BYTE, vb.VertexSize, vb.VertexObjectId, (ptrdiff_t) vb.ValuePtr[CVertexBuffer::PrimaryColor]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_DriverGLStates.enableColorArray(false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
nlassert(0);
|
||||
break;
|
||||
|
@ -1035,7 +1073,9 @@ void CDriverGL::toggleGlArraysForARBVertexProgram()
|
|||
// If last was a VertexProgram setup, and now it is a standard GL array setup.
|
||||
if( _LastSetupGLArrayVertexProgram && !isVertexProgramEnabled () )
|
||||
{
|
||||
#ifndef USE_OPENGLES
|
||||
if (_Extensions.ATITextureEnvCombine3)
|
||||
#endif
|
||||
{
|
||||
// fix for ATI : when switching from Vertex Program to fixed Pipe, must clean texture, otherwise texture may be disabled in next render
|
||||
// (seems to be a driver bug)
|
||||
|
@ -1046,12 +1086,16 @@ void CDriverGL::toggleGlArraysForARBVertexProgram()
|
|||
// activate the texture, or disable texturing if NULL.
|
||||
activateTexture(stage, NULL);
|
||||
}
|
||||
|
||||
#ifndef USE_OPENGLES
|
||||
glBegin(GL_QUADS);
|
||||
glVertex4f(0.f, 0.f, 0.f, 1.f);
|
||||
glVertex4f(0.f, 0.f, 0.f, 1.f);
|
||||
glVertex4f(0.f, 0.f, 0.f, 1.f);
|
||||
glVertex4f(0.f, 0.f, 0.f, 1.f);
|
||||
glEnd();
|
||||
#endif
|
||||
|
||||
for(uint stage=0 ; stage<inlGetNumTextStages() ; stage++)
|
||||
{
|
||||
// activate the texture, or disable texturing if NULL.
|
||||
|
@ -1185,7 +1229,9 @@ void CDriverGL::setupGlArraysForNVVertexProgram(CVertexBufferInfo &vb)
|
|||
{
|
||||
// Secondary color
|
||||
_DriverGLStates.enableSecondaryColorArray(true);
|
||||
nglSecondaryColorPointerEXT(4,GL_UNSIGNED_BYTE, vb.VertexSize, vb.ValuePtr[value]);
|
||||
#ifndef USE_OPENGLES
|
||||
nglSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, vb.VertexSize, vb.ValuePtr[value]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1199,7 +1245,9 @@ void CDriverGL::setupGlArraysForNVVertexProgram(CVertexBufferInfo &vb)
|
|||
|
||||
// Active this value
|
||||
_DriverGLStates.enableVertexAttribArray(glIndex, true);
|
||||
#ifndef USE_OPENGLES
|
||||
nglVertexAttribPointerNV (glIndex, NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// Else normal case, can't do anything for other values with UChar4....
|
||||
|
@ -1207,7 +1255,9 @@ void CDriverGL::setupGlArraysForNVVertexProgram(CVertexBufferInfo &vb)
|
|||
{
|
||||
// Active this value
|
||||
_DriverGLStates.enableVertexAttribArray(glIndex, true);
|
||||
#ifndef USE_OPENGLES
|
||||
nglVertexAttribPointerNV (glIndex, NumCoordinatesType[type], GLType[type], vb.VertexSize, vb.ValuePtr[value]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -69,7 +69,7 @@ IVertexBufferHardGL::~IVertexBufferHardGL()
|
|||
H_AUTO_OGL(IVertexBufferHardGL_IVertexBufferHardGLDtor)
|
||||
}
|
||||
|
||||
|
||||
#ifndef USE_OPENGLES
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
@ -1133,7 +1133,7 @@ void CVertexArrayRangeMapObjectATI::updateLostBuffers()
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // USE_OPENGLES
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -1210,19 +1210,37 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff
|
|||
// create a ARB VBHard
|
||||
GLuint vertexBufferID;
|
||||
glGetError();
|
||||
|
||||
#ifdef USE_OPENGLES
|
||||
glGenBuffers(1, &vertexBufferID);
|
||||
#else
|
||||
nglGenBuffersARB(1, &vertexBufferID);
|
||||
#endif
|
||||
|
||||
if (glGetError() != GL_NO_ERROR) return false;
|
||||
_Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID);
|
||||
switch(_VBType)
|
||||
{
|
||||
case CVertexBuffer::AGPPreferred:
|
||||
#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::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;
|
||||
default:
|
||||
nlassert(0);
|
||||
|
@ -1230,7 +1248,12 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff
|
|||
}
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
#ifdef USE_OPENGLES
|
||||
glDeleteBuffers(1, &vertexBufferID);
|
||||
#else
|
||||
nglDeleteBuffersARB(1, &vertexBufferID);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
CVertexBufferHardARB *newVbHard= new CVertexBufferHardARB(_Driver, vb);
|
||||
|
@ -1272,8 +1295,13 @@ 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);
|
||||
}
|
||||
|
@ -1300,6 +1328,12 @@ CVertexBufferHardARB::CVertexBufferHardARB(CDriverGL *drv, CVertexBuffer *vb) :
|
|||
#ifdef NL_DEBUG
|
||||
_Unmapping = false;
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENGLES
|
||||
_Buffer = NULL;
|
||||
_BufferSize = 0;
|
||||
_LastBufferSize = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
@ -1316,8 +1350,13 @@ 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)
|
||||
{
|
||||
|
@ -1336,12 +1375,21 @@ CVertexBufferHardARB::~CVertexBufferHardARB()
|
|||
_VertexArrayRange->_MappedVBList.erase(_IteratorInMappedVBList);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENGLES
|
||||
if (_Buffer)
|
||||
{
|
||||
delete [] _Buffer;
|
||||
_Buffer = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void *CVertexBufferHardARB::lock()
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_lock)
|
||||
H_AUTO_OGL(CVertexBufferHardARB_lock);
|
||||
|
||||
if (_VertexPtr) return _VertexPtr; // already locked
|
||||
if (_Invalid)
|
||||
{
|
||||
|
@ -1352,7 +1400,13 @@ void *CVertexBufferHardARB::lock()
|
|||
}
|
||||
// recreate a vb
|
||||
GLuint vertexBufferID;
|
||||
|
||||
#ifdef USE_OPENGLES
|
||||
glGenBuffers(1, &vertexBufferID);
|
||||
#else
|
||||
nglGenBuffersARB(1, &vertexBufferID);
|
||||
#endif
|
||||
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
_Driver->incrementResetCounter();
|
||||
|
@ -1363,13 +1417,25 @@ void *CVertexBufferHardARB::lock()
|
|||
switch(_MemType)
|
||||
{
|
||||
case CVertexBuffer::AGPPreferred:
|
||||
#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::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;
|
||||
default:
|
||||
nlassert(0);
|
||||
|
@ -1378,7 +1444,11 @@ void *CVertexBufferHardARB::lock()
|
|||
if (glGetError() != GL_NO_ERROR)
|
||||
{
|
||||
_Driver->incrementResetCounter();
|
||||
#ifdef USE_OPENGLES
|
||||
glDeleteBuffers(1, &vertexBufferID);
|
||||
#else
|
||||
nglDeleteBuffersARB(1, &vertexBufferID);
|
||||
#endif
|
||||
return &_DummyVB[0];;
|
||||
}
|
||||
_VertexObjectId = vertexBufferID;
|
||||
|
@ -1394,6 +1464,39 @@ void *CVertexBufferHardARB::lock()
|
|||
beforeLock= CTime::getPerformanceTime();
|
||||
}
|
||||
_Driver->_DriverGLStates.bindARBVertexBuffer(_VertexObjectId);
|
||||
|
||||
#ifdef USE_OPENGLES
|
||||
if (_Driver->_Extensions.OESMapBuffer)
|
||||
{
|
||||
_VertexPtr = nglMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES);
|
||||
if (!_VertexPtr)
|
||||
{
|
||||
nglUnmapBufferOES(GL_ARRAY_BUFFER);
|
||||
nlassert(glIsBuffer(_VertexObjectId));
|
||||
invalidate();
|
||||
return &_DummyVB[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint size = VB->getNumVertices() * VB->getVertexSize();
|
||||
|
||||
if (size > _BufferSize)
|
||||
{
|
||||
if (_Buffer) delete [] _Buffer;
|
||||
|
||||
_Buffer = new uint8[size+3];
|
||||
_BufferSize = size;
|
||||
}
|
||||
|
||||
uint8 offset = (size_t)_Buffer % 4;
|
||||
|
||||
if (offset > 0) offset = 4 - offset;
|
||||
|
||||
_VertexPtr = _Buffer + offset;
|
||||
_LastBufferSize = size;
|
||||
}
|
||||
#else
|
||||
_VertexPtr = nglMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
if (!_VertexPtr)
|
||||
{
|
||||
|
@ -1402,6 +1505,8 @@ void *CVertexBufferHardARB::lock()
|
|||
invalidate();
|
||||
return &_DummyVB[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NL_DEBUG
|
||||
_VertexArrayRange->_MappedVBList.push_front(this);
|
||||
_IteratorInMappedVBList = _VertexArrayRange->_MappedVBList.begin();
|
||||
|
@ -1420,7 +1525,8 @@ void *CVertexBufferHardARB::lock()
|
|||
// ***************************************************************************
|
||||
void CVertexBufferHardARB::unlock()
|
||||
{
|
||||
H_AUTO_OGL(CVertexBufferHardARB_unlock)
|
||||
H_AUTO_OGL(CVertexBufferHardARB_unlock);
|
||||
|
||||
_VertexPtr = NULL;
|
||||
if (_Invalid) return;
|
||||
if (!_VertexObjectId) return;
|
||||
|
@ -1434,7 +1540,17 @@ void CVertexBufferHardARB::unlock()
|
|||
#ifdef NL_DEBUG
|
||||
_Unmapping = true;
|
||||
#endif
|
||||
GLboolean unmapOk = nglUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||
GLboolean unmapOk = false;
|
||||
|
||||
#ifdef USE_OPENGLES
|
||||
if (_Driver->_Extensions.OESMapBuffer)
|
||||
{
|
||||
unmapOk = nglUnmapBufferOES(GL_ARRAY_BUFFER);
|
||||
}
|
||||
#else
|
||||
unmapOk = nglUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||
#endif
|
||||
|
||||
#ifdef NL_DEBUG
|
||||
_Unmapping = false;
|
||||
#endif
|
||||
|
|
|
@ -113,7 +113,7 @@ protected:
|
|||
bool _Invalid;
|
||||
};
|
||||
|
||||
|
||||
#ifndef USE_OPENGLES
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
@ -456,6 +456,8 @@ public:
|
|||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
// ARB_vertex_buffer_object implementation
|
||||
|
@ -553,6 +555,11 @@ private:
|
|||
CVertexArrayRangeARB *_VertexArrayRange;
|
||||
CVertexBuffer::TPreferredMemory _MemType;
|
||||
void *_VertexPtr; // pointer on current datas. Null if not locked
|
||||
#ifdef USE_OPENGLES
|
||||
uint8 *_Buffer;
|
||||
uint32 _BufferSize;
|
||||
uint32 _LastBufferSize;
|
||||
#endif
|
||||
// if buffer has been invalidated, returns a dummy memory block and silently fails rendering
|
||||
std::vector<uint8> _DummyVB;
|
||||
// for use by CVertexArrayRangeARB
|
||||
|
|
|
@ -111,7 +111,7 @@ bool CDriverGL::activeNVVertexProgram (CVertexProgram *program)
|
|||
}
|
||||
|
||||
// Insert into driver list. (so it is deleted when driver is deleted).
|
||||
ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), NULL);
|
||||
ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), (NL3D::IVertexProgramDrvInfos*)NULL);
|
||||
|
||||
// Create a driver info
|
||||
*it = drvInfo = new CVertexProgamDrvInfosGL (this, it);
|
||||
|
@ -309,7 +309,7 @@ static uint convInputRegisterToVBFlag(uint index)
|
|||
// For debugging with swizzling
|
||||
static void doSwizzle(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW)
|
||||
{
|
||||
H_AUTO_OGL(doSwizzle)
|
||||
H_AUTO_OGL(doSwizzle);
|
||||
nglSwizzleEXT(res, in, outX, outY, outZ, outW);
|
||||
#ifdef DEBUG_SETUP_EXT_VERTEX_SHADER
|
||||
std::string swzStr = "Swizzle : ";
|
||||
|
@ -359,7 +359,7 @@ static void doSwizzle(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum ou
|
|||
// Perform write mask and output de bug information
|
||||
static void doWriteMask(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW)
|
||||
{
|
||||
H_AUTO_OGL(doWriteMask)
|
||||
H_AUTO_OGL(doWriteMask);
|
||||
nglWriteMaskEXT(res, in, outX, outY, outZ, outW);
|
||||
#ifdef DEBUG_SETUP_EXT_VERTEX_SHADER
|
||||
nlinfo("3D: Write Mask : %c%c%c%c",
|
||||
|
@ -376,7 +376,7 @@ static void doWriteMask(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum
|
|||
*/
|
||||
bool CDriverGL::setupEXTVertexShader(const CVPParser::TProgram &program, GLuint id, uint variants[EVSNumVariants], uint16 &usedInputRegisters)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_setupEXTVertexShader)
|
||||
H_AUTO_OGL(CDriverGL_setupEXTVertexShader);
|
||||
// counter to see what is generated
|
||||
uint numOp = 0;
|
||||
uint numOpIndex = 0;
|
||||
|
@ -1440,6 +1440,14 @@ bool CDriverGL::setupARBVertexProgram (const CVPParser::TProgram &inParsedProgra
|
|||
nlassert(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef NL_OS_MAC
|
||||
// Wait for GPU to finish program upload, else draw comands might crash.
|
||||
// Happened to CVegetableBlendLayerModel (glDrawElements()).
|
||||
// For more information, see http://dev.ryzom.com/issues/1006
|
||||
glFinish();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1472,7 +1480,7 @@ bool CDriverGL::activeARBVertexProgram (CVertexProgram *program)
|
|||
return false;
|
||||
}
|
||||
// Insert into driver list. (so it is deleted when driver is deleted).
|
||||
ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), NULL);
|
||||
ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), (NL3D::IVertexProgramDrvInfos*)NULL);
|
||||
|
||||
// Create a driver info
|
||||
*it = drvInfo = new CVertexProgamDrvInfosGL (this, it);
|
||||
|
@ -1554,7 +1562,7 @@ bool CDriverGL::activeEXTVertexShader (CVertexProgram *program)
|
|||
*/
|
||||
|
||||
// Insert into driver list. (so it is deleted when driver is deleted).
|
||||
ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), NULL);
|
||||
ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), (NL3D::IVertexProgramDrvInfos*)NULL);
|
||||
|
||||
// Create a driver info
|
||||
*it = drvInfo = new CVertexProgamDrvInfosGL (this, it);
|
||||
|
|
|
@ -374,18 +374,25 @@ bool CDriverGL::init (uint windowIcon, emptyProc exitFunc)
|
|||
}
|
||||
#endif // HAVE_XRENDER
|
||||
|
||||
// list all supported extensions
|
||||
sint nextensions = 0;
|
||||
char **extensions = XListExtensions(_dpy, &nextensions);
|
||||
nldebug("3D: Available X Extensions:");
|
||||
|
||||
std::string exts;
|
||||
if (DebugLog)
|
||||
{
|
||||
// list all supported extensions
|
||||
sint nextensions = 0;
|
||||
char **extensions = XListExtensions(_dpy, &nextensions);
|
||||
|
||||
for(sint i = 0; i < nextensions; ++i)
|
||||
exts += NLMISC::toString(" %s", extensions[i]);
|
||||
for(sint i = 0; i < nextensions; ++i)
|
||||
{
|
||||
if(i%5==0) DebugLog->displayRaw("3D: ");
|
||||
DebugLog->displayRaw(NLMISC::toString("%s ", extensions[i]).c_str());
|
||||
if(i%5==4) DebugLog->displayRaw("\n");
|
||||
}
|
||||
|
||||
XFreeExtensionList(extensions);
|
||||
DebugLog->displayRaw("\n");
|
||||
|
||||
nlinfo("X Extensions:%s", exts.c_str());
|
||||
XFreeExtensionList(extensions);
|
||||
}
|
||||
|
||||
// set default X errors handler
|
||||
XSetErrorHandler(nelXErrorsHandler);
|
||||
|
@ -906,7 +913,6 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
|
|||
_hRC=wglCreateContext(_hDC);
|
||||
|
||||
wglMakeCurrent(_hDC,_hRC);
|
||||
|
||||
}
|
||||
|
||||
/// release old emitter
|
||||
|
@ -929,7 +935,7 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
|
|||
_EventEmitter.addEmitter(diee, true);
|
||||
}
|
||||
}
|
||||
catch(EDirectInput &e)
|
||||
catch(const EDirectInput &e)
|
||||
{
|
||||
nlinfo(e.what());
|
||||
}
|
||||
|
@ -1577,7 +1583,7 @@ bool CDriverGL::destroyWindow()
|
|||
|
||||
#elif defined(NL_OS_MAC)
|
||||
|
||||
if(_DestroyWindow)
|
||||
if (_DestroyWindow)
|
||||
{
|
||||
[[containerView() window] release];
|
||||
[containerView() release];
|
||||
|
@ -2297,7 +2303,7 @@ emptyProc CDriverGL::getWindowProc()
|
|||
// --------------------------------------------------
|
||||
bool CDriverGL::activate()
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_activate)
|
||||
H_AUTO_OGL(CDriverGL_activate);
|
||||
|
||||
if (_win == EmptyWindow)
|
||||
return false;
|
||||
|
@ -2376,11 +2382,15 @@ void CDriverGL::getWindowSize(uint32 &width, uint32 &height)
|
|||
if (_CurrentMode.OffScreen)
|
||||
{
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
#ifndef USE_OPENGLES
|
||||
if (_PBuffer)
|
||||
{
|
||||
nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_WIDTH_ARB, (int*)&width );
|
||||
nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_HEIGHT_ARB, (int*)&height );
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
|
@ -359,7 +359,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
|||
// push the key press event to the event server
|
||||
server->postEvent(new NLMISC::CEventKeyDown(
|
||||
virtualKeycodeToNelKey([event keyCode]),
|
||||
modifierFlagsToNelKeyButton([event modifierFlags]),
|
||||
modifiers,
|
||||
[event isARepeat] == NO, this));
|
||||
|
||||
// if this was a text event
|
||||
|
@ -372,7 +372,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
|||
|
||||
// push the text event to event server as well
|
||||
server->postEvent(new NLMISC::CEventChar(
|
||||
ucstr[0], NLMISC::noKeyButton, this));
|
||||
ucstr[0], modifiers, this));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
|
|||
// push the key release event to the event server
|
||||
server->postEvent(new NLMISC::CEventKeyUp(
|
||||
virtualKeycodeToNelKey([event keyCode]),
|
||||
modifierFlagsToNelKeyButton([event modifierFlags]), this));
|
||||
modifiers, this));
|
||||
break;
|
||||
}
|
||||
case NSFlagsChanged:break;
|
||||
|
|
|
@ -1746,7 +1746,7 @@ void CDriverUser::loadHLSBank(const std::string &fileName)
|
|||
throw EPathNotFound(path);
|
||||
fIn.serial(*hlsBank);
|
||||
}
|
||||
catch(Exception &)
|
||||
catch(const Exception &)
|
||||
{
|
||||
delete hlsBank;
|
||||
throw;
|
||||
|
|
|
@ -109,7 +109,7 @@ CRGBA CFastHLSModifier::convert(uint H, uint L, uint S)
|
|||
return col;
|
||||
}
|
||||
|
||||
#if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
|
||||
#if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
# pragma warning( push )
|
||||
# pragma warning( disable : 4799 )
|
||||
#endif
|
||||
|
@ -262,7 +262,7 @@ uint16 CFastHLSModifier::applyHLSMod(uint16 colorIn, uint8 dHue, uint dLum, uin
|
|||
#pragma managed(pop)
|
||||
#endif
|
||||
|
||||
#if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
|
||||
#if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
# pragma warning( pop )
|
||||
#endif
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ bool CInstanceGroupUser::init (const std::string &instanceGroup, bool async)
|
|||
// Read the class
|
||||
_InstanceGroup.serial (file);
|
||||
}
|
||||
catch (EStream& e)
|
||||
catch (const EStream& e)
|
||||
{
|
||||
// Avoid visual warning
|
||||
EStream ee=e;
|
||||
|
|
|
@ -283,7 +283,7 @@ void CLandscapeUser::refreshZonesAround(const CVector &pos, float radius, std::s
|
|||
{
|
||||
_Landscape->Landscape.checkBinds(Work.Zone->getZoneId());
|
||||
}
|
||||
catch (EBadBind &e)
|
||||
catch (const EBadBind &e)
|
||||
{
|
||||
nlwarning ("Bind error : %s", e.what());
|
||||
nlstopex(("Zone Data Bind Error. Please send a report. You may continue but it should crash!"));
|
||||
|
|
|
@ -1867,7 +1867,7 @@ void CMeshMRMSkinnedGeom::updateRawSkinNormal(bool enabled, CMeshMRMSkinnedInst
|
|||
CIndexBufferReadWrite ibaWrite;
|
||||
skinLod.RdrPass[i].lock (ibaWrite);
|
||||
#ifndef NL_SKINNED_MESH_MRM_INDEX16
|
||||
nlassert(ibaWrite.getFormat() == CIndexBuffer::Indices32)
|
||||
nlassert(ibaWrite.getFormat() == CIndexBuffer::Indices32);
|
||||
uint32 *dstTriPtr= (uint32 *) ibaWrite.getPtr();
|
||||
uint32 numIndices= lod.RdrPass[i].PBlock.size();
|
||||
for(uint j=0;j<numIndices;j++, srcTriPtr++, dstTriPtr++)
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "nel/misc/bit_mem_stream.h"
|
||||
//
|
||||
#include <limits>
|
||||
#include <iterator>
|
||||
//
|
||||
|
||||
|
||||
|
|
|
@ -1291,7 +1291,7 @@ bool CPSConstraintMesh::update(std::vector<sint> *numVertsVect /*= NULL*/)
|
|||
{
|
||||
_ModelBank->load(_MeshShapeFileName[k]);
|
||||
}
|
||||
catch (NLMISC::EPathNotFound &)
|
||||
catch (const NLMISC::EPathNotFound &)
|
||||
{
|
||||
nlwarning("mesh not found : %s; used as a constraint mesh particle", _MeshShapeFileName[k].c_str());
|
||||
// shape not found, so not present in the shape bank -> we create a dummy shape
|
||||
|
@ -2083,8 +2083,9 @@ static void DuplicatePrimitiveBlock(const CIndexBuffer &srcBlock, CIndexBuffer &
|
|||
CIndexBufferReadWrite ibaWrite;
|
||||
destBlock.lock (ibaWrite);
|
||||
|
||||
|
||||
#ifdef NL_FORCE_INDEX_BUFFER_16
|
||||
nlassert(destBlock.getFormat() == CIndexBuffer::Indices16);
|
||||
#endif
|
||||
|
||||
// TMP TMP TMP
|
||||
if (ibaRead.getFormat() == CIndexBuffer::Indices16)
|
||||
|
|
|
@ -93,7 +93,7 @@ bool CShader::loadShaderFile (const char *filename)
|
|||
nlwarning ("Can't open the file %s for reading", _filename.c_str());
|
||||
}
|
||||
}
|
||||
catch (Exception &e)
|
||||
catch (const Exception &e)
|
||||
{
|
||||
nlwarning ("Error while reading %s : %s", _filename.c_str(), e.what());
|
||||
}
|
||||
|
|
|
@ -50,12 +50,12 @@ static inline void GetTextureSize(ITexture *tex, uint &width, uint &height)
|
|||
width = srcWidth;
|
||||
height = srcHeight;
|
||||
}
|
||||
catch (NLMISC::EPathNotFound &e)
|
||||
catch (const NLMISC::EPathNotFound &e)
|
||||
{
|
||||
nlinfo("%s", e.what());
|
||||
width = height = 0;
|
||||
}
|
||||
catch (NLMISC::EStream &e)
|
||||
catch (const NLMISC::EStream &e)
|
||||
{
|
||||
nlinfo("unable to load size from a bitmap ! name = %s", tf->getFileName().c_str());
|
||||
nlinfo("reason = %s", e.what());
|
||||
|
|
|
@ -1573,7 +1573,7 @@ void CTileSet::loadTileVegetableDesc()
|
|||
// load the TileVegetableDesc
|
||||
f.serial(_TileVegetableDesc);
|
||||
}
|
||||
catch(Exception &e)
|
||||
catch(const Exception &e)
|
||||
{
|
||||
nlinfo("Error loading TileVegetableDesc: %s", e.what());
|
||||
}
|
||||
|
|
|
@ -816,7 +816,7 @@ CVegetableShape *CVegetableManager::getVegetableShape(const std::string &shap
|
|||
ret = NULL;
|
||||
}
|
||||
}
|
||||
catch (Exception &e)
|
||||
catch (const Exception &e)
|
||||
{
|
||||
// Warning
|
||||
nlwarning ("CVegetableManager::getVegetableShape error while loading shape file '%s' : '%s'", shape.c_str (), e.what ());
|
||||
|
|
|
@ -844,7 +844,7 @@ void SaveZBuffer (CZoneLighter::CZBuffer &zbuffer, const char *filename)
|
|||
// Save it
|
||||
bitmap.writeJPG (outputZFile, 128);
|
||||
}
|
||||
catch (Exception& except)
|
||||
catch (const Exception& except)
|
||||
{
|
||||
// Error message
|
||||
nlwarning ("ERROR writing %s: %s\n", filename, except.what());
|
||||
|
@ -3080,13 +3080,13 @@ void CZoneLighter::lightWater(CWaterShape &ws, const CMatrix &MT, const CLightDe
|
|||
diffuseTex->writeTGA(of, 24);
|
||||
of.close();
|
||||
}
|
||||
catch (NLMISC::Exception &)
|
||||
catch (const NLMISC::Exception &)
|
||||
{
|
||||
nlwarning("Zone lighter : while lighting a water shape, writing %s failed! ", texFileName.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(NLMISC::Exception &e)
|
||||
catch(const NLMISC::Exception &e)
|
||||
{
|
||||
nlwarning("Water shape lighting failed !");
|
||||
nlwarning(e.what());
|
||||
|
|
|
@ -233,6 +233,7 @@ const CType* CFormElm::getType ()
|
|||
warning (false, "getType", "This node is not an atom.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
bool CFormElm::getValue (string &/* result */, TEval /* evaluate */) const
|
||||
|
|
|
@ -105,7 +105,7 @@ CType *CFormLoader::loadType (const char *filename)
|
|||
type = NULL;
|
||||
}
|
||||
}
|
||||
catch (Exception &e)
|
||||
catch (const Exception &e)
|
||||
{
|
||||
// Output error
|
||||
warning (false, "loadType", "Error while loading the form (%s): %s", filename, e.what());
|
||||
|
@ -179,7 +179,7 @@ CFormDfn *CFormLoader::loadFormDfn (const char *filename, bool forceLoad)
|
|||
_MapFormDfn.erase (lowerStr);
|
||||
}
|
||||
}
|
||||
catch (Exception &e)
|
||||
catch (const Exception &e)
|
||||
{
|
||||
// Output error
|
||||
warning (false, "loadFormDfn", "Error while loading the form (%s): %s", filename, e.what());
|
||||
|
@ -276,7 +276,7 @@ UForm *CFormLoader::loadForm (const char *filename)
|
|||
_MapForm.erase (lowerStr);
|
||||
}
|
||||
}
|
||||
catch (Exception &e)
|
||||
catch (const Exception &e)
|
||||
{
|
||||
// Output error
|
||||
warning (false, "loadForm", "Error while loading the form (%s): %s", filename, e.what());
|
||||
|
|
|
@ -220,7 +220,7 @@ bool CLigoConfig::readPrimitiveClass (const char *_fileName, bool parsePrimitive
|
|||
syntaxError (filename.c_str(), root, "Wrong root node, should be NEL_LIGO_PRIMITIVE_CLASS");
|
||||
}
|
||||
}
|
||||
catch (Exception &e)
|
||||
catch (const Exception &e)
|
||||
{
|
||||
errorMessage ("File read error (%s):%s", filename.c_str(), e.what ());
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ void CZoneBank::debugSaveInit (CZoneBankElement &zbeTmp, const string &fileName)
|
|||
output.init (&fileOut);
|
||||
zbeTmp.serial (output);
|
||||
}
|
||||
catch (Exception& /*e*/)
|
||||
catch (const Exception& /*e*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -541,7 +541,7 @@ bool CZoneBank::addElement (const std::string &elementName, std::string &error)
|
|||
error = "Can't open file " + elementName;
|
||||
}
|
||||
}
|
||||
catch (Exception& e)
|
||||
catch (const Exception& e)
|
||||
{
|
||||
error = "Error while loading ligozone "+elementName+" : "+e.what();
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ bool ICommand::execute (const std::string &commandWithArgs, CLog &log, bool quie
|
|||
{
|
||||
return CCommandRegistry::getInstance().execute(commandWithArgs, log, quiet, human);
|
||||
}
|
||||
catch(exception e)
|
||||
catch(const exception &e)
|
||||
{
|
||||
log.displayNL("Command '%s' thrown an exception :", commandWithArgs.c_str());
|
||||
log.displayNL(e.what());
|
||||
|
|
|
@ -27,7 +27,10 @@ using namespace NLMISC;
|
|||
#define YY_NEVER_INTERACTIVE 1
|
||||
|
||||
#ifdef WIN32
|
||||
#define YY_NO_UNISTD_H 1
|
||||
#include <io.h>
|
||||
#define read _read
|
||||
#define isatty _isatty
|
||||
#endif
|
||||
|
||||
/* Types */
|
||||
|
@ -122,6 +125,12 @@ string \"[^\"\n]*\"
|
|||
if (!cf_Ignore)
|
||||
{
|
||||
cflval.Val.Type = T_STRING;
|
||||
if (strlen(yytext+1) >= sizeof(cflval.Val.String))
|
||||
{
|
||||
strcpy (cflval.Val.String, "");
|
||||
DEBUG_PRINTF("lex: string '%s' exceeds max length\n", yytext);
|
||||
return STRING;
|
||||
}
|
||||
strcpy (cflval.Val.String, yytext+1);
|
||||
cflval.Val.String[strlen(cflval.Val.String)-1] = '\0';
|
||||
DEBUG_PRINTF("lex: string '%s' '%s'\n", yytext, cflval.Val.String);
|
||||
|
@ -133,6 +142,12 @@ string \"[^\"\n]*\"
|
|||
if (!cf_Ignore)
|
||||
{
|
||||
cflval.Val.Type = T_STRING;
|
||||
if (strlen(yytext+1) >= sizeof(cflval.Val.String))
|
||||
{
|
||||
strcpy (cflval.Val.String, "");
|
||||
DEBUG_PRINTF("lex: string '%s' exceeds max length\n", yytext);
|
||||
return VARIABLE;
|
||||
}
|
||||
strcpy (cflval.Val.String, yytext);
|
||||
DEBUG_PRINTF("lex: variable '%s' '%s'\n", yytext, cflval.Val.String);
|
||||
return VARIABLE;
|
||||
|
|
|
@ -832,7 +832,7 @@ void CConfigFile::checkConfigFiles ()
|
|||
{
|
||||
(*it)->reparse ();
|
||||
}
|
||||
catch (EConfigFile &e)
|
||||
catch (const EConfigFile &e)
|
||||
{
|
||||
nlwarning ("CF: Exception will re-read modified config file '%s': %s", (*it)->getFilename().c_str(), e.what ());
|
||||
}
|
||||
|
|
|
@ -969,14 +969,12 @@ void force_exception_frame(...) {std::cout.flush();}
|
|||
static void exceptionTranslator(unsigned, EXCEPTION_POINTERS *pexp)
|
||||
{
|
||||
#ifndef NL_NO_DEBUG_FILES
|
||||
FILE *file = fopen ("exception_catched", "wb");
|
||||
fclose (file);
|
||||
CFile::createEmptyFile(getLogDirectory() + "exception_catched");
|
||||
#endif
|
||||
if (pexp->ExceptionRecord->ExceptionCode == EXCEPTION_BREAKPOINT)
|
||||
{
|
||||
#ifndef NL_NO_DEBUG_FILES
|
||||
FILE *file2 = fopen ("breakpointed", "wb");
|
||||
fclose (file2);
|
||||
CFile::createEmptyFile(getLogDirectory() + "breakpointed");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -1018,7 +1016,7 @@ void getCallStack(std::string &result, sint skipNFirst)
|
|||
array[0] = skipNFirst;
|
||||
RaiseException (0xACE0ACE, 0, 1, array);
|
||||
}
|
||||
catch (EDebug &e)
|
||||
catch (const EDebug &e)
|
||||
{
|
||||
result += e.what();
|
||||
}
|
||||
|
@ -1053,7 +1051,7 @@ void getCallStackAndLog (string &result, sint /* skipNFirst */)
|
|||
// array[0] = skipNFirst;
|
||||
// RaiseException (0xACE0ACE, 0, 1, array);
|
||||
// }
|
||||
// catch (EDebug &e)
|
||||
// catch (const EDebug &e)
|
||||
// {
|
||||
// result += e.what();
|
||||
// }
|
||||
|
@ -1683,12 +1681,18 @@ NLMISC_CATEGORISED_COMMAND(nel, writeaccess, "write a uint8 value in an invalid
|
|||
uint8 val = 123;
|
||||
uint8 *adr = (uint8*)0;
|
||||
if(args.size() >= 1)
|
||||
{
|
||||
#ifdef HAVE_X86_64
|
||||
adr = (uint8*)(uint64)atoi(args[0].c_str());
|
||||
uint64 addr64;
|
||||
NLMISC::fromString(args[0], addr64);
|
||||
adr = (uint8*)addr64;
|
||||
#else
|
||||
adr = (uint8*)atoi(args[0].c_str());
|
||||
uint32 addr32;
|
||||
NLMISC::fromString(args[0], addr32);
|
||||
adr = (uint8*)addr32;
|
||||
#endif
|
||||
if(args.size() >= 2) val = (uint8)atoi(args[1].c_str());
|
||||
}
|
||||
if(args.size() >= 2) NLMISC::fromString(args[1], val);
|
||||
*adr = val;
|
||||
return true;
|
||||
}
|
||||
|
@ -1698,11 +1702,17 @@ NLMISC_CATEGORISED_COMMAND(nel, readaccess, "read a uint8 value in an invalid ad
|
|||
uint8 val;
|
||||
uint8 *adr = (uint8*)0;
|
||||
if(args.size() == 1)
|
||||
{
|
||||
#ifdef HAVE_X86_64
|
||||
adr = (uint8*)(uint64)atoi(args[0].c_str());
|
||||
uint64 addr64;
|
||||
NLMISC::fromString(args[0], addr64);
|
||||
adr = (uint8*)addr64;
|
||||
#else
|
||||
adr = (uint8*)atoi(args[0].c_str());
|
||||
uint32 addr32;
|
||||
NLMISC::fromString(args[0], addr32);
|
||||
adr = (uint8*)addr32;
|
||||
#endif
|
||||
}
|
||||
val = *adr;
|
||||
log.displayNL("value is %hu", (uint16)val);
|
||||
return true;
|
||||
|
|
|
@ -84,7 +84,7 @@ bool loadStringFile(const std::string filename, vector<TStringInfo> &stringInfos
|
|||
buffer = new uint8[size];
|
||||
fp.serialBuffer(buffer, size);
|
||||
}
|
||||
catch(Exception &e)
|
||||
catch(const Exception &e)
|
||||
{
|
||||
nlinfo("Can't open file [%s] (%s)\n", filename.c_str(), e.what());
|
||||
return true;
|
||||
|
|
|
@ -120,7 +120,7 @@ void IDisplayer::display ( const CLog::TDisplayInfo& args, const char *message )
|
|||
{
|
||||
doDisplay( args, message );
|
||||
}
|
||||
catch (Exception &)
|
||||
catch (const Exception &)
|
||||
{
|
||||
// silence
|
||||
}
|
||||
|
|
|
@ -365,7 +365,7 @@ void CIFile::getline (char *buffer, uint32 bufferSize)
|
|||
// read one byte
|
||||
serialBuffer ((uint8 *)buffer, 1);
|
||||
}
|
||||
catch (EFile &)
|
||||
catch (const EFile &)
|
||||
{
|
||||
*buffer = '\0';
|
||||
return;
|
||||
|
|
|
@ -419,7 +419,7 @@ namespace NLMISC
|
|||
}
|
||||
}
|
||||
}
|
||||
catch(EStream &)
|
||||
catch(const EStream &)
|
||||
{
|
||||
nlwarning("CInterWindowMsgQueue : Bad message format in inter window communication");
|
||||
}
|
||||
|
|
|
@ -187,6 +187,77 @@ CHashKey getSHA1(const string &filename, bool forcePath)
|
|||
return hk;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* HMAC = hash( (Key ^ 0x5c) .. hash( (Key ^0x36) .. Message ) )
|
||||
*
|
||||
*/
|
||||
|
||||
CHashKey getHMacSHA1(const uint8 *text, uint32 text_len, const uint8 *key, uint32 key_len)
|
||||
{
|
||||
SHA1Context sha;
|
||||
|
||||
uint8_t SHA1_Key[64];
|
||||
uint8_t SHA1_Key1[20];
|
||||
uint8_t SHA1_Key2[20];
|
||||
|
||||
string buffer1;
|
||||
string buffer2;
|
||||
|
||||
// Init some vars
|
||||
for (uint i = 0; i < 64; i++)
|
||||
SHA1_Key[i] = 0;
|
||||
|
||||
// If lenght of key > 64 use sha1 hash
|
||||
if (key_len > 64) {
|
||||
uint8_t SHA1_Key0[20];
|
||||
SHA1Reset(&sha);
|
||||
SHA1Input(&sha, (const uint8_t*)key, key_len);
|
||||
SHA1Result(&sha, SHA1_Key0);
|
||||
CHashKey hk0 (SHA1_Key0);
|
||||
for (uint i = 0; i < 20; i++)
|
||||
SHA1_Key[i] = hk0.HashKeyString[i];
|
||||
} else {
|
||||
for (uint i = 0; i < key_len; i++)
|
||||
SHA1_Key[i] = key[i];
|
||||
}
|
||||
|
||||
// Do 0x36 XOR Key
|
||||
for (uint i = 0; i < 64; i++)
|
||||
buffer1 += 0x36 ^ SHA1_Key[i];
|
||||
|
||||
// Append text
|
||||
for (uint i = 0; i < text_len; i++)
|
||||
buffer1 += text[i];
|
||||
|
||||
// Get hash
|
||||
SHA1Reset(&sha);
|
||||
SHA1Input(&sha, (const uint8_t*)buffer1.c_str(), (uint)buffer1.size());
|
||||
SHA1Result(&sha, SHA1_Key1);
|
||||
CHashKey hk1 (SHA1_Key1);
|
||||
|
||||
// Do 0x5c XOR Key
|
||||
for (uint i = 0; i < 64; i++)
|
||||
buffer2 += 0x5c ^ SHA1_Key[i];
|
||||
|
||||
// Append previous hash
|
||||
for (uint i = 0; i < 20; i++)
|
||||
buffer2 += hk1.HashKeyString[i];
|
||||
|
||||
// Get new hash
|
||||
SHA1Reset(&sha);
|
||||
SHA1Input(&sha, (const uint8_t*)buffer2.c_str(), (uint)buffer2.size());
|
||||
SHA1Result(&sha, SHA1_Key2);
|
||||
CHashKey hk (SHA1_Key2);
|
||||
|
||||
return hk;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _MFC_VER
|
||||
#pragma runtime_checks( "", off )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define the SHA1 circular left shift macro
|
||||
*/
|
||||
|
|
|
@ -36,8 +36,8 @@ namespace NLMISC {
|
|||
// Storage for file handles, necessary to close the handles
|
||||
map<void*,HANDLE> AccessAddressesToHandles;
|
||||
#else
|
||||
// Storage for shmid, necessary to destroy the segments
|
||||
map<TSharedMemId, int> SharedMemIdsToShmids;
|
||||
// Storage for shmid, necessary to destroy the segments
|
||||
map<TSharedMemId, sint> SharedMemIdsToShmids;
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -71,7 +71,7 @@ void *CSharedMemory::createSharedMemory( TSharedMemId sharedMemId, uint32 size
|
|||
#else
|
||||
|
||||
// Create a shared memory segment
|
||||
int shmid = shmget( sharedMemId, size, IPC_CREAT | IPC_EXCL | 0666 );
|
||||
sint shmid = shmget( sharedMemId, size, IPC_CREAT | IPC_EXCL | 0666 );
|
||||
if ( shmid == -1 )
|
||||
return NULL;
|
||||
SharedMemIdsToShmids.insert( make_pair( sharedMemId, shmid ) );
|
||||
|
@ -82,6 +82,7 @@ void *CSharedMemory::createSharedMemory( TSharedMemId sharedMemId, uint32 size
|
|||
return NULL;
|
||||
else
|
||||
return accessAddress;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -66,15 +66,20 @@ namespace NLMISC {
|
|||
vector<string> splitted;
|
||||
explode(string(buffer), string("\n"), splitted, true);
|
||||
|
||||
std::string value;
|
||||
|
||||
for(uint32 i = 0; i < splitted.size(); i++)
|
||||
{
|
||||
vector<string> sline;
|
||||
explode(splitted[i], string(":"), sline, true);
|
||||
if(sline.size() == 2 && trim(sline[0]) == colname)
|
||||
{
|
||||
return trim(sline[1]);
|
||||
value = sline[1];
|
||||
}
|
||||
}
|
||||
|
||||
if (!value.empty())
|
||||
return trim(value);
|
||||
}
|
||||
nlwarning ("SI: Can't find the colname '%s' in /proc/cpuinfo", colname.c_str());
|
||||
return "";
|
||||
|
@ -549,7 +554,7 @@ string CSystemInfo::getOS()
|
|||
{
|
||||
OSString += " Professional";
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
|
||||
OSString += " Datacenter Server";
|
||||
|
@ -805,6 +810,9 @@ string CSystemInfo::getProc ()
|
|||
|
||||
#elif defined NL_OS_UNIX
|
||||
|
||||
uint processors = 0;
|
||||
if (fromString(getCpuInfo("processor"), processors)) ++processors;
|
||||
|
||||
ProcString = getCpuInfo("model name");
|
||||
ProcString += " / ?";
|
||||
ProcString += " Family " + getCpuInfo("cpu family");
|
||||
|
@ -815,7 +823,7 @@ string CSystemInfo::getProc ()
|
|||
ProcString += " / ";
|
||||
ProcString += getCpuInfo("cpu MHz")+"MHz";
|
||||
ProcString += " / ";
|
||||
ProcString += "? Processors found";
|
||||
ProcString += toString("%u Processors found", processors);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ bool CWordsDictionary::init( const string& configFileName )
|
|||
cf.load( configFileName );
|
||||
cfFound = true;
|
||||
}
|
||||
catch ( EConfigFile& e )
|
||||
catch (const EConfigFile &e)
|
||||
{
|
||||
nlwarning( "WD: %s", e.what() );
|
||||
}
|
||||
|
|
|
@ -451,7 +451,7 @@ void CClientReceiveTask::run()
|
|||
|
||||
NbLoop++;
|
||||
}
|
||||
catch ( ESocket& )
|
||||
catch (const ESocket&)
|
||||
{
|
||||
LNETL1_DEBUG( "LNETL1: Client connection %s broken", sockId()->asString().c_str() );
|
||||
sockId()->Sock->disconnect();
|
||||
|
|
|
@ -829,7 +829,7 @@ void CListenTask::run()
|
|||
|
||||
NbLoop++;
|
||||
}
|
||||
catch ( ESocket& e )
|
||||
catch (const ESocket &e)
|
||||
{
|
||||
LNETL1_INFO( "LNETL1: Exception in listen thread: %s", e.what() );
|
||||
// It can occur when too many sockets are open (e.g. 885 connections)
|
||||
|
@ -1131,12 +1131,12 @@ void CServerReceiveTask::run()
|
|||
*/
|
||||
}
|
||||
}
|
||||
// catch ( ESocketConnectionClosed& )
|
||||
// catch (const ESocketConnectionClosed&)
|
||||
// {
|
||||
// LNETL1_DEBUG( "LNETL1: Connection %s closed", serverbufsock->asString().c_str() );
|
||||
// // The socket went to _Connected=false when throwing the exception
|
||||
// }
|
||||
catch ( ESocket& )
|
||||
catch (const ESocket&)
|
||||
{
|
||||
LNETL1_DEBUG( "LNETL1: Connection %s broken", serverbufsock->asString().c_str() );
|
||||
(*ic)->Sock->disconnect();
|
||||
|
|
|
@ -280,7 +280,7 @@ void CCallbackClient::connect( const CInetAddress& addr )
|
|||
_MR_Recorder.recordNext( _MR_UpdateCounter, Connecting, _BufSock, addrmsg );
|
||||
}
|
||||
}
|
||||
catch ( ESocketConnectionFailed& )
|
||||
catch (const ESocketConnectionFailed&)
|
||||
{
|
||||
if ( _MR_RecordingState == Record )
|
||||
{
|
||||
|
|
|
@ -155,7 +155,7 @@ void CCallbackNetBase::processOneMessage ()
|
|||
{
|
||||
receive (msgin, &tsid);
|
||||
}
|
||||
catch (Exception &e)
|
||||
catch (const Exception &e)
|
||||
{
|
||||
nlwarning(e.what());
|
||||
return;
|
||||
|
|
|
@ -330,7 +330,7 @@ bool sendEmail (const string &smtpServer, const string &from, const string &to,
|
|||
ok = true;
|
||||
}
|
||||
}
|
||||
catch (Exception &e)
|
||||
catch (const Exception &e)
|
||||
{
|
||||
nlwarning ("EMAIL: Can't send email: %s", e.what());
|
||||
goto end;
|
||||
|
|
|
@ -146,7 +146,7 @@ string CLoginClient::authenticateBegin(const string &loginServiceAddr, const ucs
|
|||
_LSCallbackClient->disconnect();
|
||||
_LSCallbackClient->connect (CInetAddress(addr));
|
||||
}
|
||||
catch (ESocket &e)
|
||||
catch (const ESocket &e)
|
||||
{
|
||||
delete _LSCallbackClient;
|
||||
_LSCallbackClient = 0;
|
||||
|
@ -226,7 +226,7 @@ string CLoginClient::connectToShard(CLoginCookie &lc, const std::string &addr, C
|
|||
// have we received the answer?
|
||||
if (!ShardValidate) return "FES disconnect me";
|
||||
}
|
||||
catch (ESocket &e)
|
||||
catch (const ESocket &e)
|
||||
{
|
||||
return string("FES refused the connection (") + e.what () + ")";
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ string CLoginClient::connectToShard (const std::string &addr, CUdpSock &cnx)
|
|||
//
|
||||
cnx.connect (CInetAddress(addr));
|
||||
}
|
||||
catch (ESocket &e)
|
||||
catch (const ESocket &e)
|
||||
{
|
||||
return string("FES refused the connection (") + e.what () + ")";
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ string CLoginClient::connectToShard (const std::string &addr, CUdpSimSock &cnx)
|
|||
//
|
||||
cnx.connect (CInetAddress(addr));
|
||||
}
|
||||
catch (ESocket &e)
|
||||
catch (const ESocket &e)
|
||||
{
|
||||
return string("FES refused the connection (") + e.what () + ")";
|
||||
}
|
||||
|
|
|
@ -349,17 +349,17 @@ void CLoginServer::init (const string &listenAddress)
|
|||
try {
|
||||
cfcbDefaultUserPriv(IService::getInstance()->ConfigFile.getVar("DefaultUserPriv"));
|
||||
IService::getInstance()->ConfigFile.setCallback("DefaultUserPriv", cfcbDefaultUserPriv);
|
||||
} catch(Exception &) { }
|
||||
} catch(const Exception &) { }
|
||||
|
||||
try {
|
||||
cfcbAcceptInvalidCookie (IService::getInstance()->ConfigFile.getVar("AcceptInvalidCookie"));
|
||||
IService::getInstance()->ConfigFile.setCallback("AcceptInvalidCookie", cfcbAcceptInvalidCookie);
|
||||
} catch(Exception &) { }
|
||||
} catch(const Exception &) { }
|
||||
|
||||
try {
|
||||
cfcbTimeBeforeEraseCookie (IService::getInstance()->ConfigFile.getVar("TimeBeforeEraseCookie"));
|
||||
IService::getInstance()->ConfigFile.setCallback("TimeBeforeEraseCookie", cfcbTimeBeforeEraseCookie);
|
||||
} catch(Exception &) { }
|
||||
} catch(const Exception &) { }
|
||||
|
||||
// setup the listen address
|
||||
|
||||
|
|
|
@ -330,7 +330,7 @@ namespace NLNET
|
|||
_onProcessModuleMessage(currentSender, currentMessage);
|
||||
_CurrentMessageFailed = false;
|
||||
}
|
||||
catch (NLMISC::Exception e)
|
||||
catch (const NLMISC::Exception &e)
|
||||
{
|
||||
nlwarning("In module task '%s' (cotask message receiver), exception '%e' thrown", typeid(this).name(), e.what());
|
||||
// an exception have been thrown
|
||||
|
|
|
@ -109,7 +109,7 @@ namespace NLNET
|
|||
sd->serial(s);
|
||||
}
|
||||
}
|
||||
catch(EStreamOverflow e)
|
||||
catch(const EStreamOverflow &)
|
||||
{
|
||||
// FAILED to read the security block, rewind to old pos and serial as unknow
|
||||
nlwarning("Error while reading stream for security data type %u", dataTag);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue