diff --git a/.hgignore b/.hgignore index 9fb922bbb..42cd85ac7 100644 --- a/.hgignore +++ b/.hgignore @@ -199,6 +199,16 @@ code/nel/tools/pacs/build_rbank/build_rbank code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/skills.skill_tree code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/xptable.xp_table code/ryzom/tools/server/sql/ryzom_admin_default_data.sql +code/ryzom/tools/server/ryzom_ams/drupal +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/autoload +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/configs +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/cron +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/img +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/plugins +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/smarty +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/translations +code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/libinclude.php +code/ryzom/tools/server/ryzom_ams/www/html/templates_c # Linux server compile code/ryzom/server/src/entities_game_service/entities_game_service @@ -210,6 +220,6 @@ code/ryzom/server/src/ryzom_admin_service/ryzom_admin_service code/ryzom/server/src/ryzom_naming_service/ryzom_naming_service code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service code/ryzom/server/src/tick_service/tick_service -# WebTT temp dir +# WebTT temp dir code/ryzom/tools/server/www/webtt/app/tmp -code\ryzom\tools\server\ryzom_ams\old \ No newline at end of file +code\ryzom\tools\server\ryzom_ams\old diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 0cd9afd54..926d28345 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -106,7 +106,6 @@ IF(WIN32) ENDIF(WITH_MFC) ENDIF(WIN32) -FIND_PACKAGE(Threads REQUIRED) FIND_PACKAGE(LibXml2 REQUIRED) FIND_PACKAGE(PNG REQUIRED) FIND_PACKAGE(Jpeg) @@ -114,6 +113,7 @@ FIND_PACKAGE(Jpeg) IF(WITH_STATIC_LIBXML2) SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC) ENDIF(WITH_STATIC_LIBXML2) + IF(WITH_STATIC) # libxml2 could need winsock2 library SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB}) @@ -134,7 +134,7 @@ IF(FINAL_VERSION) ENDIF(FINAL_VERSION) IF(WITH_QT) - FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml REQUIRED) + FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED) ENDIF(WITH_QT) IF(WITH_NEL) @@ -144,6 +144,31 @@ IF(WITH_NEL) IF(WITH_GUI) FIND_PACKAGE(Libwww REQUIRED) + FIND_PACKAGE(Luabind REQUIRED) + FIND_PACKAGE(CURL REQUIRED) + + IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") + SET(CURL_STATIC ON) + ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") + + IF(CURL_STATIC) + SET(CURL_DEFINITIONS -DCURL_STATICLIB) + + FIND_PACKAGE(OpenSSL QUIET) + + IF(OPENSSL_FOUND) + SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}) + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) + ENDIF(OPENSSL_FOUND) + + # CURL Macports version depends on libidn, libintl and libiconv too + IF(APPLE) + FIND_LIBRARY(IDN_LIBRARY idn) + FIND_LIBRARY(INTL_LIBRARY intl) + + SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY}) + ENDIF(APPLE) + ENDIF(CURL_STATIC) ENDIF(WITH_GUI) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR}) diff --git a/code/CMakeModules/AndroidToolChain.cmake b/code/CMakeModules/AndroidToolChain.cmake new file mode 100644 index 000000000..049c39adf --- /dev/null +++ b/code/CMakeModules/AndroidToolChain.cmake @@ -0,0 +1,149 @@ +IF(DEFINED CMAKE_CROSSCOMPILING) + # subsequent toolchain loading is not really needed + RETURN() +ENDIF() + +# Standard settings +SET(CMAKE_SYSTEM_NAME Linux) +SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Linux version +SET(UNIX ON) +SET(LINUX ON) +SET(ANDROID ON) + +IF(NOT NDK_ROOT) + SET(NDK_ROOT $ENV{NDK_ROOT}) + + IF(CMAKE_HOST_WIN32) + FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT) + ENDIF(CMAKE_HOST_WIN32) +ENDIF(NOT NDK_ROOT) + +IF(NOT TARGET_CPU) + SET(TARGET_CPU "armv7") +ENDIF(NOT TARGET_CPU) + +IF(TARGET_CPU STREQUAL "armv7") + SET(LIBRARY_ARCHITECTURE "armeabi-v7a") + SET(CMAKE_SYSTEM_PROCESSOR "armv7") + SET(TOOLCHAIN_ARCH "arm") + SET(TOOLCHAIN_PREFIX "arm-linux-androideabi") + SET(TOOLCHAIN_BIN_PREFIX "arm") + SET(MINIMUM_NDK_TARGET 4) +ELSEIF(TARGET_CPU STREQUAL "armv5") + SET(LIBRARY_ARCHITECTURE "armeabi") + SET(CMAKE_SYSTEM_PROCESSOR "armv5") + SET(TOOLCHAIN_ARCH "arm") + SET(TOOLCHAIN_PREFIX "arm-linux-androideabi") + SET(TOOLCHAIN_BIN_PREFIX "arm") + SET(MINIMUM_NDK_TARGET 4) +ELSEIF(TARGET_CPU STREQUAL "x86") + SET(LIBRARY_ARCHITECTURE "x86") + SET(CMAKE_SYSTEM_PROCESSOR "x86") + SET(TOOLCHAIN_ARCH "x86") + SET(TOOLCHAIN_PREFIX "x86") + SET(TOOLCHAIN_BIN_PREFIX "i686") + SET(MINIMUM_NDK_TARGET 9) +ELSEIF(TARGET_CPU STREQUAL "mips") + SET(LIBRARY_ARCHITECTURE "mips") + SET(CMAKE_SYSTEM_PROCESSOR "mips") + SET(TOOLCHAIN_ARCH "mips") + SET(TOOLCHAIN_PREFIX "mipsel-linux-android") + SET(TOOLCHAIN_BIN_PREFIX "mipsel") + SET(MINIMUM_NDK_TARGET 9) +ENDIF(TARGET_CPU STREQUAL "armv7") + +IF(NOT NDK_TARGET) + SET(NDK_TARGET ${MINIMUM_NDK_TARGET}) +ENDIF(NOT NDK_TARGET) + +FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-*") +IF(_TOOLCHAIN_VERSIONS) + LIST(SORT _TOOLCHAIN_VERSIONS) + LIST(REVERSE _TOOLCHAIN_VERSIONS) + FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS}) + STRING(REGEX REPLACE ".+${TOOLCHAIN_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}") + IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$") + LIST(APPEND NDK_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION}) + ENDIF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$") + ENDFOREACH(_TOOLCHAIN_VERSION) +ENDIF(_TOOLCHAIN_VERSIONS) + +IF(NOT NDK_TOOLCHAIN_VERSIONS) + MESSAGE(FATAL_ERROR "No Android toolchain found in default search path ${NDK_ROOT}/toolchains") +ENDIF(NOT NDK_TOOLCHAIN_VERSIONS) + +IF(NDK_TOOLCHAIN_VERSION) + LIST(FIND NDK_TOOLCHAIN_VERSIONS "${NDK_TOOLCHAIN_VERSION}" _INDEX) + IF(_INDEX EQUAL -1) + LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION) + ENDIF(_INDEX EQUAL -1) +ELSE(NDK_TOOLCHAIN_VERSION) + LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION) +ENDIF(NDK_TOOLCHAIN_VERSION) + +MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${NDK_TOOLCHAIN_VERSION}") + +IF(CMAKE_HOST_WIN32) + SET(TOOLCHAIN_HOST "windows") + SET(TOOLCHAIN_BIN_SUFFIX ".exe") +ELSEIF(CMAKE_HOST_APPLE) + SET(TOOLCHAIN_HOST "apple") + SET(TOOLCHAIN_BIN_SUFFIX "") +ELSEIF(CMAKE_HOST_UNIX) + SET(TOOLCHAIN_HOST "linux") + SET(TOOLCHAIN_BIN_SUFFIX "") +ENDIF(CMAKE_HOST_WIN32) + +SET(TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-${NDK_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}") +SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}") + +IF(NOT EXISTS "${TOOLCHAIN_ROOT}") + FILE(GLOB _TOOLCHAIN_PREFIXES "${TOOLCHAIN_ROOT}*") + IF(_TOOLCHAIN_PREFIXES) + LIST(GET _TOOLCHAIN_PREFIXES 0 TOOLCHAIN_ROOT) + ENDIF(_TOOLCHAIN_PREFIXES) +ENDIF(NOT EXISTS "${TOOLCHAIN_ROOT}") + +MESSAGE(STATUS "Found Android toolchain in ${TOOLCHAIN_ROOT}") +MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}") + +# include dirs +SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include") +SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++") + +IF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}") + # NDK version >= 8b + SET(STL_DIR "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}") +ENDIF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}") + +# Determine bin prefix for toolchain +FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}") +IF(_TOOLCHAIN_BIN_PREFIXES) + LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX) + STRING(REGEX REPLACE "${TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}") +ENDIF(_TOOLCHAIN_BIN_PREFIXES) + +SET(STL_INCLUDE_DIR "${STL_DIR}/include") +SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}") +SET(STL_INCLUDE_CPU_DIR "${STL_LIBRARY_DIR}/include") +SET(STL_LIBRARY "${STL_LIBRARY_DIR}/libgnustl_static.a") + +SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root") + +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +INCLUDE_DIRECTORIES(${STL_INCLUDE_DIR} ${STL_INCLUDE_CPU_DIR}) + +MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY) + SET(${_NAME} ${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX}) +ENDMACRO(SET_TOOLCHAIN_BINARY) + +SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc) +SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++) + +# Force the compilers to GCC for Android +include (CMakeForceCompiler) +CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU) +CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU) diff --git a/code/CMakeModules/FindCustomMFC.cmake b/code/CMakeModules/FindCustomMFC.cmake index 7dd87c15f..6f2f163d3 100644 --- a/code/CMakeModules/FindCustomMFC.cmake +++ b/code/CMakeModules/FindCustomMFC.cmake @@ -4,42 +4,35 @@ # MFC_LIBRARY_DIR, where to find libraries # MFC_INCLUDE_DIR, where to find headers +IF(CustomMFC_FIND_REQUIRED) + SET(MFC_FIND_REQUIRED TRUE) +ENDIF(CustomMFC_FIND_REQUIRED) + # Try to find MFC using official module, MFC_FOUND is set FIND_PACKAGE(MFC) -SET(CUSTOM_MFC_DIR FALSE) +IF(NOT MFC_DIR) + # If MFC have been found, remember their directory + IF(MFC_FOUND AND VC_DIR) + SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc") + ENDIF(MFC_FOUND AND VC_DIR) -# If using STLport and MFC have been found, remember its directory -IF(WITH_STLPORT AND MFC_FOUND AND VC_DIR) - SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc") -ENDIF(WITH_STLPORT AND MFC_FOUND AND VC_DIR) - -# If using STLport or MFC haven't been found, search for afxwin.h -IF(WITH_STLPORT OR NOT MFC_FOUND) FIND_PATH(MFC_DIR include/afxwin.h - PATHS + HINTS ${MFC_STANDARD_DIR} ) +ENDIF(NOT MFC_DIR) - IF(CustomMFC_FIND_REQUIRED) - SET(MFC_FIND_REQUIRED TRUE) - ENDIF(CustomMFC_FIND_REQUIRED) +# Display an error message if MFC are not found, MFC_FOUND is updated +# User will be able to update MFC_DIR to the correct directory +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR) - # Display an error message if MFC are not found, MFC_FOUND is updated - # User will be able to update MFC_DIR to the correct directory - INCLUDE(FindPackageHandleStandardArgs) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR) +IF(MFC_FOUND) + SET(MFC_INCLUDE_DIR "${MFC_DIR}/include") + INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR}) - IF(MFC_FOUND) - SET(CUSTOM_MFC_DIR TRUE) - SET(MFC_INCLUDE_DIR "${MFC_DIR}/include") - INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR}) - ENDIF(MFC_FOUND) -ENDIF(WITH_STLPORT OR NOT MFC_FOUND) - -# Only if using a custom path -IF(CUSTOM_MFC_DIR) # Using 32 or 64 bits libraries IF(TARGET_X64) SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64") @@ -49,9 +42,7 @@ IF(CUSTOM_MFC_DIR) # Add MFC libraries directory to default library path LINK_DIRECTORIES(${MFC_LIBRARY_DIR}) -ENDIF(CUSTOM_MFC_DIR) -IF(MFC_FOUND) # Set definitions for using MFC in DLL SET(MFC_DEFINITIONS -D_AFXDLL) ENDIF(MFC_FOUND) diff --git a/code/CMakeModules/FindDInput.cmake b/code/CMakeModules/FindDInput.cmake deleted file mode 100644 index 100650652..000000000 --- a/code/CMakeModules/FindDInput.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# - Find DirectInput -# Find the DirectSound includes and libraries -# -# DINPUT_INCLUDE_DIR - where to find dinput.h -# DINPUT_LIBRARIES - List of libraries when using DirectInput. -# DINPUT_FOUND - True if DirectInput found. - -if(DINPUT_INCLUDE_DIR) - # Already in cache, be silent - set(DINPUT_FIND_QUIETLY TRUE) -endif(DINPUT_INCLUDE_DIR) - -find_path(DINPUT_INCLUDE_DIR dinput.h - "$ENV{DXSDK_DIR}" - "$ENV{DXSDK_DIR}/Include" -) - -find_library(DINPUT_LIBRARY - NAMES dinput dinput8 - PATHS - "$ENV{DXSDK_DIR}" - "$ENV{DXSDK_DIR}/Lib" - "$ENV{DXSDK_DIR}/Lib/x86" -) - -# Handle the QUIETLY and REQUIRED arguments and set DINPUT_FOUND to TRUE if -# all listed variables are TRUE. -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(DINPUT DEFAULT_MSG - DINPUT_INCLUDE_DIR DINPUT_LIBRARY) - -if(DINPUT_FOUND) - set(DINPUT_LIBRARIES ${DINPUT_LIBRARY}) -else(DINPUT_FOUND) - set(DINPUT_LIBRARIES) -endif(DINPUT_FOUND) - -mark_as_advanced(DINPUT_INCLUDE_DIR DINPUT_LIBRARY) diff --git a/code/CMakeModules/FindDirectXSDK.cmake b/code/CMakeModules/FindDirectXSDK.cmake index 9947778db..dc6753a8b 100644 --- a/code/CMakeModules/FindDirectXSDK.cmake +++ b/code/CMakeModules/FindDirectXSDK.cmake @@ -6,8 +6,8 @@ # DXSDK_FOUND - True if MAX SDK found. IF(DXSDK_DIR) - # Already in cache, be silent - SET(DXSDK_FIND_QUIETLY TRUE) + # Already in cache, be silent + SET(DXSDK_FIND_QUIETLY TRUE) ENDIF(DXSDK_DIR) FIND_PATH(DXSDK_DIR @@ -26,10 +26,10 @@ FIND_PATH(DXSDK_DIR MACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME) FIND_LIBRARY(${MYLIBRARY} - NAMES ${MYLIBRARYNAME} - PATHS - "${DXSDK_LIBRARY_DIR}" - ) + NAMES ${MYLIBRARYNAME} + PATHS + "${DXSDK_LIBRARY_DIR}" + ) ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME) IF(DXSDK_DIR) diff --git a/code/CMakeModules/FindFreeType.cmake b/code/CMakeModules/FindFreeType.cmake index 4f3c84cbe..68a3ccdbd 100644 --- a/code/CMakeModules/FindFreeType.cmake +++ b/code/CMakeModules/FindFreeType.cmake @@ -1,14 +1,13 @@ # - Locate FreeType library # This module defines -# FREETYPE_LIBRARY, the library to link against +# FREETYPE_LIBRARIES, libraries to link against # FREETYPE_FOUND, if false, do not try to link to FREETYPE # FREETYPE_INCLUDE_DIRS, where to find headers. -IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) +IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS) # in cache already - SET(FREETYPE_FIND_QUIETLY TRUE) -ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) - + SET(Freetype_FIND_QUIETLY TRUE) +ENDIF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS) FIND_PATH(FREETYPE_INCLUDE_DIRS freetype @@ -40,7 +39,7 @@ IF(FREETYPE_ADDITIONAL_INCLUDE_DIR) SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_ADDITIONAL_INCLUDE_DIR}) ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR) -FIND_LIBRARY(FREETYPE_LIBRARY +FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE NAMES freetype libfreetype freetype219 freetype246 PATHS $ENV{FREETYPE_DIR}/lib @@ -53,22 +52,54 @@ FIND_LIBRARY(FREETYPE_LIBRARY /opt/csw/lib /opt/lib /usr/freeware/lib64 + /usr/lib/x86_64-linux-gnu ) -IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) - SET(FREETYPE_FOUND "YES") +FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG + NAMES freetyped libfreetyped freetype219d freetype246d + PATHS + $ENV{FREETYPE_DIR}/lib + /usr/local/lib + /usr/lib + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 + /usr/lib/x86_64-linux-gnu +) + +IF(FREETYPE_INCLUDE_DIRS) + IF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG) + # Case where both Release and Debug versions are provided + SET(FREETYPE_FOUND ON) + SET(FREETYPE_LIBRARIES optimized ${FREETYPE_LIBRARY_RELEASE} debug ${FREETYPE_LIBRARY_DEBUG}) + ELSEIF(FREETYPE_LIBRARY_RELEASE) + # Normal case + SET(FREETYPE_FOUND ON) + SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_RELEASE}) + ELSEIF(FREETYPE_LIBRARY_DEBUG) + # Case where Freetype is compiled from sources (debug version is compiled by default) + SET(FREETYPE_FOUND ON) + SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_DEBUG}) + ENDIF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG) +ENDIF(FREETYPE_INCLUDE_DIRS) + +IF(FREETYPE_FOUND) IF(WITH_STATIC_EXTERNAL AND APPLE) FIND_PACKAGE(BZip2) IF(BZIP2_FOUND) SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR}) - SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARY} ${BZIP2_LIBRARIES}) + SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES}) ENDIF(BZIP2_FOUND) ENDIF(WITH_STATIC_EXTERNAL AND APPLE) - IF(NOT FREETYPE_FIND_QUIETLY) - MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARY}") - ENDIF(NOT FREETYPE_FIND_QUIETLY) + IF(NOT Freetype_FIND_QUIETLY) + MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARIES}") + ENDIF(NOT Freetype_FIND_QUIETLY) ELSE(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) - IF(NOT FREETYPE_FIND_QUIETLY) + IF(NOT Freetype_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find FreeType!") - ENDIF(NOT FREETYPE_FIND_QUIETLY) -ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS) + ENDIF(NOT Freetype_FIND_QUIETLY) +ENDIF(FREETYPE_FOUND) diff --git a/code/CMakeModules/FindLibOVR.cmake b/code/CMakeModules/FindLibOVR.cmake new file mode 100644 index 000000000..1403a4b2c --- /dev/null +++ b/code/CMakeModules/FindLibOVR.cmake @@ -0,0 +1,70 @@ +# - Locate LibOVR library +# This module defines +# LIBOVR_LIBRARIES, the libraries to link against +# LIBOVR_FOUND, if false, do not try to link to LIBOVR +# LIBOVR_INCLUDE_DIR, where to find headers. + +IF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR) + # in cache already + SET(LIBOVR_FIND_QUIETLY TRUE) +ENDIF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR) + +FIND_PATH(LIBOVR_INCLUDE_DIR + OVR.h + PATHS + $ENV{LIBOVR_DIR}/Include + /usr/local/include + /usr/include + /sw/include + /opt/local/include + /opt/csw/include + /opt/include +) + +IF(UNIX) + IF(TARGET_X64) + SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/x86_64") + ELSE(TARGET_X64) + SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/i386") + ENDIF(TARGET_X64) +ELSEIF(APPLE) + SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/MacOS/Release") +ELSEIF(WIN32) + IF(TARGET_X64) + SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/x64") + ELSE(TARGET_X64) + SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Win32") + ENDIF(TARGET_X64) +ENDIF(UNIX) + +FIND_LIBRARY(LIBOVR_LIBRARY + NAMES ovr + PATHS + $ENV{LIBOVR_DIR}/${LIBOVR_LIBRARY_BUILD_PATH} + /usr/local/lib + /usr/lib + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 +) + +IF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR) + IF(NOT LIBOVR_FIND_QUIETLY) + MESSAGE(STATUS "Found LibOVR: ${LIBOVR_LIBRARY}") + ENDIF(NOT LIBOVR_FIND_QUIETLY) + SET(LIBOVR_FOUND "YES") + SET(LIBOVR_DEFINITIONS "-DHAVE_LIBOVR") + IF(UNIX) + SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY} X11 Xinerama udev pthread) + ELSE(UNIX) + SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY}) + ENDIF(UNIX) +ELSE(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR) + IF(NOT LIBOVR_FIND_QUIETLY) + MESSAGE(STATUS "Warning: Unable to find LibOVR!") + ENDIF(NOT LIBOVR_FIND_QUIETLY) +ENDIF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR) diff --git a/code/CMakeModules/FindLibVR.cmake b/code/CMakeModules/FindLibVR.cmake new file mode 100644 index 000000000..eba9c347e --- /dev/null +++ b/code/CMakeModules/FindLibVR.cmake @@ -0,0 +1,32 @@ +# - Locate LibVR library +# This module defines +# LIBVR_LIBRARIES, the libraries to link against +# LIBVR_FOUND, if false, do not try to link to LIBVR +# LIBVR_INCLUDE_DIR, where to find headers. + +IF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR) + # in cache already + SET(LIBVR_FIND_QUIETLY TRUE) +ENDIF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR) + +FIND_PATH(LIBVR_INCLUDE_DIR hmd.h + PATH_SUFFIXES include/LibVR +) + +FIND_LIBRARY(LIBVR_LIBRARY + NAMES vr + PATH_SUFFIXES lib + PATHS +) + +IF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR) + IF(NOT LIBVR_FIND_QUIETLY) + MESSAGE(STATUS "Found LibVR: ${LIBVR_LIBRARY}") + ENDIF(NOT LIBVR_FIND_QUIETLY) + SET(LIBVR_FOUND "YES") + SET(LIBVR_DEFINITIONS "-DHAVE_LIBVR") +ELSE(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR) + IF(NOT LIBVR_FIND_QUIETLY) + MESSAGE(STATUS "Warning: Unable to find LibVR!") + ENDIF(NOT LIBVR_FIND_QUIETLY) +ENDIF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR) diff --git a/code/CMakeModules/FindLibwww.cmake b/code/CMakeModules/FindLibwww.cmake index e59d981c7..e742c6ae5 100644 --- a/code/CMakeModules/FindLibwww.cmake +++ b/code/CMakeModules/FindLibwww.cmake @@ -3,17 +3,15 @@ # # This module defines # LIBWWW_INCLUDE_DIR, where to find tiff.h, etc. -# LIBWWW_LIBRARY, where to find the LibWWW library. -# LIBWWW_FOUND, If false, do not try to use LibWWW. +# LIBWWW_LIBRARY, where to find the Libwww library. +# LIBWWW_FOUND, If false, do not try to use Libwww. OPTION(WITH_LIBWWW_STATIC "Use only static libraries for libwww" OFF) -SET(LIBWWW_FIND_QUIETLY ${Libwww_FIND_QUIETLY}) - # also defined, but not for general use are IF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) # in cache already - SET(LIBWWW_FIND_QUIETLY TRUE) + SET(Libwww_FIND_QUIETLY TRUE) ENDIF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR) FIND_PATH(LIBWWW_INCLUDE_DIR @@ -47,14 +45,29 @@ IF(LIBWWW_ADDITIONAL_INCLUDE_DIR) ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR) # helper to find all the libwww sub libraries -MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION) +MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION FILE) IF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) SET(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES}) SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") ENDIF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) - FIND_LIBRARY(${MYLIBRARY} - NAMES ${ARGN} + FIND_LIBRARY(${MYLIBRARY}_RELEASE + NAMES ${FILE} + PATHS + /usr/local/lib + /usr/lib + /usr/lib/x86_64-linux-gnu + /usr/local/X11R6/lib + /usr/X11R6/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + /usr/freeware/lib64 + ) + + FIND_LIBRARY(${MYLIBRARY}_DEBUG + NAMES ${FILE}d PATHS /usr/local/lib /usr/lib @@ -72,17 +85,25 @@ MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION) SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}) ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) - IF(${MYLIBRARY}) + IF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}}) + SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} optimized ${${MYLIBRARY}_RELEASE} debug ${${MYLIBRARY}_DEBUG}) ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) - ELSE(${MYLIBRARY}) - IF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32) + ELSEIF(${MYLIBRARY}_RELEASE) + IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) + SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_RELEASE}) + ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) + ELSEIF(${MYLIBRARY}_DEBUG) + IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) + SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_DEBUG}) + ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) + ELSE(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) + IF(NOT Libwww_FIND_QUIETLY AND NOT WIN32) MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}") - ENDIF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32) - ENDIF(${MYLIBRARY}) + ENDIF(NOT Libwww_FIND_QUIETLY AND NOT WIN32) + ENDIF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG) - MARK_AS_ADVANCED(${MYLIBRARY}) + MARK_AS_ADVANCED(${MYLIBRARY}_RELEASE ${MYLIBRARY}_DEBUG) ENDMACRO(FIND_WWW_LIBRARY) MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL) @@ -163,7 +184,7 @@ LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBREGEX_LIBRARY regexec) LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY OPENSSL_LIBRARIES SSL_new) INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibWWW DEFAULT_MSG +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Libwww DEFAULT_MSG LIBWWW_LIBRARIES LIBWWW_INCLUDE_DIR ) diff --git a/code/CMakeModules/FindLua52.cmake b/code/CMakeModules/FindLua52.cmake new file mode 100644 index 000000000..0c25ea840 --- /dev/null +++ b/code/CMakeModules/FindLua52.cmake @@ -0,0 +1,81 @@ +# Locate Lua library +# This module defines +# LUA52_FOUND, if false, do not try to link to Lua +# LUA_LIBRARIES +# LUA_INCLUDE_DIR, where to find lua.h +# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8) +# +# Note that the expected include convention is +# #include "lua.h" +# and not +# #include +# This is because, the lua location is not standardized and may exist +# in locations other than lua/ + +#============================================================================= +# Copyright 2007-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 distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_path(LUA_INCLUDE_DIR lua.h + HINTS + ENV LUA_DIR + PATH_SUFFIXES include/lua52 include/lua5.2 include/lua-5.2 include/lua include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) + +find_library(LUA_LIBRARY + NAMES lua52 lua5.2 lua-5.2 lua + HINTS + ENV LUA_DIR + PATH_SUFFIXES lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw + /opt/local + /opt/csw + /opt +) + +if(LUA_LIBRARY) + # include the math library for Unix + if(UNIX AND NOT APPLE AND NOT BEOS) + find_library(LUA_MATH_LIBRARY m) + set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries") + # For Windows and Mac, don't need to explicitly include the math library + else() + set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries") + endif() +endif() + +if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") + file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"") + + string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}") + unset(lua_version_str) +endif() + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua52 + REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR + VERSION_VAR LUA_VERSION_STRING) + +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY) + diff --git a/code/CMakeModules/FindLuabind.cmake b/code/CMakeModules/FindLuabind.cmake index c94a61e30..f61885be8 100644 --- a/code/CMakeModules/FindLuabind.cmake +++ b/code/CMakeModules/FindLuabind.cmake @@ -4,6 +4,48 @@ # LUABIND_FOUND, if false, do not try to link to LUABIND # LUABIND_INCLUDE_DIR, where to find headers. +MACRO(FIND_CORRECT_LUA_VERSION) + # Check Lua version linked to Luabind under Linux + IF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") + INCLUDE(CheckDepends) + + SET(LUA52_LIBRARY "liblua5.2") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND) + + IF(LUALIB_FOUND) + MESSAGE(STATUS "Luabind is using Lua 5.2") + FIND_PACKAGE(Lua52 REQUIRED) + ELSE(LUALIB_FOUND) + SET(LUA51_LIBRARY "liblua5.1") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA51_LIBRARY LUALIB_FOUND) + + IF(LUALIB_FOUND) + MESSAGE(STATUS "Luabind is using Lua 5.1") + FIND_PACKAGE(Lua51 REQUIRED) + ELSE(LUALIB_FOUND) + SET(LUA50_LIBRARY "liblua5.0") + CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND) + + IF(LUALIB_FOUND) + MESSAGE(STATUS "Luabind is using Lua 5.0") + FIND_PACKAGE(Lua50 REQUIRED) + ELSE(LUALIB_FOUND) + MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind") + ENDIF(LUALIB_FOUND) + ENDIF(LUALIB_FOUND) + ENDIF(LUALIB_FOUND) + ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") + # TODO: find a way to detect Lua version + IF(WITH_LUA52) + FIND_PACKAGE(Lua52 REQUIRED) + ELSEIF(WITH_LUA51) + FIND_PACKAGE(Lua51 REQUIRED) + ELSE(WITH_LUA52) + FIND_PACKAGE(Lua50 REQUIRED) + ENDIF(WITH_LUA52) + ENDIF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so") +ENDMACRO(FIND_CORRECT_LUA_VERSION) + IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR) # in cache already SET(Luabind_FIND_QUIETLY TRUE) @@ -84,6 +126,9 @@ IF(LUABIND_FOUND) IF(LUABIND_VERSION_FILE) SET(LUABIND_DEFINITIONS "-DHAVE_LUABIND_VERSION") ENDIF(LUABIND_VERSION_FILE) + + FIND_CORRECT_LUA_VERSION() + IF(NOT Luabind_FIND_QUIETLY) MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}") ENDIF(NOT Luabind_FIND_QUIETLY) diff --git a/code/CMakeModules/FindMSVC.cmake b/code/CMakeModules/FindMSVC.cmake new file mode 100644 index 000000000..16455b02d --- /dev/null +++ b/code/CMakeModules/FindMSVC.cmake @@ -0,0 +1,96 @@ +# - Find MS Visual C++ +# +# VC_INCLUDE_DIR - where to find headers +# VC_INCLUDE_DIRS - where to find headers +# VC_LIBRARY_DIR - where to find libraries +# VC_FOUND - True if MSVC found. + +MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION) + # Software/Wow6432Node/... + GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;${_VERSION}]" ABSOLUTE) + + IF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry") + SET(VC${_VERSION}_DIR) + GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE) + IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") + SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/") + ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") + ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry") + + IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") + SET(VC${_VERSION}_FOUND ON) + DETECT_EXPRESS_VERSION(${_VERSION}) + IF(NOT MSVC_FIND_QUIETLY) + SET(_VERSION_STR ${_VERSION}) + IF(MSVC_EXPRESS) + SET(_VERSION_STR "${_VERSION_STR} Express") + ENDIF(MSVC_EXPRESS) + MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}") + ENDIF(NOT MSVC_FIND_QUIETLY) + ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") + SET(VC${_VERSION}_FOUND OFF) + SET(VC${_VERSION}_DIR "") + ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry") +ENDMACRO(DETECT_VC_VERSION_HELPER) + +MACRO(DETECT_VC_VERSION _VERSION) + SET(VC${_VERSION}_FOUND OFF) + DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION}) + + IF(NOT VC${_VERSION}_FOUND) + DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) + ENDIF(NOT VC${_VERSION}_FOUND) + + IF(VC${_VERSION}_FOUND) + SET(VC_FOUND ON) + SET(VC_DIR "${VC${_VERSION}_DIR}") + ENDIF(VC${_VERSION}_FOUND) +ENDMACRO(DETECT_VC_VERSION) + +MACRO(DETECT_EXPRESS_VERSION _VERSION) + GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE) + + IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry") + SET(MSVC_EXPRESS ON) + ENDIF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry") +ENDMACRO(DETECT_EXPRESS_VERSION) + +IF(MSVC12) + DETECT_VC_VERSION("12.0") + + IF(NOT MSVC12_REDIST_DIR) + # If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist") + ENDIF(NOT MSVC11_REDIST_DIR) +ELSEIF(MSVC11) + DETECT_VC_VERSION("11.0") + + IF(NOT MSVC11_REDIST_DIR) + # If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist") + ENDIF(NOT MSVC11_REDIST_DIR) +ELSEIF(MSVC10) + DETECT_VC_VERSION("10.0") + + IF(NOT MSVC10_REDIST_DIR) + # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist + SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist") + ENDIF(NOT MSVC10_REDIST_DIR) +ELSEIF(MSVC90) + DETECT_VC_VERSION("9.0") +ELSEIF(MSVC80) + DETECT_VC_VERSION("8.0") +ENDIF(MSVC12) + +# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable +IF(NOT VC_DIR) + SET(VC_DIR $ENV{VC_DIR}) +ENDIF(NOT VC_DIR) + +IF(NOT VC_DIR) + STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER}) +ENDIF(NOT VC_DIR) + +SET(VC_INCLUDE_DIR "${VC_DIR}/include") +SET(VC_INCLUDE_DIRS ${VC_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR}) diff --git a/code/CMakeModules/FindMercurial.cmake b/code/CMakeModules/FindMercurial.cmake index a18e50c43..dbb2110ff 100644 --- a/code/CMakeModules/FindMercurial.cmake +++ b/code/CMakeModules/FindMercurial.cmake @@ -48,7 +48,12 @@ # License text for the above reference.) FIND_PROGRAM(Mercurial_HG_EXECUTABLE hg - DOC "mercurial command line client") + DOC "mercurial command line client" + PATHS + /opt/local/bin + "C:/Program Files/TortoiseHg" + "C:/Program Files (x86)/TortoiseHg" + ) MARK_AS_ADVANCED(Mercurial_HG_EXECUTABLE) IF(Mercurial_HG_EXECUTABLE) @@ -58,7 +63,7 @@ IF(Mercurial_HG_EXECUTABLE) STRING(REGEX REPLACE ".*version ([\\.0-9]+).*" "\\1" Mercurial_VERSION_HG "${Mercurial_VERSION_HG}") - + MACRO(Mercurial_WC_INFO dir prefix) EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip --template "{rev};{node};{tags};{author}" WORKING_DIRECTORY ${dir} diff --git a/code/CMakeModules/FindMySQL.cmake b/code/CMakeModules/FindMySQL.cmake index 1da6157fa..eb2102c8d 100644 --- a/code/CMakeModules/FindMySQL.cmake +++ b/code/CMakeModules/FindMySQL.cmake @@ -58,6 +58,8 @@ ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE}) IF(MYSQL_LIBRARY_DEBUG) SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_DEBUG}) + ELSE(MYSQL_LIBRARY_DEBUG) + SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_RELEASE}) ENDIF(MYSQL_LIBRARY_DEBUG) FIND_PACKAGE(OpenSSL) IF(OPENSSL_FOUND) diff --git a/code/CMakeModules/FindS3TC.cmake b/code/CMakeModules/FindS3TC.cmake deleted file mode 100644 index f4efb8c5e..000000000 --- a/code/CMakeModules/FindS3TC.cmake +++ /dev/null @@ -1,50 +0,0 @@ -# - Locate S3TC library -# This module defines -# S3TC_LIBRARY, the library to link against -# S3TC_FOUND, if false, do not try to link to S3TC -# S3TC_INCLUDE_DIR, where to find headers. - -IF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR) - # in cache already - SET(S3TC_FIND_QUIETLY TRUE) -ENDIF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR) - - -FIND_PATH(S3TC_INCLUDE_DIR - s3_intrf.h - PATHS - $ENV{S3TC_DIR}/include - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include - PATH_SUFFIXES S3TC -) - -FIND_LIBRARY(S3TC_LIBRARY - NAMES s3tc libs3tc - PATHS - $ENV{S3TC_DIR}/lib - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 -) - -IF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR) - SET(S3TC_FOUND "YES") - IF(NOT S3TC_FIND_QUIETLY) - MESSAGE(STATUS "Found S3TC: ${S3TC_LIBRARY}") - ENDIF(NOT S3TC_FIND_QUIETLY) -ELSE(S3TC_LIBRARY AND S3TC_INCLUDE_DIR) - IF(NOT S3TC_FIND_QUIETLY) - MESSAGE(STATUS "Warning: Unable to find S3TC!") - ENDIF(NOT S3TC_FIND_QUIETLY) -ENDIF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR) diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake index 9d9b91777..fd32d92b5 100644 --- a/code/CMakeModules/FindWindowsSDK.cmake +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -6,80 +6,304 @@ # WINSDK_LIBRARY_DIR - where to find libraries # WINSDK_FOUND - True if Windows SDK found. -IF(WINSDK_INCLUDE_DIR) - # Already in cache, be silent - SET(WindowsSDK_FIND_QUIETLY TRUE) -ENDIF(WINSDK_INCLUDE_DIR) +IF(WINSDK_FOUND) + # If Windows SDK already found, skip it + RETURN() +ENDIF(WINSDK_FOUND) -# TODO: add the possibility to use a specific Windows SDK +# Values can be CURRENT or any existing versions 7.1, 8.0A, etc... +SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer") -IF(MSVC11) - GET_FILENAME_COMPONENT(WINSDK8_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]" ABSOLUTE CACHE) - GET_FILENAME_COMPONENT(WINSDK8_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;ProductVersion]" NAME) +MACRO(DETECT_WINSDK_VERSION_HELPER _ROOT _VERSION) + GET_FILENAME_COMPONENT(WINSDK${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};InstallationFolder]" ABSOLUTE) - IF(WINSDK8_DIR) + IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") + SET(WINSDK${_VERSION}_FOUND ON) + GET_FILENAME_COMPONENT(WINSDK${_VERSION}_VERSION_FULL "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};ProductVersion]" NAME) IF(NOT WindowsSDK_FIND_QUIETLY) - MESSAGE(STATUS "Found Windows SDK ${WINSDK8_VERSION} in ${WINSDK8_DIR}") + MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}") ENDIF(NOT WindowsSDK_FIND_QUIETLY) - IF(TARGET_ARM) - SET(WINSDK8_SUFFIX "arm") - ELSEIF(TARGET_X64) - SET(WINSDK8_SUFFIX "x64") - ELSEIF(TARGET_X86) - SET(WINSDK8_SUFFIX "x86") - ENDIF(TARGET_ARM) - ENDIF(WINSDK8_DIR) -ENDIF(MSVC11) + ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") + SET(WINSDK${_VERSION}_DIR "") + ENDIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry") +ENDMACRO(DETECT_WINSDK_VERSION_HELPER) -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) +MACRO(DETECT_WINSDK_VERSION _VERSION) + SET(WINSDK${_VERSION}_FOUND OFF) + DETECT_WINSDK_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION}) -IF(WINSDK71_DIR) - IF(NOT WindowsSDK_FIND_QUIETLY) - MESSAGE(STATUS "Found Windows SDK ${WINSDK71_VERSION} in ${WINSDK71_DIR}") - ENDIF(NOT WindowsSDK_FIND_QUIETLY) -ENDIF(WINSDK71_DIR) + IF(NOT WINSDK${_VERSION}_FOUND) + DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION}) + ENDIF(NOT WINSDK${_VERSION}_FOUND) +ENDMACRO(DETECT_WINSDK_VERSION) -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) +SET(WINSDK_VERSIONS "8.0" "8.0A" "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A") +SET(WINSDK_DETECTED_VERSIONS) -IF(WINSDKCURRENT_DIR) - IF(NOT WindowsSDK_FIND_QUIETLY) - MESSAGE(STATUS "Found Windows SDK ${WINSDKCURRENT_VERSION} in ${WINSDKCURRENT_DIR}") - ENDIF(NOT WindowsSDK_FIND_QUIETLY) -ENDIF(WINSDKCURRENT_DIR) +# Search all supported Windows SDKs +FOREACH(_VERSION ${WINSDK_VERSIONS}) + DETECT_WINSDK_VERSION(${_VERSION}) + IF(WINSDK${_VERSION}_FOUND) + LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION}) + ENDIF(WINSDK${_VERSION}_FOUND) +ENDFOREACH(_VERSION) + +SET(WINSDK_SUFFIX) + +IF(TARGET_ARM) + SET(WINSDK8_SUFFIX "arm") +ELSEIF(TARGET_X64) + SET(WINSDK8_SUFFIX "x64") + SET(WINSDK_SUFFIX "x64") +ELSEIF(TARGET_X86) + SET(WINSDK8_SUFFIX "x86") +ENDIF(TARGET_ARM) + +SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE}) + +IF(WINSDKCURRENT_VERSION_INCLUDE) + FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE) +ENDIF(WINSDKCURRENT_VERSION_INCLUDE) + +SET(WINSDKENV_DIR $ENV{WINSDK_DIR}) + +MACRO(FIND_WINSDK_VERSION_HEADERS) + IF(WINSDK_DIR AND NOT WINSDK_VERSION) + # Search version in headers + IF(EXISTS ${WINSDK_DIR}/include/Msi.h) + SET(_MSI_FILE ${WINSDK_DIR}/include/Msi.h) + ENDIF(EXISTS ${WINSDK_DIR}/include/Msi.h) + + IF(_MSI_FILE) + # Look for Windows SDK 8.0 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8") + + IF(_CONTENT) + SET(WINSDK_VERSION "8.0") + ENDIF(_CONTENT) + + IF(NOT WINSDK_VERSION) + # Look for Windows SDK 7.0 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN7") + + IF(_CONTENT) + IF(EXISTS ${WINSDK_DIR}/include/winsdkver.h) + SET(_WINSDKVER_FILE ${WINSDK_DIR}/include/winsdkver.h) + ELSEIF(EXISTS ${WINSDK_DIR}/include/WinSDKVer.h) + SET(_WINSDKVER_FILE ${WINSDK_DIR}/include/WinSDKVer.h) + ENDIF(EXISTS ${WINSDK_DIR}/include/winsdkver.h) + + IF(_WINSDKVER_FILE) + # Load WinSDKVer.h content + FILE(STRINGS ${_WINSDKVER_FILE} _CONTENT REGEX "^#define NTDDI_MAXVER") + + # Get NTDDI_MAXVER value + STRING(REGEX REPLACE "^.*0x([0-9A-Fa-f]+).*$" "\\1" _WINSDKVER "${_CONTENT}") + + # In Windows SDK 7.1, NTDDI_MAXVER is wrong + IF(_WINSDKVER STREQUAL "06010000") + SET(WINSDK_VERSION "7.1") + ELSEIF(_WINSDKVER STREQUAL "0601") + SET(WINSDK_VERSION "7.0A") + ELSE(_WINSDKVER STREQUAL "06010000") + MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}") + ENDIF(_WINSDKVER STREQUAL "06010000") + ELSE(_WINSDKVER_FILE) + SET(WINSDK_VERSION "7.0") + ENDIF(_WINSDKVER_FILE) + ENDIF(_CONTENT) + ENDIF(NOT WINSDK_VERSION) + + IF(NOT WINSDK_VERSION) + # Look for Windows SDK 6.0 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_VISTA") + + IF(_CONTENT) + SET(WINSDK_VERSION "6.0") + ENDIF(_CONTENT) + ENDIF(NOT WINSDK_VERSION) + + IF(NOT WINSDK_VERSION) + # Look for Windows SDK 5.2 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WS03SP1") + + IF(_CONTENT) + SET(WINSDK_VERSION "5.2") + ENDIF(_CONTENT) + ENDIF(NOT WINSDK_VERSION) + + IF(NOT WINSDK_VERSION) + # Look for Windows SDK 5.1 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WINXP") + + IF(_CONTENT) + SET(WINSDK_VERSION "5.1") + ENDIF(_CONTENT) + ENDIF(NOT WINSDK_VERSION) + + IF(NOT WINSDK_VERSION) + # Look for Windows SDK 5.0 + FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN2K") + + IF(_CONTENT) + SET(WINSDK_VERSION "5.0") + ENDIF(_CONTENT) + ENDIF(NOT WINSDK_VERSION) + ELSE(_MSI_FILE) + MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}") + ENDIF(_MSI_FILE) + ENDIF(WINSDK_DIR AND NOT WINSDK_VERSION) +ENDMACRO(FIND_WINSDK_VERSION_HEADERS) + +MACRO(USE_CURRENT_WINSDK) + SET(WINSDK_DIR "") + SET(WINSDK_VERSION "") + SET(WINSDK_VERSION_FULL "") + + # Use WINSDK environment variable + IF(WINSDKENV_DIR AND EXISTS ${WINSDKENV_DIR}/include/Windows.h) + SET(WINSDK_DIR ${WINSDKENV_DIR}) + ENDIF(WINSDKENV_DIR AND EXISTS ${WINSDKENV_DIR}/include/Windows.h) + + # Use INCLUDE environment variable + IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE) + FOREACH(_INCLUDE ${WINSDKCURRENT_VERSION_INCLUDE}) + FILE(TO_CMAKE_PATH ${_INCLUDE} _INCLUDE) + + # Look for Windows.h because there are several paths + IF(EXISTS ${_INCLUDE}/Windows.h) + STRING(REGEX REPLACE "/(include|INCLUDE|Include)" "" WINSDK_DIR ${_INCLUDE}) + MESSAGE(STATUS "Found Windows SDK environment variable in ${WINSDK_DIR}") + BREAK() + ENDIF(EXISTS ${_INCLUDE}/Windows.h) + ENDFOREACH(_INCLUDE) + ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE) + + IF(WINSDK_DIR) + # Compare WINSDK_DIR with registered Windows SDKs + FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS}) + IF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}") + SET(WINSDK_VERSION ${_VERSION}) + SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") + BREAK() + ENDIF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}") + ENDFOREACH(_VERSION) + + FIND_WINSDK_VERSION_HEADERS() + ENDIF(WINSDK_DIR) + + IF(NOT WINSDK_DIR) + # Use Windows SDK versions installed with VC++ when possible + IF(MSVC12) + SET(WINSDK_VERSION "8.1A") + ELSEIF(MSVC11) + SET(WINSDK_VERSION "8.0A") + ELSEIF(MSVC10) + IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS) + SET(WINSDK_VERSION "7.0A") + ENDIF(NOT TARGET_X64 OR NOT MSVC_EXPRESS) + ELSEIF(MSVC90) + IF(NOT MSVC_EXPRESS) + SET(WINSDK_VERSION "6.0A") + ENDIF(NOT MSVC_EXPRESS) + ELSEIF(MSVC80) + IF(NOT MSVC_EXPRESS) + # TODO: fix this version + SET(WINSDK_VERSION "5.2A") + ENDIF(NOT MSVC_EXPRESS) + ELSE(MSVC12) + MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.") + ENDIF(MSVC12) + + # Use installed Windows SDK + IF(NOT WINSDK_VERSION) + IF(WINSDK7.1_FOUND) + SET(WINSDK_VERSION "7.1") + ELSEIF(WINSDK7.0_FOUND) + SET(WINSDK_VERSION "7.0") + ELSEIF(WINSDK6.1_FOUND) + SET(WINSDK_VERSION "6.1") + ELSEIF(WINSDK6.0_FOUND) + SET(WINSDK_VERSION "6.0") + ELSE(WINSDK7.1_FOUND) + MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.") + ENDIF(WINSDK7.1_FOUND) + ENDIF(NOT WINSDK_VERSION) + + # Look for correct registered Windows SDK version + FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS}) + IF(WINSDK_VERSION STREQUAL _VERSION) + SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") + SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}") + BREAK() + ENDIF(WINSDK_VERSION STREQUAL _VERSION) + ENDFOREACH(_VERSION) + ENDIF(NOT WINSDK_DIR) +ENDMACRO(USE_CURRENT_WINSDK) + +IF(WINSDK_VERSION STREQUAL "CURRENT") + USE_CURRENT_WINSDK() +ELSE(WINSDK_VERSION STREQUAL "CURRENT") + IF(WINSDK${WINSDK_VERSION}_FOUND) + SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}") + SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}") + ELSE(WINSDK${WINSDK_VERSION}_FOUND) + USE_CURRENT_WINSDK() + ENDIF(WINSDK${WINSDK_VERSION}_FOUND) +ENDIF(WINSDK_VERSION STREQUAL "CURRENT") + +IF(WINSDK_DIR) + MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}") +ELSE(WINSDK_DIR) + MESSAGE(FATAL_ERROR "Unable to find Windows SDK!") +ENDIF(WINSDK_DIR) + +# directory where Win32 headers are found FIND_PATH(WINSDK_INCLUDE_DIR Windows.h HINTS - ${WINSDK8_DIR}/Include/um - ${WINSDK71_DIR}/Include - ${WINSDKCURRENT_DIR}/Include + ${WINSDK_DIR}/Include/um + ${WINSDK_DIR}/Include ) +# directory where DirectX headers are found FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h HINTS - ${WINSDK8_DIR}/Include/shared - ${WINSDK71_DIR}/Include - ${WINSDKCURRENT_DIR}/Include + ${WINSDK_DIR}/Include/shared + ${WINSDK_DIR}/Include ) +# directory where all libraries are found FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib HINTS - ${WINSDK8_DIR}/Lib/win8/um/${WINSDK8_SUFFIX} - ${WINSDK71_DIR}/Lib - ${WINSDKCURRENT_DIR}/Lib + ${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX} + ${WINSDK_DIR}/Lib/${WINSDK_SUFFIX} ) +# signtool is used to sign executables FIND_PROGRAM(WINSDK_SIGNTOOL signtool HINTS - ${WINSDK8_DIR}/Bin/x86 - ${WINSDK71_DIR}/Bin - ${WINSDKCURRENT_DIR}/Bin + ${WINSDK_DIR}/Bin/x86 + ${WINSDK_DIR}/Bin +) + +# midl is used to generate IDL interfaces +FIND_PROGRAM(WINSDK_MIDL midl + HINTS + ${WINSDK_DIR}/Bin/x86 + ${WINSDK_DIR}/Bin ) IF(WINSDK_INCLUDE_DIR) - SET(WINSDK_FOUND TRUE) + SET(WINSDK_FOUND ON) SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR}) + SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH}) + INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS}) + + # Fix for using Windows SDK 7.1 with Visual C++ 2012 + IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11) + ADD_DEFINITIONS(-D_USING_V110_SDK71_) + ENDIF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11) ELSE(WINSDK_INCLUDE_DIR) IF(NOT WindowsSDK_FIND_QUIETLY) MESSAGE(STATUS "Warning: Unable to find Windows SDK!") diff --git a/code/CMakeModules/GetRevision.cmake b/code/CMakeModules/GetRevision.cmake index 18e997af2..21b234f74 100644 --- a/code/CMakeModules/GetRevision.cmake +++ b/code/CMakeModules/GetRevision.cmake @@ -19,6 +19,7 @@ IF(SOURCE_DIR) SET(SOURCE_DIR ${ROOT_DIR}) ENDIF(NOT SOURCE_DIR AND ROOT_DIR) ELSE(SOURCE_DIR) + SET(SOURCE_DIR ${CMAKE_SOURCE_DIR}) SET(ROOT_DIR ${CMAKE_SOURCE_DIR}) ENDIF(SOURCE_DIR) @@ -57,6 +58,15 @@ IF(EXISTS "${ROOT_DIR}/.hg/") ENDIF(MERCURIAL_FOUND) ENDIF(EXISTS "${ROOT_DIR}/.hg/") +# if processing exported sources, use "revision" file if exists +IF(SOURCE_DIR AND NOT DEFINED REVISION) + SET(REVISION_FILE ${SOURCE_DIR}/revision) + IF(EXISTS ${REVISION_FILE}) + FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1) + MESSAGE(STATUS "Read revision ${REVISION} from file") + ENDIF(EXISTS ${REVISION_FILE}) +ENDIF(SOURCE_DIR AND NOT DEFINED REVISION) + IF(SOURCE_DIR AND DEFINED REVISION) IF(EXISTS ${SOURCE_DIR}/revision.h.in) MESSAGE(STATUS "Revision: ${REVISION}") diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index 042f6b0cc..97b5ed88d 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -10,7 +10,6 @@ IF(MSVC) SET(PCHSupport_FOUND TRUE) - SET(_PCH_include_prefix "/I") ELSE(MSVC) IF(CMAKE_COMPILER_IS_GNUCXX) EXEC_PROGRAM(${CMAKE_CXX_COMPILER} @@ -26,44 +25,50 @@ ELSE(MSVC) # TODO: make tests for other compilers than GCC SET(PCHSupport_FOUND TRUE) ENDIF(CMAKE_COMPILER_IS_GNUCXX) - - SET(_PCH_include_prefix "-I") ENDIF(MSVC) # Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs MACRO(PCH_SET_COMPILE_FLAGS _target) SET(PCH_FLAGS) - SET(PCH_ARCHS) + SET(PCH_ARCHS) + SET(_FLAGS) - LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS}) STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD) LIST(APPEND _FLAGS " ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}}") - IF(NOT MSVC) - GET_TARGET_PROPERTY(_targetType ${_target} TYPE) - IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) - LIST(APPEND _FLAGS " -fPIC") - ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) - ENDIF(NOT MSVC) + GET_TARGET_PROPERTY(_targetType ${_target} TYPE) + + IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) + LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") + ELSE(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) + GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE) + IF(_pic) + LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}") + ENDIF(_pic) + ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY) GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES) FOREACH(item ${DIRINC}) - LIST(APPEND _FLAGS " ${_PCH_include_prefix}\"${item}\"") + LIST(APPEND _FLAGS " -I\"${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) + IF(DEFINITIONS) + FOREACH(item ${DEFINITIONS}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDFOREACH(item) + ENDIF(DEFINITIONS) GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD}) - FOREACH(item ${DEFINITIONS}) - LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") - ENDFOREACH(item) + IF(DEFINITIONS) + FOREACH(item ${DEFINITIONS}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDFOREACH(item) + ENDIF(DEFINITIONS) GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS) IF(oldProps) @@ -75,6 +80,27 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) LIST(APPEND _FLAGS " ${oldPropsBuild}") ENDIF(oldPropsBuild) + GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES) + IF(DIRINC) + FOREACH(item ${DIRINC}) + LIST(APPEND _FLAGS " -I\"${item}\"") + ENDFOREACH(item) + ENDIF(DIRINC) + + GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS) + IF(DEFINITIONS) + FOREACH(item ${DEFINITIONS}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDFOREACH(item) + ENDIF(DEFINITIONS) + + GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD}) + IF(DEFINITIONS) + FOREACH(item ${DEFINITIONS}) + LIST(APPEND GLOBAL_DEFINITIONS " -D${item}") + ENDFOREACH(item) + ENDIF(DEFINITIONS) + GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS) GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS) LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}") @@ -90,7 +116,6 @@ MACRO(PCH_SET_COMPILE_FLAGS _target) SEPARATE_ARGUMENTS(_FLAGS) ENDIF(MSVC) - IF(CLANG) # Determining all architectures and get common flags SET(_ARCH_NEXT) @@ -183,6 +208,9 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS) IF(MSVC) GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target}) SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj") + # Ninja PCH Support + # http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html + SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj") ELSE(MSVC) SET(HEADER_FORMAT "c++-header") SET(_FLAGS "") @@ -242,6 +270,25 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName) IF(MSVC) SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"") + # Ninja PCH Support + # http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES OBJECT_DEPENDS "${PCH_OUTPUT}") + + # NMAKE-VS2012 Error LNK2011 (NMAKE-VS2010 do not complain) + # we need to link the pch.obj file, see http://msdn.microsoft.com/en-us/library/3ay26wa2(v=vs.110).aspx + GET_TARGET_PROPERTY(_STATIC_LIBRARY_FLAGS ${_targetName} STATIC_LIBRARY_FLAGS) + IF(NOT _STATIC_LIBRARY_FLAGS) + SET(_STATIC_LIBRARY_FLAGS) + ENDIF(NOT _STATIC_LIBRARY_FLAGS) + SET(_STATIC_LIBRARY_FLAGS "${PCH_OUTPUT}.obj ${_STATIC_LIBRARY_FLAGS}") + + GET_TARGET_PROPERTY(_LINK_FLAGS ${_targetName} LINK_FLAGS) + IF(NOT _LINK_FLAGS) + SET(_LINK_FLAGS) + ENDIF(NOT _LINK_FLAGS) + SET(_LINK_FLAGS "${PCH_OUTPUT}.obj ${_LINK_FLAGS}") + + SET_TARGET_PROPERTIES(${_targetName} PROPERTIES STATIC_LIBRARY_FLAGS ${_STATIC_LIBRARY_FLAGS} LINK_FLAGS ${_LINK_FLAGS}) ELSE(MSVC) # for use with distcc and gcc >4.0.1 if preprocessed files are accessible # on all remote machines set @@ -329,17 +376,6 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}") ENDMACRO(ADD_PRECOMPILED_HEADER) -# Macro to move PCH creation file to the front of files list -# or remove .cpp from library/executable to avoid warning -MACRO(FIX_PRECOMPILED_HEADER _files _pch) - # Remove .cpp creating PCH from the list - LIST(REMOVE_ITEM ${_files} ${_pch}) - IF(MSVC) - # Prepend .cpp creating PCH to the list - LIST(INSERT ${_files} 0 ${_pch}) - ENDIF(MSVC) -ENDMACRO(FIX_PRECOMPILED_HEADER) - MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) IF(NOT PCHSupport_FOUND) MESSAGE(STATUS "PCH disabled because compiler doesn't support them") @@ -351,10 +387,6 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp) # 2 => setting PCH for XCode project, works for XCode projects IF(CMAKE_GENERATOR MATCHES "Visual Studio") SET(PCH_METHOD 1) - ELSEIF(CMAKE_GENERATOR MATCHES "NMake Makefiles" AND MFC_FOUND AND CMAKE_MFC_FLAG) - # To fix a bug with MFC - # Don't forget to use FIX_PRECOMPILED_HEADER before creating the target -# SET(PCH_METHOD 1) ELSEIF(CMAKE_GENERATOR MATCHES "Xcode") SET(PCH_METHOD 2) ELSE(CMAKE_GENERATOR MATCHES "Visual Studio") diff --git a/code/CMakeModules/iOSToolChain.cmake b/code/CMakeModules/iOSToolChain.cmake new file mode 100644 index 000000000..5b419778e --- /dev/null +++ b/code/CMakeModules/iOSToolChain.cmake @@ -0,0 +1,183 @@ +# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake +# files which are included with CMake 2.8.4 +# It has been altered for iOS development +# +# Options: +# +# IOS_VERSION = last(default) or specific one (4.3, 5.0, 4.1) +# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders +# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch. +# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch. +# +# IOS_PLATFORM = OS (default) or SIMULATOR or ALL +# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders +# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch. +# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch. +# +# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder +# By default this location is automatcially chosen based on the IOS_PLATFORM value above. +# If set manually, it will override the default location and force the user of a particular Developer Platform +# +# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder +# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value. +# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path. +# If set manually, this will force the use of a specific SDK version + +IF(DEFINED CMAKE_CROSSCOMPILING) + # subsequent toolchain loading is not really needed + RETURN() +ENDIF() + +# Standard settings +SET(CMAKE_SYSTEM_NAME Darwin) +SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Darwin version +SET(UNIX ON) +SET(APPLE ON) +SET(IOS ON) + +# Force the compilers to Clang for iOS +include (CMakeForceCompiler) +CMAKE_FORCE_C_COMPILER (clang Clang) +CMAKE_FORCE_CXX_COMPILER (clang++ Clang) + +# Setup iOS platform +if (NOT DEFINED IOS_PLATFORM) + set (IOS_PLATFORM "OS") +endif (NOT DEFINED IOS_PLATFORM) +set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform") + +SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform") +SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform") + +# Check the platform selection and setup for developer root +if (${IOS_PLATFORM} STREQUAL "OS") + # This causes the installers to properly locate the output libraries + set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos") +elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR") + # This causes the installers to properly locate the output libraries + set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator") +elseif (${IOS_PLATFORM} STREQUAL "ALL") + # This causes the installers to properly locate the output libraries + set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos") +else (${IOS_PLATFORM} STREQUAL "OS") + message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR") +endif (${IOS_PLATFORM} STREQUAL "OS") +set (CMAKE_XCODE_EFFECTIVE_PLATFORMS ${CMAKE_XCODE_EFFECTIVE_PLATFORMS} CACHE PATH "iOS Platform") + +# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT +# Note Xcode 4.3 changed the installation location, choose the most recent one available +SET(XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms") +SET(XCODE_PRE_43_ROOT "/Developer/Platforms") + +IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) + IF(EXISTS ${XCODE_POST_43_ROOT}) + SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT}) + ELSEIF(EXISTS ${XCODE_PRE_43_ROOT}) + SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT}) + ENDIF(EXISTS ${XCODE_POST_43_ROOT}) + IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer) + SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer) + ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer) + IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) + SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) + ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer) +ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) +SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform") +SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform") + +MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS) + FILE(GLOB _CMAKE_IOS_SDKS "${ROOT}/SDKs/iPhoneOS*") + IF(_CMAKE_IOS_SDKS) + LIST(SORT _CMAKE_IOS_SDKS) + LIST(REVERSE _CMAKE_IOS_SDKS) + FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS}) + STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}") + LIST(APPEND ${VERSIONS} ${_IOS_SDK}) + ENDFOREACH(_CMAKE_IOS_SDK) + ENDIF(_CMAKE_IOS_SDKS) +ENDMACRO(GET_AVAILABLE_SDK_VERSIONS) + +# Find and use the most recent iOS sdk +IF(NOT DEFINED CMAKE_IOS_SDK_ROOT) + # Search for a specific version of a SDK + GET_AVAILABLE_SDK_VERSIONS(${CMAKE_IOS_DEVELOPER_ROOT} IOS_VERSIONS) + + IF(NOT IOS_VERSIONS) + MESSAGE(FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.") + ENDIF(NOT IOS_VERSIONS) + + IF(IOS_VERSION) + LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX) + IF(_INDEX EQUAL -1) + LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION) + ELSE(_INDEX EQUAL -1) + SET(IOS_SDK_VERSION ${IOS_VERSION}) + ENDIF(_INDEX EQUAL -1) + ELSE(IOS_VERSION) + LIST(GET IOS_VERSIONS 0 IOS_VERSION) + SET(IOS_SDK_VERSION ${IOS_VERSION}) + ENDIF(IOS_VERSION) + + MESSAGE(STATUS "Target iOS ${IOS_VERSION} and use SDK ${IOS_SDK_VERSION}") + + SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk) + SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk) +endif (NOT DEFINED CMAKE_IOS_SDK_ROOT) + +SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK") +SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Location of the selected iOS Simulator SDK") + +SET(IOS_VERSION ${IOS_VERSION} CACHE STRING "iOS target version") + +# Set the sysroot default to the most recent SDK +SET(CMAKE_IOS_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support") +SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support") + +IF(CMAKE_GENERATOR MATCHES Xcode) + SET(ARCHS "$(ARCHS_STANDARD_32_BIT)") + IF(${IOS_PLATFORM} STREQUAL "OS") + SET(CMAKE_SYSTEM_PROCESSOR "armv7") + ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR") + SET(CMAKE_SYSTEM_PROCESSOR "x86") + ELSEIF(${IOS_PLATFORM} STREQUAL "ALL") + SET(CMAKE_SYSTEM_PROCESSOR "armv7") + ENDIF(${IOS_PLATFORM} STREQUAL "OS") +ELSE(CMAKE_GENERATOR MATCHES Xcode) + IF(${IOS_PLATFORM} STREQUAL "OS") + SET(ARCHS "armv7") + SET(CMAKE_SYSTEM_PROCESSOR "armv7") + ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR") + # iPhone simulator targets i386 + SET(ARCHS "i386") + SET(CMAKE_SYSTEM_PROCESSOR "x86") + ELSEIF(${IOS_PLATFORM} STREQUAL "ALL") + SET(ARCHS "armv7;i386") + SET(CMAKE_SYSTEM_PROCESSOR "armv7") + ENDIF(${IOS_PLATFORM} STREQUAL "OS") +ENDIF(CMAKE_GENERATOR MATCHES Xcode) + +# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard. +# The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only +set (CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS") + +# Set the find root to the iOS developer roots and to user defined paths +set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_IOS_PATH} CACHE string "iOS find search path root") + +# default to searching for frameworks first +set (CMAKE_FIND_FRAMEWORK FIRST) + +# set up the default search directories for frameworks +set (CMAKE_SYSTEM_FRAMEWORK_PATH + ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks + ${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks + ${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks +) + +# only search the iOS sdks, not the remainder of the host filesystem +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +#SET(CMAKE_SYSTEM_INCLUDE_PATH /include /usr/include) +#SET(CMAKE_SYSTEM_LIBRARY_PATH /lib /usr/lib) +#SET(CMAKE_SYSTEM_PROGRAM_PATH /bin /usr/bin) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 834a5da5b..f239ec779 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -125,10 +125,6 @@ MACRO(NL_DEFAULT_PROPS name label) COMPILE_FLAGS "/GA" LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}") ENDIF(${type} STREQUAL EXECUTABLE AND WIN32) - - IF(WITH_STLPORT AND WIN32) - SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X") - ENDIF(WITH_STLPORT AND WIN32) ENDMACRO(NL_DEFAULT_PROPS) ### @@ -324,6 +320,9 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS) OPTION(WITH_NEL_MAXPLUGIN "Build NeL 3dsMax Plugin" OFF) OPTION(WITH_NEL_SAMPLES "Build NeL Samples" ON ) OPTION(WITH_NEL_TESTS "Build NeL Unit Tests" ON ) + + OPTION(WITH_LIBOVR "With LibOVR support" OFF) + OPTION(WITH_LIBVR "With LibVR support" OFF) ENDMACRO(NL_SETUP_NEL_DEFAULT_OPTIONS) MACRO(NL_SETUP_NELNS_DEFAULT_OPTIONS) @@ -346,7 +345,8 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) ### # Optional support ### - OPTION(WITH_LUA51 "Build Ryzom Core using Lua51" ON ) + OPTION(WITH_LUA51 "Build Ryzom Core using Lua 5.1" ON ) + OPTION(WITH_LUA52 "Build Ryzom Core using Lua 5.2" OFF) ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS) MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS) @@ -387,11 +387,11 @@ MACRO(NL_SETUP_BUILD) SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR}) - IF(HOST_CPU MATCHES "amd64") + IF(HOST_CPU MATCHES "(amd|AMD)64") SET(HOST_CPU "x86_64") ELSEIF(HOST_CPU MATCHES "i.86") SET(HOST_CPU "x86") - ENDIF(HOST_CPU MATCHES "amd64") + ENDIF(HOST_CPU MATCHES "(amd|AMD)64") # Determine target CPU @@ -400,11 +400,11 @@ MACRO(NL_SETUP_BUILD) SET(TARGET_CPU ${CMAKE_SYSTEM_PROCESSOR}) ENDIF(NOT TARGET_CPU) - IF(TARGET_CPU MATCHES "amd64") + IF(TARGET_CPU MATCHES "(amd|AMD)64") SET(TARGET_CPU "x86_64") ELSEIF(TARGET_CPU MATCHES "i.86") SET(TARGET_CPU "x86") - ENDIF(TARGET_CPU MATCHES "amd64") + ENDIF(TARGET_CPU MATCHES "(amd|AMD)64") IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") SET(CLANG ON) @@ -416,6 +416,11 @@ MACRO(NL_SETUP_BUILD) MESSAGE(STATUS "Generating Xcode project") ENDIF(CMAKE_GENERATOR MATCHES "Xcode") + IF(CMAKE_GENERATOR MATCHES "NMake") + SET(NMAKE ON) + MESSAGE(STATUS "Generating NMake project") + ENDIF(CMAKE_GENERATOR MATCHES "NMake") + # If target and host CPU are the same IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING) # x86-compatible CPU @@ -535,6 +540,9 @@ MACRO(NL_SETUP_BUILD) SET(MSVC11 ON) ENDIF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11) + # Ignore default include paths + ADD_PLATFORM_FLAGS("/X") + IF(MSVC11) ADD_PLATFORM_FLAGS("/Gy- /MP") # /Ox is working with VC++ 2010, but custom optimizations don't exist @@ -894,20 +902,23 @@ ENDMACRO(NL_SETUP_BUILD) MACRO(NL_SETUP_BUILD_FLAGS) SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE) SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE) + SET(CMAKE_EXE_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE) + SET(CMAKE_MODULE_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE) + SET(CMAKE_SHARED_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE) ## Debug SET(CMAKE_C_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE) SET(CMAKE_CXX_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE) - SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${PLATFORM_LINKFLAGS} ${NL_DEBUG_LINKFLAGS}" CACHE STRING "" FORCE) - SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${PLATFORM_LINKFLAGS} ${NL_DEBUG_LINKFLAGS}" CACHE STRING "" FORCE) - SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${PLATFORM_LINKFLAGS} ${NL_DEBUG_LINKFLAGS}" CACHE STRING "" FORCE) + SET(CMAKE_EXE_LINKER_FLAGS_DEBUG ${NL_DEBUG_LINKFLAGS} CACHE STRING "" FORCE) + SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG ${NL_DEBUG_LINKFLAGS} CACHE STRING "" FORCE) + SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG ${NL_DEBUG_LINKFLAGS} CACHE STRING "" FORCE) ## Release SET(CMAKE_C_FLAGS_RELEASE ${NL_RELEASE_CFLAGS} CACHE STRING "" FORCE) SET(CMAKE_CXX_FLAGS_RELEASE ${NL_RELEASE_CFLAGS} CACHE STRING "" FORCE) - SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${NL_RELEASE_LINKFLAGS}" CACHE STRING "" FORCE) - SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${NL_RELEASE_LINKFLAGS}" CACHE STRING "" FORCE) - SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${NL_RELEASE_LINKFLAGS}" CACHE STRING "" FORCE) + SET(CMAKE_EXE_LINKER_FLAGS_RELEASE ${NL_RELEASE_LINKFLAGS} CACHE STRING "" FORCE) + SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE ${NL_RELEASE_LINKFLAGS} CACHE STRING "" FORCE) + SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE ${NL_RELEASE_LINKFLAGS} CACHE STRING "" FORCE) ENDMACRO(NL_SETUP_BUILD_FLAGS) # Macro to create x_ABSOLUTE_PREFIX from x_PREFIX @@ -1061,74 +1072,14 @@ MACRO(SETUP_EXTERNAL) IF(WIN32) FIND_PACKAGE(External REQUIRED) - IF(NOT VC_DIR) - SET(VC_DIR $ENV{VC_DIR}) - ENDIF(NOT VC_DIR) - - IF(MSVC11) - IF(NOT MSVC_REDIST_DIR) - # If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist - SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF(NOT MSVC_REDIST_DIR) - - IF(NOT VC_DIR) - IF(NOT VC_ROOT_DIR) - GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\11.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\\WDExpress\\11.0_Config\\Setup\\VC;InstallDir]" ABSOLUTE) - IF(VC_ROOT_DIR MATCHES "registry") - SET(VS110COMNTOOLS $ENV{VS110COMNTOOLS}) - IF(VS110COMNTOOLS) - FILE(TO_CMAKE_PATH ${VS110COMNTOOLS} VC_ROOT_DIR) - ENDIF(VS110COMNTOOLS) - IF(NOT VC_ROOT_DIR) - MESSAGE(FATAL_ERROR "Unable to find VC++ 2012 directory!") - ENDIF(NOT VC_ROOT_DIR) - ENDIF(VC_ROOT_DIR MATCHES "registry") - ENDIF(VC_ROOT_DIR MATCHES "registry") - ENDIF(NOT VC_ROOT_DIR) - # convert IDE fullpath to VC++ path - STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR}) - ENDIF(NOT VC_DIR) - ELSEIF(MSVC10) - IF(NOT MSVC_REDIST_DIR) - # If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist - SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist") - ENDIF(NOT MSVC_REDIST_DIR) - - IF(NOT VC_DIR) - IF(NOT VC_ROOT_DIR) - 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") - SET(VS100COMNTOOLS $ENV{VS100COMNTOOLS}) - IF(VS100COMNTOOLS) - FILE(TO_CMAKE_PATH ${VS100COMNTOOLS} VC_ROOT_DIR) - ENDIF(VS100COMNTOOLS) - IF(NOT VC_ROOT_DIR) - MESSAGE(FATAL_ERROR "Unable to find VC++ 2010 directory!") - ENDIF(NOT VC_ROOT_DIR) - ENDIF(VC_ROOT_DIR MATCHES "registry") - ENDIF(VC_ROOT_DIR MATCHES "registry") - ENDIF(NOT VC_ROOT_DIR) - # convert IDE fullpath to VC++ path - STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR}) - ENDIF(NOT VC_DIR) - ELSE(MSVC11) - IF(NOT VC_DIR) - 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(NOT VC_DIR) - ENDIF(MSVC11) + # If using custom boost, we need to define the right variables used by official boost CMake module + IF(DEFINED BOOST_DIR) + SET(BOOST_INCLUDEDIR ${BOOST_DIR}/include) + SET(BOOST_LIBRARYDIR ${BOOST_DIR}/lib) + ENDIF(DEFINED BOOST_DIR) ELSE(WIN32) + FIND_PACKAGE(External QUIET) + IF(APPLE) IF(WITH_STATIC_EXTERNAL) SET(CMAKE_FIND_LIBRARY_SUFFIXES .a) @@ -1144,15 +1095,22 @@ MACRO(SETUP_EXTERNAL) ENDIF(APPLE) ENDIF(WIN32) + # Android and iOS have pthread + IF(ANDROID OR IOS) + SET(CMAKE_USE_PTHREADS_INIT 1) + SET(Threads_FOUND TRUE) + ELSE(ANDROID OR IOS) + FIND_PACKAGE(Threads REQUIRED) + # TODO: replace all -l by absolute path to in CMAKE_THREAD_LIBS_INIT + ENDIF(ANDROID OR IOS) + IF(WITH_STLPORT) FIND_PACKAGE(STLport REQUIRED) INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR}) - IF(MSVC) - 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_DIRS}) - ENDIF(MSVC) ENDIF(WITH_STLPORT) + + IF(MSVC) + FIND_PACKAGE(MSVC REQUIRED) + FIND_PACKAGE(WindowsSDK REQUIRED) + ENDIF(MSVC) ENDMACRO(SETUP_EXTERNAL) diff --git a/code/nel/CMakeLists.txt b/code/nel/CMakeLists.txt index 1929135b4..53bf071e3 100644 --- a/code/nel/CMakeLists.txt +++ b/code/nel/CMakeLists.txt @@ -41,6 +41,14 @@ IF(WITH_GTK) FIND_PACKAGE(GTK2) ENDIF(WITH_GTK) +IF(WITH_LIBOVR) + FIND_PACKAGE(LibOVR) +ENDIF(WITH_LIBOVR) + +IF(WITH_LIBVR) + FIND_PACKAGE(LibVR) +ENDIF(WITH_LIBVR) + IF(WITH_INSTALL_LIBRARIES) IF(UNIX) SET(prefix ${CMAKE_INSTALL_PREFIX}) diff --git a/code/nel/include/nel/3d/bloom_effect.h b/code/nel/include/nel/3d/bloom_effect.h index 77673741c..c10967254 100644 --- a/code/nel/include/nel/3d/bloom_effect.h +++ b/code/nel/include/nel/3d/bloom_effect.h @@ -138,6 +138,8 @@ private: NLMISC::CSmartPtr _BlurFinalTex; // used as render target in first blur pass, and as displayed texture on second blur pass. NLMISC::CSmartPtr _BlurHorizontalTex; + // original render target + NLMISC::CSmartPtr _OriginalRenderTarget; // materials diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index d090d77da..3eb5823ca 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -26,10 +26,12 @@ #include "nel/misc/uv.h" #include "nel/misc/hierarchical_timer.h" #include "nel/3d/texture.h" -#include "nel/3d/shader.h" #include "nel/3d/vertex_buffer.h" #include "nel/3d/index_buffer.h" #include "nel/3d/vertex_program.h" +#include "nel/3d/pixel_program.h" +#include "nel/3d/geometry_program.h" +#include "nel/3d/gpu_program_params.h" #include "nel/3d/material.h" #include "nel/misc/mutex.h" #include "nel/3d/primitive_profile.h" @@ -119,9 +121,9 @@ public: static const uint32 InterfaceVersion; public: - enum TMessageBoxId { okId=0, yesId, noId, abortId, retryId, cancelId, ignoreId, idCount }; - enum TMessageBoxType { okType=0, okCancelType, yesNoType, abortRetryIgnoreType, yesNoCancelType, retryCancelType, typeCount }; - enum TMessageBoxIcon { noIcon=0, handIcon, questionIcon, exclamationIcon, asteriskIcon, warningIcon, errorIcon, informationIcon, stopIcon, iconCount }; + enum TMessageBoxId { okId = 0, yesId, noId, abortId, retryId, cancelId, ignoreId, idCount }; + enum TMessageBoxType { okType = 0, okCancelType, yesNoType, abortRetryIgnoreType, yesNoCancelType, retryCancelType, typeCount }; + enum TMessageBoxIcon { noIcon = 0, handIcon, questionIcon, exclamationIcon, asteriskIcon, warningIcon, errorIcon, informationIcon, stopIcon, iconCount }; enum TCullMode { CCW = 0, CW }; enum TStencilOp { keep = 0, zero, replace, incr, decr, invert }; enum TStencilFunc { never = 0, less, lessequal, equal, notequal, greaterequal, greater, always}; @@ -131,117 +133,225 @@ public: * * \see setPolygonMode, getPolygonMode */ - enum TPolygonMode { Filled=0, Line, Point }; - + enum TPolygonMode { Filled = 0, Line, Point }; /** * Driver Max matrix count. * Kept for backward compatibility. Suppose any Hardware VertexProgram can handle only 16 matrix * */ - enum TMatrixCount { MaxModelMatrix= 16 }; + enum TMatrixCount { MaxModelMatrix = 16 }; + enum TMatrix + { + ModelView= 0, + Projection, + ModelViewProjection, + NumMatrix + }; + + enum TTransform + { + Identity=0, + Inverse, + Transpose, + InverseTranspose, + NumTransform + }; + + enum TProgram + { + VertexProgram = 0, + PixelProgram = 1, + GeometryProgram = 2 + }; protected: + CSynchronized _SyncTexDrvInfos; + TTexDrvSharePtrList _TexDrvShares; + TMatDrvInfoPtrList _MatDrvInfos; + TVBDrvInfoPtrList _VBDrvInfos; + TIBDrvInfoPtrList _IBDrvInfos; + TGPUPrgDrvInfoPtrList _GPUPrgDrvInfos; - CSynchronized _SyncTexDrvInfos; - - TTexDrvSharePtrList _TexDrvShares; - TMatDrvInfoPtrList _MatDrvInfos; - TVBDrvInfoPtrList _VBDrvInfos; - TIBDrvInfoPtrList _IBDrvInfos; TPolygonMode _PolygonMode; - TVtxPrgDrvInfoPtrList _VtxPrgDrvInfos; - TShaderDrvInfoPtrList _ShaderDrvInfos; uint _ResetCounter; public: - IDriver(void); - virtual ~IDriver(void); + IDriver(); + virtual ~IDriver(); - virtual bool init (uint windowIcon = 0, emptyProc exitFunc = 0)=0; + virtual bool init(uint windowIcon = 0, emptyProc exitFunc = 0) = 0; + + /// Deriver should calls IDriver::release() first, to destroy all driver components (textures, shaders, VBuffers). + virtual bool release(); + + /// Before rendering via a driver in a thread, must activate() (per thread). + virtual bool activate() = 0; // Test if the device is lost. Can only happen with D3D. // The calling application may skip some part of its rendering when it is the case (this is not a requirement, but may save cpu for other applications) virtual bool isLost() const = 0; + /// Return true if driver is still active. Return false else. If he user close the window, must return false. + virtual bool isActive() = 0; + + + + /** Return the driver reset counter. + * The reset counter is incremented at each driver reset. + */ + uint getResetCounter() const { return _ResetCounter; } + + // get the number of call to swapBuffer since the driver was created + virtual uint64 getSwapBufferCounter() const = 0; + + + /// \name Disable Hardware Feature /** Disable some Feature that may be supported by the Hardware * Call before setDisplay() to work properly */ // @{ - virtual void disableHardwareVertexProgram()=0; - virtual void disableHardwareVertexArrayAGP()=0; - virtual void disableHardwareTextureShader()=0; + virtual void disableHardwareVertexProgram() = 0; + virtual void disableHardwarePixelProgram() = 0; + virtual void disableHardwareVertexArrayAGP() = 0; + virtual void disableHardwareTextureShader() = 0; // @} + + + /// \name Windowing + // @{ // first param is the associated window. // Must be a HWND for Windows (WIN32). - virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show = true, bool resizeable = true) throw(EBadDisplay)=0; + virtual bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show = true, bool resizeable = true) throw(EBadDisplay) = 0; // Must be called after a setDisplay that initialize the mode - virtual bool setMode(const GfxMode& mode)=0; - virtual bool getModes(std::vector &modes)=0; + virtual bool setMode(const GfxMode &mode) = 0; + virtual bool getModes(std::vector &modes) = 0; /// Set the title of the NeL window - virtual void setWindowTitle(const ucstring &title)=0; - + virtual void setWindowTitle(const ucstring &title) = 0; /// Set icon(s) of the NeL window - virtual void setWindowIcon(const std::vector &bitmaps)=0; - + virtual void setWindowIcon(const std::vector &bitmaps) = 0; /// Set the position of the NeL window - virtual void setWindowPos(sint32 x, sint32 y)=0; - + virtual void setWindowPos(sint32 x, sint32 y) = 0; /// Show or hide the NeL window - virtual void showWindow(bool show)=0; + virtual void showWindow(bool show) = 0; /// return the current screen mode (if we are in windowed, return the screen mode behind the window) - virtual bool getCurrentScreenMode(GfxMode &mode)=0; + virtual bool getCurrentScreenMode(GfxMode &mode) = 0; /// enter/leave the dialog mode - virtual void beginDialogMode() =0; - virtual void endDialogMode() =0; + virtual void beginDialogMode() = 0; + virtual void endDialogMode() = 0; // Return is the associated window information. (Implementation dependent) // Must be a HWND for Windows (WIN32). - virtual nlWindow getDisplay() =0; + virtual nlWindow getDisplay() = 0; - /** - * Setup monitor color properties. - * - * Return false if setup failed. - */ - virtual bool setMonitorColorProperties (const CMonitorColorProperties &properties) = 0; + /// Setup monitor color properties. Return false if setup failed + virtual bool setMonitorColorProperties(const CMonitorColorProperties &properties) = 0; // Return is the associated default window proc for the driver. (Implementation dependent) // Must be a void GlWndProc(IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) for Windows (WIN32). virtual emptyProc getWindowProc() = 0; - /// Before rendering via a driver in a thread, must activate() (per thread). - virtual bool activate(void) = 0; + virtual NLMISC::IEventEmitter *getEventEmitter() = 0; + + /// Copy a string to system clipboard. + virtual bool copyTextToClipboard(const ucstring &text) = 0; - /// Get the number of texture stage available, for multi texturing (Normal material shaders). Valid only after setDisplay(). - virtual uint getNbTextureStages() const = 0; + /// Paste a string from system clipboard. + virtual bool pasteTextFromClipboard(ucstring &text) = 0;/// Return the depth of the driver after init(). - /** is the texture is set up in the driver - * NB: this method is thread safe. - */ - virtual bool isTextureExist(const ITexture&tex)=0; + virtual uint8 getBitPerPixel() = 0; - virtual NLMISC::IEventEmitter* getEventEmitter(void) = 0; + /** Output a system message box and print a message with an icon. This method can be call even if the driver is not initialized. + * This method is used to return internal driver problem when string can't be displayed in the driver window. + * If the driver can't open a messageBox, it should not override this method and let the IDriver class manage it with the ASCII console. + * + * \param message This is the message to display in the message box. + * \param title This is the title of the message box. + * \param type This is the type of the message box, ie number of button and label of buttons. + * \param icon This is the icon of the message box should use like warning, error etc... + */ + virtual TMessageBoxId systemMessageBox(const char *message, const char *title, TMessageBoxType type = okType, TMessageBoxIcon icon = noIcon); - /* Clear the current target surface pixels. The function ignores the viewport settings but uses the scissor. */ + /// Get the width and the height of the window + virtual void getWindowSize(uint32 &width, uint32 &height) = 0; + + /// Get the position of the window always (0,0) in fullscreen + virtual void getWindowPos(sint32 &x, sint32 &y) = 0; + // @} + + + + /// \name Framebuffer operations + // @{ + /// Clear the current target surface pixels. The function ignores the viewport settings but uses the scissor. virtual bool clear2D(CRGBA rgba) = 0; - /* Clear the current target surface zbuffer. The function ignores the viewport settings but uses the scissor. */ + /// Clear the current target surface zbuffer. The function ignores the viewport settings but uses the scissor. virtual bool clearZBuffer(float zval=1) = 0; - /* Clear the current target surface stencil buffer. The function ignores the viewport settings but uses the scissor. */ + /// Clear the current target surface stencil buffer. The function ignores the viewport settings but uses the scissor. virtual bool clearStencilBuffer(float stencilval=0) = 0; /// Set the color mask filter through where the operation done will pass - virtual void setColorMask (bool bRed, bool bGreen, bool bBlue, bool bAlpha) = 0; + virtual void setColorMask(bool bRed, bool bGreen, bool bBlue, bool bAlpha) = 0; + // @} + + + /// \name Copy framebuffer to memory + // @{ + /** get the RGBA back buffer. After swapBuffers(), the content of the back buffer is undefined. + * + * \param bitmap the buffer will be written in this bitmap + */ + virtual void getBuffer(CBitmap &bitmap) = 0; + + /** get the ZBuffer (back buffer). + * + * \param zbuffer the returned array of Z. size of getWindowSize() . + */ + virtual void getZBuffer(std::vector &zbuffer) = 0; + + /** get a part of the RGBA back buffer. After swapBuffers(), the content of the back buffer is undefined. + * NB: 0,0 is the bottom left corner of the screen. + * + * \param bitmap the buffer will be written in this bitmap + * \param rect the in/out (wanted/clipped) part of Color buffer to retrieve. + */ + virtual void getBufferPart(CBitmap &bitmap, NLMISC::CRect &rect) = 0; + + /** get a part of the ZBuffer (back buffer). + * NB: 0,0 is the bottom left corner of the screen. + * + * \param zbuffer the returned array of Z. size of rec.Width*rec.Height. + * \param rect the in/out (wanted/clipped) part of ZBuffer to retrieve. + */ + virtual void getZBufferPart(std::vector &zbuffer, NLMISC::CRect &rect) = 0; + // @} + + + + /// \name Copy memory to framebuffer + // @{ + /** fill the RGBA back buffer + * + * \param bitmap will be written in the buffer. no-op if bad size. + * \return true if success + */ + virtual bool fillBuffer(CBitmap &bitmap) = 0; + // @} + + + + /// \name Viewport depth clipping + // @{ /** Set depth range. Depth range specify a linear mapping from device z coordinates (in the [-1, 1] range) to window coordinates (in the [0, 1] range) * This mapping occurs after clipping of primitives and division by w of vertices coordinates. * Default depth range is [0, 1]. @@ -250,11 +360,20 @@ public: virtual void setDepthRange(float znear, float zfar) = 0; // Get the current depth range virtual void getDepthRange(float &znear, float &zfar) const = 0; + // @} + + + /// \name Textures + // @{ + /** is the texture is set up in the driver + * NB: this method is thread safe. + */ + virtual bool isTextureExist(const ITexture &tex) = 0; /** setup a texture, generate and upload if needed. same as setupTextureEx(tex, true, dummy); */ - virtual bool setupTexture(ITexture& tex) = 0; + virtual bool setupTexture(ITexture &tex) = 0; /** setup a texture in the driver. * \param bUpload if true the texture is created and uploaded to VRAM, if false the texture is only created @@ -267,64 +386,81 @@ public: * is only bound to tex (thus creating and uploading nothing) * NB: the texture must be at least touch()-ed for the recreate to work. */ - virtual bool setupTextureEx (ITexture& tex, bool bUpload, bool& bAllUploaded, - bool bMustRecreateSharedTexture= false) = 0; + virtual bool setupTextureEx( ITexture &tex, bool bUpload, bool &bAllUploaded, + bool bMustRecreateSharedTexture = false) = 0; /** The texture must be created or uploadTexture do nothing. * These function can be used to upload piece by piece a texture. Use it in conjunction with setupTextureEx(..., false); * For compressed textures, the rect must aligned on pixel block. (a block of pixel size is 4x4 pixels). */ - virtual bool uploadTexture (ITexture& tex, NLMISC::CRect& rect, uint8 nNumMipMap) = 0; - virtual bool uploadTextureCube (ITexture& tex, NLMISC::CRect& rect, uint8 nNumMipMap, uint8 nNumFace) = 0; + virtual bool uploadTexture(ITexture &tex, NLMISC::CRect &rect, uint8 nNumMipMap) = 0; + virtual bool uploadTextureCube(ITexture &tex, NLMISC::CRect &rect, uint8 nNumMipMap, uint8 nNumFace) = 0; /** * Invalidate shared texture */ - bool invalidateShareTexture (ITexture &); + bool invalidateShareTexture(ITexture &); /** * Get the driver share texture name */ - static void getTextureShareName (const ITexture& tex, std::string &output); + static void getTextureShareName(const ITexture &tex, std::string &output); /** if true force all the uncompressed RGBA 32 bits and RGBA 24 bits texture to be DXTC5 compressed. * Do this only during upload if ITexture::allowDegradation() is true and if ITexture::UploadFormat is "Automatic" * and if bitmap format is RGBA. */ - virtual void forceDXTCCompression(bool dxtcComp)=0; + virtual void forceDXTCCompression(bool dxtcComp) = 0; /** if different from 0, enable anisotropic filter on textures. -1 enables max value. * Default is 0. */ - virtual void setAnisotropicFilter(sint filter)=0; + virtual void setAnisotropicFilter(sint filter) = 0; /** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..) * to be divided by Divisor (2, 4, 8...) * Default is 1. * NB: this is done only on TextureFile */ - virtual void forceTextureResize(uint divisor)=0; + virtual void forceTextureResize(uint divisor) = 0; - /** Sets enforcement of native fragment programs. This is by default enabled. - * - * \param nativeOnly If set to false, fragment programs don't need to be native to stay loaded, - * otherwise (aka if true) they will be purged. + /** Get the number of texture stage available, for multi texturing (Normal material shaders). Valid only after setDisplay(). */ - virtual void forceNativeFragmentPrograms(bool nativeOnly) = 0; + virtual uint getNbTextureStages() const = 0; - - virtual bool setupMaterial(CMaterial& mat)=0; - - /** - * Activate a shader, NULL to disable the current shader. + /** Get max number of per stage constant that can be used simultaneously. + * This will usually match the number of texture stages, but with a D3D driver, this feature is not available most of the time + * so it is emulated. If pixel shaders are available this will be fully supported. + * Under OpenGL this simply returns the maximum number of texture stages (getNbTextureStages) in both return values. */ - virtual bool activeShader(CShader *shd)=0; + virtual void getNumPerStageConstant(uint &lightedMaterial, uint &unlightedMaterial) const = 0; + + // [DEPRECATED] Return if this texture is a rectangle texture that requires RECT sampler (OpenGL specific pre-NPOT functionality) + virtual bool isTextureRectangle(ITexture *tex) const = 0; + + // Return true if driver support non-power of two textures + virtual bool supportNonPowerOfTwoTextures() const = 0; + // @} + + + + /// \name Texture operations + // @{ + // copy the first texture in a second one of different dimensions + virtual bool stretchRect(ITexture *srcText, NLMISC::CRect &srcRect, ITexture *destText, NLMISC::CRect &destRect) = 0; + // @} + + + + /// \name Material + // @{ + virtual bool setupMaterial(CMaterial &mat) = 0; /** Special for Faster Specular Setup. Call this between lot of primitives rendered with Specular Materials. * Visual Errors may arise if you don't correctly call endSpecularBatch(). */ - virtual void startSpecularBatch()=0; - virtual void endSpecularBatch()=0; + virtual void startSpecularBatch() = 0; + virtual void endSpecularBatch() = 0; /// \name Material multipass. /** NB: setupMaterial() must be called before those methods. @@ -332,18 +468,26 @@ public: * NB: Other render calls performs the needed setup automatically */ // @{ - /// init multipass for _CurrentMaterial. return number of pass required to render this material. - virtual sint beginMaterialMultiPass() = 0; - /// active the ith pass of this material. - virtual void setupMaterialPass(uint pass) = 0; - /// end multipass for this material. - virtual void endMaterialMultiPass() = 0; + /// init multipass for _CurrentMaterial. return number of pass required to render this material. + virtual sint beginMaterialMultiPass() = 0; + /// active the ith pass of this material. + virtual void setupMaterialPass(uint pass) = 0; + /// end multipass for this material. + virtual void endMaterialMultiPass() = 0; // @} + // Does the driver support the per-pixel lighting shader ? + virtual bool supportPerPixelLighting(bool specular) const = 0; + // @} + + + + /// \name Camera + // @{ // Setup the camera mode as a perspective/ortho camera. NB: znear and zfar must be >0 (if perspective). - virtual void setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective=true)=0; - virtual void setFrustumMatrix(CMatrix &frust)=0; - virtual CMatrix getFrustumMatrix()=0; + virtual void setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective = true) = 0; + virtual void setFrustumMatrix(CMatrix &frust) = 0; + virtual CMatrix getFrustumMatrix() = 0; virtual float getClipSpaceZMin() const = 0; @@ -351,7 +495,7 @@ public: * * NB: you must setupViewMatrix() BEFORE setupModelMatrix(), or else undefined results. */ - virtual void setupViewMatrix(const CMatrix& mtx)=0; + virtual void setupViewMatrix(const CMatrix &mtx)=0; /** setup the view matrix (inverse of camera matrix). * Extended: give a cameraPos (mtx.Pos() is not taken into account but for getViewMatrix()), @@ -365,38 +509,40 @@ public: * \param mtx the same view matrix (still with correct "inversed" camera position) as if passed in setupViewMatrix() * \param cameraPos position of the camera (before inversion, ie mtx.getPos()!=cameraPos ). */ - virtual void setupViewMatrixEx(const CMatrix& mtx, const CVector &cameraPos)=0; + virtual void setupViewMatrixEx(const CMatrix &mtx, const CVector &cameraPos) = 0; /** setup the model matrix. * * NB: you must setupModelMatrix() AFTER setupViewMatrix(), or else undefined results. */ - virtual void setupModelMatrix(const CMatrix& mtx)=0; + virtual void setupModelMatrix(const CMatrix &mtx) = 0; - virtual CMatrix getViewMatrix(void)const=0; + virtual CMatrix getViewMatrix() const = 0; + // @} + + /// \name Fixed pipeline vertex program + // @{ /** Force input normal to be normalized by the driver. default is false. * NB: driver force the normalization himself if: * - current Model matrix has a scale. */ - virtual void forceNormalize(bool normalize)=0; + virtual void forceNormalize(bool normalize) = 0; /** return the forceNormalize() state. */ - virtual bool isForceNormalize() const =0; + virtual bool isForceNormalize() const = 0; + // @} + - /** Get max number of per stage constant that can be used simultaneously. - * This will usually match the number of texture stages, but with a D3D driver, this feature is not available most of the time - * so it is emulated. If pixel shaders are available this will be fully supported. - */ - virtual void getNumPerStageConstant(uint &lightedMaterial, uint &unlightedMaterial) const = 0; - + /// \name Vertex Buffer Hard: Features + // @{ /** return true if driver support VertexBufferHard. */ - virtual bool supportVertexBufferHard() const =0; + virtual bool supportVertexBufferHard() const = 0; /** return true if volatile vertex buffer are supported. (e.g a vertex buffer which can be created with the flag CVertexBuffer::AGPVolatile or CVertexBuffer::RAMVolatile) * If these are not supported, a RAM vb is created instead (transparent to user) @@ -410,9 +556,13 @@ public: /** return true if driver support VertexBufferHard, but vbHard->unlock() are slow (ATI-openGL). */ - virtual bool slowUnlockVertexBufferHard() const =0; + virtual bool slowUnlockVertexBufferHard() const = 0; + // @} + + /// \name Vertex Buffer Hard: Settings + // @{ /* Returns true if static vertex and index buffers must by allocated in VRAM, false in AGP. * Default is false. */ @@ -423,16 +573,15 @@ public: */ void setStaticMemoryToVRAM(bool staticMemoryToVRAM); - /** Return the driver reset counter. - * The reset counter is incremented at each driver reset. - */ - uint getResetCounter () const { return _ResetCounter; } - /** return How many vertices VertexBufferHard support */ - virtual uint getMaxVerticesByVertexBufferHard() const =0; + virtual uint getMaxVerticesByVertexBufferHard() const = 0; + // @} + + /// \name Vertex Buffer Hard + // @{ /** Allocate the initial VertexArray Memory. (no-op if !supportVertexBufferHard()). * VertexArrayRange is first reseted, so any VBhard created before will be deleted. * NB: call it after setDisplay(). But setDisplay() by default call initVertexBufferHard(16Mo, 0); @@ -442,17 +591,21 @@ public: * \param vramMem amount of VRAM Memory required. if 0, reseted. * \return false if one the Buffer has not been allocated (at least at 500K). */ - virtual bool initVertexBufferHard(uint agpMem, uint vramMem=0) =0; + virtual bool initVertexBufferHard(uint agpMem, uint vramMem = 0) = 0; /** Return the amount of AGP memory allocated by initVertexBufferHard() to store vertices. */ - virtual uint32 getAvailableVertexAGPMemory () =0; + virtual uint32 getAvailableVertexAGPMemory() = 0; /** Return the amount of video memory allocated by initVertexBufferHard() to store vertices. */ - virtual uint32 getAvailableVertexVRAMMemory () =0; + virtual uint32 getAvailableVertexVRAMMemory() = 0; + // @} + + /// \name Vertex Buffer Objects + // @{ /** active a current VB, for future render(). * This method suppose that all vertices in the VB will be used. * @@ -462,30 +615,33 @@ public: * * \see activeVertexProgram */ - virtual bool activeVertexBuffer(CVertexBuffer& VB)=0; - + virtual bool activeVertexBuffer(CVertexBuffer &VB) = 0; /** active a current IB, for future render(). * * Don't change the index buffer format/size after having activated it. * Don't lock the index buffer after having activated it. */ - virtual bool activeIndexBuffer(CIndexBuffer& IB)=0; + virtual bool activeIndexBuffer(CIndexBuffer &IB) = 0; + // @} + + /// \name Rendering + // @{ /** Render a list of indexed lines with previously setuped VertexBuffer / IndexBuffer / Matrixes. * \param mat is the material to use during this rendering * \param firstIndex is the first index in the index buffer to use as first line. * \param nlines is the number of line to render. */ - virtual bool renderLines(CMaterial& mat, uint32 firstIndex, uint32 nlines)=0; + virtual bool renderLines(CMaterial &mat, uint32 firstIndex, uint32 nlines) = 0; /** Render a list of indexed triangles with previously setuped VertexBuffer / IndexBuffer / Matrixes. * \param mat is the material to use during this rendering * \param firstIndex is the first index in the index buffer to use as first triangle. * \param ntris is the number of triangle to render. */ - virtual bool renderTriangles(CMaterial& mat, uint32 firstIndex, uint32 ntris)=0; + virtual bool renderTriangles(CMaterial &mat, uint32 firstIndex, uint32 ntris) = 0; /** Render a list of triangles with previously setuped VertexBuffer / IndexBuffer / Matrixes, AND previously setuped MATERIAL!! * This use the last material setuped. It should be a "Normal shader" material, because no multi-pass is allowed @@ -496,7 +652,7 @@ public: * \param firstIndex is the first index in the index buffer to use as first triangle. * \param ntris is the number of triangle to render. */ - virtual bool renderSimpleTriangles(uint32 firstIndex, uint32 ntris)=0; + virtual bool renderSimpleTriangles(uint32 firstIndex, uint32 ntris) = 0; /** Render points with previously setuped VertexBuffer / Matrixes. * Points are stored as a sequence in the vertex buffer. @@ -504,7 +660,7 @@ public: * \param startVertex is the first vertex to use during this rendering. * \param numPoints is the number of point to render. */ - virtual bool renderRawPoints(CMaterial& mat, uint32 startVertex, uint32 numPoints)=0; + virtual bool renderRawPoints(CMaterial &mat, uint32 startVertex, uint32 numPoints) = 0; /** Render lines with previously setuped VertexBuffer / Matrixes. * Lines are stored as a sequence in the vertex buffer. @@ -512,7 +668,7 @@ public: * \param startVertex is the first vertex to use during this rendering. * \param numLine is the number of line to render. */ - virtual bool renderRawLines(CMaterial& mat, uint32 startVertex, uint32 numTri)=0; + virtual bool renderRawLines(CMaterial &mat, uint32 startVertex, uint32 numTri) = 0; /** Render triangles with previously setuped VertexBuffer / Matrixes. * Triangles are stored as a sequence in the vertex buffer. @@ -520,15 +676,15 @@ public: * \param startVertex is the first vertex to use during this rendering. * \param numTri is the number of triangle to render. */ - virtual bool renderRawTriangles(CMaterial& mat, uint32 startVertex, uint32 numTri)=0; + virtual bool renderRawTriangles(CMaterial &mat, uint32 startVertex, uint32 numTri) = 0; /** If the driver support it, primitive can be rendered with an offset added to each index * These are the offseted version of the 'render' functions * \see supportIndexOffset */ - virtual bool renderLinesWithIndexOffset(CMaterial& mat, uint32 firstIndex, uint32 nlines, uint indexOffset)=0; - virtual bool renderTrianglesWithIndexOffset(CMaterial& mat, uint32 firstIndex, uint32 ntris, uint indexOffset)=0; - virtual bool renderSimpleTrianglesWithIndexOffset(uint32 firstIndex, uint32 ntris, uint indexOffset)=0; + virtual bool renderLinesWithIndexOffset(CMaterial &mat, uint32 firstIndex, uint32 nlines, uint indexOffset) = 0; + virtual bool renderTrianglesWithIndexOffset(CMaterial &mat, uint32 firstIndex, uint32 ntris, uint indexOffset) = 0; + virtual bool renderSimpleTrianglesWithIndexOffset(uint32 firstIndex, uint32 ntris, uint indexOffset) = 0; /** render quads with previously setuped VertexBuffer / Matrixes. @@ -545,8 +701,13 @@ public: * \param startVertex is the first vertex to use during this rendering. * \param numQuad is the number of quad to render. */ - virtual bool renderRawQuads(CMaterial& mat, uint32 startVertex, uint32 numQuads)=0; + virtual bool renderRawQuads(CMaterial &mat, uint32 startVertex, uint32 numQuads) = 0; + // @} + + + /// \name Texture coordinates fixed pipeline + // @{ /** Say what Texture Stage use what UV coord. * by default activeVertexBuffer*() methods map all stage i to UV i. You can change this behavior, * after calling activeVertexBuffer*(), by using this method. @@ -558,63 +719,58 @@ public: * Warning!: some CMaterial Shader may change automatically this behavior too when setupMaterial() * (and so render*()) is called. But Normal shader doesn't do it. */ - virtual void mapTextureStageToUV(uint stage, uint uv)=0; + virtual void mapTextureStageToUV(uint stage, uint uv) = 0; + // @} + + + /// \name Buffer swapping + // @{ /// Swap the back and front buffers. - virtual bool swapBuffers(void)=0; - - /// Copy a string to system clipboard. - virtual bool copyTextToClipboard(const ucstring &text) =0; - - /// Paste a string from system clipboard. - virtual bool pasteTextFromClipboard(ucstring &text) =0; + virtual bool swapBuffers() = 0; /** set the number of VBL wait when a swapBuffers() is issued. 0 means no synchronisation to the VBL * Default is 1. Values >1 may be clamped to 1 by the driver. */ - virtual void setSwapVBLInterval(uint interval)=0; + virtual void setSwapVBLInterval(uint interval) = 0; /// get the number of VBL wait when a swapBuffers() is issued. 0 means no synchronisation to the VBL - virtual uint getSwapVBLInterval()=0; + virtual uint getSwapVBLInterval() = 0; + // @} + + + /// \name Profiling. // @{ - - /** Get the number of primitives rendered from the last swapBuffers() call. * \param pIn the number of requested rendered primitive. * \param pOut the number of effective rendered primitive. pOut==pIn if no multi-pass material is used * (Lightmap, Specular ...). */ - virtual void profileRenderedPrimitives(CPrimitiveProfile &pIn, CPrimitiveProfile &pOut) =0; - + virtual void profileRenderedPrimitives(CPrimitiveProfile &pIn, CPrimitiveProfile &pOut) = 0; /** Return the amount of Texture memory requested. taking mipmap, compression, texture format, etc... into account. * NB: because of GeForce*, RGB888 is considered to be 32 bits. So it may be false for others cards :). */ - virtual uint32 profileAllocatedTextureMemory() =0; - + virtual uint32 profileAllocatedTextureMemory() = 0; /** Get the number of material setuped from the last swapBuffers() call. */ - virtual uint32 profileSetupedMaterials() const =0; - + virtual uint32 profileSetupedMaterials() const = 0; /** Get the number of matrix setuped from the last swapBuffers() call. */ - virtual uint32 profileSetupedModelMatrix() const =0; - + virtual uint32 profileSetupedModelMatrix() const = 0; /** Enable the sum of texture memory used since last swapBuffers() call. To retrieve the memory used call getUsedTextureMemory(). */ - virtual void enableUsedTextureMemorySum (bool enable=true) =0; - + virtual void enableUsedTextureMemorySum (bool enable = true) = 0; /** Return the amount of texture video memory used since last swapBuffers() call. Before use this method, you should enable * the sum with enableUsedTextureMemorySum(). */ - virtual uint32 getUsedTextureMemory() const =0; - + virtual uint32 getUsedTextureMemory() const = 0; /** If the driver support it, enable profile VBHard locks. * No-Op if already profiling @@ -643,179 +799,126 @@ public: /** For each texture setuped in the driver, "print" result: type, shareName, format and size (mipmap included) */ void profileTextureUsage(std::vector &result); - // @} + /// \name Fog support. // @{ - virtual bool fogEnabled()=0; - virtual void enableFog(bool enable)=0; + virtual bool fogEnabled() = 0; + virtual void enableFog(bool enable = true) = 0; /// setup fog parameters. fog must enabled to see result. start and end are distance values. - virtual void setupFog(float start, float end, CRGBA color)=0; + virtual void setupFog(float start, float end, NLMISC::CRGBA color) = 0; /// Get. - virtual float getFogStart() const =0; - virtual float getFogEnd() const =0; - virtual CRGBA getFogColor() const =0; + virtual float getFogStart() const = 0; + virtual float getFogEnd() const = 0; + virtual NLMISC::CRGBA getFogColor() const = 0; // @} - /// Deriver should calls IDriver::release() first, to destroy all driver components (textures, shaders, VBuffers). - virtual bool release(void); - /// Return true if driver is still active. Return false else. If he user close the window, must return false. - virtual bool isActive()=0; - - /// Return the depth of the driver after init(). - virtual uint8 getBitPerPixel ()=0; - - /** Output a system message box and print a message with an icon. This method can be call even if the driver is not initialized. - * This method is used to return internal driver problem when string can't be displayed in the driver window. - * If the driver can't open a messageBox, it should not override this method and let the IDriver class manage it with the ASCII console. - * - * \param message This is the message to display in the message box. - * \param title This is the title of the message box. - * \param type This is the type of the message box, ie number of button and label of buttons. - * \param icon This is the icon of the message box should use like warning, error etc... - */ - virtual TMessageBoxId systemMessageBox (const char* message, const char* title, TMessageBoxType type=okType, TMessageBoxIcon icon=noIcon); + /// \name Viewport + // @{ /** Set the current viewport * * \param viewport is a viewport to setup as current viewport. */ - virtual void setupViewport (const class CViewport& viewport)=0; + virtual void setupViewport(const class CViewport &viewport) = 0; /** Get the current viewport */ virtual void getViewport(CViewport &viewport) = 0; - /** Set the current Scissor. * \param scissor is a scissor to setup the current Scissor, in Window relative coordinate (0,1). */ - virtual void setupScissor (const class CScissor& scissor)=0; + virtual void setupScissor(const class CScissor &scissor) = 0; + // @} + + /// \name Driver information + // @{ /** * Get the driver version. Not the same than interface version. Incremented at each implementation change. * * \see InterfaceVersion */ - virtual uint32 getImplementationVersion () const = 0; + virtual uint32 getImplementationVersion() const = 0; /** * Get driver information. * get the nel name of the driver (ex: "Opengl 1.2 NeL Driver") */ - virtual const char* getDriverInformation () = 0; + virtual const char *getDriverInformation() = 0; /** * Get videocard information. * get the official name of the driver */ - virtual const char* getVideocardInformation () = 0; + virtual const char *getVideocardInformation () = 0; + // @} + + /// \name Mouse / Keyboard / Game devices // @{ - /// show cursor if b is true, or hide it if b is false - virtual void showCursor (bool b) = 0; + /// show cursor if b is true, or hide it if b is false + virtual void showCursor(bool b) = 0; - /// x and y must be between 0.0 and 1.0 - virtual void setMousePos (float x, float y) = 0; + /// x and y must be between 0.0 and 1.0 + virtual void setMousePos(float x, float y) = 0; - /** Enable / disable low level mouse. This allow to take advantage of some options (speed of the mouse, automatic wrapping) - * It returns a interface to these parameters when it is supported, or NULL otherwise - * The interface pointer is valid as long as the low level mouse is enabled. - * A call to disable the mouse returns NULL, and restore the default mouse behavior - * NB : - In this mode the mouse cursor isn't drawn. - * - Calls to showCursor have no effects - * - Calls to setCapture have no effects - */ - virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool exclusive) = 0; + /** Enable / disable low level mouse. This allow to take advantage of some options (speed of the mouse, automatic wrapping) + * It returns a interface to these parameters when it is supported, or NULL otherwise + * The interface pointer is valid as long as the low level mouse is enabled. + * A call to disable the mouse returns NULL, and restore the default mouse behavior + * NB : - In this mode the mouse cursor isn't drawn. + * - Calls to showCursor have no effects + * - Calls to setCapture have no effects + */ + virtual NLMISC::IMouseDevice *enableLowLevelMouse(bool enable, bool exclusive) = 0; - /** Enable / disable a low level keyboard. - * Such a keyboard can only send KeyDown and KeyUp event. It just consider the keyboard as a - * gamepad with lots of buttons... - * This returns a interface to some parameters when it is supported, or NULL otherwise. - * The interface pointer is valid as long as the low level keyboard is enabled. - * A call to disable the keyboard returns NULL, and restore the default keyboard behavior - */ - virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable) = 0; + /** Enable / disable a low level keyboard. + * Such a keyboard can only send KeyDown and KeyUp event. It just consider the keyboard as a + * gamepad with lots of buttons... + * This returns a interface to some parameters when it is supported, or NULL otherwise. + * The interface pointer is valid as long as the low level keyboard is enabled. + * A call to disable the keyboard returns NULL, and restore the default keyboard behavior + */ + virtual NLMISC::IKeyboardDevice *enableLowLevelKeyboard(bool enable) = 0; - /** Get the delay in ms for mouse double clicks. - */ - virtual uint getDoubleClickDelay(bool hardwareMouse) = 0; + /** Get the delay in ms for mouse double clicks. + */ + virtual uint getDoubleClickDelay(bool hardwareMouse) = 0; - /** If true, capture the mouse to force it to stay under the window. - * NB : this has no effects if a low level mouse is used - */ - virtual void setCapture (bool b) = 0; + /** If true, capture the mouse to force it to stay under the window. + * NB : this has no effects if a low level mouse is used + */ + virtual void setCapture(bool b) = 0; - // see if system cursor is currently captured - virtual bool isSystemCursorCaptured() = 0; + // see if system cursor is currently captured + virtual bool isSystemCursorCaptured() = 0; - // Add a new cursor (name is case unsensitive) - virtual void addCursor(const std::string &name, const NLMISC::CBitmap &bitmap) = 0; + // Add a new cursor (name is case unsensitive) + virtual void addCursor(const std::string &name, const NLMISC::CBitmap &bitmap) = 0; - // Display a cursor from its name (case unsensitive) - virtual void setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild = false) = 0; + // Display a cursor from its name (case unsensitive) + virtual void setCursor(const std::string &name, NLMISC::CRGBA col, uint8 rot, sint hotSpotX, sint hotSpotY, bool forceRebuild = false) = 0; - // Change default scale for all cursors - virtual void setCursorScale(float scale) = 0; + // Change default scale for all cursors + virtual void setCursorScale(float scale) = 0; - /** Check whether there is a low level device manager available, and get its interface. Return NULL if not available - * From this interface you can deal with mouse and keyboard as above, but you can also manage game device (joysticks, joypads ...) - */ - virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager() = 0; + /** Check whether there is a low level device manager available, and get its interface. Return NULL if not available + * From this interface you can deal with mouse and keyboard as above, but you can also manage game device (joysticks, joypads ...) + */ + virtual NLMISC::IInputDeviceManager *getLowLevelInputDeviceManager() = 0; // @} - /// Get the width and the height of the window - virtual void getWindowSize (uint32 &width, uint32 &height) = 0; - - /// Get the position of the window always (0,0) in fullscreen - virtual void getWindowPos (sint32 &x, sint32 &y) = 0; - - /** get the RGBA back buffer. After swapBuffers(), the content of the back buffer is undefined. - * - * \param bitmap the buffer will be written in this bitmap - */ - virtual void getBuffer (CBitmap &bitmap) = 0; - - /** get the ZBuffer (back buffer). - * - * \param zbuffer the returned array of Z. size of getWindowSize() . - */ - virtual void getZBuffer (std::vector &zbuffer) = 0; - - /** get a part of the RGBA back buffer. After swapBuffers(), the content of the back buffer is undefined. - * NB: 0,0 is the bottom left corner of the screen. - * - * \param bitmap the buffer will be written in this bitmap - * \param rect the in/out (wanted/clipped) part of Color buffer to retrieve. - */ - virtual void getBufferPart (CBitmap &bitmap, NLMISC::CRect &rect) = 0; - - // copy the first texture in a second one of different dimensions - virtual bool stretchRect (ITexture * srcText, NLMISC::CRect &srcRect, ITexture * destText, NLMISC::CRect &destRect) = 0; - - // is this texture a rectangle texture ? - virtual bool isTextureRectangle(ITexture * tex) const = 0; - - // return true if driver support Bloom effect. - virtual bool supportBloomEffect() const =0; - - // return true if driver support non-power of two textures - virtual bool supportNonPowerOfTwoTextures() const =0; - - /** get a part of the ZBuffer (back buffer). - * NB: 0,0 is the bottom left corner of the screen. - * - * \param zbuffer the returned array of Z. size of rec.Width*rec.Height. - * \param rect the in/out (wanted/clipped) part of ZBuffer to retrieve. - */ - virtual void getZBufferPart (std::vector &zbuffer, NLMISC::CRect &rect) = 0; + /// \name Render target // TODO: Handle Color/ZBuffer/Stencil consistently + // @{ /** Set the current render target. * * The render target can be a texture (tex pointer) or the back buffer (tex = NULL). @@ -848,14 +951,22 @@ public: * \param cubaFace the face of the cube to copy texture to. * \return true if the render target has been changed */ - virtual bool setRenderTarget (ITexture *tex, - uint32 x = 0, - uint32 y = 0, - uint32 width = 0, - uint32 height = 0, - uint32 mipmapLevel = 0, - uint32 cubeFace = 0 - ) = 0 ; + virtual bool setRenderTarget( ITexture *tex, + uint32 x = 0, + uint32 y = 0, + uint32 width = 0, + uint32 height = 0, + uint32 mipmapLevel = 0, + uint32 cubeFace = 0 + ) = 0; + + virtual ITexture *getRenderTarget() const = 0; + + /** Retrieve the render target size. + * If the render target is the frame buffer, it returns the size of the frame buffer. + * It the render target is a texture, it returns the size of the texture mipmap selected as render target. + */ + virtual bool getRenderTargetSize (uint32 &width, uint32 &height) = 0; /** Trick method : copy the current texture target into another texture without updating the current texture. * @@ -883,30 +994,21 @@ public: * \param height height of the renderable area to copy, if 0, use the whole size. * \param mipmapLevel the mipmap to copy texture to. */ - virtual bool copyTargetToTexture (ITexture *tex, - uint32 offsetx = 0, - uint32 offsety = 0, - uint32 x = 0, - uint32 y = 0, - uint32 width = 0, - uint32 height = 0, - uint32 mipmapLevel = 0 + virtual bool copyTargetToTexture( ITexture *tex, + uint32 offsetx = 0, + uint32 offsety = 0, + uint32 x = 0, + uint32 y = 0, + uint32 width = 0, + uint32 height = 0, + uint32 mipmapLevel = 0 ) = 0; - - /** Retrieve the render target size. - * If the render target is the frame buffer, it returns the size of the frame buffer. - * It the render target is a texture, it returns the size of the texture mipmap selected as render target. - */ - virtual bool getRenderTargetSize (uint32 &width, uint32 &height) = 0; - - /** fill the RGBA back buffer - * - * \param bitmap will be written in the buffer. no-op if bad size. - * \return true if success - */ - virtual bool fillBuffer (CBitmap &bitmap) = 0; + // @} + + /// \name Render state: Polygon mode + // @{ /** Set the global polygon mode. Can be filled, line or point. The implementation driver must * call IDriver::setPolygonMode and active this mode. * @@ -918,13 +1020,27 @@ public: _PolygonMode=mode; } + /** Get the global polygon mode. + * + * \param polygon mode choose in this driver. + * \see setPolygonMode(), TPolygonMode + */ + TPolygonMode getPolygonMode () + { + return _PolygonMode; + } + // @} + + + /// \name Fixed pipeline lights + // @{ /** * return the number of light supported by driver. typically 8. * * \see enableLight() setLight() */ - virtual uint getMaxLight () const = 0; + virtual uint getMaxLight() const = 0; /** * Setup a light. @@ -935,7 +1051,7 @@ public: * \param light is a light to set in this slot. * \see enableLight() */ - virtual void setLight (uint8 num, const CLight& light) = 0; + virtual void setLight(uint8 num, const CLight &light) = 0; /** * Enable / disable light. @@ -946,7 +1062,7 @@ public: * \param enable is true to enable the light, false to disable it. * \see setLight() */ - virtual void enableLight (uint8 num, bool enable=true) = 0; + virtual void enableLight(uint8 num, bool enable = true) = 0; /** * Set ambient. @@ -954,86 +1070,135 @@ public: * \param color is the new global ambient color for the scene. * \see setLight(), enableLight() */ - virtual void setAmbientColor (CRGBA color) = 0; + virtual void setAmbientColor(NLMISC::CRGBA color) = 0; /** Setup the light used for per pixel lighting. The given values should have been modulated by the material diffuse and specular. * This is only useful for material that have their shader set as 'PerPixelLighting' * \param the light used for per pixel lighting */ - virtual void setPerPixelLightingLight(CRGBA diffuse, CRGBA specular, float shininess) = 0; + virtual void setPerPixelLightingLight(NLMISC::CRGBA diffuse, NLMISC::CRGBA specular, float shininess) = 0; /** Setup the unique light used for Lightmap Shader. * Lightmaped primitives are lit per vertex with this light (should be local attenuated for maximum efficiency) * This is only useful for material that have their shader set as 'LightMap' * \param the light used for per pixel lighting */ - virtual void setLightMapDynamicLight (bool enable, const CLight& light) = 0; + virtual void setLightMapDynamicLight(bool enable, const CLight &light) = 0; + // @} - /** Get the global polygon mode. - * - * \param polygon mode choose in this driver. - * \see setPolygonMode(), TPolygonMode - */ - TPolygonMode getPolygonMode () - { - return _PolygonMode; - } - /// \name Vertex program interface + + /// \name Vertex Program // @{ - enum TMatrix - { - ModelView= 0, - Projection, - ModelViewProjection, - NumMatrix - }; - - enum TTransform - { - Identity=0, - Inverse, - Transpose, - InverseTranspose, - NumTransform - }; - - /** - * Does the driver supports vertex programs ? - */ - virtual bool isVertexProgramSupported () const =0; + // Order of preference + // - activeVertexProgram + // - CMaterial pass[n] VP (uses activeVertexProgram, but does not override if one already set by code) + // - default generic VP that mimics fixed pipeline / no VP with fixed pipeline /** * Does the driver supports vertex program, but emulated by CPU ? */ - virtual bool isVertexProgramEmulated () const =0; + virtual bool isVertexProgramEmulated() const = 0; - - - /** - * Activate / disactivate a vertex program - * - * \param program is a pointer on a vertex program. Can be NULL to disable the current vertex program. - * - * \return true if setup/unsetup succeeded, false else. + /** Return true if the driver supports the specified vertex program profile. */ - virtual bool activeVertexProgram (CVertexProgram *program) =0; + virtual bool supportVertexProgram(CVertexProgram::TProfile profile) const = 0; - /** - * Setup constant values. + /** Compile the given vertex program, return if successful. + * If a vertex program was set active before compilation, + * the state of the active vertex program is undefined behaviour afterwards. */ - virtual void setConstant (uint index, float, float, float, float) =0; - virtual void setConstant (uint index, double, double, double, double) =0; - virtual void setConstant (uint index, const NLMISC::CVector& value) =0; - virtual void setConstant (uint index, const NLMISC::CVectorD& value) =0; - /// setup several 4 float csts taken from the given tab - virtual void setConstant (uint index, uint num, const float *src) =0; - /// setup several 4 double csts taken from the given tab - virtual void setConstant (uint index, uint num, const double *src) =0; + virtual bool compileVertexProgram(CVertexProgram *program) = 0; + /** Set the active vertex program. This will override vertex programs specified in CMaterial render calls. + * Also used internally by setupMaterial(CMaterial) when getVertexProgram returns NULL. + * The vertex program is activated immediately. + */ + virtual bool activeVertexProgram(CVertexProgram *program) = 0; + // @} + + + + /// \name Pixel Program + // @{ + + // Order of preference + // - activePixelProgram + // - CMaterial pass[n] PP (uses activePixelProgram, but does not override if one already set by code) + // - PP generated from CMaterial (uses activePixelProgram, but does not override if one already set by code) + + /** Return true if the driver supports the specified pixel program profile. + */ + virtual bool supportPixelProgram(CPixelProgram::TProfile profile) const = 0; + + /** Compile the given pixel program, return if successful. + * If a pixel program was set active before compilation, + * the state of the active pixel program is undefined behaviour afterwards. + */ + virtual bool compilePixelProgram(CPixelProgram *program) = 0; + + /** Set the active pixel program. This will override pixel programs specified in CMaterial render calls. + * Also used internally by setupMaterial(CMaterial) when getPixelProgram returns NULL. + * The pixel program is activated immediately. + */ + virtual bool activePixelProgram(CPixelProgram *program) = 0; + // @} + + + + /// \name Geometry Program + // @{ + + // Order of preference + // - activeGeometryProgram + // - CMaterial pass[n] PP (uses activeGeometryProgram, but does not override if one already set by code) + // - none + + /** Return true if the driver supports the specified pixel program profile. + */ + virtual bool supportGeometryProgram(CGeometryProgram::TProfile profile) const = 0; + + /** Compile the given pixel program, return if successful. + * If a pixel program was set active before compilation, + * the state of the active pixel program is undefined behaviour afterwards. + */ + virtual bool compileGeometryProgram(CGeometryProgram *program) = 0; + + /** Set the active pixel program. This will override pixel programs specified in CMaterial render calls. + * Also used internally by setupMaterial(CMaterial) when getGeometryProgram returns NULL. + * The pixel program is activated immediately. + */ + virtual bool activeGeometryProgram(CGeometryProgram *program) = 0; + // @} + + + + /// \name Program parameters + // @{ + // Set parameters + virtual void setUniform1f(TProgram program, uint index, float f0) = 0; + virtual void setUniform2f(TProgram program, uint index, float f0, float f1) = 0; + virtual void setUniform3f(TProgram program, uint index, float f0, float f1, float f2) = 0; + virtual void setUniform4f(TProgram program, uint index, float f0, float f1, float f2, float f3) = 0; + virtual void setUniform1i(TProgram program, uint index, sint32 i0) = 0; + virtual void setUniform2i(TProgram program, uint index, sint32 i0, sint32 i1) = 0; + virtual void setUniform3i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2) = 0; + virtual void setUniform4i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2, sint32 i3) = 0; + virtual void setUniform1ui(TProgram program, uint index, uint32 ui0) = 0; + virtual void setUniform2ui(TProgram program, uint index, uint32 ui0, uint32 ui1) = 0; + virtual void setUniform3ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2) = 0; + virtual void setUniform4ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3) = 0; + virtual void setUniform3f(TProgram program, uint index, const NLMISC::CVector& v) = 0; + virtual void setUniform4f(TProgram program, uint index, const NLMISC::CVector& v, float f3) = 0; + virtual void setUniform4f(TProgram program, uint index, const NLMISC::CRGBAF& rgba) = 0; + virtual void setUniform4x4f(TProgram program, uint index, const NLMISC::CMatrix& m) = 0; + virtual void setUniform4fv(TProgram program, uint index, size_t num, const float *src) = 0; + virtual void setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src) = 0; + virtual void setUniform4uiv(TProgram program, uint index, size_t num, const uint32 *src) = 0; + // Set builtin parameters /** - * Setup constants with a current matrix. + * Setup uniforms with a current matrix. * * This call must be done after setFrustum(), setupViewMatrix() or setupModelMatrix() to get correct * results. @@ -1043,10 +1208,9 @@ public: * \param transform is the transformation to apply to the matrix before store it in the constants. * */ - virtual void setConstantMatrix (uint index, TMatrix matrix, TTransform transform) =0; - + virtual void setUniformMatrix(TProgram program, uint index, TMatrix matrix, TTransform transform) = 0; /** - * Setup the constant with the fog vector. This vector must be used to get the final fog value in a vertex shader. + * Setup the uniform with the fog vector. This vector must be used to get the final fog value in a vertex shader. * You must use it like this: * DP4 o[FOGC].x, c[4], R4; * With c[4] the constant used for the fog vector and R4 the vertex local position. @@ -1057,14 +1221,28 @@ public: * \param index is the index where to store the vector. * */ - virtual void setConstantFog (uint index) =0; + virtual void setUniformFog(TProgram program, uint index) = 0; + // Set feature parameters + virtual bool isUniformProgramState() = 0; + // @} - /// Check if the driver support double sided colors vertex programs - virtual bool supportVertexProgramDoubleSidedColor() const = 0; + + /// \name Legacy effects + // @{ // test if support for cloud render in a single pass virtual bool supportCloudRenderSinglePass() const = 0; + // [FIXME] Return true if driver support Bloom effect // FIXME: This is terrible + virtual bool supportBloomEffect() const = 0; + // @} + + + + /// \name Backface color + // @{ + /// Check if the driver support double sided colors vertex programs + virtual bool supportVertexProgramDoubleSidedColor() const = 0; /** * Activate VertexProgram 2Sided Color mode. In 2Sided mode, the BackFace (if material 2Sided enabled) read the * result from o[BFC0], and not o[COL0]. @@ -1072,27 +1250,29 @@ public: * NB: no-op if not supported by driver */ virtual void enableVertexProgramDoubleSidedColor(bool doubleSided) =0; - // @} + + /// \name Texture addressing modes aka textures/pixels shaders // @{ - /// test whether the device supports some form of texture shader. (could be limited to DX6 EMBM for example) - virtual bool supportTextureShaders() const = 0; - // Is the shader water supported ? If not, the driver caller should implement its own version - virtual bool isWaterShaderSupported() const = 0; - // - /// test whether a texture addressing mode is supported - virtual bool isTextureAddrModeSupported(CMaterial::TTexAddressingMode mode) const = 0; - /** setup the 2D matrix for the OffsetTexture, OffsetTextureScale and OffsetTexture addressing mode - * It should be stored as the following - * [a0 a1] - * [a2 a3] - */ - virtual void setMatrix2DForTextureOffsetAddrMode(const uint stage, const float mat[4]) = 0; + /// test whether the device supports some form of texture shader. (could be limited to DX6 EMBM for example) + virtual bool supportTextureShaders() const = 0; + // Is the shader water supported ? If not, the driver caller should implement its own version + virtual bool supportWaterShader() const = 0; + // + /// test whether a texture addressing mode is supported + virtual bool supportTextureAddrMode(CMaterial::TTexAddressingMode mode) const = 0; + /** setup the 2D matrix for the OffsetTexture, OffsetTextureScale and OffsetTexture addressing mode + * It should be stored as the following + * [a0 a1] + * [a2 a3] + */ + virtual void setMatrix2DForTextureOffsetAddrMode(const uint stage, const float mat[4]) = 0; //@} + /** \name EMBM support. If texture shaders are present, this is not available, must use them instead. * EMBM is a color op of CMaterial. * NB : EMBM is the equivalent of the CMaterial::OffsetTexture addressing mode. However, it is both a texture @@ -1104,38 +1284,35 @@ public: */ // @{ - // Test if EMBM is supported. - virtual bool supportEMBM() const = 0; - // Test if EMBM is supported for the given stage - virtual bool isEMBMSupportedAtStage(uint stage) const = 0; - // set the matrix used for EMBM addressing - virtual void setEMBMMatrix(const uint stage, const float mat[4]) = 0; + // Test if EMBM is supported. + virtual bool supportEMBM() const = 0; + // Test if EMBM is supported for the given stage + virtual bool isEMBMSupportedAtStage(uint stage) const = 0; + // set the matrix used for EMBM addressing + virtual void setEMBMMatrix(const uint stage, const float mat[4]) = 0; // @} - // Does the driver support the per-pixel lighting shader ? - virtual bool supportPerPixelLighting(bool specular) const = 0; /// \name Misc // @{ - /** Does the driver support Blend Constant Color ??? If yes CMaterial::blendConstant* enum can be used * for blend Src ord Dst factor. If no, using these enum will have undefined results. */ - virtual bool supportBlendConstantColor() const =0; + virtual bool supportBlendConstantColor() const = 0; /** see supportBlendConstantColor(). Set the current Blend Constant Color. */ - virtual void setBlendConstantColor(NLMISC::CRGBA col)=0; + virtual void setBlendConstantColor(NLMISC::CRGBA col) = 0; /** see supportBlendConstantColor(). Get the current Blend Constant Color. */ - virtual NLMISC::CRGBA getBlendConstantColor() const =0; + virtual NLMISC::CRGBA getBlendConstantColor() const = 0; /** force the driver to flush all command. glFinish() in opengl. * Interesting only for debug and profiling purpose. */ - virtual void finish() =0; + virtual void finish() = 0; // Flush command queue an immediately returns virtual void flush() = 0; @@ -1144,27 +1321,27 @@ public: * See GL_POLYGON_SMOOTH help, and GL_SRC_ALPHA_SATURATE OpenGL doc (not yet implemented now since * used only for alpha part in ShadowMap gen) */ - virtual void enablePolygonSmoothing(bool smooth) =0; + virtual void enablePolygonSmoothing(bool smooth) = 0; /// see enablePolygonSmoothing() - virtual bool isPolygonSmoothingEnabled() const =0; - + virtual bool isPolygonSmoothingEnabled() const = 0; // @} + /** Special method to internally swap the Driver handle of 2 textures. * USE IT WITH CARE (eg: may have Size problems, mipmap problems, format problems ...) * Actually, it is used only by CAsyncTextureManager, to manage Lods of DXTC CTextureFile. * NB: internally, all textures slots are disabled. */ - virtual void swapTextureHandle(ITexture &tex0, ITexture &tex1) =0; + virtual void swapTextureHandle(ITexture &tex0, ITexture &tex1) = 0; /** Advanced usage. Get the texture Handle.Useful for texture sorting for instance * NB: if the texture is not setuped in the driver, 0 is returned. * NB: if implementation does not support it, 0 may be returned. OpenGL ones return the Texture ID. * NB: unlike isTextureExist(), this method is not thread safe. */ - virtual uint getTextureHandle(const ITexture&tex)=0; + virtual uint getTextureHandle(const ITexture&tex) = 0; // see if the Multiply-Add Tex Env operator is supported (see CMaterial::Mad) virtual bool supportMADOperator() const = 0; @@ -1185,16 +1362,16 @@ public: }; // Get the number of hardware renderer available on the client platform. - virtual uint getNumAdapter() const=0; + virtual uint getNumAdapter() const = 0; // Get a hardware renderer description. - virtual bool getAdapter(uint adapter, CAdapter &desc) const=0; + virtual bool getAdapter(uint adapter, CAdapter &desc) const = 0; /** Choose the hardware renderer. * Call it before the setDisplay and enumModes methods * Choose adapter = 0xffffffff for the default one. */ - virtual bool setAdapter(uint adapter)=0; + virtual bool setAdapter(uint adapter) = 0; /** Tell if the vertex color memory format is RGBA (openGL) or BGRA (directx) * BGRA : @@ -1208,20 +1385,22 @@ public: */ virtual CVertexBuffer::TVertexColorType getVertexColorFormat() const =0; + + /// \name Bench // @{ - // Start the bench. See CHTimer::startBench(); - virtual void startBench (bool wantStandardDeviation = false, bool quick = false, bool reset = true) =0; + virtual void startBench(bool wantStandardDeviation = false, bool quick = false, bool reset = true) =0; // End the bench. See CHTimer::endBench(); - virtual void endBench () =0; + virtual void endBench () =0; // Display the bench result - virtual void displayBench (class NLMISC::CLog *log) =0; - + virtual void displayBench (class NLMISC::CLog *log) =0; // @} + + /// \name Occlusion query mechanism // @{ // Test whether this device supports the occlusion query mechanism @@ -1234,8 +1413,8 @@ public: virtual void deleteOcclusionQuery(IOcclusionQuery *oq) = 0; // @} - // get the number of call to swapBuffer since the driver was created - virtual uint64 getSwapBufferCounter() const = 0; + + /** Set cull mode * Useful for mirrors / cube map rendering or when the scene must be rendered upside down @@ -1252,25 +1431,25 @@ public: virtual void stencilMask(uint mask) = 0; protected: - friend class IVBDrvInfos; - friend class IIBDrvInfos; - friend class CTextureDrvShare; - friend class ITextureDrvInfos; - friend class IMaterialDrvInfos; - friend class IVertexProgramDrvInfos; - friend class IShaderDrvInfos; + friend class IVBDrvInfos; + friend class IIBDrvInfos; + friend class CTextureDrvShare; + friend class ITextureDrvInfos; + friend class IMaterialDrvInfos; + friend class IProgramDrvInfos; + friend class IProgramParamsDrvInfos; /// remove ptr from the lists in the driver. - void removeVBDrvInfoPtr(ItVBDrvInfoPtrList vbDrvInfoIt); - void removeIBDrvInfoPtr(ItIBDrvInfoPtrList ibDrvInfoIt); - void removeTextureDrvInfoPtr(ItTexDrvInfoPtrMap texDrvInfoIt); - void removeTextureDrvSharePtr(ItTexDrvSharePtrList texDrvShareIt); - void removeMatDrvInfoPtr(ItMatDrvInfoPtrList shaderIt); - void removeShaderDrvInfoPtr(ItShaderDrvInfoPtrList shaderIt); - void removeVtxPrgDrvInfoPtr(ItVtxPrgDrvInfoPtrList vtxPrgDrvInfoIt); + void removeVBDrvInfoPtr(ItVBDrvInfoPtrList vbDrvInfoIt); + void removeIBDrvInfoPtr(ItIBDrvInfoPtrList ibDrvInfoIt); + void removeTextureDrvInfoPtr(ItTexDrvInfoPtrMap texDrvInfoIt); + void removeTextureDrvSharePtr(ItTexDrvSharePtrList texDrvShareIt); + void removeMatDrvInfoPtr(ItMatDrvInfoPtrList shaderIt); + void removeGPUPrgDrvInfoPtr(ItGPUPrgDrvInfoPtrList gpuPrgDrvInfoIt); private: - bool _StaticMemoryToVRAM; + bool _StaticMemoryToVRAM; + }; // -------------------------------------------------- diff --git a/code/nel/include/nel/3d/driver_user.h b/code/nel/include/nel/3d/driver_user.h index bfe4c1755..30ea98c65 100644 --- a/code/nel/include/nel/3d/driver_user.h +++ b/code/nel/include/nel/3d/driver_user.h @@ -133,6 +133,7 @@ public: // @{ virtual void disableHardwareVertexProgram(); + virtual void disableHardwarePixelProgram(); virtual void disableHardwareVertexArrayAGP(); virtual void disableHardwareTextureShader(); @@ -473,7 +474,6 @@ public: virtual void forceDXTCCompression(bool dxtcComp); virtual void setAnisotropicFilter(sint filter); virtual void forceTextureResize(uint divisor); - virtual void forceNativeFragmentPrograms(bool nativeOnly); virtual bool setMonitorColorProperties (const CMonitorColorProperties &properties); // @} diff --git a/code/nel/include/nel/3d/geometry_program.h b/code/nel/include/nel/3d/geometry_program.h new file mode 100644 index 000000000..48e48e260 --- /dev/null +++ b/code/nel/include/nel/3d/geometry_program.h @@ -0,0 +1,49 @@ +/** \file geometry_program.h + * Geometry program definition + */ + +/* Copyright, 2000, 2001 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_GEOMETRY_PROGRAM_H +#define NL_GEOMETRY_PROGRAM_H + +#include +#include +#include + +#include + +namespace NL3D { + +class CGeometryProgram : public IProgram +{ +public: + /// Constructor + CGeometryProgram(); + /// Destructor + virtual ~CGeometryProgram (); +}; + +} // NL3D + + +#endif // NL_GEOMETRY_PROGRAM_H + +/* End of vertex_program.h */ diff --git a/code/nel/include/nel/3d/gpu_program_params.h b/code/nel/include/nel/3d/gpu_program_params.h new file mode 100644 index 000000000..ce6b8b2f0 --- /dev/null +++ b/code/nel/include/nel/3d/gpu_program_params.h @@ -0,0 +1,178 @@ +/** + * \file gpu_program_params.h + * \brief CGPUProgramParams + * \date 2013-09-07 22:17GMT + * \author Jan Boon (Kaetemi) + * CGPUProgramParams + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + */ + +#ifndef NL3D_GPU_PROGRAM_PARAMS_H +#define NL3D_GPU_PROGRAM_PARAMS_H +#include + +// STL includes +#include +#include + +// NeL includes + +// Project includes + +namespace NLMISC { + class CVector; + class CMatrix; +} + +namespace NL3D { + +/** + * \brief CGPUProgramParams + * \date 2013-09-07 22:17GMT + * \author Jan Boon (Kaetemi) + * A storage for USERCODE-PROVIDED parameters for GPU programs. + * Allows for fast updating and iteration of parameters. + * NOTE TO DRIVER IMPLEMENTORS: DO NOT USE FOR STORING COPIES + * OF HARDCODED DRIVER MATERIAL PARAMETERS OR DRIVER PARAMETERS!!! + * The 4-component alignment that is done in this storage + * class is necessary to simplify support for register-based + * assembly shaders, which require setting per 4 components. + */ +class CGPUProgramParams +{ +public: + enum TType { Float, Int, UInt }; + struct CMeta { uint Index, Size, Count; TType Type; std::string Name; size_t Next, Prev; }; // size is element size, count is nb of elements + +private: + union CVec { float F[4]; sint32 I[4]; uint32 UI[4]; }; + +public: + CGPUProgramParams(); + virtual ~CGPUProgramParams(); + + /// \name User functions + // @{ + // Copy from another params storage + void copy(CGPUProgramParams *params); + + // Set by index, available only when the associated program has been compiled + void set1f(uint index, float f0); + void set2f(uint index, float f0, float f1); + void set3f(uint index, float f0, float f1, float f2); + void set4f(uint index, float f0, float f1, float f2, float f3); + void set1i(uint index, sint32 i0); + void set2i(uint index, sint32 i0, sint32 i1); + void set3i(uint index, sint32 i0, sint32 i1, sint32 i2); + void set4i(uint index, sint32 i0, sint32 i1, sint32 i2, sint32 i3); + void set1ui(uint index, uint32 ui0); + void set2ui(uint index, uint32 ui0, uint32 ui1); + void set3ui(uint index, uint32 ui0, uint32 ui1, uint32 ui2); + void set4ui(uint index, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3); + void set3f(uint index, const NLMISC::CVector& v); + void set4f(uint index, const NLMISC::CVector& v, float f3); + void set4x4f(uint index, const NLMISC::CMatrix& m); + void set4fv(uint index, size_t num, const float *src); + void set4iv(uint index, size_t num, const sint32 *src); + void set4uiv(uint index, size_t num, const uint32 *src); + void unset(uint index); + + // Set by name, it is recommended to use index when repeatedly setting an element + void set1f(const std::string &name, float f0); + void set2f(const std::string &name, float f0, float f1); + void set3f(const std::string &name, float f0, float f1, float f2); + void set4f(const std::string &name, float f0, float f1, float f2, float f3); + void set1i(const std::string &name, sint32 i0); + void set2i(const std::string &name, sint32 i0, sint32 i1); + void set3i(const std::string &name, sint32 i0, sint32 i1, sint32 i2); + void set4i(const std::string &name, sint32 i0, sint32 i1, sint32 i2, sint32 i3); + void set1ui(const std::string &name, uint32 ui0); + void set2ui(const std::string &name, uint32 ui0, uint32 ui1); + void set3ui(const std::string &name, uint32 ui0, uint32 ui1, uint32 ui2); + void set4ui(const std::string &name, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3); + void set3f(const std::string &name, const NLMISC::CVector& v); + void set4f(const std::string &name, const NLMISC::CVector& v, float f3); + void set4x4f(const std::string &name, const NLMISC::CMatrix& m); + void set4fv(const std::string &name, size_t num, const float *src); + void set4iv(const std::string &name, size_t num, const sint32 *src); + void set4uiv(const std::string &name, size_t num, const uint32 *src); + void unset(const std::string &name); + // @} + + // Maps the given name to the given index. + // on duplicate entry the data set by name will be prefered, as it can be + // assumed to have been set after the data set by index, and the mapping + // will usually happen while iterating and finding an element with name + // but no known index. + // Unknown index will be set to ~0, unknown name will have an empty string. + void map(uint index, const std::string &name); + + /// \name Internal + // @{ + /// Allocate specified number of components if necessary (internal use only) + size_t allocOffset(uint index, uint size, uint count, TType type); + size_t allocOffset(const std::string &name, uint size, uint count, TType type); + size_t allocOffset(uint size, uint count, TType type); + /// Return offset for specified index + size_t getOffset(uint index) const; + size_t getOffset(const std::string &name) const; + /// Remove by offset + void freeOffset(size_t offset); + // @} + + /// \name Driver and dev tools + // @{ + // Iteration (returns the offsets for access using getFooByOffset) + inline size_t getBegin() const { return m_Meta.size() ? m_First : s_End; } + inline size_t getNext(size_t offset) const { return m_Meta[offset].Next; } + inline size_t getEnd() const { return s_End; } + + // Data access + inline uint getSizeByOffset(size_t offset) const { return m_Meta[offset].Size; } // size of element (4 for float4) + inline uint getCountByOffset(size_t offset) const { return m_Meta[offset].Count; } // number of elements (usually 1) + inline uint getNbComponentsByOffset(size_t offset) const { return m_Meta[offset].Size * m_Meta[offset].Count; } // nb of components (size * count) + inline float *getPtrFByOffset(size_t offset) { return m_Vec[offset].F; } + inline sint32 *getPtrIByOffset(size_t offset) { return m_Vec[offset].I; } + inline uint32 *getPtrUIByOffset(size_t offset) { return m_Vec[offset].UI; } + inline TType getTypeByOffset(size_t offset) const { return m_Meta[offset].Type; } + inline uint getIndexByOffset(size_t offset) const { return m_Meta[offset].Index; } + const std::string &getNameByOffset(size_t offset) const { return m_Meta[offset].Name; }; + // @} + + // Utility + static inline uint getNbRegistersByComponents(uint nbComponents) { return (nbComponents + 3) >> 2; } // vector register per 4 components + +private: + std::vector m_Vec; + std::vector m_Meta; + std::vector m_Map; // map from index to offset + std::map m_MapName; // map from name to offset + size_t m_First; + size_t m_Last; + static const size_t s_End = -1; + +}; /* class CGPUProgramParams */ + +} /* namespace NL3D */ + +#endif /* #ifndef NL3D_GPU_PROGRAM_PARAMS_H */ + +/* end of file */ diff --git a/code/nel/include/nel/3d/landscapevb_allocator.h b/code/nel/include/nel/3d/landscapevb_allocator.h index d3a081e7b..0e485e990 100644 --- a/code/nel/include/nel/3d/landscapevb_allocator.h +++ b/code/nel/include/nel/3d/landscapevb_allocator.h @@ -21,6 +21,7 @@ #include "nel/misc/smart_ptr.h" #include "nel/3d/tessellation.h" #include "nel/3d/vertex_buffer.h" +#include "nel/3d/vertex_program.h" namespace NL3D @@ -41,6 +42,7 @@ class CVertexProgram; #define NL3D_LANDSCAPE_VPPOS_DELTAPOS (CVertexBuffer::TexCoord3) #define NL3D_LANDSCAPE_VPPOS_ALPHAINFO (CVertexBuffer::TexCoord4) +class CVertexProgramLandscape; // *************************************************************************** /** @@ -107,6 +109,8 @@ public: * Give a vertexProgram Id to activate. Always 0, but 1 For tile Lightmap Pass. */ void activate(uint vpId); + void activateVP(uint vpId); + inline CVertexProgramLandscape *getVP(uint vpId) const { return _VertexProgram[vpId]; } // @} @@ -151,15 +155,35 @@ private: /// \name Vertex Program mgt . // @{ +public: enum {MaxVertexProgram= 2,}; // Vertex Program , NULL if not enabled. - CVertexProgram *_VertexProgram[MaxVertexProgram]; +private: + NLMISC::CSmartPtr _VertexProgram[MaxVertexProgram]; void deleteVertexProgram(); void setupVBFormatAndVertexProgram(bool withVertexProgram); // @} }; +class CVertexProgramLandscape : public CVertexProgram +{ +public: + struct CIdx + { + uint ProgramConstants0; + uint RefineCenter; + uint TileDist; + uint PZBModelPosition; + }; + CVertexProgramLandscape(CLandscapeVBAllocator::TType type, bool lightMap = false); + virtual ~CVertexProgramLandscape() { } + virtual void buildInfo(); +public: + const CIdx &idx() const { return m_Idx; } + CIdx m_Idx; +}; + } // NL3D diff --git a/code/nel/include/nel/3d/material.h b/code/nel/include/nel/3d/material.h index a7ca18bff..671f3339a 100644 --- a/code/nel/include/nel/3d/material.h +++ b/code/nel/include/nel/3d/material.h @@ -22,7 +22,6 @@ #include "nel/misc/rgba.h" #include "nel/misc/matrix.h" #include "nel/3d/texture.h" -#include "nel/3d/shader.h" #include @@ -171,7 +170,8 @@ public: * - Alpha of texture in stage 0 is blended with alpha of texture in stage 1. Blend done with the alpha color of each * stage and the whole is multiplied by the alpha in color vertex [AT0*ADiffuseCol+AT1*(1-ADiffuseCol)]*AStage * - RGB still unchanged - * + * Water : + * - Water */ enum TShader { Normal=0, Bump, @@ -183,7 +183,8 @@ public: PerPixelLightingNoSpec, Cloud, Water, - shaderCount}; + shaderCount, + Program /* internally used when a pixel program is active */ }; /// \name Texture Env Modes. // @{ diff --git a/code/nel/include/nel/3d/meshvp_per_pixel_light.h b/code/nel/include/nel/3d/meshvp_per_pixel_light.h index d7be0f3f9..a234feddd 100644 --- a/code/nel/include/nel/3d/meshvp_per_pixel_light.h +++ b/code/nel/include/nel/3d/meshvp_per_pixel_light.h @@ -27,6 +27,7 @@ namespace NL3D { +class CVertexProgramPerPixelLight; /** * This vertex program is used to perform perpixel lighting with meshs. Its outputs are : @@ -49,6 +50,8 @@ namespace NL3D { class CMeshVPPerPixelLight : public IMeshVertexProgram { public: + friend class CVertexProgramPerPixelLight; + /// true if want Specular Lighting. bool SpecularLighting; public: @@ -84,7 +87,9 @@ private: bool _IsPointLight; // enum { NumVp = 8}; - static std::auto_ptr _VertexProgram[NumVp]; + static NLMISC::CSmartPtr _VertexProgram[NumVp]; + + NLMISC::CRefPtr _ActiveVertexProgram; }; } // NL3D diff --git a/code/nel/include/nel/3d/meshvp_wind_tree.h b/code/nel/include/nel/3d/meshvp_wind_tree.h index 7553d7cca..e2c790d6d 100644 --- a/code/nel/include/nel/3d/meshvp_wind_tree.h +++ b/code/nel/include/nel/3d/meshvp_wind_tree.h @@ -24,6 +24,7 @@ namespace NL3D { +class CVertexProgramWindTree; // *************************************************************************** /** @@ -35,6 +36,7 @@ namespace NL3D { class CMeshVPWindTree : public IMeshVertexProgram { public: + friend class CVertexProgramWindTree; enum {HrcDepth= 3}; @@ -104,6 +106,7 @@ public: // @} private: + static void initVertexPrograms(); void setupLighting(CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat); private: @@ -112,7 +115,9 @@ private: /** The 16 versions: Specular or not (0 or 2), + normalize normal or not (0 or 1). * All multiplied by 4, because support from 0 to 3 pointLights activated. (0.., 4.., 8.., 12..) */ - static std::auto_ptr _VertexProgram[NumVp]; + static NLMISC::CSmartPtr _VertexProgram[NumVp]; + + NLMISC::CRefPtr _ActiveVertexProgram; // WindTree Time for this mesh param setup. Stored in mesh because same for all instances. float _CurrentTime[HrcDepth]; diff --git a/code/nel/include/nel/3d/pixel_program.h b/code/nel/include/nel/3d/pixel_program.h new file mode 100644 index 000000000..0787ae9fb --- /dev/null +++ b/code/nel/include/nel/3d/pixel_program.h @@ -0,0 +1,49 @@ +/** \file pixel_program.h + * Pixel program definition + */ + +/* Copyright, 2000, 2001 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#ifndef NL_PIXEL_PROGRAM_H +#define NL_PIXEL_PROGRAM_H + +#include +#include +#include + +#include + +namespace NL3D { + +class CPixelProgram : public IProgram +{ +public: + /// Constructor + CPixelProgram(); + /// Destructor + virtual ~CPixelProgram (); +}; + +} // NL3D + + +#endif // NL_PIXEL_PROGRAM_H + +/* End of vertex_program.h */ diff --git a/code/nel/include/nel/3d/program.h b/code/nel/include/nel/3d/program.h new file mode 100644 index 000000000..77e6baa62 --- /dev/null +++ b/code/nel/include/nel/3d/program.h @@ -0,0 +1,264 @@ +/** + * \file program.h + * \brief IProgram + * \date 2013-09-07 15:00GMT + * \author Jan Boon (Kaetemi) + * IProgram + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + */ + +#ifndef NL3D_PROGRAM_H +#define NL3D_PROGRAM_H +#include + +// STL includes + +// NeL includes +#include + +// Project includes + +namespace NL3D { + +// List typedef. +class IDriver; +class IProgramDrvInfos; +typedef std::list TGPUPrgDrvInfoPtrList; +typedef TGPUPrgDrvInfoPtrList::iterator ItGPUPrgDrvInfoPtrList; + +// Class for interaction of vertex program with Driver. +// IProgramDrvInfos represent the real data of the GPU program, stored into the driver (eg: just a GLint for opengl). +class IProgramDrvInfos : public NLMISC::CRefCount +{ +private: + IDriver *_Driver; + ItGPUPrgDrvInfoPtrList _DriverIterator; + +public: + IProgramDrvInfos (IDriver *drv, ItGPUPrgDrvInfoPtrList it); + // The virtual dtor is important. + virtual ~IProgramDrvInfos(void); + + virtual uint getUniformIndex(const char *name) const = 0; +}; + +// Features exposed by a program. Used to set builtin parameters on user provided shaders. +// This is only used for user provided shaders, not for builtin shaders, +// as it is a slow method which has to go through all of the options every time. +// Builtin shaders should set all flags to 0. +// Example: +// User shader flags Matrices in the Vertex Program: +// -> When rendering with a material, the driver will call setUniformDriver, +// which will check if the flag Matrices exists, and if so, it will use +// the index cache to find which matrices are needed by the shader, +// and set those which are found. +// This does not work extremely efficient, but it's the most practical option +// for passing builtin parameters onto user provided shaders. +// Note: May need additional flags related to scene sorting, etcetera. +struct CProgramFeatures +{ + CProgramFeatures() : DriverFlags(0), MaterialFlags(0) { } + + // Driver builtin parameters + enum TDriverFlags + { + // Matrices + Matrices = 0x00000001, + + // Fog + Fog = 0x00000002, + }; + uint32 DriverFlags; + + enum TMaterialFlags + { + /// Use the CMaterial texture stages as the textures for a Pixel Program + TextureStages = 0x00000001, + TextureMatrices = 0x00000002, + }; + // Material builtin parameters + uint32 MaterialFlags; +}; + +// Stucture used to cache the indices of builtin parameters which are used by the drivers +// Not used for parameters of specific nl3d programs +struct CProgramIndex +{ + enum TName + { + ModelView, + ModelViewInverse, + ModelViewTranspose, + ModelViewInverseTranspose, + + Projection, + ProjectionInverse, + ProjectionTranspose, + ProjectionInverseTranspose, + + ModelViewProjection, + ModelViewProjectionInverse, + ModelViewProjectionTranspose, + ModelViewProjectionInverseTranspose, + + Fog, + + NUM_UNIFORMS + }; + static const char *Names[NUM_UNIFORMS]; + uint Indices[NUM_UNIFORMS]; +}; + +/** + * \brief IProgram + * \date 2013-09-07 15:00GMT + * \author Jan Boon (Kaetemi) + * A generic GPU program + */ +class IProgram : public NLMISC::CRefCount +{ +public: + enum TProfile + { + none = 0, + + // types + // Vertex Shader = 0x01 + // Pixel Shader = 0x02 + // Geometry Shader = 0x03 + + // nel - 0x31,type,bitfield + nelvp = 0x31010001, // VP supported by CVertexProgramParser, similar to arbvp1, can be translated to vs_1_1 + + // direct3d - 0xD9,type,major,minor + // vertex programs + vs_1_1 = 0xD9010101, + vs_2_0 = 0xD9010200, + // vs_2_sw = 0xD9010201, // not sure... + // vs_2_x = 0xD9010202, // not sure... + // vs_3_0 = 0xD9010300, // not supported + // pixel programs + ps_1_1 = 0xD9020101, + ps_1_2 = 0xD9020102, + ps_1_3 = 0xD9020103, + ps_1_4 = 0xD9020104, + ps_2_0 = 0xD9020200, + // ps_2_x = 0xD9020201, // not sure... + // ps_3_0 = 0xD9020300, // not supported + + // opengl - 0x61,type,bitfield + // vertex programs + // vp20 = 0x61010001, // NV_vertex_program1_1, outdated + arbvp1 = 0x61010002, // ARB_vertex_program + vp30 = 0x61010004, // NV_vertex_program2 + vp40 = 0x61010008, // NV_vertex_program3 + NV_fragment_program3 + gp4vp = 0x61010010, // NV_gpu_program4 + gp5vp = 0x61010020, // NV_gpu_program5 + // pixel programs + // fp20 = 0x61020001, // very limited and outdated, unnecessary + // fp30 = 0x61020002, // NV_fragment_program, now arbfp1, redundant + arbfp1 = 0x61020004, // ARB_fragment_program + fp40 = 0x61020008, // NV_fragment_program2, arbfp1 with "OPTION NV_fragment_program2;\n" + gp4fp = 0x61020010, // NV_gpu_program4 + gp5fp = 0x61020020, // NV_gpu_program5 + // geometry programs + gp4gp = 0x61030001, // NV_gpu_program4 + gp5gp = 0x61030001, // NV_gpu_program5 + + // glsl - 0x65,type,version + glsl330v = 0x65010330, // GLSL vertex program version 330 + glsl330f = 0x65020330, // GLSL fragment program version 330 + glsl330g = 0x65030330, // GLSL geometry program version 330 + }; + + struct CSource : public NLMISC::CRefCount + { + public: + std::string DisplayName; + + /// Minimal required profile for this GPU program + IProgram::TProfile Profile; + + const char *SourcePtr; + size_t SourceLen; + /// Copy the source code string + inline void setSource(const std::string &source) { SourceCopy = source; SourcePtr = &SourceCopy[0]; SourceLen = SourceCopy.size(); } + inline void setSource(const char *source) { SourceCopy = source; SourcePtr = &SourceCopy[0]; SourceLen = SourceCopy.size(); } + /// Set pointer to source code string without copying the string + inline void setSourcePtr(const char *sourcePtr, size_t sourceLen) { SourceCopy.clear(); SourcePtr = sourcePtr; SourceLen = sourceLen; } + inline void setSourcePtr(const char *sourcePtr) { SourceCopy.clear(); SourcePtr = sourcePtr; SourceLen = strlen(sourcePtr); } + + /// CVertexProgramInfo/CPixelProgramInfo/... NeL features + CProgramFeatures Features; + + /// Map with known parameter indices, used for assembly programs + std::map ParamIndices; + + private: + std::string SourceCopy; + }; + +public: + IProgram(); + virtual ~IProgram(); + + // Manage the sources, not allowed after compilation. + // Add multiple sources using different profiles, the driver will use the first one it supports. + inline size_t getSourceNb() const { return m_Sources.size(); }; + inline CSource *getSource(size_t i) const { return m_Sources[i]; }; + inline size_t addSource(CSource *source) { nlassert(!m_Source); m_Sources.push_back(source); return (m_Sources.size() - 1); } + inline void removeSource(size_t i) { nlassert(!m_Source); m_Sources.erase(m_Sources.begin() + i); } + + // Get the idx of a parameter (ogl: uniform, d3d: constant, etcetera) by name. Invalid name returns ~0 + inline uint getUniformIndex(const char *name) const { return m_DrvInfo->getUniformIndex(name); }; + inline uint getUniformIndex(const std::string &name) const { return m_DrvInfo->getUniformIndex(name.c_str()); }; + inline uint getUniformIndex(CProgramIndex::TName name) const { return m_Index.Indices[name]; } + + // Get feature information of the current program + inline CSource *source() const { return m_Source; }; + inline const CProgramFeatures &features() const { return m_Source->Features; }; + inline TProfile profile() const { return m_Source->Profile; } + + // Build feature info, called automatically by the driver after compile succeeds + void buildInfo(CSource *source); + + // Override this to build additional info in a subclass + virtual void buildInfo(); + +protected: + /// The progam source + std::vector > m_Sources; + + /// The source used for compilation + NLMISC::CSmartPtr m_Source; + CProgramIndex m_Index; + +public: + /// The driver information. For the driver implementation only. + NLMISC::CRefPtr m_DrvInfo; + +}; /* class IProgram */ + +} /* namespace NL3D */ + +#endif /* #ifndef NL3D_PROGRAM_H */ + +/* end of file */ diff --git a/code/nel/include/nel/3d/render_trav.h b/code/nel/include/nel/3d/render_trav.h index 6e8d04b32..d50d2c242 100644 --- a/code/nel/include/nel/3d/render_trav.h +++ b/code/nel/include/nel/3d/render_trav.h @@ -27,6 +27,7 @@ #include "nel/3d/mesh_block_manager.h" #include "nel/3d/shadow_map_manager.h" #include "nel/3d/u_scene.h" +#include "nel/3d/vertex_program.h" #include @@ -68,6 +69,41 @@ class CWaterModel; #define NL3D_SHADOW_MESH_SKIN_MANAGER_MAXVERTICES 3000 #define NL3D_SHADOW_MESH_SKIN_MANAGER_NUMVB 8 +/// Container for lighted vertex program. +class CVertexProgramLighted : public CVertexProgram +{ +public: + static const uint MaxLight = 4; + static const uint MaxPointLight = (MaxLight - 1); + struct CIdxLighted + { + uint Ambient; + uint Diffuse[MaxLight]; + uint Specular[MaxLight]; + uint DirOrPos[MaxLight]; // light 0, directional sun; light 1,2,3, omni point light + uint EyePosition; + uint DiffuseAlpha; + }; + struct CFeaturesLighted + { + /// Number of point lights that this program is generated for, varies from 0 to 3. + uint NumActivePointLights; + bool SupportSpecular; + bool Normalize; + /// Start of constants to use for lighting with assembly shaders. + uint CtStartNeLVP; + }; + CVertexProgramLighted() { } + virtual ~CVertexProgramLighted() { } + virtual void buildInfo(); + const CIdxLighted &idxLighted() const { return m_IdxLighted; } + const CFeaturesLighted &featuresLighted() const { return m_FeaturesLighted; } + +protected: + CIdxLighted m_IdxLighted; + CFeaturesLighted m_FeaturesLighted; + +}; // *************************************************************************** @@ -224,7 +260,7 @@ public: // @{ // Max VP Light setup Infos. - enum {MaxVPLight= 4}; + enum {MaxVPLight = CVertexProgramLighted::MaxLight}; /** reset the lighting setup in the driver (all lights are disabled). * called at beginning of traverse(). Must be called by any model (before and after rendering) @@ -244,7 +280,8 @@ public: */ void changeLightSetup(CLightContribution *lightContribution, bool useLocalAttenuation); - + /// Must call before beginVPLightSetup + void prepareVPLightSetup(); /** setup the driver VP constants to get info from current LightSetup. * Only 0..3 Light + SunLights are supported. The VP do NOT support distance/Spot attenuation * Also it does not handle World Matrix with non uniform scale correctly since lighting is made in ObjectSpace @@ -253,7 +290,7 @@ public: * \param supportSpecular asitsounds. PointLights and dirLight are localViewer * \param invObjectWM the inverse of object matrix: lights are mul by this. Vp compute in object space. */ - void beginVPLightSetup(uint ctStart, bool supportSpecular, const CMatrix &invObjectWM); + void beginVPLightSetup(CVertexProgramLighted *program, const CMatrix &invObjectWM); /** change the driver VP LightSetup constants which depends on material. * \param excludeStrongest This remove the strongest light from the setup. The typical use is to have it computed by using perpixel lighting. @@ -299,7 +336,8 @@ public: * \param numActivePoinLights tells how many point light from 0 to 3 this VP must handle. NB: the Sun directionnal is not option * NB: nlassert(numActiveLights<=MaxVPLight-1). */ - static std::string getLightVPFragment(uint numActivePointLights, uint ctStart, bool supportSpecular, bool normalize); + static std::string getLightVPFragmentNeLVP(uint numActivePointLights, uint ctStart, bool supportSpecular, bool normalize); + // TODO_VP_GLSL /** This returns a reference to a driver light, by its index * \see getStrongestLightIndex @@ -381,12 +419,14 @@ private: mutable uint _StrongestLightIndex; mutable bool _StrongestLightTouched; + // Current vp setuped with beginVPLightSetup() + NLMISC::CRefPtr _VPCurrent; // Current ctStart setuped with beginVPLightSetup() - uint _VPCurrentCtStart; + //uint _VPCurrentCtStart; // Current num of VP lights enabled. uint _VPNumLights; // Current support of specular - bool _VPSupportSpecular; + // bool _VPSupportSpecular; // Sum of all ambiant of all lights + ambiantGlobal. NLMISC::CRGBAF _VPFinalAmbient; // Diffuse/Spec comp of all light / 255. diff --git a/code/nel/include/nel/3d/scene.h b/code/nel/include/nel/3d/scene.h index 1d54ce7a6..e0648ebd3 100644 --- a/code/nel/include/nel/3d/scene.h +++ b/code/nel/include/nel/3d/scene.h @@ -826,7 +826,8 @@ private: void flushSSSModelRequests(); // common vb for water display CVertexBuffer _WaterVB; - + + bool _RequestParticlesAnimate; }; diff --git a/code/nel/include/nel/3d/shader.h b/code/nel/include/nel/3d/shader.h deleted file mode 100644 index 3377c27d4..000000000 --- a/code/nel/include/nel/3d/shader.h +++ /dev/null @@ -1,99 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#ifndef NL_SHADER_H -#define NL_SHADER_H - -#include "nel/misc/types_nl.h" -#include "nel/misc/smart_ptr.h" -#include - - -namespace NL3D { - -using NLMISC::CRefCount; - - -class IDriver; - -// List typedef. -class IShaderDrvInfos; -typedef std::list TShaderDrvInfoPtrList; -typedef TShaderDrvInfoPtrList::iterator ItShaderDrvInfoPtrList; - -/** - * Interface for shader driver infos. - */ -class IShaderDrvInfos : public CRefCount -{ -private: - IDriver *_Driver; - ItShaderDrvInfoPtrList _DriverIterator; - -public: - IShaderDrvInfos(IDriver *drv, ItShaderDrvInfoPtrList it) {_Driver= drv; _DriverIterator= it;} - // The virtual dtor is important. - virtual ~IShaderDrvInfos(); -}; - - -/** - * Shader resource for the driver. It is just a container for a ".fx" text file. - */ -/* *** IMPORTANT ******************** - * *** IF YOU MODIFY THE STRUCTURE OF THIS CLASS, PLEASE INCREMENT IDriver::InterfaceVersion TO INVALIDATE OLD DRIVER DLL - * ********************************** - */ -// -------------------------------------------------- -class CShader -{ -public: - CShader(); - ~CShader(); - - // Load a shader file - bool loadShaderFile (const char *filename); - - // Set the shader text - void setText (const char *text); - - // Get the shader text - const char *getText () const { return _Text.c_str(); } - - // Set the shader name - void setName (const char *name); - - // Get the shader name - const char *getName () const { return _Name.c_str(); } - -public: - // Private. For Driver only. - bool _ShaderChanged; - NLMISC::CRefPtr _DrvInfo; -private: - // The shader - std::string _Text; - // The shader name - std::string _Name; -}; - - -} // NL3D - - -#endif // NL_SHADER_H - -/* End of shader.h */ diff --git a/code/nel/include/nel/3d/stereo_debugger.h b/code/nel/include/nel/3d/stereo_debugger.h new file mode 100644 index 000000000..b07a9630c --- /dev/null +++ b/code/nel/include/nel/3d/stereo_debugger.h @@ -0,0 +1,134 @@ +/** + * \file stereo_debugger.h + * \brief CStereoDebugger + * \date 2013-07-03 20:17GMT + * \author Jan Boon (Kaetemi) + * CStereoDebugger + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + */ + +#if !FINAL_VERSION +#ifndef NL3D_STEREO_DEBUGGER_H +#define NL3D_STEREO_DEBUGGER_H +#include + +// STL includes + +// NeL includes +#include +#include + +// Project includes +#include +#include +#include +#include + +#define NL_STEREO_MAX_USER_CAMERAS 8 + +namespace NL3D { + +class ITexture; +class CTextureUser; +class CPixelProgram; + +/** + * \brief CStereoDebugger + * \date 2013-07-03 20:17GMT + * \author Jan Boon (Kaetemi) + * CStereoDebugger + */ +class CStereoDebugger : public IStereoDisplay +{ +public: + CStereoDebugger(); + virtual ~CStereoDebugger(); + + + /// Sets driver and generates necessary render targets + virtual void setDriver(NL3D::UDriver *driver); + void releaseTextures(); + void initTextures(); + void setTextures(); + void verifyTextures(); + + /// Gets the required screen resolution for this device + virtual bool getScreenResolution(uint &width, uint &height); + /// Set latest camera position etcetera + virtual void updateCamera(uint cid, const NL3D::UCamera *camera); + /// Get the frustum to use for clipping + virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const; + + /// Is there a next pass + virtual bool nextPass(); + /// Gets the current viewport + virtual const NL3D::CViewport &getCurrentViewport() const; + /// Gets the current camera frustum + virtual const NL3D::CFrustum &getCurrentFrustum(uint cid) const; + /// Gets the current camera frustum + virtual void getCurrentFrustum(uint cid, NL3D::UCamera *camera) const; + /// Gets the current camera matrix + virtual void getCurrentMatrix(uint cid, NL3D::UCamera *camera) const; + + /// At the start of a new render target + virtual bool wantClear(); + /// The 3D scene + virtual bool wantScene(); + /// Interface within the 3D scene + virtual bool wantInterface3D(); + /// 2D Interface + virtual bool wantInterface2D(); + + /// Returns true if a new render target was set, always fase if not using render targets + virtual bool beginRenderTarget(); + /// Returns true if a render target was fully drawn, always false if not using render targets + virtual bool endRenderTarget(); + + + static void listDevices(std::vector &devicesOut); + +private: + UDriver *m_Driver; + + int m_Stage; + int m_SubStage; + + CViewport m_LeftViewport; + CViewport m_RightViewport; + CFrustum m_Frustum[NL_STEREO_MAX_USER_CAMERAS]; + CMatrix m_CameraMatrix[NL_STEREO_MAX_USER_CAMERAS]; + + NLMISC::CSmartPtr m_LeftTex; + NL3D::CTextureUser *m_LeftTexU; + NLMISC::CSmartPtr m_RightTex; + NL3D::CTextureUser *m_RightTexU; + NL3D::UMaterial m_Mat; + NLMISC::CQuadUV m_QuadUV; + CPixelProgram *m_PixelProgram; + +}; /* class CStereoDebugger */ + +} /* namespace NL3D */ + +#endif /* #ifndef NL3D_STEREO_DEBUGGER_H */ +#endif /* #if !FINAL_VERSION */ + +/* end of file */ diff --git a/code/nel/include/nel/3d/stereo_display.h b/code/nel/include/nel/3d/stereo_display.h new file mode 100644 index 000000000..e3b5b3716 --- /dev/null +++ b/code/nel/include/nel/3d/stereo_display.h @@ -0,0 +1,141 @@ +/** + * \file stereo_display.h + * \brief IStereoDisplay + * \date 2013-06-27 16:29GMT + * \author Jan Boon (Kaetemi) + * IStereoDisplay + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + */ + +#ifndef NL3D_STEREO_DISPLAY_H +#define NL3D_STEREO_DISPLAY_H +#include + +// STL includes + +// NeL includes +#include + +// Project includes + +namespace NL3D { + +class UCamera; +class CViewport; +class CFrustum; +class IStereoDisplay; +class UTexture; +class UDriver; + +class IStereoDeviceFactory : public NLMISC::CRefCount +{ +public: + IStereoDeviceFactory() { } + virtual ~IStereoDeviceFactory() { } + virtual IStereoDisplay *createDevice() const = 0; +}; + +struct CStereoDeviceInfo +{ +public: + enum TStereoDeviceClass + { + StereoDisplay, + StereoHMD, + }; + + enum TStereoDeviceLibrary + { + NeL3D, + OVR, + LibVR, + OpenHMD, + }; + + NLMISC::CSmartPtr Factory; + + TStereoDeviceLibrary Library; + TStereoDeviceClass Class; + std::string Manufacturer; + std::string ProductName; + std::string Serial; // A unique device identifier +}; + +/** + * \brief IStereoDisplay + * \date 2013-06-27 16:29GMT + * \author Jan Boon (Kaetemi) + * IStereoDisplay + */ +class IStereoDisplay +{ +public: + IStereoDisplay(); + virtual ~IStereoDisplay(); + + /// Sets driver and generates necessary render targets + virtual void setDriver(NL3D::UDriver *driver) = 0; + + /// Gets the required screen resolution for this device + virtual bool getScreenResolution(uint &width, uint &height) = 0; + /// Set latest camera position etcetera + virtual void updateCamera(uint cid, const NL3D::UCamera *camera) = 0; + /// Get the frustum to use for clipping + virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const = 0; + + /// Is there a next pass + virtual bool nextPass() = 0; + /// Gets the current viewport + virtual const NL3D::CViewport &getCurrentViewport() const = 0; + /// Gets the current camera frustum + virtual const NL3D::CFrustum &getCurrentFrustum(uint cid) const = 0; + /// Gets the current camera frustum + virtual void getCurrentFrustum(uint cid, NL3D::UCamera *camera) const = 0; + /// Gets the current camera matrix + virtual void getCurrentMatrix(uint cid, NL3D::UCamera *camera) const = 0; + + /// At the start of a new render target + virtual bool wantClear() = 0; + /// The 3D scene + virtual bool wantScene() = 0; + /// Interface within the 3D scene + virtual bool wantInterface3D() = 0; + /// 2D Interface + virtual bool wantInterface2D() = 0; + + /// Returns true if a new render target was set, always fase if not using render targets + virtual bool beginRenderTarget() = 0; + /// Returns true if a render target was fully drawn, always false if not using render targets + virtual bool endRenderTarget() = 0; + + static const char *getLibraryName(CStereoDeviceInfo::TStereoDeviceLibrary library); + static void listDevices(std::vector &devicesOut); + static IStereoDisplay *createDevice(const CStereoDeviceInfo &deviceInfo); + static void releaseUnusedLibraries(); + static void releaseAllLibraries(); + +}; /* class IStereoDisplay */ + +} /* namespace NL3D */ + +#endif /* #ifndef NL3D_STEREO_DISPLAY_H */ + +/* end of file */ diff --git a/code/nel/include/nel/3d/stereo_hmd.h b/code/nel/include/nel/3d/stereo_hmd.h new file mode 100644 index 000000000..95c159cfd --- /dev/null +++ b/code/nel/include/nel/3d/stereo_hmd.h @@ -0,0 +1,73 @@ +/** + * \file stereo_hmd.h + * \brief IStereoHMD + * \date 2013-06-27 16:30GMT + * \author Jan Boon (Kaetemi) + * IStereoHMD + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + */ + +#ifndef NL3D_STEREO_HMD_H +#define NL3D_STEREO_HMD_H +#include + +// STL includes + +// NeL includes + +// Project includes +#include + +namespace NL3D { + +/** + * \brief IStereoHMD + * \date 2013-06-27 16:30GMT + * \author Jan Boon (Kaetemi) + * IStereoHMD + */ +class IStereoHMD : public IStereoDisplay +{ +public: + IStereoHMD(); + virtual ~IStereoHMD(); + + /// Get the HMD orientation + virtual NLMISC::CQuat getOrientation() const = 0; + + /// Get GUI center (1 = width, 1 = height, 0 = center) + virtual void getInterface2DShift(uint cid, float &x, float &y, float distance) const = 0; + + /// Set the head model, eye position relative to orientation point + virtual void setEyePosition(const NLMISC::CVector &v) = 0; + /// Get the head model, eye position relative to orientation point + virtual const NLMISC::CVector &getEyePosition() const = 0; + + /// Set the scale of the game in units per meter + virtual void setScale(float s) = 0; + +}; /* class IStereoHMD */ + +} /* namespace NL3D */ + +#endif /* #ifndef NL3D_STEREO_HMD_H */ + +/* end of file */ diff --git a/code/nel/include/nel/3d/stereo_libvr.h b/code/nel/include/nel/3d/stereo_libvr.h new file mode 100644 index 000000000..76d1966fe --- /dev/null +++ b/code/nel/include/nel/3d/stereo_libvr.h @@ -0,0 +1,160 @@ +/** + * \file stereo_libvr.h + * \brief CStereoLibVR + * \date 2013-08-19 19:17MT + * \author Thibaut Girka (ThibG) + * CStereoLibVR + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + */ + +#ifndef NL3D_STEREO_LIBVR_H +#define NL3D_STEREO_LIBVR_H + +#ifdef HAVE_LIBVR + +#include + +// STL includes + +// NeL includes +#include +#include + +// Project includes +#include +#include +#include +#include + +namespace NL3D { + +class ITexture; +class CTextureUser; +class CStereoLibVRDevicePtr; +class CStereoLibVRDeviceHandle; +class CPixelProgram; + +#define NL_STEREO_MAX_USER_CAMERAS 8 + +/** + * \brief CStereoOVR + * \date 2013-06-25 22:22GMT + * \author Jan Boon (Kaetemi) + * CStereoOVR + */ +class CStereoLibVR : public IStereoHMD +{ +public: + CStereoLibVR(const CStereoLibVRDeviceHandle *handle); + virtual ~CStereoLibVR(); + + /// Sets driver and generates necessary render targets + virtual void setDriver(NL3D::UDriver *driver); + + /// Gets the required screen resolution for this device + virtual bool getScreenResolution(uint &width, uint &height); + /// Set latest camera position etcetera + virtual void updateCamera(uint cid, const NL3D::UCamera *camera); + /// Get the frustum to use for clipping + virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const; + + /// Is there a next pass + virtual bool nextPass(); + /// Gets the current viewport + virtual const NL3D::CViewport &getCurrentViewport() const; + /// Gets the current camera frustum + virtual const NL3D::CFrustum &getCurrentFrustum(uint cid) const; + /// Gets the current camera frustum + virtual void getCurrentFrustum(uint cid, NL3D::UCamera *camera) const; + /// Gets the current camera matrix + virtual void getCurrentMatrix(uint cid, NL3D::UCamera *camera) const; + + /// At the start of a new render target + virtual bool wantClear(); + /// The 3D scene + virtual bool wantScene(); + /// Interface within the 3D scene + virtual bool wantInterface3D(); + /// 2D Interface + virtual bool wantInterface2D(); + + /// Returns true if a new render target was set, always fase if not using render targets + virtual bool beginRenderTarget(); + /// Returns true if a render target was fully drawn, always false if not using render targets + virtual bool endRenderTarget(); + + + /// Get the HMD orientation + virtual NLMISC::CQuat getOrientation() const; + + /// Get GUI center (1 = width, 1 = height, 0 = center) + virtual void getInterface2DShift(uint cid, float &x, float &y, float distance) const; + + /// Set the head model, eye position relative to orientation point + virtual void setEyePosition(const NLMISC::CVector &v); + /// Get the head model, eye position relative to orientation point + virtual const NLMISC::CVector &getEyePosition() const; + + /// Set the scale of the game in units per meter + virtual void setScale(float s); + + + static void listDevices(std::vector &devicesOut); + static bool isLibraryInUse(); + static void releaseLibrary(); + + + /// Calculates internal camera information based on the reference camera + void initCamera(uint cid, const NL3D::UCamera *camera); + /// Checks if the device used by this class was actually created + bool isDeviceCreated(); + +private: + CStereoLibVRDevicePtr *m_DevicePtr; + int m_Stage; + int m_SubStage; + CViewport m_LeftViewport; + CViewport m_RightViewport; + CFrustum m_ClippingFrustum[NL_STEREO_MAX_USER_CAMERAS]; + CFrustum m_LeftFrustum[NL_STEREO_MAX_USER_CAMERAS]; + CFrustum m_RightFrustum[NL_STEREO_MAX_USER_CAMERAS]; + CMatrix m_CameraMatrix[NL_STEREO_MAX_USER_CAMERAS]; + mutable bool m_OrientationCached; + mutable NLMISC::CQuat m_OrientationCache; + UDriver *m_Driver; + NLMISC::CSmartPtr m_BarrelTex; + NL3D::CTextureUser *m_BarrelTexU; + NL3D::UMaterial m_BarrelMat; + NLMISC::CQuadUV m_BarrelQuadLeft; + NLMISC::CQuadUV m_BarrelQuadRight; + CPixelProgram *m_PixelProgram; + NLMISC::CVector m_EyePosition; + float m_Scale; + +}; /* class CStereoLibVR */ + +} /* namespace NL3D */ + +#endif /* HAVE_LIBVR */ + +#endif /* #ifndef NL3D_STEREO_LIBVR_H */ + +/* end of file */ diff --git a/code/nel/include/nel/3d/stereo_ovr.h b/code/nel/include/nel/3d/stereo_ovr.h new file mode 100644 index 000000000..ba6895bf0 --- /dev/null +++ b/code/nel/include/nel/3d/stereo_ovr.h @@ -0,0 +1,176 @@ +/** + * \file stereo_ovr.h + * \brief CStereoOVR + * \date 2013-06-25 22:22GMT + * \author Jan Boon (Kaetemi) + * CStereoOVR + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + * + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole + * combination. + * + * As a special exception, the copyright holders of this library give + * you permission to link this library with the Oculus SDK to produce + * an executable, regardless of the license terms of the Oculus SDK, + * and distribute linked combinations including the two, provided that + * you also meet the terms and conditions of the license of the Oculus + * SDK. You must obey the GNU General Public License in all respects + * for all of the code used other than the Oculus SDK. If you modify + * this file, you may extend this exception to your version of the + * file, but you are not obligated to do so. If you do not wish to do + * so, delete this exception statement from your version. + */ + +#ifndef NL3D_STEREO_OVR_H +#define NL3D_STEREO_OVR_H + +#ifdef HAVE_LIBOVR + +#include + +// STL includes + +// NeL includes +#include +#include + +// Project includes +#include +#include +#include +#include + +namespace NL3D { + +class ITexture; +class CTextureUser; +class CStereoOVRDevicePtr; +class CStereoOVRDeviceHandle; +class CPixelProgramOVR; + +#define NL_STEREO_MAX_USER_CAMERAS 8 + +/** + * \brief CStereoOVR + * \date 2013-06-25 22:22GMT + * \author Jan Boon (Kaetemi) + * CStereoOVR + */ +class CStereoOVR : public IStereoHMD +{ +public: + CStereoOVR(const CStereoOVRDeviceHandle *handle); + virtual ~CStereoOVR(); + + /// Sets driver and generates necessary render targets + virtual void setDriver(NL3D::UDriver *driver); + + /// Gets the required screen resolution for this device + virtual bool getScreenResolution(uint &width, uint &height); + /// Set latest camera position etcetera + virtual void updateCamera(uint cid, const NL3D::UCamera *camera); + /// Get the frustum to use for clipping + virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const; + + /// Is there a next pass + virtual bool nextPass(); + /// Gets the current viewport + virtual const NL3D::CViewport &getCurrentViewport() const; + /// Gets the current camera frustum + virtual const NL3D::CFrustum &getCurrentFrustum(uint cid) const; + /// Gets the current camera frustum + virtual void getCurrentFrustum(uint cid, NL3D::UCamera *camera) const; + /// Gets the current camera matrix + virtual void getCurrentMatrix(uint cid, NL3D::UCamera *camera) const; + + /// At the start of a new render target + virtual bool wantClear(); + /// The 3D scene + virtual bool wantScene(); + /// Interface within the 3D scene + virtual bool wantInterface3D(); + /// 2D Interface + virtual bool wantInterface2D(); + + /// Returns true if a new render target was set, always fase if not using render targets + virtual bool beginRenderTarget(); + /// Returns true if a render target was fully drawn, always false if not using render targets + virtual bool endRenderTarget(); + + + /// Get the HMD orientation + virtual NLMISC::CQuat getOrientation() const; + + /// Get GUI center (1 = width, 1 = height, 0 = center) + virtual void getInterface2DShift(uint cid, float &x, float &y, float distance) const; + + /// Set the head model, eye position relative to orientation point + virtual void setEyePosition(const NLMISC::CVector &v); + /// Get the head model, eye position relative to orientation point + virtual const NLMISC::CVector &getEyePosition() const; + + /// Set the scale of the game in units per meter + virtual void setScale(float s); + + + static void listDevices(std::vector &devicesOut); + static bool isLibraryInUse(); + static void releaseLibrary(); + + + /// Calculates internal camera information based on the reference camera + void initCamera(uint cid, const NL3D::UCamera *camera); + /// Checks if the device used by this class was actually created + bool isDeviceCreated(); + +private: + CStereoOVRDevicePtr *m_DevicePtr; + int m_Stage; + int m_SubStage; + CViewport m_LeftViewport; + CViewport m_RightViewport; + CFrustum m_ClippingFrustum[NL_STEREO_MAX_USER_CAMERAS]; + CFrustum m_LeftFrustum[NL_STEREO_MAX_USER_CAMERAS]; + CFrustum m_RightFrustum[NL_STEREO_MAX_USER_CAMERAS]; + CMatrix m_CameraMatrix[NL_STEREO_MAX_USER_CAMERAS]; + mutable bool m_OrientationCached; + mutable NLMISC::CQuat m_OrientationCache; + UDriver *m_Driver; + NLMISC::CSmartPtr m_BarrelTex; + NL3D::CTextureUser *m_BarrelTexU; + NL3D::UMaterial m_BarrelMat; + NLMISC::CQuadUV m_BarrelQuadLeft; + NLMISC::CQuadUV m_BarrelQuadRight; + NLMISC::CRefPtr m_PixelProgram; + NLMISC::CVector m_EyePosition; + float m_Scale; + +}; /* class CStereoOVR */ + +} /* namespace NL3D */ + +#endif /* HAVE_LIBOVR */ + +#endif /* #ifndef NL3D_STEREO_OVR_H */ + +/* end of file */ diff --git a/code/nel/include/nel/3d/u_driver.h b/code/nel/include/nel/3d/u_driver.h index d66a72e47..2e74ae3fe 100644 --- a/code/nel/include/nel/3d/u_driver.h +++ b/code/nel/include/nel/3d/u_driver.h @@ -168,6 +168,7 @@ public: */ // @{ virtual void disableHardwareVertexProgram()=0; + virtual void disableHardwarePixelProgram()=0; virtual void disableHardwareVertexArrayAGP()=0; virtual void disableHardwareTextureShader()=0; // @} @@ -672,13 +673,6 @@ public: */ virtual void forceTextureResize(uint divisor)=0; - /** Sets enforcement of native fragment programs. This is by default enabled. - * - * \param nativeOnly If set to false, fragment programs don't need to be native to stay loaded, - * otherwise (aka if true) they will be purged. - */ - virtual void forceNativeFragmentPrograms(bool nativeOnly) = 0; - /** Setup monitor color properties. * * Return false if setup failed. diff --git a/code/nel/include/nel/3d/vegetable_manager.h b/code/nel/include/nel/3d/vegetable_manager.h index 71ed235e4..ee21af3f3 100644 --- a/code/nel/include/nel/3d/vegetable_manager.h +++ b/code/nel/include/nel/3d/vegetable_manager.h @@ -48,6 +48,7 @@ class CVegetableLightEx; // default distance is 60 meters. #define NL3D_VEGETABLE_DEFAULT_DIST_MAX 60.f +class CVertexProgramVeget; // *************************************************************************** /** @@ -306,7 +307,8 @@ private: // The same, but no VBHard. CVegetableVBAllocator _VBSoftAllocator[CVegetableVBAllocator::VBTypeCount]; // Vertex Program. One VertexProgram for each rdrPass (with / without fog) - CVertexProgram *_VertexProgram[NL3D_VEGETABLE_NRDRPASS][2]; + CSmartPtr _VertexProgram[NL3D_VEGETABLE_NRDRPASS][2]; + CRefPtr _ActiveVertexProgram; // Material. Useful for texture and alphaTest @@ -342,7 +344,7 @@ private: /// setup the vertexProgram constants. - void setupVertexProgramConstants(IDriver *driver); + void setupVertexProgramConstants(IDriver *driver, bool fogEnabled); /** swap the RdrPass type (hard or soft) of the rdrPass of an instance group. diff --git a/code/nel/include/nel/3d/vertex_program.h b/code/nel/include/nel/3d/vertex_program.h index 903e5ccf7..3d77c6104 100644 --- a/code/nel/include/nel/3d/vertex_program.h +++ b/code/nel/include/nel/3d/vertex_program.h @@ -19,90 +19,24 @@ #include "nel/misc/types_nl.h" #include "nel/misc/smart_ptr.h" +#include "nel/3d/program.h" #include - namespace NL3D { -// List typedef. -class IDriver; -class IVertexProgramDrvInfos; -typedef std::list TVtxPrgDrvInfoPtrList; -typedef TVtxPrgDrvInfoPtrList::iterator ItVtxPrgDrvInfoPtrList; - -// Class for interaction of vertex program with Driver. -// IVertexProgramDrvInfos represent the real data of the vertex program, stored into the driver (eg: just a GLint for opengl). -class IVertexProgramDrvInfos : public NLMISC::CRefCount -{ -private: - IDriver *_Driver; - ItVtxPrgDrvInfoPtrList _DriverIterator; - -public: - IVertexProgramDrvInfos (IDriver *drv, ItVtxPrgDrvInfoPtrList it); - // The virtual dtor is important. - virtual ~IVertexProgramDrvInfos(void); -}; - - -/** - * This class is a vertex program. - * - * D3D / OPENGL compatibility notes: - * --------------------------------- - * - * To make your program compatible with D3D and OPENGL nel drivers, please follow thoses directives to write your vertex programs - * - * - Use only v[0], v[1] etc.. syntax for input registers. Don't use v0, v1 or v[OPOS] etc.. - * - Use only c[0], c[1] etc.. syntax for constant registers. Don't use c0, c1 etc.. - * - Use only o[HPOS], o[COL0] etc.. syntax for output registers. Don't use oPos, oD0 etc.. - * - Use only uppercase for registers R1, R2 etc.. Don't use lowercase r1, r2 etc.. - * - Use a semicolon to delineate instructions. - * - Use ARL instruction to load the adress register and not MOV. - * - Don't use the NOP instruction. - * - Don't use macros. - * - * -> Thoses programs work without any change under OpenGL. - * -> Direct3D driver implementation will have to modify the syntax on the fly before the setup like this: - * - "v[0]" must be changed in "v0" etc.. - * - "o[HPOS]" must be changed in oPos etc.. - * - Semicolon must be changed in line return character. - * - ARL instruction must be changed in MOV. - * - * Behaviour of LOG may change depending on implementation: You can only expect to have dest.z = log2(abs(src.w)). - * LIT may or may not clamp the specular exponent to [-128, 128] (not done when EXT_vertex_shader is used for example ..) - * - * Depending on the implementation, some optimizations can be achieved by masking the unused output values of instructions - * as LIT, EXPP .. - * - * \author Cyril 'Hulud' Corvazier - * \author Nevrax France - * \date 2001 - */ -class CVertexProgram : public NLMISC::CRefCount +class CVertexProgram : public IProgram { public: - /// Constructor - CVertexProgram (const char* program); + CVertexProgram(); + CVertexProgram(const char *nelvp); /// Destructor virtual ~CVertexProgram (); - /// Get the program - const std::string& getProgram () const { return _Program; }; - -private: - /// The progam - std::string _Program; - -public: - /// The driver information. For the driver implementation only. - NLMISC::CRefPtr _DrvInfo; }; - } // NL3D diff --git a/code/nel/include/nel/3d/vertex_program_parse.h b/code/nel/include/nel/3d/vertex_program_parse.h index cd9f414c9..88538da07 100644 --- a/code/nel/include/nel/3d/vertex_program_parse.h +++ b/code/nel/include/nel/3d/vertex_program_parse.h @@ -21,6 +21,40 @@ #include +/** + * This class is a vertex program. + * + * D3D / OPENGL compatibility notes: + * --------------------------------- + * + * To make your program compatible with D3D and OPENGL nel drivers, please follow thoses directives to write your vertex programs + * + * - Use only v[0], v[1] etc.. syntax for input registers. Don't use v0, v1 or v[OPOS] etc.. + * - Use only c[0], c[1] etc.. syntax for constant registers. Don't use c0, c1 etc.. + * - Use only o[HPOS], o[COL0] etc.. syntax for output registers. Don't use oPos, oD0 etc.. + * - Use only uppercase for registers R1, R2 etc.. Don't use lowercase r1, r2 etc.. + * - Use a semicolon to delineate instructions. + * - Use ARL instruction to load the adress register and not MOV. + * - Don't use the NOP instruction. + * - Don't use macros. + * + * -> Thoses programs work without any change under OpenGL. + * -> Direct3D driver implementation will have to modify the syntax on the fly before the setup like this: + * - "v[0]" must be changed in "v0" etc.. + * - "o[HPOS]" must be changed in oPos etc.. + * - Semicolon must be changed in line return character. + * - ARL instruction must be changed in MOV. + * + * Behaviour of LOG may change depending on implementation: You can only expect to have dest.z = log2(abs(src.w)). + * LIT may or may not clamp the specular exponent to [-128, 128] (not done when EXT_vertex_shader is used for example ..) + * + * Depending on the implementation, some optimizations can be achieved by masking the unused output values of instructions + * as LIT, EXPP .. + * + * \author Cyril 'Hulud' Corvazier + * \author Nevrax France + * \date 2001 + */ /// Swizzle of an operand in a vertex program struct CVPSwizzle diff --git a/code/nel/include/nel/3d/water_env_map.h b/code/nel/include/nel/3d/water_env_map.h index 384f55b56..50fca18ec 100644 --- a/code/nel/include/nel/3d/water_env_map.h +++ b/code/nel/include/nel/3d/water_env_map.h @@ -61,7 +61,7 @@ public: // Get envmap 2D texture (after projection of cube map) ITexture *getEnvMap2D() const { return _Env2D; } // tmp for debug : render test mesh with current model / view matrixs - void renderTestMesh(IDriver &driver); + // void renderTestMesh(IDriver &driver); // set constant alpha of envmap void setAlpha(uint8 alpha) { _Alpha = alpha; } uint8 getAlpha() const { return _Alpha; } diff --git a/code/nel/include/nel/3d/water_shape.h b/code/nel/include/nel/3d/water_shape.h index f7a7e1b0b..dc7f20426 100644 --- a/code/nel/include/nel/3d/water_shape.h +++ b/code/nel/include/nel/3d/water_shape.h @@ -49,6 +49,29 @@ const NLMISC::CClassId WaveMakerModelClassId = NLMISC::CClassId(0x16da3356, 0x7 const uint WATER_VERTEX_HARD_SIZE = sizeof(float[3]); const uint WATER_VERTEX_SOFT_SIZE = sizeof(float[5]); +// VP Water No Wave +class CVertexProgramWaterVPNoWave : public CVertexProgram +{ +public: + struct CIdx + { + uint BumpMap0Scale; + uint BumpMap0Offset; + uint BumpMap1Scale; + uint BumpMap1Offset; + uint ObserverHeight; + uint ScaleReflectedRay; + uint DiffuseMapVector0; + uint DiffuseMapVector1; + }; + CVertexProgramWaterVPNoWave(bool diffuse); + virtual ~CVertexProgramWaterVPNoWave() { } + virtual void buildInfo(); + inline const CIdx &idx() const { return m_Idx; } +private: + CIdx m_Idx; + bool m_Diffuse; +}; /** * A water shape. @@ -247,17 +270,17 @@ private: static bool _GridSizeTouched; // - static std::auto_ptr _VertexProgramBump1; - static std::auto_ptr _VertexProgramBump2; + /*static NLMISC::CSmartPtr _VertexProgramBump1; + static NLMISC::CSmartPtr _VertexProgramBump2; // - static std::auto_ptr _VertexProgramBump1Diffuse; - static std::auto_ptr _VertexProgramBump2Diffuse; + static NLMISC::CSmartPtr _VertexProgramBump1Diffuse; + static NLMISC::CSmartPtr _VertexProgramBump2Diffuse; // - static std::auto_ptr _VertexProgramNoBump; - static std::auto_ptr _VertexProgramNoBumpDiffuse; + static NLMISC::CSmartPtr _VertexProgramNoBump; + static NLMISC::CSmartPtr _VertexProgramNoBumpDiffuse;*/ // - static std::auto_ptr _VertexProgramNoWave; - static std::auto_ptr _VertexProgramNoWaveDiffuse; + static NLMISC::CSmartPtr _VertexProgramNoWave; + static NLMISC::CSmartPtr _VertexProgramNoWaveDiffuse; }; diff --git a/code/nel/include/nel/georges/load_form.h b/code/nel/include/nel/georges/load_form.h index 6bf6c83c3..4aaab43d0 100644 --- a/code/nel/include/nel/georges/load_form.h +++ b/code/nel/include/nel/georges/load_form.h @@ -109,7 +109,7 @@ struct TLoadFormDicoEntry } }; */ -const uint32 PACKED_SHEET_HEADER = 'PKSH'; +const uint32 PACKED_SHEET_HEADER = NELID("PKSH"); const uint32 PACKED_SHEET_VERSION = 5; // This Version may be used if you want to use the serialVersion() system in loadForm() const uint32 PACKED_SHEET_VERSION_COMPATIBLE = 0; diff --git a/code/nel/include/nel/misc/cdb_branch.h b/code/nel/include/nel/misc/cdb_branch.h index 11adbac0d..f8a979499 100644 --- a/code/nel/include/nel/misc/cdb_branch.h +++ b/code/nel/include/nel/misc/cdb_branch.h @@ -21,6 +21,8 @@ #include "cdb.h" +#define NL_CDB_OPTIMIZE_PREDICT 1 + namespace NLMISC{ /** @@ -247,6 +249,10 @@ protected: /// called by clear void removeAllBranchObserver(); + +#if NL_CDB_OPTIMIZE_PREDICT + CRefPtr _PredictNode; +#endif }; } diff --git a/code/nel/include/nel/misc/fast_floor.h b/code/nel/include/nel/misc/fast_floor.h index f58e475e5..6cb8e209c 100644 --- a/code/nel/include/nel/misc/fast_floor.h +++ b/code/nel/include/nel/misc/fast_floor.h @@ -19,6 +19,7 @@ #include "types_nl.h" #include +#include namespace NLMISC { diff --git a/code/nel/include/nel/misc/stream.h b/code/nel/include/nel/misc/stream.h index ad0e8ddd4..5a342643d 100644 --- a/code/nel/include/nel/misc/stream.h +++ b/code/nel/include/nel/misc/stream.h @@ -53,6 +53,13 @@ class CMemStream; # endif # define NLMISC_BSWAP64(src) (src) = (((src)>>56)&0xFF) | ((((src)>>48)&0xFF)<<8) | ((((src)>>40)&0xFF)<<16) | ((((src)>>32)&0xFF)<<24) | ((((src)>>24)&0xFF)<<32) | ((((src)>>16)&0xFF)<<40) | ((((src)>>8)&0xFF)<<48) | (((src)&0xFF)<<56) +// convert a 4 characters string to uint32 +#ifdef NL_LITTLE_ENDIAN +# define NELID(x) (uint32((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | (x[3]))) +#else +# define NELID(x) (uint32((x[3] << 24) | (x[2] << 16) | (x[1] << 8) | (x[0]))) +#endif + // ====================================================================================================== /** * Stream Exception. diff --git a/code/nel/samples/3d/nel_qt/nel_qt.cfg b/code/nel/samples/3d/nel_qt/nel_qt.cfg index b2c141f89..b87b4767a 100644 --- a/code/nel/samples/3d/nel_qt/nel_qt.cfg +++ b/code/nel/samples/3d/nel_qt/nel_qt.cfg @@ -6,7 +6,7 @@ GraphicsDriver = "OpenGL"; SoundDriver = "OpenAL"; SoundDevice = ""; LanguageCode = "en"; -QtStyle = "Cleanlooks"; +QtStyle = ""; FontName = "andbasr.ttf"; FontShadow = 1; BackgroundColor = { diff --git a/code/nel/src/3d/CMakeLists.txt b/code/nel/src/3d/CMakeLists.txt index 6f632e261..fff343915 100644 --- a/code/nel/src/3d/CMakeLists.txt +++ b/code/nel/src/3d/CMakeLists.txt @@ -153,8 +153,6 @@ SOURCE_GROUP(Driver FILES ../../include/nel/3d/scene.h scene_group.cpp ../../include/nel/3d/scene_group.h - shader.cpp - ../../include/nel/3d/shader.h texture.cpp ../../include/nel/3d/texture.h vertex_buffer.cpp @@ -164,7 +162,15 @@ SOURCE_GROUP(Driver FILES vertex_program.cpp ../../include/nel/3d/vertex_program.h vertex_program_parse.cpp - ../../include/nel/3d/vertex_program_parse.h) + ../../include/nel/3d/vertex_program_parse.h + pixel_program.cpp + ../../include/nel/3d/pixel_program.h + geometry_program.cpp + ../../include/nel/3d/geometry_program.h + program.cpp + ../../include/nel/3d/program.h + gpu_program_params.cpp + ../../include/nel/3d/gpu_program_params.h) SOURCE_GROUP(Font FILES computed_string.cpp @@ -686,12 +692,24 @@ SOURCE_GROUP(Shadows FILES ../../include/nel/3d/shadow_map_manager.h shadow_poly_receiver.cpp ../../include/nel/3d/shadow_poly_receiver.h) +SOURCE_GROUP(Stereo FILES + stereo_display.cpp + ../../include/nel/3d/stereo_display.h + stereo_hmd.cpp + ../../include/nel/3d/stereo_hmd.h + stereo_ovr.cpp + stereo_ovr_fp.cpp + ../../include/nel/3d/stereo_ovr.h + stereo_libvr.cpp + ../../include/nel/3d/stereo_libvr.h + stereo_debugger.cpp + ../../include/nel/3d/stereo_debugger.h) NL_TARGET_LIB(nel3d ${HEADERS} ${SRC}) -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} ${LIBOVR_INCLUDE_DIR} ${LIBVR_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARY}) +TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARIES} ${LIBOVR_LIBRARIES} ${LIBVR_LIBRARY}) SET_TARGET_PROPERTIES(nel3d PROPERTIES LINK_INTERFACE_LIBRARIES "") NL_DEFAULT_PROPS(nel3d "NeL, Library: NeL 3D") NL_ADD_RUNTIME_FLAGS(nel3d) @@ -701,6 +719,9 @@ NL_ADD_LIB_SUFFIX(nel3d) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) +ADD_DEFINITIONS(${LIBOVR_DEFINITIONS}) +ADD_DEFINITIONS(${LIBVR_DEFINITIONS}) + IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel3d ${CMAKE_CURRENT_SOURCE_DIR}/std3d.h ${CMAKE_CURRENT_SOURCE_DIR}/std3d.cpp) ENDIF(WITH_PCH) diff --git a/code/nel/src/3d/animation.cpp b/code/nel/src/3d/animation.cpp index 9cfd3f26b..a604d2bde 100644 --- a/code/nel/src/3d/animation.cpp +++ b/code/nel/src/3d/animation.cpp @@ -89,8 +89,8 @@ void CAnimation::serial (NLMISC::IStream& f) nlassert(_IdByChannelId.empty()); // Serial a header - f.serialCheck ((uint32)'_LEN'); - f.serialCheck ((uint32)'MINA'); + f.serialCheck (NELID("_LEN")); + f.serialCheck (NELID("MINA")); // Serial a version sint version=f.serialVersion (2); diff --git a/code/nel/src/3d/animation_set.cpp b/code/nel/src/3d/animation_set.cpp index 94946799b..05db8a7be 100644 --- a/code/nel/src/3d/animation_set.cpp +++ b/code/nel/src/3d/animation_set.cpp @@ -185,9 +185,9 @@ void CAnimationSet::serial (NLMISC::IStream& f) nlassert(!_AnimHeaderOptimisation); // Serial an header - f.serialCheck ((uint32)'_LEN'); - f.serialCheck ((uint32)'MINA'); - f.serialCheck ((uint32)'TES_'); + f.serialCheck (NELID("_LEN")); + f.serialCheck (NELID("MINA")); + f.serialCheck (NELID("TES_")); // Serial a version uint ver= f.serialVersion (1); diff --git a/code/nel/src/3d/bloom_effect.cpp b/code/nel/src/3d/bloom_effect.cpp index 7cbb48310..7809aba2c 100644 --- a/code/nel/src/3d/bloom_effect.cpp +++ b/code/nel/src/3d/bloom_effect.cpp @@ -55,13 +55,18 @@ static const char *TextureOffset = END \n"; -static CVertexProgram TextureOffsetVertexProgram(TextureOffset); +static NLMISC::CSmartPtr TextureOffsetVertexProgram; //----------------------------------------------------------------------------------------------------------- CBloomEffect::CBloomEffect() { + if (!TextureOffsetVertexProgram) + { + TextureOffsetVertexProgram = new CVertexProgram(TextureOffset); + } + _Driver = NULL; _Scene = NULL; _SquareBloom = true; @@ -285,6 +290,8 @@ void CBloomEffect::initBloom() // clientcfg if(!_Init) init(); + _OriginalRenderTarget = static_cast(_Driver)->getDriver()->getRenderTarget(); + // if window resize, reinitialize textures if(_WndWidth!=_Driver->getWindowWidth() || _WndHeight!=_Driver->getWindowHeight()) { @@ -349,13 +356,15 @@ void CBloomEffect::initBloom() // clientcfg } } - NL3D::CTextureUser *txt = (_InitBloomEffect) ? (new CTextureUser(_InitText)) : (new CTextureUser()); - if(!((CDriverUser *) _Driver)->setRenderTarget(*txt, 0, 0, _WndWidth, _WndHeight)) + if (!_OriginalRenderTarget) { - nlwarning("setRenderTarget return false with initial texture for bloom effect\n"); - return; + NL3D::CTextureUser txt = (_InitBloomEffect) ? (CTextureUser(_InitText)) : (CTextureUser()); + if(!(static_cast(_Driver)->setRenderTarget(txt, 0, 0, _WndWidth, _WndHeight))) + { + nlwarning("setRenderTarget return false with initial texture for bloom effect\n"); + return; + } } - delete txt; } //----------------------------------------------------------------------------------------------------------- @@ -371,13 +380,13 @@ void CBloomEffect::endBloom() // clientcfg if(_Driver->getWindowWidth()==0 || _Driver->getWindowHeight()==0) return; - CTextureUser *txt1 = (_InitBloomEffect) ? (new CTextureUser(_InitText)) : (new CTextureUser()); - CTextureUser *txt2 = new CTextureUser(_BlurFinalTex); - CRect *rect1 = new CRect(0, 0, _WndWidth, _WndHeight); - CRect *rect2 = new CRect(0, 0, _BlurWidth, _BlurHeight); + CTextureUser txt1 = _OriginalRenderTarget ? CTextureUser(_OriginalRenderTarget) : ((_InitBloomEffect) ? (CTextureUser(_InitText)) : (CTextureUser())); + CTextureUser txt2(_BlurFinalTex); + CRect rect1(0, 0, _WndWidth, _WndHeight); + CRect rect2(0, 0, _BlurWidth, _BlurHeight); // stretch rect - ((CDriverUser *) _Driver)->stretchRect(_Scene, *txt1 , *rect1, - *txt2, *rect2); + ((CDriverUser *) _Driver)->stretchRect(_Scene, txt1 , rect1, + txt2, rect2); // horizontal blur pass doBlur(true); @@ -387,10 +396,6 @@ void CBloomEffect::endBloom() // clientcfg // apply blur with a blend operation applyBlur(); - delete txt1; - delete txt2; - delete rect1; - delete rect2; } //----------------------------------------------------------------------------------------------------------- @@ -399,16 +404,30 @@ void CBloomEffect::applyBlur() { NL3D::IDriver *drvInternal = ((CDriverUser *) _Driver)->getDriver(); - // in opengl, display in init texture - if(_InitBloomEffect) + /*if (_OriginalRenderTarget) { - CTextureUser *txt = new CTextureUser(_InitText); - if(!((CDriverUser *) _Driver)->setRenderTarget(*txt, 0, 0, _WndWidth, _WndHeight)) + CTextureUser txt(_OriginalRenderTarget); + if(!(static_cast(_Driver)->setRenderTarget(txt, 0, 0, _WndWidth, _WndHeight))) + { + nlwarning("setRenderTarget return false with original render target for bloom effect\n"); + return; + } + } + // in opengl, display in init texture + else if(_InitBloomEffect) + { + CTextureUser txt(_InitText); + if(!(static_cast(_Driver)->setRenderTarget(txt, 0, 0, _WndWidth, _WndHeight))) { nlwarning("setRenderTarget return false with initial texture for bloom effect\n"); return; } - delete txt; + }*/ + CTextureUser txtApply = _OriginalRenderTarget ? CTextureUser(_OriginalRenderTarget) : ((_InitBloomEffect) ? (CTextureUser(_InitText)) : (CTextureUser())); + if(!(static_cast(_Driver)->setRenderTarget(txtApply, 0, 0, _WndWidth, _WndHeight))) + { + nlwarning("setRenderTarget return false with initial texture for bloom effect\n"); + return; } // display blur texture @@ -429,9 +448,9 @@ void CBloomEffect::applyBlur() } // initialize vertex program - drvInternal->activeVertexProgram(&TextureOffsetVertexProgram); - drvInternal->setConstant(8, 255.f, 255.f, 255.f, 255.f); - drvInternal->setConstant(9, 0.0f, 0.f, 0.f, 1.f); + drvInternal->activeVertexProgram(TextureOffsetVertexProgram); + drvInternal->setUniform4f(IDriver::VertexProgram, 8, 255.f, 255.f, 255.f, 255.f); + drvInternal->setUniform4f(IDriver::VertexProgram, 9, 0.0f, 0.f, 0.f, 1.f); // initialize blur material UMaterial displayBlurMat; @@ -463,7 +482,9 @@ void CBloomEffect::applyBlur() void CBloomEffect::endInterfacesDisplayBloom() // clientcfg { - if(_InitBloomEffect) + // Render from render target to screen if necessary. + // Don't do this when the blend was done to the screen or when rendering to a user provided rendertarget. + if ((_OriginalRenderTarget.getPtr() == NULL) && _InitBloomEffect) { if(!_Driver->supportBloomEffect() || !_Init) return; @@ -475,9 +496,8 @@ void CBloomEffect::endInterfacesDisplayBloom() // clientcfg return; NL3D::IDriver *drvInternal = ((CDriverUser *) _Driver)->getDriver(); - CTextureUser *txt = new CTextureUser(); - ((CDriverUser *)_Driver)->setRenderTarget(*txt, 0, 0, 0, 0); - delete txt; + CTextureUser txtNull; + ((CDriverUser *)_Driver)->setRenderTarget(txtNull, 0, 0, 0, 0); // initialize texture coordinates float newU = drvInternal->isTextureRectangle(_InitText) ? (float)_WndWidth : 1.f; @@ -497,6 +517,8 @@ void CBloomEffect::endInterfacesDisplayBloom() // clientcfg _Driver->drawQuad(_DisplayQuad, _DisplayInitMat); _Driver->setMatrixMode3D(pCam); } + + _OriginalRenderTarget = NULL; } @@ -523,19 +545,18 @@ void CBloomEffect::doBlur(bool horizontalBlur) } NL3D::IDriver *drvInternal = ((CDriverUser *) _Driver)->getDriver(); - CTextureUser *txt = new CTextureUser(endTexture); + CTextureUser txt(endTexture); // initialize render target - if(!((CDriverUser *) _Driver)->setRenderTarget(*txt, 0, 0, _BlurWidth, _BlurHeight)) + if(!((CDriverUser *) _Driver)->setRenderTarget(txt, 0, 0, _BlurWidth, _BlurHeight)) { nlwarning("setRenderTarget return false with blur texture for bloom effect\n"); return; } - delete txt; // initialize vertex program - drvInternal->activeVertexProgram(&TextureOffsetVertexProgram); - drvInternal->setConstant(8, 255.f, 255.f, 255.f, 255.f); - drvInternal->setConstant(9, 0.0f, 0.f, 0.f, 1.f); + drvInternal->activeVertexProgram(TextureOffsetVertexProgram); + drvInternal->setUniform4f(IDriver::VertexProgram, 8, 255.f, 255.f, 255.f, 255.f); + drvInternal->setUniform4f(IDriver::VertexProgram, 9, 0.0f, 0.f, 0.f, 1.f); // set several decal constants in order to obtain in the render target texture a mix of color // of a texel and its neighbored texels on the axe of the pass. @@ -554,10 +575,10 @@ void CBloomEffect::doBlur(bool horizontalBlur) decalR = 1.f; decal2R = 2.f; } - drvInternal->setConstant(10, (decalR/(float)_BlurWidth)*blurVec.x, (decalR/(float)_BlurHeight)*blurVec.y, 0.f, 0.f); - drvInternal->setConstant(11, (decal2R/(float)_BlurWidth)*blurVec.x, (decal2R/(float)_BlurHeight)*blurVec.y, 0.f, 0.f); - drvInternal->setConstant(12, (decalL/(float)_BlurWidth)*blurVec.x, (decalL/(float)_BlurHeight)*blurVec.y, 0.f, 0.f); - drvInternal->setConstant(13, (decal2L/(float)_BlurWidth)*blurVec.x, (decal2L/(float)_BlurHeight)*blurVec.y, 0.f, 0.f); + drvInternal->setUniform2f(IDriver::VertexProgram, 10, (decalR/(float)_BlurWidth)*blurVec.x, (decalR/(float)_BlurHeight)*blurVec.y); + drvInternal->setUniform2f(IDriver::VertexProgram, 11, (decal2R/(float)_BlurWidth)*blurVec.x, (decal2R/(float)_BlurHeight)*blurVec.y); + drvInternal->setUniform2f(IDriver::VertexProgram, 12, (decalL/(float)_BlurWidth)*blurVec.x, (decalL/(float)_BlurHeight)*blurVec.y); + drvInternal->setUniform2f(IDriver::VertexProgram, 13, (decal2L/(float)_BlurWidth)*blurVec.x, (decal2L/(float)_BlurHeight)*blurVec.y); // initialize material textures CMaterial * matObject = _BlurMat.getObjectPtr(); @@ -579,10 +600,9 @@ void CBloomEffect::doBlur(bool horizontalBlur) // disable render target and vertex program drvInternal->activeVertexProgram(NULL); - txt = new CTextureUser(); - ((CDriverUser *)_Driver)->setRenderTarget(*txt, 0, 0, 0, 0); + CTextureUser cu; + ((CDriverUser *)_Driver)->setRenderTarget(cu, 0, 0, 0, 0); _Driver->setMatrixMode3D(pCam); - delete txt; } }; // NL3D diff --git a/code/nel/src/3d/computed_string.cpp b/code/nel/src/3d/computed_string.cpp index 0c2cd48de..a57191cc0 100644 --- a/code/nel/src/3d/computed_string.cpp +++ b/code/nel/src/3d/computed_string.cpp @@ -21,6 +21,7 @@ #include "nel/3d/index_buffer.h" #include "nel/3d/material.h" #include "nel/3d/frustum.h" +#include "nel/3d/viewport.h" #include "nel/misc/smart_ptr.h" #include "nel/misc/debug.h" @@ -85,6 +86,10 @@ void CComputedString::render2D (IDriver& driver, // get window size uint32 wndWidth, wndHeight; driver.getWindowSize(wndWidth, wndHeight); + CViewport vp; + driver.getViewport(vp); + wndWidth = (uint32)((float)wndWidth * vp.getWidth()); + wndHeight = (uint32)((float)wndHeight * vp.getHeight()); // scale to window size. x*= wndWidth; z*= wndHeight; @@ -242,8 +247,8 @@ void CComputedString::render2DClip (IDriver& driver, CRenderStringBuffer &rdrBuf uint lastIndex = 0; for(uint i=0;i_MatDrvInfos is updated (entry deleted); - delete *itshd; - } - // Release VBs drv. ItVBDrvInfoPtrList itvb; while( (itvb = _VBDrvInfos.begin()) != _VBDrvInfos.end() ) @@ -119,12 +110,12 @@ bool IDriver::release(void) delete *itib; } - // Release VtxPrg drv. - ItVtxPrgDrvInfoPtrList itVtxPrg; - while( (itVtxPrg = _VtxPrgDrvInfos.begin()) != _VtxPrgDrvInfos.end() ) + // Release GPUPrg drv. + ItGPUPrgDrvInfoPtrList itGPUPrg; + while( (itGPUPrg = _GPUPrgDrvInfos.begin()) != _GPUPrgDrvInfos.end() ) { - // NB: at IVertexProgramDrvInfos deletion, this->_VtxPrgDrvInfos is updated (entry deleted); - delete *itVtxPrg; + // NB: at IVertexProgramDrvInfos deletion, this->_GPUPrgDrvInfos is updated (entry deleted); + delete *itGPUPrg; } return true; @@ -249,14 +240,9 @@ void IDriver::removeMatDrvInfoPtr(ItMatDrvInfoPtrList shaderIt) _MatDrvInfos.erase(shaderIt); } // *************************************************************************** -void IDriver::removeShaderDrvInfoPtr(ItShaderDrvInfoPtrList shaderIt) +void IDriver::removeGPUPrgDrvInfoPtr(ItGPUPrgDrvInfoPtrList gpuPrgDrvInfoIt) { - _ShaderDrvInfos.erase(shaderIt); -} -// *************************************************************************** -void IDriver::removeVtxPrgDrvInfoPtr(ItVtxPrgDrvInfoPtrList vtxPrgDrvInfoIt) -{ - _VtxPrgDrvInfos.erase(vtxPrgDrvInfoIt); + _GPUPrgDrvInfos.erase(gpuPrgDrvInfoIt); } // *************************************************************************** diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 412cb52da..13306432f 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -193,6 +193,11 @@ CDriverD3D::CDriverD3D() #else // NL_DISABLE_HARDWARE_VERTEX_PROGAM _DisableHardwareVertexProgram = false; #endif // NL_DISABLE_HARDWARE_VERTEX_PROGAM +#ifdef NL_DISABLE_HARDWARE_PIXEL_PROGAM + _DisableHardwarePixelProgram = true; +#else // NL_DISABLE_HARDWARE_PIXEL_PROGAM + _DisableHardwarePixelProgram = false; +#endif // NL_DISABLE_HARDWARE_PIXEL_PROGAM #ifdef NL_DISABLE_HARDWARE_VERTEX_ARRAY_AGP _DisableHardwareVertexArrayAGP = true; #else // NL_DISABLE_HARDWARE_VERTEX_ARRAY_AGP @@ -1546,13 +1551,15 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r #endif // NL_FORCE_TEXTURE_STAGE_COUNT _VertexProgram = !_DisableHardwareVertexProgram && ((caps.VertexShaderVersion&0xffff) >= 0x0100); - _PixelShader = !_DisableHardwarePixelShader && (caps.PixelShaderVersion&0xffff) >= 0x0101; + _PixelProgramVersion = _DisableHardwareVertexProgram ? 0x0000 : caps.PixelShaderVersion & 0xffff; + nldebug("Pixel Program Version: %i.%i", (uint32)((_PixelProgramVersion & 0xFF00) >> 8), (uint32)(_PixelProgramVersion & 0xFF)); + _PixelProgram = _PixelProgramVersion >= 0x0101; _MaxVerticesByVertexBufferHard = caps.MaxVertexIndex; _MaxLight = caps.MaxActiveLights; if(_MaxLight > 0xFF) _MaxLight = 3; - if (_PixelShader) + if (_PixelProgram) { _MaxNumPerStageConstantLighted = _NbNeLTextureStages; _MaxNumPerStageConstantUnlighted = _NbNeLTextureStages; @@ -1703,6 +1710,13 @@ bool CDriverD3D::release() // Call IDriver::release() before, to destroy textures, shaders and VBs... IDriver::release(); + ItShaderDrvInfoPtrList itshd; + while( (itshd = _ShaderDrvInfos.begin()) != _ShaderDrvInfos.end() ) + { + // NB: at IShader deletion, this->_MatDrvInfos is updated (entry deleted); + delete *itshd; + } + _SwapBufferCounter = 0; if (_QuadIB) @@ -2016,6 +2030,8 @@ bool CDriverD3D::swapBuffers() // Reset vertex program setVertexProgram (NULL, NULL); + // Reset pixel program + setPixelShader (NULL); if (_VBHardProfiling) { @@ -2987,7 +3003,7 @@ bool CDriverD3D::stretchRect(ITexture * srcText, NLMISC::CRect &srcRect, ITextur bool CDriverD3D::supportBloomEffect() const { - return isVertexProgramSupported(); + return supportVertexProgram(CVertexProgram::nelvp); } // *************************************************************************** @@ -3330,9 +3346,9 @@ uint COcclusionQueryD3D::getVisibleCount() } // *************************************************************************** -bool CDriverD3D::isWaterShaderSupported() const +bool CDriverD3D::supportWaterShader() const { - H_AUTO_D3D(CDriverD3D_isWaterShaderSupported); + H_AUTO_D3D(CDriverD3D_supportWaterShader); return _PixelShaderVersion >= D3DPS_VERSION(1, 1); } @@ -3618,7 +3634,7 @@ void CDriverD3D::CVertexProgramPtrState::apply(CDriverD3D *driver) void CDriverD3D::CPixelShaderPtrState::apply(CDriverD3D *driver) { H_AUTO_D3D(CDriverD3D_CPixelShaderPtrState); - if (!driver->supportPixelShaders()) return; + if (!driver->_PixelProgram) return; driver->_DeviceInterface->SetPixelShader(PixelShader); } diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.h b/code/nel/src/3d/driver/direct3d/driver_direct3d.h index cff7cb804..1055e105c 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -35,7 +35,6 @@ #include "nel/3d/scissor.h" #include "nel/3d/driver.h" #include "nel/3d/material.h" -#include "nel/3d/shader.h" #include "nel/3d/vertex_buffer.h" #include "nel/3d/index_buffer.h" #include "nel/3d/ptr_set.h" @@ -181,6 +180,75 @@ public: }; +using NLMISC::CRefCount; + + +class IDriver; +class CDriverD3D; + +// List typedef. +class IShaderDrvInfos; +typedef std::list TShaderDrvInfoPtrList; +typedef TShaderDrvInfoPtrList::iterator ItShaderDrvInfoPtrList; + +/** + * Interface for shader driver infos. + */ +class IShaderDrvInfos : public CRefCount +{ +private: + CDriverD3D *_Driver; + ItShaderDrvInfoPtrList _DriverIterator; + +public: + IShaderDrvInfos(CDriverD3D *drv, ItShaderDrvInfoPtrList it) {_Driver= drv; _DriverIterator= it;} + // The virtual dtor is important. + virtual ~IShaderDrvInfos(); +}; + + +/** + * Shader resource for the driver. It is just a container for a ".fx" text file. + */ +/* *** IMPORTANT ******************** + * *** IF YOU MODIFY THE STRUCTURE OF THIS CLASS, PLEASE INCREMENT IDriver::InterfaceVersion TO INVALIDATE OLD DRIVER DLL + * ********************************** + */ +// -------------------------------------------------- +class CD3DShaderFX +{ +public: + CD3DShaderFX(); + ~CD3DShaderFX(); + + // Load a shader file + bool loadShaderFile (const char *filename); + + // Set the shader text + void setText (const char *text); + + // Get the shader text + const char *getText () const { return _Text.c_str(); } + + // Set the shader name + void setName (const char *name); + + // Get the shader name + const char *getName () const { return _Name.c_str(); } + +public: + // Private. For Driver only. + bool _ShaderChanged; + NLMISC::CRefPtr _DrvInfo; +private: + // The shader + std::string _Text; + // The shader name + std::string _Name; +}; + + + // *************************************************************************** class CTextureDrvInfosD3D : public ITextureDrvInfos { @@ -229,16 +297,48 @@ public: }; + // *************************************************************************** -class CVertexProgamDrvInfosD3D : public IVertexProgramDrvInfos +class CVertexProgamDrvInfosD3D : public IProgramDrvInfos { public: // The shader IDirect3DVertexShader9 *Shader; - CVertexProgamDrvInfosD3D(IDriver *drv, ItVtxPrgDrvInfoPtrList it); + CVertexProgamDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it); ~CVertexProgamDrvInfosD3D(); + + virtual uint getUniformIndex(const char *name) const + { + std::map::const_iterator it = ParamIndices.find(name); + if (it != ParamIndices.end()) return it->second; + return ~0; + }; + + std::map ParamIndices; +}; + + +// *************************************************************************** +class CPixelProgramDrvInfosD3D : public IProgramDrvInfos +{ +public: + + // The shader + IDirect3DPixelShader9 *Shader; + + CPixelProgramDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it); + ~CPixelProgramDrvInfosD3D(); + + virtual uint getUniformIndex(const char *name) const + { + std::map::const_iterator it = ParamIndices.find(name); + if (it != ParamIndices.end()) return it->second; + return ~0; + }; + + std::map ParamIndices; }; @@ -333,7 +433,7 @@ public: // Scalar handles D3DXHANDLE ScalarFloatHandle[MaxShaderTexture]; - CShaderDrvInfosD3D(IDriver *drv, ItShaderDrvInfoPtrList it); + CShaderDrvInfosD3D(CDriverD3D *drv, ItShaderDrvInfoPtrList it); virtual ~CShaderDrvInfosD3D(); }; @@ -773,13 +873,13 @@ public: // Driver parameters virtual void disableHardwareVertexProgram(); + virtual void disableHardwarePixelProgram(); virtual void disableHardwareIndexArrayAGP(); virtual void disableHardwareVertexArrayAGP(); virtual void disableHardwareTextureShader(); virtual void forceDXTCCompression(bool dxtcComp); virtual void setAnisotropicFilter(sint filter); virtual void forceTextureResize(uint divisor); - virtual void forceNativeFragmentPrograms(bool /* nativeOnly */) {} // ignored // Driver information virtual uint getNumAdapter() const; @@ -841,6 +941,7 @@ public: // todo hulud d3d buffers virtual void getZBufferPart (std::vector &zbuffer, NLMISC::CRect &rect); virtual bool setRenderTarget (ITexture *tex, uint32 x, uint32 y, uint32 width, uint32 height, uint32 mipmapLevel, uint32 cubeFace); + virtual ITexture *getRenderTarget() const; virtual bool copyTargetToTexture (ITexture *tex, uint32 offsetx, uint32 offsety, uint32 x, uint32 y, uint32 width, uint32 height, uint32 mipmapLevel); virtual bool getRenderTargetSize (uint32 &width, uint32 &height); @@ -959,9 +1060,9 @@ public: virtual bool supportTextureShaders() const {return false;}; virtual bool supportMADOperator() const; // todo hulud d3d adressing mode - virtual bool isWaterShaderSupported() const; + virtual bool supportWaterShader() const; // todo hulud d3d adressing mode - virtual bool isTextureAddrModeSupported(CMaterial::TTexAddressingMode /* mode */) const {return false;}; + virtual bool supportTextureAddrMode(CMaterial::TTexAddressingMode /* mode */) const {return false;}; // todo hulud d3d adressing mode virtual void setMatrix2DForTextureOffsetAddrMode(const uint /* stage */, const float /* mat */[4]) {} @@ -991,18 +1092,133 @@ public: virtual void setupMaterialPass(uint pass); virtual void endMaterialMultiPass(); - // Vertex program - virtual bool isVertexProgramSupported () const; - virtual bool isVertexProgramEmulated () const; - virtual bool activeVertexProgram (CVertexProgram *program); - virtual void setConstant (uint index, float, float, float, float); - virtual void setConstant (uint index, double, double, double, double); - virtual void setConstant (uint index, const NLMISC::CVector& value); - virtual void setConstant (uint index, const NLMISC::CVectorD& value); - virtual void setConstant (uint index, uint num, const float *src); - virtual void setConstant (uint index, uint num, const double *src); - virtual void setConstantMatrix (uint index, IDriver::TMatrix matrix, IDriver::TTransform transform); - virtual void setConstantFog (uint index); + + + + + + /// \name Vertex Program + // @{ + + // Order of preference + // - activeVertexProgram + // - CMaterial pass[n] VP (uses activeVertexProgram, but does not override if one already set by code) + // - default generic VP that mimics fixed pipeline / no VP with fixed pipeline + + /** + * Does the driver supports vertex program, but emulated by CPU ? + */ + virtual bool isVertexProgramEmulated() const; + + /** Return true if the driver supports the specified vertex program profile. + */ + virtual bool supportVertexProgram(CVertexProgram::TProfile profile) const; + + /** Compile the given vertex program, return if successful. + * If a vertex program was set active before compilation, + * the state of the active vertex program is undefined behaviour afterwards. + */ + virtual bool compileVertexProgram(CVertexProgram *program); + + /** Set the active vertex program. This will override vertex programs specified in CMaterial render calls. + * Also used internally by setupMaterial(CMaterial) when getVertexProgram returns NULL. + * The vertex program is activated immediately. + */ + virtual bool activeVertexProgram(CVertexProgram *program); + // @} + + + + /// \name Pixel Program + // @{ + + // Order of preference + // - activePixelProgram + // - CMaterial pass[n] PP (uses activePixelProgram, but does not override if one already set by code) + // - PP generated from CMaterial (uses activePixelProgram, but does not override if one already set by code) + + /** Return true if the driver supports the specified pixel program profile. + */ + virtual bool supportPixelProgram(CPixelProgram::TProfile profile) const; + + /** Compile the given pixel program, return if successful. + * If a pixel program was set active before compilation, + * the state of the active pixel program is undefined behaviour afterwards. + */ + virtual bool compilePixelProgram(CPixelProgram *program); + + /** Set the active pixel program. This will override pixel programs specified in CMaterial render calls. + * Also used internally by setupMaterial(CMaterial) when getPixelProgram returns NULL. + * The pixel program is activated immediately. + */ + virtual bool activePixelProgram(CPixelProgram *program); + // @} + + + + /// \name Geometry Program + // @{ + + // Order of preference + // - activeGeometryProgram + // - CMaterial pass[n] PP (uses activeGeometryProgram, but does not override if one already set by code) + // - none + + /** Return true if the driver supports the specified pixel program profile. + */ + virtual bool supportGeometryProgram(CGeometryProgram::TProfile profile) const { return false; } + + /** Compile the given pixel program, return if successful. + * If a pixel program was set active before compilation, + * the state of the active pixel program is undefined behaviour afterwards. + */ + virtual bool compileGeometryProgram(CGeometryProgram *program) { return false; } + + /** Set the active pixel program. This will override pixel programs specified in CMaterial render calls. + * Also used internally by setupMaterial(CMaterial) when getGeometryProgram returns NULL. + * The pixel program is activated immediately. + */ + virtual bool activeGeometryProgram(CGeometryProgram *program) { return false; } + // @} + + + + /// \name Program parameters + // @{ + // Set parameters + virtual void setUniform1f(TProgram program, uint index, float f0); + virtual void setUniform2f(TProgram program, uint index, float f0, float f1); + virtual void setUniform3f(TProgram program, uint index, float f0, float f1, float f2); + virtual void setUniform4f(TProgram program, uint index, float f0, float f1, float f2, float f3); + virtual void setUniform1i(TProgram program, uint index, sint32 i0); + virtual void setUniform2i(TProgram program, uint index, sint32 i0, sint32 i1); + virtual void setUniform3i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2); + virtual void setUniform4i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2, sint32 i3); + virtual void setUniform1ui(TProgram program, uint index, uint32 ui0); + virtual void setUniform2ui(TProgram program, uint index, uint32 ui0, uint32 ui1); + virtual void setUniform3ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2); + virtual void setUniform4ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3); + virtual void setUniform3f(TProgram program, uint index, const NLMISC::CVector& v); + virtual void setUniform4f(TProgram program, uint index, const NLMISC::CVector& v, float f3); + virtual void setUniform4f(TProgram program, uint index, const NLMISC::CRGBAF& rgba); + virtual void setUniform4x4f(TProgram program, uint index, const NLMISC::CMatrix& m); + virtual void setUniform4fv(TProgram program, uint index, size_t num, const float *src); + virtual void setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src); + virtual void setUniform4uiv(TProgram program, uint index, size_t num, const uint32 *src); + // Set builtin parameters + virtual void setUniformMatrix(TProgram program, uint index, TMatrix matrix, TTransform transform); + virtual void setUniformFog(TProgram program, uint index); + // Set feature parameters + virtual bool setUniformDriver(TProgram program); // set all driver-specific features params (based on program->features->DriverFlags) + virtual bool setUniformMaterial(TProgram program, CMaterial &material); // set all material-specific feature params (based on program->features->MaterialFlags) + virtual void setUniformParams(TProgram program, CGPUProgramParams ¶ms); // set all user-provided params from the storage + virtual bool isUniformProgramState() { return false; } + // @} + + + + + virtual void enableVertexProgramDoubleSidedColor(bool doubleSided); virtual bool supportVertexProgramDoubleSidedColor() const; @@ -1021,7 +1237,7 @@ public: * ColorOp[n] = DISABLE; * AlphaOp[n] = DISABLE; */ - virtual bool activeShader(CShader *shd); + bool activeShader(CD3DShaderFX *shd); // Bench virtual void startBench (bool wantStandardDeviation = false, bool quick = false, bool reset = true); @@ -1040,8 +1256,6 @@ public: uint32 getMaxVertexIndex() const { return _MaxVertexIndex; } - bool supportPixelShaders() const { return _PixelShader; } - // *** Inline info uint inlGetNumTextStages() const { return _NbNeLTextureStages; } @@ -1892,12 +2106,21 @@ public: return d3dtex; } + // Get the d3dtext mirror of an existing setuped pixel program. + static inline CPixelProgramDrvInfosD3D* getPixelProgramD3D(CPixelProgram& pixelProgram) + { + H_AUTO_D3D(CDriverD3D_getPixelProgramD3D); + CPixelProgramDrvInfosD3D* d3dPixelProgram; + d3dPixelProgram = (CPixelProgramDrvInfosD3D*)(IProgramDrvInfos*)(pixelProgram.m_DrvInfo); + return d3dPixelProgram; + } + // Get the d3dtext mirror of an existing setuped vertex program. static inline CVertexProgamDrvInfosD3D* getVertexProgramD3D(CVertexProgram& vertexProgram) { H_AUTO_D3D(CDriverD3D_getVertexProgramD3D); CVertexProgamDrvInfosD3D* d3dVertexProgram; - d3dVertexProgram = (CVertexProgamDrvInfosD3D*)(IVertexProgramDrvInfos*)(vertexProgram._DrvInfo); + d3dVertexProgram = (CVertexProgamDrvInfosD3D*)(IProgramDrvInfos*)(vertexProgram.m_DrvInfo); return d3dVertexProgram; } @@ -1943,7 +2166,7 @@ public: void releaseInternalShaders(); bool setShaderTexture (uint textureHandle, ITexture *texture, CFXCache *cache); - bool validateShader(CShader *shader); + bool validateShader(CD3DShaderFX *shader); void activePass (uint pass) { @@ -2080,6 +2303,8 @@ private: void findNearestFullscreenVideoMode(); + TShaderDrvInfoPtrList _ShaderDrvInfos; + // Windows std::string _WindowClass; HWND _HWnd; @@ -2197,8 +2422,10 @@ private: bool _ForceDXTCCompression:1; bool _TextureCubeSupported; bool _VertexProgram; - bool _PixelShader; + bool _PixelProgram; + uint16 _PixelProgramVersion; bool _DisableHardwareVertexProgram; + bool _DisableHardwarePixelProgram; bool _DisableHardwareVertexArrayAGP; bool _DisableHardwareIndexArrayAGP; bool _DisableHardwarePixelShader; @@ -2316,6 +2543,9 @@ private: // The last vertex buffer needs vertex color bool _FogEnabled; + NLMISC::CRefPtr _VertexProgramUser; + NLMISC::CRefPtr _PixelProgramUser; + // *** Internal resources // Current render pass @@ -2344,7 +2574,7 @@ private: CIndexBuffer _QuadIndexesAGP; // The last setuped shader - CShader *_CurrentShader; + CD3DShaderFX *_CurrentShader; UINT _CurrentShaderPassCount; public: struct CTextureRef @@ -2369,29 +2599,29 @@ private: CRenderVariable *_ModifiedRenderState; // Internal shaders - CShader _ShaderLightmap0; - CShader _ShaderLightmap1; - CShader _ShaderLightmap2; - CShader _ShaderLightmap3; - CShader _ShaderLightmap4; - CShader _ShaderLightmap0Blend; - CShader _ShaderLightmap1Blend; - CShader _ShaderLightmap2Blend; - CShader _ShaderLightmap3Blend; - CShader _ShaderLightmap4Blend; - CShader _ShaderLightmap0X2; - CShader _ShaderLightmap1X2; - CShader _ShaderLightmap2X2; - CShader _ShaderLightmap3X2; - CShader _ShaderLightmap4X2; - CShader _ShaderLightmap0BlendX2; - CShader _ShaderLightmap1BlendX2; - CShader _ShaderLightmap2BlendX2; - CShader _ShaderLightmap3BlendX2; - CShader _ShaderLightmap4BlendX2; - CShader _ShaderCloud; - CShader _ShaderWaterNoDiffuse; - CShader _ShaderWaterDiffuse; + CD3DShaderFX _ShaderLightmap0; + CD3DShaderFX _ShaderLightmap1; + CD3DShaderFX _ShaderLightmap2; + CD3DShaderFX _ShaderLightmap3; + CD3DShaderFX _ShaderLightmap4; + CD3DShaderFX _ShaderLightmap0Blend; + CD3DShaderFX _ShaderLightmap1Blend; + CD3DShaderFX _ShaderLightmap2Blend; + CD3DShaderFX _ShaderLightmap3Blend; + CD3DShaderFX _ShaderLightmap4Blend; + CD3DShaderFX _ShaderLightmap0X2; + CD3DShaderFX _ShaderLightmap1X2; + CD3DShaderFX _ShaderLightmap2X2; + CD3DShaderFX _ShaderLightmap3X2; + CD3DShaderFX _ShaderLightmap4X2; + CD3DShaderFX _ShaderLightmap0BlendX2; + CD3DShaderFX _ShaderLightmap1BlendX2; + CD3DShaderFX _ShaderLightmap2BlendX2; + CD3DShaderFX _ShaderLightmap3BlendX2; + CD3DShaderFX _ShaderLightmap4BlendX2; + CD3DShaderFX _ShaderCloud; + CD3DShaderFX _ShaderWaterNoDiffuse; + CD3DShaderFX _ShaderWaterDiffuse; // Backup frame buffer @@ -2527,6 +2757,10 @@ public: // Clip the wanted rectangle with window. return true if rect is not NULL. bool clipRect(NLMISC::CRect &rect); + friend class IShaderDrvInfos; + + void removeShaderDrvInfoPtr(ItShaderDrvInfoPtrList shaderIt); + }; #define NL_D3DCOLOR_RGBA(rgba) (D3DCOLOR_ARGB(rgba.A,rgba.R,rgba.G,rgba.B)) diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp index a7d218e79..40d01039b 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp @@ -328,7 +328,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) pShader = static_cast((IMaterialDrvInfos*)(mat._MatDrvInfo)); // Now we can get the supported shader from the cache. - CMaterial::TShader matShader = mat.getShader(); + CMaterial::TShader matShader = _PixelProgramUser ? CMaterial::Program : mat.getShader(); if (_CurrentMaterialSupportedShader != CMaterial::Normal) { @@ -567,7 +567,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) normalShaderDesc.TexEnvMode[stage] = mat.getTexEnvMode(uint8(stage)); } - if (_PixelShader) + if (_PixelProgram) { #ifdef NL_DEBUG_D3D // Check, should not occured @@ -648,7 +648,9 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) // Must separate texture setup and texture activation in 2 "for"... // because setupTexture() may disable all stage. - if (matShader == CMaterial::Normal) + if (matShader == CMaterial::Normal + || ((matShader == CMaterial::Program) && (_PixelProgramUser->features().MaterialFlags & CProgramFeatures::TextureStages)) + ) { uint stage; for(stage=0 ; stagefeatures().MaterialFlags & CProgramFeatures::TextureStages)) + ) { uint stage; for(stage=0 ; stageNeedsConstantForDiffuse && _PixelShader) + if (!pShader->NeedsConstantForDiffuse && _PixelProgram) setPixelShader (pShader->PixelShader); } break; @@ -2019,7 +2023,7 @@ void CDriverD3D::endMaterialMultiPass() bool CDriverD3D::supportCloudRenderSinglePass () const { H_AUTO_D3D(CDriver3D_supportCloudRenderSinglePass); - return _PixelShader; + return _PixelProgram; } // *************************************************************************** diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp new file mode 100644 index 000000000..e0a2cd4a4 --- /dev/null +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_pixel_program.cpp @@ -0,0 +1,153 @@ +/** \file driver_direct3d_pixel_program.cpp + * Direct 3d driver implementation + * + * $Id: driver_direct3d_pixel_program.cpp,v 1.1.2.4 2007/07/09 15:26:35 legallo Exp $ + * + * \todo manage better the init/release system (if a throw occurs in the init, we must release correctly the driver) + */ + +/* Copyright, 2000 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stddirect3d.h" + +#include "driver_direct3d.h" + +using namespace std; +using namespace NLMISC; + +namespace NL3D +{ + +// *************************************************************************** + +CPixelProgramDrvInfosD3D::CPixelProgramDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos (drv, it) +{ + H_AUTO_D3D(CPixelProgramDrvInfosD3D_CPixelProgamDrvInfosD3D) + Shader = NULL; +} + +// *************************************************************************** + +CPixelProgramDrvInfosD3D::~CPixelProgramDrvInfosD3D() +{ + H_AUTO_D3D(CPixelProgramDrvInfosD3D_CPixelProgramDrvInfosD3DDtor) + if (Shader) + Shader->Release(); +} + +// *************************************************************************** + +bool CDriverD3D::supportPixelProgram (CPixelProgram::TProfile profile) const +{ + H_AUTO_D3D(CDriverD3D_supportPixelProgram_profile) + return ((profile & 0xFFFF0000) == 0xD9020000) + && (_PixelProgramVersion >= (uint16)(profile & 0x0000FFFF)); +} + +// *************************************************************************** + +bool CDriverD3D::compilePixelProgram(CPixelProgram *program) +{ + // Program setuped ? + if (program->m_DrvInfo==NULL) + { + // Find a supported pixel program profile + IProgram::CSource *source = NULL; + for (uint i = 0; i < program->getSourceNb(); ++i) + { + if (supportPixelProgram(program->getSource(i)->Profile)) + { + source = program->getSource(i); + } + } + if (!source) + { + nlwarning("No supported source profile for pixel program"); + return false; + } + + _GPUPrgDrvInfos.push_front (NULL); + ItGPUPrgDrvInfoPtrList itPix = _GPUPrgDrvInfos.begin(); + CPixelProgramDrvInfosD3D *drvInfo; + *itPix = drvInfo = new CPixelProgramDrvInfosD3D(this, itPix); + + // Create a driver info structure + program->m_DrvInfo = *itPix; + + LPD3DXBUFFER pShader; + LPD3DXBUFFER pErrorMsgs; + if (D3DXAssembleShader(source->SourcePtr, source->SourceLen, NULL, NULL, 0, &pShader, &pErrorMsgs) == D3D_OK) + { + if (_DeviceInterface->CreatePixelShader((DWORD*)pShader->GetBufferPointer(), &(getPixelProgramD3D(*program)->Shader)) != D3D_OK) + return false; + } + else + { + nlwarning ("Can't assemble pixel program:"); + nlwarning ((const char*)pErrorMsgs->GetBufferPointer()); + return false; + } + + // Set parameters for assembly programs + drvInfo->ParamIndices = source->ParamIndices; + + // Build the feature info + program->buildInfo(source); + } + + return true; +} + +// *************************************************************************** + +bool CDriverD3D::activePixelProgram(CPixelProgram *program) +{ + H_AUTO_D3D(CDriverD3D_activePixelProgram ) + if (_DisableHardwarePixelProgram) + return false; + + // Set the pixel program + if (program) + { + if (!CDriverD3D::compilePixelProgram(program)) return false; + + CPixelProgramDrvInfosD3D *info = static_cast((IProgramDrvInfos*)program->m_DrvInfo); + _PixelProgramUser = program; + setPixelShader(info->Shader); + } + else + { + setPixelShader(NULL); + _PixelProgramUser = NULL; + } + + return true; +} + +// *************************************************************************** + +void CDriverD3D::disableHardwarePixelProgram() +{ + H_AUTO_D3D(CDriverD3D_disableHardwarePixelProgram) + _DisableHardwarePixelProgram = true; + _PixelProgram = false; +} + +} // NL3D diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp index b9b757de1..5cc6c283c 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp @@ -17,6 +17,8 @@ #include "stddirect3d.h" #include "driver_direct3d.h" +#include "nel/misc/path.h" +#include "nel/misc/file.h" using namespace std; using namespace NLMISC; @@ -24,6 +26,93 @@ using namespace NLMISC; namespace NL3D { + +// *************************************************************************** + +CD3DShaderFX::~CD3DShaderFX() +{ + // Must kill the drv mirror of this shader. + _DrvInfo.kill(); +} + +// *************************************************************************** + +CD3DShaderFX::CD3DShaderFX() +{ + _ShaderChanged = true; +} + +// *************************************************************************** + +void CD3DShaderFX::setText (const char *text) +{ + _Text = text; + _ShaderChanged = true; +} + +// *************************************************************************** + +void CD3DShaderFX::setName (const char *name) +{ + _Name = name; + _ShaderChanged = true; +} + +// *************************************************************************** + +bool CD3DShaderFX::loadShaderFile (const char *filename) +{ + _Text = ""; + // Lookup + string _filename = NLMISC::CPath::lookup(filename, false, true, true); + if (!_filename.empty()) + { + // File length + uint size = NLMISC::CFile::getFileSize (_filename); + _Text.reserve (size+1); + + try + { + NLMISC::CIFile file; + if (file.open (_filename)) + { + // Read it + while (!file.eof ()) + { + char line[512]; + file.getline (line, 512); + _Text += line; + } + + // Set the shader name + _Name = NLMISC::CFile::getFilename (filename); + return true; + } + else + { + nlwarning ("Can't open the file %s for reading", _filename.c_str()); + } + } + catch (const Exception &e) + { + nlwarning ("Error while reading %s : %s", _filename.c_str(), e.what()); + } + } + return false; +} + +// *************************************************************************** + +IShaderDrvInfos::~IShaderDrvInfos() +{ + _Driver->removeShaderDrvInfoPtr(_DriverIterator); +} + +void CDriverD3D::removeShaderDrvInfoPtr(ItShaderDrvInfoPtrList shaderIt) +{ + _ShaderDrvInfos.erase(shaderIt); +} + // mem allocator for state records std::allocator CStateRecord::Allocator; @@ -249,7 +338,7 @@ HRESULT CDriverD3D::SetVertexShaderConstantI(UINT StartRegister, CONST INT* pCon // *************************************************************************** -CShaderDrvInfosD3D::CShaderDrvInfosD3D(IDriver *drv, ItShaderDrvInfoPtrList it) : IShaderDrvInfos(drv, it) +CShaderDrvInfosD3D::CShaderDrvInfosD3D(CDriverD3D *drv, ItShaderDrvInfoPtrList it) : IShaderDrvInfos(drv, it) { H_AUTO_D3D(CShaderDrvInfosD3D_CShaderDrvInfosD3D) Validated = false; @@ -265,7 +354,7 @@ CShaderDrvInfosD3D::~CShaderDrvInfosD3D() // *************************************************************************** -bool CDriverD3D::validateShader(CShader *shader) +bool CDriverD3D::validateShader(CD3DShaderFX *shader) { H_AUTO_D3D(CDriverD3D_validateShader) CShaderDrvInfosD3D *shaderInfo = static_cast((IShaderDrvInfos*)shader->_DrvInfo); @@ -327,7 +416,7 @@ bool CDriverD3D::validateShader(CShader *shader) // *************************************************************************** -bool CDriverD3D::activeShader(CShader *shd) +bool CDriverD3D::activeShader(CD3DShaderFX *shd) { H_AUTO_D3D(CDriverD3D_activeShader) if (_DisableHardwarePixelShader) @@ -393,7 +482,7 @@ bool CDriverD3D::activeShader(CShader *shd) } -static void setFX(CShader &s, const char *name, const char *prog, CDriverD3D *drv) +static void setFX(CD3DShaderFX &s, const char *name, const char *prog, CDriverD3D *drv) { H_AUTO_D3D(setFX) diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp index 7922b30ea..87f41678b 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp @@ -1187,6 +1187,11 @@ bool CDriverD3D::setRenderTarget (ITexture *tex, uint32 /* x */, uint32 /* y */, return true; } +ITexture *CDriverD3D::getRenderTarget() const +{ + return _RenderTarget.Texture; +} + // *************************************************************************** bool CDriverD3D::copyTargetToTexture (ITexture * /* tex */, uint32 /* offsetx */, uint32 /* offsety */, uint32 /* x */, uint32 /* y */, uint32 /* width */, diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_uniform.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_uniform.cpp new file mode 100644 index 000000000..e44780e89 --- /dev/null +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_uniform.cpp @@ -0,0 +1,242 @@ +// NeL - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "stddirect3d.h" + +#include "driver_direct3d.h" + +using namespace std; +using namespace NLMISC; + +namespace NL3D +{ + +void CDriverD3D::setUniform4f(TProgram program, uint index, float f0, float f1, float f2, float f3) +{ + H_AUTO_D3D(CDriverD3D_setUniform4f); + + const float tabl[4] = { f0, f1, f2, f3 }; + switch (program) + { + case VertexProgram: + if (_VertexProgram) + { + setVertexProgramConstant(index, tabl); + } + break; + case PixelProgram: + if (_PixelProgram) + { + setPixelShaderConstant(index, tabl); + } + break; + } +} + +void CDriverD3D::setUniform4fv(TProgram program, uint index, size_t num, const float *src) +{ + H_AUTO_D3D(CDriverD3D_setUniform4fv); + + switch (program) + { + case VertexProgram: + if (_VertexProgram) + { + for (uint i = 0; i < num; ++i) + { + setVertexProgramConstant(index + i, src + (i * 4)); + } + } + break; + case PixelProgram: + if (_PixelProgram) + { + for (uint i = 0; i < num; ++i) + { + setPixelShaderConstant(index + i, src + (i * 4)); + } + } + break; + } +} + +void CDriverD3D::setUniform1f(TProgram program, uint index, float f0) +{ + CDriverD3D::setUniform4f(program, index, f0, 0.f, 0.f, 0.f); +} + +void CDriverD3D::setUniform2f(TProgram program, uint index, float f0, float f1) +{ + CDriverD3D::setUniform4f(program, index, f0, f1, 0.f, 0.f); +} + +void CDriverD3D::setUniform3f(TProgram program, uint index, float f0, float f1, float f2) +{ + CDriverD3D::setUniform4f(program, index, f0, f1, f2, 0.0f); +} + +void CDriverD3D::setUniform1i(TProgram program, uint index, sint32 i0) +{ + +} + +void CDriverD3D::setUniform2i(TProgram program, uint index, sint32 i0, sint32 i1) +{ + +} + +void CDriverD3D::setUniform3i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2) +{ + +} + +void CDriverD3D::setUniform4i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2, sint32 i3) +{ + +} + +void CDriverD3D::setUniform1ui(TProgram program, uint index, uint32 ui0) +{ + +} + +void CDriverD3D::setUniform2ui(TProgram program, uint index, uint32 ui0, uint32 ui1) +{ + +} + +void CDriverD3D::setUniform3ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2) +{ + +} + +void CDriverD3D::setUniform4ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3) +{ + +} + +void CDriverD3D::setUniform3f(TProgram program, uint index, const NLMISC::CVector& v) +{ + CDriverD3D::setUniform4f(program, index, v.x, v.y, v.z, 0.f); +} + +void CDriverD3D::setUniform4f(TProgram program, uint index, const NLMISC::CVector& v, float f3) +{ + CDriverD3D::setUniform4f(program, index, v.x, v.y, v.z, f3); +} + +void CDriverD3D::setUniform4f(TProgram program, uint index, const NLMISC::CRGBAF& rgba) +{ + CDriverD3D::setUniform4fv(program, index, 1, &rgba.R); +} + +void CDriverD3D::setUniform4x4f(TProgram program, uint index, const NLMISC::CMatrix& m) +{ + H_AUTO_D3D(CDriverD3D_setUniform4x4f); + + // TODO: Verify this! + NLMISC::CMatrix mat = m; + mat.transpose(); + const float *md = mat.get(); + + CDriverD3D::setUniform4fv(program, index, 4, md); +} + +void CDriverD3D::setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src) +{ + +} + +void CDriverD3D::setUniform4uiv(TProgram program, uint index, size_t num, const uint32 *src) +{ + +} + +void CDriverD3D::setUniformMatrix(NL3D::IDriver::TProgram program, uint index, NL3D::IDriver::TMatrix matrix, NL3D::IDriver::TTransform transform) +{ + H_AUTO_D3D(CDriverD3D_setUniformMatrix); + + D3DXMATRIX mat; + D3DXMATRIX *matPtr = NULL; + switch (matrix) + { + case IDriver::ModelView: + matPtr = &_D3DModelView; + break; + case IDriver::Projection: + matPtr = &(_MatrixCache[remapMatrixIndex(D3DTS_PROJECTION)].Matrix); + break; + case IDriver::ModelViewProjection: + matPtr = &_D3DModelViewProjection; + break; + } + if (transform != IDriver::Identity) + { + switch (transform) + { + case IDriver::Inverse: + D3DXMatrixInverse(&mat, NULL, matPtr); + break; + case IDriver::Transpose: + D3DXMatrixTranspose(&mat, matPtr); + break; + case IDriver::InverseTranspose: + D3DXMatrixInverse(&mat, NULL, matPtr); + D3DXMatrixTranspose(&mat, &mat); + break; + } + matPtr = &mat; + } + + D3DXMatrixTranspose(&mat, matPtr); + + CDriverD3D::setUniform4fv(program, index, 4, &mat.m[0][0]); +} + +void CDriverD3D::setUniformFog(NL3D::IDriver::TProgram program, uint index) +{ + H_AUTO_D3D(CDriverD3D_setUniformFog) + + /* "oFog" must always be between [1, 0] what ever you set in D3DRS_FOGSTART and D3DRS_FOGEND (1 for no fog, 0 for full fog). + The Geforce4 TI 4200 (drivers 53.03 and 45.23) doesn't accept other values for "oFog". */ + const float delta = _FogEnd - _FogStart; + CDriverD3D::setUniform4f(program, index, + -_D3DModelView._13 / delta, + -_D3DModelView._23 / delta, + -_D3DModelView._33 / delta, + 1 - (_D3DModelView._43 - _FogStart) / delta); +} + +bool CDriverD3D::setUniformDriver(TProgram program) +{ + // todo + + return true; +} + +bool CDriverD3D::setUniformMaterial(TProgram program, CMaterial &material) +{ + // todo + + return true; +} + +void CDriverD3D::setUniformParams(TProgram program, CGPUProgramParams ¶ms) +{ + // todo +} + +} // NL3D diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex_program.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex_program.cpp index ce6bda220..d4af02592 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex_program.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex_program.cpp @@ -26,7 +26,7 @@ namespace NL3D // *************************************************************************** -CVertexProgamDrvInfosD3D::CVertexProgamDrvInfosD3D(IDriver *drv, ItVtxPrgDrvInfoPtrList it) : IVertexProgramDrvInfos (drv, it) +CVertexProgamDrvInfosD3D::CVertexProgamDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos (drv, it) { H_AUTO_D3D(CVertexProgamDrvInfosD3D_CVertexProgamDrvInfosD3D) Shader = NULL; @@ -43,10 +43,10 @@ CVertexProgamDrvInfosD3D::~CVertexProgamDrvInfosD3D() // *************************************************************************** -bool CDriverD3D::isVertexProgramSupported () const +bool CDriverD3D::supportVertexProgram (CVertexProgram::TProfile profile) const { - H_AUTO_D3D(CDriverD3D_isVertexProgramSupported ) - return _VertexProgram; + H_AUTO_D3D(CDriverD3D_supportVertexProgram ) + return (profile == CVertexProgram::nelvp) && _VertexProgram; } // *************************************************************************** @@ -262,101 +262,130 @@ void dump(const CVPParser::TProgram &prg, std::string &dest) // *************************************************************************** +bool CDriverD3D::compileVertexProgram(NL3D::CVertexProgram *program) +{ + // Program setuped ? + if (program->m_DrvInfo == NULL) + { + // Find nelvp + IProgram::CSource *source = NULL; + for (uint i = 0; i < program->getSourceNb(); ++i) + { + if (program->getSource(i)->Profile == CVertexProgram::nelvp) + { + source = program->getSource(i); + } + } + if (!source) + { + nlwarning("Direct3D driver only supports 'nelvp' profile, vertex program cannot be used"); + return false; + } + + _GPUPrgDrvInfos.push_front (NULL); + ItGPUPrgDrvInfoPtrList itTex = _GPUPrgDrvInfos.begin(); + CVertexProgamDrvInfosD3D *drvInfo; + *itTex = drvInfo = new CVertexProgamDrvInfosD3D(this, itTex); + + // Create a driver info structure + program->m_DrvInfo = *itTex; + + /** Check with our parser if the program will works with other implemented extensions, too. (EXT_vertex_shader ..). + * There are some incompatibilities. + */ + CVPParser parser; + CVPParser::TProgram parsedProgram; + std::string errorOutput; + bool result = parser.parse(source->SourcePtr, parsedProgram, errorOutput); + if (!result) + { + nlwarning("Unable to parse a vertex program :"); + nlwarning(errorOutput.c_str()); + #ifdef NL_DEBUG_D3D + nlassert(0); + #endif // NL_DEBUG_D3D + return false; + } + + // tmp fix for Radeon 8500/9000/9200 + // Currently they hang when PaletteSkin / SkinWeight are present in the vertex declaration, but not used + // so disable them in the vertex declaration + // We don't use these component in vertex programs currently.. + #ifdef NL_DEBUG + for(uint k = 0; k < parsedProgram.size(); ++k) + { + for(uint l = 0; l < parsedProgram[k].getNumUsedSrc(); ++l) + { + const CVPOperand &op = parsedProgram[k].getSrc(l); + if (op.Type == CVPOperand::InputRegister) + { + nlassert(op.Value.InputRegisterValue != CVPOperand::IWeight); + nlassert(op.Value.InputRegisterValue != CVPOperand::IPaletteSkin); + } + } + } + #endif + + // Dump the vertex program + std::string dest; + dump(parsedProgram, dest); +#ifdef NL_DEBUG_D3D + nlinfo("Assemble Vertex Shader : "); + string::size_type lineBegin = 0; + string::size_type lineEnd; + while ((lineEnd = dest.find('\n', lineBegin)) != string::npos) + { + nlinfo(dest.substr (lineBegin, lineEnd-lineBegin).c_str()); + lineBegin = lineEnd+1; + } + nlinfo(dest.substr (lineBegin, lineEnd-lineBegin).c_str()); +#endif // NL_DEBUG_D3D + + LPD3DXBUFFER pShader; + LPD3DXBUFFER pErrorMsgs; + if (D3DXAssembleShader (dest.c_str(), (UINT)dest.size(), NULL, NULL, 0, &pShader, &pErrorMsgs) == D3D_OK) + { + if (_DeviceInterface->CreateVertexShader((DWORD*)pShader->GetBufferPointer(), &(getVertexProgramD3D(*program)->Shader)) != D3D_OK) + return false; + } + else + { + nlwarning ("Can't assemble vertex program:"); + nlwarning ((const char*)pErrorMsgs->GetBufferPointer()); + return false; + } + + // Set parameters for assembly programs + drvInfo->ParamIndices = source->ParamIndices; + + // Build the feature info + program->buildInfo(source); + } + + return true; +} + +// *************************************************************************** + bool CDriverD3D::activeVertexProgram (CVertexProgram *program) { H_AUTO_D3D(CDriverD3D_activeVertexProgram ) if (_DisableHardwareVertexProgram) return false; - // Setup or unsetup ? - if (program) - { - // Program setuped ? - if (program->_DrvInfo==NULL) - { - _VtxPrgDrvInfos.push_front (NULL); - ItVtxPrgDrvInfoPtrList itTex = _VtxPrgDrvInfos.begin(); - *itTex = new CVertexProgamDrvInfosD3D(this, itTex); - - // Create a driver info structure - program->_DrvInfo = *itTex; - - /** Check with our parser if the program will works with other implemented extensions, too. (EXT_vertex_shader ..). - * There are some incompatibilities. - */ - CVPParser parser; - CVPParser::TProgram parsedProgram; - std::string errorOutput; - bool result = parser.parse(program->getProgram().c_str(), parsedProgram, errorOutput); - if (!result) - { - nlwarning("Unable to parse a vertex program :"); - nlwarning(errorOutput.c_str()); - #ifdef NL_DEBUG_D3D - nlassert(0); - #endif // NL_DEBUG_D3D - return false; - } - - // tmp fix for Radeon 8500/9000/9200 - // Currently they hang when PaletteSkin / SkinWeight are present in the vertex declaration, but not used - // so disable them in the vertex declaration - // We don't use these component in vertex programs currently.. - #ifdef NL_DEBUG - for(uint k = 0; k < parsedProgram.size(); ++k) - { - for(uint l = 0; l < parsedProgram[k].getNumUsedSrc(); ++l) - { - const CVPOperand &op = parsedProgram[k].getSrc(l); - if (op.Type == CVPOperand::InputRegister) - { - nlassert(op.Value.InputRegisterValue != CVPOperand::IWeight); - nlassert(op.Value.InputRegisterValue != CVPOperand::IPaletteSkin); - } - } - } - #endif - - // Dump the vertex program - std::string dest; - dump(parsedProgram, dest); -#ifdef NL_DEBUG_D3D - nlinfo("Assemble Vertex Shader : "); - string::size_type lineBegin = 0; - string::size_type lineEnd; - while ((lineEnd = dest.find('\n', lineBegin)) != string::npos) - { - nlinfo(dest.substr (lineBegin, lineEnd-lineBegin).c_str()); - lineBegin = lineEnd+1; - } - nlinfo(dest.substr (lineBegin, lineEnd-lineBegin).c_str()); -#endif // NL_DEBUG_D3D - - LPD3DXBUFFER pShader; - LPD3DXBUFFER pErrorMsgs; - if (D3DXAssembleShader (dest.c_str(), (UINT)dest.size(), NULL, NULL, 0, &pShader, &pErrorMsgs) == D3D_OK) - { - if (_DeviceInterface->CreateVertexShader((DWORD*)pShader->GetBufferPointer(), &(getVertexProgramD3D(*program)->Shader)) != D3D_OK) - return false; - } - else - { - nlwarning ("Can't assemble vertex program:"); - nlwarning ((const char*)pErrorMsgs->GetBufferPointer()); - return false; - } - } - } - // Set the vertex program if (program) { - CVertexProgamDrvInfosD3D *info = static_cast((IVertexProgramDrvInfos*)program->_DrvInfo); + if (!CDriverD3D::compileVertexProgram(program)) return false; + + CVertexProgamDrvInfosD3D *info = NLMISC::safe_cast((IProgramDrvInfos*)program->m_DrvInfo); + _VertexProgramUser = program; setVertexProgram (info->Shader, program); /* D3DRS_FOGSTART and D3DRS_FOGEND must be set with [1, 0] else the fog doesn't work properly on VertexShader and non-VertexShader objects (random fog flicking) with Geforce4 TI 4200 (drivers 53.03 and 45.23). The other cards seam to interpret the "oFog"'s values using D3DRS_FOGSTART, D3DRS_FOGEND. + Related to setUniformFog(). */ float z = 0; float o = 1; @@ -366,6 +395,7 @@ bool CDriverD3D::activeVertexProgram (CVertexProgram *program) else { setVertexProgram (NULL, NULL); + _VertexProgramUser = NULL; // Set the old fog range setRenderState (D3DRS_FOGSTART, *((DWORD*) (&_FogStart))); @@ -377,171 +407,6 @@ bool CDriverD3D::activeVertexProgram (CVertexProgram *program) // *************************************************************************** -void CDriverD3D::setConstant (uint index, float f0, float f1, float f2, float f3) -{ - H_AUTO_D3D(CDriverD3D_setConstant ) - if (!_VertexProgram) - { - #ifdef NL_DEBUG - nlwarning("No vertex programs available!!"); - #endif - return; - } - const float tabl[4] = {f0, f1, f2, f3}; - setVertexProgramConstant (index, tabl); -} - -// *************************************************************************** - -void CDriverD3D::setConstant (uint index, double d0, double d1, double d2, double d3) -{ - H_AUTO_D3D(CDriverD3D_setConstant ) - if (!_VertexProgram) - { - #ifdef NL_DEBUG - nlwarning("No vertex programs available!!"); - #endif - return; - } - const float tabl[4] = {(float)d0, (float)d1, (float)d2, (float)d3}; - setVertexProgramConstant (index, tabl); -} - -// *************************************************************************** - -void CDriverD3D::setConstant (uint index, const NLMISC::CVector& value) -{ - H_AUTO_D3D(CDriverD3D_setConstant ) - if (!_VertexProgram) - { - #ifdef NL_DEBUG - nlwarning("No vertex programs available!!"); - #endif - return; - } - const float tabl[4] = {value.x, value.y, value.z, 0}; - setVertexProgramConstant (index, tabl); -} - -// *************************************************************************** - -void CDriverD3D::setConstant (uint index, const NLMISC::CVectorD& value) -{ - H_AUTO_D3D(CDriverD3D_setConstant ) - if (!_VertexProgram) - { - #ifdef NL_DEBUG - nlwarning("No vertex programs available!!"); - #endif - return; - } - const float tabl[4] = {(float)value.x, (float)value.y, (float)value.z, 0}; - setVertexProgramConstant (index, tabl); -} - -// *************************************************************************** - -void CDriverD3D::setConstant (uint index, uint num, const float *src) -{ - H_AUTO_D3D(CDriverD3D_setConstant ) - if (!_VertexProgram) - { - #ifdef NL_DEBUG - nlwarning("No vertex programs available!!"); - #endif - return; - } - uint i; - for (i=0; i_11, matPtr->_21, matPtr->_31, matPtr->_41); - setConstant (index+1, matPtr->_12, matPtr->_22, matPtr->_32, matPtr->_42); - setConstant (index+2, matPtr->_13, matPtr->_23, matPtr->_33, matPtr->_43); - setConstant (index+3, matPtr->_14, matPtr->_24, matPtr->_34, matPtr->_44); -} - -// *************************************************************************** - -void CDriverD3D::setConstantFog (uint index) -{ - H_AUTO_D3D(CDriverD3D_setConstantFog ) - /* "oFog" must always be between [1, 0] what ever you set in D3DRS_FOGSTART and D3DRS_FOGEND (1 for no fog, 0 for full fog). - The Geforce4 TI 4200 (drivers 53.03 and 45.23) doesn't accept other values for "oFog". */ - const float delta = _FogEnd-_FogStart; - setConstant (index, - _D3DModelView._13/delta, -_D3DModelView._23/delta, -_D3DModelView._33/delta, 1-(_D3DModelView._43-_FogStart)/delta); -} - -// *************************************************************************** - void CDriverD3D::enableVertexProgramDoubleSidedColor(bool /* doubleSided */) { H_AUTO_D3D(CDriverD3D_enableVertexProgramDoubleSidedColor) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index 08b883e12..02617990d 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -263,8 +263,6 @@ CDriverGL::CDriverGL() _CurrentFogColor[2]= 0; _CurrentFogColor[3]= 0; - _RenderTargetFBO = false; - _LightSetupDirty= false; _ModelViewMatrixDirty= false; _RenderSetupDirty= false; @@ -482,6 +480,7 @@ bool CDriverGL::setupDisplay() } _VertexProgramEnabled= false; + _PixelProgramEnabled= false; _LastSetupGLArrayVertexProgram= false; // Init VertexArrayRange according to supported extenstion. @@ -690,7 +689,7 @@ bool CDriverGL::stretchRect(ITexture * /* srcText */, NLMISC::CRect &/* srcRect // *************************************************************************** bool CDriverGL::supportBloomEffect() const { - return (isVertexProgramSupported() && supportFrameBufferObject() && supportPackedDepthStencil() && supportTextureRectangle()); + return (supportVertexProgram(CVertexProgram::nelvp) && supportFrameBufferObject() && supportPackedDepthStencil() && supportTextureRectangle()); } // *************************************************************************** @@ -702,7 +701,7 @@ bool CDriverGL::supportNonPowerOfTwoTextures() const // *************************************************************************** bool CDriverGL::isTextureRectangle(ITexture * tex) const { - return (supportTextureRectangle() && tex->isBloomTexture() && tex->mipMapOff() + return (!supportNonPowerOfTwoTextures() && supportTextureRectangle() && tex->isBloomTexture() && tex->mipMapOff() && (!isPowerOf2(tex->getWidth()) || !isPowerOf2(tex->getHeight()))); } @@ -737,6 +736,12 @@ void CDriverGL::disableHardwareVertexProgram() _Extensions.DisableHardwareVertexProgram= true; } +void CDriverGL::disableHardwarePixelProgram() +{ + H_AUTO_OGL(CDriverGL_disableHardwarePixelProgram) + _Extensions.DisableHardwarePixelProgram= true; +} + // *************************************************************************** void CDriverGL::disableHardwareVertexArrayAGP() { @@ -854,6 +859,7 @@ bool CDriverGL::swapBuffers() // Reset texture shaders //resetTextureShaders(); activeVertexProgram(NULL); + activePixelProgram(NULL); #ifndef USE_OPENGLES /* Yoyo: must do this (GeForce bug ??) else weird results if end render with a VBHard. @@ -1400,6 +1406,7 @@ void CDriverGL::setupFog(float start, float end, CRGBA color) glFogfv(GL_FOG_COLOR, _CurrentFogColor); +#ifndef USE_OPENGLES /** Special : with vertex program, using the extension EXT_vertex_shader, fog is emulated using 1 more constant to scale result to [0, 1] */ if (_Extensions.EXTVertexShader && !_Extensions.NVVertexProgram && !_Extensions.ARBVertexProgram) @@ -1409,14 +1416,18 @@ void CDriverGL::setupFog(float start, float end, CRGBA color) // last constant is used to store fog information (fog must be rescaled to [0, 1], because of a driver bug) if (start != end) { - setConstant(_EVSNumConstant, 1.f / (start - end), - end / (start - end), 0, 0); + float datas[] = { 1.f / (start - end), - end / (start - end), 0, 0 }; + nglSetInvariantEXT(_EVSConstantHandle + _EVSNumConstant, GL_FLOAT, datas); } else { - setConstant(_EVSNumConstant, 0.f, 0, 0, 0); + float datas[] = { 0.f, 0, 0, 0 }; + nglSetInvariantEXT(_EVSConstantHandle + _EVSNumConstant, GL_FLOAT, datas); } } } +#endif + _FogStart = start; _FogEnd = end; } @@ -1535,9 +1546,9 @@ bool CDriverGL::supportTextureShaders() const } // *************************************************************************** -bool CDriverGL::isWaterShaderSupported() const +bool CDriverGL::supportWaterShader() const { - H_AUTO_OGL(CDriverGL_isWaterShaderSupported); + H_AUTO_OGL(CDriverGL_supportWaterShader); if(_Extensions.ARBFragmentProgram && ARBWaterShader[0] != 0) return true; @@ -1547,9 +1558,9 @@ bool CDriverGL::isWaterShaderSupported() const } // *************************************************************************** -bool CDriverGL::isTextureAddrModeSupported(CMaterial::TTexAddressingMode /* mode */) const +bool CDriverGL::supportTextureAddrMode(CMaterial::TTexAddressingMode /* mode */) const { - H_AUTO_OGL(CDriverGL_isTextureAddrModeSupported) + H_AUTO_OGL(CDriverGL_supportTextureAddrMode) if (_Extensions.NVTextureShader) { @@ -1987,12 +1998,6 @@ static void fetchPerturbedEnvMapR200() #endif } -// *************************************************************************** -void CDriverGL::forceNativeFragmentPrograms(bool nativeOnly) -{ - _ForceNativeFragmentPrograms = nativeOnly; -} - // *************************************************************************** void CDriverGL::initFragmentShaders() { @@ -2567,14 +2572,6 @@ CVertexBuffer::TVertexColorType CDriverGL::getVertexColorFormat() const return CVertexBuffer::TRGBA; } -// *************************************************************************** -bool CDriverGL::activeShader(CShader * /* shd */) -{ - H_AUTO_OGL(CDriverGL_activeShader) - - return false; -} - // *************************************************************************** void CDriverGL::startBench (bool wantStandardDeviation, bool quick, bool reset) { diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index ee6431dc4..57f73b0b6 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -49,7 +49,6 @@ #include "nel/3d/driver.h" #include "nel/3d/material.h" -#include "nel/3d/shader.h" #include "nel/3d/vertex_buffer.h" #include "nel/3d/ptr_set.h" #include "nel/3d/texture_cube.h" @@ -308,6 +307,7 @@ public: virtual bool init (uint windowIcon = 0, emptyProc exitFunc = 0); virtual void disableHardwareVertexProgram(); + virtual void disableHardwarePixelProgram(); virtual void disableHardwareVertexArrayAGP(); virtual void disableHardwareTextureShader(); @@ -370,8 +370,6 @@ public: virtual void forceTextureResize(uint divisor); - virtual void forceNativeFragmentPrograms(bool nativeOnly); - /// Setup texture env functions. Used by setupMaterial void setTextureEnvFunction(uint stage, CMaterial& mat); @@ -405,8 +403,6 @@ public: virtual CMatrix getViewMatrix() const; - virtual bool activeShader(CShader *shd); - virtual void forceNormalize(bool normalize) { _ForceNormalize= normalize; @@ -565,6 +561,8 @@ public: virtual bool setRenderTarget (ITexture *tex, uint32 x, uint32 y, uint32 width, uint32 height, uint32 mipmapLevel, uint32 cubeFace); + virtual ITexture *getRenderTarget() const; + virtual bool copyTargetToTexture (ITexture *tex, uint32 offsetx, uint32 offsety, uint32 x, uint32 y, uint32 width, uint32 height, uint32 mipmapLevel); @@ -602,9 +600,9 @@ public: // @{ virtual bool supportTextureShaders() const; - virtual bool isWaterShaderSupported() const; + virtual bool supportWaterShader() const; - virtual bool isTextureAddrModeSupported(CMaterial::TTexAddressingMode mode) const; + virtual bool supportTextureAddrMode(CMaterial::TTexAddressingMode mode) const; virtual void setMatrix2DForTextureOffsetAddrMode(const uint stage, const float mat[4]); // @} @@ -694,6 +692,7 @@ private: virtual class IVertexBufferHardGL *createVertexBufferHard(uint size, uint numVertices, CVertexBuffer::TPreferredMemory vbType, CVertexBuffer *vb); friend class CTextureDrvInfosGL; friend class CVertexProgamDrvInfosGL; + friend class CPixelProgamDrvInfosGL; private: // Version of the driver. Not the interface version!! Increment when implementation of the driver change. @@ -889,7 +888,7 @@ private: // viewport before call to setRenderTarget, if BFO extension is supported CViewport _OldViewport; - bool _RenderTargetFBO; + CSmartPtr _RenderTargetFBO; // Num lights return by GL_MAX_LIGHTS @@ -1300,36 +1299,156 @@ private: // @} - /// \name Vertex program interface + + + + + /// \name Vertex Program // @{ - bool isVertexProgramSupported () const; - bool isVertexProgramEmulated () const; - bool activeVertexProgram (CVertexProgram *program); - void setConstant (uint index, float, float, float, float); - void setConstant (uint index, double, double, double, double); - void setConstant (uint indexStart, const NLMISC::CVector& value); - void setConstant (uint indexStart, const NLMISC::CVectorD& value); - void setConstant (uint index, uint num, const float *src); - void setConstant (uint index, uint num, const double *src); - void setConstantMatrix (uint index, IDriver::TMatrix matrix, IDriver::TTransform transform); - void setConstantFog (uint index); - void enableVertexProgramDoubleSidedColor(bool doubleSided); - bool supportVertexProgramDoubleSidedColor() const; + // Order of preference + // - activeVertexProgram + // - CMaterial pass[n] VP (uses activeVertexProgram, but does not override if one already set by code) + // - default generic VP that mimics fixed pipeline / no VP with fixed pipeline + + /** + * Does the driver supports vertex program, but emulated by CPU ? + */ + virtual bool isVertexProgramEmulated() const; + + /** Return true if the driver supports the specified vertex program profile. + */ + virtual bool supportVertexProgram(CVertexProgram::TProfile profile) const; + + /** Compile the given vertex program, return if successful. + * If a vertex program was set active before compilation, + * the state of the active vertex program is undefined behaviour afterwards. + */ + virtual bool compileVertexProgram(CVertexProgram *program); + + /** Set the active vertex program. This will override vertex programs specified in CMaterial render calls. + * Also used internally by setupMaterial(CMaterial) when getVertexProgram returns NULL. + * The vertex program is activated immediately. + */ + virtual bool activeVertexProgram(CVertexProgram *program); + // @} + + + + /// \name Pixel Program + // @{ + + // Order of preference + // - activePixelProgram + // - CMaterial pass[n] PP (uses activePixelProgram, but does not override if one already set by code) + // - PP generated from CMaterial (uses activePixelProgram, but does not override if one already set by code) + + /** Return true if the driver supports the specified pixel program profile. + */ + virtual bool supportPixelProgram(CPixelProgram::TProfile profile = CPixelProgram::arbfp1) const; + + /** Compile the given pixel program, return if successful. + * If a pixel program was set active before compilation, + * the state of the active pixel program is undefined behaviour afterwards. + */ + virtual bool compilePixelProgram(CPixelProgram *program); + + /** Set the active pixel program. This will override pixel programs specified in CMaterial render calls. + * Also used internally by setupMaterial(CMaterial) when getPixelProgram returns NULL. + * The pixel program is activated immediately. + */ + virtual bool activePixelProgram(CPixelProgram *program); + // @} + + + + /// \name Geometry Program + // @{ + + // Order of preference + // - activeGeometryProgram + // - CMaterial pass[n] PP (uses activeGeometryProgram, but does not override if one already set by code) + // - none + + /** Return true if the driver supports the specified pixel program profile. + */ + virtual bool supportGeometryProgram(CGeometryProgram::TProfile profile) const { return false; } + + /** Compile the given pixel program, return if successful. + * If a pixel program was set active before compilation, + * the state of the active pixel program is undefined behaviour afterwards. + */ + virtual bool compileGeometryProgram(CGeometryProgram *program) { return false; } + + /** Set the active pixel program. This will override pixel programs specified in CMaterial render calls. + * Also used internally by setupMaterial(CMaterial) when getGeometryProgram returns NULL. + * The pixel program is activated immediately. + */ + virtual bool activeGeometryProgram(CGeometryProgram *program) { return false; } + // @} + + + + /// \name Program parameters + // @{ + // Set parameters + inline void setUniform4fInl(TProgram program, uint index, float f0, float f1, float f2, float f3); + inline void setUniform4fvInl(TProgram program, uint index, size_t num, const float *src); + virtual void setUniform1f(TProgram program, uint index, float f0); + virtual void setUniform2f(TProgram program, uint index, float f0, float f1); + virtual void setUniform3f(TProgram program, uint index, float f0, float f1, float f2); + virtual void setUniform4f(TProgram program, uint index, float f0, float f1, float f2, float f3); + virtual void setUniform1i(TProgram program, uint index, sint32 i0); + virtual void setUniform2i(TProgram program, uint index, sint32 i0, sint32 i1); + virtual void setUniform3i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2); + virtual void setUniform4i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2, sint32 i3); + virtual void setUniform1ui(TProgram program, uint index, uint32 ui0); + virtual void setUniform2ui(TProgram program, uint index, uint32 ui0, uint32 ui1); + virtual void setUniform3ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2); + virtual void setUniform4ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3); + virtual void setUniform3f(TProgram program, uint index, const NLMISC::CVector& v); + virtual void setUniform4f(TProgram program, uint index, const NLMISC::CVector& v, float f3); + virtual void setUniform4f(TProgram program, uint index, const NLMISC::CRGBAF& rgba); + virtual void setUniform4x4f(TProgram program, uint index, const NLMISC::CMatrix& m); + virtual void setUniform4fv(TProgram program, uint index, size_t num, const float *src); + virtual void setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src); + virtual void setUniform4uiv(TProgram program, uint index, size_t num, const uint32 *src); + // Set builtin parameters + virtual void setUniformMatrix(TProgram program, uint index, TMatrix matrix, TTransform transform); + virtual void setUniformFog(TProgram program, uint index); + // Set feature parameters + virtual bool isUniformProgramState() { return false; } + // @} + + + + + + virtual void enableVertexProgramDoubleSidedColor(bool doubleSided); + virtual bool supportVertexProgramDoubleSidedColor() const; virtual bool supportMADOperator() const ; - // @} /// \name Vertex program implementation // @{ bool activeNVVertexProgram (CVertexProgram *program); bool activeARBVertexProgram (CVertexProgram *program); bool activeEXTVertexShader (CVertexProgram *program); + + bool compileNVVertexProgram (CVertexProgram *program); + bool compileARBVertexProgram (CVertexProgram *program); + bool compileEXTVertexShader (CVertexProgram *program); //@} + /// \name Pixel program implementation + // @{ + bool activeARBPixelProgram (CPixelProgram *program); + bool setupPixelProgram (CPixelProgram *program, GLuint id/*, bool &specularWritten*/); + //@} + /// \fallback for material shaders // @{ @@ -1342,15 +1461,27 @@ private: // Don't use glIsEnabled, too slow. return _VertexProgramEnabled; } + + bool isPixelProgramEnabled () const + { + // Don't use glIsEnabled, too slow. + return _PixelProgramEnabled; + } // Track state of activeVertexProgram() bool _VertexProgramEnabled; + // Track state of activePixelProgram() + bool _PixelProgramEnabled; + // Say if last setupGlArrays() was a VertexProgram setup. bool _LastSetupGLArrayVertexProgram; // The last vertex program that was setupped NLMISC::CRefPtr _LastSetuppedVP; + // The last pixel program that was setupped + NLMISC::CRefPtr _LastSetuppedPP; + bool _ForceDXTCCompression; /// Divisor for textureResize (power). uint _ForceTextureResizePower; @@ -1496,7 +1627,7 @@ private: }; // *************************************************************************** -class CVertexProgamDrvInfosGL : public IVertexProgramDrvInfos +class CVertexProgamDrvInfosGL : public IProgramDrvInfos { public: // The GL Id. @@ -1517,7 +1648,36 @@ public: // The gl id is auto created here. - CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInfoPtrList it); + CVertexProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it); + + virtual uint getUniformIndex(const char *name) const + { + std::map::const_iterator it = ParamIndices.find(name); + if (it != ParamIndices.end()) return it->second; + return ~0; + }; + + std::map ParamIndices; +}; + +// *************************************************************************** +class CPixelProgamDrvInfosGL : public IProgramDrvInfos +{ +public: + // The GL Id. + GLuint ID; + + // The gl id is auto created here. + CPixelProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it); + + virtual uint getUniformIndex(const char *name) const + { + std::map::const_iterator it = ParamIndices.find(name); + if (it != ParamIndices.end()) return it->second; + return ~0; + }; + + std::map ParamIndices; }; #ifdef NL_STATIC diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index d38ff8f51..3b771e1c1 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -1225,6 +1225,15 @@ static bool setupARBFragmentProgram(const char *glext) return true; } +// ********************************* +static bool setupNVFragmentProgram2(const char *glext) +{ + H_AUTO_OGL(setupNVFragmentProgram2); + CHECK_EXT("GL_NV_fragment_program2"); + + return true; +} + // *************************************************************************** static bool setupARBVertexBufferObject(const char *glext) { @@ -1560,6 +1569,19 @@ void registerGlExtensions(CGlExtensions &ext) ext.EXTVertexShader = false; ext.ARBVertexProgram = false; } + + // Check pixel program + // Disable feature ??? + if (!ext.DisableHardwarePixelProgram) + { + ext.ARBFragmentProgram = setupARBFragmentProgram(glext); + ext.NVFragmentProgram2 = setupNVFragmentProgram2(glext); + } + else + { + ext.ARBFragmentProgram = false; + ext.NVFragmentProgram2 = false; + } ext.OESDrawTexture = setupOESDrawTexture(glext); ext.OESMapBuffer = setupOESMapBuffer(glext); @@ -1571,14 +1593,12 @@ void registerGlExtensions(CGlExtensions &ext) ext.NVTextureShader = setupNVTextureShader(glext); ext.ATIEnvMapBumpMap = setupATIEnvMapBumpMap(glext); ext.ATIFragmentShader = setupATIFragmentShader(glext); - ext.ARBFragmentProgram = setupARBFragmentProgram(glext); } else { ext.ATIEnvMapBumpMap = false; ext.NVTextureShader = false; ext.ATIFragmentShader = false; - ext.ARBFragmentProgram = false; } // For now, the only way to know if emulation, is to test some extension which exist only on GeForce3. diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.h b/code/nel/src/3d/driver/opengl/driver_opengl_extension.h index 9d28a15ab..fe7738fd8 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.h @@ -103,6 +103,9 @@ struct CGlExtensions bool ARBTextureNonPowerOfTwo; bool ARBMultisample; + // NV Pixel Programs + bool NVFragmentProgram2; + bool OESDrawTexture; bool OESMapBuffer; @@ -111,6 +114,7 @@ public: /// \name Disable Hardware feature. False by default. setuped by IDriver // @{ bool DisableHardwareVertexProgram; + bool DisableHardwarePixelProgram; bool DisableHardwareVertexArrayAGP; bool DisableHardwareTextureShader; // @} @@ -174,6 +178,7 @@ public: /// \name Disable Hardware feature. False by default. setuped by IDriver DisableHardwareVertexProgram= false; + DisableHardwarePixelProgram= false; DisableHardwareVertexArrayAGP= false; DisableHardwareTextureShader= false; } @@ -206,6 +211,7 @@ public: result += NVTextureShader ? "NVTextureShader " : ""; result += ATIFragmentShader ? "ATIFragmentShader " : ""; result += ARBFragmentProgram ? "ARBFragmentProgram " : ""; + result += NVFragmentProgram2 ? "NVFragmentProgram2 " : ""; result += ARBVertexProgram ? "ARBVertexProgram " : ""; result += NVVertexProgram ? "NVVertexProgram " : ""; result += EXTVertexShader ? "EXTVertexShader " : ""; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp index 6d9dbb247..ed43fe8c3 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp @@ -283,14 +283,15 @@ void CDriverGL::setTextureShaders(const uint8 *addressingModes, const CSmartPtr< bool CDriverGL::setupMaterial(CMaterial& mat) { H_AUTO_OGL(CDriverGL_setupMaterial) - CShaderGL* pShader; - GLenum glenum = GL_ZERO; - uint32 touched = mat.getTouched(); - uint stage; // profile. _NbSetupMaterialCall++; + CMaterial::TShader matShader; + + CShaderGL* pShader; + GLenum glenum = GL_ZERO; + uint32 touched = mat.getTouched(); // 0. Retrieve/Create driver shader. //================================== @@ -359,9 +360,29 @@ bool CDriverGL::setupMaterial(CMaterial& mat) mat.clearTouched(0xFFFFFFFF); } - // Now we can get the supported shader from the cache. - CMaterial::TShader matShader = pShader->SupportedShader; + // 2b. User supplied pixel shader overrides material + //================================== + /*if (_VertexProgramEnabled) + { + if (!setUniformDriver(VertexProgram)) return false; + if (!setUniformMaterialInternal(VertexProgram, mat)) return false; + }*/ + if (_PixelProgramEnabled) + { + matShader = CMaterial::Program; + // if (!setUniformDriver(PixelProgram)) return false; + // if (!setUniformMaterialInternal(PixelProgram, mat)) return false; + if (!_LastSetuppedPP) return false; + } + else + { + // Now we can get the supported shader from the cache. + matShader = pShader->SupportedShader; + } + + // 2b. Update more shader state + //================================== // if the shader has changed since last time if(matShader != _CurrentMaterialSupportedShader) { @@ -382,9 +403,11 @@ bool CDriverGL::setupMaterial(CMaterial& mat) // Must setup textures each frame. (need to test if touched). // Must separate texture setup and texture activation in 2 "for"... // because setupTexture() may disable all stage. - if (matShader != CMaterial::Water) + if (matShader != CMaterial::Water + && ((matShader != CMaterial::Program) || (_LastSetuppedPP->features().MaterialFlags & CProgramFeatures::TextureStages)) + ) { - for(stage=0 ; stagefeatures().MaterialFlags & CProgramFeatures::TextureStages)) ) { - for(stage=0 ; stagefeatures().MaterialFlags & CProgramFeatures::TextureMatrices)) + ) { setupUserTextureMatrix(inlGetNumTextStages(), mat); } - else // deactivate texture matrix + else { disableUserTextureMatrix(); } @@ -1476,7 +1502,7 @@ CTextureCube *CDriverGL::getSpecularCubeMap(uint exp) { 1.f, 4.f, 8.f, 24.f, 48.f, 128.f, 256.f, 511.f }; - const uint numCubeMap = sizeof(expToCubeMap) / sizeof(float); + const uint numCubeMap = sizeof(cubeMapExp) / sizeof(float); static bool tableBuilt = false; if (!tableBuilt) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp new file mode 100644 index 000000000..899511a1b --- /dev/null +++ b/code/nel/src/3d/driver/opengl/driver_opengl_pixel_program.cpp @@ -0,0 +1,251 @@ +/** \file driver_opengl_pixel_program.cpp + * OpenGL driver implementation for pixel program manipulation. + * + * $Id: driver_opengl_pixel_program.cpp,v 1.1.2.4 2007/07/09 15:29:00 legallo Exp $ + * + * \todo manage better the init/release system (if a throw occurs in the init, we must release correctly the driver) + */ + +/* Copyright, 2000 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "stdopengl.h" + +#include "driver_opengl.h" +#include "nel/3d/index_buffer.h" +#include "nel/3d/pixel_program.h" +#include + +// tmp +#include "nel/misc/file.h" + +using namespace std; +using namespace NLMISC; + +namespace NL3D +{ + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif + +// *************************************************************************** + +CPixelProgamDrvInfosGL::CPixelProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos (drv, it) +{ + H_AUTO_OGL(CPixelProgamDrvInfosGL_CPixelProgamDrvInfosGL) + +#ifndef USE_OPENGLES + // Extension must exist + nlassert(drv->_Extensions.ARBFragmentProgram); + + if (drv->_Extensions.ARBFragmentProgram) // ARB implementation + { + nglGenProgramsARB(1, &ID); + } +#endif +} + +// *************************************************************************** + +bool CDriverGL::supportPixelProgram(CPixelProgram::TProfile profile) const +{ + H_AUTO_OGL(CPixelProgamDrvInfosGL_supportPixelProgram_profile) + switch (profile) + { + case CPixelProgram::arbfp1: + return _Extensions.ARBFragmentProgram; + case CPixelProgram::fp40: + return _Extensions.NVFragmentProgram2; + } + return false; +} + +// *************************************************************************** + +bool CDriverGL::activePixelProgram(CPixelProgram *program) +{ + H_AUTO_OGL(CDriverGL_activePixelProgram) + + if (_Extensions.ARBFragmentProgram) + { + return activeARBPixelProgram(program); + } + + return false; +} + +// *************************************************************************** + +bool CDriverGL::compilePixelProgram(NL3D::CPixelProgram *program) +{ +#ifndef USE_OPENGLES + // Program setuped ? + if (program->m_DrvInfo == NULL) + { + glDisable(GL_FRAGMENT_PROGRAM_ARB); + _PixelProgramEnabled = false; + + // Insert into driver list. (so it is deleted when driver is deleted). + ItGPUPrgDrvInfoPtrList it = _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IProgramDrvInfos*)NULL); + + // Create a driver info + CPixelProgamDrvInfosGL *drvInfo; + *it = drvInfo = new CPixelProgamDrvInfosGL(this, it); + // Set the pointer + program->m_DrvInfo = drvInfo; + + if (!setupPixelProgram(program, drvInfo->ID)) + { + delete drvInfo; + program->m_DrvInfo = NULL; + _GPUPrgDrvInfos.erase(it); + return false; + } + } + + return true; +#else + return false; +#endif +} + +// *************************************************************************** + +bool CDriverGL::activeARBPixelProgram(CPixelProgram *program) +{ + H_AUTO_OGL(CDriverGL_activeARBPixelProgram) + +#ifndef USE_OPENGLES + // Setup or unsetup ? + if (program) + { + // Program setuped ? + if (!CDriverGL::compilePixelProgram(program)) return false; + + // Cast the driver info pointer + CPixelProgamDrvInfosGL *drvInfo = safe_cast((IProgramDrvInfos*)program->m_DrvInfo); + + glEnable(GL_FRAGMENT_PROGRAM_ARB); + _PixelProgramEnabled = true; + nglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, drvInfo->ID); + + _LastSetuppedPP = program; + } + else + { + glDisable(GL_FRAGMENT_PROGRAM_ARB); + _PixelProgramEnabled = false; + } + + return true; +#else + return false; +#endif +} + +// *************************************************************************** + +bool CDriverGL::setupPixelProgram(CPixelProgram *program, GLuint id/*, bool &specularWritten*/) +{ + H_AUTO_OGL(CDriverGL_setupARBPixelProgram); + +#ifndef USE_OPENGLES + CPixelProgamDrvInfosGL *drvInfo = static_cast((IProgramDrvInfos *)program->m_DrvInfo); + + // Find a supported pixel program profile + IProgram::CSource *source = NULL; + for (uint i = 0; i < program->getSourceNb(); ++i) + { + if (supportPixelProgram(program->getSource(i)->Profile)) + { + source = program->getSource(i); + } + } + if (!source) + { + nlwarning("No supported source profile for pixel program"); + return false; + } + + // Compile the program + nglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, id); + glGetError(); + nglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, source->SourceLen, source->SourcePtr); + GLenum err = glGetError(); + if (err != GL_NO_ERROR) + { + if (err == GL_INVALID_OPERATION) + { + GLint position; + glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &position); + nlassert(position != -1); // there was an error.. + nlassert(position < (GLint) source->SourceLen); + uint line = 0; + const char *lineStart = source->SourcePtr; + for(uint k = 0; k < (uint) position; ++k) + { + if (source->SourcePtr[k] == '\n') + { + lineStart = source->SourcePtr + k; + ++line; + } + } + nlwarning("ARB fragment program parse error at line %d.", (int) line); + // search end of line + const char *lineEnd = source->SourcePtr + source->SourceLen; + for(uint k = position; k < source->SourceLen; ++k) + { + if (source->SourcePtr[k] == '\n') + { + lineEnd = source->SourcePtr + k; + break; + } + } + nlwarning(std::string(lineStart, lineEnd).c_str()); + // display the gl error msg + const GLubyte *errorMsg = glGetString(GL_PROGRAM_ERROR_STRING_ARB); + nlassert((const char *) errorMsg); + nlwarning((const char *) errorMsg); + } + nlassert(0); + return false; + } + + // Set parameters for assembly programs + drvInfo->ParamIndices = source->ParamIndices; + + // Build the feature info + program->buildInfo(source); + + return true; +#else + return false; +#endif +} + +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + +} // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp index 055f8d99d..96d95bd5d 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp @@ -2323,7 +2323,7 @@ bool CDriverGL::setRenderTarget (ITexture *tex, uint32 x, uint32 y, uint32 width newVP.init(0, 0, ((float)width/(float)w), ((float)height/(float)h)); setupViewport(newVP); - _RenderTargetFBO = true; + _RenderTargetFBO = tex; return activeFrameBufferObject(tex); } @@ -2343,7 +2343,7 @@ bool CDriverGL::setRenderTarget (ITexture *tex, uint32 x, uint32 y, uint32 width setupViewport(_OldViewport); _OldViewport = _CurrViewport; - _RenderTargetFBO = false; + _RenderTargetFBO = NULL; return false; } @@ -2356,12 +2356,17 @@ bool CDriverGL::setRenderTarget (ITexture *tex, uint32 x, uint32 y, uint32 width // Update the scissor setupScissor (_CurrScissor); - _RenderTargetFBO = false; + _RenderTargetFBO = NULL; _OldViewport = _CurrViewport; return true; } +ITexture *CDriverGL::getRenderTarget() const +{ + return _RenderTargetFBO ? _RenderTargetFBO : _TextureTarget; +} + // *************************************************************************** bool CDriverGL::copyTargetToTexture (ITexture *tex, diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp new file mode 100644 index 000000000..9b0447dc5 --- /dev/null +++ b/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp @@ -0,0 +1,509 @@ +// NeL - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "stdopengl.h" + +#include "driver_opengl.h" + +using namespace std; +using namespace NLMISC; + +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif + +inline void CDriverGL::setUniform4fInl(TProgram program, uint index, float f0, float f1, float f2, float f3) +{ + H_AUTO_OGL(CDriverGL_setUniform4f); + +#ifndef USE_OPENGLES + switch (program) + { + case VertexProgram: + if (_Extensions.NVVertexProgram) + { + // Setup constant + nglProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, index, f0, f1, f2, f3); + } + else if (_Extensions.ARBVertexProgram) + { + nglProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, index, f0, f1, f2, f3); + } + else if (_Extensions.EXTVertexShader) + { + float datas[] = { f0, f1, f2, f3 }; + nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, datas); + } + break; + case PixelProgram: + if (_Extensions.ARBFragmentProgram) + { + nglProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, index, f0, f1, f2, f3); + } + break; + } +#endif +} + +inline void CDriverGL::setUniform4fvInl(TProgram program, uint index, size_t num, const float *src) +{ + H_AUTO_OGL(CDriverGL_setUniform4fv); + +#ifndef USE_OPENGLES + switch (program) + { + case VertexProgram: + if (_Extensions.NVVertexProgram) + { + nglProgramParameters4fvNV(GL_VERTEX_PROGRAM_NV, index, num, src); + } + else if (_Extensions.ARBVertexProgram) // ARB pixel and geometry program will only exist when ARB vertex program exists + { + for (uint k = 0; k < num; ++k) + { + nglProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, index + k, src + 4 * k); + } + } + else if (_Extensions.EXTVertexShader) + { + for (uint k = 0; k < num; ++k) + { + nglSetInvariantEXT(_EVSConstantHandle + index + k, GL_FLOAT, (void *)(src + 4 * k)); + } + } + break; + case PixelProgram: + if (_Extensions.ARBFragmentProgram) // ARB pixel and geometry program will only exist when ARB vertex program exists + { + for (uint k = 0; k < num; ++k) + { + nglProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, index + k, src + 4 * k); + } + } + break; + } +#endif +} + +void CDriverGL::setUniform1f(TProgram program, uint index, float f0) +{ + CDriverGL::setUniform4fInl(program, index, f0, 0.f, 0.f, 0.f); +} + +void CDriverGL::setUniform2f(TProgram program, uint index, float f0, float f1) +{ + CDriverGL::setUniform4fInl(program, index, f0, f1, 0.f, 0.f); +} + +void CDriverGL::setUniform3f(TProgram program, uint index, float f0, float f1, float f2) +{ + CDriverGL::setUniform4fInl(program, index, f0, f1, f2, 0.0f); +} + +void CDriverGL::setUniform4f(TProgram program, uint index, float f0, float f1, float f2, float f3) +{ + CDriverGL::setUniform4fInl(program, index, f0, f1, f2, f3); +} + +void CDriverGL::setUniform1i(TProgram program, uint index, sint32 i0) +{ + +} + +void CDriverGL::setUniform2i(TProgram program, uint index, sint32 i0, sint32 i1) +{ + +} + +void CDriverGL::setUniform3i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2) +{ + +} + +void CDriverGL::setUniform4i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2, sint32 i3) +{ + +} + +void CDriverGL::setUniform1ui(TProgram program, uint index, uint32 ui0) +{ + +} + +void CDriverGL::setUniform2ui(TProgram program, uint index, uint32 ui0, uint32 ui1) +{ + +} + +void CDriverGL::setUniform3ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2) +{ + +} + +void CDriverGL::setUniform4ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3) +{ + +} + +void CDriverGL::setUniform3f(TProgram program, uint index, const NLMISC::CVector& v) +{ + CDriverGL::setUniform4fInl(program, index, v.x, v.y, v.z, 0.f); +} + +void CDriverGL::setUniform4f(TProgram program, uint index, const NLMISC::CVector& v, float f3) +{ + CDriverGL::setUniform4fInl(program, index, v.x, v.y, v.z, f3); +} + +void CDriverGL::setUniform4f(TProgram program, uint index, const NLMISC::CRGBAF& rgba) +{ + CDriverGL::setUniform4fvInl(program, index, 1, &rgba.R); +} + +void CDriverGL::setUniform4x4f(TProgram program, uint index, const NLMISC::CMatrix& m) +{ + H_AUTO_OGL(CDriverGL_setUniform4x4f); + + // TODO: Verify this! + NLMISC::CMatrix mat = m; + mat.transpose(); + const float *md = mat.get(); + + CDriverGL::setUniform4fvInl(program, index, 4, md); +} + +void CDriverGL::setUniform4fv(TProgram program, uint index, size_t num, const float *src) +{ + CDriverGL::setUniform4fvInl(program, index, num, src); +} + +void CDriverGL::setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src) +{ + +} + +void CDriverGL::setUniform4uiv(TProgram program, uint index, size_t num, const uint32 *src) +{ + +} + +const uint CDriverGL::GLMatrix[IDriver::NumMatrix]= +{ + GL_MODELVIEW, + GL_PROJECTION, +#ifdef USE_OPENGLES + GL_MODELVIEW +#else + GL_MODELVIEW_PROJECTION_NV +#endif +}; + +const uint CDriverGL::GLTransform[IDriver::NumTransform]= +{ +#ifdef USE_OPENGLES + 0, + 0, + 0, + 0 +#else + GL_IDENTITY_NV, + GL_INVERSE_NV, + GL_TRANSPOSE_NV, + GL_INVERSE_TRANSPOSE_NV +#endif +}; + +void CDriverGL::setUniformMatrix(NL3D::IDriver::TProgram program, uint index, NL3D::IDriver::TMatrix matrix, NL3D::IDriver::TTransform transform) +{ + H_AUTO_OGL(CDriverGL_setUniformMatrix); + +#ifndef USE_OPENGLES + // Vertex program exist ? + if (program == VertexProgram && _Extensions.NVVertexProgram) + { + // First, ensure that the render setup is correclty setuped. + refreshRenderSetup(); + + // Track the matrix + nglTrackMatrixNV(GL_VERTEX_PROGRAM_NV, index, GLMatrix[matrix], GLTransform[transform]); + // Release Track => matrix data is copied. + nglTrackMatrixNV(GL_VERTEX_PROGRAM_NV, index, GL_NONE, GL_IDENTITY_NV); + } + else + { + // First, ensure that the render setup is correctly setuped. + refreshRenderSetup(); + + CMatrix mat; + switch (matrix) + { + case IDriver::ModelView: + mat = _ModelViewMatrix; + break; + case IDriver::Projection: + { + refreshProjMatrixFromGL(); + mat = _GLProjMat; + } + break; + case IDriver::ModelViewProjection: + refreshProjMatrixFromGL(); + mat = _GLProjMat * _ModelViewMatrix; + break; + default: + break; + } + + switch(transform) + { + case IDriver::Identity: break; + case IDriver::Inverse: + mat.invert(); + break; + case IDriver::Transpose: + mat.transpose(); + break; + case IDriver::InverseTranspose: + mat.invert(); + mat.transpose(); + break; + default: + break; + } + + mat.transpose(); + const float *md = mat.get(); + + CDriverGL::setUniform4fvInl(program, index, 4, md); + } +#endif +} + +void CDriverGL::setUniformFog(NL3D::IDriver::TProgram program, uint index) +{ + H_AUTO_OGL(CDriverGL_setUniformFog) + + const float *values = _ModelViewMatrix.get(); + CDriverGL::setUniform4fInl(program, index, -values[2], -values[6], -values[10], -values[14]); +} + +/* + +bool CDriverGL::setUniformDriver(TProgram program) +{ + IProgram *prog = NULL; + switch (program) + { + case VertexProgram: + prog = _LastSetuppedVP; + break; + case PixelProgram: + prog = _LastSetuppedPP; + break; + } + if (!prog) return false; + + const CProgramFeatures &features = prog->features(); + + if (features.DriverFlags) + { + if (features.DriverFlags & CProgramFeatures::Matrices) + { + if (prog->getUniformIndex(CProgramIndex::ModelView) != ~0) + { + setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelView), ModelView, Identity); + } + if (prog->getUniformIndex(CProgramIndex::ModelViewInverse) != ~0) + { + setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewInverse), ModelView, Inverse); + } + if (prog->getUniformIndex(CProgramIndex::ModelViewTranspose) != ~0) + { + setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewTranspose), ModelView, Transpose); + } + if (prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose) != ~0) + { + setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose), ModelView, InverseTranspose); + } + if (prog->getUniformIndex(CProgramIndex::Projection) != ~0) + { + setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::Projection), Projection, Identity); + } + if (prog->getUniformIndex(CProgramIndex::ProjectionInverse) != ~0) + { + setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionInverse), Projection, Inverse); + } + if (prog->getUniformIndex(CProgramIndex::ProjectionTranspose) != ~0) + { + setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionTranspose), Projection, Transpose); + } + if (prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose) != ~0) + { + setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose), Projection, InverseTranspose); + } + if (prog->getUniformIndex(CProgramIndex::ModelViewProjection) != ~0) + { + setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjection), ModelViewProjection, Identity); + } + if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse) != ~0) + { + setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse), ModelViewProjection, Inverse); + } + if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose) != ~0) + { + setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose), ModelViewProjection, Transpose); + } + if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose) != ~0) + { + setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose), ModelViewProjection, InverseTranspose); + } + } + if (features.DriverFlags & CProgramFeatures::Fog) + { + if (prog->getUniformIndex(CProgramIndex::Fog) != ~0) + { + setUniformFog(program, prog->getUniformIndex(CProgramIndex::Fog)); + } + } + } + + return true; +} + +bool CDriverGL::setUniformMaterial(TProgram program, CMaterial &material) +{ + IProgram *prog = NULL; + switch (program) + { + case VertexProgram: + prog = _LastSetuppedVP; + break; + case PixelProgram: + prog = _LastSetuppedPP; + break; + } + if (!prog) return false; + + const CProgramFeatures &features = prog->features(); + + // These are also already set by setupMaterial, so setupMaterial uses setUniformMaterialInternal instead + if (features.MaterialFlags & (CProgramFeatures::TextureStages | CProgramFeatures::TextureMatrices)) + { + if (features.MaterialFlags & CProgramFeatures::TextureStages) + { + for (uint stage = 0; stage < inlGetNumTextStages(); ++stage) + { + ITexture *text= material.getTexture(uint8(stage)); + + // Must setup textures each frame. (need to test if touched). + if (text != NULL && !setupTexture(*text)) + return false; + + // activate the texture, or disable texturing if NULL. + activateTexture(stage, text); + + // If texture not NULL, Change texture env function. + setTextureEnvFunction(stage, material); + } + + + } + if (features.MaterialFlags & CProgramFeatures::TextureMatrices) + { + // Textures user matrix + setupUserTextureMatrix(inlGetNumTextStages(), material); + } + } + + return true; +} + +bool CDriverGL::setUniformMaterialInternal(TProgram program, CMaterial &material) +{ + IProgram *prog = NULL; + switch (program) + { + case VertexProgram: + prog = _LastSetuppedVP; + break; + case PixelProgram: + prog = _LastSetuppedPP; + break; + } + if (!prog) return false; + + const CProgramFeatures &features = prog->features(); + + if (features.MaterialFlags & ~(CProgramFeatures::TextureStages | CProgramFeatures::TextureMatrices)) + { + // none + } + + return true; +} + +void CDriverGL::setUniformParams(TProgram program, CGPUProgramParams ¶ms) +{ + IProgram *prog = NULL; + switch (program) + { + case VertexProgram: + prog = _LastSetuppedVP; + break; + case PixelProgram: + prog = _LastSetuppedPP; + break; + } + if (!prog) return; + + size_t offset = params.getBegin(); + while (offset != params.getEnd()) + { + uint size = params.getSizeByOffset(offset); + uint count = params.getCountByOffset(offset); + + nlassert(size == 4 || count == 1); // only support float4 arrays + nlassert(params.getTypeByOffset(offset) == CGPUProgramParams::Float); // only support float + + uint index = params.getIndexByOffset(offset); + if (index == ~0) + { + const std::string &name = params.getNameByOffset(offset); + nlassert(!name.empty() /* missing both parameter name and index, code error /); + uint index = prog->getUniformIndex(name.c_str()); + nlassert(index != ~0 /* invalid parameter name /); + params.map(index, name); + } + + setUniform4fv(program, index, count, params.getPtrFByOffset(offset)); + + offset = params.getNext(offset); + } +} + +*/ + +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + +} // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp index 14ed83adb..6df62dfc3 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp @@ -1151,7 +1151,7 @@ void CDriverGL::toggleGlArraysForEXTVertexShader() CVertexProgram *vp = _LastSetuppedVP; if (vp) { - CVertexProgamDrvInfosGL *drvInfo = NLMISC::safe_cast((IVertexProgramDrvInfos *) vp->_DrvInfo); + CVertexProgamDrvInfosGL *drvInfo = NLMISC::safe_cast((IProgramDrvInfos *) vp->m_DrvInfo); if (drvInfo) { // Disable all VertexAttribs. @@ -1396,7 +1396,7 @@ void CDriverGL::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb) CVertexProgram *vp = _LastSetuppedVP; if (!vp) return; - CVertexProgamDrvInfosGL *drvInfo = NLMISC::safe_cast((IVertexProgramDrvInfos *) vp->_DrvInfo); + CVertexProgamDrvInfosGL *drvInfo = NLMISC::safe_cast((IProgramDrvInfos *) vp->m_DrvInfo); if (!drvInfo) return; uint32 flags= vb.VertexFormat; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp index 5392bcbdd..5470ec5c5 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp @@ -41,7 +41,7 @@ namespace NLDRIVERGL { #endif // *************************************************************************** -CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInfoPtrList it) : IVertexProgramDrvInfos (drv, it) +CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL(CDriverGL *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos (drv, it) { H_AUTO_OGL(CVertexProgamDrvInfosGL_CVertexProgamDrvInfosGL); @@ -70,23 +70,136 @@ CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInf // *************************************************************************** -bool CDriverGL::isVertexProgramSupported () const +bool CDriverGL::supportVertexProgram(CVertexProgram::TProfile profile) const { - H_AUTO_OGL(CVertexProgamDrvInfosGL_isVertexProgramSupported) - return _Extensions.NVVertexProgram || _Extensions.EXTVertexShader || _Extensions.ARBVertexProgram; + H_AUTO_OGL(CVertexProgamDrvInfosGL_supportVertexProgram) + return (profile == CVertexProgram::nelvp) + && (_Extensions.NVVertexProgram || _Extensions.EXTVertexShader || _Extensions.ARBVertexProgram); } // *************************************************************************** -bool CDriverGL::isVertexProgramEmulated () const +bool CDriverGL::isVertexProgramEmulated() const { H_AUTO_OGL(CVertexProgamDrvInfosGL_isVertexProgramEmulated) return _Extensions.NVVertexProgramEmulated; } +bool CDriverGL::compileNVVertexProgram(CVertexProgram *program) +{ + H_AUTO_OGL(CDriverGL_compileNVVertexProgram); +#ifndef USE_OPENGLES + + // Driver info + CVertexProgamDrvInfosGL *drvInfo; + + nlassert(!program->m_DrvInfo); + glDisable(GL_VERTEX_PROGRAM_NV); + _VertexProgramEnabled = false; + + // Find nelvp + IProgram::CSource *source = NULL; + for (uint i = 0; i < program->getSourceNb(); ++i) + { + if (program->getSource(i)->Profile == CVertexProgram::nelvp) + { + source = program->getSource(i); + } + } + if (!source) + { + nlwarning("OpenGL driver only supports 'nelvp' profile, vertex program cannot be used"); + return false; + } + + /** Check with our parser if the program will works with other implemented extensions, too. (EXT_vertex_shader ..). + * There are some incompatibilities. + */ + CVPParser parser; + CVPParser::TProgram parsedProgram; + std::string errorOutput; + bool result = parser.parse(source->SourcePtr, parsedProgram, errorOutput); + if (!result) + { + nlwarning("Unable to parse a vertex program :"); + nlwarning(errorOutput.c_str()); + #ifdef NL_DEBUG + nlassert(0); + #endif + return false; + } + + // Insert into driver list. (so it is deleted when driver is deleted). + ItGPUPrgDrvInfoPtrList it = _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IProgramDrvInfos*)NULL); + + // Create a driver info + *it = drvInfo = new CVertexProgamDrvInfosGL(this, it); + + // Set the pointer + program->m_DrvInfo = drvInfo; + + // Compile the program + nglLoadProgramNV(GL_VERTEX_PROGRAM_NV, drvInfo->ID, (GLsizei)source->SourceLen, (const GLubyte*)source->SourcePtr); + + // Get loading error code + GLint errorOff; + glGetIntegerv(GL_PROGRAM_ERROR_POSITION_NV, &errorOff); + + // Compilation error ? + if (errorOff >= 0) + { + // String length + uint length = (uint)source->SourceLen; + const char* sString = source->SourcePtr; + + // Line count and char count + uint line=1; + uint charC=1; + + // Find the line + uint offset=0; + while ((offset < length) && (offset < (uint)errorOff)) + { + if (sString[offset]=='\n') + { + line++; + charC=1; + } + else + charC++; + + // Next character + offset++; + } + + // Show the error + nlwarning("3D: Vertex program syntax error line %d character %d\n", line, charC); + + // Setup not ok + delete drvInfo; + program->m_DrvInfo = NULL; + _GPUPrgDrvInfos.erase(it); + return false; + } + + // Set parameters for assembly programs + drvInfo->ParamIndices = source->ParamIndices; + + // Build the feature info + program->buildInfo(source); + + // Setup ok + return true; + +#else + + return false; + +#endif +} // *************************************************************************** -bool CDriverGL::activeNVVertexProgram (CVertexProgram *program) +bool CDriverGL::activeNVVertexProgram(CVertexProgram *program) { H_AUTO_OGL(CVertexProgamDrvInfosGL_activeNVVertexProgram); @@ -94,99 +207,16 @@ bool CDriverGL::activeNVVertexProgram (CVertexProgram *program) // Setup or unsetup ? if (program) { - // Enable vertex program - glEnable (GL_VERTEX_PROGRAM_NV); - _VertexProgramEnabled= true; - - // Driver info - CVertexProgamDrvInfosGL *drvInfo; + CVertexProgamDrvInfosGL *drvInfo = safe_cast((IProgramDrvInfos*)program->m_DrvInfo); + nlassert(drvInfo); - // Program setuped ? - if (program->_DrvInfo==NULL) - { - /** Check with our parser if the program will works with other implemented extensions, too. (EXT_vertex_shader ..). - * There are some incompatibilities. - */ - CVPParser parser; - CVPParser::TProgram parsedProgram; - std::string errorOutput; - bool result = parser.parse(program->getProgram().c_str(), parsedProgram, errorOutput); - if (!result) - { - nlwarning("Unable to parse a vertex program :"); - nlwarning(errorOutput.c_str()); - #ifdef NL_DEBUG - nlassert(0); - #endif - return false; - } - - // Insert into driver list. (so it is deleted when driver is deleted). - ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), (NL3D::IVertexProgramDrvInfos*)NULL); - - // Create a driver info - *it = drvInfo = new CVertexProgamDrvInfosGL (this, it); - - // Set the pointer - program->_DrvInfo=drvInfo; - - // Compile the program - nglLoadProgramNV (GL_VERTEX_PROGRAM_NV, drvInfo->ID, (GLsizei)program->getProgram().length(), (const GLubyte*)program->getProgram().c_str()); - - // Get loading error code - GLint errorOff; - glGetIntegerv (GL_PROGRAM_ERROR_POSITION_NV, &errorOff); - - // Compilation error ? - if (errorOff>=0) - { - // String length - uint length = (uint)program->getProgram ().length(); - const char* sString= program->getProgram ().c_str(); - - // Line count and char count - uint line=1; - uint charC=1; - - // Find the line - uint offset=0; - while ((offset((IVertexProgramDrvInfos*)program->_DrvInfo); - } + // Enable vertex program + glEnable(GL_VERTEX_PROGRAM_NV); + _VertexProgramEnabled = true; // Setup this program - nglBindProgramNV (GL_VERTEX_PROGRAM_NV, drvInfo->ID); + nglBindProgramNV(GL_VERTEX_PROGRAM_NV, drvInfo->ID); _LastSetuppedVP = program; // Ok @@ -195,8 +225,8 @@ bool CDriverGL::activeNVVertexProgram (CVertexProgram *program) else // Unsetup { // Disable vertex program - glDisable (GL_VERTEX_PROGRAM_NV); - _VertexProgramEnabled= false; + glDisable(GL_VERTEX_PROGRAM_NV); + _VertexProgramEnabled = false; // Ok return true; } @@ -1486,165 +1516,273 @@ bool CDriverGL::setupARBVertexProgram (const CVPParser::TProgram &inParsedProgra #endif } +// *************************************************************************** +bool CDriverGL::compileARBVertexProgram(NL3D::CVertexProgram *program) +{ + H_AUTO_OGL(CDriverGL_compileARBVertexProgram); + +#ifndef USE_OPENGLES + + nlassert(!program->m_DrvInfo); + glDisable(GL_VERTEX_PROGRAM_ARB); + _VertexProgramEnabled = false; + + // Find nelvp + IProgram::CSource *source = NULL; + for (uint i = 0; i < program->getSourceNb(); ++i) + { + if (program->getSource(i)->Profile == CVertexProgram::nelvp) + { + source = program->getSource(i); + } + } + if (!source) + { + nlwarning("OpenGL driver only supports 'nelvp' profile, vertex program cannot be used"); + return false; + } + + // try to parse the program + CVPParser parser; + CVPParser::TProgram parsedProgram; + std::string errorOutput; + bool result = parser.parse(source->SourcePtr, parsedProgram, errorOutput); + if (!result) + { + nlwarning("Unable to parse a vertex program."); + #ifdef NL_DEBUG + nlerror(errorOutput.c_str()); + #endif + return false; + } + // Insert into driver list. (so it is deleted when driver is deleted). + ItGPUPrgDrvInfoPtrList it = _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IProgramDrvInfos*)NULL); + + // Create a driver info + CVertexProgamDrvInfosGL *drvInfo; + *it = drvInfo = new CVertexProgamDrvInfosGL(this, it); + // Set the pointer + program->m_DrvInfo = drvInfo; + + if (!setupARBVertexProgram(parsedProgram, drvInfo->ID, drvInfo->SpecularWritten)) + { + delete drvInfo; + program->m_DrvInfo = NULL; + _GPUPrgDrvInfos.erase(it); + return false; + } + + // Set parameters for assembly programs + drvInfo->ParamIndices = source->ParamIndices; + + // Build the feature info + program->buildInfo(source); + + return true; + +#else + + return false; + +#endif +} // *************************************************************************** -bool CDriverGL::activeARBVertexProgram (CVertexProgram *program) + +bool CDriverGL::activeARBVertexProgram(CVertexProgram *program) { H_AUTO_OGL(CDriverGL_activeARBVertexProgram); #ifndef USE_OPENGLES + // Setup or unsetup ? if (program) { // Driver info - CVertexProgamDrvInfosGL *drvInfo; + CVertexProgamDrvInfosGL *drvInfo = safe_cast((IProgramDrvInfos*)program->m_DrvInfo); + nlassert(drvInfo); - // Program setuped ? - if (program->_DrvInfo==NULL) - { - // try to parse the program - CVPParser parser; - CVPParser::TProgram parsedProgram; - std::string errorOutput; - bool result = parser.parse(program->getProgram().c_str(), parsedProgram, errorOutput); - if (!result) - { - nlwarning("Unable to parse a vertex program."); - #ifdef NL_DEBUG - nlerror(errorOutput.c_str()); - #endif - return false; - } - // Insert into driver list. (so it is deleted when driver is deleted). - ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), (NL3D::IVertexProgramDrvInfos*)NULL); - - // Create a driver info - *it = drvInfo = new CVertexProgamDrvInfosGL (this, it); - // Set the pointer - program->_DrvInfo=drvInfo; - - if (!setupARBVertexProgram(parsedProgram, drvInfo->ID, drvInfo->SpecularWritten)) - { - delete drvInfo; - program->_DrvInfo = NULL; - _VtxPrgDrvInfos.erase(it); - return false; - } - } - else - { - // Cast the driver info pointer - drvInfo=safe_cast((IVertexProgramDrvInfos*)program->_DrvInfo); - } glEnable( GL_VERTEX_PROGRAM_ARB ); _VertexProgramEnabled = true; - nglBindProgramARB( GL_VERTEX_PROGRAM_ARB, drvInfo->ID ); + nglBindProgramARB(GL_VERTEX_PROGRAM_ARB, drvInfo->ID); if (drvInfo->SpecularWritten) { - glEnable( GL_COLOR_SUM_ARB ); + glEnable(GL_COLOR_SUM_ARB); } else { - glDisable( GL_COLOR_SUM_ARB ); // no specular written + glDisable(GL_COLOR_SUM_ARB); // no specular written } _LastSetuppedVP = program; } else { - glDisable( GL_VERTEX_PROGRAM_ARB ); - glDisable( GL_COLOR_SUM_ARB ); + glDisable(GL_VERTEX_PROGRAM_ARB); + glDisable(GL_COLOR_SUM_ARB); _VertexProgramEnabled = false; } return true; + #else + return false; + #endif } // *************************************************************************** -bool CDriverGL::activeEXTVertexShader (CVertexProgram *program) + +bool CDriverGL::compileEXTVertexShader(CVertexProgram *program) { H_AUTO_OGL(CDriverGL_activeEXTVertexShader); #ifndef USE_OPENGLES - // Setup or unsetup ? - if (program) + + nlassert(program->m_DrvInfo); + glDisable(GL_VERTEX_SHADER_EXT); + _VertexProgramEnabled = false; + + // Find nelvp + IProgram::CSource *source = NULL; + for (uint i = 0; i < program->getSourceNb(); ++i) { - // Driver info - CVertexProgamDrvInfosGL *drvInfo; - - // Program setuped ? - if (program->_DrvInfo==NULL) + if (program->getSource(i)->Profile == CVertexProgram::nelvp) { - // try to parse the program - CVPParser parser; - CVPParser::TProgram parsedProgram; - std::string errorOutput; - bool result = parser.parse(program->getProgram().c_str(), parsedProgram, errorOutput); - if (!result) - { - nlwarning("Unable to parse a vertex program."); - #ifdef NL_DEBUG - nlerror(errorOutput.c_str()); - #endif - return false; - } - - /* - FILE *f = fopen(getLogDirectory() + "test.txt", "wb"); - if (f) - { - std::string vpText; - CVPParser::dump(parsedProgram, vpText); - fwrite(vpText.c_str(), vpText.size(), 1, f); - fclose(f); - } - */ - - // Insert into driver list. (so it is deleted when driver is deleted). - ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), (NL3D::IVertexProgramDrvInfos*)NULL); - - // Create a driver info - *it = drvInfo = new CVertexProgamDrvInfosGL (this, it); - // Set the pointer - program->_DrvInfo=drvInfo; - - if (!setupEXTVertexShader(parsedProgram, drvInfo->ID, drvInfo->Variants, drvInfo->UsedVertexComponents)) - { - delete drvInfo; - program->_DrvInfo = NULL; - _VtxPrgDrvInfos.erase(it); - return false; - } + source = program->getSource(i); } - else - { - // Cast the driver info pointer - drvInfo=safe_cast((IVertexProgramDrvInfos*)program->_DrvInfo); - } - - glEnable( GL_VERTEX_SHADER_EXT); - _VertexProgramEnabled = true; - nglBindVertexShaderEXT( drvInfo->ID ); - _LastSetuppedVP = program; } - else + if (!source) { - glDisable( GL_VERTEX_SHADER_EXT ); - _VertexProgramEnabled = false; + nlwarning("OpenGL driver only supports 'nelvp' profile, vertex program cannot be used"); + return false; } + + // try to parse the program + CVPParser parser; + CVPParser::TProgram parsedProgram; + std::string errorOutput; + bool result = parser.parse(source->SourcePtr, parsedProgram, errorOutput); + if (!result) + { + nlwarning("Unable to parse a vertex program."); + #ifdef NL_DEBUG + nlerror(errorOutput.c_str()); + #endif + return false; + } + + /* + FILE *f = fopen(getLogDirectory() + "test.txt", "wb"); + if (f) + { + std::string vpText; + CVPParser::dump(parsedProgram, vpText); + fwrite(vpText.c_str(), vpText.size(), 1, f); + fclose(f); + } + */ + + // Insert into driver list. (so it is deleted when driver is deleted). + ItGPUPrgDrvInfoPtrList it= _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IProgramDrvInfos*)NULL); + + // Create a driver info + CVertexProgamDrvInfosGL *drvInfo; + *it = drvInfo = new CVertexProgamDrvInfosGL (this, it); + // Set the pointer + program->m_DrvInfo=drvInfo; + + if (!setupEXTVertexShader(parsedProgram, drvInfo->ID, drvInfo->Variants, drvInfo->UsedVertexComponents)) + { + delete drvInfo; + program->m_DrvInfo = NULL; + _GPUPrgDrvInfos.erase(it); + return false; + } + + // Set parameters for assembly programs + drvInfo->ParamIndices = source->ParamIndices; + + // Build the feature info + program->buildInfo(source); + return true; + #else + return false; + #endif } // *************************************************************************** -bool CDriverGL::activeVertexProgram (CVertexProgram *program) + +bool CDriverGL::activeEXTVertexShader(CVertexProgram *program) +{ + H_AUTO_OGL(CDriverGL_activeEXTVertexShader); + +#ifndef USE_OPENGLES + + // Setup or unsetup ? + if (program) + { + // Driver info + CVertexProgamDrvInfosGL *drvInfo = safe_cast((IProgramDrvInfos*)program->m_DrvInfo); + nlassert(drvInfo); + + glEnable(GL_VERTEX_SHADER_EXT); + _VertexProgramEnabled = true; + nglBindVertexShaderEXT(drvInfo->ID); + _LastSetuppedVP = program; + } + else + { + glDisable(GL_VERTEX_SHADER_EXT); + _VertexProgramEnabled = false; + } + return true; + +#else + + return false; + +#endif +} + +bool CDriverGL::compileVertexProgram(NL3D::CVertexProgram *program) +{ + if (program->m_DrvInfo == NULL) + { + // Extension + if (_Extensions.NVVertexProgram) + { + return compileNVVertexProgram(program); + } + else if (_Extensions.ARBVertexProgram) + { + return compileARBVertexProgram(program); + } + else if (_Extensions.EXTVertexShader) + { + return compileEXTVertexShader(program); + } + + // Can't do anything + return false; + } + return true; +} + +// *************************************************************************** + +bool CDriverGL::activeVertexProgram(CVertexProgram *program) { H_AUTO_OGL(CDriverGL_activeVertexProgram) - // Extension here ? + + // Compile if necessary + if (program && !CDriverGL::compileVertexProgram(program)) return false; + + // Extension if (_Extensions.NVVertexProgram) { return activeNVVertexProgram(program); @@ -1662,287 +1800,6 @@ bool CDriverGL::activeVertexProgram (CVertexProgram *program) return false; } - -// *************************************************************************** - -void CDriverGL::setConstant (uint index, float f0, float f1, float f2, float f3) -{ - H_AUTO_OGL(CDriverGL_setConstant); - -#ifndef USE_OPENGLES - // Vertex program exist ? - if (_Extensions.NVVertexProgram) - { - // Setup constant - nglProgramParameter4fNV (GL_VERTEX_PROGRAM_NV, index, f0, f1, f2, f3); - } - else if (_Extensions.ARBVertexProgram) - { - nglProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, index, f0, f1, f2, f3); - } - else if (_Extensions.EXTVertexShader) - { - float datas[] = { f0, f1, f2, f3 }; - nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, datas); - } -#endif -} - - -// *************************************************************************** - -void CDriverGL::setConstant (uint index, double d0, double d1, double d2, double d3) -{ - H_AUTO_OGL(CDriverGL_setConstant); - -#ifndef USE_OPENGLES - // Vertex program exist ? - if (_Extensions.NVVertexProgram) - { - // Setup constant - nglProgramParameter4dNV (GL_VERTEX_PROGRAM_NV, index, d0, d1, d2, d3); - } - else if (_Extensions.ARBVertexProgram) - { - nglProgramEnvParameter4dARB(GL_VERTEX_PROGRAM_ARB, index, d0, d1, d2, d3); - } - else if (_Extensions.EXTVertexShader) - { - double datas[] = { d0, d1, d2, d3 }; - nglSetInvariantEXT(_EVSConstantHandle + index, GL_DOUBLE, datas); - } -#endif -} - - -// *************************************************************************** - -void CDriverGL::setConstant (uint index, const NLMISC::CVector& value) -{ - H_AUTO_OGL(CDriverGL_setConstant); - -#ifndef USE_OPENGLES - // Vertex program exist ? - if (_Extensions.NVVertexProgram) - { - // Setup constant - nglProgramParameter4fNV (GL_VERTEX_PROGRAM_NV, index, value.x, value.y, value.z, 0); - } - else if (_Extensions.ARBVertexProgram) - { - nglProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, index, value.x, value.y, value.z, 0); - } - else if (_Extensions.EXTVertexShader) - { - float datas[] = { value.x, value.y, value.z, 0 }; - nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, datas); - } -#endif -} - - -// *************************************************************************** - -void CDriverGL::setConstant (uint index, const NLMISC::CVectorD& value) -{ - H_AUTO_OGL(CDriverGL_setConstant); - -#ifndef USE_OPENGLES - // Vertex program exist ? - if (_Extensions.NVVertexProgram) - { - // Setup constant - nglProgramParameter4dNV (GL_VERTEX_PROGRAM_NV, index, value.x, value.y, value.z, 0); - } - else if (_Extensions.ARBVertexProgram) - { - nglProgramEnvParameter4dARB(GL_VERTEX_PROGRAM_ARB, index, value.x, value.y, value.z, 0); - } - else if (_Extensions.EXTVertexShader) - { - double datas[] = { value.x, value.y, value.z, 0 }; - nglSetInvariantEXT(_EVSConstantHandle + index, GL_DOUBLE, datas); - } -#endif -} - - -// *************************************************************************** -void CDriverGL::setConstant (uint index, uint num, const float *src) -{ - H_AUTO_OGL(CDriverGL_setConstant); - -#ifndef USE_OPENGLES - // Vertex program exist ? - if (_Extensions.NVVertexProgram) - { - nglProgramParameters4fvNV(GL_VERTEX_PROGRAM_NV, index, num, src); - } - else if (_Extensions.ARBVertexProgram) - { - for(uint k = 0; k < num; ++k) - { - nglProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, index + k, src + 4 * k); - } - } - else if (_Extensions.EXTVertexShader) - { - for(uint k = 0; k < num; ++k) - { - nglSetInvariantEXT(_EVSConstantHandle + index + k, GL_FLOAT, (void *) (src + 4 * k)); - } - } -#endif -} - -// *************************************************************************** -void CDriverGL::setConstant (uint index, uint num, const double *src) -{ - H_AUTO_OGL(CDriverGL_setConstant); - -#ifndef USE_OPENGLES - // Vertex program exist ? - if (_Extensions.NVVertexProgram) - { - nglProgramParameters4dvNV(GL_VERTEX_PROGRAM_NV, index, num, src); - } - else if (_Extensions.ARBVertexProgram) - { - for(uint k = 0; k < num; ++k) - { - nglProgramEnvParameter4dvARB(GL_VERTEX_PROGRAM_ARB, index + k, src + 4 * k); - } - } - else if (_Extensions.EXTVertexShader) - { - for(uint k = 0; k < num; ++k) - { - nglSetInvariantEXT(_EVSConstantHandle + index + k, GL_DOUBLE, (void *) (src + 4 * k)); - } - } -#endif -} - -// *************************************************************************** - -const uint CDriverGL::GLMatrix[IDriver::NumMatrix]= -{ - GL_MODELVIEW, - GL_PROJECTION, -#ifdef USE_OPENGLES - GL_MODELVIEW -#else - GL_MODELVIEW_PROJECTION_NV -#endif -}; - - -// *************************************************************************** - -const uint CDriverGL::GLTransform[IDriver::NumTransform]= -{ -#ifdef USE_OPENGLES - 0, - 0, - 0, - 0 -#else - GL_IDENTITY_NV, - GL_INVERSE_NV, - GL_TRANSPOSE_NV, - GL_INVERSE_TRANSPOSE_NV -#endif -}; - - -// *************************************************************************** - -void CDriverGL::setConstantMatrix (uint index, IDriver::TMatrix matrix, IDriver::TTransform transform) -{ - H_AUTO_OGL(CDriverGL_setConstantMatrix); - -#ifndef USE_OPENGLES - // Vertex program exist ? - if (_Extensions.NVVertexProgram) - { - // First, ensure that the render setup is correclty setuped. - refreshRenderSetup(); - - // Track the matrix - nglTrackMatrixNV (GL_VERTEX_PROGRAM_NV, index, GLMatrix[matrix], GLTransform[transform]); - // Release Track => matrix data is copied. - nglTrackMatrixNV (GL_VERTEX_PROGRAM_NV, index, GL_NONE, GL_IDENTITY_NV); - } - else - { - // First, ensure that the render setup is correctly setuped. - refreshRenderSetup(); - CMatrix mat; - switch (matrix) - { - case IDriver::ModelView: - mat = _ModelViewMatrix; - break; - case IDriver::Projection: - { - refreshProjMatrixFromGL(); - mat = _GLProjMat; - } - break; - case IDriver::ModelViewProjection: - refreshProjMatrixFromGL(); - mat = _GLProjMat * _ModelViewMatrix; - break; - default: - break; - } - - switch(transform) - { - case IDriver::Identity: break; - case IDriver::Inverse: - mat.invert(); - break; - case IDriver::Transpose: - mat.transpose(); - break; - case IDriver::InverseTranspose: - mat.invert(); - mat.transpose(); - break; - default: - break; - } - mat.transpose(); - float matDatas[16]; - mat.get(matDatas); - if (_Extensions.ARBVertexProgram) - { - nglProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, index, matDatas); - nglProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, index + 1, matDatas + 4); - nglProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, index + 2, matDatas + 8); - nglProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, index + 3, matDatas + 12); - } - else - { - nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, matDatas); - nglSetInvariantEXT(_EVSConstantHandle + index + 1, GL_FLOAT, matDatas + 4); - nglSetInvariantEXT(_EVSConstantHandle + index + 2, GL_FLOAT, matDatas + 8); - nglSetInvariantEXT(_EVSConstantHandle + index + 3, GL_FLOAT, matDatas + 12); - } - } -#endif -} - -// *************************************************************************** - -void CDriverGL::setConstantFog (uint index) -{ - H_AUTO_OGL(CDriverGL_setConstantFog) - const float *values = _ModelViewMatrix.get(); - setConstant (index, -values[2], -values[6], -values[10], -values[14]); -} - // *************************************************************************** void CDriverGL::enableVertexProgramDoubleSidedColor(bool doubleSided) diff --git a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp index c59167183..c3a8552ac 100644 --- a/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/unix_event_emitter.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "nel/misc/debug.h" @@ -566,7 +567,7 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server) } else { - k = XKeycodeToKeysym(_dpy, keyCode, 0); + k = XkbKeycodeToKeysym(_dpy, keyCode, 0, 0); } // send CEventKeyDown event only if keyCode is defined diff --git a/code/nel/src/3d/driver_user.cpp b/code/nel/src/3d/driver_user.cpp index b45ebbd37..e5d814755 100644 --- a/code/nel/src/3d/driver_user.cpp +++ b/code/nel/src/3d/driver_user.cpp @@ -213,6 +213,12 @@ void CDriverUser::disableHardwareVertexProgram() _Driver->disableHardwareVertexProgram(); } +void CDriverUser::disableHardwarePixelProgram() +{ + NL3D_HAUTO_UI_DRIVER; + + _Driver->disableHardwarePixelProgram(); +} void CDriverUser::disableHardwareVertexArrayAGP() { NL3D_HAUTO_UI_DRIVER; @@ -1490,12 +1496,6 @@ void CDriverUser::forceTextureResize(uint divisor) _Driver->forceTextureResize(divisor); } -void CDriverUser::forceNativeFragmentPrograms(bool nativeOnly) -{ - NL3D_HAUTO_UI_DRIVER; - - _Driver->forceNativeFragmentPrograms(nativeOnly); -} bool CDriverUser::setMonitorColorProperties (const CMonitorColorProperties &properties) { NL3D_HAUTO_UI_DRIVER; diff --git a/code/nel/src/3d/flare_model.cpp b/code/nel/src/3d/flare_model.cpp index 47d9fdb43..6c422aac9 100644 --- a/code/nel/src/3d/flare_model.cpp +++ b/code/nel/src/3d/flare_model.cpp @@ -363,6 +363,8 @@ void CFlareModel::traverseRender() } // setup driver drv->activeVertexProgram(NULL); + drv->activePixelProgram(NULL); + drv->activeGeometryProgram(NULL); drv->setupModelMatrix(fs->getLookAtMode() ? CMatrix::Identity : getWorldMatrix()); // we don't change the fustrum to draw 2d shapes : it is costly, and we need to restore it after the drawing has been done // we setup Z to be (near + far) / 2, and setup x and y to get the screen coordinates we want @@ -565,6 +567,8 @@ void CFlareModel::updateOcclusionQueryBegin(IDriver *drv) { nlassert(drv); drv->activeVertexProgram(NULL); + drv->activePixelProgram(NULL); + drv->activeGeometryProgram(NULL); drv->setupModelMatrix(CMatrix::Identity); initStatics(); drv->setColorMask(false, false, false, false); // don't write any pixel during the test @@ -661,6 +665,8 @@ void CFlareModel::occlusionTest(CMesh &mesh, IDriver &drv) } drv.setColorMask(false, false, false, false); // don't write any pixel during the test drv.activeVertexProgram(NULL); + drv.activePixelProgram(NULL); + drv.activeGeometryProgram(NULL); setupOcclusionMeshMatrix(drv, *_Scene); drv.activeVertexBuffer(const_cast(mesh.getVertexBuffer())); // query drawn count diff --git a/code/nel/src/3d/geometry_program.cpp b/code/nel/src/3d/geometry_program.cpp new file mode 100644 index 000000000..26fb15ae9 --- /dev/null +++ b/code/nel/src/3d/geometry_program.cpp @@ -0,0 +1,49 @@ +/** \file geometry_program.cpp + * Geometry program definition + */ + +/* Copyright, 2000, 2001 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "std3d.h" + +#include + +#include + +namespace NL3D +{ + +// *************************************************************************** + +CGeometryProgram::CGeometryProgram() +{ + +} + +// *************************************************************************** + +CGeometryProgram::~CGeometryProgram () +{ + +} + +// *************************************************************************** + +} // NL3D diff --git a/code/nel/src/3d/gpu_program_params.cpp b/code/nel/src/3d/gpu_program_params.cpp new file mode 100644 index 000000000..e196154f8 --- /dev/null +++ b/code/nel/src/3d/gpu_program_params.cpp @@ -0,0 +1,587 @@ +/** + * \file gpu_program_params.cpp + * \brief CGPUProgramParams + * \date 2013-09-07 22:17GMT + * \author Jan Boon (Kaetemi) + * CGPUProgramParams + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + */ + +#include +#include + +// STL includes + +// NeL includes +// #include +#include +#include + +// Project includes +#include + +using namespace std; +// using namespace NLMISC; + +namespace NL3D { + +CGPUProgramParams::CGPUProgramParams() : m_First(s_End), m_Last(s_End) +{ + +} + +CGPUProgramParams::~CGPUProgramParams() +{ + +} + +void CGPUProgramParams::copy(CGPUProgramParams *params) +{ + size_t offset = params->getBegin(); + while (offset != params->getEnd()) + { + uint index = params->getIndexByOffset(offset); + const std::string &name = params->getNameByOffset(offset); + size_t local; + uint size = params->getSizeByOffset(offset); + uint count = params->getCountByOffset(offset); + uint nbComponents = size * count; + if (index) + { + local = allocOffset(index, size, count, params->getTypeByOffset(offset)); + if (!name.empty()) + { + map(index, name); + } + } + else + { + nlassert(!name.empty()); + local = allocOffset(name, size, count, params->getTypeByOffset(offset)); + } + + uint32 *src = params->getPtrUIByOffset(offset); + uint32 *dst = getPtrUIByOffset(local); + + for (uint c = 0; c < nbComponents; ++c) + { + dst[c] = src[c]; + } + + offset = params->getNext(offset); + } +} + +void CGPUProgramParams::set1f(uint index, float f0) +{ + float *f = getPtrFByOffset(allocOffset(index, 1, 1, Float)); + f[0] = f0; +} + +void CGPUProgramParams::set2f(uint index, float f0, float f1) +{ + float *f = getPtrFByOffset(allocOffset(index, 2, 1, Float)); + f[0] = f0; + f[1] = f1; +} + +void CGPUProgramParams::set3f(uint index, float f0, float f1, float f2) +{ + float *f = getPtrFByOffset(allocOffset(index, 3, 1, Float)); + f[0] = f0; + f[1] = f1; + f[2] = f2; +} + +void CGPUProgramParams::set4f(uint index, float f0, float f1, float f2, float f3) +{ + float *f = getPtrFByOffset(allocOffset(index, 4, 1, Float)); + f[0] = f0; + f[1] = f1; + f[2] = f2; + f[3] = f3; +} + +void CGPUProgramParams::set1i(uint index, sint32 i0) +{ + sint32 *i = getPtrIByOffset(allocOffset(index, 1, 1, Int)); + i[0] = i0; +} + +void CGPUProgramParams::set2i(uint index, sint32 i0, sint32 i1) +{ + sint32 *i = getPtrIByOffset(allocOffset(index, 2, 1, Int)); + i[0] = i0; + i[1] = i1; +} + +void CGPUProgramParams::set3i(uint index, sint32 i0, sint32 i1, sint32 i2) +{ + sint32 *i = getPtrIByOffset(allocOffset(index, 3, 1, Int)); + i[0] = i0; + i[1] = i1; + i[2] = i2; +} + +void CGPUProgramParams::set4i(uint index, sint32 i0, sint32 i1, sint32 i2, sint32 i3) +{ + sint32 *i = getPtrIByOffset(allocOffset(index, 4, 1, Int)); + i[0] = i0; + i[1] = i1; + i[2] = i2; + i[3] = i3; +} + +void CGPUProgramParams::set1ui(uint index, uint32 ui0) +{ + uint32 *ui = getPtrUIByOffset(allocOffset(index, 1, 1, UInt)); + ui[0] = ui0; +} + +void CGPUProgramParams::set2ui(uint index, uint32 ui0, uint32 ui1) +{ + uint32 *ui = getPtrUIByOffset(allocOffset(index, 2, 1, UInt)); + ui[0] = ui0; + ui[1] = ui1; +} + +void CGPUProgramParams::set3ui(uint index, uint32 ui0, uint32 ui1, uint32 ui2) +{ + uint32 *ui = getPtrUIByOffset(allocOffset(index, 3, 1, UInt)); + ui[0] = ui0; + ui[1] = ui1; + ui[2] = ui2; +} + +void CGPUProgramParams::set4ui(uint index, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3) +{ + uint32 *ui = getPtrUIByOffset(allocOffset(index, 4, 1, UInt)); + ui[0] = ui0; + ui[1] = ui1; + ui[2] = ui2; + ui[3] = ui3; +} + +void CGPUProgramParams::set3f(uint index, const NLMISC::CVector& v) +{ + float *f = getPtrFByOffset(allocOffset(index, 3, 1, Float)); + f[0] = v.x; + f[1] = v.y; + f[2] = v.z; +} + +void CGPUProgramParams::set4f(uint index, const NLMISC::CVector& v, float f3) +{ + float *f = getPtrFByOffset(allocOffset(index, 4, 1, Float)); + f[0] = v.x; + f[1] = v.y; + f[2] = v.z; + f[3] = f3; +} + +void CGPUProgramParams::set4x4f(uint index, const NLMISC::CMatrix& m) +{ + // TODO: Verify this! + float *f = getPtrFByOffset(allocOffset(index, 4, 4, Float)); + NLMISC::CMatrix mt = m; + mt.transpose(); + mt.get(f); +} + +void CGPUProgramParams::set4fv(uint index, size_t num, const float *src) +{ + float *f = getPtrFByOffset(allocOffset(index, 4, num, Float)); + size_t nb = 4 * num; + for (uint c = 0; c < nb; ++c) + f[c] = src[c]; +} + +void CGPUProgramParams::set4iv(uint index, size_t num, const sint32 *src) +{ + sint32 *i = getPtrIByOffset(allocOffset(index, 4, num, Int)); + size_t nb = 4 * num; + for (uint c = 0; c < nb; ++c) + i[c] = src[c]; +} + +void CGPUProgramParams::set4uiv(uint index, size_t num, const uint32 *src) +{ + uint32 *ui = getPtrUIByOffset(allocOffset(index, 4, num, UInt)); + size_t nb = 4 * num; + for (uint c = 0; c < nb; ++c) + ui[c] = src[c]; +} + +void CGPUProgramParams::unset(uint index) +{ + size_t offset = getOffset(index); + if (offset != getEnd()) + { + freeOffset(offset); + } +} + +void CGPUProgramParams::set1f(const std::string &name, float f0) +{ + float *f = getPtrFByOffset(allocOffset(name, 1, 1, Float)); + f[0] = f0; +} + +void CGPUProgramParams::set2f(const std::string &name, float f0, float f1) +{ + float *f = getPtrFByOffset(allocOffset(name, 2, 1, Float)); + f[0] = f0; + f[1] = f1; +} + +void CGPUProgramParams::set3f(const std::string &name, float f0, float f1, float f2) +{ + float *f = getPtrFByOffset(allocOffset(name, 3, 1, Float)); + f[0] = f0; + f[1] = f1; + f[2] = f2; +} + +void CGPUProgramParams::set4f(const std::string &name, float f0, float f1, float f2, float f3) +{ + float *f = getPtrFByOffset(allocOffset(name, 4, 1, Float)); + f[0] = f0; + f[1] = f1; + f[2] = f2; + f[3] = f3; +} + +void CGPUProgramParams::set1i(const std::string &name, sint32 i0) +{ + sint32 *i = getPtrIByOffset(allocOffset(name, 1, 1, Int)); + i[0] = i0; +} + +void CGPUProgramParams::set2i(const std::string &name, sint32 i0, sint32 i1) +{ + sint32 *i = getPtrIByOffset(allocOffset(name, 2, 1, Int)); + i[0] = i0; + i[1] = i1; +} + +void CGPUProgramParams::set3i(const std::string &name, sint32 i0, sint32 i1, sint32 i2) +{ + sint32 *i = getPtrIByOffset(allocOffset(name, 3, 1, Int)); + i[0] = i0; + i[1] = i1; + i[2] = i2; +} + +void CGPUProgramParams::set4i(const std::string &name, sint32 i0, sint32 i1, sint32 i2, sint32 i3) +{ + sint32 *i = getPtrIByOffset(allocOffset(name, 4, 1, Int)); + i[0] = i0; + i[1] = i1; + i[2] = i2; + i[3] = i3; +} + +void CGPUProgramParams::set1ui(const std::string &name, uint32 ui0) +{ + uint32 *ui = getPtrUIByOffset(allocOffset(name, 1, 1, UInt)); + ui[0] = ui0; +} + +void CGPUProgramParams::set2ui(const std::string &name, uint32 ui0, uint32 ui1) +{ + uint32 *ui = getPtrUIByOffset(allocOffset(name, 2, 1, UInt)); + ui[0] = ui0; + ui[1] = ui1; +} + +void CGPUProgramParams::set3ui(const std::string &name, uint32 ui0, uint32 ui1, uint32 ui2) +{ + uint32 *ui = getPtrUIByOffset(allocOffset(name, 3, 1, UInt)); + ui[0] = ui0; + ui[1] = ui1; + ui[2] = ui2; +} + +void CGPUProgramParams::set4ui(const std::string &name, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3) +{ + uint32 *ui = getPtrUIByOffset(allocOffset(name, 4, 1, UInt)); + ui[0] = ui0; + ui[1] = ui1; + ui[2] = ui2; + ui[3] = ui3; +} + +void CGPUProgramParams::set3f(const std::string &name, const NLMISC::CVector& v) +{ + float *f = getPtrFByOffset(allocOffset(name, 3, 1, Float)); + f[0] = v.x; + f[1] = v.y; + f[2] = v.z; +} + +void CGPUProgramParams::set4f(const std::string &name, const NLMISC::CVector& v, float f3) +{ + float *f = getPtrFByOffset(allocOffset(name, 4, 1, Float)); + f[0] = v.x; + f[1] = v.y; + f[2] = v.z; + f[3] = f3; +} + +void CGPUProgramParams::set4x4f(const std::string &name, const NLMISC::CMatrix& m) +{ + // TODO: Verify this! + float *f = getPtrFByOffset(allocOffset(name, 4, 4, Float)); + NLMISC::CMatrix mt = m; + mt.transpose(); + mt.get(f); +} + +void CGPUProgramParams::set4fv(const std::string &name, size_t num, const float *src) +{ + float *f = getPtrFByOffset(allocOffset(name, 4, num, Float)); + size_t nb = 4 * num; + for (uint c = 0; c < nb; ++c) + f[c] = src[c]; +} + +void CGPUProgramParams::set4iv(const std::string &name, size_t num, const sint32 *src) +{ + sint32 *i = getPtrIByOffset(allocOffset(name, 4, num, Int)); + size_t nb = 4 * num; + for (uint c = 0; c < nb; ++c) + i[c] = src[c]; +} + +void CGPUProgramParams::set4uiv(const std::string &name, size_t num, const uint32 *src) +{ + uint32 *ui = getPtrUIByOffset(allocOffset(name, 4, num, UInt)); + size_t nb = 4 * num; + for (uint c = 0; c < nb; ++c) + ui[c] = src[c]; +} + +void CGPUProgramParams::unset(const std::string &name) +{ + size_t offset = getOffset(name); + if (offset != getEnd()) + { + freeOffset(offset); + } +} + +void CGPUProgramParams::map(uint index, const std::string &name) +{ + size_t offsetIndex = getOffset(index); + size_t offsetName = getOffset(name); + if (offsetName != getEnd()) + { + // Remove possible duplicate + if (offsetIndex != getEnd()) + { + freeOffset(offsetIndex); + } + + // Set index + m_Meta[offsetName].Index = index; + + // Map index to name + if (index >= m_Map.size()) + m_Map.resize(index + 1, s_End); + m_Map[index] = offsetName; + } + else if (offsetIndex != getEnd()) + { + // Set name + m_Meta[offsetIndex].Name = name; + + // Map name to index + m_MapName[name] = offsetIndex; + } +} + +/// Allocate specified number of components if necessary +size_t CGPUProgramParams::allocOffset(uint index, uint size, uint count, TType type) +{ + nlassert(count > 0); // this code will not properly handle 0 + nlassert(size > 0); // this code will not properly handle 0 + nlassert(index < 0xFFFF); // sanity check + + uint nbComponents = size * count; + size_t offset = getOffset(index); + if (offset != s_End) + { + if (getCountByOffset(offset) >= nbComponents) + { + m_Meta[offset].Type = type; + m_Meta[offset].Size = size; + m_Meta[offset].Count = count; + return offset; + } + if (getCountByOffset(offset) < nbComponents) + { + freeOffset(offset); + } + } + + // Allocate space + offset = allocOffset(size, count, type); + + // Fill + m_Meta[offset].Index = index; + + // Store offset in map + if (index >= m_Map.size()) + m_Map.resize(index + 1, s_End); + m_Map[index] = offset; + + return offset; +} + +/// Allocate specified number of components if necessary +size_t CGPUProgramParams::allocOffset(const std::string &name, uint size, uint count, TType type) +{ + nlassert(count > 0); // this code will not properly handle 0 + nlassert(size > 0); // this code will not properly handle 0 + nlassert(!name.empty()); // sanity check + + uint nbComponents = size * count; + size_t offset = getOffset(name); + if (offset != s_End) + { + if (getCountByOffset(offset) >= nbComponents) + { + m_Meta[offset].Type = type; + m_Meta[offset].Size = size; + m_Meta[offset].Count = count; + return offset; + } + if (getCountByOffset(offset) < nbComponents) + { + freeOffset(offset); + } + } + + // Allocate space + offset = allocOffset(size, count, type); + + // Fill + m_Meta[offset].Name = name; + + // Store offset in map + m_MapName[name] = offset; + + return offset; +} + +/// Allocate specified number of components if necessary +size_t CGPUProgramParams::allocOffset(uint size, uint count, TType type) +{ + uint nbComponents = size * count; + + // Allocate space + size_t offset = m_Meta.size(); + uint blocks = getNbRegistersByComponents(nbComponents); // per 4 components + m_Meta.resize(offset + blocks); + m_Vec.resize(offset + blocks); + + // Fill + m_Meta[offset].Size = size; + m_Meta[offset].Count = count; + m_Meta[offset].Type = type; + m_Meta[offset].Prev = m_Last; + m_Meta[offset].Next = s_End; + + // Link + if (m_Last == s_End) + { + m_First = m_Last = offset; + } + else + { + nlassert(m_Meta[m_Last].Next == s_End); // code error otherwise + m_Meta[m_Last].Next = offset; + m_Last = offset; + } + + return offset; +} + +/// Return offset for specified index +size_t CGPUProgramParams::getOffset(uint index) const +{ + if (index >= m_Map.size()) + return s_End; + return m_Map[index]; +} + +size_t CGPUProgramParams::getOffset(const std::string &name) const +{ + std::map::const_iterator it = m_MapName.find(name); + if (it == m_MapName.end()) + return s_End; + return it->second; +} + +/// Remove by offset +void CGPUProgramParams::freeOffset(size_t offset) +{ + uint index = getIndexByOffset(offset); + if (index != ~0) + { + if (m_Map.size() > index) + { + m_Map[index] = getEnd(); + } + } + const std::string &name = getNameByOffset(offset); + if (!name.empty()) + { + if (m_MapName.find(name) != m_MapName.end()) + { + m_MapName.erase(name); + } + } + if (offset == m_Last) + { + nlassert(m_Meta[offset].Next == s_End); + m_Last = m_Meta[offset].Prev; + } + else + { + nlassert(m_Meta[offset].Next != s_End); + m_Meta[m_Meta[offset].Next].Prev = m_Meta[offset].Prev; + } + if (offset == m_First) + { + nlassert(m_Meta[offset].Prev == s_End); + m_First = m_Meta[offset].Next; + } + else + { + nlassert(m_Meta[offset].Prev != s_End); + m_Meta[m_Meta[offset].Prev].Next = m_Meta[offset].Next; + } +} + +} /* namespace NL3D */ + +/* end of file */ diff --git a/code/nel/src/3d/landscape.cpp b/code/nel/src/3d/landscape.cpp index 31f1bb051..154f6f847 100644 --- a/code/nel/src/3d/landscape.cpp +++ b/code/nel/src/3d/landscape.cpp @@ -568,18 +568,21 @@ void CLandscape::clear() void CLandscape::setDriver(IDriver *drv) { nlassert(drv); - if(_Driver != drv) + if (_Driver != drv) { _Driver= drv; // Does the driver support VertexShader??? // only if VP supported by GPU. - _VertexShaderOk= (_Driver->isVertexProgramSupported() && !_Driver->isVertexProgramEmulated()); + _VertexShaderOk = (!_Driver->isVertexProgramEmulated() && ( + _Driver->supportVertexProgram(CVertexProgram::nelvp) + // || _Driver->supportVertexProgram(CVertexProgram::glsl330v) // TODO_VP_GLSL + )); // Does the driver has sufficient requirements for Vegetable??? // only if VP supported by GPU, and Only if max vertices allowed. - _DriverOkForVegetable= _VertexShaderOk && (_Driver->getMaxVerticesByVertexBufferHard()>=(uint)NL3D_LANDSCAPE_VEGETABLE_MAX_AGP_VERTEX_MAX); + _DriverOkForVegetable = _VertexShaderOk && (_Driver->getMaxVerticesByVertexBufferHard()>=(uint)NL3D_LANDSCAPE_VEGETABLE_MAX_AGP_VERTEX_MAX); } } @@ -1193,20 +1196,33 @@ void CLandscape::render(const CVector &refineCenter, const CVector &frontVecto // If VertexShader enabled, setup VertexProgram Constants. - if(_VertexShaderOk) + if (_VertexShaderOk) { - // c[0..3] take the ModelViewProjection Matrix. - driver->setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); - // c[4] take useful constants. - driver->setConstant(4, 0, 1, 0.5f, 0); - // c[5] take RefineCenter - driver->setConstant(5, refineCenter); - // c[6] take info for Geomorph trnasition to TileNear. - driver->setConstant(6, CLandscapeGlobals::TileDistFarSqr, CLandscapeGlobals::OOTileDistDeltaSqr, 0, 0); - // c[10] take the fog vector. - driver->setConstantFog(10); - // c[12] take the current landscape Center / delta Pos to apply - driver->setConstant(12, _PZBModelPosition); + bool uprogstate = driver->isUniformProgramState(); + uint nbvp = uprogstate ? CLandscapeVBAllocator::MaxVertexProgram : 1; + for (uint i = 0; i < nbvp; ++i) + { + CVertexProgramLandscape *program = _TileVB.getVP(i); + if (program) + { + // activate the program to set the uniforms in the program state for all programs + // note: when uniforms are driver state, the indices must be the same across programs + _TileVB.activateVP(i); + + // c[0..3] take the ModelViewProjection Matrix. + driver->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity); + // c[4] take useful constants. + driver->setUniform4f(IDriver::VertexProgram, program->idx().ProgramConstants0, 0, 1, 0.5f, 0); + // c[5] take RefineCenter + driver->setUniform3f(IDriver::VertexProgram, program->idx().RefineCenter, refineCenter); + // c[6] take info for Geomorph trnasition to TileNear. + driver->setUniform2f(IDriver::VertexProgram, program->idx().TileDist, CLandscapeGlobals::TileDistFarSqr, CLandscapeGlobals::OOTileDistDeltaSqr); + // c[10] take the fog vector. + driver->setUniformFog(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::Fog)); + // c[12] take the current landscape Center / delta Pos to apply + driver->setUniform3f(IDriver::VertexProgram, program->idx().PZBModelPosition, _PZBModelPosition); + } + } } diff --git a/code/nel/src/3d/landscapevb_allocator.cpp b/code/nel/src/3d/landscapevb_allocator.cpp index 00cf78f1f..2c30cc19b 100644 --- a/code/nel/src/3d/landscapevb_allocator.cpp +++ b/code/nel/src/3d/landscapevb_allocator.cpp @@ -82,7 +82,10 @@ void CLandscapeVBAllocator::updateDriver(IDriver *driver) deleteVertexProgram(); // Then rebuild VB format, and VertexProgram, if needed. // Do it only if VP supported by GPU. - setupVBFormatAndVertexProgram(_Driver->isVertexProgramSupported() && !_Driver->isVertexProgramEmulated()); + setupVBFormatAndVertexProgram(!_Driver->isVertexProgramEmulated() && ( + _Driver->supportVertexProgram(CVertexProgram::nelvp) + // || _Driver->supportVertexProgram(CVertexProgram::glsl330v) // TODO_VP_GLSL + )); // must reallocate the VertexBuffer. if( _NumVerticesAllocated>0 ) @@ -247,14 +250,23 @@ void CLandscapeVBAllocator::activate(uint vpId) nlassert(_Driver); nlassert(!_BufferLocked); + activateVP(vpId); + + _Driver->activeVertexBuffer(_VB); +} + + +// *************************************************************************** +void CLandscapeVBAllocator::activateVP(uint vpId) +{ + nlassert(_Driver); + // If enabled, activate Vertex program first. - if(_VertexProgram[vpId]) + if (_VertexProgram[vpId]) { //nlinfo("\nSTARTVP\n%s\nENDVP\n", _VertexProgram[vpId]->getProgram().c_str()); nlverify(_Driver->activeVertexProgram(_VertexProgram[vpId])); } - - _Driver->activeVertexBuffer(_VB); } @@ -516,12 +528,11 @@ const char* NL3D_LandscapeTileLightMapEndProgram= // *************************************************************************** void CLandscapeVBAllocator::deleteVertexProgram() { - for(uint i=0;icompileVertexProgram(_VertexProgram[0])); } else if(_Type==Far1) { @@ -577,9 +587,8 @@ void CLandscapeVBAllocator::setupVBFormatAndVertexProgram(bool withVertexProgr _VB.initEx(); // Init the Vertex Program. - string vpgram= string(NL3D_LandscapeCommonStartProgram) + - string(NL3D_LandscapeFar1EndProgram); - _VertexProgram[0]= new CVertexProgram(vpgram.c_str()); + _VertexProgram[0] = new CVertexProgramLandscape(Far1); + nlverify(_Driver->compileVertexProgram(_VertexProgram[0])); } else { @@ -594,20 +603,76 @@ void CLandscapeVBAllocator::setupVBFormatAndVertexProgram(bool withVertexProgr _VB.initEx(); // Init the Vertex Program. - string vpgram= string(NL3D_LandscapeCommonStartProgram) + - string(NL3D_LandscapeTileEndProgram); - _VertexProgram[0]= new CVertexProgram(vpgram.c_str()); + _VertexProgram[0] = new CVertexProgramLandscape(Tile, false); + nlverify(_Driver->compileVertexProgram(_VertexProgram[0])); // Init the Vertex Program for lightmap pass - vpgram= string(NL3D_LandscapeCommonStartProgram) + - string(NL3D_LandscapeTileLightMapEndProgram); - _VertexProgram[1]= new CVertexProgram(vpgram.c_str()); + _VertexProgram[1] = new CVertexProgramLandscape(Tile, true); + nlverify(_Driver->compileVertexProgram(_VertexProgram[1])); } } } +CVertexProgramLandscape::CVertexProgramLandscape(CLandscapeVBAllocator::TType type, bool lightMap) +{ + // nelvp + { + CSource *source = new CSource(); + source->Profile = nelvp; + source->DisplayName = "Landscape/nelvp"; + switch (type) + { + case CLandscapeVBAllocator::Far0: + source->DisplayName += "/far0"; + source->setSource(std::string(NL3D_LandscapeCommonStartProgram) + + std::string(NL3D_LandscapeFar0EndProgram)); + break; + case CLandscapeVBAllocator::Far1: + source->DisplayName += "/far1"; + source->setSource(std::string(NL3D_LandscapeCommonStartProgram) + + std::string(NL3D_LandscapeFar1EndProgram)); + break; + case CLandscapeVBAllocator::Tile: + source->DisplayName += "/tile"; + if (lightMap) + { + source->DisplayName += "/lightmap"; + source->setSource(std::string(NL3D_LandscapeCommonStartProgram) + + std::string(NL3D_LandscapeTileLightMapEndProgram)); + } + else + { + source->setSource(std::string(NL3D_LandscapeCommonStartProgram) + + std::string(NL3D_LandscapeTileEndProgram)); + } + break; + } + source->ParamIndices["modelViewProjection"] = 0; + source->ParamIndices["programConstants0"] = 4; + source->ParamIndices["refineCenter"] = 5; + source->ParamIndices["tileDist"] = 6; + source->ParamIndices["fog"] = 10; + source->ParamIndices["pzbModelPosition"] = 12; + addSource(source); + } + // TODO_VP_GLSL + { + // .... + } +} +void CVertexProgramLandscape::buildInfo() +{ + m_Idx.ProgramConstants0 = getUniformIndex("programConstants0"); + nlassert(m_Idx.ProgramConstants0 != ~0); + m_Idx.RefineCenter = getUniformIndex("refineCenter"); + nlassert(m_Idx.RefineCenter != ~0); + m_Idx.TileDist = getUniformIndex("tileDist"); + nlassert(m_Idx.TileDist != ~0); + m_Idx.PZBModelPosition = getUniformIndex("pzbModelPosition"); + nlassert(m_Idx.PZBModelPosition != ~0); +} } // NL3D diff --git a/code/nel/src/3d/lod_character_shape.cpp b/code/nel/src/3d/lod_character_shape.cpp index 09aded766..6250f2fb5 100644 --- a/code/nel/src/3d/lod_character_shape.cpp +++ b/code/nel/src/3d/lod_character_shape.cpp @@ -264,9 +264,9 @@ void CLodCharacterShapeBuild::compile(const std::vector &triangleSelection void CLodCharacterShapeBuild::serial(NLMISC::IStream &f) { // NEL_CLODBULD - f.serialCheck((uint32)'_LEN'); - f.serialCheck((uint32)'DOLC'); - f.serialCheck((uint32)'DLUB'); + f.serialCheck(NELID("_LEN")); + f.serialCheck(NELID("DOLC")); + f.serialCheck(NELID("DLUB")); /* Version 1: @@ -525,9 +525,9 @@ void CLodCharacterShape::CBoneInfluence::serial(NLMISC::IStream &f) void CLodCharacterShape::serial(NLMISC::IStream &f) { // NEL_CLODSHAP - f.serialCheck((uint32)'_LEN'); - f.serialCheck((uint32)'DOLC'); - f.serialCheck((uint32)'PAHS'); + f.serialCheck(NELID("_LEN")); + f.serialCheck(NELID("DOLC")); + f.serialCheck(NELID("PAHS")); /* Version 1: diff --git a/code/nel/src/3d/material.cpp b/code/nel/src/3d/material.cpp index 4f4386dc3..886f45308 100644 --- a/code/nel/src/3d/material.cpp +++ b/code/nel/src/3d/material.cpp @@ -18,7 +18,6 @@ #include "nel/3d/material.h" #include "nel/3d/texture.h" -#include "nel/3d/shader.h" #include "nel/3d/driver.h" #include "nel/misc/stream.h" diff --git a/code/nel/src/3d/meshvp_per_pixel_light.cpp b/code/nel/src/3d/meshvp_per_pixel_light.cpp index ab84492c4..816c20f3b 100644 --- a/code/nel/src/3d/meshvp_per_pixel_light.cpp +++ b/code/nel/src/3d/meshvp_per_pixel_light.cpp @@ -32,14 +32,13 @@ namespace NL3D { -std::auto_ptr CMeshVPPerPixelLight::_VertexProgram[NumVp]; + +NLMISC::CSmartPtr CMeshVPPerPixelLight::_VertexProgram[NumVp]; // *************************************************************************** // Light VP fragment constants start at 24 static const uint VPLightConstantStart = 24; - - // *************************************************************************** // *************************************************************************** @@ -355,18 +354,36 @@ static const char* PPLightingVPCodeTest = "; ***************************************************************/ - - - -//================================================================================= -void CMeshVPPerPixelLight::initInstance(CMeshBaseInstance *mbi) +class CVertexProgramPerPixelLight : public CVertexProgramLighted { - // init the vertexProgram code. - static bool vpCreated= false; - if(!vpCreated) +public: + struct CIdx { - vpCreated= true; + /// Position or direction of strongest light + uint StrongestLight; + /// Viewer position + uint ViewerPos; + }; + CVertexProgramPerPixelLight(uint vp); + virtual ~CVertexProgramPerPixelLight() { }; + virtual void buildInfo(); + const CIdx &idx() const { return m_Idx; } +private: + CIdx m_Idx; + +}; + +CVertexProgramPerPixelLight::CVertexProgramPerPixelLight(uint vp) +{ + // lighted settings + m_FeaturesLighted.SupportSpecular = (vp & 2) != 0; + m_FeaturesLighted.NumActivePointLights = MaxLight - 1; + m_FeaturesLighted.Normalize = false; + m_FeaturesLighted.CtStartNeLVP = VPLightConstantStart; + + // nelvp + { // Gives each vp name // Bit 0 : 1 when it is a directionnal light // Bit 1 : 1 when specular is needed @@ -389,34 +406,89 @@ void CMeshVPPerPixelLight::initInstance(CMeshBaseInstance *mbi) }; uint numvp = sizeof(vpName) / sizeof(const char *); - nlassert(NumVp == numvp); // make sure that it is in sync with header..todo : compile time assert :) + nlassert(CMeshVPPerPixelLight::NumVp == numvp); // make sure that it is in sync with header..todo : compile time assert :) + + // \todo yoyo TODO_OPTIM Manage different number of pointLights + // NB: never call getLightVPFragmentNeLVP() with normalize, because already done by PerPixel fragment before. + std::string vpCode = std::string(vpName[vp]) + + std::string("# ***************") // temp for debug + + CRenderTrav::getLightVPFragmentNeLVP( + m_FeaturesLighted.NumActivePointLights, + m_FeaturesLighted.CtStartNeLVP, + m_FeaturesLighted.SupportSpecular, + m_FeaturesLighted.Normalize) + + std::string("# ***************") // temp for debug + + std::string(PPLightingVPCodeEnd); + #ifdef NL_DEBUG + /** For test : parse those programs before they are used. + * As a matter of fact some program will works with the NV_VERTEX_PROGRAM extension, + * but won't with EXT_vertex_shader, because there are some limitations (can't read a temp + * register that hasn't been written before..) + */ + CVPParser vpParser; + CVPParser::TProgram result; + std::string parseOutput; + if (!vpParser.parse(vpCode.c_str(), result, parseOutput)) + { + nlwarning(parseOutput.c_str()); + nlassert(0); + } + #endif + + CSource *source = new CSource(); + source->DisplayName = NLMISC::toString("nelvp/MeshVPPerPixel/%i", vp); + source->Profile = CVertexProgram::nelvp; + source->setSource(vpCode); + source->ParamIndices["modelViewProjection"] = 0; + addSource(source); + } + + // glsl + { + // TODO_VP_GLSL + } +} + +void CVertexProgramPerPixelLight::buildInfo() +{ + CVertexProgramLighted::buildInfo(); + if (profile() == nelvp) + { + m_Idx.StrongestLight = 4; + if (m_FeaturesLighted.SupportSpecular) + { + m_Idx.ViewerPos = 5; + } + else + { + m_Idx.ViewerPos = ~0; + } + } + else + { + // TODO_VP_GLSL + } + nlassert(m_Idx.StrongestLight != ~0); + if (m_FeaturesLighted.SupportSpecular) + { + nlassert(m_Idx.ViewerPos != ~0); + } +} + + +//================================================================================= +void CMeshVPPerPixelLight::initInstance(CMeshBaseInstance *mbi) +{ + // init the vertexProgram code. + static bool vpCreated= false; + if (!vpCreated) + { + vpCreated = true; + for (uint vp = 0; vp < NumVp; ++vp) { - // \todo yoyo TODO_OPTIM Manage different number of pointLights - // NB: never call getLightVPFragment() with normalize, because already done by PerPixel fragment before. - std::string vpCode = std::string(vpName[vp]) - + std::string("# ***************") // temp for debug - + CRenderTrav::getLightVPFragment(CRenderTrav::MaxVPLight-1, VPLightConstantStart, (vp & 2) != 0, false) - + std::string("# ***************") // temp for debug - + std::string(PPLightingVPCodeEnd); - #ifdef NL_DEBUG - /** For test : parse those programs before they are used. - * As a matter of fact some program will works with the NV_VERTEX_PROGRAM extension, - * but won't with EXT_vertex_shader, because there are some limitations (can't read a temp - * register that hasn't been written before..) - */ - CVPParser vpParser; - CVPParser::TProgram result; - std::string parseOutput; - if (!vpParser.parse(vpCode.c_str(), result, parseOutput)) - { - nlwarning(parseOutput.c_str()); - nlassert(0); - } - #endif - _VertexProgram[vp]= std::auto_ptr(new CVertexProgram(vpCode.c_str())); + _VertexProgram[vp] = new CVertexProgramPerPixelLight(vp); } - } } @@ -427,21 +499,24 @@ bool CMeshVPPerPixelLight::begin(IDriver *drv, const NLMISC::CVector &viewerPos) { // test if supported by driver - if (! - (drv->isVertexProgramSupported() - && !drv->isVertexProgramEmulated() - && drv->supportPerPixelLighting(SpecularLighting) - ) - ) + if (drv->isVertexProgramEmulated() + || !drv->supportPerPixelLighting(SpecularLighting)) { return false; } // + enable(true, drv); // must enable the vertex program before the vb is activated + CVertexProgramPerPixelLight *program = _ActiveVertexProgram; + if (!program) + { + // failed to compile vertex program + return false; + } + // CRenderTrav *renderTrav= &scene->getRenderTrav(); /// Setup for gouraud lighting - renderTrav->beginVPLightSetup(VPLightConstantStart, - SpecularLighting, - invertedModelMat); + renderTrav->prepareVPLightSetup(); + renderTrav->beginVPLightSetup(program, invertedModelMat); // sint strongestLightIndex = renderTrav->getStrongestLightIndex(); if (strongestLightIndex == -1) return false; // if no strongest light, disable this vertex program @@ -455,7 +530,7 @@ bool CMeshVPPerPixelLight::begin(IDriver *drv, { // put light direction in object space NLMISC::CVector lPos = invertedModelMat.mulVector(strongestLight.getDirection()); - drv->setConstant(4, lPos); + drv->setUniform3f(IDriver::VertexProgram, program->idx().StrongestLight, lPos); _IsPointLight = false; } break; @@ -463,7 +538,7 @@ bool CMeshVPPerPixelLight::begin(IDriver *drv, { // put light in object space NLMISC::CVector lPos = invertedModelMat * strongestLight.getPosition(); - drv->setConstant(4, lPos); + drv->setUniform3f(IDriver::VertexProgram, program->idx().StrongestLight, lPos); _IsPointLight = true; } break; @@ -477,14 +552,12 @@ bool CMeshVPPerPixelLight::begin(IDriver *drv, { // viewer pos in object space NLMISC::CVector vPos = invertedModelMat * viewerPos; - drv->setConstant(5, vPos); + drv->setUniform3f(IDriver::VertexProgram, program->idx().ViewerPos, vPos); } // c[0..3] take the ModelViewProjection Matrix. After setupModelMatrix(); - drv->setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); - // - enable(true, drv); // must enable the vertex program before the vb is activated - // + drv->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity); + return true; } @@ -521,11 +594,19 @@ void CMeshVPPerPixelLight::enable(bool enabled, IDriver *drv) | (SpecularLighting ? 2 : 0) | (_IsPointLight ? 1 : 0); // - drv->activeVertexProgram(_VertexProgram[idVP].get()); + if (drv->activeVertexProgram((CVertexProgramPerPixelLight *)_VertexProgram[idVP])) + { + _ActiveVertexProgram = _VertexProgram[idVP]; + } + else + { + _ActiveVertexProgram = NULL; + } } else { drv->activeVertexProgram(NULL); + _ActiveVertexProgram = NULL; } _Enabled = enabled; } @@ -538,6 +619,8 @@ bool CMeshVPPerPixelLight::setupForMaterial(const CMaterial &mat, ) { bool enabled = (mat.getShader() == CMaterial::PerPixelLighting || mat.getShader() == CMaterial::PerPixelLightingNoSpec); + bool change = (enabled != _Enabled); + enable(enabled, drv); // enable disable the vertex program (for material that don't have the right shader) if (enabled) { CRenderTrav *renderTrav= &scene->getRenderTrav(); @@ -547,8 +630,6 @@ bool CMeshVPPerPixelLight::setupForMaterial(const CMaterial &mat, renderTrav->getStrongestLightColors(pplDiffuse, pplSpecular); drv->setPerPixelLightingLight(pplDiffuse, pplSpecular, mat.getShininess()); } - bool change = (enabled != _Enabled); - enable(enabled, drv); // enable disable the vertex program (for material that don't have the right shader) return change; } //================================================================================= diff --git a/code/nel/src/3d/meshvp_wind_tree.cpp b/code/nel/src/3d/meshvp_wind_tree.cpp index bf04c6096..0d2e91363 100644 --- a/code/nel/src/3d/meshvp_wind_tree.cpp +++ b/code/nel/src/3d/meshvp_wind_tree.cpp @@ -35,11 +35,11 @@ namespace NL3D // *************************************************************************** // Light VP fragment constants start at 24 -static const uint VPLightConstantStart= 24; +static const uint VPLightConstantStart = 24; // *************************************************************************** -std::auto_ptr CMeshVPWindTree::_VertexProgram[CMeshVPWindTree::NumVp]; +NLMISC::CSmartPtr CMeshVPWindTree::_VertexProgram[CMeshVPWindTree::NumVp]; static const char* WindTreeVPCodeWave= "!!VP1.0 \n\ @@ -79,6 +79,83 @@ static const char* WindTreeVPCodeEnd= END \n\ "; + +class CVertexProgramWindTree : public CVertexProgramLighted +{ +public: + struct CIdx + { + uint ProgramConstants[3]; + uint WindLevel1; + uint WindLevel2[4]; + uint WindLevel3[4]; + }; + CVertexProgramWindTree(uint numPls, bool specular, bool normalize); + virtual ~CVertexProgramWindTree() { }; + virtual void buildInfo(); + const CIdx &idx() const { return m_Idx; } + + bool PerMeshSetup; + +private: + CIdx m_Idx; + +}; + +CVertexProgramWindTree::CVertexProgramWindTree(uint numPls, bool specular, bool normalize) +{ + // lighted settings + m_FeaturesLighted.SupportSpecular = specular; + m_FeaturesLighted.NumActivePointLights = numPls; + m_FeaturesLighted.Normalize = normalize; + m_FeaturesLighted.CtStartNeLVP = VPLightConstantStart; + + // constants cache + PerMeshSetup = false; + + // nelvp + { + std::string vpCode = std::string(WindTreeVPCodeWave) + + CRenderTrav::getLightVPFragmentNeLVP(numPls, VPLightConstantStart, specular, normalize) + + WindTreeVPCodeEnd; + + CSource *source = new CSource(); + source->DisplayName = NLMISC::toString("nelvp/MeshVPWindTree/%i/%s/%s", numPls, specular ? "spec" : "nospec", normalize ? "normalize" : "nonormalize"); + source->Profile = CVertexProgram::nelvp; + source->setSource(vpCode); + source->ParamIndices["modelViewProjection"] = 0; + source->ParamIndices["fog"] = 6; + addSource(source); + } + + // TODO_VP_GLSL +} + +void CVertexProgramWindTree::buildInfo() +{ + CVertexProgramLighted::buildInfo(); + if (profile() == nelvp) + { + m_Idx.ProgramConstants[0] = 8; + m_Idx.ProgramConstants[1] = 9; + m_Idx.ProgramConstants[2] = 10; + m_Idx.WindLevel1 = 15; + m_Idx.WindLevel2[0] = 16; + m_Idx.WindLevel2[1] = 17; + m_Idx.WindLevel2[2] = 18; + m_Idx.WindLevel2[3] = 19; + m_Idx.WindLevel3[0] = 20; + m_Idx.WindLevel3[1] = 21; + m_Idx.WindLevel3[2] = 22; + m_Idx.WindLevel3[3] = 23; + } + else + { + // TODO_VP_GLSL + } +} + + // *************************************************************************** float CMeshVPWindTree::speedCos(float angle) { @@ -130,21 +207,17 @@ void CMeshVPWindTree::serial(NLMISC::IStream &f) throw(NLMISC::EStream) f.serial(SpecularLighting); } - -// *************************************************************************** -void CMeshVPWindTree::initInstance(CMeshBaseInstance *mbi) +void CMeshVPWindTree::initVertexPrograms() { // init the vertexProgram code. static bool vpCreated= false; + if(!vpCreated) { vpCreated= true; // All vpcode and begin() written for HrcDepth==3 nlassert(HrcDepth==3); - // combine fragments. - string vpCode; - // For all possible VP. for(uint i=0;i(new CVertexProgram(vpCode.c_str())); + // combine + _VertexProgram[i] = new CVertexProgramWindTree(numPls, normalize, specular); } } +} + +// *************************************************************************** +void CMeshVPWindTree::initInstance(CMeshBaseInstance *mbi) +{ + initVertexPrograms(); // init a random phase. mbi->_VPWindTreePhase= frand(1); @@ -203,21 +279,27 @@ inline void CMeshVPWindTree::setupPerMesh(IDriver *driver, CScene *scene) } } + CVertexProgramWindTree *program = _ActiveVertexProgram; + nlassert(program); + // Setup common constants for each instances. // c[8] take useful constants. - static float ct8[4]= {0, 1, 0.5f, 2}; - driver->setConstant(8, 1, ct8); + driver->setUniform4f(IDriver::VertexProgram, program->idx().ProgramConstants[0], + 0, 1, 0.5f, 2); // c[9] take other useful constants. - static float ct9[4]= {3.f, 0.f, -1.f, -2.f}; - driver->setConstant(9, 1, ct9); + driver->setUniform4f(IDriver::VertexProgram, program->idx().ProgramConstants[1], + 3.f, 0.f, -1.f, -2.f); // c[10] take Number of phase (4) for level2 and 3. -0.01 to avoid int value == 4. - static float ct10[4]= {4-0.01f, 0, 0, 0}; - driver->setConstant(10, 1, ct10); + driver->setUniform4f(IDriver::VertexProgram, program->idx().ProgramConstants[2], + 4-0.01f, 0, 0, 0); } // *************************************************************************** inline void CMeshVPWindTree::setupPerInstanceConstants(IDriver *driver, CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat) { + CVertexProgramWindTree *program = _ActiveVertexProgram; + nlassert(program); + // get instance info float instancePhase= mbi->_VPWindTreePhase; @@ -238,16 +320,18 @@ inline void CMeshVPWindTree::setupPerInstanceConstants(IDriver *driver, CScene setupLighting(scene, mbi, invertedModelMat); // c[0..3] take the ModelViewProjection Matrix. After setupModelMatrix(); - driver->setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); + driver->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::ModelViewProjection), + IDriver::ModelViewProjection, IDriver::Identity); // c[4..7] take the ModelView Matrix. After setupModelMatrix();00 - driver->setConstantFog(6); + driver->setUniformFog(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::Fog)); // c[15] take Wind of level 0. float f; f= _CurrentTime[0] + instancePhase; f= speedCos(f) + Bias[0]; - driver->setConstant(15, maxDeltaPosOS[0]*f ); + driver->setUniform3f(IDriver::VertexProgram, program->idx().WindLevel1, + maxDeltaPosOS[0]*f ); // c[16-19] take Wind of level 1. @@ -255,16 +339,20 @@ inline void CMeshVPWindTree::setupPerInstanceConstants(IDriver *driver, CScene float instTime1= _CurrentTime[1] + instancePhase; // phase 0. f= speedCos( instTime1+0 ) + Bias[1]; - driver->setConstant(16+0, maxDeltaPosOS[1]*f); + driver->setUniform3f(IDriver::VertexProgram, program->idx().WindLevel2[0], + maxDeltaPosOS[1]*f); // phase 1. f= speedCos( instTime1+0.25f ) + Bias[1]; - driver->setConstant(16+1, maxDeltaPosOS[1]*f); + driver->setUniform3f(IDriver::VertexProgram, program->idx().WindLevel2[1], + maxDeltaPosOS[1]*f); // phase 2. f= speedCos( instTime1+0.50f ) + Bias[1]; - driver->setConstant(16+2, maxDeltaPosOS[1]*f); + driver->setUniform3f(IDriver::VertexProgram, program->idx().WindLevel2[2], + maxDeltaPosOS[1]*f); // phase 3. f= speedCos( instTime1+0.75f ) + Bias[1]; - driver->setConstant(16+3, maxDeltaPosOS[1]*f); + driver->setUniform3f(IDriver::VertexProgram, program->idx().WindLevel2[3], + maxDeltaPosOS[1]*f); // c[20, 23] take Wind of level 2. @@ -272,22 +360,54 @@ inline void CMeshVPWindTree::setupPerInstanceConstants(IDriver *driver, CScene float instTime2= _CurrentTime[2] + instancePhase; // phase 0. f= speedCos( instTime2+0 ) + Bias[2]; - driver->setConstant(20+0, maxDeltaPosOS[2]*f); + driver->setUniform3f(IDriver::VertexProgram, program->idx().WindLevel3[0], + maxDeltaPosOS[2]*f); // phase 1. f= speedCos( instTime2+0.25f ) + Bias[2]; - driver->setConstant(20+1, maxDeltaPosOS[2]*f); + driver->setUniform3f(IDriver::VertexProgram, program->idx().WindLevel3[1], + maxDeltaPosOS[2]*f); // phase 2. f= speedCos( instTime2+0.50f ) + Bias[2]; - driver->setConstant(20+2, maxDeltaPosOS[2]*f); + driver->setUniform3f(IDriver::VertexProgram, program->idx().WindLevel3[2], + maxDeltaPosOS[2]*f); // phase 3. f= speedCos( instTime2+0.75f ) + Bias[2]; - driver->setConstant(20+3, maxDeltaPosOS[2]*f); + driver->setUniform3f(IDriver::VertexProgram, program->idx().WindLevel3[3], + maxDeltaPosOS[2]*f); } // *************************************************************************** bool CMeshVPWindTree::begin(IDriver *driver, CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat, const NLMISC::CVector & /*viewerPos*/) { - if (!(driver->isVertexProgramSupported() && !driver->isVertexProgramEmulated())) return false; + if (driver->isVertexProgramEmulated()) return false; + + + // Activate the good VertexProgram + //=============== + + // Get how many pointLights are setuped now. + nlassert(scene != NULL); + CRenderTrav *renderTrav= &scene->getRenderTrav(); + renderTrav->prepareVPLightSetup(); + sint numPls= renderTrav->getNumVPLights()-1; + clamp(numPls, 0, CRenderTrav::MaxVPLight-1); + + + // Enable normalize only if requested by user. Because lighting don't manage correct "scale lighting" + uint idVP= (SpecularLighting?2:0) + (driver->isForceNormalize()?1:0) ; + // correct VP id for correct unmber of pls. + idVP= numPls*4 + idVP; + // activate VP. + if (driver->activeVertexProgram(_VertexProgram[idVP])) + { + _ActiveVertexProgram = _VertexProgram[idVP]; + } + else + { + // vertex program not supported + _ActiveVertexProgram = NULL; + return false; + } // precompute mesh @@ -296,22 +416,7 @@ bool CMeshVPWindTree::begin(IDriver *driver, CScene *scene, CMeshBaseInstance *m // Setup instance constants setupPerInstanceConstants(driver, scene, mbi, invertedModelMat); - // Activate the good VertexProgram - //=============== - // Get how many pointLights are setuped now. - nlassert(scene != NULL); - CRenderTrav *renderTrav= &scene->getRenderTrav(); - sint numPls= renderTrav->getNumVPLights()-1; - clamp(numPls, 0, CRenderTrav::MaxVPLight-1); - - // Enable normalize only if requested by user. Because lighting don't manage correct "scale lighting" - uint idVP= (SpecularLighting?2:0) + (driver->isForceNormalize()?1:0) ; - // correct VP id for correct unmber of pls. - idVP= numPls*4 + idVP; - - // activate VP. - driver->activeVertexProgram(_VertexProgram[idVP].get()); return true; @@ -322,6 +427,7 @@ void CMeshVPWindTree::end(IDriver *driver) { // Disable the VertexProgram driver->activeVertexProgram(NULL); + _ActiveVertexProgram = NULL; } // *************************************************************************** @@ -347,7 +453,8 @@ void CMeshVPWindTree::setupLighting(CScene *scene, CMeshBaseInstance *mbi, const nlassert(scene != NULL); CRenderTrav *renderTrav= &scene->getRenderTrav(); // setup cte for lighting - renderTrav->beginVPLightSetup(VPLightConstantStart, SpecularLighting, invertedModelMat); + CVertexProgramWindTree *program = _ActiveVertexProgram; + renderTrav->beginVPLightSetup(program, invertedModelMat); } @@ -367,47 +474,71 @@ bool CMeshVPWindTree::supportMeshBlockRendering() const // *************************************************************************** bool CMeshVPWindTree::isMBRVpOk(IDriver *driver) const { - return driver->isVertexProgramSupported() && !driver->isVertexProgramEmulated(); + initVertexPrograms(); + + if (driver->isVertexProgramEmulated()) + { + return false; + } + for (uint i = 0; i < NumVp; ++i) + { + if (!driver->compileVertexProgram(_VertexProgram[i])) + { + return false; + } + } + return true; } // *************************************************************************** void CMeshVPWindTree::beginMBRMesh(IDriver *driver, CScene *scene) { - // precompute mesh - setupPerMesh(driver, scene); - /* Since need a VertexProgram Activation before activeVBHard, activate a default one bet the common one will be "NoPointLight, NoSpecular, No ForceNormalize" => 0. */ - _LastMBRIdVP= 0; + _LastMBRIdVP = 0; // activate VP. - driver->activeVertexProgram(_VertexProgram[_LastMBRIdVP].get()); + driver->activeVertexProgram(_VertexProgram[_LastMBRIdVP]); + _ActiveVertexProgram = _VertexProgram[_LastMBRIdVP]; + + // precompute mesh + setupPerMesh(driver, scene); + _VertexProgram[_LastMBRIdVP]->PerMeshSetup = true; } // *************************************************************************** void CMeshVPWindTree::beginMBRInstance(IDriver *driver, CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat) { - // setup first constants for this instance - setupPerInstanceConstants(driver, scene, mbi, invertedModelMat); - // Get how many pointLights are setuped now. nlassert(scene != NULL); CRenderTrav *renderTrav= &scene->getRenderTrav(); + renderTrav->prepareVPLightSetup(); sint numPls= renderTrav->getNumVPLights()-1; clamp(numPls, 0, CRenderTrav::MaxVPLight-1); // Enable normalize only if requested by user. Because lighting don't manage correct "scale lighting" - uint idVP= (SpecularLighting?2:0) + (driver->isForceNormalize()?1:0) ; + uint idVP = (SpecularLighting?2:0) + (driver->isForceNormalize()?1:0) ; // correct VP id for correct number of pls. - idVP= numPls*4 + idVP; + idVP = numPls*4 + idVP; // re-activate VP if idVP different from last setup - if( idVP!=_LastMBRIdVP ) + if(idVP != _LastMBRIdVP) { _LastMBRIdVP= idVP; - driver->activeVertexProgram(_VertexProgram[_LastMBRIdVP].get()); + driver->activeVertexProgram(_VertexProgram[_LastMBRIdVP]); + _ActiveVertexProgram = _VertexProgram[_LastMBRIdVP]; + + if (!_VertexProgram[_LastMBRIdVP]->PerMeshSetup) + { + // precompute mesh + setupPerMesh(driver, scene); + _VertexProgram[_LastMBRIdVP]->PerMeshSetup = true; + } } + + // setup first constants for this instance + setupPerInstanceConstants(driver, scene, mbi, invertedModelMat); } // *************************************************************************** @@ -415,6 +546,7 @@ void CMeshVPWindTree::endMBRMesh(IDriver *driver) { // Disable the VertexProgram driver->activeVertexProgram(NULL); + _ActiveVertexProgram = NULL; } // *************************************************************************** diff --git a/code/nel/src/3d/packed_world.cpp b/code/nel/src/3d/packed_world.cpp index 64b669fc4..15d59c724 100644 --- a/code/nel/src/3d/packed_world.cpp +++ b/code/nel/src/3d/packed_world.cpp @@ -152,7 +152,7 @@ void CPackedWorld::getZones(std::vector &zones) void CPackedWorld::serialZoneNames(NLMISC::IStream &f) throw(NLMISC::EStream) { f.serialVersion(1); - f.serialCheck((uint32) 'OWPA'); + f.serialCheck(NELID("OWPA")); f.serialCont(ZoneNames); } diff --git a/code/nel/src/3d/pixel_program.cpp b/code/nel/src/3d/pixel_program.cpp new file mode 100644 index 000000000..adb2163e5 --- /dev/null +++ b/code/nel/src/3d/pixel_program.cpp @@ -0,0 +1,49 @@ +/** \file pixel_program.cpp + * Pixel program definition + */ + +/* Copyright, 2000, 2001 Nevrax Ltd. + * + * This file is part of NEVRAX NEL. + * NEVRAX NEL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + + * NEVRAX NEL is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with NEVRAX NEL; see the file COPYING. If not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + */ + +#include "std3d.h" + +#include + +#include + +namespace NL3D +{ + +// *************************************************************************** + +CPixelProgram::CPixelProgram() +{ + +} + +// *************************************************************************** + +CPixelProgram::~CPixelProgram () +{ + +} + +// *************************************************************************** + +} // NL3D diff --git a/code/nel/src/3d/program.cpp b/code/nel/src/3d/program.cpp new file mode 100644 index 000000000..facf877fc --- /dev/null +++ b/code/nel/src/3d/program.cpp @@ -0,0 +1,117 @@ +/** + * \file program.cpp + * \brief IProgram + * \date 2013-09-07 15:00GMT + * \author Jan Boon (Kaetemi) + * IProgram + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + */ + +#include +#include + +// STL includes + +// NeL includes +// #include +#include + +// Project includes +#include + +using namespace std; +// using namespace NLMISC; + +namespace NL3D { + +// *************************************************************************** + +IProgramDrvInfos::IProgramDrvInfos(IDriver *drv, ItGPUPrgDrvInfoPtrList it) +{ + _Driver = drv; + _DriverIterator = it; +} + +// *************************************************************************** + +IProgramDrvInfos::~IProgramDrvInfos () +{ + _Driver->removeGPUPrgDrvInfoPtr(_DriverIterator); +} + +// *************************************************************************** + +IProgram::IProgram() +{ + +} + +// *************************************************************************** + +IProgram::~IProgram() +{ + // Must kill the drv mirror of this program. + m_DrvInfo.kill(); +} + +const char *CProgramIndex::Names[NUM_UNIFORMS] = +{ + "modelView", + "modelViewInverse", + "modelViewTranspose", + "modelViewInverseTranspose", + + "projection", + "projectionInverse", + "projectionTranspose", + "projectionInverseTranspose", + + "modelViewProjection", + "modelViewProjectionInverse", + "modelViewProjectionTranspose", + "modelViewProjectionInverseTranspose", + + "fog", +}; + +void IProgram::buildInfo(CSource *source) +{ + nlassert(!m_Source); + + m_Source = source; + + // Fill index cache + for (int i = 0; i < CProgramIndex::NUM_UNIFORMS; ++i) + { + m_Index.Indices[i] = getUniformIndex(m_Index.Names[i]); + } + + buildInfo(); +} + +void IProgram::buildInfo() +{ + +} + +} /* namespace NL3D */ + +/* end of file */ diff --git a/code/nel/src/3d/ps_located.cpp b/code/nel/src/3d/ps_located.cpp index f066b6f3c..9be0baf41 100644 --- a/code/nel/src/3d/ps_located.cpp +++ b/code/nel/src/3d/ps_located.cpp @@ -73,7 +73,7 @@ CPSLocated::CPSLocated() : /*_MaxNumFaces(0),*/ _ParametricMotion(false), _TriggerOnDeath(false), _LastForever(true), - _TriggerID((uint32) 'NONE'), + _TriggerID(NELID("NONE")), _NonIntegrableForceNbRefs(0), _NumIntegrableForceWithDifferentBasis(0) { diff --git a/code/nel/src/3d/ps_particle_basic.cpp b/code/nel/src/3d/ps_particle_basic.cpp index 1cb57d2bc..c2d6b6357 100644 --- a/code/nel/src/3d/ps_particle_basic.cpp +++ b/code/nel/src/3d/ps_particle_basic.cpp @@ -786,7 +786,7 @@ void CPSMultiTexturedParticle::setupMaterial(ITexture *primary, IDriver *driver, /// if bump is used, the matrix must be setupped each time (not a material field) if (!_ForceBasicCaps && isMultiTextureEnabled() && _MainOp == EnvBumpMap) { - if (driver->isTextureAddrModeSupported(CMaterial::OffsetTexture)) + if (driver->supportTextureAddrMode(CMaterial::OffsetTexture)) { CTextureBump *tb = dynamic_cast((ITexture *) _Texture2); if (tb != NULL) @@ -858,7 +858,7 @@ void CPSMultiTexturedParticle::setupMaterial(ITexture *primary, IDriver *driver, } else { - if (!_ForceBasicCaps && (driver->isTextureAddrModeSupported(CMaterial::OffsetTexture) || driver->supportEMBM())) // envbumpmap supported ? + if (!_ForceBasicCaps && (driver->supportTextureAddrMode(CMaterial::OffsetTexture) || driver->supportEMBM())) // envbumpmap supported ? { CTextureBump *tb = dynamic_cast((ITexture *) _Texture2); if (tb != NULL) @@ -917,7 +917,7 @@ void CPSMultiTexturedParticle::setupMultiTexEnv(TOperator op, ITexture *tex1, IT mat.enableTexAddrMode(false); break; case EnvBumpMap: - if (drv.isTextureAddrModeSupported(CMaterial::OffsetTexture)) + if (drv.supportTextureAddrMode(CMaterial::OffsetTexture)) { mat.setTexture(0, tex2); mat.setTexture(1, tex1); @@ -1113,7 +1113,7 @@ void CPSMultiTexturedParticle::enumTexs(std::vector NL_PS_FUNC(CPSMultiTexturedParticle_enumTexs) if (_MainOp == EnvBumpMap && !_ForceBasicCaps) { - if (drv.isTextureAddrModeSupported(CMaterial::OffsetTexture) || drv.supportEMBM()) + if (drv.supportTextureAddrMode(CMaterial::OffsetTexture) || drv.supportEMBM()) { if (_Texture2) dest.push_back(_Texture2); } @@ -1132,7 +1132,7 @@ bool CPSMultiTexturedParticle::isAlternateTextureUsed(IDriver &driver) const NL_PS_FUNC(CPSMultiTexturedParticle_isAlternateTextureUsed) if (!isTouched() && areBasicCapsForcedLocal() == areBasicCapsForced()) return (_MultiTexState & AlternateTextureUsed) != 0; if (_MainOp != EnvBumpMap) return false; - return _ForceBasicCaps || (!driver.isTextureAddrModeSupported(CMaterial::OffsetTexture) && !driver.supportEMBM()); + return _ForceBasicCaps || (!driver.supportTextureAddrMode(CMaterial::OffsetTexture) && !driver.supportEMBM()); } } // NL3D diff --git a/code/nel/src/3d/render_trav.cpp b/code/nel/src/3d/render_trav.cpp index 5cf6fd20e..e7dfe89b1 100644 --- a/code/nel/src/3d/render_trav.cpp +++ b/code/nel/src/3d/render_trav.cpp @@ -760,15 +760,24 @@ void CRenderTrav::changeLightSetup(CLightContribution *lightContribution, bool // *************************************************************************** // *************************************************************************** - -// *************************************************************************** -void CRenderTrav::beginVPLightSetup(uint ctStart, bool supportSpecular, const CMatrix &invObjectWM) +void CRenderTrav::prepareVPLightSetup() { - uint i; nlassert(MaxVPLight==4); _VPNumLights= min(_NumLightEnabled, (uint)MaxVPLight); - _VPCurrentCtStart= ctStart; - _VPSupportSpecular= supportSpecular; + // Must force real light setup at least the first time, in changeVPLightSetupMaterial() + _VPMaterialCacheDirty= true; +} + +// *************************************************************************** +void CRenderTrav::beginVPLightSetup(CVertexProgramLighted *program, const CMatrix &invObjectWM) +{ + uint i; + // nlassert(MaxVPLight==4); + // _VPNumLights= min(_NumLightEnabled, (uint)MaxVPLight); + // _VPCurrentCtStart= ctStart; + // _VPSupportSpecular= supportSpecular; + _VPCurrent = program; + bool supportSpecular = program->featuresLighted().SupportSpecular; // Prepare Colors (to be multiplied by material) //================ @@ -786,8 +795,11 @@ void CRenderTrav::beginVPLightSetup(uint ctStart, bool supportSpecular, const C // reset other to 0. for(; isetConstant(_VPCurrentCtStart+1+i, 0.f, 0.f, 0.f, 0.f); + _VPLightDiffuse[i] = CRGBA::Black; + if (program->idxLighted().Diffuse[i] != ~0) + { + Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Diffuse[i], 0.f, 0.f, 0.f, 0.f); + } } // Specular. _VPCurrentCtStart+5 to 8 (only if supportSpecular) if(supportSpecular) @@ -800,7 +812,10 @@ void CRenderTrav::beginVPLightSetup(uint ctStart, bool supportSpecular, const C for(; isetConstant(_VPCurrentCtStart+5+i, 0.f, 0.f, 0.f, 0.f); + if (program->idxLighted().Specular[i] != ~0) + { + Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Specular[i], 0.f, 0.f, 0.f, 0.f); + } } } @@ -816,40 +831,24 @@ void CRenderTrav::beginVPLightSetup(uint ctStart, bool supportSpecular, const C lightDir= invObjectWM.mulVector(_DriverLight[0].getDirection()); lightDir.normalize(); lightDir= -lightDir; - if(supportSpecular) - { - // Setup lightDir. - Driver->setConstant(_VPCurrentCtStart+9, lightDir); - } - else - { - // Setup lightDir. NB: no specular color! - Driver->setConstant(_VPCurrentCtStart+5, lightDir); - } + Driver->setUniform3f(IDriver::VertexProgram, program->idxLighted().DirOrPos[0], lightDir); // The sun is the same for every instance. // Setup PointLights //================ uint startPLPos; - if(supportSpecular) + if (supportSpecular) { // Setup eye in objectSpace for localViewer - Driver->setConstant(_VPCurrentCtStart+11, eye); - // Start at 12. - startPLPos= 12; - } - else - { - // Start at 6. - startPLPos= 6; + Driver->setUniform3f(IDriver::VertexProgram, program->idxLighted().EyePosition, eye); } // For all pointLight enabled (other are black: don't matter) for(i=1; i<_VPNumLights; i++) { // Setup position of light. CVector lightPos; - lightPos= invObjectWM * _DriverLight[i].getPosition(); - Driver->setConstant(_VPCurrentCtStart+startPLPos+(i-1), lightPos); + lightPos = invObjectWM * _DriverLight[i].getPosition(); + Driver->setUniform3f(IDriver::VertexProgram, program->idxLighted().DirOrPos[i], lightPos); } @@ -860,6 +859,9 @@ void CRenderTrav::beginVPLightSetup(uint ctStart, bool supportSpecular, const C // *************************************************************************** void CRenderTrav::changeVPLightSetupMaterial(const CMaterial &mat, bool excludeStrongest) { + CVertexProgramLighted *program = _VPCurrent; + nlassert(program); + // Must test if at least done one time. if(!_VPMaterialCacheDirty) { @@ -869,7 +871,7 @@ void CRenderTrav::changeVPLightSetupMaterial(const CMaterial &mat, bool exclude _VPMaterialCacheDiffuse == mat.getDiffuse().getPacked() ) { // Same Diffuse part, test if same specular if necessary - if( !_VPSupportSpecular || + if( !program->featuresLighted().SupportSpecular || ( _VPMaterialCacheSpecular == mat.getSpecular().getPacked() && _VPMaterialCacheShininess == mat.getShininess() ) ) { @@ -899,7 +901,7 @@ void CRenderTrav::changeVPLightSetupMaterial(const CMaterial &mat, bool exclude // setup Ambient + Emissive color= _VPFinalAmbient * mat.getAmbient(); color+= mat.getEmissive(); - Driver->setConstant(_VPCurrentCtStart+0, 1, &color.R); + Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Ambient, color); // is the strongest light is not excluded, its index should have been setup to _VPNumLights @@ -908,7 +910,7 @@ void CRenderTrav::changeVPLightSetupMaterial(const CMaterial &mat, bool exclude for(i = 0; i < strongestLightIndex; ++i) { color= _VPLightDiffuse[i] * matDiff; - Driver->setConstant(_VPCurrentCtStart+1+i, 1, &color.R); + Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Diffuse[i], color); } @@ -917,24 +919,24 @@ void CRenderTrav::changeVPLightSetupMaterial(const CMaterial &mat, bool exclude color= _VPLightDiffuse[i] * matDiff; _StrongestLightDiffuse.set((uint8) (255.f * color.R), (uint8) (255.f * color.G), (uint8) (255.f * color.B), (uint8) (255.f * color.A)); // setup strongest light to black for the gouraud part - Driver->setConstant(_VPCurrentCtStart + 1 + i, 0.f, 0.f, 0.f, 0.f); + Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Diffuse[i], 0.f, 0.f, 0.f, 0.f); ++i; // setup other lights for(; i < _VPNumLights; i++) { color= _VPLightDiffuse[i] * matDiff; - Driver->setConstant(_VPCurrentCtStart + 1 + i, 1, &color.R); + Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Diffuse[i], color); } } // setup Specular - if(_VPSupportSpecular) + if (program->featuresLighted().SupportSpecular) { for(i = 0; i < strongestLightIndex; ++i) { color= _VPLightSpecular[i] * matSpec; color.A= specExp; - Driver->setConstant(_VPCurrentCtStart+5+i, 1, &color.R); + Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Specular[i], color); } if (i != _VPNumLights) @@ -943,14 +945,14 @@ void CRenderTrav::changeVPLightSetupMaterial(const CMaterial &mat, bool exclude _StrongestLightSpecular.set((uint8) (255.f * color.R), (uint8) (255.f * color.G), (uint8) (255.f * color.B), (uint8) (255.f * color.A)); // setup strongest light to black (for gouraud part) - Driver->setConstant(_VPCurrentCtStart + 5 + i, 0.f, 0.f, 0.f, 0.f); + Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Specular[i], 0.f, 0.f, 0.f, 0.f); ++i; // setup other lights for(; i < _VPNumLights; i++) { color= _VPLightSpecular[i] * matSpec; color.A= specExp; - Driver->setConstant(_VPCurrentCtStart + 5 + i, 1, &color.R); + Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Specular[i], color); } } } @@ -959,10 +961,7 @@ void CRenderTrav::changeVPLightSetupMaterial(const CMaterial &mat, bool exclude static float alphaCte[4]= {0,0,1,0}; alphaCte[3]= matDiff.A; // setup at good place - if(_VPSupportSpecular) - Driver->setConstant(_VPCurrentCtStart+10, 1, alphaCte); - else - Driver->setConstant(_VPCurrentCtStart+9, 1, alphaCte); + Driver->setUniform4fv(IDriver::VertexProgram, program->idxLighted().DiffuseAlpha, 1, alphaCte); } // *************************************************************************** @@ -1071,9 +1070,9 @@ static const char* LightingVPFragmentSpecular_Begin= \n\ # Compute vertex-to-eye vector normed. \n\ ADD R4, c[CTS+11], -R5; \n\ - DP3 R4.w, R4, R4; \n\ - RSQ R4.w, R4.w; \n\ - MUL R4, R4, R4.w; \n\ + DP3 R1.w, R4, R4; \n\ + RSQ R1.w, R1.w; \n\ + MUL R4, R4, R1.w; \n\ \n\ # Diffuse-Specular Sun \n\ # Compute R1= halfAngleVector= (lightDir+R4).normed(). \n\ @@ -1168,8 +1167,66 @@ static void strReplaceAll(string &strInOut, const string &tokenSrc, const string } } +void CVertexProgramLighted::buildInfo() +{ + CVertexProgram::buildInfo(); + if (profile() == nelvp) + { + // Fixed uniform locations + m_IdxLighted.Ambient = m_FeaturesLighted.CtStartNeLVP + 0; + for (uint i = 0; i < MaxLight; ++i) + { + m_IdxLighted.Diffuse[i] = m_FeaturesLighted.CtStartNeLVP + 1 + i; + } + if (m_FeaturesLighted.SupportSpecular) + { + for (uint i = 0; i < MaxLight; ++i) + { + m_IdxLighted.Specular[i] = m_FeaturesLighted.CtStartNeLVP + 5 + i; + } + m_IdxLighted.DirOrPos[0] = 9; + for (uint i = 1; i < MaxLight; ++i) + { + m_IdxLighted.DirOrPos[i] = m_FeaturesLighted.CtStartNeLVP + (12 - 1) + i; + } + m_IdxLighted.DiffuseAlpha = m_FeaturesLighted.CtStartNeLVP + 10; + m_IdxLighted.EyePosition = m_FeaturesLighted.CtStartNeLVP + 11; + } + else + { + for (uint i = 0; i < MaxLight; ++i) + { + m_IdxLighted.Specular[i] = ~0; + } + for (uint i = 0; i < MaxLight; ++i) + { + m_IdxLighted.DirOrPos[i] = m_FeaturesLighted.CtStartNeLVP + 5 + i; + } + m_IdxLighted.DiffuseAlpha = m_FeaturesLighted.CtStartNeLVP + 9; + m_IdxLighted.EyePosition = ~0; + } + } + else + { + // Named uniform locations + // TODO_VP_GLSL + // m_IdxLighted.Ambient = getUniformIndex("ambient"); + // etc + } + + nlassert(m_IdxLighted.Diffuse[0] != ~0); + if (m_FeaturesLighted.SupportSpecular) + { + nlassert(m_IdxLighted.Specular[0] != ~0); + nlassert(m_IdxLighted.EyePosition != ~0); + } + nlassert(m_IdxLighted.DirOrPos[0] != ~0); + nlassert(m_IdxLighted.DiffuseAlpha != ~0); +} + +// generates the lighting part of a vertex program, nelvp profile // *************************************************************************** -std::string CRenderTrav::getLightVPFragment(uint numActivePointLights, uint ctStart, bool supportSpecular, bool normalize) +std::string CRenderTrav::getLightVPFragmentNeLVP(uint numActivePointLights, uint ctStart, bool supportSpecular, bool normalize) { string ret; diff --git a/code/nel/src/3d/scene.cpp b/code/nel/src/3d/scene.cpp index df5297e2f..fb2d476ac 100644 --- a/code/nel/src/3d/scene.cpp +++ b/code/nel/src/3d/scene.cpp @@ -191,6 +191,8 @@ CScene::CScene(bool bSmallScene) : LightTrav(bSmallScene) _WaterEnvMap = NULL; _GlobalSystemTime= 0.0; + + _RequestParticlesAnimate = false; } // *************************************************************************** void CScene::release() @@ -377,6 +379,13 @@ void CScene::endPartRender() // Reset profiling _NextRenderProfile= false; + IDriver *drv = getDriver(); + drv->activeVertexProgram(NULL); + drv->activePixelProgram(NULL); + drv->activeGeometryProgram(NULL); + + // Ensure nothing animates on subsequent renders + _EllapsedTime = 0.f; /* uint64 total = PSStatsRegisterPSModelObserver + @@ -614,7 +623,11 @@ void CScene::renderPart(UScene::TRenderPart rp, bool doHrcPass) // loadBalance LoadBalancingTrav.traverse(); // - _ParticleSystemManager.processAnimate(_EllapsedTime); // deals with permanently animated particle systems + if (_RequestParticlesAnimate) + { + _ParticleSystemManager.processAnimate(_EllapsedTime); // deals with permanently animated particle systems + _RequestParticlesAnimate = false; + } // Light LightTrav.traverse(); } @@ -860,6 +873,9 @@ void CScene::animate( TGlobalAnimationTime atTime ) // Rendered part are invalidate _RenderedPart = UScene::RenderNothing; + + // Particles are animated later due to dependencies + _RequestParticlesAnimate = true; } @@ -1561,6 +1577,8 @@ void CScene::renderOcclusionTestMeshs() nlassert(RenderTrav.getDriver()); RenderTrav.getDriver()->setupViewport(RenderTrav.getViewport()); RenderTrav.getDriver()->activeVertexProgram(NULL); + RenderTrav.getDriver()->activePixelProgram(NULL); + RenderTrav.getDriver()->activeGeometryProgram(NULL); IDriver::TPolygonMode oldPolygonMode = RenderTrav.getDriver()->getPolygonMode(); CMaterial m; m.initUnlit(); diff --git a/code/nel/src/3d/scene_group.cpp b/code/nel/src/3d/scene_group.cpp index 7cfa56b02..d539278cd 100644 --- a/code/nel/src/3d/scene_group.cpp +++ b/code/nel/src/3d/scene_group.cpp @@ -405,7 +405,7 @@ void CInstanceGroup::serial (NLMISC::IStream& f) * ***********************************************/ // Serial a header - f.serialCheck ((uint32)'TPRG'); + f.serialCheck (NELID("TPRG")); /* Version 5: diff --git a/code/nel/src/3d/shader.cpp b/code/nel/src/3d/shader.cpp deleted file mode 100644 index a0d0c3172..000000000 --- a/code/nel/src/3d/shader.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "std3d.h" - -#include "nel/3d/shader.h" -#include "nel/3d/driver.h" -#include "nel/misc/path.h" -#include "nel/misc/file.h" - -using namespace std; -using namespace NLMISC; - -namespace NL3D -{ - -// *************************************************************************** - -CShader::~CShader() -{ - // Must kill the drv mirror of this shader. - _DrvInfo.kill(); -} - -// *************************************************************************** - -CShader::CShader() -{ - _ShaderChanged = true; -} - -// *************************************************************************** - -void CShader::setText (const char *text) -{ - _Text = text; - _ShaderChanged = true; -} - -// *************************************************************************** - -void CShader::setName (const char *name) -{ - _Name = name; - _ShaderChanged = true; -} - -// *************************************************************************** - -bool CShader::loadShaderFile (const char *filename) -{ - _Text = ""; - // Lookup - string _filename = CPath::lookup(filename, false, true, true); - if (!_filename.empty()) - { - // File length - uint size = CFile::getFileSize (_filename); - _Text.reserve (size+1); - - try - { - CIFile file; - if (file.open (_filename)) - { - // Read it - while (!file.eof ()) - { - char line[512]; - file.getline (line, 512); - _Text += line; - } - - // Set the shader name - _Name = CFile::getFilename (filename); - return true; - } - else - { - nlwarning ("Can't open the file %s for reading", _filename.c_str()); - } - } - catch (const Exception &e) - { - nlwarning ("Error while reading %s : %s", _filename.c_str(), e.what()); - } - } - return false; -} - -// *************************************************************************** - -IShaderDrvInfos::~IShaderDrvInfos() -{ - _Driver->removeShaderDrvInfoPtr(_DriverIterator); -} - -} // NL3D diff --git a/code/nel/src/3d/shadow_map_manager.cpp b/code/nel/src/3d/shadow_map_manager.cpp index 79f4ade20..383a28184 100644 --- a/code/nel/src/3d/shadow_map_manager.cpp +++ b/code/nel/src/3d/shadow_map_manager.cpp @@ -244,11 +244,12 @@ void CShadowMapManager::addShadowReceiver(CTransform *model) void CShadowMapManager::renderGenerate(CScene *scene) { H_AUTO( NL3D_ShadowManager_Generate ); - + // Each frame, do a small garbage collector for unused free textures. garbageShadowTextures(scene); IDriver *driverForShadowGeneration= scene->getRenderTrav().getAuxDriver(); + CSmartPtr previousRenderTarget = driverForShadowGeneration->getRenderTarget(); // Init // ******** @@ -488,7 +489,7 @@ void CShadowMapManager::renderGenerate(CScene *scene) } // Set default render target - driverForShadowGeneration->setRenderTarget (NULL); + driverForShadowGeneration->setRenderTarget (previousRenderTarget); // Allow Writing on all. driverForShadowGeneration->setColorMask(true, true, true, true); diff --git a/code/nel/src/3d/shape.cpp b/code/nel/src/3d/shape.cpp index adc610827..cf61185cd 100644 --- a/code/nel/src/3d/shape.cpp +++ b/code/nel/src/3d/shape.cpp @@ -116,7 +116,7 @@ IShape* CShapeStream::getShapePointer () const void CShapeStream::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { // First, serial an header or checking if it is correct - f.serialCheck ((uint32)'PAHS'); + f.serialCheck (NELID("PAHS")); // Then, serial the shape f.serialPolyPtr (_Shape); diff --git a/code/nel/src/3d/skeleton_weight.cpp b/code/nel/src/3d/skeleton_weight.cpp index 4668a005a..ba037236a 100644 --- a/code/nel/src/3d/skeleton_weight.cpp +++ b/code/nel/src/3d/skeleton_weight.cpp @@ -60,7 +60,7 @@ void CSkeletonWeight::build (const TNodeArray& array) void CSkeletonWeight::serial (NLMISC::IStream& f) { // Serial a header - f.serialCheck ((uint32)'TWKS'); + f.serialCheck (NELID("TWKS")); // Serial a version number (void)f.serialVersion (0); diff --git a/code/nel/src/3d/stereo_debugger.cpp b/code/nel/src/3d/stereo_debugger.cpp new file mode 100644 index 000000000..c5c5e262a --- /dev/null +++ b/code/nel/src/3d/stereo_debugger.cpp @@ -0,0 +1,463 @@ +/** + * \file stereo_debugger.cpp + * \brief CStereoDebugger + * \date 2013-07-03 20:17GMT + * \author Jan Boon (Kaetemi) + * CStereoDebugger + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + */ + +#if !FINAL_VERSION +#include +#include + +// STL includes + +// NeL includes +// #include + +// Project includes +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +// using namespace NLMISC; + +namespace NL3D { + +namespace { + +const char *a_arbfp1 = + "!!ARBfp1.0\n" + "PARAM c[1] = { { 1, 0, 0.5 } };\n" + "TEMP R0;\n" + "TEMP R1;\n" + "TEMP R2;\n" + "TEX R0, fragment.texcoord[0], texture[0], 2D;\n" + "TEX R1, fragment.texcoord[0], texture[1], 2D;\n" + "ADD R2, R0, -R1;\n" + "ADD R1, R0, R1;\n" + "MUL R1, R1, c[0].z;\n" + "ABS R2, R2;\n" + "CMP R2, -R2, c[0].x, c[0].y;\n" + "ADD_SAT R2.x, R2, R2.y;\n" + "ADD_SAT R2.x, R2, R2.z;\n" + "ADD_SAT R2.x, R2, R2.w;\n" + "ABS R2.x, R2;\n" + "CMP R2.x, -R2, c[0].y, c[0];\n" + "ABS R0.x, R2;\n" + "CMP R2.x, -R0, c[0].y, c[0];\n" + "MOV R0.xzw, R1;\n" + "MAD R0.y, R1, c[0].z, c[0].z;\n" + "CMP R0, -R2.x, R1, R0;\n" + "MAD R1.x, R0, c[0].z, c[0].z;\n" + "CMP result.color.x, -R2, R1, R0;\n" + "MOV result.color.yzw, R0;\n" + "END\n"; + +const char *a_ps_2_0 = + "ps_2_0\n" + // cgc version 3.1.0013, build date Apr 18 2012 + // command line args: -profile ps_2_0 + // source file: pp_stereo_debug.cg + //vendor NVIDIA Corporation + //version 3.1.0.13 + //profile ps_2_0 + //program pp_stereo_debug + //semantic pp_stereo_debug.cTex0 : TEX0 + //semantic pp_stereo_debug.cTex1 : TEX1 + //var float2 texCoord : $vin.TEXCOORD0 : TEX0 : 0 : 1 + //var sampler2D cTex0 : TEX0 : texunit 0 : 1 : 1 + //var sampler2D cTex1 : TEX1 : texunit 1 : 2 : 1 + //var float4 oCol : $vout.COLOR : COL : 3 : 1 + //const c[0] = 0 1 0.5 + "dcl_2d s0\n" + "dcl_2d s1\n" + "def c0, 0.00000000, 1.00000000, 0.50000000, 0\n" + "dcl t0.xy\n" + "texld r1, t0, s1\n" + "texld r2, t0, s0\n" + "add r0, r2, -r1\n" + "add r1, r2, r1\n" + "mul r1, r1, c0.z\n" + "abs r0, r0\n" + "cmp r0, -r0, c0.x, c0.y\n" + "add_pp_sat r0.x, r0, r0.y\n" + "add_pp_sat r0.x, r0, r0.z\n" + "add_pp_sat r0.x, r0, r0.w\n" + "abs_pp r0.x, r0\n" + "cmp_pp r0.x, -r0, c0.y, c0\n" + "abs_pp r0.x, r0\n" + "mov r2.xzw, r1\n" + "mad r2.y, r1, c0.z, c0.z\n" + "cmp r2, -r0.x, r1, r2\n" + "mad r1.x, r2, c0.z, c0.z\n" + "mov r0.yzw, r2\n" + "cmp r0.x, -r0, r1, r2\n" + "mov oC0, r0\n"; + +class CStereoDebuggerFactory : public IStereoDeviceFactory +{ +public: + IStereoDisplay *createDevice() const + { + return new CStereoDebugger(); + } +}; + +} /* anonymous namespace */ + +CStereoDebugger::CStereoDebugger() : m_Driver(NULL), m_Stage(0), m_SubStage(0), m_LeftTexU(NULL), m_RightTexU(NULL), m_PixelProgram(NULL) +{ + +} + +CStereoDebugger::~CStereoDebugger() +{ + releaseTextures(); + + if (!m_Mat.empty()) + { + m_Driver->deleteMaterial(m_Mat); + } + + delete m_PixelProgram; + m_PixelProgram = NULL; + + m_Driver = NULL; +} + +/// Sets driver and generates necessary render targets +void CStereoDebugger::setDriver(NL3D::UDriver *driver) +{ + nlassert(!m_PixelProgram); + + m_Driver = driver; + NL3D::IDriver *drvInternal = (static_cast(driver))->getDriver(); + + if (drvInternal->supportBloomEffect() && drvInternal->supportNonPowerOfTwoTextures()) + { + m_PixelProgram = new CPixelProgram(); + // arbfp1 + { + IProgram::CSource *source = new IProgram::CSource(); + source->Features.MaterialFlags = CProgramFeatures::TextureStages; + source->Profile = IProgram::arbfp1; + source->setSourcePtr(a_arbfp1); + m_PixelProgram->addSource(source); + } + // ps_2_0 + { + IProgram::CSource *source = new IProgram::CSource(); + source->Features.MaterialFlags = CProgramFeatures::TextureStages; + source->Profile = IProgram::ps_2_0; + source->setSourcePtr(a_ps_2_0); + m_PixelProgram->addSource(source); + } + if (!drvInternal->compilePixelProgram(m_PixelProgram)) + { + nlwarning("No supported pixel program for stereo debugger"); + + delete m_PixelProgram; + m_PixelProgram = NULL; + } + } + + if (m_PixelProgram) + { + initTextures(); + + m_Mat = m_Driver->createMaterial(); + m_Mat.initUnlit(); + m_Mat.setColor(CRGBA::White); + m_Mat.setBlend (false); + m_Mat.setAlphaTest (false); + NL3D::CMaterial *mat = m_Mat.getObjectPtr(); + mat->setShader(NL3D::CMaterial::Normal); + mat->setBlendFunc(CMaterial::one, CMaterial::zero); + mat->setZWrite(false); + mat->setZFunc(CMaterial::always); + mat->setDoubleSided(true); + + setTextures(); + + m_QuadUV.V0 = CVector(0.f, 0.f, 0.5f); + m_QuadUV.V1 = CVector(1.f, 0.f, 0.5f); + m_QuadUV.V2 = CVector(1.f, 1.f, 0.5f); + m_QuadUV.V3 = CVector(0.f, 1.f, 0.5f); + + m_QuadUV.Uv0 = CUV(0.f, 0.f); + m_QuadUV.Uv1 = CUV(1.f, 0.f); + m_QuadUV.Uv2 = CUV(1.f, 1.f); + m_QuadUV.Uv3 = CUV(0.f, 1.f); + } +} + +void CStereoDebugger::releaseTextures() +{ + if (!m_Mat.empty()) + { + m_Mat.getObjectPtr()->setTexture(0, NULL); + m_Mat.getObjectPtr()->setTexture(1, NULL); + m_Driver->deleteMaterial(m_Mat); + } + + delete m_LeftTexU; + m_LeftTexU = NULL; + m_LeftTex = NULL; // CSmartPtr + + delete m_RightTexU; + m_RightTexU = NULL; + m_RightTex = NULL; // CSmartPtr +} + +void CStereoDebugger::initTextures() +{ + uint32 width, height; + m_Driver->getWindowSize(width, height); + NL3D::IDriver *drvInternal = (static_cast(m_Driver))->getDriver(); + + m_LeftTex = new CTextureBloom(); + m_LeftTex->setRenderTarget(true); + m_LeftTex->setReleasable(false); + m_LeftTex->resize(width, height); + m_LeftTex->setFilterMode(ITexture::Linear, ITexture::LinearMipMapOff); + m_LeftTex->setWrapS(ITexture::Clamp); + m_LeftTex->setWrapT(ITexture::Clamp); + drvInternal->setupTexture(*m_LeftTex); + m_LeftTexU = new CTextureUser(m_LeftTex); + nlassert(!drvInternal->isTextureRectangle(m_LeftTex)); // not allowed + + m_RightTex = new CTextureBloom(); + m_RightTex->setRenderTarget(true); + m_RightTex->setReleasable(false); + m_RightTex->resize(width, height); + m_RightTex->setFilterMode(ITexture::Linear, ITexture::LinearMipMapOff); + m_RightTex->setWrapS(ITexture::Clamp); + m_RightTex->setWrapT(ITexture::Clamp); + drvInternal->setupTexture(*m_RightTex); + m_RightTexU = new CTextureUser(m_RightTex); + nlassert(!drvInternal->isTextureRectangle(m_RightTex)); // not allowed +} + +void CStereoDebugger::setTextures() +{ + NL3D::CMaterial *mat = m_Mat.getObjectPtr(); + mat->setTexture(0, m_LeftTex); + mat->setTexture(1, m_RightTex); +} + +void CStereoDebugger::verifyTextures() +{ + if (m_Driver) + { + uint32 width, height; + m_Driver->getWindowSize(width, height); + if (m_LeftTex->getWidth() != width + || m_RightTex->getWidth() != width + || m_LeftTex->getHeight() != height + || m_RightTex->getHeight() != height) + { + nldebug("Rebuild textures"); + releaseTextures(); + initTextures(); + setTextures(); + } + } +} + +/// Gets the required screen resolution for this device +bool CStereoDebugger::getScreenResolution(uint &width, uint &height) +{ + return false; +} + +/// Set latest camera position etcetera +void CStereoDebugger::updateCamera(uint cid, const NL3D::UCamera *camera) +{ + m_Frustum[cid] = camera->getFrustum(); +} + +/// Get the frustum to use for clipping +void CStereoDebugger::getClippingFrustum(uint cid, NL3D::UCamera *camera) const +{ + // do nothing +} + +/// Is there a next pass +bool CStereoDebugger::nextPass() +{ + if (m_Driver->getPolygonMode() == UDriver::Filled) + { + switch (m_Stage) + { + case 0: + ++m_Stage; + m_SubStage = 0; + return true; + case 1: + ++m_Stage; + m_SubStage = 0; + return true; + case 2: + ++m_Stage; + m_SubStage = 0; + return true; + case 3: + m_Stage = 0; + m_SubStage = 0; + return false; + } + } + else + { + switch (m_Stage) + { + case 0: + ++m_Stage; + m_SubStage = 0; + return true; + case 1: + m_Stage = 0; + m_SubStage = 0; + return false; + } + } + return false; +} + +/// Gets the current viewport +const NL3D::CViewport &CStereoDebugger::getCurrentViewport() const +{ + if (m_Stage % 2) return m_LeftViewport; + else return m_RightViewport; +} + +/// Gets the current camera frustum +const NL3D::CFrustum &CStereoDebugger::getCurrentFrustum(uint cid) const +{ + return m_Frustum[cid]; +} + +/// Gets the current camera frustum +void CStereoDebugger::getCurrentFrustum(uint cid, NL3D::UCamera *camera) const +{ + // do nothing +} + +/// Gets the current camera matrix +void CStereoDebugger::getCurrentMatrix(uint cid, NL3D::UCamera *camera) const +{ + // do nothing +} + +/// At the start of a new render target +bool CStereoDebugger::wantClear() +{ + m_SubStage = 1; + return m_Stage != 3; +} + +/// The 3D scene +bool CStereoDebugger::wantScene() +{ + m_SubStage = 2; + return m_Stage != 3; +} + +/// Interface within the 3D scene +bool CStereoDebugger::wantInterface3D() +{ + m_SubStage = 3; + return m_Stage == 3; +} + +/// 2D Interface +bool CStereoDebugger::wantInterface2D() +{ + m_SubStage = 4; + return m_Stage == 3; +} + +/// Returns true if a new render target was set, always fase if not using render targets +bool CStereoDebugger::beginRenderTarget() +{ + if (m_Stage != 3 && m_Driver && (m_Driver->getPolygonMode() == UDriver::Filled)) + { + if (m_Stage % 2) static_cast(m_Driver)->setRenderTarget(*m_RightTexU, 0, 0, 0, 0); + else static_cast(m_Driver)->setRenderTarget(*m_LeftTexU, 0, 0, 0, 0); + return true; + } + return false; +} + +/// Returns true if a render target was fully drawn, always false if not using render targets +bool CStereoDebugger::endRenderTarget() +{ + if (m_Stage != 3 && m_Driver && (m_Driver->getPolygonMode() == UDriver::Filled)) + { + CTextureUser cu; + (static_cast(m_Driver))->setRenderTarget(cu); + bool fogEnabled = m_Driver->fogEnabled(); + m_Driver->enableFog(false); + + m_Driver->setMatrixMode2D11(); + CViewport vp = CViewport(); + m_Driver->setViewport(vp); + uint32 width, height; + NL3D::IDriver *drvInternal = (static_cast(m_Driver))->getDriver(); + NL3D::CMaterial *mat = m_Mat.getObjectPtr(); + mat->setTexture(0, m_LeftTex); + mat->setTexture(1, m_RightTex); + drvInternal->activePixelProgram(m_PixelProgram); + + m_Driver->drawQuad(m_QuadUV, m_Mat); + + drvInternal->activePixelProgram(NULL); + m_Driver->enableFog(fogEnabled); + + return true; + } + return false; +} + +void CStereoDebugger::listDevices(std::vector &devicesOut) +{ + CStereoDeviceInfo devInfo; + devInfo.Factory = new CStereoDebuggerFactory(); + devInfo.Library = CStereoDeviceInfo::NeL3D; + devInfo.Class = CStereoDeviceInfo::StereoDisplay; + devInfo.Manufacturer = "NeL"; + devInfo.ProductName = "Stereo Debugger"; + devInfo.Serial = "NL-3D-DEBUG"; + devicesOut.push_back(devInfo); +} + +} /* namespace NL3D */ + +#endif /* #if !FINAL_VERSION */ + +/* end of file */ diff --git a/code/nel/src/3d/stereo_display.cpp b/code/nel/src/3d/stereo_display.cpp new file mode 100644 index 000000000..eace867fc --- /dev/null +++ b/code/nel/src/3d/stereo_display.cpp @@ -0,0 +1,112 @@ +/** + * \file stereo_display.cpp + * \brief IStereoDisplay + * \date 2013-06-27 16:29GMT + * \author Jan Boon (Kaetemi) + * IStereoDisplay + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + */ + +#include +#include + +// STL includes + +// NeL includes +// #include + +// Project includes +#include +#include +#include + +using namespace std; +// using namespace NLMISC; + +namespace NL3D { + +IStereoDisplay::IStereoDisplay() +{ + +} + +IStereoDisplay::~IStereoDisplay() +{ + +} + +const char *IStereoDisplay::getLibraryName(CStereoDeviceInfo::TStereoDeviceLibrary library) +{ + static const char *nel3dName = "NeL 3D"; + static const char *ovrName = "Oculus SDK"; + static const char *libvrName = "LibVR"; + static const char *openhmdName = "OpenHMD"; + switch (library) + { + case CStereoDeviceInfo::NeL3D: + return nel3dName; + case CStereoDeviceInfo::OVR: + return ovrName; + case CStereoDeviceInfo::LibVR: + return libvrName; + case CStereoDeviceInfo::OpenHMD: + return openhmdName; + } + nlerror("Invalid device library specified"); + return ""; +} + +void IStereoDisplay::listDevices(std::vector &devicesOut) +{ +#ifdef HAVE_LIBOVR + CStereoOVR::listDevices(devicesOut); +#endif +#ifdef HAVE_LIBVR + CStereoLibVR::listDevices(devicesOut); +#endif +#if !FINAL_VERSION + CStereoDebugger::listDevices(devicesOut); +#endif +} + +IStereoDisplay *IStereoDisplay::createDevice(const CStereoDeviceInfo &deviceInfo) +{ + return deviceInfo.Factory->createDevice(); +} + +void IStereoDisplay::releaseUnusedLibraries() +{ +#ifdef HAVE_LIBOVR + if (!CStereoOVR::isLibraryInUse()) + CStereoOVR::releaseLibrary(); +#endif +} + +void IStereoDisplay::releaseAllLibraries() +{ +#ifdef HAVE_LIBOVR + CStereoOVR::releaseLibrary(); +#endif +} + +} /* namespace NL3D */ + +/* end of file */ diff --git a/code/nel/src/3d/stereo_hmd.cpp b/code/nel/src/3d/stereo_hmd.cpp new file mode 100644 index 000000000..d28017482 --- /dev/null +++ b/code/nel/src/3d/stereo_hmd.cpp @@ -0,0 +1,55 @@ +/** + * \file stereo_hmd.cpp + * \brief IStereoHMD + * \date 2013-06-27 16:30GMT + * \author Jan Boon (Kaetemi) + * IStereoHMD + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + */ + +#include +#include + +// STL includes + +// NeL includes +// #include + +// Project includes + +using namespace std; +// using namespace NLMISC; + +namespace NL3D { + +IStereoHMD::IStereoHMD() +{ + +} + +IStereoHMD::~IStereoHMD() +{ + +} + +} /* namespace NL3D */ + +/* end of file */ diff --git a/code/nel/src/3d/stereo_libvr.cpp b/code/nel/src/3d/stereo_libvr.cpp new file mode 100644 index 000000000..8ce64e07c --- /dev/null +++ b/code/nel/src/3d/stereo_libvr.cpp @@ -0,0 +1,642 @@ +/** + * \file stereo_libvr.cpp + * \brief CStereoLibVR + * \date 2013-08-19 19:17MT + * \author Thibaut Girka (ThibG) + * CStereoLibVR + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + */ + +#ifdef HAVE_LIBVR + +#include +#include +#include + +// STL includes +#include + +// External includes +extern "C" { +#include +} + +// NeL includes +// #include +#include +#include +#include +#include +#include +#include +#include + +// Project includes + +using namespace std; +// using namespace NLMISC; + +namespace NL3D { + +extern const char *g_StereoOVR_fp40; //TODO: what? +extern const char *g_StereoOVR_arbfp1; //TODO: what? +extern const char *g_StereoOVR_ps_2_0; //TODO: what? + +namespace { +sint s_DeviceCounter = 0; +}; + +class CStereoLibVRDeviceHandle : public IStereoDeviceFactory +{ +public: + // fixme: virtual destructor??? + IStereoDisplay *createDevice() const + { + CStereoLibVR *stereo = new CStereoLibVR(this); + if (stereo->isDeviceCreated()) + return stereo; + delete stereo; + return NULL; + } +}; + +class CStereoLibVRDevicePtr +{ +public: + struct hmd *HMDDevice; + struct display_info HMDInfo; + float InterpupillaryDistance; +}; + +CStereoLibVR::CStereoLibVR(const CStereoLibVRDeviceHandle *handle) : m_Stage(0), m_SubStage(0), m_OrientationCached(false), m_Driver(NULL), m_BarrelTexU(NULL), m_PixelProgram(NULL), m_EyePosition(0.0f, 0.09f, 0.15f), m_Scale(1.0f) +{ + struct stereo_config st_conf; + + ++s_DeviceCounter; + // For now, LibVR doesn't support multiple devices... + m_DevicePtr = new CStereoLibVRDevicePtr(); + m_DevicePtr->HMDDevice = hmd_open_first(0); + m_DevicePtr->InterpupillaryDistance = 0.0647; //TODO + + if (m_DevicePtr->HMDDevice) + { + hmd_get_display_info(m_DevicePtr->HMDDevice, &m_DevicePtr->HMDInfo); + hmd_get_stereo_config(m_DevicePtr->HMDDevice, &st_conf); + nldebug("LibVR: HScreenSize: %f, VScreenSize: %f", m_DevicePtr->HMDInfo.h_screen_size, m_DevicePtr->HMDInfo.v_screen_size); + nldebug("LibVR: VScreenCenter: %f", m_DevicePtr->HMDInfo.v_center); + nldebug("LibVR: EyeToScreenDistance: %f", m_DevicePtr->HMDInfo.eye_to_screen[0]); + nldebug("LibVR: LensSeparationDistance: %f", m_DevicePtr->HMDInfo.lens_separation); + nldebug("LibVR: HResolution: %i, VResolution: %i", m_DevicePtr->HMDInfo.h_resolution, m_DevicePtr->HMDInfo.v_resolution); + nldebug("LibVR: DistortionK[0]: %f, DistortionK[1]: %f", m_DevicePtr->HMDInfo.distortion_k[0], m_DevicePtr->HMDInfo.distortion_k[1]); + nldebug("LibVR: DistortionK[2]: %f, DistortionK[3]: %f", m_DevicePtr->HMDInfo.distortion_k[2], m_DevicePtr->HMDInfo.distortion_k[3]); + nldebug("LibVR: Scale: %f", st_conf.distort.scale); + m_LeftViewport.init(0.f, 0.f, 0.5f, 1.0f); + m_RightViewport.init(0.5f, 0.f, 0.5f, 1.0f); + } +} + +CStereoLibVR::~CStereoLibVR() +{ + if (!m_BarrelMat.empty()) + { + m_BarrelMat.getObjectPtr()->setTexture(0, NULL); + m_Driver->deleteMaterial(m_BarrelMat); + } + delete m_BarrelTexU; + m_BarrelTexU = NULL; + m_BarrelTex = NULL; // CSmartPtr + + delete m_PixelProgram; + m_PixelProgram = NULL; + + m_Driver = NULL; + + if (m_DevicePtr->HMDDevice) + hmd_close(m_DevicePtr->HMDDevice); + + delete m_DevicePtr; + m_DevicePtr = NULL; + + --s_DeviceCounter; +} + +void CStereoLibVR::setDriver(NL3D::UDriver *driver) +{ + nlassert(!m_PixelProgram); + + NL3D::IDriver *drvInternal = (static_cast(driver))->getDriver(); + if (drvInternal->supportPixelProgram(CPixelProgram::fp40) && drvInternal->supportBloomEffect() && drvInternal->supportNonPowerOfTwoTextures()) + { + nldebug("VR: fp40"); + m_PixelProgram = new CPixelProgram(g_StereoOVR_fp40); + } + else if (drvInternal->supportPixelProgram(CPixelProgram::arbfp1) && drvInternal->supportBloomEffect() && drvInternal->supportNonPowerOfTwoTextures()) + { + nldebug("VR: arbfp1"); + m_PixelProgram = new CPixelProgram(g_StereoOVR_arbfp1); + } + else if (drvInternal->supportPixelProgram(CPixelProgram::ps_2_0)) + { + nldebug("VR: ps_2_0"); + m_PixelProgram = new CPixelProgram(g_StereoOVR_ps_2_0); + } + + if (m_PixelProgram) + { + m_Driver = driver; + + m_BarrelTex = new CTextureBloom(); // lol bloom + m_BarrelTex->setRenderTarget(true); + m_BarrelTex->setReleasable(false); + m_BarrelTex->resize(m_DevicePtr->HMDInfo.h_resolution, m_DevicePtr->HMDInfo.v_resolution); + m_BarrelTex->setFilterMode(ITexture::Linear, ITexture::LinearMipMapOff); + m_BarrelTex->setWrapS(ITexture::Clamp); + m_BarrelTex->setWrapT(ITexture::Clamp); + drvInternal->setupTexture(*m_BarrelTex); + m_BarrelTexU = new CTextureUser(m_BarrelTex); + + m_BarrelMat = m_Driver->createMaterial(); + m_BarrelMat.initUnlit(); + m_BarrelMat.setColor(CRGBA::White); + m_BarrelMat.setBlend (false); + m_BarrelMat.setAlphaTest (false); + NL3D::CMaterial *barrelMat = m_BarrelMat.getObjectPtr(); + barrelMat->setShader(NL3D::CMaterial::PostProcessing); + barrelMat->setBlendFunc(CMaterial::one, CMaterial::zero); + barrelMat->setZWrite(false); + barrelMat->setZFunc(CMaterial::always); + barrelMat->setDoubleSided(true); + barrelMat->setTexture(0, m_BarrelTex); + + m_BarrelQuadLeft.V0 = CVector(0.f, 0.f, 0.5f); + m_BarrelQuadLeft.V1 = CVector(0.5f, 0.f, 0.5f); + m_BarrelQuadLeft.V2 = CVector(0.5f, 1.f, 0.5f); + m_BarrelQuadLeft.V3 = CVector(0.f, 1.f, 0.5f); + + m_BarrelQuadRight.V0 = CVector(0.5f, 0.f, 0.5f); + m_BarrelQuadRight.V1 = CVector(1.f, 0.f, 0.5f); + m_BarrelQuadRight.V2 = CVector(1.f, 1.f, 0.5f); + m_BarrelQuadRight.V3 = CVector(0.5f, 1.f, 0.5f); + + nlassert(!drvInternal->isTextureRectangle(m_BarrelTex)); // not allowed + + m_BarrelQuadLeft.Uv0 = CUV(0.f, 0.f); + m_BarrelQuadLeft.Uv1 = CUV(0.5f, 0.f); + m_BarrelQuadLeft.Uv2 = CUV(0.5f, 1.f); + m_BarrelQuadLeft.Uv3 = CUV(0.f, 1.f); + + m_BarrelQuadRight.Uv0 = CUV(0.5f, 0.f); + m_BarrelQuadRight.Uv1 = CUV(1.f, 0.f); + m_BarrelQuadRight.Uv2 = CUV(1.f, 1.f); + m_BarrelQuadRight.Uv3 = CUV(0.5f, 1.f); + } + else + { + nlwarning("VR: No pixel program support"); + } +} + +bool CStereoLibVR::getScreenResolution(uint &width, uint &height) +{ + width = m_DevicePtr->HMDInfo.h_resolution; + height = m_DevicePtr->HMDInfo.v_resolution; + return true; +} + +void CStereoLibVR::initCamera(uint cid, const NL3D::UCamera *camera) +{ + struct stereo_config st_conf; + hmd_get_stereo_config(m_DevicePtr->HMDDevice, &st_conf); + + float ar = st_conf.proj.aspect_ratio; + float fov = st_conf.proj.yfov; + m_LeftFrustum[cid].initPerspective(fov, ar, camera->getFrustum().Near, camera->getFrustum().Far); + m_RightFrustum[cid] = m_LeftFrustum[cid]; + + float projectionCenterOffset = st_conf.proj.projection_offset * 0.5 * (m_LeftFrustum[cid].Right - m_LeftFrustum[cid].Left); + nldebug("LibVR: projectionCenterOffset = %f", projectionCenterOffset); + + m_LeftFrustum[cid].Left -= projectionCenterOffset; + m_LeftFrustum[cid].Right -= projectionCenterOffset; + m_RightFrustum[cid].Left += projectionCenterOffset; + m_RightFrustum[cid].Right += projectionCenterOffset; + + // TODO: Clipping frustum should also take into account the IPD + m_ClippingFrustum[cid] = m_LeftFrustum[cid]; + m_ClippingFrustum[cid].Left = min(m_LeftFrustum[cid].Left, m_RightFrustum[cid].Left); + m_ClippingFrustum[cid].Right = max(m_LeftFrustum[cid].Right, m_RightFrustum[cid].Right); +} + +/// Get the frustum to use for clipping +void CStereoLibVR::getClippingFrustum(uint cid, NL3D::UCamera *camera) const +{ + camera->setFrustum(m_ClippingFrustum[cid]); +} + +void CStereoLibVR::updateCamera(uint cid, const NL3D::UCamera *camera) +{ + if (camera->getFrustum().Near != m_LeftFrustum[cid].Near + || camera->getFrustum().Far != m_LeftFrustum[cid].Far) + CStereoLibVR::initCamera(cid, camera); + m_CameraMatrix[cid] = camera->getMatrix(); +} + +bool CStereoLibVR::nextPass() +{ + // Do not allow weird stuff. + uint32 width, height; + m_Driver->getWindowSize(width, height); + nlassert(width == m_DevicePtr->HMDInfo.h_resolution); + nlassert(height == m_DevicePtr->HMDInfo.v_resolution); + + if (m_Driver->getPolygonMode() == UDriver::Filled) + { + switch (m_Stage) + { + case 0: + ++m_Stage; + m_SubStage = 0; + // stage 1: + // (initBloom) + // clear buffer + // draw scene left + return true; + case 1: + ++m_Stage; + m_SubStage = 0; + // stage 2: + // draw scene right + return true; + case 2: + ++m_Stage; + m_SubStage = 0; + // stage 3: + // (endBloom) + // draw interface 3d left + return true; + case 3: + ++m_Stage; + m_SubStage = 0; + // stage 4: + // draw interface 3d right + return true; + case 4: + ++m_Stage; + m_SubStage = 0; + // stage 5: + // (endInterfacesDisplayBloom) + // draw interface 2d left + return true; + case 5: + ++m_Stage; + m_SubStage = 0; + // stage 6: + // draw interface 2d right + return true; + case 6: + m_Stage = 0; + m_SubStage = 0; + // present + m_OrientationCached = false; + return false; + } + } + else + { + switch (m_Stage) + { + case 0: + ++m_Stage; + m_SubStage = 0; + return true; + case 1: + m_Stage = 0; + m_SubStage = 0; + return false; + } + } + nlerror("Invalid stage"); + m_Stage = 0; + m_SubStage = 0; + m_OrientationCached = false; + return false; +} + +const NL3D::CViewport &CStereoLibVR::getCurrentViewport() const +{ + if (m_Stage % 2) return m_LeftViewport; + else return m_RightViewport; +} + +const NL3D::CFrustum &CStereoLibVR::getCurrentFrustum(uint cid) const +{ + if (m_Stage % 2) return m_LeftFrustum[cid]; + else return m_RightFrustum[cid]; +} + +void CStereoLibVR::getCurrentFrustum(uint cid, NL3D::UCamera *camera) const +{ + if (m_Stage % 2) camera->setFrustum(m_LeftFrustum[cid]); + else camera->setFrustum(m_RightFrustum[cid]); +} + +void CStereoLibVR::getCurrentMatrix(uint cid, NL3D::UCamera *camera) const +{ + CMatrix translate; + if (m_Stage % 2) translate.translate(CVector((m_DevicePtr->InterpupillaryDistance * m_Scale) * -0.5f, 0.f, 0.f)); + else translate.translate(CVector((m_DevicePtr->InterpupillaryDistance * m_Scale) * 0.5f, 0.f, 0.f)); + CMatrix mat = m_CameraMatrix[cid] * translate; + if (camera->getTransformMode() == NL3D::UTransformable::RotQuat) + { + camera->setPos(mat.getPos()); + camera->setRotQuat(mat.getRot()); + } + else + { + // camera->setTransformMode(NL3D::UTransformable::DirectMatrix); + camera->setMatrix(mat); + } +} + +bool CStereoLibVR::wantClear() +{ + switch (m_Stage) + { + case 1: + m_SubStage = 1; + return true; + } + return m_Driver->getPolygonMode() != UDriver::Filled; +} + +bool CStereoLibVR::wantScene() +{ + switch (m_Stage) + { + case 1: + case 2: + m_SubStage = 2; + return true; + } + return m_Driver->getPolygonMode() != UDriver::Filled; +} + +bool CStereoLibVR::wantInterface3D() +{ + switch (m_Stage) + { + case 3: + case 4: + m_SubStage = 3; + return true; + } + return m_Driver->getPolygonMode() != UDriver::Filled; +} + +bool CStereoLibVR::wantInterface2D() +{ + switch (m_Stage) + { + case 5: + case 6: + m_SubStage = 4; + return true; + } + return m_Driver->getPolygonMode() != UDriver::Filled; +} + + +/// Returns non-NULL if a new render target was set +bool CStereoLibVR::beginRenderTarget() +{ + // render target always set before driver clear + // nlassert(m_SubStage <= 1); + if (m_Driver && m_Stage == 1 && (m_Driver->getPolygonMode() == UDriver::Filled)) + { + static_cast(m_Driver)->setRenderTarget(*m_BarrelTexU, 0, 0, 0, 0); + return true; + } + return false; +} + +/// Returns true if a render target was fully drawn +bool CStereoLibVR::endRenderTarget() +{ + // after rendering of course + // nlassert(m_SubStage > 1); + if (m_Driver && m_Stage == 6 && (m_Driver->getPolygonMode() == UDriver::Filled)) // set to 4 to turn off distortion of 2d gui + { + struct stereo_config st_conf; + hmd_get_stereo_config(m_DevicePtr->HMDDevice, &st_conf); + CTextureUser cu; + (static_cast(m_Driver))->setRenderTarget(cu); + bool fogEnabled = m_Driver->fogEnabled(); + m_Driver->enableFog(false); + + m_Driver->setMatrixMode2D11(); + CViewport vp = CViewport(); + m_Driver->setViewport(vp); + uint32 width, height; + m_Driver->getWindowSize(width, height); + NL3D::IDriver *drvInternal = (static_cast(m_Driver))->getDriver(); + NL3D::CMaterial *barrelMat = m_BarrelMat.getObjectPtr(); + barrelMat->setTexture(0, m_BarrelTex); + drvInternal->activePixelProgram(m_PixelProgram); + + float w = float(m_BarrelQuadLeft.V1.x),// / float(width), + h = float(m_BarrelQuadLeft.V2.y),// / float(height), + x = float(m_BarrelQuadLeft.V0.x),/// / float(width), + y = float(m_BarrelQuadLeft.V0.y);// / float(height); + + //TODO: stereo_config stuff + float lensViewportShift = st_conf.proj.projection_offset; + + float lensCenterX = x + (w + lensViewportShift * 0.5f) * 0.5f; + float lensCenterY = y + h * 0.5f; + float screenCenterX = x + w * 0.5f; + float screenCenterY = y + h * 0.5f; + float scaleX = (w / 2 / st_conf.distort.scale); + float scaleY = (h / 2 / st_conf.distort.scale); + float scaleInX = (2 / w); + float scaleInY = (2 / h); + drvInternal->setPixelProgramConstant(0, lensCenterX, lensCenterY, 0.f, 0.f); + drvInternal->setPixelProgramConstant(1, screenCenterX, screenCenterY, 0.f, 0.f); + drvInternal->setPixelProgramConstant(2, scaleX, scaleY, 0.f, 0.f); + drvInternal->setPixelProgramConstant(3, scaleInX, scaleInY, 0.f, 0.f); + drvInternal->setPixelProgramConstant(4, 1, st_conf.distort.distortion_k); + + + m_Driver->drawQuad(m_BarrelQuadLeft, m_BarrelMat); + + x = w; + lensCenterX = x + (w - lensViewportShift * 0.5f) * 0.5f; + screenCenterX = x + w * 0.5f; + drvInternal->setPixelProgramConstant(0, lensCenterX, lensCenterY, 0.f, 0.f); + drvInternal->setPixelProgramConstant(1, screenCenterX, screenCenterY, 0.f, 0.f); + + m_Driver->drawQuad(m_BarrelQuadRight, m_BarrelMat); + + drvInternal->activePixelProgram(NULL); + m_Driver->enableFog(fogEnabled); + + return true; + } + return false; +} + +NLMISC::CQuat CStereoLibVR::getOrientation() const +{ + if (m_OrientationCached) + return m_OrientationCache; + + unsigned int t = NLMISC::CTime::getLocalTime(); + hmd_update(m_DevicePtr->HMDDevice, &t); + + float quat[4]; + hmd_get_rotation(m_DevicePtr->HMDDevice, quat); + NLMISC::CMatrix coordsys; + float csys[] = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, -1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }; + coordsys.set(csys); + NLMISC::CMatrix matovr; + matovr.setRot(NLMISC::CQuat(quat[1], quat[2], quat[3], quat[0])); + NLMISC::CMatrix matr; + matr.rotateX(NLMISC::Pi * 0.5f); // fix this properly... :) (note: removing this allows you to use rift while lying down) + NLMISC::CMatrix matnel = matr * matovr * coordsys; + NLMISC::CQuat finalquat = matnel.getRot(); + m_OrientationCache = finalquat; + m_OrientationCached = true; + return finalquat; +} + +/// Get GUI shift +void CStereoLibVR::getInterface2DShift(uint cid, float &x, float &y, float distance) const +{ +#if 0 + + // todo: take into account m_EyePosition + + NLMISC::CVector vector = CVector(0.f, -distance, 0.f); + NLMISC::CQuat rot = getOrientation(); + rot.invert(); + NLMISC::CMatrix mat; + mat.rotate(rot); + //if (m_Stage % 2) mat.translate(CVector(m_DevicePtr->HMDInfo.InterpupillaryDistance * -0.5f, 0.f, 0.f)); + //else mat.translate(CVector(m_DevicePtr->HMDInfo.InterpupillaryDistance * 0.5f, 0.f, 0.f)); + mat.translate(vector); + CVector proj = CStereoOVR::getCurrentFrustum(cid).project(mat.getPos()); + + NLMISC::CVector ipd; + if (m_Stage % 2) ipd = CVector(m_DevicePtr->HMDInfo.InterpupillaryDistance * -0.5f, 0.f, 0.f); + else ipd = CVector(m_DevicePtr->HMDInfo.InterpupillaryDistance * 0.5f, 0.f, 0.f); + CVector projipd = CStereoOVR::getCurrentFrustum(cid).project(vector + ipd); + CVector projvec = CStereoOVR::getCurrentFrustum(cid).project(vector); + + x = (proj.x + projipd.x - projvec.x - 0.5f); + y = (proj.y + projipd.y - projvec.y - 0.5f); + +#elif 1 + + // Alternative method + // todo: take into account m_EyePosition + + NLMISC::CVector vec = CVector(0.f, -distance, 0.f); + NLMISC::CVector ipd; + if (m_Stage % 2) ipd = CVector((m_DevicePtr->InterpupillaryDistance * m_Scale) * -0.5f, 0.f, 0.f); + else ipd = CVector((m_DevicePtr->InterpupillaryDistance * m_Scale) * 0.5f, 0.f, 0.f); + + + NLMISC::CQuat rot = getOrientation(); + NLMISC::CQuat modrot = NLMISC::CQuat(CVector(0.f, 1.f, 0.f), NLMISC::Pi); + rot = rot * modrot; + float p = NLMISC::Pi + atan2f(2.0f * ((rot.x * rot.y) + (rot.z * rot.w)), 1.0f - 2.0f * ((rot.y * rot.y) + (rot.w * rot.w))); + if (p > NLMISC::Pi) p -= NLMISC::Pi * 2.0f; + float t = -atan2f(2.0f * ((rot.x * rot.w) + (rot.y * rot.z)), 1.0f - 2.0f * ((rot.z * rot.z) + (rot.w * rot.w)));// // asinf(2.0f * ((rot.x * rot.z) - (rot.w * rot.y))); + + CVector rotshift = CVector(p, 0.f, t) * -distance; + + CVector proj = CStereoLibVR::getCurrentFrustum(cid).project(vec + ipd + rotshift); + + x = (proj.x - 0.5f); + y = (proj.y - 0.5f); + +#endif +} + +void CStereoLibVR::setEyePosition(const NLMISC::CVector &v) +{ + m_EyePosition = v; +} + +const NLMISC::CVector &CStereoLibVR::getEyePosition() const +{ + return m_EyePosition; +} + +void CStereoLibVR::setScale(float s) +{ + m_EyePosition = m_EyePosition * (s / m_Scale); + m_Scale = s; +} + +void CStereoLibVR::listDevices(std::vector &devicesOut) +{ + // For now, LibVR doesn't support multiple devices + struct hmd *hmd = hmd_open_first(0); + if (hmd) + { + CStereoDeviceInfo deviceInfoOut; + CStereoLibVRDeviceHandle *handle = new CStereoLibVRDeviceHandle(); + deviceInfoOut.Factory = static_cast(handle); + deviceInfoOut.Class = CStereoDeviceInfo::StereoHMD; + deviceInfoOut.Library = CStereoDeviceInfo::LibVR; + //TODO: manufacturer, produc name + //TODO: serial + devicesOut.push_back(deviceInfoOut); + hmd_close(hmd); + } +} + +bool CStereoLibVR::isLibraryInUse() +{ + nlassert(s_DeviceCounter >= 0); + return s_DeviceCounter > 0; +} + +void CStereoLibVR::releaseLibrary() +{ + nlassert(s_DeviceCounter == 0); +} + +bool CStereoLibVR::isDeviceCreated() +{ + return m_DevicePtr->HMDDevice != NULL; +} + +} /* namespace NL3D */ + +#endif /* HAVE_LIBVR */ + +/* end of file */ diff --git a/code/nel/src/3d/stereo_ovr.cpp b/code/nel/src/3d/stereo_ovr.cpp new file mode 100644 index 000000000..46a8d147c --- /dev/null +++ b/code/nel/src/3d/stereo_ovr.cpp @@ -0,0 +1,850 @@ +/** + * \file stereo_ovr.cpp + * \brief CStereoOVR + * \date 2013-06-25 22:22GMT + * \author Jan Boon (Kaetemi) + * CStereoOVR + */ + +/* + * Copyright (C) 2013 by authors + * + * This file is part of NL3D. + * NL3D is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * NL3D is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General + * Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with NL3D. If not, see + * . + * + * Linking this library statically or dynamically with other modules + * is making a combined work based on this library. Thus, the terms + * and conditions of the GNU General Public License cover the whole + * combination. + * + * As a special exception, the copyright holders of this library give + * you permission to link this library with the Oculus SDK to produce + * an executable, regardless of the license terms of the Oculus SDK, + * and distribute linked combinations including the two, provided that + * you also meet the terms and conditions of the license of the Oculus + * SDK. You must obey the GNU General Public License in all respects + * for all of the code used other than the Oculus SDK. If you modify + * this file, you may extend this exception to your version of the + * file, but you are not obligated to do so. If you do not wish to do + * so, delete this exception statement from your version. + */ + +#ifdef HAVE_LIBOVR + +#include +#include + +// STL includes +#include + +// External includes +#include + +// NeL includes +// #include +#include +#include +#include +#include +#include +#include +#include + +// Project includes + +using namespace std; +// using namespace NLMISC; + +namespace NL3D { + +extern const char *g_StereoOVR_fp40; +extern const char *g_StereoOVR_arbfp1; +extern const char *g_StereoOVR_ps_2_0; +extern const char *g_StereoOVR_glsl330f; + +namespace { + +class CStereoOVRLog : public OVR::Log +{ +public: + CStereoOVRLog(unsigned logMask = OVR::LogMask_All) : OVR::Log(logMask) + { + + } + + virtual void LogMessageVarg(OVR::LogMessageType messageType, const char* fmt, va_list argList) + { + if (NLMISC::INelContext::isContextInitialised()) + { + char buffer[MaxLogBufferMessageSize]; + FormatLog(buffer, MaxLogBufferMessageSize, messageType, fmt, argList); + if (IsDebugMessage(messageType)) + NLMISC::INelContext::getInstance().getDebugLog()->displayNL("OVR: %s", buffer); + else + NLMISC::INelContext::getInstance().getInfoLog()->displayNL("OVR: %s", buffer); + } + } +}; + +CStereoOVRLog *s_StereoOVRLog = NULL; +OVR::Ptr s_DeviceManager; + +class CStereoOVRSystem +{ +public: + ~CStereoOVRSystem() + { + Release(); + } + + void Init() + { + if (!s_StereoOVRLog) + { + nldebug("Initialize OVR"); + s_StereoOVRLog = new CStereoOVRLog(); + } + if (!OVR::System::IsInitialized()) + OVR::System::Init(s_StereoOVRLog); + if (!s_DeviceManager) + s_DeviceManager = OVR::DeviceManager::Create(); + } + + void Release() + { + if (s_DeviceManager) + { + nldebug("Release OVR"); + s_DeviceManager->Release(); + } + s_DeviceManager.Clear(); + if (OVR::System::IsInitialized()) + OVR::System::Destroy(); + if (s_StereoOVRLog) + nldebug("Release OVR Ok"); + delete s_StereoOVRLog; + s_StereoOVRLog = NULL; + } +}; + +CStereoOVRSystem s_StereoOVRSystem; + +sint s_DeviceCounter = 0; + +} + +class CStereoOVRDeviceHandle : public IStereoDeviceFactory +{ +public: + // fixme: virtual destructor??? + OVR::DeviceEnumerator DeviceHandle; + IStereoDisplay *createDevice() const + { + CStereoOVR *stereo = new CStereoOVR(this); + if (stereo->isDeviceCreated()) + return stereo; + delete stereo; + return NULL; + } +}; + +class CStereoOVRDevicePtr +{ +public: + OVR::Ptr HMDDevice; + OVR::Ptr SensorDevice; + OVR::SensorFusion SensorFusion; + OVR::HMDInfo HMDInfo; +}; + +CStereoOVR::CStereoOVR(const CStereoOVRDeviceHandle *handle) : m_Stage(0), m_SubStage(0), m_OrientationCached(false), m_Driver(NULL), m_BarrelTexU(NULL), m_PixelProgram(NULL), m_EyePosition(0.0f, 0.09f, 0.15f), m_Scale(1.0f) +{ + ++s_DeviceCounter; + m_DevicePtr = new CStereoOVRDevicePtr(); + + OVR::DeviceEnumerator dh = handle->DeviceHandle; + m_DevicePtr->HMDDevice = dh.CreateDevice(); + + if (m_DevicePtr->HMDDevice) + { + m_DevicePtr->HMDDevice->GetDeviceInfo(&m_DevicePtr->HMDInfo); + nldebug("OVR: HScreenSize: %f, VScreenSize: %f", m_DevicePtr->HMDInfo.HScreenSize, m_DevicePtr->HMDInfo.VScreenSize); + nldebug("OVR: VScreenCenter: %f", m_DevicePtr->HMDInfo.VScreenCenter); + nldebug("OVR: EyeToScreenDistance: %f", m_DevicePtr->HMDInfo.EyeToScreenDistance); + nldebug("OVR: LensSeparationDistance: %f", m_DevicePtr->HMDInfo.LensSeparationDistance); + nldebug("OVR: InterpupillaryDistance: %f", m_DevicePtr->HMDInfo.InterpupillaryDistance); + nldebug("OVR: HResolution: %i, VResolution: %i", m_DevicePtr->HMDInfo.HResolution, m_DevicePtr->HMDInfo.VResolution); + nldebug("OVR: DistortionK[0]: %f, DistortionK[1]: %f", m_DevicePtr->HMDInfo.DistortionK[0], m_DevicePtr->HMDInfo.DistortionK[1]); + nldebug("OVR: DistortionK[2]: %f, DistortionK[3]: %f", m_DevicePtr->HMDInfo.DistortionK[2], m_DevicePtr->HMDInfo.DistortionK[3]); + //2013/06/26 05:31:51 DBG 17a0 snowballs_client.exe stereo_ovr.cpp 160 NL3D::CStereoOVR::CStereoOVR : OVR: HScreenSize: 0.149760, VScreenSize: 0.093600 + //2013/06/26 05:31:51 DBG 17a0 snowballs_client.exe stereo_ovr.cpp 161 NL3D::CStereoOVR::CStereoOVR : OVR: VScreenCenter: 0.046800 + //2013/06/26 05:31:51 DBG 17a0 snowballs_client.exe stereo_ovr.cpp 162 NL3D::CStereoOVR::CStereoOVR : OVR: EyeToScreenDistance: 0.041000 + //2013/06/26 05:31:51 DBG 17a0 snowballs_client.exe stereo_ovr.cpp 163 NL3D::CStereoOVR::CStereoOVR : OVR: LensSeparationDistance: 0.063500 + //2013/06/26 05:31:51 DBG 17a0 snowballs_client.exe stereo_ovr.cpp 164 NL3D::CStereoOVR::CStereoOVR : OVR: InterpupillaryDistance: 0.064000 + //2013/06/26 05:31:51 DBG 17a0 snowballs_client.exe stereo_ovr.cpp 165 NL3D::CStereoOVR::CStereoOVR : OVR: HResolution: 1280, VResolution: 800 + //2013/06/26 05:31:51 DBG 17a0 snowballs_client.exe stereo_ovr.cpp 166 NL3D::CStereoOVR::CStereoOVR : OVR: DistortionK[0]: 1.000000, DistortionK[1]: 0.220000 + //2013/06/26 05:31:51 DBG 17a0 snowballs_client.exe stereo_ovr.cpp 167 NL3D::CStereoOVR::CStereoOVR : OVR: DistortionK[2]: 0.240000, DistortionK[3]: 0.000000 + m_DevicePtr->SensorDevice = m_DevicePtr->HMDDevice->GetSensor(); + m_DevicePtr->SensorFusion.AttachToSensor(m_DevicePtr->SensorDevice); + m_DevicePtr->SensorFusion.SetGravityEnabled(true); + m_DevicePtr->SensorFusion.SetPredictionEnabled(true); + m_DevicePtr->SensorFusion.SetYawCorrectionEnabled(true); + m_LeftViewport.init(0.f, 0.f, 0.5f, 1.0f); + m_RightViewport.init(0.5f, 0.f, 0.5f, 1.0f); + } +} + +CStereoOVR::~CStereoOVR() +{ + if (!m_BarrelMat.empty()) + { + m_BarrelMat.getObjectPtr()->setTexture(0, NULL); + m_Driver->deleteMaterial(m_BarrelMat); + } + delete m_BarrelTexU; + m_BarrelTexU = NULL; + m_BarrelTex = NULL; // CSmartPtr + + delete m_PixelProgram; + m_PixelProgram = NULL; + + m_Driver = NULL; + + if (m_DevicePtr->SensorDevice) + m_DevicePtr->SensorDevice->Release(); + m_DevicePtr->SensorDevice.Clear(); + if (m_DevicePtr->HMDDevice) + m_DevicePtr->HMDDevice->Release(); + m_DevicePtr->HMDDevice.Clear(); + + delete m_DevicePtr; + m_DevicePtr = NULL; + --s_DeviceCounter; +} + +class CPixelProgramOVR : public CPixelProgram +{ +public: + struct COVRIndices + { + uint LensCenter; + uint ScreenCenter; + uint Scale; + uint ScaleIn; + uint HmdWarpParam; + }; + + CPixelProgramOVR() + { + { + CSource *source = new CSource(); + source->Profile = glsl330f; + source->Features.MaterialFlags = CProgramFeatures::TextureStages; + source->setSourcePtr(g_StereoOVR_glsl330f); + addSource(source); + } + { + CSource *source = new CSource(); + source->Profile = fp40; + source->Features.MaterialFlags = CProgramFeatures::TextureStages; + source->setSourcePtr(g_StereoOVR_fp40); + source->ParamIndices["cLensCenter"] = 0; + source->ParamIndices["cScreenCenter"] = 1; + source->ParamIndices["cScale"] = 2; + source->ParamIndices["cScaleIn"] = 3; + source->ParamIndices["cHmdWarpParam"] = 4; + addSource(source); + } + { + CSource *source = new CSource(); + source->Profile = arbfp1; + source->Features.MaterialFlags = CProgramFeatures::TextureStages; + source->setSourcePtr(g_StereoOVR_arbfp1); + source->ParamIndices["cLensCenter"] = 0; + source->ParamIndices["cScreenCenter"] = 1; + source->ParamIndices["cScale"] = 2; + source->ParamIndices["cScaleIn"] = 3; + source->ParamIndices["cHmdWarpParam"] = 4; + addSource(source); + } + { + CSource *source = new CSource(); + source->Profile = ps_2_0; + source->Features.MaterialFlags = CProgramFeatures::TextureStages; + source->setSourcePtr(g_StereoOVR_ps_2_0); + source->ParamIndices["cLensCenter"] = 0; + source->ParamIndices["cScreenCenter"] = 1; + source->ParamIndices["cScale"] = 2; + source->ParamIndices["cScaleIn"] = 3; + source->ParamIndices["cHmdWarpParam"] = 4; + addSource(source); + } + } + + virtual ~CPixelProgramOVR() + { + + } + + virtual void buildInfo() + { + CPixelProgram::buildInfo(); + + m_OVRIndices.LensCenter = getUniformIndex("cLensCenter"); + nlassert(m_OVRIndices.LensCenter != ~0); + m_OVRIndices.ScreenCenter = getUniformIndex("cScreenCenter"); + nlassert(m_OVRIndices.ScreenCenter != ~0); + m_OVRIndices.Scale = getUniformIndex("cScale"); + nlassert(m_OVRIndices.Scale != ~0); + m_OVRIndices.ScaleIn = getUniformIndex("cScaleIn"); + nlassert(m_OVRIndices.ScaleIn != ~0); + m_OVRIndices.HmdWarpParam = getUniformIndex("cHmdWarpParam"); + nlassert(m_OVRIndices.HmdWarpParam != ~0); + } + + inline const COVRIndices &ovrIndices() { return m_OVRIndices; } + +private: + COVRIndices m_OVRIndices; + +}; + +void CStereoOVR::setDriver(NL3D::UDriver *driver) +{ + nlassert(!m_PixelProgram); + + NL3D::IDriver *drvInternal = (static_cast(driver))->getDriver(); + + if (drvInternal->supportBloomEffect() && drvInternal->supportNonPowerOfTwoTextures()) + { + m_PixelProgram = new CPixelProgramOVR(); + if (!drvInternal->compilePixelProgram(m_PixelProgram)) + { + m_PixelProgram.kill(); + } + } + + if (m_PixelProgram) + { + m_Driver = driver; + + m_BarrelTex = new CTextureBloom(); // lol bloom + m_BarrelTex->setRenderTarget(true); + m_BarrelTex->setReleasable(false); + m_BarrelTex->resize(m_DevicePtr->HMDInfo.HResolution, m_DevicePtr->HMDInfo.VResolution); + m_BarrelTex->setFilterMode(ITexture::Linear, ITexture::LinearMipMapOff); + m_BarrelTex->setWrapS(ITexture::Clamp); + m_BarrelTex->setWrapT(ITexture::Clamp); + drvInternal->setupTexture(*m_BarrelTex); + m_BarrelTexU = new CTextureUser(m_BarrelTex); + + m_BarrelMat = m_Driver->createMaterial(); + m_BarrelMat.initUnlit(); + m_BarrelMat.setColor(CRGBA::White); + m_BarrelMat.setBlend (false); + m_BarrelMat.setAlphaTest (false); + NL3D::CMaterial *barrelMat = m_BarrelMat.getObjectPtr(); + barrelMat->setShader(NL3D::CMaterial::Normal); + barrelMat->setBlendFunc(CMaterial::one, CMaterial::zero); + barrelMat->setZWrite(false); + barrelMat->setZFunc(CMaterial::always); + barrelMat->setDoubleSided(true); + barrelMat->setTexture(0, m_BarrelTex); + + m_BarrelQuadLeft.V0 = CVector(0.f, 0.f, 0.5f); + m_BarrelQuadLeft.V1 = CVector(0.5f, 0.f, 0.5f); + m_BarrelQuadLeft.V2 = CVector(0.5f, 1.f, 0.5f); + m_BarrelQuadLeft.V3 = CVector(0.f, 1.f, 0.5f); + + m_BarrelQuadRight.V0 = CVector(0.5f, 0.f, 0.5f); + m_BarrelQuadRight.V1 = CVector(1.f, 0.f, 0.5f); + m_BarrelQuadRight.V2 = CVector(1.f, 1.f, 0.5f); + m_BarrelQuadRight.V3 = CVector(0.5f, 1.f, 0.5f); + + nlassert(!drvInternal->isTextureRectangle(m_BarrelTex)); // not allowed + + m_BarrelQuadLeft.Uv0 = CUV(0.f, 0.f); + m_BarrelQuadLeft.Uv1 = CUV(0.5f, 0.f); + m_BarrelQuadLeft.Uv2 = CUV(0.5f, 1.f); + m_BarrelQuadLeft.Uv3 = CUV(0.f, 1.f); + + m_BarrelQuadRight.Uv0 = CUV(0.5f, 0.f); + m_BarrelQuadRight.Uv1 = CUV(1.f, 0.f); + m_BarrelQuadRight.Uv2 = CUV(1.f, 1.f); + m_BarrelQuadRight.Uv3 = CUV(0.5f, 1.f); + } + else + { + nlwarning("VR: No pixel program support"); + } +} + +bool CStereoOVR::getScreenResolution(uint &width, uint &height) +{ + width = m_DevicePtr->HMDInfo.HResolution; + height = m_DevicePtr->HMDInfo.VResolution; + return true; +} + +void CStereoOVR::initCamera(uint cid, const NL3D::UCamera *camera) +{ + float ar = (float)m_DevicePtr->HMDInfo.HResolution / ((float)m_DevicePtr->HMDInfo.VResolution * 2.0f); + float fov = 2.0f * atanf((m_DevicePtr->HMDInfo.HScreenSize * 0.5f * 0.5f) / (m_DevicePtr->HMDInfo.EyeToScreenDistance)); //(float)NLMISC::Pi/2.f; // 2.0f * atanf(m_DevicePtr->HMDInfo.VScreenSize / 2.0f * m_DevicePtr->HMDInfo.EyeToScreenDistance); + m_LeftFrustum[cid].initPerspective(fov, ar, camera->getFrustum().Near, camera->getFrustum().Far); + m_RightFrustum[cid] = m_LeftFrustum[cid]; + + float viewCenter = m_DevicePtr->HMDInfo.HScreenSize * 0.25f; + float eyeProjectionShift = viewCenter - m_DevicePtr->HMDInfo.LensSeparationDistance * 0.5f; // docs say LensSeparationDistance, why not InterpupillaryDistance? related to how the lenses work? + float projectionCenterOffset = (eyeProjectionShift / (m_DevicePtr->HMDInfo.HScreenSize * 0.5f)) * (m_LeftFrustum[cid].Right - m_LeftFrustum[cid].Left); // used logic for this one, but it ends up being the same as the one i made up + nldebug("OVR: projectionCenterOffset = %f", projectionCenterOffset); + + m_LeftFrustum[cid].Left -= projectionCenterOffset; + m_LeftFrustum[cid].Right -= projectionCenterOffset; + m_RightFrustum[cid].Left += projectionCenterOffset; + m_RightFrustum[cid].Right += projectionCenterOffset; + + // TODO: Clipping frustum should also take into account the IPD + m_ClippingFrustum[cid] = m_LeftFrustum[cid]; + m_ClippingFrustum[cid].Left = min(m_LeftFrustum[cid].Left, m_RightFrustum[cid].Left); + m_ClippingFrustum[cid].Right = max(m_LeftFrustum[cid].Right, m_RightFrustum[cid].Right); +} + +/// Get the frustum to use for clipping +void CStereoOVR::getClippingFrustum(uint cid, NL3D::UCamera *camera) const +{ + camera->setFrustum(m_ClippingFrustum[cid]); +} + +void CStereoOVR::updateCamera(uint cid, const NL3D::UCamera *camera) +{ + if (camera->getFrustum().Near != m_LeftFrustum[cid].Near + || camera->getFrustum().Far != m_LeftFrustum[cid].Far) + CStereoOVR::initCamera(cid, camera); + m_CameraMatrix[cid] = camera->getMatrix(); +} + +bool CStereoOVR::nextPass() +{ + // Do not allow weird stuff. + uint32 width, height; + m_Driver->getWindowSize(width, height); + nlassert(width == m_DevicePtr->HMDInfo.HResolution); + nlassert(height == m_DevicePtr->HMDInfo.VResolution); + + if (m_Driver->getPolygonMode() == UDriver::Filled) + { + switch (m_Stage) + { + case 0: + ++m_Stage; + m_SubStage = 0; + // stage 1: + // (initBloom) + // clear buffer + // draw scene left + return true; + case 1: + ++m_Stage; + m_SubStage = 0; + // stage 2: + // draw scene right + return true; + case 2: + ++m_Stage; + m_SubStage = 0; + // stage 3: + // (endBloom) + // draw interface 3d left + return true; + case 3: + ++m_Stage; + m_SubStage = 0; + // stage 4: + // draw interface 3d right + return true; + case 4: + ++m_Stage; + m_SubStage = 0; + // stage 5: + // (endInterfacesDisplayBloom) + // draw interface 2d left + return true; + case 5: + ++m_Stage; + m_SubStage = 0; + // stage 6: + // draw interface 2d right + return true; + case 6: + m_Stage = 0; + m_SubStage = 0; + // present + m_OrientationCached = false; + return false; + } + } + else + { + switch (m_Stage) + { + case 0: + ++m_Stage; + m_SubStage = 0; + return true; + case 1: + m_Stage = 0; + m_SubStage = 0; + return false; + } + } + nlerror("Invalid stage"); + m_Stage = 0; + m_SubStage = 0; + m_OrientationCached = false; + return false; +} + +const NL3D::CViewport &CStereoOVR::getCurrentViewport() const +{ + if (m_Stage % 2) return m_LeftViewport; + else return m_RightViewport; +} + +const NL3D::CFrustum &CStereoOVR::getCurrentFrustum(uint cid) const +{ + if (m_Stage % 2) return m_LeftFrustum[cid]; + else return m_RightFrustum[cid]; +} + +void CStereoOVR::getCurrentFrustum(uint cid, NL3D::UCamera *camera) const +{ + if (m_Stage % 2) camera->setFrustum(m_LeftFrustum[cid]); + else camera->setFrustum(m_RightFrustum[cid]); +} + +void CStereoOVR::getCurrentMatrix(uint cid, NL3D::UCamera *camera) const +{ + CMatrix translate; + if (m_Stage % 2) translate.translate(CVector((m_DevicePtr->HMDInfo.InterpupillaryDistance * m_Scale) * -0.5f, 0.f, 0.f)); + else translate.translate(CVector((m_DevicePtr->HMDInfo.InterpupillaryDistance * m_Scale) * 0.5f, 0.f, 0.f)); + CMatrix mat = m_CameraMatrix[cid] * translate; + if (camera->getTransformMode() == NL3D::UTransformable::RotQuat) + { + camera->setPos(mat.getPos()); + camera->setRotQuat(mat.getRot()); + } + else + { + // camera->setTransformMode(NL3D::UTransformable::DirectMatrix); + camera->setMatrix(mat); + } +} + +bool CStereoOVR::wantClear() +{ + switch (m_Stage) + { + case 1: + m_SubStage = 1; + return true; + } + return m_Driver->getPolygonMode() != UDriver::Filled; +} + +bool CStereoOVR::wantScene() +{ + switch (m_Stage) + { + case 1: + case 2: + m_SubStage = 2; + return true; + } + return m_Driver->getPolygonMode() != UDriver::Filled; +} + +bool CStereoOVR::wantInterface3D() +{ + switch (m_Stage) + { + case 3: + case 4: + m_SubStage = 3; + return true; + } + return m_Driver->getPolygonMode() != UDriver::Filled; +} + +bool CStereoOVR::wantInterface2D() +{ + switch (m_Stage) + { + case 5: + case 6: + m_SubStage = 4; + return true; + } + return m_Driver->getPolygonMode() != UDriver::Filled; +} + + +/// Returns non-NULL if a new render target was set +bool CStereoOVR::beginRenderTarget() +{ + // render target always set before driver clear + // nlassert(m_SubStage <= 1); + if (m_Driver && m_Stage == 1 && (m_Driver->getPolygonMode() == UDriver::Filled)) + { + static_cast(m_Driver)->setRenderTarget(*m_BarrelTexU, 0, 0, 0, 0); + return true; + } + return false; +} + +/// Returns true if a render target was fully drawn +bool CStereoOVR::endRenderTarget() +{ + // after rendering of course + // nlassert(m_SubStage > 1); + if (m_Driver && m_Stage == 6 && (m_Driver->getPolygonMode() == UDriver::Filled)) // set to 4 to turn off distortion of 2d gui + { + CTextureUser cu; + (static_cast(m_Driver))->setRenderTarget(cu); + bool fogEnabled = m_Driver->fogEnabled(); + m_Driver->enableFog(false); + + m_Driver->setMatrixMode2D11(); + CViewport vp = CViewport(); + m_Driver->setViewport(vp); + uint32 width, height; + m_Driver->getWindowSize(width, height); + NL3D::IDriver *drvInternal = (static_cast(m_Driver))->getDriver(); + NL3D::CMaterial *barrelMat = m_BarrelMat.getObjectPtr(); + barrelMat->setTexture(0, m_BarrelTex); + + drvInternal->activePixelProgram(m_PixelProgram); + + float w = float(m_BarrelQuadLeft.V1.x),// / float(width), + h = float(m_BarrelQuadLeft.V2.y),// / float(height), + x = float(m_BarrelQuadLeft.V0.x),/// / float(width), + y = float(m_BarrelQuadLeft.V0.y);// / float(height); + + float lensOffset = m_DevicePtr->HMDInfo.LensSeparationDistance * 0.5f; + float lensShift = m_DevicePtr->HMDInfo.HScreenSize * 0.25f - lensOffset; + float lensViewportShift = 4.0f * lensShift / m_DevicePtr->HMDInfo.HScreenSize; + + float lensCenterX = x + (w + lensViewportShift * 0.5f) * 0.5f; + float lensCenterY = y + h * 0.5f; + float screenCenterX = x + w * 0.5f; + float screenCenterY = y + h * 0.5f; + float scaleX = (w / 2); + float scaleY = (h / 2); + float scaleInX = (2 / w); + float scaleInY = (2 / h); + + + drvInternal->setUniform2f(IDriver::PixelProgram, + m_PixelProgram->ovrIndices().LensCenter, + lensCenterX, lensCenterY); + + drvInternal->setUniform2f(IDriver::PixelProgram, + m_PixelProgram->ovrIndices().ScreenCenter, + screenCenterX, screenCenterY); + + drvInternal->setUniform2f(IDriver::PixelProgram, + m_PixelProgram->ovrIndices().Scale, + scaleX, scaleY); + + drvInternal->setUniform2f(IDriver::PixelProgram, + m_PixelProgram->ovrIndices().ScaleIn, + scaleInX, scaleInY); + + + drvInternal->setUniform4fv(IDriver::PixelProgram, + m_PixelProgram->ovrIndices().HmdWarpParam, + 1, m_DevicePtr->HMDInfo.DistortionK); + + m_Driver->drawQuad(m_BarrelQuadLeft, m_BarrelMat); + + x = w; + lensCenterX = x + (w - lensViewportShift * 0.5f) * 0.5f; + screenCenterX = x + w * 0.5f; + + + drvInternal->setUniform2f(IDriver::PixelProgram, + m_PixelProgram->ovrIndices().LensCenter, + lensCenterX, lensCenterY); + + drvInternal->setUniform2f(IDriver::PixelProgram, + m_PixelProgram->ovrIndices().ScreenCenter, + screenCenterX, screenCenterY); + + + m_Driver->drawQuad(m_BarrelQuadRight, m_BarrelMat); + + drvInternal->activePixelProgram(NULL); + m_Driver->enableFog(fogEnabled); + + return true; + } + return false; +} + +NLMISC::CQuat CStereoOVR::getOrientation() const +{ + if (m_OrientationCached) + return m_OrientationCache; + + OVR::Quatf quatovr = m_DevicePtr->SensorFusion.GetPredictedOrientation(); + NLMISC::CMatrix coordsys; + float csys[] = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, -1.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }; + coordsys.set(csys); + NLMISC::CMatrix matovr; + matovr.setRot(NLMISC::CQuat(quatovr.x, quatovr.y, quatovr.z, quatovr.w)); + NLMISC::CMatrix matr; + matr.rotateX(NLMISC::Pi * 0.5f); // fix this properly... :) (note: removing this allows you to use rift while lying down) + NLMISC::CMatrix matnel = matr * matovr * coordsys; + NLMISC::CQuat finalquat = matnel.getRot(); + m_OrientationCache = finalquat; + m_OrientationCached = true; + return finalquat; +} + +/// Get GUI shift +void CStereoOVR::getInterface2DShift(uint cid, float &x, float &y, float distance) const +{ +#if 0 + + // todo: take into account m_EyePosition + + NLMISC::CVector vector = CVector(0.f, -distance, 0.f); + NLMISC::CQuat rot = getOrientation(); + rot.invert(); + NLMISC::CMatrix mat; + mat.rotate(rot); + //if (m_Stage % 2) mat.translate(CVector(m_DevicePtr->HMDInfo.InterpupillaryDistance * -0.5f, 0.f, 0.f)); + //else mat.translate(CVector(m_DevicePtr->HMDInfo.InterpupillaryDistance * 0.5f, 0.f, 0.f)); + mat.translate(vector); + CVector proj = CStereoOVR::getCurrentFrustum(cid).project(mat.getPos()); + + NLMISC::CVector ipd; + if (m_Stage % 2) ipd = CVector(m_DevicePtr->HMDInfo.InterpupillaryDistance * -0.5f, 0.f, 0.f); + else ipd = CVector(m_DevicePtr->HMDInfo.InterpupillaryDistance * 0.5f, 0.f, 0.f); + CVector projipd = CStereoOVR::getCurrentFrustum(cid).project(vector + ipd); + CVector projvec = CStereoOVR::getCurrentFrustum(cid).project(vector); + + x = (proj.x + projipd.x - projvec.x - 0.5f); + y = (proj.y + projipd.y - projvec.y - 0.5f); + +#elif 1 + + // Alternative method + // todo: take into account m_EyePosition + + NLMISC::CVector vec = CVector(0.f, -distance, 0.f); + NLMISC::CVector ipd; + if (m_Stage % 2) ipd = CVector((m_DevicePtr->HMDInfo.InterpupillaryDistance * m_Scale) * -0.5f, 0.f, 0.f); + else ipd = CVector((m_DevicePtr->HMDInfo.InterpupillaryDistance * m_Scale) * 0.5f, 0.f, 0.f); + + + NLMISC::CQuat rot = getOrientation(); + NLMISC::CQuat modrot = NLMISC::CQuat(CVector(0.f, 1.f, 0.f), NLMISC::Pi); + rot = rot * modrot; + float p = NLMISC::Pi + atan2f(2.0f * ((rot.x * rot.y) + (rot.z * rot.w)), 1.0f - 2.0f * ((rot.y * rot.y) + (rot.w * rot.w))); + if (p > NLMISC::Pi) p -= NLMISC::Pi * 2.0f; + float t = -atan2f(2.0f * ((rot.x * rot.w) + (rot.y * rot.z)), 1.0f - 2.0f * ((rot.z * rot.z) + (rot.w * rot.w)));// // asinf(2.0f * ((rot.x * rot.z) - (rot.w * rot.y))); + + CVector rotshift = CVector(p, 0.f, t) * -distance; + + CVector proj = CStereoOVR::getCurrentFrustum(cid).project(vec + ipd + rotshift); + + x = (proj.x - 0.5f); + y = (proj.y - 0.5f); + +#endif +} + +void CStereoOVR::setEyePosition(const NLMISC::CVector &v) +{ + m_EyePosition = v; +} + +const NLMISC::CVector &CStereoOVR::getEyePosition() const +{ + return m_EyePosition; +} + +void CStereoOVR::setScale(float s) +{ + m_EyePosition = m_EyePosition * (s / m_Scale); + m_Scale = s; +} + +void CStereoOVR::listDevices(std::vector &devicesOut) +{ + s_StereoOVRSystem.Init(); + OVR::DeviceEnumerator devices = s_DeviceManager->EnumerateDevices(); + uint id = 1; + do + { + CStereoDeviceInfo deviceInfoOut; + OVR::DeviceInfo deviceInfo; + if (devices.IsAvailable()) + { + devices.GetDeviceInfo(&deviceInfo); + CStereoOVRDeviceHandle *handle = new CStereoOVRDeviceHandle(); + deviceInfoOut.Factory = static_cast(handle); + handle->DeviceHandle = devices; + deviceInfoOut.Class = CStereoDeviceInfo::StereoHMD; // 1; // OVR::HMDDevice + deviceInfoOut.Library = CStereoDeviceInfo::OVR; // "Oculus SDK"; + deviceInfoOut.Manufacturer = deviceInfo.Manufacturer; + deviceInfoOut.ProductName = deviceInfo.ProductName; + stringstream ser; + ser << id; + deviceInfoOut.Serial = ser.str(); // can't get the real serial from the sdk... + devicesOut.push_back(deviceInfoOut); + ++id; + } + + } while (devices.Next()); +} + +bool CStereoOVR::isLibraryInUse() +{ + nlassert(s_DeviceCounter >= 0); + return s_DeviceCounter > 0; +} + +void CStereoOVR::releaseLibrary() +{ + nlassert(s_DeviceCounter == 0); + s_StereoOVRSystem.Release(); +} + +bool CStereoOVR::isDeviceCreated() +{ + return m_DevicePtr->HMDDevice != NULL; +} + +} /* namespace NL3D */ + +#endif /* HAVE_LIBOVR */ + +/* end of file */ diff --git a/code/nel/src/3d/stereo_ovr_fp.cpp b/code/nel/src/3d/stereo_ovr_fp.cpp new file mode 100644 index 000000000..940be0bfe --- /dev/null +++ b/code/nel/src/3d/stereo_ovr_fp.cpp @@ -0,0 +1,249 @@ +/************************************************************************************ + +Filename : stereo_ovf_fp.cpp +Content : Barrel fragment program compiled to a blob of assembly +Created : July 01, 2013 +Modified by : Jan Boon (Kaetemi) + +Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +************************************************************************************/ + +namespace NL3D { +const char *g_StereoOVR_fp40 = + "!!ARBfp1.0\n" + "OPTION NV_fragment_program2;\n" + //# cgc version 3.1.0013, build date Apr 18 2012 + //# command line args: -profile fp40 + //# source file: pp_oculus_vr.cg + //#vendor NVIDIA Corporation + //#version 3.1.0.13 + //#profile fp40 + //#program pp_oculus_vr + //#semantic pp_oculus_vr.cLensCenter + //#semantic pp_oculus_vr.cScreenCenter + //#semantic pp_oculus_vr.cScale + //#semantic pp_oculus_vr.cScaleIn + //#semantic pp_oculus_vr.cHmdWarpParam + //#semantic pp_oculus_vr.cTex0 : TEX0 + //#var float2 texCoord : $vin.TEXCOORD0 : TEX0 : 0 : 1 + //#var float2 cLensCenter : : c[0] : 1 : 1 + //#var float2 cScreenCenter : : c[1] : 2 : 1 + //#var float2 cScale : : c[2] : 3 : 1 + //#var float2 cScaleIn : : c[3] : 4 : 1 + //#var float4 cHmdWarpParam : : c[4] : 5 : 1 + //#var sampler2D nlTex0 : TEX0 : texunit 0 : 6 : 1 + //#var float4 oCol : $vout.COLOR : COL : 7 : 1 + //#const c[5] = 0.25 0.5 0 + "PARAM c[6] = { program.env[0..4],\n" // program.local->program.env! + " { 0.25, 0.5, 0 } };\n" + "TEMP R0;\n" + "TEMP R1;\n" + "SHORT TEMP H0;\n" + "TEMP RC;\n" + "TEMP HC;\n" + "OUTPUT oCol = result.color;\n" + "ADDR R0.xy, fragment.texcoord[0], -c[0];\n" + "MULR R0.xy, R0, c[3];\n" + "MULR R0.z, R0.y, R0.y;\n" + "MADR R1.x, R0, R0, R0.z;\n" + "MULR R0.zw, R1.x, c[4].xywz;\n" + "MADR R1.y, R1.x, c[4], c[4].x;\n" + "MADR R0.w, R0, R1.x, R1.y;\n" + "MULR R0.z, R0, R1.x;\n" + "MADR R0.z, R0, R1.x, R0.w;\n" + "MULR R1.xy, R0, R0.z;\n" + "MOVR R0.xy, c[5];\n" + "ADDR R1.zw, R0.xyxy, c[1].xyxy;\n" + "MOVR R0.zw, c[0].xyxy;\n" + "MADR R0.zw, R1.xyxy, c[2].xyxy, R0;\n" + "MINR R1.xy, R0.zwzw, R1.zwzw;\n" + "ADDR R0.xy, -R0, c[1];\n" + "MAXR R0.xy, R0, R1;\n" + "SEQR H0.xy, R0, R0.zwzw;\n" + "MULXC HC.x, H0, H0.y;\n" + "IF EQ.x;\n" + "MOVR oCol, c[5].z;\n" + "ELSE;\n" + "TEX oCol, R0.zwzw, texture[0], 2D;\n" + "ENDIF;\n" + "END\n"; + //# 24 instructions, 2 R-regs, 1 H-regs + +const char *g_StereoOVR_arbfp1 = + "!!ARBfp1.0\n" + //# cgc version 3.1.0013, build date Apr 18 2012 + //# command line args: -profile arbfp1 + //# source file: pp_oculus_vr.cg + //#vendor NVIDIA Corporation + //#version 3.1.0.13 + //#profile arbfp1 + //#program pp_oculus_vr + //#semantic pp_oculus_vr.cLensCenter + //#semantic pp_oculus_vr.cScreenCenter + //#semantic pp_oculus_vr.cScale + //#semantic pp_oculus_vr.cScaleIn + //#semantic pp_oculus_vr.cHmdWarpParam + //#semantic pp_oculus_vr.cTex0 : TEX0 + //#var float2 texCoord : $vin.TEXCOORD0 : TEX0 : 0 : 1 + //#var float2 cLensCenter : : c[0] : 1 : 1 + //#var float2 cScreenCenter : : c[1] : 2 : 1 + //#var float2 cScale : : c[2] : 3 : 1 + //#var float2 cScaleIn : : c[3] : 4 : 1 + //#var float4 cHmdWarpParam : : c[4] : 5 : 1 + //#var sampler2D nlTex0 : TEX0 : texunit 0 : 6 : 1 + //#var float4 oCol : $vout.COLOR : COL : 7 : 1 + //#const c[5] = 0.25 0.5 0 1 + "PARAM c[6] = { program.env[0..4],\n" + " { 0.25, 0.5, 0, 1 } };\n" + "TEMP R0;\n" + "TEMP R1;\n" + "ADD R0.xy, fragment.texcoord[0], -c[0];\n" + "MUL R0.xy, R0, c[3];\n" + "MUL R0.z, R0.y, R0.y;\n" + "MAD R0.z, R0.x, R0.x, R0;\n" + "MUL R0.w, R0.z, c[4];\n" + "MUL R0.w, R0, R0.z;\n" + "MAD R1.y, R0.z, c[4], c[4].x;\n" + "MUL R1.x, R0.z, c[4].z;\n" + "MAD R1.x, R0.z, R1, R1.y;\n" + "MAD R0.z, R0.w, R0, R1.x;\n" + "MUL R0.xy, R0, R0.z;\n" + "MOV R0.zw, c[5].xyxy;\n" + "ADD R1.xy, R0.zwzw, c[1];\n" + "MUL R0.xy, R0, c[2];\n" + "ADD R0.xy, R0, c[0];\n" + "MIN R1.xy, R1, R0;\n" + "ADD R0.zw, -R0, c[1].xyxy;\n" + "MAX R0.zw, R0, R1.xyxy;\n" + "ADD R0.zw, R0, -R0.xyxy;\n" + "ABS R0.zw, R0;\n" + "CMP R0.zw, -R0, c[5].z, c[5].w;\n" + "MUL R0.z, R0, R0.w;\n" + "ABS R0.z, R0;\n" + "CMP R0.z, -R0, c[5], c[5].w;\n" + "ABS R1.x, R0.z;\n" + "TEX R0, R0, texture[0], 2D;\n" + "CMP R1.x, -R1, c[5].z, c[5].w;\n" + "CMP result.color, -R1.x, R0, c[5].z;\n" + "END\n"; + //# 28 instructions, 2 R-regs + +const char *g_StereoOVR_ps_2_0 = + "ps_2_0\n" + // cgc version 3.1.0013, build date Apr 18 2012 + // command line args: -profile ps_2_0 + // source file: pp_oculus_vr.cg + //vendor NVIDIA Corporation + //version 3.1.0.13 + //profile ps_2_0 + //program pp_oculus_vr + //semantic pp_oculus_vr.cLensCenter + //semantic pp_oculus_vr.cScreenCenter + //semantic pp_oculus_vr.cScale + //semantic pp_oculus_vr.cScaleIn + //semantic pp_oculus_vr.cHmdWarpParam + //semantic pp_oculus_vr.cTex0 : TEX0 + //var float2 texCoord : $vin.TEXCOORD0 : TEX0 : 0 : 1 + //var float2 cLensCenter : : c[0] : 1 : 1 + //var float2 cScreenCenter : : c[1] : 2 : 1 + //var float2 cScale : : c[2] : 3 : 1 + //var float2 cScaleIn : : c[3] : 4 : 1 + //var float4 cHmdWarpParam : : c[4] : 5 : 1 + //var sampler2D nlTex0 : TEX0 : texunit 0 : 6 : 1 + //var float4 oCol : $vout.COLOR : COL : 7 : 1 + //const c[5] = -0.25 -0.5 0.25 0.5 + //const c[6] = 1 0 + "dcl_2d s0\n" + "def c5, -0.25000000, -0.50000000, 0.25000000, 0.50000000\n" + "def c6, 1.00000000, 0.00000000, 0, 0\n" + "dcl t0.xy\n" + "add r0.xy, t0, -c0\n" + "mul r4.xy, r0, c3\n" + "mul r0.x, r4.y, r4.y\n" + "mad r0.x, r4, r4, r0\n" + "mul r1.x, r0, c4.w\n" + "mul r1.x, r1, r0\n" + "mad r3.x, r0, c4.y, c4\n" + "mul r2.x, r0, c4.z\n" + "mad r2.x, r0, r2, r3\n" + "mad r0.x, r1, r0, r2\n" + "mul r0.xy, r4, r0.x\n" + "mul r0.xy, r0, c2\n" + "add r3.xy, r0, c0\n" + "mov r1.x, c5.z\n" + "mov r1.y, c5.w\n" + "mov r2.xy, c1\n" + "add r2.xy, r1, r2\n" + "mov r1.xy, c1\n" + "min r2.xy, r2, r3\n" + "add r1.xy, c5, r1\n" + "max r1.xy, r1, r2\n" + "add r1.xy, r1, -r3\n" + "abs r1.xy, r1\n" + "cmp r1.xy, -r1, c6.x, c6.y\n" + "mul_pp r1.x, r1, r1.y\n" + "abs_pp r1.x, r1\n" + "cmp_pp r1.x, -r1, c6, c6.y\n" + "abs_pp r1.x, r1\n" + "texld r0, r3, s0\n" + "cmp r0, -r1.x, r0, c6.y\n" + "mov oC0, r0\n"; + +const char *g_StereoOVR_glsl330f = + "#version 330\n" + "\n" + "bool _TMP2;\n" + "bvec2 _TMP1;\n" + "vec2 _TMP3;\n" + "uniform vec2 cLensCenter;\n" + "uniform vec2 cScreenCenter;\n" + "uniform vec2 cScale;\n" + "uniform vec2 cScaleIn;\n" + "uniform vec4 cHmdWarpParam;\n" + "uniform sampler2D nlTex0;\n" + "vec2 _TMP10;\n" + "vec2 _b0011;\n" + "vec2 _a0011;\n" + "in vec4 nlTexCoord0;\n" + "out vec4 nlCol;\n" + "\n" + "void main()\n" + "{\n" + " vec2 _theta;\n" + " float _rSq;\n" + " vec2 _theta1;\n" + " vec2 _tc;\n" + "\n" + " _theta = (nlTexCoord0.xy - cLensCenter)*cScaleIn;\n" + " _rSq = _theta.x*_theta.x + _theta.y*_theta.y;\n" + " _theta1 = _theta*(cHmdWarpParam.x + cHmdWarpParam.y*_rSq + cHmdWarpParam.z*_rSq*_rSq + cHmdWarpParam.w*_rSq*_rSq*_rSq);\n" + " _tc = cLensCenter + cScale*_theta1;\n" + " _a0011 = cScreenCenter - vec2( 0.25, 0.5);\n" + " _b0011 = cScreenCenter + vec2( 0.25, 0.5);\n" + " _TMP3 = min(_b0011, _tc);\n" + " _TMP10 = max(_a0011, _TMP3);\n" + " _TMP1 = bvec2(_TMP10.x == _tc.x, _TMP10.y == _tc.y);\n" + " _TMP2 = _TMP1.x && _TMP1.y;\n" + " if (!_TMP2) {\n" + " nlCol = vec4(0, 0, 0, 0);\n" + " } else {\n" + " nlCol = texture(nlTex0, _tc);\n" + " }\n" + "}\n"; + +} + +/* end of file */ diff --git a/code/nel/src/3d/tile_far_bank.cpp b/code/nel/src/3d/tile_far_bank.cpp index 75a758560..e62903904 100644 --- a/code/nel/src/3d/tile_far_bank.cpp +++ b/code/nel/src/3d/tile_far_bank.cpp @@ -104,8 +104,8 @@ const sint CTileFarBank::_Version=0x0; void CTileFarBank::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { // Write/Check "FAR_BANK" in header of the stream - f.serialCheck ((uint32)'_RAF'); - f.serialCheck ((uint32)'KNAB'); + f.serialCheck (NELID("_RAF")); + f.serialCheck (NELID("KNAB")); // Serial version (void)f.serialVersion(_Version); diff --git a/code/nel/src/3d/vegetable_manager.cpp b/code/nel/src/3d/vegetable_manager.cpp index fe1c63dc4..ba44a766f 100644 --- a/code/nel/src/3d/vegetable_manager.cpp +++ b/code/nel/src/3d/vegetable_manager.cpp @@ -126,9 +126,7 @@ CVegetableManager::~CVegetableManager() // delete All VP for(sint i=0; i Profile = nelvp; + source->DisplayName = "nelvp/Veget"; + + // Init the Vertex Program. + string vpgram; + // start always with Bend. + if( vpType==NL3D_VEGETABLE_RDRPASS_LIGHTED || vpType==NL3D_VEGETABLE_RDRPASS_LIGHTED_2SIDED ) + { + source->DisplayName += "/Bend"; + vpgram= NL3D_BendProgram; + } + else + { + source->DisplayName += "/FastBend"; + vpgram= NL3D_FastBendProgram; + } + // combine the VP according to Type + switch(vpType) + { + case NL3D_VEGETABLE_RDRPASS_LIGHTED: + case NL3D_VEGETABLE_RDRPASS_LIGHTED_2SIDED: + source->DisplayName += "/Lighted"; + vpgram+= string(NL3D_LightedStartVegetableProgram); + break; + case NL3D_VEGETABLE_RDRPASS_UNLIT: + case NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED: + source->DisplayName += "/Unlit"; + vpgram+= string(NL3D_UnlitVegetableProgram); + break; + case NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED_ZSORT: + source->DisplayName += "/UnlitAlphaBlend"; + vpgram+= string(NL3D_UnlitAlphaBlendVegetableProgram); + break; + } + + // common end of VP + vpgram+= string(NL3D_CommonEndVegetableProgram); + + if (fogEnabled) + { + source->DisplayName += "/Fog"; + vpgram+= string(NL3D_VegetableProgramFog); + } + + vpgram+="\nEND\n"; + + source->setSource(vpgram); + + source->ParamIndices["modelViewProjection"] = 0; + source->ParamIndices["fog"] = 6; + source->ParamIndices["programConstants0"] = 8; + source->ParamIndices["directionalLight"] = 9; + source->ParamIndices["viewCenter"] = 10; + source->ParamIndices["negInvTransDist"] = 11; + source->ParamIndices["angleAxis"] = 16; + source->ParamIndices["wind"] = 17; + source->ParamIndices["cosCoeff0"] = 18; + source->ParamIndices["cosCoeff1"] = 19; + source->ParamIndices["cosCoeff2"] = 20; + source->ParamIndices["quatConstants"] = 21; + source->ParamIndices["piConstants"] = 22; + source->ParamIndices["lutSize"] = 23; + for (uint i = 0; i < NL3D_VEGETABLE_VP_LUT_SIZE; ++i) + { + source->ParamIndices[NLMISC::toString("lut[%i]", i)] = 32 + i; + } + + addSource(source); + } + // TODO_VP_GLSL + } + virtual ~CVertexProgramVeget() + { + + } + virtual void buildInfo() + { + m_Idx.ProgramConstants0 = getUniformIndex("programConstants0"); + nlassert(m_Idx.ProgramConstants0 != ~0); + m_Idx.DirectionalLight = getUniformIndex("directionalLight"); + nlassert(m_Idx.DirectionalLight != ~0); + m_Idx.ViewCenter = getUniformIndex("viewCenter"); + nlassert(m_Idx.ViewCenter != ~0); + m_Idx.NegInvTransDist = getUniformIndex("negInvTransDist"); + nlassert(m_Idx.NegInvTransDist != ~0); + m_Idx.AngleAxis = getUniformIndex("angleAxis"); + nlassert(m_Idx.AngleAxis != ~0); + m_Idx.Wind = getUniformIndex("wind"); + nlassert(m_Idx.Wind != ~0); + m_Idx.CosCoeff0 = getUniformIndex("cosCoeff0"); + nlassert(m_Idx.CosCoeff0 != ~0); + m_Idx.CosCoeff1 = getUniformIndex("cosCoeff1"); + nlassert(m_Idx.CosCoeff1 != ~0); + m_Idx.CosCoeff2 = getUniformIndex("cosCoeff2"); + nlassert(m_Idx.CosCoeff2 != ~0); + m_Idx.QuatConstants = getUniformIndex("quatConstants"); + nlassert(m_Idx.QuatConstants != ~0); + m_Idx.PiConstants = getUniformIndex("piConstants"); + nlassert(m_Idx.PiConstants != ~0); + m_Idx.LUTSize = getUniformIndex("lutSize"); + nlassert(m_Idx.LUTSize != ~0); + for (uint i = 0; i < NL3D_VEGETABLE_VP_LUT_SIZE; ++i) + { + m_Idx.LUT[i] = getUniformIndex(NLMISC::toString("lut[%i]", i)); + nlassert(m_Idx.LUT[i] != ~0); + } + } + const CIdx &idx() const { return m_Idx; } +private: + CIdx m_Idx; +}; // *************************************************************************** void CVegetableManager::initVertexProgram(uint vpType, bool fogEnabled) { nlassert(_LastDriver); // update driver should have been called at least once ! - // Init the Vertex Program. - string vpgram; - // start always with Bend. - if( vpType==NL3D_VEGETABLE_RDRPASS_LIGHTED || vpType==NL3D_VEGETABLE_RDRPASS_LIGHTED_2SIDED ) - vpgram= NL3D_BendProgram; - else - vpgram= NL3D_FastBendProgram; - - // combine the VP according to Type - switch(vpType) - { - case NL3D_VEGETABLE_RDRPASS_LIGHTED: - case NL3D_VEGETABLE_RDRPASS_LIGHTED_2SIDED: - vpgram+= string(NL3D_LightedStartVegetableProgram); - break; - case NL3D_VEGETABLE_RDRPASS_UNLIT: - case NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED: - vpgram+= string(NL3D_UnlitVegetableProgram); - break; - case NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED_ZSORT: - vpgram+= string(NL3D_UnlitAlphaBlendVegetableProgram); - break; - } - - // common end of VP - vpgram+= string(NL3D_CommonEndVegetableProgram); - - if (fogEnabled) - { - vpgram+= string(NL3D_VegetableProgramFog); - } - - vpgram+="\nEND\n"; - + // create VP. - _VertexProgram[vpType][fogEnabled ? 1 : 0] = new CVertexProgram(vpgram.c_str()); - + _VertexProgram[vpType][fogEnabled ? 1 : 0] = new CVertexProgramVeget(vpType, fogEnabled); } @@ -1756,42 +1864,48 @@ public: // *************************************************************************** -void CVegetableManager::setupVertexProgramConstants(IDriver *driver) +void CVegetableManager::setupVertexProgramConstants(IDriver *driver, bool fogEnabled) { + nlassert(_ActiveVertexProgram); + + // Standard // setup VertexProgram constants. // c[0..3] take the ModelViewProjection Matrix. After setupModelMatrix(); - driver->setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); + driver->setUniformMatrix(IDriver::VertexProgram, _ActiveVertexProgram->getUniformIndex(CProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity); // c[6] take the Fog vector. After setupModelMatrix(); - driver->setConstantFog(6); + if (fogEnabled) + { + driver->setUniformFog(IDriver::VertexProgram, _ActiveVertexProgram->getUniformIndex(CProgramIndex::Fog)); + } // c[8] take useful constants. - driver->setConstant(8, 0, 1, 0.5f, 2); + driver->setUniform4f(IDriver::VertexProgram, _ActiveVertexProgram->idx().ProgramConstants0, 0, 1, 0.5f, 2); // c[9] take normalized directional light - driver->setConstant(9, _DirectionalLight); + driver->setUniform3f(IDriver::VertexProgram, _ActiveVertexProgram->idx().DirectionalLight, _DirectionalLight); // c[10] take pos of camera - driver->setConstant(10, _ViewCenter); + driver->setUniform3f(IDriver::VertexProgram, _ActiveVertexProgram->idx().ViewCenter, _ViewCenter); // c[11] take factor for Blend formula - driver->setConstant(11, -1.f/NL3D_VEGETABLE_BLOCK_BLEND_TRANSITION_DIST, 0, 0, 0); + driver->setUniform1f(IDriver::VertexProgram, _ActiveVertexProgram->idx().NegInvTransDist, -1.f/NL3D_VEGETABLE_BLOCK_BLEND_TRANSITION_DIST); // Bend. // c[16]= quaternion axis. w==1, and z must be 0 - driver->setConstant( 16, _AngleAxis.x, _AngleAxis.y, _AngleAxis.z, 1); + driver->setUniform4f(IDriver::VertexProgram, _ActiveVertexProgram->idx().AngleAxis, _AngleAxis, 1); // c[17]= {timeAnim, WindPower, WindPower*(1-WindBendMin)/2, 0)} - driver->setConstant( 17, (float)_WindAnimTime, _WindPower, _WindPower*(1-_WindBendMin)/2, 0 ); + driver->setUniform3f(IDriver::VertexProgram, _ActiveVertexProgram->idx().Wind, (float)_WindAnimTime, _WindPower, _WindPower * (1 - _WindBendMin) / 2); // c[18]= High order Taylor cos coefficient: { -1/2, 1/24, -1/720, 1/40320 } - driver->setConstant( 18, -1/2.f, 1/24.f, -1/720.f, 1/40320.f ); + driver->setUniform4f(IDriver::VertexProgram, _ActiveVertexProgram->idx().CosCoeff0, -1/2.f, 1/24.f, -1/720.f, 1/40320.f ); // c[19]= Low order Taylor cos coefficient: { 1, -1/2, 1/24, -1/720 } - driver->setConstant( 19, 1, -1/2.f, 1/24.f, -1/720.f ); + driver->setUniform4f(IDriver::VertexProgram, _ActiveVertexProgram->idx().CosCoeff1, 1, -1/2.f, 1/24.f, -1/720.f ); // c[20]= Low order Taylor sin coefficient: { 1, -1/6, 1/120, -1/5040 } - driver->setConstant( 20, 1, -1/6.f, 1/120.f, -1/5040.f ); + driver->setUniform4f(IDriver::VertexProgram, _ActiveVertexProgram->idx().CosCoeff2, 1, -1/6.f, 1/120.f, -1/5040.f ); // c[21]= Special constant vector for quatToMatrix: { 0, 1, -1, 0 } - driver->setConstant( 21, 0.f, 1.f, -1.f, 0.f); + driver->setUniform4f(IDriver::VertexProgram, _ActiveVertexProgram->idx().QuatConstants, 0.f, 1.f, -1.f, 0.f); // c[22]= {0.5f, Pi, 2*Pi, 1/(2*Pi)} - driver->setConstant( 22, 0.5f, (float)Pi, (float)(2*Pi), (float)(1/(2*Pi)) ); + driver->setUniform4f(IDriver::VertexProgram, _ActiveVertexProgram->idx().PiConstants, 0.5f, (float)Pi, (float)(2*Pi), (float)(1/(2*Pi))); // c[23]= {NL3D_VEGETABLE_VP_LUT_SIZE, 0, 0, 0}. NL3D_VEGETABLE_VP_LUT_SIZE==64. - driver->setConstant( 23, NL3D_VEGETABLE_VP_LUT_SIZE, 0.f, 0.f, 0.f ); + driver->setUniform1f(IDriver::VertexProgram, _ActiveVertexProgram->idx().LUTSize, NL3D_VEGETABLE_VP_LUT_SIZE); // Fill constant. Start at 32. @@ -1799,7 +1913,7 @@ void CVegetableManager::setupVertexProgramConstants(IDriver *driver) { CVector2f cur= _WindTable[i]; CVector2f delta= _WindDeltaTable[i]; - driver->setConstant( 32+i, cur.x, cur.y, delta.x, delta.y ); + driver->setUniform4f(IDriver::VertexProgram, _ActiveVertexProgram->idx().LUT[i], cur.x, cur.y, delta.x, delta.y); } } @@ -1925,10 +2039,6 @@ void CVegetableManager::render(const CVector &viewCenter, const CVector &front } - // setup VP constants. - setupVertexProgramConstants(driver); - - // Setup TexEnvs for Dynamic lightmapping //-------------------- // if the dynamic lightmap is provided @@ -1968,6 +2078,12 @@ void CVegetableManager::render(const CVector &viewCenter, const CVector &front _VegetableMaterial.setZWrite(true); _VegetableMaterial.setAlphaTestThreshold(0.5f); + bool uprogst = driver->isUniformProgramState(); + bool progstateset[NL3D_VEGETABLE_NRDRPASS]; + for (sint rdrPass = 0; rdrPass < NL3D_VEGETABLE_NRDRPASS; ++rdrPass) + { + progstateset[rdrPass] = false; + } /* Prefer sort with Soft / Hard first. @@ -1995,14 +2111,20 @@ void CVegetableManager::render(const CVector &viewCenter, const CVector &front // set the 2Sided flag in the material _VegetableMaterial.setDoubleSided( doubleSided ); - - // Activate the unique material. - driver->setupMaterial(_VegetableMaterial); - // activate Vertex program first. //nlinfo("\nSTARTVP\n%s\nENDVP\n", _VertexProgram[rdrPass]->getProgram().c_str()); - nlverify(driver->activeVertexProgram(_VertexProgram[rdrPass][fogged ? 1 : 0])); + _ActiveVertexProgram = _VertexProgram[rdrPass][fogged ? 1 : 0]; + nlverify(driver->activeVertexProgram(_ActiveVertexProgram)); + + // Set VP constants + if (!progstateset[uprogst ? rdrPass : 0]) + { + setupVertexProgramConstants(driver, uprogst ? fogged : true); + } + + // Activate the unique material. + driver->setupMaterial(_VegetableMaterial); // Activate the good VBuffer vbAllocator.activate(); @@ -2222,6 +2344,7 @@ void CVegetableManager::render(const CVector &viewCenter, const CVector &front // disable VertexProgram. driver->activeVertexProgram(NULL); + _ActiveVertexProgram = NULL; // restore Fog. @@ -2261,25 +2384,25 @@ void CVegetableManager::setupRenderStateForBlendLayerModel(IDriver *driver) // set model matrix to the manager matrix. driver->setupModelMatrix(_ManagerMatrix); - // setup VP constants. - setupVertexProgramConstants(driver); - // Setup RdrPass. //============= uint rdrPass= NL3D_VEGETABLE_RDRPASS_UNLIT_2SIDED_ZSORT; - // Activate the unique material (correclty setuped for AlphaBlend in render()). - driver->setupMaterial(_VegetableMaterial); - // activate Vertex program first. //nlinfo("\nSTARTVP\n%s\nENDVP\n", _VertexProgram[rdrPass]->getProgram().c_str()); - nlverify(driver->activeVertexProgram(_VertexProgram[rdrPass][fogged ? 1 : 0])); + _ActiveVertexProgram = _VertexProgram[rdrPass][fogged ? 1 : 0]; + nlverify(driver->activeVertexProgram(_ActiveVertexProgram)); - if (fogged) + // setup VP constants. + setupVertexProgramConstants(driver, fogged); + + /*if (fogged) // duplicate { - driver->setConstantFog(6); - } + driver->setCon/stantFog(6); + }*/ + // Activate the unique material (correclty setuped for AlphaBlend in render()). + driver->setupMaterial(_VegetableMaterial); } @@ -2302,6 +2425,7 @@ void CVegetableManager::exitRenderStateForBlendLayerModel(IDriver *driver) { // disable VertexProgram. driver->activeVertexProgram(NULL); + _ActiveVertexProgram = NULL; // restore Fog. driver->enableFog(_BkupFog); diff --git a/code/nel/src/3d/vegetable_shape.cpp b/code/nel/src/3d/vegetable_shape.cpp index 0b8697d63..7d9991b65 100644 --- a/code/nel/src/3d/vegetable_shape.cpp +++ b/code/nel/src/3d/vegetable_shape.cpp @@ -192,10 +192,10 @@ void CVegetableShape::serial(NLMISC::IStream &f) - BestSidedPreComputeLighting */ sint ver= f.serialVersion(1); - f.serialCheck((uint32)'_LEN'); - f.serialCheck((uint32)'GEV_'); - f.serialCheck((uint32)'BATE'); - f.serialCheck((uint32)'__EL'); + f.serialCheck(NELID("_LEN")); + f.serialCheck(NELID("GEV_")); + f.serialCheck(NELID("BATE")); + f.serialCheck(NELID("__EL")); f.serial(Lighted); f.serial(DoubleSided); diff --git a/code/nel/src/3d/vegetablevb_allocator.cpp b/code/nel/src/3d/vegetablevb_allocator.cpp index 9c801b179..29a03b51d 100644 --- a/code/nel/src/3d/vegetablevb_allocator.cpp +++ b/code/nel/src/3d/vegetablevb_allocator.cpp @@ -98,7 +98,9 @@ void CVegetableVBAllocator::updateDriver(IDriver *driver) _VBHardOk= false; // Driver must support VP. - nlassert(_Driver->isVertexProgramSupported()); + nlassert(_Driver->supportVertexProgram(CVertexProgram::nelvp) + // || _Driver->supportVertexProgram(CVertexProgram::glsl330v) // TODO_VP_GLSL + ); // must reallocate the VertexBuffer. if( _NumVerticesAllocated>0 ) diff --git a/code/nel/src/3d/vertex_program.cpp b/code/nel/src/3d/vertex_program.cpp index 9e7587069..d0c0cfb79 100644 --- a/code/nel/src/3d/vertex_program.cpp +++ b/code/nel/src/3d/vertex_program.cpp @@ -24,34 +24,28 @@ namespace NL3D { - // *************************************************************************** -IVertexProgramDrvInfos::IVertexProgramDrvInfos (IDriver *drv, ItVtxPrgDrvInfoPtrList it) + +CVertexProgram::CVertexProgram() { - _Driver= drv; - _DriverIterator= it; + } - // *************************************************************************** -IVertexProgramDrvInfos::~IVertexProgramDrvInfos () + +CVertexProgram::CVertexProgram(const char *nelvp) { - _Driver->removeVtxPrgDrvInfoPtr (_DriverIterator); + CSource *source = new CSource(); + source->Profile = IProgram::nelvp; + source->setSource(nelvp); + addSource(source); } - // *************************************************************************** -CVertexProgram::CVertexProgram (const char* program) -{ - _Program=program; -} - -// *************************************************************************** CVertexProgram::~CVertexProgram () { - // Must kill the drv mirror of this VB. - _DrvInfo.kill(); + } } // NL3D diff --git a/code/nel/src/3d/vertex_program_parse.cpp b/code/nel/src/3d/vertex_program_parse.cpp index 9b535d551..40ac2282e 100644 --- a/code/nel/src/3d/vertex_program_parse.cpp +++ b/code/nel/src/3d/vertex_program_parse.cpp @@ -885,7 +885,7 @@ bool CVPParser::parseInstruction(CVPInstruction &instr, std::string &errorOutput } // it is not allowed to write to an adress register except for ARL - if (instrStr != 'ARL ') + if (instrStr != NELID("ARL ")) { if (instr.Dest.Type == CVPOperand::AddressRegister) { diff --git a/code/nel/src/3d/water_env_map.cpp b/code/nel/src/3d/water_env_map.cpp index 3d2f64a1f..a1b954764 100644 --- a/code/nel/src/3d/water_env_map.cpp +++ b/code/nel/src/3d/water_env_map.cpp @@ -226,9 +226,8 @@ void CWaterEnvMap::doInit() _MaterialPassThru.setZFunc(CMaterial::always); } } - - -static CVertexProgram testMeshVP( +/* +static const char *testMeshVPstr = "!!VP1.0\n\ DP4 o[HPOS].x, c[0], v[0]; \n\ DP4 o[HPOS].y, c[1], v[0]; \n\ @@ -236,14 +235,56 @@ static CVertexProgram testMeshVP( DP4 o[HPOS].w, c[3], v[0]; \n\ MAD o[COL0], v[8], c[4].xxxx, c[4].yyyy; \n\ MOV o[TEX0], v[8]; \n\ - END" -); + END"; + + +class CVertexProgramTestMeshVP : public CVertexProgram +{ +public: + struct CIdx + { + uint ProgramConstant0; + }; + CVertexProgramTestMeshVP() + { + // nelvp + { + CSource *source = new CSource(); + source->Profile = nelvp; + source->DisplayName = "testMeshVP/nelvp"; + source->setSourcePtr(testMeshVPstr); + source->ParamIndices["modelViewProjection"] = 0; + source->ParamIndices["programConstant0"] = 4; + addSource(source); + } + } + virtual ~CVertexProgramTestMeshVP() + { + + } + virtual void buildInfo() + { + m_Idx.ProgramConstant0 = getUniformIndex("programConstant0"); + nlassert(m_Idx.ProgramConstant0 != ~0); + } + inline const CIdx &idx() { return m_Idx; } +private: + CIdx m_Idx; +}; + + +static NLMISC::CSmartPtr testMeshVP; // ******************************************************************************* void CWaterEnvMap::renderTestMesh(IDriver &driver) { + if (!testMeshVP) + { + testMeshVP = new CVertexProgramTestMeshVP(); + } + doInit(); CMaterial testMat; testMat.setLighting(false); @@ -257,18 +298,17 @@ void CWaterEnvMap::renderTestMesh(IDriver &driver) testMat.setZWrite(false); testMat.setZFunc(CMaterial::always); // tmp : test cubemap - driver.activeVertexProgram(&testMeshVP); + driver.activeVertexProgram(testMeshVP); driver.activeVertexBuffer(_TestVB); driver.activeIndexBuffer(_TestIB); - driver.setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); // tmp _MaterialPassThruZTest.setTexture(0, _EnvCubic); - driver.setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); - driver.setConstant(4, 2.f, 1.f, 0.f, 0.f); + driver.setUniformMatrix(IDriver::VertexProgram, testMeshVP->getUniformIndex(CProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity); + driver.setUniform2f(IDriver::VertexProgram, testMeshVP->idx().ProgramConstant0, 2.f, 1.f); //driver.renderTriangles(testMat, 0, TEST_VB_NUM_TRIS); driver.renderTriangles(_MaterialPassThruZTest, 0, TEST_VB_NUM_TRIS); driver.activeVertexProgram(NULL); } - +*/ // ******************************************************************************* void CWaterEnvMap::initFlattenVB() { diff --git a/code/nel/src/3d/water_model.cpp b/code/nel/src/3d/water_model.cpp index ddf3d35b2..eb8ceae27 100644 --- a/code/nel/src/3d/water_model.cpp +++ b/code/nel/src/3d/water_model.cpp @@ -61,7 +61,7 @@ void CWaterModel::setupVertexBuffer(CVertexBuffer &vb, uint numWantedVertices, I vb.setNumVertices(0); vb.setName("Water"); vb.setPreferredMemory(CVertexBuffer::AGPPreferred, false); - if (drv->isWaterShaderSupported()) + if (drv->supportWaterShader()) { vb.setVertexFormat(CVertexBuffer::PositionFlag); } @@ -377,7 +377,7 @@ void CWaterModel::traverseRender() #ifndef FORCE_SIMPLE_WATER_RENDER - if (!drv->isWaterShaderSupported()) + if (!drv->supportWaterShader()) #endif { doSimpleRender(drv); @@ -903,11 +903,12 @@ void CWaterModel::setupMaterialNVertexShader(IDriver *drv, CWaterShape *shape, c _WaterMat.setZWrite(true); _WaterMat.setShader(CMaterial::Water); } - const uint cstOffset = 5; // 4 places for the matrix - NLMISC::CVectorH cst[13]; //=========================// // setup Water material // //=========================// + shape->initVertexProgram(); + CVertexProgramWaterVPNoWave *program = shape->_ColorMap ? CWaterShape::_VertexProgramNoWaveDiffuse : CWaterShape::_VertexProgramNoWave; + drv->activeVertexProgram(program); CWaterModel::_WaterMat.setTexture(0, shape->_BumpMap[0]); CWaterModel::_WaterMat.setTexture(1, shape->_BumpMap[1]); CWaterModel::_WaterMat.setTexture(3, shape->_ColorMap); @@ -953,25 +954,21 @@ void CWaterModel::setupMaterialNVertexShader(IDriver *drv, CWaterShape *shape, c { // setup 2x3 matrix for lookup in diffuse map updateDiffuseMapMatrix(); - cst[11].set(_ColorMapMatColumn0.x, _ColorMapMatColumn1.x, 0, _ColorMapMatColumn0.x * obsPos.x + _ColorMapMatColumn1.x * obsPos.y + _ColorMapMatPos.x); - cst[12].set(_ColorMapMatColumn0.y, _ColorMapMatColumn1.y, 0, _ColorMapMatColumn0.y * obsPos.x + _ColorMapMatColumn1.y * obsPos.y + _ColorMapMatPos.y); + drv->setUniform4f(IDriver::VertexProgram, program->idx().DiffuseMapVector0, _ColorMapMatColumn0.x, _ColorMapMatColumn1.x, 0, _ColorMapMatColumn0.x * obsPos.x + _ColorMapMatColumn1.x * obsPos.y + _ColorMapMatPos.x); + drv->setUniform4f(IDriver::VertexProgram, program->idx().DiffuseMapVector1, _ColorMapMatColumn0.y, _ColorMapMatColumn1.y, 0, _ColorMapMatColumn0.y * obsPos.x + _ColorMapMatColumn1.y * obsPos.y + _ColorMapMatPos.y); } - /// set matrix - drv->setConstantMatrix(0, IDriver::ModelViewProjection, IDriver::Identity); + // set builtins + drv->setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::ModelViewProjection), IDriver::ModelViewProjection, IDriver::Identity); + drv->setUniformFog(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::Fog)); // retrieve current time double date = scene->getCurrentTime(); // set bumpmaps pos - cst[6].set(fmodf(obsPos.x * shape->_HeightMapScale[0].x, 1.f) + (float) fmod(date * shape->_HeightMapSpeed[0].x, 1), fmodf(shape->_HeightMapScale[0].y * obsPos.y, 1.f) + (float) fmod(date * shape->_HeightMapSpeed[0].y, 1), 0.f, 1.f); // bump map 0 offset - cst[5].set(shape->_HeightMapScale[0].x, shape->_HeightMapScale[0].y, 0, 0); // bump map 0 scale - cst[8].set(fmodf(shape->_HeightMapScale[1].x * obsPos.x, 1.f) + (float) fmod(date * shape->_HeightMapSpeed[1].x, 1), fmodf(shape->_HeightMapScale[1].y * obsPos.y, 1.f) + (float) fmod(date * shape->_HeightMapSpeed[1].y, 1), 0.f, 1.f); // bump map 1 offset - cst[7].set(shape->_HeightMapScale[1].x, shape->_HeightMapScale[1].y, 0, 0); // bump map 1 scale - cst[9].set(0, 0, obsPos.z - zHeight, 1.f); - cst[10].set(0.5f, 0.5f, 0.f, 1.f); // used to scale reflected ray into the envmap - /// set all our constants in one call - drv->setConstant(cstOffset, sizeof(cst) / sizeof(cst[0]) - cstOffset, (float *) &cst[cstOffset]); - shape->initVertexProgram(); - drv->activeVertexProgram(shape->_ColorMap ? CWaterShape::_VertexProgramNoWaveDiffuse.get() : CWaterShape::_VertexProgramNoWave.get()); - drv->setConstantFog(4); + drv->setUniform4f(IDriver::VertexProgram, program->idx().BumpMap0Offset, fmodf(obsPos.x * shape->_HeightMapScale[0].x, 1.f) + (float) fmod(date * shape->_HeightMapSpeed[0].x, 1), fmodf(shape->_HeightMapScale[0].y * obsPos.y, 1.f) + (float) fmod(date * shape->_HeightMapSpeed[0].y, 1), 0.f, 1.f); // bump map 0 offset + drv->setUniform4f(IDriver::VertexProgram, program->idx().BumpMap0Scale, shape->_HeightMapScale[0].x, shape->_HeightMapScale[0].y, 0, 0); // bump map 0 scale + drv->setUniform4f(IDriver::VertexProgram, program->idx().BumpMap1Offset, fmodf(shape->_HeightMapScale[1].x * obsPos.x, 1.f) + (float) fmod(date * shape->_HeightMapSpeed[1].x, 1), fmodf(shape->_HeightMapScale[1].y * obsPos.y, 1.f) + (float) fmod(date * shape->_HeightMapSpeed[1].y, 1), 0.f, 1.f); // bump map 1 offset + drv->setUniform4f(IDriver::VertexProgram, program->idx().BumpMap1Scale, shape->_HeightMapScale[1].x, shape->_HeightMapScale[1].y, 0, 0); // bump map 1 scale + drv->setUniform4f(IDriver::VertexProgram, program->idx().ObserverHeight, 0, 0, obsPos.z - zHeight, 1.f); + drv->setUniform4f(IDriver::VertexProgram, program->idx().ScaleReflectedRay, 0.5f, 0.5f, 0.f, 1.f); // used to scale reflected ray into the envmap } //================================================ @@ -1363,7 +1360,7 @@ uint CWaterModel::getNumWantedVertices() uint CWaterModel::fillVB(void *datas, uint startTri, IDriver &drv) { H_AUTO( NL3D_Water_Render ); - if (drv.isWaterShaderSupported()) + if (drv.supportWaterShader()) { return fillVBHard(datas, startTri); } @@ -1657,7 +1654,7 @@ void CWaterModel::traverseRender() drv->setupModelMatrix(modelMat); bool isAbove = obsPos.z > getWorldMatrix().getPos().z; CVertexBuffer &vb = renderTrav.Scene->getWaterVB(); - if (drv->isWaterShaderSupported()) + if (drv->supportWaterShader()) { setupMaterialNVertexShader(drv, shape, obsPos, isAbove, zHeight); nlassert(vb.getNumVertices() > 0); diff --git a/code/nel/src/3d/water_shape.cpp b/code/nel/src/3d/water_shape.cpp index 0196294c3..5c675b12b 100644 --- a/code/nel/src/3d/water_shape.cpp +++ b/code/nel/src/3d/water_shape.cpp @@ -81,7 +81,69 @@ DP4 o[TEX3].x, v[0], c[11]; #compute uv for diffuse texture \n\ DP4 o[TEX3].y, v[0], c[12]; \n\ END"; +CVertexProgramWaterVPNoWave::CVertexProgramWaterVPNoWave(bool diffuse) +{ + m_Diffuse = diffuse; + // nelvp + { + CSource *source = new CSource(); + source->Profile = nelvp; + source->DisplayName = "WaterVPNoWave/nelvp"; + source->ParamIndices["modelViewProjection"] = 0; + source->ParamIndices["fog"] = 4; + source->ParamIndices["bumpMap0Scale"] = 5; + source->ParamIndices["bumpMap0Offset"] = 6; + source->ParamIndices["bumpMap1Scale"] = 7; + source->ParamIndices["bumpMap1Offset"] = 8; + source->ParamIndices["observerHeight"] = 9; + source->ParamIndices["scaleReflectedRay"] = 10; + if (diffuse) + { + source->DisplayName += "/diffuse"; + source->ParamIndices["diffuseMapVector0"] = 11; + source->ParamIndices["diffuseMapVector1"] = 12; + source->setSourcePtr(WaterVPNoWaveDiffuse); + } + else + { + source->setSourcePtr(WaterVPNoWave); + } + addSource(source); + } + // glsl330v + { + // TODO_VP_GLSL + // CSource *source = new CSource(); + // source->Profile = glsl330v; + // source->DisplayName = "WaterVPNoWave/glsl330v"; + // if (diffuse) source->DisplayName += "/diffuse"; + // source->setSource... + // addSource(source); + } +} +void CVertexProgramWaterVPNoWave::buildInfo() +{ + m_Idx.BumpMap0Scale = getUniformIndex("bumpMap0Scale"); + nlassert(m_Idx.BumpMap0Scale != ~0); + m_Idx.BumpMap0Offset = getUniformIndex("bumpMap0Offset"); + nlassert(m_Idx.BumpMap0Offset != ~0); + m_Idx.BumpMap1Scale = getUniformIndex("bumpMap1Scale"); + nlassert(m_Idx.BumpMap1Scale != ~0); + m_Idx.BumpMap1Offset = getUniformIndex("bumpMap1Offset"); + nlassert(m_Idx.BumpMap1Offset != ~0); + m_Idx.ObserverHeight = getUniformIndex("observerHeight"); + nlassert(m_Idx.ObserverHeight != ~0); + m_Idx.ScaleReflectedRay = getUniformIndex("scaleReflectedRay"); + nlassert(m_Idx.ScaleReflectedRay != ~0); + if (m_Diffuse) + { + m_Idx.DiffuseMapVector0 = getUniformIndex("diffuseMapVector0"); + nlassert(m_Idx.DiffuseMapVector0 != ~0); + m_Idx.DiffuseMapVector1 = getUniformIndex("diffuseMapVector1"); + nlassert(m_Idx.DiffuseMapVector1 != ~0); + } +} //////////////// // WAVY WATER // @@ -188,19 +250,19 @@ uint32 CWaterShape::_XGridBorder = 4; uint32 CWaterShape::_YGridBorder = 4; uint32 CWaterShape::_MaxGridSize; bool CWaterShape::_GridSizeTouched = true; -std::auto_ptr CWaterShape::_VertexProgramBump1; -std::auto_ptr CWaterShape::_VertexProgramBump2; -std::auto_ptr CWaterShape::_VertexProgramBump1Diffuse; -std::auto_ptr CWaterShape::_VertexProgramBump2Diffuse; -std::auto_ptr CWaterShape::_VertexProgramNoBump; -std::auto_ptr CWaterShape::_VertexProgramNoBumpDiffuse; +/*NLMISC::CSmartPtr CWaterShape::_VertexProgramBump1; +NLMISC::CSmartPtr CWaterShape::_VertexProgramBump2; +NLMISC::CSmartPtr CWaterShape::_VertexProgramBump1Diffuse; +NLMISC::CSmartPtr CWaterShape::_VertexProgramBump2Diffuse; +NLMISC::CSmartPtr CWaterShape::_VertexProgramNoBump; +NLMISC::CSmartPtr CWaterShape::_VertexProgramNoBumpDiffuse;*/ // water with no waves -std::auto_ptr CWaterShape::_VertexProgramNoWave; -std::auto_ptr CWaterShape::_VertexProgramNoWaveDiffuse; +NLMISC::CSmartPtr CWaterShape::_VertexProgramNoWave; +NLMISC::CSmartPtr CWaterShape::_VertexProgramNoWaveDiffuse; /** Build a vertex program for water depending on requirements - */ + *//* static CVertexProgram *BuildWaterVP(bool diffuseMap, bool bumpMap, bool use2BumpMap) { std::string vp = WaterVPStartCode; @@ -224,7 +286,7 @@ static CVertexProgram *BuildWaterVP(bool diffuseMap, bool bumpMap, bool use2Bump vp += "\nEND"; return new CVertexProgram(vp.c_str()); } - +*/ //============================================ @@ -321,17 +383,17 @@ void CWaterShape::initVertexProgram() if (!created) { // waves - _VertexProgramBump1 = std::auto_ptr(BuildWaterVP(false, true, false)); - _VertexProgramBump2 = std::auto_ptr(BuildWaterVP(false, true, true)); + /*_VertexProgramBump1 = BuildWaterVP(false, true, false); + _VertexProgramBump2 = BuildWaterVP(false, true, true); - _VertexProgramBump1Diffuse = std::auto_ptr(BuildWaterVP(true, true, false)); - _VertexProgramBump2Diffuse = std::auto_ptr(BuildWaterVP(true, true, true)); + _VertexProgramBump1Diffuse = BuildWaterVP(true, true, false); + _VertexProgramBump2Diffuse = BuildWaterVP(true, true, true); - _VertexProgramNoBump = std::auto_ptr(BuildWaterVP(false, false, false)); - _VertexProgramNoBumpDiffuse = std::auto_ptr(BuildWaterVP(true, false, false)); + _VertexProgramNoBump = BuildWaterVP(false, false, false); + _VertexProgramNoBumpDiffuse = BuildWaterVP(true, false, false);*/ // no waves - _VertexProgramNoWave.reset(new CVertexProgram(WaterVPNoWave)); - _VertexProgramNoWaveDiffuse.reset(new CVertexProgram(WaterVPNoWaveDiffuse)); + _VertexProgramNoWave = new CVertexProgramWaterVPNoWave(false); + _VertexProgramNoWaveDiffuse = new CVertexProgramWaterVPNoWave(true); created = true; } } @@ -372,7 +434,7 @@ void CWaterShape::flushTextures (IDriver &driver, uint selectedTexture) /* if ( - (driver.supportTextureShaders() && driver.isTextureAddrModeSupported(CMaterial::OffsetTexture)) + (driver.supportTextureShaders() && driver.supportTextureAddrMode(CMaterial::OffsetTexture)) || driver.supportEMBM() ) { diff --git a/code/nel/src/3d/zone.cpp b/code/nel/src/3d/zone.cpp index 4acca80f5..c601f0fa4 100644 --- a/code/nel/src/3d/zone.cpp +++ b/code/nel/src/3d/zone.cpp @@ -458,7 +458,7 @@ void CZone::serial(NLMISC::IStream &f) throw EOlderStream(f); } - f.serialCheck((uint32)'ENOZ'); + f.serialCheck(NELID("ENOZ")); f.xmlSerial (ZoneId, "ZONE_ID"); f.xmlSerial (ZoneBB, "BB"); diff --git a/code/nel/src/gui/CMakeLists.txt b/code/nel/src/gui/CMakeLists.txt index 3f183a2ff..e3d501e23 100644 --- a/code/nel/src/gui/CMakeLists.txt +++ b/code/nel/src/gui/CMakeLists.txt @@ -1,8 +1,3 @@ -FIND_PACKAGE( Libwww REQUIRED ) -FIND_PACKAGE( CURL REQUIRED ) -FIND_PACKAGE( Lua51 REQUIRED ) -FIND_PACKAGE( Luabind REQUIRED ) - FILE(GLOB SRC *.cpp *.h) FILE(GLOB HEADERS ../../include/nel/gui/*.h) @@ -11,30 +6,21 @@ SOURCE_GROUP("src" FILES ${SRC}) NL_TARGET_LIB(nelgui ${SRC} ${HEADERS}) +INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${LIBWWW_INCLUDE_DIR}) + +TARGET_LINK_LIBRARIES(nelgui nelmisc nel3d ${LUA_LIBRARIES} ${LUABIND_LIBRARIES} ${LIBXML2_LIBRARIES} ${LIBWWW_LIBRARIES} ${CURL_LIBRARIES}) SET_TARGET_PROPERTIES(nelgui PROPERTIES LINK_INTERFACE_LIBRARIES "") NL_DEFAULT_PROPS(nelgui "NeL, Library: NeL GUI") NL_ADD_RUNTIME_FLAGS(nelgui) -INCLUDE_DIRECTORIES(${LUA_INCLUDE_DIR} ${LUABIND_INCLUDE_DIR} ${LIBWWW_INCLUDE_DIR}) - NL_ADD_LIB_SUFFIX(nelgui) -#MESSAGE( "libww libs: ${LIBWWW_LIBRARIES}" ) - -TARGET_LINK_LIBRARIES( nelgui - nelmisc - nel3d - ${LUA_LIBRARIES} - ${LUABIND_LIBRARIES} - ${LIBXML2_LIBRARIES} - ${LIBWWW_LIBRARIES} - ${CURL_LIBRARIES} - ) +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${CURL_DEFINITIONS} ${LUABIND_DEFINITIONS}) IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nelgui ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) ENDIF(WITH_PCH) IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) - INSTALL(TARGETS nelgui LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) + INSTALL(TARGETS nelgui LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/nel/src/gui/ctrl_base_button.cpp b/code/nel/src/gui/ctrl_base_button.cpp index 8c74e3bfc..4a0c53cf4 100644 --- a/code/nel/src/gui/ctrl_base_button.cpp +++ b/code/nel/src/gui/ctrl_base_button.cpp @@ -549,27 +549,27 @@ namespace NLGUI if( editorMode ) { prop = (char*) xmlGetProp( cur, BAD_CAST "onover" ); - if( prop != NULL ) + if (prop) mapAHString( "onover", std::string( (const char*)prop ) ); prop = (char*) xmlGetProp( cur, BAD_CAST "onclick_l" ); - if( prop != NULL ) + if (prop) mapAHString( "onclick_l", std::string( (const char*)prop ) ); prop = (char*) xmlGetProp( cur, BAD_CAST "ondblclick_l" ); - if( prop != NULL ) + if (prop) mapAHString( "ondblclick_l", std::string( (const char*)prop ) ); prop = (char*) xmlGetProp( cur, BAD_CAST "onclick_r" ); - if( prop != NULL ) + if (prop) mapAHString( "onclick_r", std::string( (const char*)prop ) ); prop = (char*) xmlGetProp( cur, BAD_CAST "onlongclick_l" ); - if( prop != NULL ) + if (prop) mapAHString( "onlongclick_l", std::string( (const char*)prop ) ); prop = (char*) xmlGetProp( cur, BAD_CAST "onclock_tick" ); - if( prop != NULL ) + if (prop) mapAHString( "onclock_tick", std::string( (const char*)prop ) ); } diff --git a/code/nel/src/gui/group_container.cpp b/code/nel/src/gui/group_container.cpp index 9cb31deab..c3a7834c5 100644 --- a/code/nel/src/gui/group_container.cpp +++ b/code/nel/src/gui/group_container.cpp @@ -2233,35 +2233,35 @@ namespace NLGUI if( editorMode ) { ptr = xmlGetProp( cur, BAD_CAST "on_open" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_open", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_close" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_close", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_close_button" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_close_button", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_move" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_move", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_deactive_check" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_deactive_check", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_resize" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_resize", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_alpha_settings_changed" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_alpha_settings_changed", std::string( (const char*)ptr ) ); ptr = xmlGetProp( cur, BAD_CAST "on_begin_move" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_begin_move", std::string( (const char*)ptr ) ); } diff --git a/code/nel/src/gui/group_editbox.cpp b/code/nel/src/gui/group_editbox.cpp index 4e8eb3e36..5c2f3bf1d 100644 --- a/code/nel/src/gui/group_editbox.cpp +++ b/code/nel/src/gui/group_editbox.cpp @@ -540,7 +540,7 @@ namespace NLGUI if( editorMode ) { prop = (char*) xmlGetProp( cur, BAD_CAST "onenter" ); - if( prop != NULL ) + if (prop) mapAHString( "onenter", std::string( (const char*)prop ) ); } diff --git a/code/nel/src/gui/group_modal.cpp b/code/nel/src/gui/group_modal.cpp index 654a372f0..fb4c6d129 100644 --- a/code/nel/src/gui/group_modal.cpp +++ b/code/nel/src/gui/group_modal.cpp @@ -244,29 +244,29 @@ namespace NLGUI // read modal option CXMLAutoPtr prop; prop = xmlGetProp (cur, (xmlChar*)"mouse_pos"); - if ( prop ) SpawnOnMousePos= convertBool(prop); + if (prop) SpawnOnMousePos= convertBool(prop); prop = xmlGetProp (cur, (xmlChar*)"exit_click_out"); - if ( prop ) ExitClickOut= convertBool(prop); + if (prop) ExitClickOut= convertBool(prop); prop = xmlGetProp (cur, (xmlChar*)"exit_click_l"); - if ( prop ) ExitClickL= convertBool(prop); + if (prop) ExitClickL= convertBool(prop); prop = xmlGetProp (cur, (xmlChar*)"exit_click_r"); - if ( prop ) ExitClickR= convertBool(prop); + if (prop) ExitClickR= convertBool(prop); prop = xmlGetProp (cur, (xmlChar*)"exit_click_b"); - if ( prop ) ExitClickR= ExitClickL= convertBool(prop); + if (prop) ExitClickR= ExitClickL= convertBool(prop); prop = xmlGetProp (cur, (xmlChar*)"force_inside_screen"); - if ( prop ) ForceInsideScreen= convertBool(prop); + if (prop) ForceInsideScreen= convertBool(prop); prop = xmlGetProp (cur, (xmlChar*)"category"); - if ( prop ) Category= (const char *) prop; + if (prop) Category= (const char *) prop; prop = xmlGetProp (cur, (xmlChar*)"onclick_out"); - if ( prop ) OnClickOut = (const char *) prop; + if (prop) OnClickOut = (const char *) prop; prop = xmlGetProp (cur, (xmlChar*)"onclick_out_params"); - if ( prop ) OnClickOutParams = (const char *) prop; + if (prop) OnClickOutParams = (const char *) prop; prop = xmlGetProp (cur, (xmlChar*)"onpostclick_out"); - if ( prop ) OnPostClickOut = (const char *) prop; + if (prop) OnPostClickOut = (const char *) prop; prop = xmlGetProp (cur, (xmlChar*)"onpostclick_out_params"); - if ( prop ) OnPostClickOutParams = (const char *) prop; + if (prop) OnPostClickOutParams = (const char *) prop; prop = xmlGetProp (cur, (xmlChar*)"exit_key_pushed"); - if ( prop ) ExitKeyPushed= convertBool(prop); + if (prop) ExitKeyPushed= convertBool(prop); // Force parent hotspot for spawn on mouse if(SpawnOnMousePos) diff --git a/code/nel/src/gui/group_wheel.cpp b/code/nel/src/gui/group_wheel.cpp index 59172382e..6f4c96484 100644 --- a/code/nel/src/gui/group_wheel.cpp +++ b/code/nel/src/gui/group_wheel.cpp @@ -119,11 +119,11 @@ namespace NLGUI if( editorMode ) { CXMLAutoPtr ptr( (char*) xmlGetProp( cur, BAD_CAST "on_wheel_up" ) ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_wheel_up", std::string( (const char*)ptr ) ); ptr = (char*) xmlGetProp( cur, BAD_CAST "on_wheel_down" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_wheel_down", std::string( (const char*)ptr ) ); } diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index 4e8919e5c..b2de26527 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -349,27 +349,27 @@ namespace NLGUI if( editorMode ) { ptr = (char*) xmlGetProp( cur, BAD_CAST "on_active" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_active", std::string( (const char*)ptr ) ); ptr = (char*) xmlGetProp( cur, BAD_CAST "on_deactive" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_deactive", std::string( (const char*)ptr ) ); ptr = (char*) xmlGetProp( cur, BAD_CAST "group_onclick_r" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "group_onclick_r", std::string( (const char*)ptr ) ); ptr = (char*) xmlGetProp( cur, BAD_CAST "group_onclick_l" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "group_onclick_l", std::string( (const char*)ptr ) ); ptr = (char*) xmlGetProp( cur, BAD_CAST "on_enter" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_enter", std::string( (const char*)ptr ) ); ptr = (char*) xmlGetProp( cur, BAD_CAST "on_escape" ); - if( ptr != NULL ) + if( ptr ) mapAHString( "on_escape", std::string( (const char*)ptr ) ); } diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index da8bd1e52..01e47bb80 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -41,7 +41,7 @@ #ifdef LUA_NEVRAX_VERSION #include "lua_ide_dll_nevrax/include/lua_ide_dll/ide_interface.h" // external debugger #endif -const uint32 UI_CACHE_SERIAL_CHECK = (uint32) 'IUG_'; +const uint32 UI_CACHE_SERIAL_CHECK = NELID("IUG_"); using namespace NLMISC; using namespace std; @@ -1001,7 +1001,7 @@ namespace NLGUI ptr = (char*) xmlGetProp (cur, (xmlChar*)"target"); std::string target; - if( ptr != NULL ) + if( ptr ) { target = std::string( (const char*)ptr ); if( !editorMode ) @@ -1136,17 +1136,17 @@ namespace NLGUI VariableData data; ptr = xmlGetProp( cur, BAD_CAST "entry" ); - if( ptr != NULL ) + if( ptr ) data.entry = std::string( (const char*)ptr ); data.type = type; ptr = xmlGetProp( cur, BAD_CAST "value" ); - if( ptr != NULL ) + if( ptr ) data.value = std::string( (const char*)ptr ); ptr = xmlGetProp( cur, BAD_CAST "size" ); - if( ptr != NULL ) + if( ptr ) fromString( std::string( (const char*)ptr ), data.size ); variableCache[ data.entry ] = data; diff --git a/code/nel/src/gui/view_renderer.cpp b/code/nel/src/gui/view_renderer.cpp index c61d8fa51..6d3ef62e7 100644 --- a/code/nel/src/gui/view_renderer.cpp +++ b/code/nel/src/gui/view_renderer.cpp @@ -354,6 +354,9 @@ namespace NLGUI // start to draw at the reference corner getTextureSizeFromId (nTxId, txw, txh); + // to avoid a division by zero crash later + if (txw < 0 || txh < 0) return; + if (rot > 3) rot = 3; sint32 startX = x, startY = y; diff --git a/code/nel/src/ligo/ligo_material.cpp b/code/nel/src/ligo/ligo_material.cpp index 643629648..c5e7541a3 100644 --- a/code/nel/src/ligo/ligo_material.cpp +++ b/code/nel/src/ligo/ligo_material.cpp @@ -80,7 +80,7 @@ void CMaterial::serial (NLMISC::IStream &s) s.xmlPush ("LIGO_MATERIAL"); // Serial the header - s.serialCheck ((uint32)'TMOL'); + s.serialCheck (NELID("TMOL")); // Serial the version /*sint ver =*/ s.serialVersion (0); diff --git a/code/nel/src/ligo/transition.cpp b/code/nel/src/ligo/transition.cpp index b13c4f566..ee6921c78 100644 --- a/code/nel/src/ligo/transition.cpp +++ b/code/nel/src/ligo/transition.cpp @@ -199,7 +199,7 @@ void CTransition::serial (NLMISC::IStream &s) s.xmlPush ("LIGO_TRANSITION"); // Serial the header - s.serialCheck ((uint32)'STGL'); + s.serialCheck (NELID("STGL")); // Serial the version /*sint ver =*/ s.serialVersion (0); diff --git a/code/nel/src/ligo/zone_region.cpp b/code/nel/src/ligo/zone_region.cpp index ad65aec8e..9926d3757 100644 --- a/code/nel/src/ligo/zone_region.cpp +++ b/code/nel/src/ligo/zone_region.cpp @@ -153,7 +153,7 @@ void CZoneRegion::serial (NLMISC::IStream &f) f.xmlPush ("LAND"); sint32 version = f.serialVersion (1); - f.serialCheck ((uint32)'DNAL'); + f.serialCheck (NELID("DNAL")); f.xmlSerial (_MinX, "MIN_X"); f.xmlSerial (_MinY, "MIN_Y"); diff --git a/code/nel/src/misc/bitmap.cpp b/code/nel/src/misc/bitmap.cpp index cfe8cab89..f32980508 100644 --- a/code/nel/src/misc/bitmap.cpp +++ b/code/nel/src/misc/bitmap.cpp @@ -19,6 +19,7 @@ #include "nel/misc/bitmap.h" #include "nel/misc/stream.h" #include "nel/misc/file.h" +#include "nel/misc/system_info.h" // Define this to force all bitmap white (debug) // #define NEL_ALL_BITMAP_WHITE diff --git a/code/nel/src/misc/cdb_branch.cpp b/code/nel/src/misc/cdb_branch.cpp index 998ea8cd3..627c1f38b 100644 --- a/code/nel/src/misc/cdb_branch.cpp +++ b/code/nel/src/misc/cdb_branch.cpp @@ -232,6 +232,9 @@ void CCDBNodeBranch::attachChild( ICDBNode * node, string nodeName ) //nldebug ( "CDB: Attaching node" ); _NodesByName.push_back( node ); _Sorted = false; +#if NL_CDB_OPTIMIZE_PREDICT + _PredictNode = node; +#endif } } // attachChild // @@ -799,6 +802,18 @@ public: //----------------------------------------------- ICDBNode *CCDBNodeBranch::find(const std::string &nodeName) { +#if NL_CDB_OPTIMIZE_PREDICT + ICDBNode *predictNode = _PredictNode; + if (predictNode) + { + if (predictNode->getParent() == this + && *predictNode->getName() == nodeName) + { + return predictNode; + } + } +#endif + if (!_Sorted) { _Sorted = true; @@ -812,7 +827,15 @@ ICDBNode *CCDBNodeBranch::find(const std::string &nodeName) else { if (*(*it)->getName() == nodeName) + { +#if NL_CDB_OPTIMIZE_PREDICT + ICDBNode *node = *it; + _PredictNode = node; + return node; +#else return *it; +#endif + } else return NULL; } diff --git a/code/nel/src/misc/gtk_displayer.cpp b/code/nel/src/misc/gtk_displayer.cpp index f558a4909..c2e04e67e 100644 --- a/code/nel/src/misc/gtk_displayer.cpp +++ b/code/nel/src/misc/gtk_displayer.cpp @@ -189,7 +189,8 @@ gint KeyIn(GtkWidget *Widget, GdkEventKey *Event, gpointer *Data) } break; case GDK_Down : - if (CommandHistoryPos + 1 < CommandHistory.size()) { + if (CommandHistoryPos + 1 < CommandHistory.size()) + { CommandHistoryPos++; gtk_entry_set_text (GTK_ENTRY(Widget), CommandHistory[CommandHistoryPos].c_str()); } @@ -374,7 +375,8 @@ gint updateInterf (gpointer data) { uint32 col = (*it).first; GtkTextTag *tag = NULL; - if ((col>>24) == 0) { + if ((col>>24) == 0) + { GdkColor color; color.red = (col >> 8) & 0xFF00; color.green = col & 0xFF00; diff --git a/code/nel/src/misc/p_thread.cpp b/code/nel/src/misc/p_thread.cpp index e4deab4ca..a24029b3c 100644 --- a/code/nel/src/misc/p_thread.cpp +++ b/code/nel/src/misc/p_thread.cpp @@ -17,6 +17,9 @@ #include "stdmisc.h" +#include +#include + #ifdef NL_OS_UNIX #include "nel/misc/p_thread.h" diff --git a/code/nel/src/misc/sstring.cpp b/code/nel/src/misc/sstring.cpp index 492a00db1..fe9332328 100644 --- a/code/nel/src/misc/sstring.cpp +++ b/code/nel/src/misc/sstring.cpp @@ -37,14 +37,13 @@ namespace NLMISC return token; } - uint i; + uint i, j; CSString result; // skip leading junk for (i=0;i #include #include @@ -44,16 +42,7 @@ #include #include -#include "nel/misc/debug.h" -#include "nel/misc/common.h" -#include "nel/misc/fast_mem.h" -#include "nel/misc/system_info.h" -#include "nel/misc/mem_displayer.h" -#include "nel/misc/stream.h" -#include "nel/misc/path.h" -#include "nel/misc/string_common.h" - -#ifdef NL_OS_WINDOWS +#ifdef _WIN32 #define NOMINMAX #include #include diff --git a/code/nel/src/misc/system_info.cpp b/code/nel/src/misc/system_info.cpp index 7ef96ec58..1fa91db6c 100644 --- a/code/nel/src/misc/system_info.cpp +++ b/code/nel/src/misc/system_info.cpp @@ -231,7 +231,14 @@ string CSystemInfo::getOS() } else if ( osvi.dwMajorVersion == 6 ) { - if ( osvi.dwMinorVersion == 1 ) + if ( osvi.dwMinorVersion == 2 ) + { + if( osvi.wProductType == VER_NT_WORKSTATION ) + OSString += " Windows 8"; + else + OSString += " Windows Server 2012"; + } + else if ( osvi.dwMinorVersion == 1 ) { if( osvi.wProductType == VER_NT_WORKSTATION ) OSString += " Windows 7"; diff --git a/code/nel/src/net/email.cpp b/code/nel/src/net/email.cpp index 589e3aa8e..ae6f92477 100644 --- a/code/nel/src/net/email.cpp +++ b/code/nel/src/net/email.cpp @@ -56,7 +56,8 @@ static void uuencode (const char *s, const char *store, const int length) unsigned char *us = (unsigned char *)s; /* Transform the 3x8 bits to 4x6 bits, as required by base64. */ - for (i = 0; i < length; i += 3) { + for (i = 0; i < length; i += 3) + { *p++ = tbl[us[0] >> 2]; *p++ = tbl[((us[0] & 3) << 4) + (us[1] >> 4)]; *p++ = tbl[((us[1] & 0xf) << 2) + (us[2] >> 6)]; @@ -64,10 +65,12 @@ static void uuencode (const char *s, const char *store, const int length) us += 3; } /* Pad the result if necessary... */ - if (i == length + 1) { + if (i == length + 1) + { *(p - 1) = tbl[64]; } - else if (i == length + 2) { + else if (i == length + 2) + { *(p - 1) = *(p - 2) = tbl[64]; } /* ...and zero-terminate it. */ diff --git a/code/nel/src/pacs/primitive_block_pacs.cpp b/code/nel/src/pacs/primitive_block_pacs.cpp index 0681d2eea..1ee0615ea 100644 --- a/code/nel/src/pacs/primitive_block_pacs.cpp +++ b/code/nel/src/pacs/primitive_block_pacs.cpp @@ -16,6 +16,7 @@ #include "stdpacs.h" #include "nel/misc/i_xml.h" +#include "nel/misc/stream.h" #include "nel/pacs/primitive_block.h" @@ -85,7 +86,7 @@ void CPrimitiveBlock::serial (NLMISC::IStream &s) s.xmlPush ("PRIMITIVE_BLOCK"); // Serial checks - s.serialCheck ((uint32)'KBRP'); + s.serialCheck (NELID("KBRP")); // Serial the version (void)s.serialVersion (0); diff --git a/code/nel/tools/3d/CMakeLists.txt b/code/nel/tools/3d/CMakeLists.txt index 441a83800..58bf81f5a 100644 --- a/code/nel/tools/3d/CMakeLists.txt +++ b/code/nel/tools/3d/CMakeLists.txt @@ -24,7 +24,7 @@ IF(WITH_NEL_TOOLS) shapes_exporter tga_cut tga_resize - shape2obj + shape2obj zone_check_bind zone_dump zviewer) @@ -62,7 +62,7 @@ IF(WITH_NEL_TOOLS) ENDIF(WITH_QT) IF(SQUISH_FOUND) - ADD_SUBDIRECTORY(s3tc_compressor_lib) + ADD_SUBDIRECTORY(s3tc_compressor_lib) ADD_SUBDIRECTORY(panoply_maker) ADD_SUBDIRECTORY(tga_2_dds) ADD_SUBDIRECTORY(hls_bank_maker) diff --git a/code/nel/tools/3d/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer/object_viewer.cpp index bc9949079..ff530e007 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer/object_viewer.cpp @@ -1711,8 +1711,8 @@ void CObjectViewer::serial (NLMISC::IStream& f) { // version 4: include particle workspace infos // serial "OBJV_CFG" - f.serialCheck ((uint32)'VJBO'); - f.serialCheck ((uint32)'GFC_'); + f.serialCheck (NELID("VJBO")); + f.serialCheck (NELID("GFC_")); // serial the version int ver=f.serialVersion (4); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt index 43900fe9e..7903114d1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt @@ -8,7 +8,7 @@ ADD_SUBDIRECTORY(object_viewer) ADD_SUBDIRECTORY(georges_editor) IF(WITH_GUI) -ADD_SUBDIRECTORY(gui_editor) + ADD_SUBDIRECTORY(gui_editor) ENDIF(WITH_GUI) ADD_SUBDIRECTORY(translation_manager) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h index f7f26eafc..4071b4637 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h @@ -15,35 +15,35 @@ // along with this program. If not, see . #ifndef EXPANDABLE_HEADERVIEW_H -#define EXPANDABLE_HEADERVIEW_H - -// Qt includes -#include - -namespace GeorgesQt -{ - class ExpandableHeaderView : public QHeaderView - { - Q_OBJECT - public: - ExpandableHeaderView(Qt::Orientation orientation, QWidget * parent = 0); - - bool* expanded() { return &m_expanded; } - - protected: - void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const; - bool isPointInDecoration(int section, QPoint pos)const; - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - - private: - bool m_expanded; - bool m_inDecoration; - -Q_SIGNALS: - void headerClicked(int); - }; - -} /* namespace NLQT */ - -#endif // EXPANDABLE_HEADERVIEW_H +#define EXPANDABLE_HEADERVIEW_H + +// Qt includes +#include + +namespace GeorgesQt +{ + class ExpandableHeaderView : public QHeaderView + { + Q_OBJECT + public: + ExpandableHeaderView(Qt::Orientation orientation, QWidget * parent = 0); + + bool* expanded() { return &m_expanded; } + + protected: + void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const; + bool isPointInDecoration(int section, QPoint pos)const; + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + + private: + bool m_expanded; + bool m_inDecoration; + +Q_SIGNALS: + void headerClicked(int); + }; + +} /* namespace NLQT */ + +#endif // EXPANDABLE_HEADERVIEW_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt index 0a5d8533d..a9083613e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt @@ -1,40 +1,8 @@ -IF(WITH_LUA51) - FIND_PACKAGE(Lua51 REQUIRED) -ELSE(WITH_LUA51) - FIND_PACKAGE(Lua50 REQUIRED) -ENDIF(WITH_LUA51) - FIND_PACKAGE(Luabind REQUIRED) - FIND_PACKAGE(CURL REQUIRED) - -IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") - SET(CURL_STATIC ON) -ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a") - -IF(CURL_STATIC) - SET(CURL_DEFINITIONS -DCURL_STATICLIB) - FIND_PACKAGE(OpenSSL QUIET) - - IF(OPENSSL_FOUND) - SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}) - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) - ENDIF(OPENSSL_FOUND) - - # CURL Macports version depends on libidn, libintl and libiconv too - IF(APPLE) - FIND_LIBRARY(IDN_LIBRARY idn) - FIND_LIBRARY(INTL_LIBRARY intl) - SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY}) - ENDIF(APPLE) -ENDIF(CURL_STATIC) - -FIND_PACKAGE(Libwww REQUIRED) - - -INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${LIBXML2_INCLUDE_DIR} - ${LUA_INCLUDE_DIR} - ${QT_INCLUDES}) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${LIBXML2_INCLUDE_DIR} + ${QT_INCLUDES} + ${LUA_INCLUDE_DIR}) FILE(GLOB SRC *.cpp *.h) @@ -104,12 +72,8 @@ TARGET_LINK_LIBRARIES( nelgui ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} - qt_property_browser - ${LUA_LIBRARIES} - ${LUABIND_LIBRARIES} - ${CURL_LIBRARIES} - ${LIBWWW_LIBRARIES} ${LIBXML2_LIBRARIES} + qt_property_browser ) NL_DEFAULT_PROPS(ovqt_plugin_gui_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: GUI Editor") diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp index 5a8c64f93..0f86ab90c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp @@ -1,191 +1,191 @@ -// Object Viewer Qt - Log Plugin - MMORPG Framework -// Copyright (C) 2011 Adrian Jaekel -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Project includes -#include "log_plugin.h" -#include "log_settings_page.h" -#include "qt_displayer.h" - -#include "../core/icore.h" -#include "../core/core_constants.h" -#include "../core/menu_manager.h" -#include "../../extension_system/iplugin_spec.h" - -// Qt includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// NeL includes -#include - -namespace Plugin -{ - - CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent) - { - m_ui.setupUi(this); - } - - CLogPlugin::~CLogPlugin() - { - Q_FOREACH(QObject *obj, m_autoReleaseObjects) - { - m_plugMan->removeObject(obj); - } - qDeleteAll(m_autoReleaseObjects); - m_autoReleaseObjects.clear(); - - NLMISC::ErrorLog->removeDisplayer(m_displayer); - NLMISC::WarningLog->removeDisplayer(m_displayer); - NLMISC::DebugLog->removeDisplayer(m_displayer); - NLMISC::AssertLog->removeDisplayer(m_displayer); - NLMISC::InfoLog->removeDisplayer(m_displayer); - delete m_displayer; - } - - bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) - { - Q_UNUSED(errorString); - m_plugMan = pluginManager; - m_logSettingsPage = new CLogSettingsPage(this, this); - addAutoReleasedObject(m_logSettingsPage); - return true; - } - - void CLogPlugin::extensionsInitialized() - { - setDisplayers(); - - Core::ICore *core = Core::ICore::instance(); - Core::MenuManager *menuManager = core->menuManager(); - QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW); - - QMainWindow *wnd = Core::ICore::instance()->mainWindow(); - wnd->addDockWidget(Qt::RightDockWidgetArea, this); - hide(); - - viewMenu->addAction(this->toggleViewAction()); - } - - void CLogPlugin::setNelContext(NLMISC::INelContext *nelContext) - { -#ifdef NL_OS_WINDOWS - // Ensure that a context doesn't exist yet. - // This only applies to platforms without PIC, e.g. Windows. - nlassert(!NLMISC::INelContext::isContextInitialised()); -#endif // fdef NL_OS_WINDOWS^M - m_libContext = new NLMISC::CLibraryContext(*nelContext); - - m_displayer = new NLQT::CQtDisplayer(m_ui.plainTextEdit); - - } - - QString CLogPlugin::name() const - { - return "LogPlugin"; - } - - QString CLogPlugin::version() const - { - return "1.1"; - } - - QString CLogPlugin::vendor() const - { - return "aquiles"; - } - - QString CLogPlugin::description() const - { - return tr("DockWidget to display all log messages from NeL."); - } - - QStringList CLogPlugin::dependencies() const - { - QStringList list; - list.append(Core::Constants::OVQT_CORE_PLUGIN); - return list; - } - - void CLogPlugin::addAutoReleasedObject(QObject *obj) - { - m_plugMan->addObject(obj); - m_autoReleaseObjects.prepend(obj); - } - - void CLogPlugin::setDisplayers() - { - QSettings *settings = Core::ICore::instance()->settings(); - - settings->beginGroup(Core::Constants::LOG_SECTION); +// Object Viewer Qt - Log Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +// Project includes +#include "log_plugin.h" +#include "log_settings_page.h" +#include "qt_displayer.h" + +#include "../core/icore.h" +#include "../core/core_constants.h" +#include "../core/menu_manager.h" +#include "../../extension_system/iplugin_spec.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// NeL includes +#include + +namespace Plugin +{ + + CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent) + { + m_ui.setupUi(this); + } + + CLogPlugin::~CLogPlugin() + { + Q_FOREACH(QObject *obj, m_autoReleaseObjects) + { + m_plugMan->removeObject(obj); + } + qDeleteAll(m_autoReleaseObjects); + m_autoReleaseObjects.clear(); + + NLMISC::ErrorLog->removeDisplayer(m_displayer); + NLMISC::WarningLog->removeDisplayer(m_displayer); + NLMISC::DebugLog->removeDisplayer(m_displayer); + NLMISC::AssertLog->removeDisplayer(m_displayer); + NLMISC::InfoLog->removeDisplayer(m_displayer); + delete m_displayer; + } + + bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) + { + Q_UNUSED(errorString); + m_plugMan = pluginManager; + m_logSettingsPage = new CLogSettingsPage(this, this); + addAutoReleasedObject(m_logSettingsPage); + return true; + } + + void CLogPlugin::extensionsInitialized() + { + setDisplayers(); + + Core::ICore *core = Core::ICore::instance(); + Core::MenuManager *menuManager = core->menuManager(); + QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW); + + QMainWindow *wnd = Core::ICore::instance()->mainWindow(); + wnd->addDockWidget(Qt::RightDockWidgetArea, this); + hide(); + + viewMenu->addAction(this->toggleViewAction()); + } + + void CLogPlugin::setNelContext(NLMISC::INelContext *nelContext) + { +#ifdef NL_OS_WINDOWS + // Ensure that a context doesn't exist yet. + // This only applies to platforms without PIC, e.g. Windows. + nlassert(!NLMISC::INelContext::isContextInitialised()); +#endif // fdef NL_OS_WINDOWS^M + m_libContext = new NLMISC::CLibraryContext(*nelContext); + + m_displayer = new NLQT::CQtDisplayer(m_ui.plainTextEdit); + + } + + QString CLogPlugin::name() const + { + return "LogPlugin"; + } + + QString CLogPlugin::version() const + { + return "1.1"; + } + + QString CLogPlugin::vendor() const + { + return "aquiles"; + } + + QString CLogPlugin::description() const + { + return tr("DockWidget to display all log messages from NeL."); + } + + QStringList CLogPlugin::dependencies() const + { + QStringList list; + list.append(Core::Constants::OVQT_CORE_PLUGIN); + return list; + } + + void CLogPlugin::addAutoReleasedObject(QObject *obj) + { + m_plugMan->addObject(obj); + m_autoReleaseObjects.prepend(obj); + } + + void CLogPlugin::setDisplayers() + { + QSettings *settings = Core::ICore::instance()->settings(); + + settings->beginGroup(Core::Constants::LOG_SECTION); bool error = settings->value(Core::Constants::LOG_ERROR, true).toBool(); bool warning = settings->value(Core::Constants::LOG_WARNING, true).toBool(); bool debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool(); bool assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool(); - bool info = settings->value(Core::Constants::LOG_INFO, true).toBool(); - settings->endGroup(); - - if (error) { - if (!NLMISC::ErrorLog->attached(m_displayer)) - NLMISC::ErrorLog->addDisplayer(m_displayer); - } else { - if (m_displayer) { - NLMISC::ErrorLog->removeDisplayer(m_displayer); - } - } - if (warning) { - if (!NLMISC::WarningLog->attached(m_displayer)) - NLMISC::WarningLog->addDisplayer(m_displayer); - } else { - if (m_displayer) { - NLMISC::WarningLog->removeDisplayer(m_displayer); - } - } - if (debug) { - if (!NLMISC::DebugLog->attached(m_displayer)) - NLMISC::DebugLog->addDisplayer(m_displayer); - } else { - if (m_displayer) { - NLMISC::DebugLog->removeDisplayer(m_displayer); - } - } - if (assert) { - if (!NLMISC::AssertLog->attached(m_displayer)) - NLMISC::AssertLog->addDisplayer(m_displayer); - } else { - if (m_displayer) { - NLMISC::AssertLog->removeDisplayer(m_displayer); - } - } - if (info) { - if (!NLMISC::InfoLog->attached(m_displayer)) - NLMISC::InfoLog->addDisplayer(m_displayer); - } else { - if (m_displayer) { - NLMISC::InfoLog->removeDisplayer(m_displayer); - } - } - } -} -Q_EXPORT_PLUGIN(Plugin::CLogPlugin) + bool info = settings->value(Core::Constants::LOG_INFO, true).toBool(); + settings->endGroup(); + + if (error) { + if (!NLMISC::ErrorLog->attached(m_displayer)) + NLMISC::ErrorLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::ErrorLog->removeDisplayer(m_displayer); + } + } + if (warning) { + if (!NLMISC::WarningLog->attached(m_displayer)) + NLMISC::WarningLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::WarningLog->removeDisplayer(m_displayer); + } + } + if (debug) { + if (!NLMISC::DebugLog->attached(m_displayer)) + NLMISC::DebugLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::DebugLog->removeDisplayer(m_displayer); + } + } + if (assert) { + if (!NLMISC::AssertLog->attached(m_displayer)) + NLMISC::AssertLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::AssertLog->removeDisplayer(m_displayer); + } + } + if (info) { + if (!NLMISC::InfoLog->attached(m_displayer)) + NLMISC::InfoLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::InfoLog->removeDisplayer(m_displayer); + } + } + } +} +Q_EXPORT_PLUGIN(Plugin::CLogPlugin) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h index 6a2d78f79..2221195a8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h @@ -1,33 +1,33 @@ -/* -Log Plugin Qt -Copyright (C) 2011 Adrian Jaekel - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - +/* +Log Plugin Qt +Copyright (C) 2011 Adrian Jaekel + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + */ #ifndef LOG_PLUGIN_H #define LOG_PLUGIN_H -// Project includes +// Project includes #include "ui_log_form.h" #include "../../extension_system/iplugin.h" // NeL includes #include "nel/misc/app_context.h" -// Qt includes +// Qt includes #include namespace NLMISC @@ -54,7 +54,7 @@ namespace Plugin Q_OBJECT Q_INTERFACES(ExtensionSystem::IPlugin) public: - CLogPlugin(QWidget *parent = 0); + CLogPlugin(QWidget *parent = 0); ~CLogPlugin(); bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); @@ -63,26 +63,26 @@ namespace Plugin void setNelContext(NLMISC::INelContext *nelContext); NLQT::CQtDisplayer* displayer() { return m_displayer; } - QString name() const; - QString version() const; - QString vendor() const; + QString name() const; + QString version() const; + QString vendor() const; QString description() const; - QStringList dependencies() const; - - void addAutoReleasedObject(QObject *obj); - - void setDisplayers(); - - protected: - NLMISC::CLibraryContext *m_libContext; + QStringList dependencies() const; + + void addAutoReleasedObject(QObject *obj); + + void setDisplayers(); + + protected: + NLMISC::CLibraryContext *m_libContext; private: ExtensionSystem::IPluginManager *m_plugMan; QList m_autoReleaseObjects; CLogSettingsPage *m_logSettingsPage; - Ui::CLogPlugin m_ui; - + Ui::CLogPlugin m_ui; + NLQT::CQtDisplayer *m_displayer; }; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp index 3aba359a5..4b3fa1ebb 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp @@ -1,133 +1,133 @@ -// Object Viewer Qt - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// Copyright (C) 2011 Adrian Jaekel -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Project includes -#include "log_settings_page.h" -#include "log_plugin.h" -#include "../core/core_constants.h" -#include "../core/icore.h" -#include "../../extension_system/plugin_manager.h" - -// NeL includes - -// Qt includes -#include -#include - +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Adrian Jaekel +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +// Project includes +#include "log_settings_page.h" +#include "log_plugin.h" +#include "../core/core_constants.h" +#include "../core/icore.h" +#include "../../extension_system/plugin_manager.h" + +// NeL includes + +// Qt includes +#include +#include + namespace ExtensionSystem { - class IPluginManager; -} - -namespace Plugin -{ - - class CLogPlugin; - - CLogSettingsPage::CLogSettingsPage(CLogPlugin *logPlugin, QObject *parent) - : IOptionsPage(parent), - m_logPlugin(logPlugin), - m_currentPage(NULL), + class IPluginManager; +} + +namespace Plugin +{ + + class CLogPlugin; + + CLogSettingsPage::CLogSettingsPage(CLogPlugin *logPlugin, QObject *parent) + : IOptionsPage(parent), + m_logPlugin(logPlugin), + m_currentPage(NULL), m_error(true), m_warning(true), m_debug(true), m_assert(true), - m_info(true) - { - } - - QString CLogSettingsPage::id() const - { - return QLatin1String("log"); - } - - QString CLogSettingsPage::trName() const - { - return tr("Log"); - } - - QString CLogSettingsPage::category() const - { - return QLatin1String(Core::Constants::SETTINGS_CATEGORY_GENERAL); - } - - QString CLogSettingsPage::trCategory() const - { - return tr(Core::Constants::SETTINGS_TR_CATEGORY_GENERAL); - } - - QIcon CLogSettingsPage::categoryIcon() const - { - return QIcon(); - } - - QWidget *CLogSettingsPage::createPage(QWidget *parent) - { - m_currentPage = new QWidget(parent); - m_ui.setupUi(m_currentPage); - - readSettings(); - m_ui.errorCheck->setChecked(m_error); - m_ui.warningCheck->setChecked(m_warning); - m_ui.debugCheck->setChecked(m_debug); - m_ui.assertCheck->setChecked(m_assert); - m_ui.infoCheck->setChecked(m_info); - - return m_currentPage; - } - - void CLogSettingsPage::apply() - { - m_error = m_ui.errorCheck->isChecked(); - m_warning = m_ui.warningCheck->isChecked(); - m_debug = m_ui.debugCheck->isChecked(); - m_assert = m_ui.assertCheck->isChecked(); - m_info = m_ui.infoCheck->isChecked(); - - writeSettings(); - m_logPlugin->setDisplayers(); - } - - void CLogSettingsPage::readSettings() - { - QSettings *settings = Core::ICore::instance()->settings(); - - settings->beginGroup(Core::Constants::LOG_SECTION); + m_info(true) + { + } + + QString CLogSettingsPage::id() const + { + return QLatin1String("log"); + } + + QString CLogSettingsPage::trName() const + { + return tr("Log"); + } + + QString CLogSettingsPage::category() const + { + return QLatin1String(Core::Constants::SETTINGS_CATEGORY_GENERAL); + } + + QString CLogSettingsPage::trCategory() const + { + return tr(Core::Constants::SETTINGS_TR_CATEGORY_GENERAL); + } + + QIcon CLogSettingsPage::categoryIcon() const + { + return QIcon(); + } + + QWidget *CLogSettingsPage::createPage(QWidget *parent) + { + m_currentPage = new QWidget(parent); + m_ui.setupUi(m_currentPage); + + readSettings(); + m_ui.errorCheck->setChecked(m_error); + m_ui.warningCheck->setChecked(m_warning); + m_ui.debugCheck->setChecked(m_debug); + m_ui.assertCheck->setChecked(m_assert); + m_ui.infoCheck->setChecked(m_info); + + return m_currentPage; + } + + void CLogSettingsPage::apply() + { + m_error = m_ui.errorCheck->isChecked(); + m_warning = m_ui.warningCheck->isChecked(); + m_debug = m_ui.debugCheck->isChecked(); + m_assert = m_ui.assertCheck->isChecked(); + m_info = m_ui.infoCheck->isChecked(); + + writeSettings(); + m_logPlugin->setDisplayers(); + } + + void CLogSettingsPage::readSettings() + { + QSettings *settings = Core::ICore::instance()->settings(); + + settings->beginGroup(Core::Constants::LOG_SECTION); m_error = settings->value(Core::Constants::LOG_ERROR, true).toBool(); m_warning = settings->value(Core::Constants::LOG_WARNING, true).toBool(); m_debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool(); m_assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool(); - m_info = settings->value(Core::Constants::LOG_INFO, true).toBool(); - settings->endGroup(); - } - - void CLogSettingsPage::writeSettings() - { - QSettings *settings = Core::ICore::instance()->settings(); - - settings->beginGroup(Core::Constants::LOG_SECTION); - settings->setValue(Core::Constants::LOG_ERROR, m_error); - settings->setValue(Core::Constants::LOG_WARNING, m_warning); - settings->setValue(Core::Constants::LOG_DEBUG, m_debug); - settings->setValue(Core::Constants::LOG_ASSERT, m_assert); - settings->setValue(Core::Constants::LOG_INFO, m_info); - settings->endGroup(); - - settings->sync(); - } - + m_info = settings->value(Core::Constants::LOG_INFO, true).toBool(); + settings->endGroup(); + } + + void CLogSettingsPage::writeSettings() + { + QSettings *settings = Core::ICore::instance()->settings(); + + settings->beginGroup(Core::Constants::LOG_SECTION); + settings->setValue(Core::Constants::LOG_ERROR, m_error); + settings->setValue(Core::Constants::LOG_WARNING, m_warning); + settings->setValue(Core::Constants::LOG_DEBUG, m_debug); + settings->setValue(Core::Constants::LOG_ASSERT, m_assert); + settings->setValue(Core::Constants::LOG_INFO, m_info); + settings->endGroup(); + + settings->sync(); + } + } /* namespace Plugin */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.h index 1dffea313..dc19db1c6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.h @@ -1,56 +1,56 @@ -#ifndef MISSION_COMPILER_MAIN_WINDOW_H -#define MISSION_COMPILER_MAIN_WINDOW_H - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace Ui { - class MissionCompilerMainWindow; -} - -struct CMission; - -class MissionCompilerMainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit MissionCompilerMainWindow(QWidget *parent = 0); - ~MissionCompilerMainWindow(); - - void loadConfig(); - void saveConfig(); - QUndoStack *getUndoStack() { return m_undoStack; } - - typedef std::map TMissionContainer; - -public Q_SLOTS: - void handleFilterChanged(const QString &text); - void handleValidation(); - void handleCompile(); - void handlePublish(); - void handleAllDoubleClick(const QModelIndex &index); - void handleSelDoubleClick(const QModelIndex &index); - void handleMoveSelectedRight(); - void handleMoveSelectedLeft(); - void handleMoveAllRight(); - void handleMoveAllLeft(); - void handleDataDirButton(); - void handleDataDirChanged(const QString &text); - void handleResetFiltersButton(); - void handleChangedSettings(); - -private: - Ui::MissionCompilerMainWindow *ui; +#ifndef MISSION_COMPILER_MAIN_WINDOW_H +#define MISSION_COMPILER_MAIN_WINDOW_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace Ui { + class MissionCompilerMainWindow; +} + +struct CMission; + +class MissionCompilerMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MissionCompilerMainWindow(QWidget *parent = 0); + ~MissionCompilerMainWindow(); + + void loadConfig(); + void saveConfig(); + QUndoStack *getUndoStack() { return m_undoStack; } + + typedef std::map TMissionContainer; + +public Q_SLOTS: + void handleFilterChanged(const QString &text); + void handleValidation(); + void handleCompile(); + void handlePublish(); + void handleAllDoubleClick(const QModelIndex &index); + void handleSelDoubleClick(const QModelIndex &index); + void handleMoveSelectedRight(); + void handleMoveSelectedLeft(); + void handleMoveAllRight(); + void handleMoveAllLeft(); + void handleDataDirButton(); + void handleDataDirChanged(const QString &text); + void handleResetFiltersButton(); + void handleChangedSettings(); + +private: + Ui::MissionCompilerMainWindow *ui; void updateCompileLog(); void populateAllPrimitives(const QString &dataDir = QString()); @@ -60,16 +60,16 @@ private: void applyCheckboxes(const QStringList &servers); - QMenu *_toolModeMenu; - QUndoStack *m_undoStack; - QStringListModel *m_allPrimitivesModel; - QStringListModel *m_selectedPrimitivesModel; - QSortFilterProxyModel *m_filteredProxyModel; - QRegExp *m_regexpFilter; - QString m_compileLog; - QString m_lastDir; - - NLLIGO::CLigoConfig m_ligoConfig; -}; - -#endif // MISSION_COMPILER_MAIN_WINDOW_H + QMenu *_toolModeMenu; + QUndoStack *m_undoStack; + QStringListModel *m_allPrimitivesModel; + QStringListModel *m_selectedPrimitivesModel; + QSortFilterProxyModel *m_filteredProxyModel; + QRegExp *m_regexpFilter; + QString m_compileLog; + QString m_lastDir; + + NLLIGO::CLigoConfig m_ligoConfig; +}; + +#endif // MISSION_COMPILER_MAIN_WINDOW_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.ui index dace315ab..3adc8e176 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.ui @@ -253,10 +253,7 @@ - horizontalLayoutWidget dataDirLabel - horizontalLayoutWidget - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.cpp index a9ef08f50..206f0db77 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.cpp @@ -1,63 +1,63 @@ -// Object Viewer Qt - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// Copyright (C) 2011 Dzmitry Kamiahin -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Project includes -#include "server_entry_dialog.h" - -#include "ui_server_entry_dialog.h" - -// NeL includes - -// Qt includes -#include - -namespace MissionCompiler -{ - -ServerEntryDialog::ServerEntryDialog(QWidget *parent) - : QDialog(parent), - m_ui(new Ui::ServerEntryDialog) -{ - m_ui->setupUi(this); - - connect(m_ui->serverTextPathButton, SIGNAL(clicked()), this, SLOT(lookupTextPath())); - connect(m_ui->serverPrimPathButton, SIGNAL(clicked()), this, SLOT(lookupPrimPath())); -} - -ServerEntryDialog::~ServerEntryDialog() -{ - delete m_ui; -} - +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2011 Dzmitry Kamiahin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +// Project includes +#include "server_entry_dialog.h" + +#include "ui_server_entry_dialog.h" + +// NeL includes + +// Qt includes +#include + +namespace MissionCompiler +{ + +ServerEntryDialog::ServerEntryDialog(QWidget *parent) + : QDialog(parent), + m_ui(new Ui::ServerEntryDialog) +{ + m_ui->setupUi(this); + + connect(m_ui->serverTextPathButton, SIGNAL(clicked()), this, SLOT(lookupTextPath())); + connect(m_ui->serverPrimPathButton, SIGNAL(clicked()), this, SLOT(lookupPrimPath())); +} + +ServerEntryDialog::~ServerEntryDialog() +{ + delete m_ui; +} + QString ServerEntryDialog::getServerName() { return m_ui->serverNameEdit->text(); } -QString ServerEntryDialog::getTextPath() -{ - return m_ui->serverTextPathEdit->text(); -} - -QString ServerEntryDialog::getPrimPath() -{ - return m_ui->serverPrimPathEdit->text(); -} - +QString ServerEntryDialog::getTextPath() +{ + return m_ui->serverTextPathEdit->text(); +} + +QString ServerEntryDialog::getPrimPath() +{ + return m_ui->serverPrimPathEdit->text(); +} + void ServerEntryDialog::setServerName(QString name) { m_ui->serverNameEdit->setText(name); @@ -68,22 +68,22 @@ void ServerEntryDialog::setTextPath(QString path) m_ui->serverTextPathEdit->setText(path); } -void ServerEntryDialog::setPrimPath(QString path) -{ - m_ui->serverPrimPathEdit->setText(path); -} - -void ServerEntryDialog::lookupTextPath() -{ - QString curPath = m_ui->serverTextPathEdit->text(); - QString path = QFileDialog::getExistingDirectory(this, "", curPath); - m_ui->serverTextPathEdit->setText(path); -} - -void ServerEntryDialog::lookupPrimPath() -{ - QString curPath = m_ui->serverPrimPathEdit->text(); - QString path = QFileDialog::getExistingDirectory(this, "", curPath); - m_ui->serverPrimPathEdit->setText(path); -} +void ServerEntryDialog::setPrimPath(QString path) +{ + m_ui->serverPrimPathEdit->setText(path); +} + +void ServerEntryDialog::lookupTextPath() +{ + QString curPath = m_ui->serverTextPathEdit->text(); + QString path = QFileDialog::getExistingDirectory(this, "", curPath); + m_ui->serverTextPathEdit->setText(path); +} + +void ServerEntryDialog::lookupPrimPath() +{ + QString curPath = m_ui->serverPrimPathEdit->text(); + QString path = QFileDialog::getExistingDirectory(this, "", curPath); + m_ui->serverPrimPathEdit->setText(path); +} } /* namespace MissionCompiler */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.h index 98a086cd0..6dd560876 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.h @@ -21,8 +21,8 @@ #include -namespace Ui { - class ServerEntryDialog; +namespace Ui { + class ServerEntryDialog; } namespace MissionCompiler diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.cpp index 74b5cfbdb..b859d9d66 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.cpp @@ -50,8 +50,8 @@ void CSchemeManager::getSchemes(const std::string &type, std::vector -#include -#include -#include -#include - -#include "qnel_widget.h" -#include "painter_dock_widget.h" - -#include "../core/icore.h" -#include "../core/menu_manager.h" -#include "../core/core_constants.h" - -ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::ZonePainterMainWindow) -{ - ui->setupUi(this); - m_nelWidget = new NLQT::QNLWidget(this); - setCentralWidget(m_nelWidget); - - // Load the settings. - loadConfig(); - - // Set up dock widget(s) and toolbar. - m_painterDockWidget = new PainterDockWidget(this); - addDockWidget(Qt::RightDockWidgetArea, m_painterDockWidget); - m_painterDockWidget->setVisible(true); - - // Insert tool modes - _toolModeMenu = new QMenu(tr("Tool Mode"), ui->painterToolBar); - _toolModeMenu->setIcon(QIcon(":/painterTools/images/draw-brush.png")); - ui->painterToolBar->addAction(_toolModeMenu->menuAction()); - //connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode())); - - QSignalMapper *modeMapper = new QSignalMapper(this); - - _toolPaintModeAction = _toolModeMenu->addAction(tr("Paint Mode")); - _toolPaintModeAction->setIcon(QIcon(":/painterTools/images/draw-brush.png")); - _toolPaintModeAction->setStatusTip(tr("Set paint mode")); - connect(_toolPaintModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - modeMapper->setMapping(_toolPaintModeAction, 0); - - _toolFillModeAction = _toolModeMenu->addAction(tr("Fill Mode")); - _toolFillModeAction->setStatusTip(tr("Set fill mode")); - _toolFillModeAction->setIcon(QIcon(":/painterTools/images/color-fill.png")); - connect(_toolFillModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - modeMapper->setMapping(_toolFillModeAction, 1); - - _toolSelectModeAction = _toolModeMenu->addAction(tr("Select mode")); - _toolSelectModeAction->setIcon(QIcon(":/painterTools/images/go-jump-4.png")); - _toolSelectModeAction->setStatusTip(tr("Set select mode")); - connect(_toolSelectModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - modeMapper->setMapping(_toolSelectModeAction, 2); - - _toolPickModeAction = _toolModeMenu->addAction(tr("Pick mode")); - _toolPickModeAction->setIcon(QIcon(":/painterTools/images/color-picker-black.png")); - _toolPickModeAction->setStatusTip(tr("Set color picking mode")); - connect(_toolPickModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - modeMapper->setMapping(_toolPickModeAction, 2); - - connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setToolMode(int))); - - m_statusBarTimer = new QTimer(this); - connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar())); - m_statusInfo = new QLabel(this); - m_statusInfo->hide(); - - // Set Background Color Toolbar - - - connect(ui->actionBackground_Dlg, SIGNAL(triggered()), this, SLOT(setBackgroundColor())); - - - Core::ICore::instance()->mainWindow()->statusBar()->addPermanentWidget(m_statusInfo); - - m_undoStack = new QUndoStack(this); -} - -void ZonePainterMainWindow::showEvent(QShowEvent *showEvent) -{ - QMainWindow::showEvent(showEvent); - m_statusBarTimer->start(1000); - m_statusInfo->show(); -} - -void ZonePainterMainWindow::hideEvent(QHideEvent *hideEvent) -{ - m_statusBarTimer->stop(); - m_statusInfo->hide(); - QMainWindow::hideEvent(hideEvent); -} - -void ZonePainterMainWindow::updateStatusBar() -{ - m_statusInfo->setText(QString("Tool Mode: Paint Mode")); -} - -void ZonePainterMainWindow::setToolMode(int value) -{ - switch (value) - { - case 0: - //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); - break; - case 1: - //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); - break; - case 2: - //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); - break; - } -} - -void ZonePainterMainWindow::setToolMode() -{ - //switch (Modules::objView().getDriver()->getPolygonMode()) - //{ - //case NL3D::UDriver::Filled: - // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); - // break; - //case NL3D::UDriver::Line: - // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); - // break; - //case NL3D::UDriver::Point: - // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); - // break; - //} -} - -void ZonePainterMainWindow::setBackgroundColor() { - QColor color = QColorDialog::getColor(QColor(m_nelWidget->backgroundColor().R, - m_nelWidget->backgroundColor().G, - m_nelWidget->backgroundColor().B)); - if (color.isValid()) - m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue())); -} - -void ZonePainterMainWindow::loadConfig() { +#include "zone_painter_main_window.h" +#include "ui_zone_painter_main_window.h" + +#include +#include +#include +#include +#include + +#include "qnel_widget.h" +#include "painter_dock_widget.h" + +#include "../core/icore.h" +#include "../core/menu_manager.h" +#include "../core/core_constants.h" + +ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::ZonePainterMainWindow) +{ + ui->setupUi(this); + m_nelWidget = new NLQT::QNLWidget(this); + setCentralWidget(m_nelWidget); + + // Load the settings. + loadConfig(); + + // Set up dock widget(s) and toolbar. + m_painterDockWidget = new PainterDockWidget(this); + addDockWidget(Qt::RightDockWidgetArea, m_painterDockWidget); + m_painterDockWidget->setVisible(true); + + // Insert tool modes + _toolModeMenu = new QMenu(tr("Tool Mode"), ui->painterToolBar); + _toolModeMenu->setIcon(QIcon(":/painterTools/images/draw-brush.png")); + ui->painterToolBar->addAction(_toolModeMenu->menuAction()); + //connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode())); + + QSignalMapper *modeMapper = new QSignalMapper(this); + + _toolPaintModeAction = _toolModeMenu->addAction(tr("Paint Mode")); + _toolPaintModeAction->setIcon(QIcon(":/painterTools/images/draw-brush.png")); + _toolPaintModeAction->setStatusTip(tr("Set paint mode")); + connect(_toolPaintModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolPaintModeAction, 0); + + _toolFillModeAction = _toolModeMenu->addAction(tr("Fill Mode")); + _toolFillModeAction->setStatusTip(tr("Set fill mode")); + _toolFillModeAction->setIcon(QIcon(":/painterTools/images/color-fill.png")); + connect(_toolFillModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolFillModeAction, 1); + + _toolSelectModeAction = _toolModeMenu->addAction(tr("Select mode")); + _toolSelectModeAction->setIcon(QIcon(":/painterTools/images/go-jump-4.png")); + _toolSelectModeAction->setStatusTip(tr("Set select mode")); + connect(_toolSelectModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolSelectModeAction, 2); + + _toolPickModeAction = _toolModeMenu->addAction(tr("Pick mode")); + _toolPickModeAction->setIcon(QIcon(":/painterTools/images/color-picker-black.png")); + _toolPickModeAction->setStatusTip(tr("Set color picking mode")); + connect(_toolPickModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolPickModeAction, 2); + + connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setToolMode(int))); + + m_statusBarTimer = new QTimer(this); + connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar())); + m_statusInfo = new QLabel(this); + m_statusInfo->hide(); + + // Set Background Color Toolbar + + + connect(ui->actionBackground_Dlg, SIGNAL(triggered()), this, SLOT(setBackgroundColor())); + + + Core::ICore::instance()->mainWindow()->statusBar()->addPermanentWidget(m_statusInfo); + + m_undoStack = new QUndoStack(this); +} + +void ZonePainterMainWindow::showEvent(QShowEvent *showEvent) +{ + QMainWindow::showEvent(showEvent); + m_statusBarTimer->start(1000); + m_statusInfo->show(); +} + +void ZonePainterMainWindow::hideEvent(QHideEvent *hideEvent) +{ + m_statusBarTimer->stop(); + m_statusInfo->hide(); + QMainWindow::hideEvent(hideEvent); +} + +void ZonePainterMainWindow::updateStatusBar() +{ + m_statusInfo->setText(QString("Tool Mode: Paint Mode")); +} + +void ZonePainterMainWindow::setToolMode(int value) +{ + switch (value) + { + case 0: + //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); + break; + case 1: + //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); + break; + case 2: + //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); + break; + } +} + +void ZonePainterMainWindow::setToolMode() +{ + //switch (Modules::objView().getDriver()->getPolygonMode()) + //{ + //case NL3D::UDriver::Filled: + // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); + // break; + //case NL3D::UDriver::Line: + // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); + // break; + //case NL3D::UDriver::Point: + // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); + // break; + //} +} + +void ZonePainterMainWindow::setBackgroundColor() { + QColor color = QColorDialog::getColor(QColor(m_nelWidget->backgroundColor().R, + m_nelWidget->backgroundColor().G, + m_nelWidget->backgroundColor().B)); + if (color.isValid()) + m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue())); +} + +void ZonePainterMainWindow::loadConfig() { QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup("ZonePainter"); QColor color; color = settings->value("BackgroundColor", QColor(80, 80, 80)).value(); settings->endGroup(); - m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue(), color.alpha())); -} - -void ZonePainterMainWindow::saveConfig() { + m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue(), color.alpha())); +} + +void ZonePainterMainWindow::saveConfig() { QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup("ZonePainter" ); @@ -157,12 +157,12 @@ void ZonePainterMainWindow::saveConfig() { settings->setValue("BackgroundColor", color); settings->endGroup(); - settings->sync(); -} - -ZonePainterMainWindow::~ZonePainterMainWindow() -{ - delete ui; - delete m_nelWidget; - delete m_painterDockWidget; -} + settings->sync(); +} + +ZonePainterMainWindow::~ZonePainterMainWindow() +{ + delete ui; + delete m_nelWidget; + delete m_painterDockWidget; +} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h index 0dbfd9948..caa4433e4 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h @@ -1,57 +1,57 @@ -#ifndef ZONE_PAINTER_MAIN_WINDOW_H -#define ZONE_PAINTER_MAIN_WINDOW_H - -#include -#include -#include -#include -#include - -namespace NLQT { - class QNLWidget; -} - -namespace Ui { - class ZonePainterMainWindow; -} - -class PainterDockWidget; - -class ZonePainterMainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit ZonePainterMainWindow(QWidget *parent = 0); - ~ZonePainterMainWindow(); - - void loadConfig(); - void saveConfig(); - QUndoStack *getUndoStack() { return m_undoStack; } -public Q_SLOTS: +#ifndef ZONE_PAINTER_MAIN_WINDOW_H +#define ZONE_PAINTER_MAIN_WINDOW_H + +#include +#include +#include +#include +#include + +namespace NLQT { + class QNLWidget; +} + +namespace Ui { + class ZonePainterMainWindow; +} + +class PainterDockWidget; + +class ZonePainterMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit ZonePainterMainWindow(QWidget *parent = 0); + ~ZonePainterMainWindow(); + + void loadConfig(); + void saveConfig(); + QUndoStack *getUndoStack() { return m_undoStack; } +public Q_SLOTS: void setToolMode(int value); - void setToolMode(); - void updateStatusBar(); - void setBackgroundColor(); - -protected: - virtual void showEvent(QShowEvent *showEvent); - virtual void hideEvent(QHideEvent *hideEvent); - -private: - Ui::ZonePainterMainWindow *ui; - NLQT::QNLWidget *m_nelWidget; - PainterDockWidget *m_painterDockWidget; - QTimer *m_statusBarTimer; - QLabel *m_statusInfo; - + void setToolMode(); + void updateStatusBar(); + void setBackgroundColor(); + +protected: + virtual void showEvent(QShowEvent *showEvent); + virtual void hideEvent(QHideEvent *hideEvent); + +private: + Ui::ZonePainterMainWindow *ui; + NLQT::QNLWidget *m_nelWidget; + PainterDockWidget *m_painterDockWidget; + QTimer *m_statusBarTimer; + QLabel *m_statusInfo; + QAction *_toolPaintModeAction; QAction *_toolFillModeAction; QAction *_toolSelectModeAction; QAction *_toolPickModeAction; - QMenu *_toolModeMenu; - QUndoStack *m_undoStack; - //QAction *m_setBackColorAction; -}; - -#endif // ZONE_PAINTER_MAIN_WINDOW_H + QMenu *_toolModeMenu; + QUndoStack *m_undoStack; + //QAction *m_setBackColorAction; +}; + +#endif // ZONE_PAINTER_MAIN_WINDOW_H diff --git a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp index 70bf51f81..af026b3df 100644 --- a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp +++ b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.cpp @@ -1,724 +1,724 @@ -/* -Object Viewer Qt Widget -Copyright (C) 2010 Adrian Jaekel - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "object_viewer_widget.h" - -// STL includes - -// NeL includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Qt includes -#include - -// Project includes - -Q_EXPORT_PLUGIN2(object_viewer_widget_qt, NLQT::CObjectViewerWidget) - -using namespace NLMISC; -using namespace NL3D; -using namespace std; - -namespace NLQT -{ - CObjectViewerWidget *CObjectViewerWidget::_objectViewerWidget = NULL; - - CObjectViewerWidget::CObjectViewerWidget(QWidget *parent) - : _isGraphicsInitialized(false), _isGraphicsEnabled(false), - _Driver(NULL), _Light(0), _phi(0), _psi(0),_dist(2), - _CameraFocal(75), _CurrentInstance(""), _BloomEffect(false), - _Scene(0), QWidget(parent) - { +/* +Object Viewer Qt Widget +Copyright (C) 2010 Adrian Jaekel + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include "object_viewer_widget.h" + +// STL includes + +// NeL includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Qt includes +#include + +// Project includes + +Q_EXPORT_PLUGIN2(object_viewer_widget_qt, NLQT::CObjectViewerWidget) + +using namespace NLMISC; +using namespace NL3D; +using namespace std; + +namespace NLQT +{ + CObjectViewerWidget *CObjectViewerWidget::_objectViewerWidget = NULL; + + CObjectViewerWidget::CObjectViewerWidget(QWidget *parent) + : _isGraphicsInitialized(false), _isGraphicsEnabled(false), + _Driver(NULL), _Light(0), _phi(0), _psi(0),_dist(2), + _CameraFocal(75), _CurrentInstance(""), _BloomEffect(false), + _Scene(0), QWidget(parent) + { setMouseTracking(true); - setFocusPolicy(Qt::StrongFocus); - _objectViewerWidget = this; - - _isGraphicsEnabled = true; - - // As a special case, a QTimer with a timeout of 0 will time out as soon as all the events in the window system's event queue have been processed. - // This can be used to do heavy work while providing a snappy user interface. - _mainTimer = new QTimer(this); - connect(_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender())); - // timer->start(); // <- timeout 0 - // it's heavy on cpu, though, when no 3d driver initialized :) - _mainTimer->start(25); // 25fps - } - - CObjectViewerWidget::~CObjectViewerWidget() - { - release(); - } - - void CObjectViewerWidget::showEvent ( QShowEvent * event ) - { - if (!_mainTimer->isActive()) - { - _mainTimer->start(25); - } - } - - void CObjectViewerWidget::setNelContext(NLMISC::INelContext &nelContext) - { - _LibContext = new CLibraryContext(nelContext); - } - - void CObjectViewerWidget::init() - { - - connect(this, SIGNAL(topLevelChanged(bool)), - this, SLOT(topLevelChanged(bool))); - //H_AUTO2 - //nldebug("%d %d %d",_nlw->winId(), width(), height()); - - -#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC) - //dynamic_cast(widget())->makeCurrent(); -#endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC) - - nlWindow wnd = (nlWindow)winId(); - uint16 w = width(); - uint16 h = height(); - - setMouseTracking(true); - - // set background color from config - //NLMISC::CConfigFile::CVar v = Modules::config().getConfigFile().getVar("BackgroundColor"); - //_BackgroundColor = CRGBA(v.asInt(0), v.asInt(1), v.asInt(2)); - _BackgroundColor = CRGBA(255, 255, 255); - - // set graphics driver from config - //NLMISC::CConfigFile::CVar v2 = Modules::config().getConfigFile().getVar("GraphicsDriver"); - // Choose driver opengl to work correctly under Linux example - _Direct3D = false; //_Driver = OpenGL; - -#ifdef NL_OS_WINDOWS - //std::string driver = v2.asString(); - //if (driver == "Direct3D") _Direct3D = true; //m_Driver = Direct3D; - //else if (driver == "OpenGL") _Direct3D = false; //m_Driver = OpenGL; - //else nlwarning("Invalid driver specified, defaulting to OpenGL"); -#endif - - //Modules::config().setAndCallback("CameraFocal",CConfigCallback(this,&CObjectViewer::cfcbCameraFocal)); - //Modules::config().setAndCallback("BloomEffect",CConfigCallback(this,&CObjectViewer::cfcbBloomEffect)); - - // create the driver - nlassert(!_Driver); - - _Driver = UDriver::createDriver(0, _Direct3D, 0); - nlassert(_Driver); - - // initialize the window with config file values - _Driver->setDisplay(wnd, NL3D::UDriver::CMode(w, h, 32)); - - //_Light = ULight::createLight(); - - //// set mode of the light - //_Light->setMode(ULight::DirectionalLight); - - //// set position of the light - //_Light->setPosition(CVector(-20.f, 30.f, 10.f)); - - //// white light - //_Light->setAmbiant(CRGBA(255, 255, 255)); - - //// set and enable the light - //_Driver->setLight(0, *_Light); - //_Driver->enableLight(0); - - // Create a scene - _Scene = _Driver->createScene(true); - - _PlayListManager = _Scene->createPlayListManager(); - - //_Scene->enableLightingSystem(true); - - // create the camera - UCamera camera = _Scene->getCam(); - - camera.setTransformMode (UTransformable::DirectMatrix); - - setSizeViewport(w, h); - - // camera will look at entities - camera.lookAt(NLMISC::CVector(_dist,0,1), NLMISC::CVector(0,0,0.5)); - - NLMISC::CVector hotSpot=NLMISC::CVector(0,0,0); - - _MouseListener = _Driver->create3dMouseListener(); - _MouseListener->setMatrix(_Scene->getCam().getMatrix()); - _MouseListener->setFrustrum(_Scene->getCam().getFrustum()); - _MouseListener->setHotSpot(hotSpot); - _MouseListener->setMouseMode(U3dMouseListener::edit3d); - - NL3D::CBloomEffect::instance().setDriver(_Driver); - NL3D::CBloomEffect::instance().setScene(_Scene); - NL3D::CBloomEffect::instance().init(!_Direct3D); - //NL3D::CBloomEffect::instance().setDensityBloom(Modules::config().getConfigFile().getVar("BloomDensity").asInt()); - //NL3D::CBloomEffect::instance().setSquareBloom(Modules::config().getConfigFile().getVar("BloomSquare").asBool()); - } - - void CObjectViewerWidget::release() - { - //H_AUTO2 - nldebug(""); - - _Driver->delete3dMouseListener(_MouseListener); - - // delete all entities - deleteEntities(); - - _Scene->deletePlayListManager(_PlayListManager); - - // delete the scene - _Driver->deleteScene(_Scene); - - // delete the light - delete _Light; - - // release driver - nlassert(_Driver); - _Driver->release(); - delete _Driver; - _Driver = NULL; - } - - void CObjectViewerWidget::updateRender() - { - //nldebug("CMainWindow::updateRender"); - updateInitialization(isVisible()); - - //QModelIndex index = _dirModel->setRootPath("D:/Dev/Ryzom/code/ryzom/common/data_leveldesign/leveldesign"); - //_dirTree->setRootIndex(index); - - if (isVisible()) - { - // call all update functions - // 01. Update Utilities (configuration etc) - - // 02. Update Time (deltas) - // ... - - // 03. Update Receive (network, servertime, receive messages) - // ... - - // 04. Update Input (keyboard controls, etc) - if (_isGraphicsInitialized) - updateInput(); - - // 05. Update Weather (sky, snow, wind, fog, sun) - // ... - - // 06. Update Entities (movement, do after possible tp from incoming messages etc) - // - Move other entities - // - Update self entity - // - Move bullets - // ... - - // 07. Update Landscape (async zone loading near entity) - // ... - - // 08. Update Collisions (entities) - // - Update entities - // - Update move container (swap with Update entities? todo: check code!) - // - Update bullets - // ... - - // 09. Update Animations (playlists) - // - Needs to be either before or after entities, not sure, - // there was a problem with wrong order a while ago!!! - - - //updateAnimation(_AnimationDialog->getTime()); - updateAnimatePS(); - // 10. Update Camera (depends on entities) - // ... - - // 11. Update Interface (login, ui, etc) - // ... - - // 12. Update Sound (sound driver) - // ... - - // 13. Update Send (network, send new position etc) - // ... - - // 14. Update Debug (stuff for dev) - // ... - - if (_isGraphicsInitialized && !getDriver()->isLost()) - { - // 01. Render Driver (background color) - renderDriver(); // clear all buffers - - // 02. Render Sky (sky scene) - // ... - - // 04. Render Scene (entity scene) - renderScene(); - - // 05. Render Effects (flare) - // ... - - // 06. Render Interface 3D (player names) - // ... - - // 07. Render Debug 3D - // ... - - // 08. Render Interface 2D (chatboxes etc, optionally does have 3d) - // ... - - // 09. Render Debug 2D (stuff for dev) - renderDebug2D(); - - // swap 3d buffers - getDriver()->swapBuffers(); - } - } - } - - void CObjectViewerWidget::updateInitialization(bool visible) - { - //nldebug("CMainWindow::updateInitialization"); - bool done; - do - { - done = true; // set false whenever change - bool wantGraphics = _isGraphicsEnabled && visible; - // bool wantLandscape = wantGraphics && m_IsGraphicsInitialized && isLandscapeEnabled; - - // .. stuff that depends on other stuff goes on top to prioritize deinitialization - - // Landscape - // ... - - // Graphics (Driver) - if (_isGraphicsInitialized) - { - if (!wantGraphics) - { - //_isGraphicsInitialized = false; - //release(); - _mainTimer->stop(); - //done = false; - } - } - else - { - if (wantGraphics) - { - init(); - _isGraphicsInitialized = true; - _mainTimer->start(25); - //done = false; - } - } - } - while (!done); - } - - void CObjectViewerWidget::updateInput() - { - _Driver->EventServer.pump(); - - // New matrix from camera - _Scene->getCam().setTransformMode(NL3D::UTransformable::DirectMatrix); - _Scene->getCam().setMatrix (_MouseListener->getViewMatrix()); - - //nldebug("%s",_Scene->getCam().getMatrix().getPos().asString().c_str()); - } - - void CObjectViewerWidget::renderDriver() - { - // Render the scene. - if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect)) - { - NL3D::CBloomEffect::instance().initBloom(); - } - _Driver->clearBuffers(_BackgroundColor); - } - - void CObjectViewerWidget::renderScene() - { - // render the scene - _Scene->render(); - - if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect)) - { - NL3D::CBloomEffect::instance().endBloom(); - NL3D::CBloomEffect::instance().endInterfacesDisplayBloom(); - } - } - - void CObjectViewerWidget::renderDebug2D() - { - } - - void CObjectViewerWidget::saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga) - { - //H_AUTO2 - - // FIXME: create screenshot path if it doesn't exist! - - // empty bitmap - CBitmap bitmap; - // copy the driver buffer to the bitmap - _Driver->getBuffer(bitmap); - // create the file name - string filename = std::string("./") + nameFile; - // write the bitmap as a jpg, png or tga to the file - if (jpg) - { - string newfilename = CFile::findNewFile(filename + ".jpg"); - COFile outputFile(newfilename); - bitmap.writeJPG(outputFile, 100); - nlinfo("Screenshot '%s' saved", newfilename.c_str()); - } - if (png) - { - string newfilename = CFile::findNewFile(filename + ".png"); - COFile outputFile(newfilename); - bitmap.writePNG(outputFile, 24); - nlinfo("Screenshot '%s' saved", newfilename.c_str()); - } - if (tga) - { - string newfilename = CFile::findNewFile(filename + ".tga"); - COFile outputFile(newfilename); - bitmap.writeTGA(outputFile, 24, false); - nlinfo("Screenshot '%s' saved", newfilename.c_str()); - } - } - - bool CObjectViewerWidget::loadMesh(const std::string &meshFileName, const std::string &skelFileName) - { - std::string fileName = CFile::getFilenameWithoutExtension(meshFileName); - if ( _Entities.count(fileName) != 0) - return false; - - CPath::addSearchPath(CFile::getPath(meshFileName), false, false); - - // create instance of the mesh character - UInstance Entity = _Scene->createInstance(meshFileName); - - CAABBox bbox; - Entity.getShapeAABBox(bbox); - setCamera(_Scene, bbox , Entity, true); - - _MouseListener->setMatrix(_Scene->getCam().getMatrix()); - - USkeleton Skeleton = _Scene->createSkeleton(skelFileName); - - // if we can't create entity, skip it - if (Entity.empty()) return false; - - // create a new entity - EIT eit = (_Entities.insert (make_pair (fileName, CEntity()))).first; - CEntity &entity = (*eit).second; - - // set the entity up - entity._Name = fileName; - entity._FileNameShape = meshFileName; - entity._FileNameSkeleton = skelFileName; - entity._Instance = Entity; - if (!Skeleton.empty()) - { - entity._Skeleton = Skeleton; - entity._Skeleton.bindSkin (entity._Instance); - } - entity._AnimationSet = _Driver->createAnimationSet(false); - entity._PlayList = _PlayListManager->createPlayList(entity._AnimationSet); - return true; - } - - void CObjectViewerWidget::setVisible(bool visible) - { - // called by show() - // code assuming visible window needed to init the 3d driver - nldebug("%d", visible); - if (visible) - { - QWidget::setVisible(true); - } - else - { - QWidget::setVisible(false); - } - } - - void CObjectViewerWidget::resetScene() - { - deleteEntities(); - - // Reset camera. - //.. - - // to load files with the same name but located in different directories - //CPath::clearMap(); - - // load and set search paths from config - //Modules::config().configSearchPaths(); - - _CurrentInstance = ""; - - nlinfo("Scene cleared"); - } - - void CObjectViewerWidget::setBackgroundColor(NLMISC::CRGBA backgroundColor) - { - _BackgroundColor = backgroundColor; - - // config file variable changes - //Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.R, 0); - //Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.G, 1); - //Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.B, 2); - } - - void CObjectViewerWidget::setGraphicsDriver(bool Direct3D) - { - //_Direct3D = Direct3D; - - //if (_Direct3D) Modules::config().getConfigFile().getVar("GraphicsDriver").setAsString("Direct3D"); - //else Modules::config().getConfigFile().getVar("GraphicsDriver").setAsString("OpenGL"); - } - - void CObjectViewerWidget::setSizeViewport(uint16 w, uint16 h) - { - _Scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)w/h, 0.1f, 1000); - } - - void CObjectViewerWidget::setCurrentObject(const std::string &name) - { - if ((_Entities.count(name) != 0) || ( name.empty() )) _CurrentInstance = name; - else nlerror ("Entity %s not found", name.c_str()); - nlinfo("set current entity %s", _CurrentInstance.c_str()); - } - - CEntity& CObjectViewerWidget::getEntity(const std::string &name) - { - if ( _Entities.count(name) == 0) nlerror("Entity %s not found", name.c_str()); - EIT eit = _Entities.find (name); - return (*eit).second; - } - - void CObjectViewerWidget::getListObjects(std::vector &listObj) - { - listObj.clear(); - for (EIT eit = _Entities.begin(); eit != _Entities.end(); ++eit) - listObj.push_back((*eit).second._Name); - } - - void CObjectViewerWidget::deleteEntity(CEntity &entity) - { - if (entity._PlayList != NULL) - { - _PlayListManager->deletePlayList (entity._PlayList); - entity._PlayList = NULL; - } - - if (entity._AnimationSet != NULL) - { - _Driver->deleteAnimationSet(entity._AnimationSet); - entity._AnimationSet = NULL; - } - - if (!entity._Skeleton.empty()) - { - entity._Skeleton.detachSkeletonSon(entity._Instance); - - _Scene->deleteSkeleton(entity._Skeleton); - entity._Skeleton = NULL; - } - - if (!entity._Instance.empty()) - { - _Scene->deleteInstance(entity._Instance); - entity._Instance = NULL; - } - } - - void CObjectViewerWidget::deleteEntities() - { - for (EIT eit = _Entities.begin(); eit != _Entities.end(); ++eit) - { - CEntity &entity = (*eit).second; - deleteEntity(entity); - } - _Entities.clear(); - } - - void CObjectViewerWidget::setCamera(NL3D::UScene *scene, CAABBox &bbox, UTransform &entity, bool high_z) - { - CVector pos(0.f, 0.f, 0.f); - CQuat quat(0.f, 0.f, 0.f, 0.f); - NL3D::UInstance inst; - inst.cast(entity); - if (!inst.empty()) - { - inst.getDefaultPos(pos); - inst.getDefaultRotQuat(quat); - } - - // fix scale (some shapes have a different value) - entity.setScale(1.f, 1.f, 1.f); - - UCamera Camera = scene->getCam(); - CVector max_radius = bbox.getHalfSize(); - - CVector center = bbox.getCenter(); - entity.setPivot(center); - center += pos; - - //scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)w/h, 0.1f, 1000); - float fov = float(_CameraFocal * (float)Pi/180.0); - //Camera.setPerspective (fov, 1.0f, 0.1f, 1000.0f); - float radius = max(max(max_radius.x, max_radius.y), max_radius.z); - if (radius == 0.f) radius = 1.f; - float left, right, bottom, top, znear, zfar; - Camera.getFrustum(left, right, bottom, top, znear, zfar); - float dist = (radius / (tan(fov/2))) * 0.2; - CVector eye(center); - CVector ax(quat.getAxis()); - - if (ax.isNull() || ax == CVector::I) - { - ax = CVector::J; - } - else if (ax == -CVector::K) - { - ax = -CVector::J; - } - - eye -= ax * (dist+radius); - if (high_z) - eye.z += max_radius.z/1.0f; - Camera.lookAt(eye, center); - setupLight(eye, center - eye); - } - - bool CObjectViewerWidget::setupLight(const CVector &position, const CVector &direction) - { - if (!_Light) - _Light = ULight::createLight(); - if (!_Light) return false; - - // set mode of the light - _Light->setMode(ULight::DirectionalLight); - - // set position of the light - // Light->setupDirectional(settings.light_ambiant, settings.light_diffuse, settings.light_specular, settings.light_direction); - NLMISC::CRGBA light_ambiant = CRGBA(0,0,0); - NLMISC::CRGBA light_diffuse = CRGBA(255,255,255); - NLMISC::CRGBA light_specular = CRGBA(255,255,255); - NLMISC::CVector light_direction = CVector(0.25, 0.25, 0.25); - _Light->setupPointLight(light_ambiant, light_diffuse, light_specular, position, direction + light_direction); - - // set and enable the light - _Driver->setLight(0, *_Light); - _Driver->enableLight(0); - - return true; - } - - QIcon* CObjectViewerWidget::saveOneImage(string shapename) - { - int output_width = 128; - int output_height = 128; - - // Create a scene - NL3D::UScene* Scene = _Driver->createScene(true); - if (!Scene) return 0; - - // get scene camera - if (Scene->getCam().empty()) - { - nlwarning("can't get camera from scene"); - return 0; - } - - // add an entity to the scene - UInstance Entity = Scene->createInstance(shapename.c_str()); - - // if we can't create entity, skip it - if (Entity.empty()) - { - nlwarning("can't create instance from %s", shapename.c_str()); - return 0; - } - - // get AABox of Entity - CAABBox bbox; - Entity.getShapeAABBox(bbox); - setCamera(Scene, bbox , Entity, true); - Scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)output_width/output_height, 0.1f, 1000); - - string filename = CPath::standardizePath("") + toString("%s.%s", shapename.c_str(), "png"); - - // the background is white - _Driver->clearBuffers(); - - // render the scene - Scene->render(); - - CBitmap btm; - _Driver->getBuffer(btm); - - btm.resample(output_width, output_height); - - COFile fs; - - if (fs.open(filename)) - { - if (!btm.writePNG(fs, 24)) - { - nlwarning("can't save image to PNG"); - return 0; - } - } - else - { - nlwarning("can't create %s", "test.png"); - return 0; - } - fs.close(); - - QIcon *icon = new QIcon(QString(filename.c_str())); - //CFile::deleteFile(filename); - return icon; - } + setFocusPolicy(Qt::StrongFocus); + _objectViewerWidget = this; + + _isGraphicsEnabled = true; + + // As a special case, a QTimer with a timeout of 0 will time out as soon as all the events in the window system's event queue have been processed. + // This can be used to do heavy work while providing a snappy user interface. + _mainTimer = new QTimer(this); + connect(_mainTimer, SIGNAL(timeout()), this, SLOT(updateRender())); + // timer->start(); // <- timeout 0 + // it's heavy on cpu, though, when no 3d driver initialized :) + _mainTimer->start(25); // 25fps + } + + CObjectViewerWidget::~CObjectViewerWidget() + { + release(); + } + + void CObjectViewerWidget::showEvent ( QShowEvent * event ) + { + if (!_mainTimer->isActive()) + { + _mainTimer->start(25); + } + } + + void CObjectViewerWidget::setNelContext(NLMISC::INelContext &nelContext) + { + _LibContext = new CLibraryContext(nelContext); + } + + void CObjectViewerWidget::init() + { + + connect(this, SIGNAL(topLevelChanged(bool)), + this, SLOT(topLevelChanged(bool))); + //H_AUTO2 + //nldebug("%d %d %d",_nlw->winId(), width(), height()); + + +#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC) + //dynamic_cast(widget())->makeCurrent(); +#endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC) + + nlWindow wnd = (nlWindow)winId(); + uint16 w = width(); + uint16 h = height(); + + setMouseTracking(true); + + // set background color from config + //NLMISC::CConfigFile::CVar v = Modules::config().getConfigFile().getVar("BackgroundColor"); + //_BackgroundColor = CRGBA(v.asInt(0), v.asInt(1), v.asInt(2)); + _BackgroundColor = CRGBA(255, 255, 255); + + // set graphics driver from config + //NLMISC::CConfigFile::CVar v2 = Modules::config().getConfigFile().getVar("GraphicsDriver"); + // Choose driver opengl to work correctly under Linux example + _Direct3D = false; //_Driver = OpenGL; + +#ifdef NL_OS_WINDOWS + //std::string driver = v2.asString(); + //if (driver == "Direct3D") _Direct3D = true; //m_Driver = Direct3D; + //else if (driver == "OpenGL") _Direct3D = false; //m_Driver = OpenGL; + //else nlwarning("Invalid driver specified, defaulting to OpenGL"); +#endif + + //Modules::config().setAndCallback("CameraFocal",CConfigCallback(this,&CObjectViewer::cfcbCameraFocal)); + //Modules::config().setAndCallback("BloomEffect",CConfigCallback(this,&CObjectViewer::cfcbBloomEffect)); + + // create the driver + nlassert(!_Driver); + + _Driver = UDriver::createDriver(0, _Direct3D, 0); + nlassert(_Driver); + + // initialize the window with config file values + _Driver->setDisplay(wnd, NL3D::UDriver::CMode(w, h, 32)); + + //_Light = ULight::createLight(); + + //// set mode of the light + //_Light->setMode(ULight::DirectionalLight); + + //// set position of the light + //_Light->setPosition(CVector(-20.f, 30.f, 10.f)); + + //// white light + //_Light->setAmbiant(CRGBA(255, 255, 255)); + + //// set and enable the light + //_Driver->setLight(0, *_Light); + //_Driver->enableLight(0); + + // Create a scene + _Scene = _Driver->createScene(true); + + _PlayListManager = _Scene->createPlayListManager(); + + //_Scene->enableLightingSystem(true); + + // create the camera + UCamera camera = _Scene->getCam(); + + camera.setTransformMode (UTransformable::DirectMatrix); + + setSizeViewport(w, h); + + // camera will look at entities + camera.lookAt(NLMISC::CVector(_dist,0,1), NLMISC::CVector(0,0,0.5)); + + NLMISC::CVector hotSpot=NLMISC::CVector(0,0,0); + + _MouseListener = _Driver->create3dMouseListener(); + _MouseListener->setMatrix(_Scene->getCam().getMatrix()); + _MouseListener->setFrustrum(_Scene->getCam().getFrustum()); + _MouseListener->setHotSpot(hotSpot); + _MouseListener->setMouseMode(U3dMouseListener::edit3d); + + NL3D::CBloomEffect::instance().setDriver(_Driver); + NL3D::CBloomEffect::instance().setScene(_Scene); + NL3D::CBloomEffect::instance().init(!_Direct3D); + //NL3D::CBloomEffect::instance().setDensityBloom(Modules::config().getConfigFile().getVar("BloomDensity").asInt()); + //NL3D::CBloomEffect::instance().setSquareBloom(Modules::config().getConfigFile().getVar("BloomSquare").asBool()); + } + + void CObjectViewerWidget::release() + { + //H_AUTO2 + nldebug(""); + + _Driver->delete3dMouseListener(_MouseListener); + + // delete all entities + deleteEntities(); + + _Scene->deletePlayListManager(_PlayListManager); + + // delete the scene + _Driver->deleteScene(_Scene); + + // delete the light + delete _Light; + + // release driver + nlassert(_Driver); + _Driver->release(); + delete _Driver; + _Driver = NULL; + } + + void CObjectViewerWidget::updateRender() + { + //nldebug("CMainWindow::updateRender"); + updateInitialization(isVisible()); + + //QModelIndex index = _dirModel->setRootPath("D:/Dev/Ryzom/code/ryzom/common/data_leveldesign/leveldesign"); + //_dirTree->setRootIndex(index); + + if (isVisible()) + { + // call all update functions + // 01. Update Utilities (configuration etc) + + // 02. Update Time (deltas) + // ... + + // 03. Update Receive (network, servertime, receive messages) + // ... + + // 04. Update Input (keyboard controls, etc) + if (_isGraphicsInitialized) + updateInput(); + + // 05. Update Weather (sky, snow, wind, fog, sun) + // ... + + // 06. Update Entities (movement, do after possible tp from incoming messages etc) + // - Move other entities + // - Update self entity + // - Move bullets + // ... + + // 07. Update Landscape (async zone loading near entity) + // ... + + // 08. Update Collisions (entities) + // - Update entities + // - Update move container (swap with Update entities? todo: check code!) + // - Update bullets + // ... + + // 09. Update Animations (playlists) + // - Needs to be either before or after entities, not sure, + // there was a problem with wrong order a while ago!!! + + + //updateAnimation(_AnimationDialog->getTime()); + updateAnimatePS(); + // 10. Update Camera (depends on entities) + // ... + + // 11. Update Interface (login, ui, etc) + // ... + + // 12. Update Sound (sound driver) + // ... + + // 13. Update Send (network, send new position etc) + // ... + + // 14. Update Debug (stuff for dev) + // ... + + if (_isGraphicsInitialized && !getDriver()->isLost()) + { + // 01. Render Driver (background color) + renderDriver(); // clear all buffers + + // 02. Render Sky (sky scene) + // ... + + // 04. Render Scene (entity scene) + renderScene(); + + // 05. Render Effects (flare) + // ... + + // 06. Render Interface 3D (player names) + // ... + + // 07. Render Debug 3D + // ... + + // 08. Render Interface 2D (chatboxes etc, optionally does have 3d) + // ... + + // 09. Render Debug 2D (stuff for dev) + renderDebug2D(); + + // swap 3d buffers + getDriver()->swapBuffers(); + } + } + } + + void CObjectViewerWidget::updateInitialization(bool visible) + { + //nldebug("CMainWindow::updateInitialization"); + bool done; + do + { + done = true; // set false whenever change + bool wantGraphics = _isGraphicsEnabled && visible; + // bool wantLandscape = wantGraphics && m_IsGraphicsInitialized && isLandscapeEnabled; + + // .. stuff that depends on other stuff goes on top to prioritize deinitialization + + // Landscape + // ... + + // Graphics (Driver) + if (_isGraphicsInitialized) + { + if (!wantGraphics) + { + //_isGraphicsInitialized = false; + //release(); + _mainTimer->stop(); + //done = false; + } + } + else + { + if (wantGraphics) + { + init(); + _isGraphicsInitialized = true; + _mainTimer->start(25); + //done = false; + } + } + } + while (!done); + } + + void CObjectViewerWidget::updateInput() + { + _Driver->EventServer.pump(); + + // New matrix from camera + _Scene->getCam().setTransformMode(NL3D::UTransformable::DirectMatrix); + _Scene->getCam().setMatrix (_MouseListener->getViewMatrix()); + + //nldebug("%s",_Scene->getCam().getMatrix().getPos().asString().c_str()); + } + + void CObjectViewerWidget::renderDriver() + { + // Render the scene. + if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect)) + { + NL3D::CBloomEffect::instance().initBloom(); + } + _Driver->clearBuffers(_BackgroundColor); + } + + void CObjectViewerWidget::renderScene() + { + // render the scene + _Scene->render(); + + if((NL3D::CBloomEffect::instance().getDriver() != NULL) && (_BloomEffect)) + { + NL3D::CBloomEffect::instance().endBloom(); + NL3D::CBloomEffect::instance().endInterfacesDisplayBloom(); + } + } + + void CObjectViewerWidget::renderDebug2D() + { + } + + void CObjectViewerWidget::saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga) + { + //H_AUTO2 + + // FIXME: create screenshot path if it doesn't exist! + + // empty bitmap + CBitmap bitmap; + // copy the driver buffer to the bitmap + _Driver->getBuffer(bitmap); + // create the file name + string filename = std::string("./") + nameFile; + // write the bitmap as a jpg, png or tga to the file + if (jpg) + { + string newfilename = CFile::findNewFile(filename + ".jpg"); + COFile outputFile(newfilename); + bitmap.writeJPG(outputFile, 100); + nlinfo("Screenshot '%s' saved", newfilename.c_str()); + } + if (png) + { + string newfilename = CFile::findNewFile(filename + ".png"); + COFile outputFile(newfilename); + bitmap.writePNG(outputFile, 24); + nlinfo("Screenshot '%s' saved", newfilename.c_str()); + } + if (tga) + { + string newfilename = CFile::findNewFile(filename + ".tga"); + COFile outputFile(newfilename); + bitmap.writeTGA(outputFile, 24, false); + nlinfo("Screenshot '%s' saved", newfilename.c_str()); + } + } + + bool CObjectViewerWidget::loadMesh(const std::string &meshFileName, const std::string &skelFileName) + { + std::string fileName = CFile::getFilenameWithoutExtension(meshFileName); + if ( _Entities.count(fileName) != 0) + return false; + + CPath::addSearchPath(CFile::getPath(meshFileName), false, false); + + // create instance of the mesh character + UInstance Entity = _Scene->createInstance(meshFileName); + + CAABBox bbox; + Entity.getShapeAABBox(bbox); + setCamera(_Scene, bbox , Entity, true); + + _MouseListener->setMatrix(_Scene->getCam().getMatrix()); + + USkeleton Skeleton = _Scene->createSkeleton(skelFileName); + + // if we can't create entity, skip it + if (Entity.empty()) return false; + + // create a new entity + EIT eit = (_Entities.insert (make_pair (fileName, CEntity()))).first; + CEntity &entity = (*eit).second; + + // set the entity up + entity._Name = fileName; + entity._FileNameShape = meshFileName; + entity._FileNameSkeleton = skelFileName; + entity._Instance = Entity; + if (!Skeleton.empty()) + { + entity._Skeleton = Skeleton; + entity._Skeleton.bindSkin (entity._Instance); + } + entity._AnimationSet = _Driver->createAnimationSet(false); + entity._PlayList = _PlayListManager->createPlayList(entity._AnimationSet); + return true; + } + + void CObjectViewerWidget::setVisible(bool visible) + { + // called by show() + // code assuming visible window needed to init the 3d driver + nldebug("%d", visible); + if (visible) + { + QWidget::setVisible(true); + } + else + { + QWidget::setVisible(false); + } + } + + void CObjectViewerWidget::resetScene() + { + deleteEntities(); + + // Reset camera. + //.. + + // to load files with the same name but located in different directories + //CPath::clearMap(); + + // load and set search paths from config + //Modules::config().configSearchPaths(); + + _CurrentInstance = ""; + + nlinfo("Scene cleared"); + } + + void CObjectViewerWidget::setBackgroundColor(NLMISC::CRGBA backgroundColor) + { + _BackgroundColor = backgroundColor; + + // config file variable changes + //Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.R, 0); + //Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.G, 1); + //Modules::config().getConfigFile().getVar("BackgroundColor").setAsInt(_BackgroundColor.B, 2); + } + + void CObjectViewerWidget::setGraphicsDriver(bool Direct3D) + { + //_Direct3D = Direct3D; + + //if (_Direct3D) Modules::config().getConfigFile().getVar("GraphicsDriver").setAsString("Direct3D"); + //else Modules::config().getConfigFile().getVar("GraphicsDriver").setAsString("OpenGL"); + } + + void CObjectViewerWidget::setSizeViewport(uint16 w, uint16 h) + { + _Scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)w/h, 0.1f, 1000); + } + + void CObjectViewerWidget::setCurrentObject(const std::string &name) + { + if ((_Entities.count(name) != 0) || ( name.empty() )) _CurrentInstance = name; + else nlerror ("Entity %s not found", name.c_str()); + nlinfo("set current entity %s", _CurrentInstance.c_str()); + } + + CEntity& CObjectViewerWidget::getEntity(const std::string &name) + { + if ( _Entities.count(name) == 0) nlerror("Entity %s not found", name.c_str()); + EIT eit = _Entities.find (name); + return (*eit).second; + } + + void CObjectViewerWidget::getListObjects(std::vector &listObj) + { + listObj.clear(); + for (EIT eit = _Entities.begin(); eit != _Entities.end(); ++eit) + listObj.push_back((*eit).second._Name); + } + + void CObjectViewerWidget::deleteEntity(CEntity &entity) + { + if (entity._PlayList != NULL) + { + _PlayListManager->deletePlayList (entity._PlayList); + entity._PlayList = NULL; + } + + if (entity._AnimationSet != NULL) + { + _Driver->deleteAnimationSet(entity._AnimationSet); + entity._AnimationSet = NULL; + } + + if (!entity._Skeleton.empty()) + { + entity._Skeleton.detachSkeletonSon(entity._Instance); + + _Scene->deleteSkeleton(entity._Skeleton); + entity._Skeleton = NULL; + } + + if (!entity._Instance.empty()) + { + _Scene->deleteInstance(entity._Instance); + entity._Instance = NULL; + } + } + + void CObjectViewerWidget::deleteEntities() + { + for (EIT eit = _Entities.begin(); eit != _Entities.end(); ++eit) + { + CEntity &entity = (*eit).second; + deleteEntity(entity); + } + _Entities.clear(); + } + + void CObjectViewerWidget::setCamera(NL3D::UScene *scene, CAABBox &bbox, UTransform &entity, bool high_z) + { + CVector pos(0.f, 0.f, 0.f); + CQuat quat(0.f, 0.f, 0.f, 0.f); + NL3D::UInstance inst; + inst.cast(entity); + if (!inst.empty()) + { + inst.getDefaultPos(pos); + inst.getDefaultRotQuat(quat); + } + + // fix scale (some shapes have a different value) + entity.setScale(1.f, 1.f, 1.f); + + UCamera Camera = scene->getCam(); + CVector max_radius = bbox.getHalfSize(); + + CVector center = bbox.getCenter(); + entity.setPivot(center); + center += pos; + + //scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)w/h, 0.1f, 1000); + float fov = float(_CameraFocal * (float)Pi/180.0); + //Camera.setPerspective (fov, 1.0f, 0.1f, 1000.0f); + float radius = max(max(max_radius.x, max_radius.y), max_radius.z); + if (radius == 0.f) radius = 1.f; + float left, right, bottom, top, znear, zfar; + Camera.getFrustum(left, right, bottom, top, znear, zfar); + float dist = (radius / (tan(fov/2))) * 0.2; + CVector eye(center); + CVector ax(quat.getAxis()); + + if (ax.isNull() || ax == CVector::I) + { + ax = CVector::J; + } + else if (ax == -CVector::K) + { + ax = -CVector::J; + } + + eye -= ax * (dist+radius); + if (high_z) + eye.z += max_radius.z/1.0f; + Camera.lookAt(eye, center); + setupLight(eye, center - eye); + } + + bool CObjectViewerWidget::setupLight(const CVector &position, const CVector &direction) + { + if (!_Light) + _Light = ULight::createLight(); + if (!_Light) return false; + + // set mode of the light + _Light->setMode(ULight::DirectionalLight); + + // set position of the light + // Light->setupDirectional(settings.light_ambiant, settings.light_diffuse, settings.light_specular, settings.light_direction); + NLMISC::CRGBA light_ambiant = CRGBA(0,0,0); + NLMISC::CRGBA light_diffuse = CRGBA(255,255,255); + NLMISC::CRGBA light_specular = CRGBA(255,255,255); + NLMISC::CVector light_direction = CVector(0.25, 0.25, 0.25); + _Light->setupPointLight(light_ambiant, light_diffuse, light_specular, position, direction + light_direction); + + // set and enable the light + _Driver->setLight(0, *_Light); + _Driver->enableLight(0); + + return true; + } + + QIcon* CObjectViewerWidget::saveOneImage(string shapename) + { + int output_width = 128; + int output_height = 128; + + // Create a scene + NL3D::UScene* Scene = _Driver->createScene(true); + if (!Scene) return 0; + + // get scene camera + if (Scene->getCam().empty()) + { + nlwarning("can't get camera from scene"); + return 0; + } + + // add an entity to the scene + UInstance Entity = Scene->createInstance(shapename.c_str()); + + // if we can't create entity, skip it + if (Entity.empty()) + { + nlwarning("can't create instance from %s", shapename.c_str()); + return 0; + } + + // get AABox of Entity + CAABBox bbox; + Entity.getShapeAABBox(bbox); + setCamera(Scene, bbox , Entity, true); + Scene->getCam().setPerspective(_CameraFocal * (float)Pi/180.f, (float)output_width/output_height, 0.1f, 1000); + + string filename = CPath::standardizePath("") + toString("%s.%s", shapename.c_str(), "png"); + + // the background is white + _Driver->clearBuffers(); + + // render the scene + Scene->render(); + + CBitmap btm; + _Driver->getBuffer(btm); + + btm.resample(output_width, output_height); + + COFile fs; + + if (fs.open(filename)) + { + if (!btm.writePNG(fs, 24)) + { + nlwarning("can't save image to PNG"); + return 0; + } + } + else + { + nlwarning("can't create %s", "test.png"); + return 0; + } + fs.close(); + + QIcon *icon = new QIcon(QString(filename.c_str())); + //CFile::deleteFile(filename); + return icon; + } void CObjectViewerWidget::updateAnimatePS(uint64 deltaTime) { @@ -731,67 +731,67 @@ namespace NLQT lastTime += deltaTime; float fdelta = 0.001f * (float) (lastTime - firstTime); _Scene->animate ( fdelta); - } - -#if defined(NL_OS_WINDOWS) - - typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - - bool CObjectViewerWidget::winEvent(MSG * message, long * result) - { - if (getDriver() && getDriver()->isActive()) - { - NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); - if (driver) - { - winProc proc = (winProc)driver->getWindowProc(); - return proc(driver, message->hwnd, message->message, message->wParam, message->lParam); - } - } - - return false; - } - -#elif defined(NL_OS_MAC) - - typedef bool (*cocoaProc)(NL3D::IDriver*, const void* e); - - bool CObjectViewerWidget::macEvent(EventHandlerCallRef caller, EventRef event) - { - if(caller) - nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt"); - - if (getDriver() && getDriver()->isActive()) - { - NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); - if (driver) - { - cocoaProc proc = (cocoaProc)driver->getWindowProc(); - return proc(driver, event); - } - } - - return false; - } - -#elif defined(NL_OS_UNIX) - - typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e); - - bool CObjectViewerWidget::x11Event(XEvent *event) - { - if (getDriver() && getDriver()->isActive()) - { - NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); - if (driver) - { - x11Proc proc = (x11Proc)driver->getWindowProc(); - return proc(driver, event); - } - } - - return false; - } -#endif - -} /* namespace NLQT */ + } + +#if defined(NL_OS_WINDOWS) + + typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + + bool CObjectViewerWidget::winEvent(MSG * message, long * result) + { + if (getDriver() && getDriver()->isActive()) + { + NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); + if (driver) + { + winProc proc = (winProc)driver->getWindowProc(); + return proc(driver, message->hwnd, message->message, message->wParam, message->lParam); + } + } + + return false; + } + +#elif defined(NL_OS_MAC) + + typedef bool (*cocoaProc)(NL3D::IDriver*, const void* e); + + bool CObjectViewerWidget::macEvent(EventHandlerCallRef caller, EventRef event) + { + if(caller) + nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt"); + + if (getDriver() && getDriver()->isActive()) + { + NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); + if (driver) + { + cocoaProc proc = (cocoaProc)driver->getWindowProc(); + return proc(driver, event); + } + } + + return false; + } + +#elif defined(NL_OS_UNIX) + + typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e); + + bool CObjectViewerWidget::x11Event(XEvent *event) + { + if (getDriver() && getDriver()->isActive()) + { + NL3D::IDriver *driver = dynamic_cast(getDriver())->getDriver(); + if (driver) + { + x11Proc proc = (x11Proc)driver->getWindowProc(); + return proc(driver, event); + } + } + + return false; + } +#endif + +} /* namespace NLQT */ diff --git a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h index 15c9b0fa9..fb6656679 100644 --- a/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h +++ b/code/nel/tools/3d/object_viewer_widget/src/object_viewer_widget.h @@ -1,229 +1,229 @@ -/* -Object Viewer Qt Widget -Copyright (C) 2010 Adrian Jaekel - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef OBJECT_VIEWER_WIDGET_H -#define OBJECT_VIEWER_WIDGET_H - -// STL includes - -// Qt includes -#include -#include - -// NeL includes -#include -#include - -// Project includes -#include "entity.h" -#include "interfaces.h" - -namespace NL3D -{ - class UDriver; - class UScene; - class ULight; - class UInstance; - class UCamera; - class USkeleton; - class UPlayListManager; - class U3dMouseListener; -} - -class QIcon; -/** -namespace NLQT -@brief namespace NLQT -*/ -namespace NLQT -{ - class CObjectViewerWidget: - public QWidget, - public IObjectViewer - { - Q_OBJECT - Q_INTERFACES(NLQT::IObjectViewer) - - public: - /// Default constructor. - CObjectViewerWidget(QWidget *parent = 0); - virtual ~CObjectViewerWidget(); - - virtual QPaintEngine* paintEngine() const { return NULL; } - virtual void showEvent ( QShowEvent * event ); - - void setNelContext(NLMISC::INelContext &nelContext); - - static CObjectViewerWidget &objViewWid() { return *_objectViewerWidget; } - - /// Init a driver and create scene. - void init(); - - /// Release class. - void release(); - - /// Update mouse and keyboard events. And update camera matrix. - void updateInput(); - - /// Render Driver (clear all buffers and set background color). - void renderDriver(); - - /// Render current scene. - void renderScene(); - - /// Render Debug 2D (stuff for dev). - void renderDebug2D(); - - /// Make a screenshot of the current scene and save. - void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga); - - /// Load a mesh or particle system and add to current scene. - /// @param meshFileName - name loading shape or ps file. - /// @param skelFileName - name loading skeletin file. - /// @return true if file have been loaded, false if file have not been loaded. - bool loadMesh (const std::string &meshFileName, const std::string &skelFileName); - - /// Reset current scene. - void resetScene(); - - /// Set the background color. - /// @param backgroundColor - background color. - void setBackgroundColor(NLMISC::CRGBA backgroundColor); - - /// Set type driver. - /// @param Direct3D - type driver (true - Direct3D) or (false -OpenGL) - void setGraphicsDriver(bool Direct3D); - - /// Set size viewport for correct set perspective - /// @param w - width window. - /// @param h - height window. - void setSizeViewport(uint16 w, uint16 h); - - void setBloomEffect(bool enabled) { _BloomEffect = enabled; } - - /// Select instance from the scene - /// @param name - name instance, "" if no instance edited - void setCurrentObject(const std::string &name); - - /// Get current instance from the scene - /// @return name current instance, "" if no instance edited - const std::string& getCurrentObject() { return _CurrentInstance; } - - /// Get entity from the scene - /// @return ref Entity - CEntity& getEntity(const std::string &name); - - /// Get full list instances from the scene - /// @param listObj - ref of return list instances - void getListObjects(std::vector &listObj); - - /// Get value background color. - /// @return background color. - NLMISC::CRGBA getBackgroundColor() { return _BackgroundColor; } - - /// Get type driver. - /// @return true if have used Direct3D driver, false OpenGL driver. - inline bool getDirect3D() { return _Direct3D; } - - inline bool getBloomEffect() const { return _BloomEffect; } - - /// Get a pointer to the driver. - /// @return pointer to the driver. - inline NL3D::UDriver *getDriver() { return _Driver; } - - /// Get a pointer to the scene. - /// @return pointer to the scene. - inline NL3D::UScene *getScene() { return _Scene; } - - /// Get a manager of playlist - /// @return pointer to the UPlayListManager - inline NL3D::UPlayListManager *getPlayListManager() { return _PlayListManager; } - - void setCamera(NL3D::UScene *scene, NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z=false); - bool setupLight(const NLMISC::CVector &position, const NLMISC::CVector &direction); - - QIcon* saveOneImage(std::string shapename); - - virtual void setVisible(bool visible); - - QWidget* getWidget() {return this;} - - virtual QString name() const {return ("ObjectViewerWidget");} - - protected: -#if defined(NL_OS_WINDOWS) - virtual bool winEvent(MSG * message, long * result); -#elif defined(NL_OS_MAC) - virtual bool macEvent(EventHandlerCallRef caller, EventRef event); -#elif defined(NL_OS_UNIX) - virtual bool x11Event(XEvent *event); -#endif - - private Q_SLOTS: - void updateRender(); - - private: +/* +Object Viewer Qt Widget +Copyright (C) 2010 Adrian Jaekel + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef OBJECT_VIEWER_WIDGET_H +#define OBJECT_VIEWER_WIDGET_H + +// STL includes + +// Qt includes +#include +#include + +// NeL includes +#include +#include + +// Project includes +#include "entity.h" +#include "interfaces.h" + +namespace NL3D +{ + class UDriver; + class UScene; + class ULight; + class UInstance; + class UCamera; + class USkeleton; + class UPlayListManager; + class U3dMouseListener; +} + +class QIcon; +/** +namespace NLQT +@brief namespace NLQT +*/ +namespace NLQT +{ + class CObjectViewerWidget: + public QWidget, + public IObjectViewer + { + Q_OBJECT + Q_INTERFACES(NLQT::IObjectViewer) + + public: + /// Default constructor. + CObjectViewerWidget(QWidget *parent = 0); + virtual ~CObjectViewerWidget(); + + virtual QPaintEngine* paintEngine() const { return NULL; } + virtual void showEvent ( QShowEvent * event ); + + void setNelContext(NLMISC::INelContext &nelContext); + + static CObjectViewerWidget &objViewWid() { return *_objectViewerWidget; } + + /// Init a driver and create scene. + void init(); + + /// Release class. + void release(); + + /// Update mouse and keyboard events. And update camera matrix. + void updateInput(); + + /// Render Driver (clear all buffers and set background color). + void renderDriver(); + + /// Render current scene. + void renderScene(); + + /// Render Debug 2D (stuff for dev). + void renderDebug2D(); + + /// Make a screenshot of the current scene and save. + void saveScreenshot(const std::string &nameFile, bool jpg, bool png, bool tga); + + /// Load a mesh or particle system and add to current scene. + /// @param meshFileName - name loading shape or ps file. + /// @param skelFileName - name loading skeletin file. + /// @return true if file have been loaded, false if file have not been loaded. + bool loadMesh (const std::string &meshFileName, const std::string &skelFileName); + + /// Reset current scene. + void resetScene(); + + /// Set the background color. + /// @param backgroundColor - background color. + void setBackgroundColor(NLMISC::CRGBA backgroundColor); + + /// Set type driver. + /// @param Direct3D - type driver (true - Direct3D) or (false -OpenGL) + void setGraphicsDriver(bool Direct3D); + + /// Set size viewport for correct set perspective + /// @param w - width window. + /// @param h - height window. + void setSizeViewport(uint16 w, uint16 h); + + void setBloomEffect(bool enabled) { _BloomEffect = enabled; } + + /// Select instance from the scene + /// @param name - name instance, "" if no instance edited + void setCurrentObject(const std::string &name); + + /// Get current instance from the scene + /// @return name current instance, "" if no instance edited + const std::string& getCurrentObject() { return _CurrentInstance; } + + /// Get entity from the scene + /// @return ref Entity + CEntity& getEntity(const std::string &name); + + /// Get full list instances from the scene + /// @param listObj - ref of return list instances + void getListObjects(std::vector &listObj); + + /// Get value background color. + /// @return background color. + NLMISC::CRGBA getBackgroundColor() { return _BackgroundColor; } + + /// Get type driver. + /// @return true if have used Direct3D driver, false OpenGL driver. + inline bool getDirect3D() { return _Direct3D; } + + inline bool getBloomEffect() const { return _BloomEffect; } + + /// Get a pointer to the driver. + /// @return pointer to the driver. + inline NL3D::UDriver *getDriver() { return _Driver; } + + /// Get a pointer to the scene. + /// @return pointer to the scene. + inline NL3D::UScene *getScene() { return _Scene; } + + /// Get a manager of playlist + /// @return pointer to the UPlayListManager + inline NL3D::UPlayListManager *getPlayListManager() { return _PlayListManager; } + + void setCamera(NL3D::UScene *scene, NLMISC::CAABBox &bbox, NL3D::UTransform &entity, bool high_z=false); + bool setupLight(const NLMISC::CVector &position, const NLMISC::CVector &direction); + + QIcon* saveOneImage(std::string shapename); + + virtual void setVisible(bool visible); + + QWidget* getWidget() {return this;} + + virtual QString name() const {return ("ObjectViewerWidget");} + + protected: +#if defined(NL_OS_WINDOWS) + virtual bool winEvent(MSG * message, long * result); +#elif defined(NL_OS_MAC) + virtual bool macEvent(EventHandlerCallRef caller, EventRef event); +#elif defined(NL_OS_UNIX) + virtual bool x11Event(XEvent *event); +#endif + + private Q_SLOTS: + void updateRender(); + + private: /// Update the animation time for Particle System animation. /// @param deltaTime - set the manual animation time. - void updateAnimatePS(uint64 deltaTime = 0); - - static CObjectViewerWidget *_objectViewerWidget; - - NLMISC::CLibraryContext *_LibContext; - - // render stuff - QTimer *_mainTimer; - bool _isGraphicsInitialized, _isGraphicsEnabled; - - void updateInitialization(bool visible); - - void deleteEntity (CEntity &entity); - - /// Delete all entities - void deleteEntities(); - - NLMISC::CRGBA _BackgroundColor; - - NL3D::UDriver *_Driver; - NL3D::UScene *_Scene; - NL3D::UPlayListManager *_PlayListManager; - NL3D::ULight *_Light; - NL3D::UCamera *_Camera; - NL3D::U3dMouseListener *_MouseListener; - - // The entities storage - CEntities _Entities; - - /// Camera parameters. - float _phi, _psi, _dist; - float _CameraFocal; - - bool _Direct3D; - bool _BloomEffect; - - std::string _CurrentInstance; - - // a temporary solution, and later remove - friend class CAnimationSetDialog; - - };/* class CObjectViewerWidget */ - -} /* namespace NLQT */ - -#endif // OBJECT_VIEWER_WIDGET_H + void updateAnimatePS(uint64 deltaTime = 0); + + static CObjectViewerWidget *_objectViewerWidget; + + NLMISC::CLibraryContext *_LibContext; + + // render stuff + QTimer *_mainTimer; + bool _isGraphicsInitialized, _isGraphicsEnabled; + + void updateInitialization(bool visible); + + void deleteEntity (CEntity &entity); + + /// Delete all entities + void deleteEntities(); + + NLMISC::CRGBA _BackgroundColor; + + NL3D::UDriver *_Driver; + NL3D::UScene *_Scene; + NL3D::UPlayListManager *_PlayListManager; + NL3D::ULight *_Light; + NL3D::UCamera *_Camera; + NL3D::U3dMouseListener *_MouseListener; + + // The entities storage + CEntities _Entities; + + /// Camera parameters. + float _phi, _psi, _dist; + float _CameraFocal; + + bool _Direct3D; + bool _BloomEffect; + + std::string _CurrentInstance; + + // a temporary solution, and later remove + friend class CAnimationSetDialog; + + };/* class CObjectViewerWidget */ + +} /* namespace NLQT */ + +#endif // OBJECT_VIEWER_WIDGET_H diff --git a/code/nel/tools/3d/object_viewer_widget/src/stdpch.cpp b/code/nel/tools/3d/object_viewer_widget/src/stdpch.cpp index e5875aca1..3dd66d085 100644 --- a/code/nel/tools/3d/object_viewer_widget/src/stdpch.cpp +++ b/code/nel/tools/3d/object_viewer_widget/src/stdpch.cpp @@ -1,5 +1,5 @@ /* -Object Viewer Qt Widget +Object Viewer Qt Widget Copyright (C) 2010 Adrian Jaekel This program is free software: you can redistribute it and/or modify diff --git a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp index 9c82f5421..a2465ba4c 100644 --- a/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp +++ b/code/nel/tools/3d/plugin_max/nel_vertex_tree_paint/vertex_tree_paint.cpp @@ -217,7 +217,7 @@ LRESULT APIENTRY colorSwatchSubclassWndProc( case WM_LBUTTONUP: case WM_LBUTTONDBLCLK: { HWND hPanel = GetParent(hwnd); - LONG mod = GetWindowLongPtr(hPanel,GWLP_USERDATA); + LONG_PTR mod = GetWindowLongPtr(hPanel,GWLP_USERDATA); if (mod) { ((VertexPaint*)mod)->PaletteButton(hwnd); } @@ -424,9 +424,10 @@ void VertexPaint::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev ) SendMessage(hParams, WM_POSTINIT, 0, 0); } - else { + else + { SetWindowLongPtr(hParams,GWLP_USERDATA,(LONG_PTR)this); - } + } iTint = SetupIntSpinner (hParams, IDC_TINT_SPIN, IDC_TINT, 0, 100, (int) (fTint*100.0f)); @@ -440,7 +441,7 @@ void VertexPaint::BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev ) // Force an eval to update caches. NotifyDependents(FOREVER, PART_VERTCOLOR, REFMSG_CHANGE); - } +} void VertexPaint::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next) { diff --git a/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp b/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp index 0d2ea6a7e..9d6506197 100644 --- a/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp +++ b/code/nel/tools/3d/s3tc_compressor_lib/s3tc_compressor.cpp @@ -42,15 +42,15 @@ static void compressMipMap(uint8 *pixSrc, sint width, sint height, vector--> + value="http://shard.ryzomcore.org/ams/index.php" /> +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include "camera.h" + +#include + +#include "global.h" +#include "misc.h" + +using namespace NLMISC; +using namespace NL3D; + +//--------------------------------------------------- +// update the camera perspective setup +//--------------------------------------------------- +void updateCameraPerspective() +{ + float fov, aspectRatio; + computeCurrentFovAspectRatio(fov, aspectRatio); + + // change the perspective of the scene + if(!MainCam.empty()) + MainCam.setPerspective(fov, aspectRatio, CameraSetupZNear, ClientCfg.Vision); + // change the perspective of the root scene + if(SceneRoot) + { + UCamera cam= SceneRoot->getCam(); + cam.setPerspective(fov, aspectRatio, SceneRootCameraZNear, SceneRootCameraZFar); + } +} + +void buildCameraClippingPyramid(std::vector &planes) +{ + if (StereoDisplay) StereoDisplay->getClippingFrustum(0, &MainCam); + + // Compute pyramid in view basis. + CVector pfoc(0,0,0); + const CFrustum &frustum = MainCam.getFrustum(); + InvMainSceneViewMatrix = MainCam.getMatrix(); + MainSceneViewMatrix = InvMainSceneViewMatrix; + MainSceneViewMatrix.invert(); + + CVector lb(frustum.Left, frustum.Near, frustum.Bottom ); + CVector lt(frustum.Left, frustum.Near, frustum.Top ); + CVector rb(frustum.Right, frustum.Near, frustum.Bottom ); + CVector rt(frustum.Right, frustum.Near, frustum.Top ); + + CVector lbFar(frustum.Left, ClientCfg.CharacterFarClip, frustum.Bottom); + CVector ltFar(frustum.Left, ClientCfg.CharacterFarClip, frustum.Top ); + CVector rtFar(frustum.Right, ClientCfg.CharacterFarClip, frustum.Top ); + + planes.resize (4); + // planes[0].make(lbFar, ltFar, rtFar); + planes[0].make(pfoc, lt, lb); + planes[1].make(pfoc, rt, lt); + planes[2].make(pfoc, rb, rt); + planes[3].make(pfoc, lb, rb); + + // Compute pyramid in World basis. + // The vector transformation M of a plane p is computed as p*M-1. + // Here, ViewMatrix== CamMatrix-1. Hence the following formula. + uint i; + + for (i = 0; i < 4; i++) + { + planes[i] = planes[i]*MainSceneViewMatrix; + } +} + +/* end of file */ \ No newline at end of file diff --git a/code/ryzom/client/src/camera.h b/code/ryzom/client/src/camera.h new file mode 100644 index 000000000..037661c3a --- /dev/null +++ b/code/ryzom/client/src/camera.h @@ -0,0 +1,29 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef CL_CAMERA_H +#define CL_CAMERA_H + +#include + +#include + +void updateCameraPerspective(); +void buildCameraClippingPyramid(std::vector &planes); + +#endif // CL_CAMERA_H + +/* end of file */ diff --git a/code/ryzom/client/src/character_cl.cpp b/code/ryzom/client/src/character_cl.cpp index e3b453cfc..932819817 100644 --- a/code/ryzom/client/src/character_cl.cpp +++ b/code/ryzom/client/src/character_cl.cpp @@ -488,7 +488,7 @@ void CCharacterCL::stopAttachedFXForCurrrentAnim(bool stopLoopingFX) { if(!(*tmpItAttached)->FX.empty()) { - if (!(*tmpItAttached)->FX.removeByID('STOP') && !(*tmpItAttached)->FX.removeByID('main')) + if (!(*tmpItAttached)->FX.removeByID(NELID("STOP")) && !(*tmpItAttached)->FX.removeByID(NELID("main"))) { (*tmpItAttached)->FX.activateEmitters(false); } @@ -9373,7 +9373,7 @@ void CCharacterCL::CWornItem::enableAdvantageFX(NL3D::UInstance parent) if (!enabled) { // well, it is unlikely that player will loses its ability to master an item after he gained it, but manage the case anyway. - if (!AdvantageFX.removeByID('STOP') && !AdvantageFX.removeByID('main')) + if (!AdvantageFX.removeByID(NELID("STOP")) && !AdvantageFX.removeByID(NELID("main"))) { AdvantageFX.activateEmitters(false); } diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index 5bbd90e01..782c6cc0d 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -302,6 +302,10 @@ CClientConfig::CClientConfig() Contrast = 0.f; // Default Monitor Contrast. Luminosity = 0.f; // Default Monitor Luminosity. Gamma = 0.f; // Default Monitor Gamma. + + VREnable = false; + VRDisplayDevice = "Auto"; + VRDisplayDeviceId = ""; Local = false; // Default is Net Mode. FSHost = ""; // Default Host. @@ -323,13 +327,13 @@ CClientConfig::CClientConfig() TexturesLoginInterface.push_back("texture_interfaces_v3_login"); DisplayAccountButtons = true; - CreateAccountURL = "https://secure.ryzom.com/signup/from_client.php"; + CreateAccountURL = "http://shard.ryzomcore.org/ams/index.php?page=register"; ConditionsTermsURL = "https://secure.ryzom.com/signup/terms_of_use.php"; - EditAccountURL = "https://secure.ryzom.com/payment_profile/index.php"; + EditAccountURL = "http://shard.ryzomcore.org/ams/index.php?page=settings"; BetaAccountURL = "http://www.ryzom.com/profile"; - ForgetPwdURL = "https://secure.ryzom.com/payment_profile/lost_secure_password.php"; + ForgetPwdURL = "http://shard.ryzomcore.org/ams/index.php?page=forgot_password"; FreeTrialURL = "http://www.ryzom.com/join/?freetrial=1"; - LoginSupportURL = "http://www.ryzom.com/en/support.html"; + LoginSupportURL = "http://shard.ryzomcore.org/ams/index.php"; Position = CVector(0.f, 0.f, 0.f); // Default Position. Heading = CVector(0.f, 1.f, 0.f); // Default Heading. EyesHeight = 1.5f; // Default User Eyes Height. @@ -847,6 +851,9 @@ void CClientConfig::setValues() else cfgWarning ("Default value used for 'Driver3D' !!!"); + READ_BOOL_FV(VREnable) + READ_STRING_FV(VRDisplayDevice) + READ_STRING_FV(VRDisplayDeviceId) //////////// // INPUTS // diff --git a/code/ryzom/client/src/client_cfg.h b/code/ryzom/client/src/client_cfg.h index c76cfaf36..44ddf3891 100644 --- a/code/ryzom/client/src/client_cfg.h +++ b/code/ryzom/client/src/client_cfg.h @@ -146,6 +146,11 @@ struct CClientConfig /// Monitor Gamma [-1 ~ 1], default 0 float Gamma; + // VR + bool VREnable; + std::string VRDisplayDevice; + std::string VRDisplayDeviceId; + /// Client in Local mode or not. bool Local; /// Host. diff --git a/code/ryzom/client/src/decal.cpp b/code/ryzom/client/src/decal.cpp index 45c5311ac..1454d9f59 100644 --- a/code/ryzom/client/src/decal.cpp +++ b/code/ryzom/client/src/decal.cpp @@ -84,7 +84,65 @@ static const char *DecalAttenuationVertexProgramCode = MUL o[COL0].w, v[3], R0.w; \n\ END \n"; -static NL3D::CVertexProgram DecalAttenuationVertexProgram(DecalAttenuationVertexProgramCode); +class CVertexProgramDecalAttenuation : public CVertexProgram +{ +public: + struct CIdx + { + // 0-3 mvp + uint WorldToUV0; // 4 + uint WorldToUV1; // 5 + uint RefCamDist; // 6 + uint DistScaleBias; // 7 + uint Diffuse; // 8 + // 9 + // 10 + uint BlendScale; // 11 + }; + CVertexProgramDecalAttenuation() + { + // nelvp + { + CSource *source = new CSource(); + source->Profile = nelvp; + source->DisplayName = "nelvp/DecalAttenuation"; + source->setSourcePtr(DecalAttenuationVertexProgramCode); + source->ParamIndices["modelViewProjection"] = 0; + source->ParamIndices["worldToUV0"] = 4; + source->ParamIndices["worldToUV1"] = 5; + source->ParamIndices["refCamDist"] = 6; + source->ParamIndices["distScaleBias"] = 7; + source->ParamIndices["diffuse"] = 8; + source->ParamIndices["blendScale"] = 11; + addSource(source); + } + // TODO_VP_GLSL + } + ~CVertexProgramDecalAttenuation() + { + + } + virtual void buildInfo() + { + m_Idx.WorldToUV0 = getUniformIndex("worldToUV0"); + nlassert(m_Idx.WorldToUV0 != ~0); + m_Idx.WorldToUV1 = getUniformIndex("worldToUV1"); + nlassert(m_Idx.WorldToUV1 != ~0); + m_Idx.RefCamDist = getUniformIndex("refCamDist"); + nlassert(m_Idx.RefCamDist != ~0); + m_Idx.DistScaleBias = getUniformIndex("distScaleBias"); + nlassert(m_Idx.DistScaleBias != ~0); + m_Idx.Diffuse = getUniformIndex("diffuse"); + nlassert(m_Idx.Diffuse != ~0); + m_Idx.BlendScale = getUniformIndex("blendScale"); + nlassert(m_Idx.BlendScale != ~0); + } + inline const CIdx &idx() const { return m_Idx; } +private: + CIdx m_Idx; +}; + +static NLMISC::CSmartPtr DecalAttenuationVertexProgram; typedef CShadowPolyReceiver::CRGBAVertex CRGBAVertex; @@ -92,6 +150,10 @@ typedef CShadowPolyReceiver::CRGBAVertex CRGBAVertex; // **************************************************************************** CDecal::CDecal() { + if (!DecalAttenuationVertexProgram) + { + DecalAttenuationVertexProgram = new CVertexProgramDecalAttenuation(); + } _ShadowMap = new CShadowMap(&(((CSceneUser *) Scene)->getScene().getRenderTrav().getShadowMapManager())); _Material.initUnlit(); _Diffuse = CRGBA::White; @@ -303,6 +365,7 @@ void CDecal::renderTriCache(NL3D::IDriver &drv, NL3D::CShadowPolyReceiver &/* drv.setupModelMatrix(modelMat); if (useVertexProgram) { + CVertexProgramDecalAttenuation *program = DecalAttenuationVertexProgram; { CVertexBufferReadWrite vba; _VB.setNumVertices((uint32)_TriCache.size()); @@ -310,16 +373,16 @@ void CDecal::renderTriCache(NL3D::IDriver &drv, NL3D::CShadowPolyReceiver &/* memcpy(vba.getVertexCoordPointer(), &_TriCache[0], sizeof(CRGBAVertex) * _TriCache.size()); } drv.activeVertexBuffer(_VB); - drv.setConstantMatrix(0, NL3D::IDriver::ModelViewProjection, NL3D::IDriver::Identity); - drv.setConstant(4, _WorldToUVMatrix[0][0], _WorldToUVMatrix[1][0], _WorldToUVMatrix[2][0], _WorldToUVMatrix[3][0]); - drv.setConstant(5, _WorldToUVMatrix[0][1], _WorldToUVMatrix[1][1], _WorldToUVMatrix[2][1], _WorldToUVMatrix[3][1]); - drv.setConstant(8, _Diffuse.R * (1.f / 255.f), _Diffuse.G * (1.f / 255.f), _Diffuse.B * (1.f / 255.f), 1.f); + drv.setUniformMatrix(IDriver::VertexProgram, program->getUniformIndex(CProgramIndex::ModelViewProjection), NL3D::IDriver::ModelViewProjection, NL3D::IDriver::Identity); + drv.setUniform4f(IDriver::VertexProgram, program->idx().WorldToUV0, _WorldToUVMatrix[0][0], _WorldToUVMatrix[1][0], _WorldToUVMatrix[2][0], _WorldToUVMatrix[3][0]); + drv.setUniform4f(IDriver::VertexProgram, program->idx().WorldToUV1, _WorldToUVMatrix[0][1], _WorldToUVMatrix[1][1], _WorldToUVMatrix[2][1], _WorldToUVMatrix[3][1]); + drv.setUniform4f(IDriver::VertexProgram, program->idx().Diffuse, _Diffuse.R * (1.f / 255.f), _Diffuse.G * (1.f / 255.f), _Diffuse.B * (1.f / 255.f), 1.f); const NLMISC::CVector &camPos = MainCam.getMatrix().getPos(); - drv.setConstant(6, camPos.x - _RefPosition.x, camPos.y - _RefPosition.y, camPos.z - _RefPosition.z, 1.f); + drv.setUniform4f(IDriver::VertexProgram, program->idx().RefCamDist, camPos.x - _RefPosition.x, camPos.y - _RefPosition.y, camPos.z - _RefPosition.z, 1.f); // bottom & top blend float bottomBlendScale = 1.f / favoid0(_BottomBlendZMax - _BottomBlendZMin); float topBlendScale = 1.f / favoid0(_TopBlendZMin - _TopBlendZMax); - drv.setConstant(11, bottomBlendScale, bottomBlendScale * (_RefPosition.z - _BottomBlendZMin), + drv.setUniform4f(IDriver::VertexProgram, program->idx().BlendScale, bottomBlendScale, bottomBlendScale * (_RefPosition.z - _BottomBlendZMin), topBlendScale, topBlendScale * (_RefPosition.z - _TopBlendZMax)); // static volatile bool wantSimpleMat = false; @@ -560,12 +623,12 @@ void CDecalRenderList::renderAllDecals() NL3D::IDriver *drvInternal = ((CDriverUser *) Driver)->getDriver(); // static volatile bool forceNoVertexProgram = false; - if (drvInternal->isVertexProgramSupported() && !forceNoVertexProgram) + if (!forceNoVertexProgram && drvInternal->compileVertexProgram(DecalAttenuationVertexProgram)) { - //drvInternal->setConstantMatrix(0, NL3D::IDriver::ModelViewProjection, NL3D::IDriver::Identity); - drvInternal->setConstant(7, _DistScale, _DistBias, 0.f, 1.f); + drvInternal->activeVertexProgram(DecalAttenuationVertexProgram); + //drvInternal->setCons/tantMatrix(0, NL3D::IDriver::ModelViewProjection, NL3D::IDriver::Identity); + drvInternal->setUniform4f(IDriver::VertexProgram, DecalAttenuationVertexProgram->idx().DistScaleBias, _DistScale, _DistBias, 0.f, 1.f); useVertexProgram = true; - drvInternal->activeVertexProgram(&DecalAttenuationVertexProgram); } else { diff --git a/code/ryzom/client/src/fx_cl.cpp b/code/ryzom/client/src/fx_cl.cpp index 971100386..7a5418c3a 100644 --- a/code/ryzom/client/src/fx_cl.cpp +++ b/code/ryzom/client/src/fx_cl.cpp @@ -263,7 +263,7 @@ CFxCL::~CFxCL() // Stop emitters UParticleSystemInstance fxInst; fxInst.cast (_Instance); - if (!fxInst.removeByID( 'STOP' ) && !fxInst.removeByID( 'main' ) ) + if (!fxInst.removeByID(NELID("STOP")) && !fxInst.removeByID(NELID("main"))) { fxInst.activateEmitters( false ); } diff --git a/code/ryzom/client/src/fx_manager.h b/code/ryzom/client/src/fx_manager.h index 71df3f2c4..e41171e9e 100644 --- a/code/ryzom/client/src/fx_manager.h +++ b/code/ryzom/client/src/fx_manager.h @@ -77,7 +77,7 @@ protected: float TimeOut; bool TestNoMoreParticles; public: - CFX2Remove(NL3D::UParticleSystemInstance instance=NL3D::UParticleSystemInstance(), float timeOut = NULL, bool testNoMoreParticles = false) + CFX2Remove(NL3D::UParticleSystemInstance instance=NL3D::UParticleSystemInstance(), float timeOut = 0.f, bool testNoMoreParticles = false) { Instance = instance; TimeOut = timeOut; diff --git a/code/ryzom/client/src/global.cpp b/code/ryzom/client/src/global.cpp index 8bd6f10fa..2e3ba875a 100644 --- a/code/ryzom/client/src/global.cpp +++ b/code/ryzom/client/src/global.cpp @@ -26,6 +26,8 @@ using namespace NLMISC; // *************************************************************************** // Main System NL3D::UDriver *Driver = 0; // The main 3D Driver +NL3D::IStereoDisplay *StereoDisplay = NULL; // Stereo display +NL3D::IStereoHMD *StereoHMD = NULL; // Head mount display CSoundManager *SoundMngr = 0; // the sound manager NL3D::UMaterial GenericMat; // Generic Material NL3D::UTextContext *TextContext = 0; // Context for all the text in the client. diff --git a/code/ryzom/client/src/global.h b/code/ryzom/client/src/global.h index a6b7a03c6..9e5a294ae 100644 --- a/code/ryzom/client/src/global.h +++ b/code/ryzom/client/src/global.h @@ -40,6 +40,8 @@ namespace NL3D class UMaterial; class UTextContext; class UWaterEnvMap; + class IStereoDisplay; + class IStereoHMD; } class CEntityAnimationManager; @@ -77,6 +79,8 @@ const float ExtraZoneLoadingVision = 100.f; // *************************************************************************** // Main System extern NL3D::UDriver *Driver; // The main 3D Driver +extern NL3D::IStereoDisplay *StereoDisplay; // Stereo display +extern NL3D::IStereoHMD *StereoHMD; // Head mount display extern CSoundManager *SoundMngr; // the sound manager extern NL3D::UMaterial GenericMat; // Generic Material extern NL3D::UTextContext *TextContext; // Context for all the text in the client. diff --git a/code/ryzom/client/src/hair_set.cpp b/code/ryzom/client/src/hair_set.cpp index 1bc6f030c..d82733162 100644 --- a/code/ryzom/client/src/hair_set.cpp +++ b/code/ryzom/client/src/hair_set.cpp @@ -47,8 +47,8 @@ void CHairSet::init (NLMISC::IProgressCallback &progress) const CItemSheet *item = SheetMngr.getItem(SLOTTYPE::HEAD_SLOT, k); if( (item) && (!item->getShape().empty()) ) { - std::string itemName = item->getShape(); - itemName = NLMISC::strlwr(itemName); + std::string itemName = NLMISC::toLower(item->getShape()); + if (item->getShape().find("cheveux", 0) != std::string::npos) { // get race diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 9d515fabd..4c5cd1eca 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -39,6 +39,7 @@ #include "nel/3d/u_driver.h" #include "nel/3d/u_text_context.h" #include "nel/3d/u_shape_bank.h" +#include "nel/3d/stereo_hmd.h" // Net. #include "nel/net/email.h" // Ligo. @@ -46,6 +47,7 @@ // Std. #include +#include // Game Share #include "game_share/ryzom_version.h" // Client @@ -792,6 +794,59 @@ void prelogInit() // Check driver version checkDriverVersion(); + // Initialize the VR devices (even more important than the most important part of the client) + nmsg = "Initializing VR devices..."; + ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); + if (ClientCfg.VREnable) + { + nldebug("VR [C]: Enabled"); + std::vector devices; + IStereoDisplay::listDevices(devices); + for (std::vector::iterator it(devices.begin()), end(devices.end()); it != end; ++it) + { + std::stringstream name; + name << std::string("[") << it->Serial << "] [" << IStereoDisplay::getLibraryName(it->Library) << " - " << it->Manufacturer << " - " << it->ProductName << "]"; + nlinfo("VR [C]: Stereo Display: %s", name.str().c_str()); + } + CStereoDeviceInfo *deviceInfo = NULL; + if (ClientCfg.VRDisplayDevice == std::string("Auto") + && devices.begin() != devices.end()) + { + deviceInfo = &devices[0]; + } + else + { + for (std::vector::iterator it(devices.begin()), end(devices.end()); it != end; ++it) + { + std::stringstream name; + name << IStereoDisplay::getLibraryName(it->Library) << " - " << it->Manufacturer << " - " << it->ProductName; + if (name.str() == ClientCfg.VRDisplayDevice) + deviceInfo = &(*it); + if (ClientCfg.VRDisplayDeviceId == it->Serial) + break; + } + } + if (deviceInfo) + { + nlinfo("VR [C]: Create VR stereo display device"); + StereoDisplay = IStereoDisplay::createDevice(*deviceInfo); + if (StereoDisplay) + { + if (deviceInfo->Class == CStereoDeviceInfo::StereoHMD) + { + nlinfo("VR [C]: Stereo display device is a HMD"); + StereoHMD = static_cast(StereoDisplay); + } + } + } + } + else + { + nldebug("VR [C]: NOT Enabled"); + } + IStereoDisplay::releaseUnusedLibraries(); + + // Create the driver (most important part of the client). nmsg = "Creating 3d driver..."; ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); @@ -860,6 +915,11 @@ void prelogInit() Driver->setSwapVBLInterval(1); else Driver->setSwapVBLInterval(0); + + if (StereoDisplay) + { + // override mode TODO + } // Set the mode of the window. if (!Driver->setDisplay (mode, false)) @@ -1102,6 +1162,12 @@ void prelogInit() // init bloom effect CBloomEffect::getInstance().init(driver != UDriver::Direct3d); + + if (StereoDisplay) + { + // Init stereo display resources + StereoDisplay->setDriver(Driver); + } nlinfo ("PROFILE: %d seconds for prelogInit", (uint32)(ryzomGetLocalTime ()-initStart)/1000); diff --git a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp index 54c8b6fac..688c27635 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -542,10 +542,12 @@ void renderSceneScreenShot (uint left, uint right, uint top, uint bottom, uint s { CCameraBackup cbScene = setupCameraForScreenshot(*Scene, left, right, top, bottom, screenShotWidth, screenShotHeight); CCameraBackup cbCanopy = setupCameraForScreenshot(*SceneRoot, left, right, top, bottom, screenShotWidth, screenShotHeight); + commitCamera(); // sky setup are copied from main scene before rendering so no setup done here - renderAll(ClientCfg.ScreenShotFullDetail); + renderScene(ClientCfg.ScreenShotFullDetail, ClientCfg.Bloom); restoreCamera(*Scene, cbScene); restoreCamera(*SceneRoot, cbCanopy); + commitCamera(); } // *************************************************************************** diff --git a/code/ryzom/client/src/interface_v3/animal_position_state.cpp b/code/ryzom/client/src/interface_v3/animal_position_state.cpp index 9789d4012..50e6d4265 100644 --- a/code/ryzom/client/src/interface_v3/animal_position_state.cpp +++ b/code/ryzom/client/src/interface_v3/animal_position_state.cpp @@ -64,7 +64,7 @@ bool CPositionState::getPos(sint32 &px, sint32 &py) // *************************************************************************** void CPositionState::serialNodeLeaf(NLMISC::IStream &f, CCDBNodeLeaf *&dbNode) { - f.serialCheck((uint32) 'NL__'); + f.serialCheck(NELID("NL__")); f.serialVersion(0); std::string dbPath; if (f.isReading()) @@ -85,18 +85,18 @@ void CPositionState::serialNodeLeaf(NLMISC::IStream &f, CCDBNodeLeaf *&dbNode) } f.serial(dbPath); } - f.serialCheck((uint32) 'END_'); + f.serialCheck(NELID("END_")); } // *************************************************************************** void CUIDEntityPositionState::serial(NLMISC::IStream &f) { - f.serialCheck((uint32) 'UIDE'); + f.serialCheck(NELID("UIDE")); f.serialVersion(0); serialNodeLeaf(f, _DBPos); serialNodeLeaf(f, _Uid); - f.serialCheck((uint32) '_END'); + f.serialCheck(NELID("_END")); } // *************************************************************************** @@ -241,11 +241,11 @@ bool CAnimalPositionState::getPos(sint32 &px, sint32 &py) // *************************************************************************** void CAnimalPositionState::serial(NLMISC::IStream &f) { - f.serialCheck((uint32) 'APS_'); + f.serialCheck(NELID("APS_")); f.serialVersion(0); CUIDEntityPositionState::serial(f); serialNodeLeaf(f, _Status); - f.serialCheck((uint32) 'END_'); + f.serialCheck(NELID("END_")); } @@ -257,7 +257,7 @@ void CAnimalPositionState::serial(NLMISC::IStream &f) // *************************************************************************** CEntityCL *CNamedEntityPositionState::getEntity() { - if (!dbOk()) return false; + if (!dbOk()) return NULL; return EntitiesMngr.getEntityByName(_Name->getValue32()); } @@ -299,11 +299,11 @@ bool CDialogEntityPositionState::getDbPos(sint32 &px, sint32 &py) // *************************************************************************** void CNamedEntityPositionState::serial(NLMISC::IStream &f) { - f.serialCheck((uint32) 'NEPS'); + f.serialCheck(NELID("NEPS")); f.serialVersion(0); serialNodeLeaf(f, _Name); serialNodeLeaf(f, _X); serialNodeLeaf(f, _Y); - f.serialCheck((uint32) 'END_'); + f.serialCheck(NELID("END_")); } diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index 24b1e15c6..e74392432 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -924,33 +924,28 @@ void CChatGroupWindow::removeAllFreeTellers() void CChatGroupWindow::saveFreeTeller(NLMISC::IStream &f) { f.serialVersion(2); - - uint32 nNbFreeTellerSaved = 0; - - f.serial(nNbFreeTellerSaved); - - // Don't save the free tellers - //// Save the free teller only if it is present in the friend list to avoid the only-growing situation - //// because free tellers are never deleted in game if we save/load all the free tellers, we just create more - //// and more container. - - //uint32 i, nNbFreeTellerSaved = 0; - //for (i = 0; i < _FreeTellers.size(); ++i) - // if (PeopleInterraction.FriendList.getIndexFromName(_FreeTellers[i]->getUCTitle()) != -1) - // nNbFreeTellerSaved++; - - //f.serial(nNbFreeTellerSaved); - - //for (i = 0; i < _FreeTellers.size(); ++i) - //{ - // CGroupContainer *pGC = _FreeTellers[i]; - // if (PeopleInterraction.FriendList.getIndexFromName(pGC->getUCTitle()) != -1) - // { - // ucstring sTitle = pGC->getUCTitle(); - // f.serial(sTitle); - // } - //} + // Save the free teller only if it is present in the friend list to avoid the only-growing situation + // because free tellers are never deleted in game if we save/load all the free tellers, we just create more + // and more container. + + uint32 i, nNbFreeTellerSaved = 0; + for (i = 0; i < _FreeTellers.size(); ++i) + if (PeopleInterraction.FriendList.getIndexFromName(_FreeTellers[i]->getUCTitle()) != -1) + nNbFreeTellerSaved++; + + f.serial(nNbFreeTellerSaved); + + for (i = 0; i < _FreeTellers.size(); ++i) + { + CGroupContainer *pGC = _FreeTellers[i]; + + if (PeopleInterraction.FriendList.getIndexFromName(pGC->getUCTitle()) != -1) + { + ucstring sTitle = pGC->getUCTitle(); + f.serial(sTitle); + } + } } //================================================================================= @@ -979,12 +974,11 @@ void CChatGroupWindow::loadFreeTeller(NLMISC::IStream &f) ucstring sTitle; f.serial(sTitle); - // Don't actually create the free teller - //CGroupContainer *pGC = createFreeTeller(sTitle, ""); + CGroupContainer *pGC = createFreeTeller(sTitle, ""); - //// With version 1 all tells are active because windows information have "title based" ids and no "sID based". - //if ((ver == 1) && (pGC != NULL)) - // pGC->setActive(false); + // With version 1 all tells are active because windows information have "title based" ids and no "sID based". + if ((ver == 1) && (pGC != NULL)) + pGC->setActive(false); } } diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index ae06d0997..293582f52 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -591,7 +591,7 @@ bool CDBCtrlSheet::parse(xmlNodePtr cur, CInterfaceGroup * parentGroup) return false; prop = (char*) xmlGetProp( cur, (xmlChar*)"dragable" ); - if( prop != NULL ) + if (prop) setDraggable( CInterfaceElement::convertBool(prop) ); else setDraggable( false ); diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp index 5db9ce827..b5092be67 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp @@ -110,7 +110,7 @@ bool CDBGroupListSheet::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) // value prop = xmlGetProp (cur, (xmlChar*)"value"); - if ( prop ) + if (prop) { // get a branch in the database. CCDBNodeBranch *branch= NLGUI::CDBManager::getInstance()->getDbBranch(prop); diff --git a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp index 6007c33b8..9d108926c 100644 --- a/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp +++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet_text.cpp @@ -94,7 +94,7 @@ bool CDBGroupListSheetText::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) // value prop = xmlGetProp (cur, (xmlChar*)"value"); - if ( prop ) + if (prop) { // get a branch in the database. CCDBNodeBranch *branch= NLGUI::CDBManager::getInstance()->getDbBranch(prop); diff --git a/code/ryzom/client/src/interface_v3/filtered_chat_summary.cpp b/code/ryzom/client/src/interface_v3/filtered_chat_summary.cpp index 40b8c7bd4..d4a00e8e4 100644 --- a/code/ryzom/client/src/interface_v3/filtered_chat_summary.cpp +++ b/code/ryzom/client/src/interface_v3/filtered_chat_summary.cpp @@ -23,7 +23,7 @@ void CFilteredChatSummary::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { sint ver= f.serialVersion(2); - f.serialCheck((uint32) 'USHC'); + f.serialCheck(NELID("USHC")); f.serial(SrcGuild); f.serial(SrcTeam); f.serial(SrcAroundMe); @@ -42,7 +42,7 @@ void CFilteredChatSummary::serial(NLMISC::IStream &f) throw(NLMISC::EStream) void CFilteredDynChatSummary::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { sint ver = f.serialVersion(0); - f.serialCheck((uint32) 'USHC'); + f.serialCheck(NELID("USHC")); if (ver >= 0) { for (uint8 i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++) diff --git a/code/ryzom/client/src/interface_v3/group_compas.cpp b/code/ryzom/client/src/interface_v3/group_compas.cpp index 20257cbaa..d4d0631ce 100644 --- a/code/ryzom/client/src/interface_v3/group_compas.cpp +++ b/code/ryzom/client/src/interface_v3/group_compas.cpp @@ -68,7 +68,7 @@ void CCompassTarget::serial(NLMISC::IStream &f) return; } } - f.serialCheck((uint32) 'CTAR'); + f.serialCheck(NELID("CTAR")); f.serialVersion(0); f.serial(Pos); // for the name, try to save a string identifier if possible, because language may be changed between @@ -95,7 +95,7 @@ void CCompassTarget::serial(NLMISC::IStream &f) _PositionState = NULL; } } - f.serialCheck((uint32) '_END'); + f.serialCheck(NELID("_END")); // if language has been modified, then we are not able to display correctly the name, so just // reset the compass to north to avoid incoherency if (f.isReading()) @@ -811,18 +811,19 @@ void CGroupCompasMenu::setActive (bool state) uint nbUserLandMarks = std::min( uint(currCont->UserLandMarks.size()), CContinent::getMaxNbUserLandMarks() ); // Sort the landmarks - std::sort(currCont->UserLandMarks.begin(), currCont->UserLandMarks.end(), UserLandMarksSortPredicate); + std::vector sortedLandmarks(currCont->UserLandMarks); + std::sort(sortedLandmarks.begin(), sortedLandmarks.end(), UserLandMarksSortPredicate); for(k = 0; k < nbUserLandMarks; ++k) { - if (currCont->UserLandMarks[k].Type < CUserLandMark::UserLandMarkTypeCount) + if (sortedLandmarks[k].Type < CUserLandMark::UserLandMarkTypeCount) { CCompassTarget ct; ct.setType(CCompassTarget::UserLandMark); - ct.Pos = currCont->UserLandMarks[k].Pos; - ct.Name = currCont->UserLandMarks[k].Title; + ct.Pos = sortedLandmarks[k].Pos; + ct.Name = sortedLandmarks[k].Title; Targets.push_back(ct); - landMarkSubMenus[currCont->UserLandMarks[k].Type]->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); + landMarkSubMenus[sortedLandmarks[k].Type]->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); selectable= true; } } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 9d1cb364a..9db2282fc 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1663,7 +1663,7 @@ bool CInterfaceManager::loadConfig (const string &filename) // serial user chats info (serial it before position of windows so that they can be updated properly) if (ver >= 1) { - f.serialCheck(uint32('_ICU')); + f.serialCheck(NELID("_ICU")); if (!PeopleInterraction.loadUserChatsInfos(f)) { nlwarning("Bad user chat saving"); @@ -1671,7 +1671,7 @@ bool CInterfaceManager::loadConfig (const string &filename) } // header - f.serialCheck(uint32('GFCI')); + f.serialCheck(NELID("GFCI")); f.serial(nNbMode); f.serial(_CurrentMode); if(ver>=10) @@ -1897,7 +1897,7 @@ bool CInterfaceManager::saveConfig (const string &filename) f.serialVersion(ICFG_STREAM_VERSION); // serial user chats info (serial it before position of windows so that they can be updated properly) - f.serialCheck(uint32('_ICU')); + f.serialCheck(NELID("_ICU")); if (!PeopleInterraction.saveUserChatsInfos(f)) { nlwarning("Config saving failed"); @@ -1907,7 +1907,7 @@ bool CInterfaceManager::saveConfig (const string &filename) } // header - f.serialCheck(uint32('GFCI')); + f.serialCheck(NELID("GFCI")); f.serial(i); f.serial(_CurrentMode); f.serial(_LastInGameScreenW); diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index 95b091c22..332bcac57 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -1695,14 +1695,14 @@ bool CPeopleInterraction::saveUserChatsInfos(NLMISC::IStream &f) try { sint ver= f.serialVersion(USER_CHATS_INFO_VERSION); - f.serialCheck((uint32) 'TAHC'); + f.serialCheck(NELID("TAHC")); //saveFilteredChat(f, MainChat); saveFilteredChat(f, ChatGroup); for(uint k = 0; k < MaxNumUserChats; ++k) { saveFilteredChat(f, UserChat[k]); } - f.serialCheck((uint32) 'TAHC'); + f.serialCheck(NELID("TAHC")); if (ver>=1) { CChatGroupWindow *pCGW = PeopleInterraction.getChatGroupWindow(); @@ -1732,7 +1732,7 @@ bool CPeopleInterraction::saveUserDynChatsInfos(NLMISC::IStream &f) try { sint ver = f.serialVersion(USER_DYN_CHATS_INFO_VERSION); - f.serialCheck((uint32) 'OMGY'); + f.serialCheck(NELID("OMGY")); if (ver >= 1) { saveFilteredDynChat(f, TheUserChat); @@ -1755,7 +1755,7 @@ bool CPeopleInterraction::loadUserChatsInfos(NLMISC::IStream &f) { bool present; sint ver = f.serialVersion(USER_CHATS_INFO_VERSION); - f.serialCheck((uint32) 'TAHC'); + f.serialCheck(NELID("TAHC")); f.serial(present); if (!present) { @@ -1777,7 +1777,7 @@ bool CPeopleInterraction::loadUserChatsInfos(NLMISC::IStream &f) setupUserChatFromSummary(fcs, UserChat[k]); } } - f.serialCheck((uint32) 'TAHC'); + f.serialCheck(NELID("TAHC")); if (ver>=1) { // CChatGroupWindow *pCGW = PeopleInterraction.getChatGroupWindow(); @@ -1819,7 +1819,7 @@ bool CPeopleInterraction::loadUserDynChatsInfos(NLMISC::IStream &f) { bool present; sint ver = f.serialVersion(USER_DYN_CHATS_INFO_VERSION); - f.serialCheck((uint32) 'OMGY'); + f.serialCheck(NELID("OMGY")); f.serial(present); if (!present) { diff --git a/code/ryzom/client/src/landscape_poly_drawer.h b/code/ryzom/client/src/landscape_poly_drawer.h index 0012b5dcb..73d7fcadc 100644 --- a/code/ryzom/client/src/landscape_poly_drawer.h +++ b/code/ryzom/client/src/landscape_poly_drawer.h @@ -95,11 +95,11 @@ public: private: - // renderAll is called in main loop. It can called beginRenderLandscapePolyPart and renderLandscapePolyPart + // renderScene is called in main loop. It can called beginRenderLandscapePolyPart and renderLandscapePolyPart // methods. - friend void renderAll(bool); + friend void renderScene(); - // Enable stencil test and initialize function and operation of stencil at the beginning of renderAll method, + // Enable stencil test and initialize function and operation of stencil at the beginning of renderScene method, // before opaque render of canopy and main scene parts. // The eighth bit will be written with a 0 during next render to mark stencil buffer parts which will // support Shadow Volume algorithm. diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index 69fc35230..45e3fea51 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -1943,16 +1943,21 @@ class CAHInitResLod : public IActionHandler VideoModes.clear(); StringModeList.clear(); - StringModeList.push_back("uiConfigWindowed"); CurrentMode = getRyzomModes(VideoModes, StringModeList); + // getRyzomModes() expects empty list, so we need to insert 'Windowed' after mode list is filled + StringModeList.insert(StringModeList.begin(), "uiConfigWindowed"); + // If the client is in windowed mode, still in windowed mode and do not change anything if (ClientCfg.Windowed) CurrentMode = 0; // If we have not found the mode so it can be an error or machine change, so propose the first available else if (CurrentMode == -1) CurrentMode = 1; + // We inserted 'Windowed' as first mode, so index needs to move too + else + ++CurrentMode; CInterfaceManager *pIM = CInterfaceManager::getInstance(); CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:login:checkpass:content:res_value")); @@ -2111,7 +2116,12 @@ class CAHUninitResLod : public IActionHandler //nlinfo("CAHUninitResLod called"); // If the mode requested is a windowed mode do nothnig - if (CurrentMode != 0) + if (CurrentMode == 0) + { + ClientCfg.Windowed = true; + ClientCfg.writeBool("FullScreen", false); + } + else { ClientCfg.Windowed = false; // Get W, H @@ -2125,6 +2135,10 @@ class CAHUninitResLod : public IActionHandler } ClientCfg.Width = w; ClientCfg.Height = h; + + ClientCfg.writeBool("FullScreen", true); + ClientCfg.writeInt("Width", w); + ClientCfg.writeInt("Height", h); } if (CurrentPreset != 4) // CInterfaceDDX::CustomPreset diff --git a/code/ryzom/client/src/main_loop.cpp b/code/ryzom/client/src/main_loop.cpp index 59519fc69..01336402d 100644 --- a/code/ryzom/client/src/main_loop.cpp +++ b/code/ryzom/client/src/main_loop.cpp @@ -42,6 +42,7 @@ #include "nel/3d/u_material.h" #include "nel/3d/u_instance_material.h" #include "nel/3d/u_cloud_scape.h" +#include "nel/3d/stereo_hmd.h" // game share #include "game_share/brick_types.h" #include "game_share/light_cycle.h" @@ -77,7 +78,7 @@ #include "world_database_manager.h" #include "continent_manager.h" #include "ig_callback.h" -#include "fog_map.h" +//#include "fog_map.h" #include "movie_shooter.h" #include "sound_manager.h" #include "graph.h" @@ -124,16 +125,6 @@ #include "nel/misc/check_fpu.h" -// TMP TMP -#include "nel/gui/ctrl_polygon.h" -// TMP TMP -#include "game_share/scenario_entry_points.h" -#include "nel/3d/driver.h" -#include "nel/3d/texture_file.h" - -#include "nel/3d/packed_world.h" -#include "nel/3d/packed_zone.h" -#include "nel/3d/driver_user.h" #ifdef USE_WATER_ENV_MAP @@ -148,6 +139,14 @@ #include "nel/gui/lua_manager.h" #include "nel/gui/group_table.h" +// pulled from main_loop.cpp +#include "ping.h" +#include "profiling.h" +#include "camera.h" +#include "main_loop_debug.h" +#include "main_loop_temp.h" +#include "main_loop_utilities.h" + /////////// // USING // @@ -159,20 +158,12 @@ using namespace NLNET; using namespace std; -// TMP TMP -static void viewportToScissor(const CViewport &vp, CScissor &scissor) -{ - scissor.X = vp.getX(); - scissor.Y = vp.getY(); - scissor.Width = vp.getWidth(); - scissor.Height = vp.getHeight(); -} + //////////// // EXTERN // //////////// -extern std::set LodCharactersNotFound; extern UDriver *Driver; extern IMouseDevice *MouseDevice; extern UScene *Scene; @@ -187,13 +178,16 @@ extern TTime UniversalTime; extern UMaterial GenericMat; extern UCamera MainCam; extern CEventsListener EventsListener; -extern uint32 NbDatabaseChanges; extern CMatrix MainSceneViewMatrix; extern CMatrix InvMainSceneViewMatrix; extern std::vector LogoBitmaps; extern bool IsInRingSession; extern std::string UsedFSAddr; +// temp +extern NLMISC::CValueSmoother smoothFPS; +extern NLMISC::CValueSmoother moreSmoothFPS; + void loadBackgroundBitmap (TBackground background); void destroyLoadingBitmap (); void drawLoadingBitmap (float progress); @@ -216,84 +210,6 @@ uint64 SimulatedServerTick = 0; -/////////// -// CLASS // -/////////// -/** - * Class to manage the ping computed with the database. - * \author Guillaume PUZIN - * \author Nevrax France - * \date 2003 - */ -class CPing : public ICDBNode::IPropertyObserver -{ -private: - uint32 _Ping; - bool _RdyToPing; - -public: - // Constructor. - CPing() {_Ping = 0; _RdyToPing = true;} - // Destructor. - ~CPing() {;} - - // Add an observer on the database for the ping. - void init() - { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - if(pIM) - { - CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DEBUG_INFO:Ping", false); - if(pNodeLeaf) - { - ICDBNode::CTextId textId; - pNodeLeaf->addObserver(this, textId); - // nlwarning("CPing: cannot add the observer"); - } - else - nlwarning("CPing: 'SERVER:DEBUG_INFO:Ping' does not exist."); - } - } - - // Release the observer on the database for the ping. - void release() - { - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - if(pIM) - { - CCDBNodeLeaf *pNodeLeaf = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DEBUG_INFO:Ping", false); - if(pNodeLeaf) - { - ICDBNode::CTextId textId; - pNodeLeaf->removeObserver(this, textId); - } - else - nlwarning("CPing: 'SERVER:DEBUG_INFO:Ping' does not exist."); - } - } - - // Method called when the ping message is back. - virtual void update(ICDBNode* node) - { - CCDBNodeLeaf *leaf = safe_cast(node); - uint32 before = (uint32)leaf->getValue32(); - uint32 current = (uint32)(0xFFFFFFFF & ryzomGetLocalTime()); - if(before > current) - { - //nlwarning("DB PING Pb before '%u' after '%u'.", before, current); - if(ClientCfg.Check) - nlstop; - } - _Ping = current - before; - _RdyToPing = true; - } - - // return the ping in ms. - uint32 getValue() {return _Ping;} - - void rdyToPing(bool rdy) {_RdyToPing = rdy;} - bool rdyToPing() const {return _RdyToPing;} -}; ///////////// // GLOBALS // @@ -327,12 +243,6 @@ uint8 ShowInfos = 0; // 0=no info 1=text info 2=graph info bool bZeroCpu = false; // For no Cpu use if application is minimize TODO: intercept minimize message, called by CTRL + Z at this -bool Profiling = false; // Are we in Profile mode? -uint ProfileNumFrame = 0; -bool WantProfiling = false; -bool ProfilingVBLock = false; -bool WantProfilingVBLock = false; - bool MovieShooterSaving= false; // Are we in Shooting mode? @@ -379,8 +289,6 @@ CGameContextMenu GameContextMenu; -NLMISC::CValueSmoother smoothFPS; -NLMISC::CValueSmoother moreSmoothFPS(64); static CRefPtr s_FpsLeaf; static CRefPtr s_UiDirectionLeaf; @@ -425,12 +333,6 @@ H_AUTO_DECL ( RZ_Client_Main_Loop_Net ) /////////////// // FUNCTIONS // /////////////// -// Display some debug infos. -void displayDebug(); -void displayDebugFps(); -void displayDebugUIUnderMouse(); -// Display an Help. -void displayHelp(); //update the sound manager (listener pos, user walk/run sound...) void updateSound(); @@ -453,476 +355,11 @@ void displaySceneProfiles(); // validate current dialogs (end them if the player is too far from its interlocutor) void validateDialogs(const CGameContextMenu &gcm); -void buildCameraClippingPyramid (vector &planes) -{ - // Compute pyramid in view basis. - CVector pfoc(0,0,0); - const CFrustum &frustum = MainCam.getFrustum(); - InvMainSceneViewMatrix = MainCam.getMatrix(); - MainSceneViewMatrix = InvMainSceneViewMatrix; - MainSceneViewMatrix.invert(); - CVector lb(frustum.Left, frustum.Near, frustum.Bottom ); - CVector lt(frustum.Left, frustum.Near, frustum.Top ); - CVector rb(frustum.Right, frustum.Near, frustum.Bottom ); - CVector rt(frustum.Right, frustum.Near, frustum.Top ); +// *************************************************************************** - CVector lbFar(frustum.Left, ClientCfg.CharacterFarClip, frustum.Bottom); - CVector ltFar(frustum.Left, ClientCfg.CharacterFarClip, frustum.Top ); - CVector rtFar(frustum.Right, ClientCfg.CharacterFarClip, frustum.Top ); - - planes.resize (4); - // planes[0].make(lbFar, ltFar, rtFar); - planes[0].make(pfoc, lt, lb); - planes[1].make(pfoc, rt, lt); - planes[2].make(pfoc, rb, rt); - planes[3].make(pfoc, lb, rb); - - // Compute pyramid in World basis. - // The vector transformation M of a plane p is computed as p*M-1. - // Here, ViewMatrix== CamMatrix-1. Hence the following formula. - uint i; - - for (i = 0; i < 4; i++) - { - planes[i] = planes[i]*MainSceneViewMatrix; - } -} - - -//--------------------------------------------------- -// Test Profiling and run? -//--------------------------------------------------- -void testLaunchProfile() -{ - if(!WantProfiling) - return; - - // comes from ActionHandler - WantProfiling= false; - -#ifdef _PROFILE_ON_ - if( !Profiling ) - { - // start the bench. - NLMISC::CHTimer::startBench(); - ProfileNumFrame = 0; - Driver->startBench(); - if (SoundMngr) - SoundMngr->getMixer()->startDriverBench(); - // state - Profiling= true; - } - else - { - // end the bench. - if (SoundMngr) - SoundMngr->getMixer()->endDriverBench(); - NLMISC::CHTimer::endBench(); - Driver->endBench(); - - - // Display and save profile to a File. - CLog log; - CFileDisplayer fileDisplayer(NLMISC::CFile::findNewFile(getLogDirectory() + "profile.log")); - CStdDisplayer stdDisplayer; - log.addDisplayer(&fileDisplayer); - log.addDisplayer(&stdDisplayer); - // diplay - NLMISC::CHTimer::displayHierarchicalByExecutionPathSorted(&log, CHTimer::TotalTime, true, 48, 2); - NLMISC::CHTimer::displayHierarchical(&log, true, 48, 2); - NLMISC::CHTimer::displayByExecutionPath(&log, CHTimer::TotalTime); - NLMISC::CHTimer::display(&log, CHTimer::TotalTime); - NLMISC::CHTimer::display(&log, CHTimer::TotalTimeWithoutSons); - Driver->displayBench(&log); - - if (SoundMngr) - SoundMngr->getMixer()->displayDriverBench(&log); - - // state - Profiling= false; - } -#endif // #ifdef _PROFILE_ON_ -} - - -//--------------------------------------------------- -// Test ProfilingVBLock and run? -//--------------------------------------------------- -void testLaunchProfileVBLock() -{ - // If running, must stop for this frame. - if(ProfilingVBLock) - { - vector strs; - Driver->endProfileVBHardLock(strs); - nlinfo("Profile VBLock"); - nlinfo("**************"); - for(uint i=0;iprofileVBHardAllocation(strs); - for(uint i=0;iendProfileIBLock(strs); - nlinfo("Profile Index Buffer Lock"); - nlinfo("**************"); - for(uint i=0;iprofileIBAllocation(strs); - for(uint i=0;istartProfileVBHardLock(); - Driver->startProfileIBLock(); - } -} - - -//--------------------------------------------------- -// update the camera perspective setup -//--------------------------------------------------- -void updateCameraPerspective() -{ - float fov, aspectRatio; - computeCurrentFovAspectRatio(fov, aspectRatio); - - // change the perspective of the scene - if(!MainCam.empty()) - MainCam.setPerspective(fov, aspectRatio, CameraSetupZNear, ClientCfg.Vision); - // change the perspective of the root scene - if(SceneRoot) - { - UCamera cam= SceneRoot->getCam(); - cam.setPerspective(fov, aspectRatio, SceneRootCameraZNear, SceneRootCameraZFar); - } -} - -//--------------------------------------------------- -// Compare ClientCfg and LastClientCfg to know what we must update -//--------------------------------------------------- -void updateFromClientCfg() -{ - CClientConfig::setValues(); - ClientCfg.IsInvalidated = false; - - // GRAPHICS - GENERAL - //--------------------------------------------------- - if ((ClientCfg.Windowed != LastClientCfg.Windowed) || - (ClientCfg.Width != LastClientCfg.Width) || - (ClientCfg.Height != LastClientCfg.Height) || - (ClientCfg.Depth != LastClientCfg.Depth) || - (ClientCfg.Frequency != LastClientCfg.Frequency)) - { - setVideoMode(UDriver::CMode(ClientCfg.Width, ClientCfg.Height, (uint8)ClientCfg.Depth, - ClientCfg.Windowed, ClientCfg.Frequency)); - } - - if (ClientCfg.DivideTextureSizeBy2 != LastClientCfg.DivideTextureSizeBy2) - { - if (ClientCfg.DivideTextureSizeBy2) - Driver->forceTextureResize(2); - else - Driver->forceTextureResize(1); - } - - //--------------------------------------------------- - if (ClientCfg.WaitVBL != LastClientCfg.WaitVBL) - { - if(ClientCfg.WaitVBL) - Driver->setSwapVBLInterval(1); - else - Driver->setSwapVBLInterval(0); - } - - // GRAPHICS - LANDSCAPE - //--------------------------------------------------- - if (ClientCfg.LandscapeThreshold != LastClientCfg.LandscapeThreshold) - { - if (Landscape) Landscape->setThreshold(ClientCfg.getActualLandscapeThreshold()); - } - - //--------------------------------------------------- - if (ClientCfg.LandscapeTileNear != LastClientCfg.LandscapeTileNear) - { - if (Landscape) Landscape->setTileNear(ClientCfg.LandscapeTileNear); - } - - //--------------------------------------------------- - if (Landscape) - { - if (ClientCfg.Vision != LastClientCfg.Vision) - { - if (!ClientCfg.Light) - { - // Not in an indoor ? - if (ContinentMngr.cur() && !ContinentMngr.cur()->Indoor) - { - // Refresh All Zone in streaming according to the refine position - vector zonesAdded; - vector zonesRemoved; - const R2::CScenarioEntryPoints::CCompleteIsland *ci = R2::CScenarioEntryPoints::getInstance().getCompleteIslandFromCoords(CVector2f((float) UserEntity->pos().x, (float) UserEntity->pos().y)); - Landscape->refreshAllZonesAround(View.refinePos(), ClientCfg.Vision + ExtraZoneLoadingVision, zonesAdded, zonesRemoved, ProgressBar, ci ? &(ci->ZoneIDs) : NULL); - LandscapeIGManager.unloadArrayZoneIG(zonesRemoved); - LandscapeIGManager.loadArrayZoneIG(zonesAdded); - } - } - } - } - - //--------------------------------------------------- - if (ClientCfg.Vision != LastClientCfg.Vision || ClientCfg.FoV!=LastClientCfg.FoV || - ClientCfg.Windowed != LastClientCfg.Windowed || ClientCfg.ScreenAspectRatio != LastClientCfg.ScreenAspectRatio ) - { - updateCameraPerspective(); - } - - //--------------------------------------------------- - if (Landscape) - { - if (ClientCfg.MicroVeget != LastClientCfg.MicroVeget) - { - if(ClientCfg.MicroVeget) - { - // if configured, enable the vegetable and load the texture. - Landscape->enableVegetable(true); - // Default setup. TODO later by gameDev. - Landscape->setVegetableWind(CVector(0.5, 0.5, 0).normed(), 0.5, 1, 0); - // Default setup. should work well for night/day transition in 30 minutes. - // Because all vegetables will be updated every 20 seconds => 90 steps. - Landscape->setVegetableUpdateLightingFrequency(1/20.f); - // Density (percentage to ratio) - Landscape->setVegetableDensity(ClientCfg.MicroVegetDensity/100.f); - } - else - { - Landscape->enableVegetable(false); - } - } - } - - //--------------------------------------------------- - if (ClientCfg.MicroVegetDensity != LastClientCfg.MicroVegetDensity) - { - // Density (percentage to ratio) - if (Landscape) Landscape->setVegetableDensity(ClientCfg.MicroVegetDensity/100.f); - } - - // GRAPHICS - SPECIAL EFFECTS - //--------------------------------------------------- - if (ClientCfg.FxNbMaxPoly != LastClientCfg.FxNbMaxPoly) - { - if (Scene->getGroupLoadMaxPolygon("Fx") != ClientCfg.FxNbMaxPoly) - Scene->setGroupLoadMaxPolygon("Fx", ClientCfg.FxNbMaxPoly); - } - - //--------------------------------------------------- - if (ClientCfg.Cloud != LastClientCfg.Cloud) - { - if (ClientCfg.Cloud) - { - InitCloudScape = true; - CloudScape = Scene->createCloudScape(); - } - else - { - if (CloudScape != NULL) - Scene->deleteCloudScape(CloudScape); - CloudScape = NULL; - } - } - - //--------------------------------------------------- - if (ClientCfg.CloudQuality != LastClientCfg.CloudQuality) - { - if (CloudScape != NULL) - CloudScape->setQuality(ClientCfg.CloudQuality); - } - - //--------------------------------------------------- - if (ClientCfg.CloudUpdate != LastClientCfg.CloudUpdate) - { - if (CloudScape != NULL) - CloudScape->setNbCloudToUpdateIn80ms(ClientCfg.CloudUpdate); - } - - //--------------------------------------------------- - if (ClientCfg.Shadows != LastClientCfg.Shadows) - { - // Enable/Disable Receive on Landscape - if(Landscape) - { - Landscape->enableReceiveShadowMap(ClientCfg.Shadows); - } - // Enable/Disable Cast for all entities - for(uint i=0;iupdateCastShadowMap(); - } - } - - // GRAPHICS - CHARACTERS - //--------------------------------------------------- - if (ClientCfg.SkinNbMaxPoly != LastClientCfg.SkinNbMaxPoly) - { - if (Scene->getGroupLoadMaxPolygon("Skin") != ClientCfg.SkinNbMaxPoly) - Scene->setGroupLoadMaxPolygon("Skin", ClientCfg.SkinNbMaxPoly); - } - - //--------------------------------------------------- - if (ClientCfg.NbMaxSkeletonNotCLod != LastClientCfg.NbMaxSkeletonNotCLod ) - { - Scene->setMaxSkeletonsInNotCLodForm(ClientCfg.NbMaxSkeletonNotCLod); - } - - //--------------------------------------------------- - if (ClientCfg.CharacterFarClip != LastClientCfg.CharacterFarClip) - { - // Nothing to do - } - - //--------------------------------------------------- - if (ClientCfg.HDEntityTexture != LastClientCfg.HDEntityTexture) - { - // Don't reload Texture, will be done at next Game Start - } - - // INTERFACE works - - - // INPUTS - //--------------------------------------------------- - if (ClientCfg.CursorSpeed != LastClientCfg.CursorSpeed) - SetMouseSpeed (ClientCfg.CursorSpeed); - - if (ClientCfg.CursorAcceleration != LastClientCfg.CursorAcceleration) - SetMouseAcceleration (ClientCfg.CursorAcceleration); - - if (ClientCfg.HardwareCursor != LastClientCfg.HardwareCursor) - { - if (ClientCfg.HardwareCursor != IsMouseCursorHardware()) - { - InitMouseWithCursor (ClientCfg.HardwareCursor); - } - } - - - // SOUND - //--------------------------------------------------- - bool mustReloadSoundMngrContinent= false; - - // disable/enable sound? - if (ClientCfg.SoundOn != LastClientCfg.SoundOn) - { - if (SoundMngr && !ClientCfg.SoundOn) - { - nlwarning("Deleting sound manager..."); - delete SoundMngr; - SoundMngr = NULL; - } - else if (SoundMngr == NULL && ClientCfg.SoundOn) - { - nlwarning("Creating sound manager..."); - SoundMngr = new CSoundManager(); - try - { - SoundMngr->init(NULL); - } - catch(const Exception &e) - { - nlwarning("init : Error when creating 'SoundMngr' : %s", e.what()); - SoundMngr = 0; - } - - // re-init with good SFX/Music Volume - if(SoundMngr) - { - SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume); - SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume); - } - } - else - { - nlwarning("Sound config error !"); - } - - mustReloadSoundMngrContinent= true; - } - - // change EAX? - if ( SoundMngr && LastClientCfg.SoundOn && - (ClientCfg.UseEax != LastClientCfg.UseEax) ) - { - SoundMngr->reset(); - - mustReloadSoundMngrContinent= true; - } - - // change SoundForceSoftwareBuffer? - if ( SoundMngr && LastClientCfg.SoundOn && - (ClientCfg.SoundForceSoftwareBuffer != LastClientCfg.SoundForceSoftwareBuffer) ) - { - SoundMngr->reset(); - - mustReloadSoundMngrContinent= true; - } - - // change MaxTrack? don't reset - if ( SoundMngr && LastClientCfg.SoundOn && - (ClientCfg.MaxTrack != LastClientCfg.MaxTrack)) - { - SoundMngr->getMixer()->changeMaxTrack(ClientCfg.MaxTrack); - } - - // change SoundFX Volume? don't reset - if (SoundMngr && ClientCfg.SoundSFXVolume != LastClientCfg.SoundSFXVolume) - { - SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume); - } - - // change Game Music Volume? don't reset - if (SoundMngr && ClientCfg.SoundGameMusicVolume != LastClientCfg.SoundGameMusicVolume) - { - SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume); - } - - // reload only if active and reseted - if (mustReloadSoundMngrContinent && SoundMngr && ContinentMngr.cur() && !ContinentMngr.cur()->Indoor && UserEntity) - { - SoundMngr->loadContinent(ContinentMngr.getCurrentContinentSelectName(), UserEntity->pos()); - } - - // Ok backup the new clientcfg - LastClientCfg = ClientCfg; -} +enum TSkyMode { NoSky, OldSky, NewSky }; +static TSkyMode s_SkyMode = NoSky; void preRenderNewSky () { @@ -934,29 +371,43 @@ void preRenderNewSky () cd.Hour = 12.f; } sky.setup(cd, SmoothedClientDate, WeatherManager.getWeatherValue(), MainFogState.FogColor, Scene->getSunDirection(), false); - // setup camera - CFrustum frust = MainCam.getFrustum(); - UCamera camSky = sky.getScene()->getCam(); - sky.getScene()->setViewport(Scene->getViewport()); - camSky.setTransformMode(UTransform::DirectMatrix); - // must have our own Far!!! - frust.Far= SkyCameraZFar; - camSky.setFrustum(frust); - CMatrix skyCameraMatrix; - skyCameraMatrix.identity(); - skyCameraMatrix= MainCam.getMatrix(); - skyCameraMatrix.setPos(CVector::Null); - camSky.setMatrix(skyCameraMatrix); } -//uint32 MainLoopCounter = 0; +void commitCamera() +{ + // Set the sky camera + if (s_SkyMode == NewSky) + { + CSky &sky = ContinentMngr.cur()->CurrentSky; + // setup camera + CFrustum frust = MainCam.getFrustum(); + UCamera camSky = sky.getScene()->getCam(); + sky.getScene()->setViewport(Scene->getViewport()); + camSky.setTransformMode(UTransform::DirectMatrix); + // must have our own Far!!! + frust.Far= SkyCameraZFar; + camSky.setFrustum(frust); + CMatrix skyCameraMatrix; + skyCameraMatrix.identity(); + skyCameraMatrix= MainCam.getMatrix(); + skyCameraMatrix.setPos(CVector::Null); + camSky.setMatrix(skyCameraMatrix); + } + // Set The Root Camera + UCamera camRoot = SceneRoot->getCam(); + if(!camRoot.empty()) + { + // Update Camera Position/Rotation. + //camRoot.setPos(View.currentViewPos()); + //camRoot.setRotQuat(View.currentViewQuat()); + camRoot.setPos(MainCam.getPos()); + camRoot.setRotQuat(MainCam.getRotQuat()); + } +} // *************************************************************************** -enum TSkyMode { NoSky, OldSky, NewSky }; - -// *************************************************************************** void beginRenderCanopyPart() { SceneRoot->beginPartRender(); @@ -975,17 +426,17 @@ void endRenderMainScenePart() Scene->endPartRender(true); } -void beginRenderSkyPart(TSkyMode skyMode) +void beginRenderSkyPart() { - if(skyMode == NewSky) + if (s_SkyMode == NewSky) { CSky &sky = ContinentMngr.cur()->CurrentSky; sky.getScene()->beginPartRender(); } } -void endRenderSkyPart(TSkyMode skyMode) +void endRenderSkyPart() { - if(skyMode == NewSky) + if (s_SkyMode == NewSky) { CSky &sky = ContinentMngr.cur()->CurrentSky; sky.getScene()->endPartRender(false); @@ -1003,14 +454,6 @@ static void renderCanopyPart(UScene::TRenderPart renderPart) ContinentMngr.getFogState(CanopyFog, LightCycleManager.getLightLevel(), LightCycleManager.getLightDesc().DuskRatio, LightCycleManager.getState(), View.viewPos(), RootFogState); RootFogState.setupInDriver(*Driver); - // Set The Root Camera - UCamera camRoot = SceneRoot->getCam(); - if(!camRoot.empty()) - { - // Update Camera Position/Rotation. - camRoot.setPos(View.currentViewPos()); - camRoot.setRotQuat(View.currentView()); - } // Render the root scene SceneRoot->renderPart(renderPart); } @@ -1035,12 +478,12 @@ static void renderMainScenePart(UScene::TRenderPart renderPart) // *************************************************************************************************************************** // Render a part of the sky -static void renderSkyPart(UScene::TRenderPart renderPart, TSkyMode skyMode) +static void renderSkyPart(UScene::TRenderPart renderPart) { - nlassert(skyMode != NoSky); + nlassert(s_SkyMode != NoSky); Driver->setDepthRange(SKY_DEPTH_RANGE_START, 1.f); Driver->enableFog(false); - if (skyMode == NewSky) + if (s_SkyMode == NewSky) { CSky &sky = ContinentMngr.cur()->CurrentSky; sky.getScene()->renderPart(renderPart); @@ -1059,95 +502,49 @@ static void renderSkyPart(UScene::TRenderPart renderPart, TSkyMode skyMode) #endif } - // *************************************************************************************************************************** -// Render all scenes -void renderAll(bool forceFullDetail) +// Utility to force full detail +struct CForceFullDetail { - if (ClientCfg.Bloom) +public: + void backup() { - // set bloom parameters before applying bloom effect - CBloomEffect::getInstance().setSquareBloom(ClientCfg.SquareBloom); - CBloomEffect::getInstance().setDensityBloom((uint8)ClientCfg.DensityBloom); - // init bloom - CBloomEffect::getInstance().initBloom(); + maxFullDetailChar = Scene->getMaxSkeletonsInNotCLodForm(); + oldBalancingMode = Scene->getPolygonBalancingMode(); + oldSkyBalancingMode = UScene::PolygonBalancingOff; + UScene *skyScene = getSkyScene(); + if (skyScene) oldSkyBalancingMode = skyScene->getPolygonBalancingMode(); } - - // backup old balancing mode - uint maxFullDetailChar = Scene->getMaxSkeletonsInNotCLodForm(); - UScene *skyScene = getSkyScene(); - UScene::TPolygonBalancingMode oldBalancingMode = Scene->getPolygonBalancingMode(); - UScene::TPolygonBalancingMode oldSkyBalancingMode = UScene::PolygonBalancingOff; - if (skyScene) - { - oldSkyBalancingMode = skyScene->getPolygonBalancingMode(); - } - // disable load balancing for that frame only if asked - if (forceFullDetail) + void set() { Scene->setMaxSkeletonsInNotCLodForm(1000000); Scene->setPolygonBalancingMode(UScene::PolygonBalancingOff); - if (skyScene) - { - skyScene->setPolygonBalancingMode(UScene::PolygonBalancingOff); - } + UScene *skyScene = getSkyScene(); + if (skyScene) skyScene->setPolygonBalancingMode(UScene::PolygonBalancingOff); } - + void restore() { - H_AUTO_USE ( RZ_Client_Main_Loop_Sky_And_Weather ) - - //HeightGrid.update(Scene->getCam().getPos()); - - // update description of light cycle - updateLightDesc(); - - // server driven weather mgt - updateDBDrivenWeatherValue(); - - // Update the weather manager - updateWeatherManager(MainCam.getMatrix(), ContinentMngr.cur()); - - // compute thunder color - ThunderColor.modulateFromui(WeatherManager.getCurrWeatherState().ThunderColor, (uint) (256.f * WeatherManager.getThunderLevel())); - - // Update the lighting - LightCycleManager.setHour(DayNightCycleHour, WeatherManager, ThunderColor); - - #ifdef RENDER_CLOUDS - if (Filter3D[FilterCloud]) - { - H_AUTO_USE ( RZ_Client_Main_Loop_Update_Cloud_Scape ); - updateClouds(); - } - #endif - - - ContinentMngr.getFogState(MainFog, LightCycleManager.getLightLevel(), LightCycleManager.getLightDesc().DuskRatio, LightCycleManager.getState(), View.viewPos(), MainFogState); + Scene->setMaxSkeletonsInNotCLodForm(maxFullDetailChar); + Scene->setPolygonBalancingMode(oldBalancingMode); + UScene *skyScene = getSkyScene(); + if (skyScene) skyScene->setPolygonBalancingMode(oldSkyBalancingMode); + } +private: + uint maxFullDetailChar; + UScene::TPolygonBalancingMode oldBalancingMode; + UScene::TPolygonBalancingMode oldSkyBalancingMode; +}; +static CForceFullDetail s_ForceFullDetail; +void clearBuffers() +{ + if (Render) + { if (Driver->getPolygonMode() == UDriver::Filled) { Driver->clearZBuffer(); } - #ifdef RENDER_CLOUDS - if (CloudScape != NULL && Filter3D[FilterCloud]) - { - H_AUTO_USE ( RZ_Client_Main_Loop_Anim_Cloud_Scape ); - - Driver->enableFog (false); - - // Force polygon mode to filled - NL3D::UDriver::TPolygonMode oldMode = Driver->getPolygonMode(); - Driver->setPolygonMode(NL3D::UDriver::Filled); - - CloudScape->anim (DT); // WARNING this function work with screen - - Driver->enableFog (true); - - // Reset backuped polygon mode - Driver->setPolygonMode(oldMode); - } - #endif // Sky is used to clear the frame buffer now, but if in line or point polygon mode, we should draw it if (Driver->getPolygonMode() != UDriver::Filled) { @@ -1157,6 +554,168 @@ void renderAll(bool forceFullDetail) } } } + else + { + Driver->clearBuffers(ClientCfg.BGColor); + } +} + +void renderScene(bool forceFullDetail, bool bloom) +{ + if (bloom) + { + // set bloom parameters before applying bloom effect + CBloomEffect::getInstance().setSquareBloom(ClientCfg.SquareBloom); + CBloomEffect::getInstance().setDensityBloom((uint8)ClientCfg.DensityBloom); + // init bloom + CBloomEffect::getInstance().initBloom(); + } + if (forceFullDetail) + { + s_ForceFullDetail.backup(); + s_ForceFullDetail.set(); + } + clearBuffers(); + renderScene(); + if (forceFullDetail) + { + s_ForceFullDetail.restore(); + } + if (bloom) + { + // apply bloom effect + CBloomEffect::getInstance().endBloom(); + CBloomEffect::getInstance().endInterfacesDisplayBloom(); + } +} + +// *************************************************************************************************************************** + +void updateWaterEnvMap() +{ + #ifdef USE_WATER_ENV_MAP + if (WaterEnvMapRefCount > 0) // water env map needed + { + if (!WaterEnvMap) + { + CSky &sky = ContinentMngr.cur()->CurrentSky; + if (sky.getScene()) + { + nlassert(WaterEnvMapSkyCam.empty()); + WaterEnvMapSkyCam = sky.getScene()->createCamera(); // deleted in unselect + nlassert(WaterEnvMapCanopyCam.empty()); + WaterEnvMapCanopyCam = SceneRoot->createCamera(); // deleted in unselect + // Create water env map if not already created + WaterEnvMap = Driver->createWaterEnvMap(); + if(WaterEnvMap) + { + WaterEnvMap->init(128, 256, ClientCfg.WaterEnvMapUpdateTime); + WaterEnvMap->setWaterEnvMapRenderCallback(&WaterEnvMapRdr); + Scene->setWaterEnvMap(WaterEnvMap); + } + } + } + WaterEnvMapRdr.CurrDate = SmoothedClientDate; + WaterEnvMapRdr.AnimationDate = SmoothedClientDate; + if (ClientCfg.R2EDEnabled && R2::getEditor().getFixedLighting()) + { + WaterEnvMapRdr.CurrDate.Hour = 12.f; + } + WaterEnvMapRdr.CurrFogColor = MainFogState.FogColor; + WaterEnvMapRdr.CurrTime = TimeInSec - FirstTimeInSec; + WaterEnvMapRdr.CurrWeather = WeatherManager.getWeatherValue(); + CSky &sky = ContinentMngr.cur()->CurrentSky; + WaterEnvMap->setAlpha(sky.getWaterEnvMapAlpha()); + Scene->updateWaterEnvMaps(TimeInSec - FirstTimeInSec); + } + #endif +} + +// *************************************************************************************************************************** + +void updateWeather() +{ + H_AUTO_USE ( RZ_Client_Main_Loop_Sky_And_Weather ) + + //HeightGrid.update(Scene->getCam().getPos()); + + // update description of light cycle + updateLightDesc(); + + // server driven weather mgt + updateDBDrivenWeatherValue(); + + // Update the weather manager + updateWeatherManager(MainCam.getMatrix(), ContinentMngr.cur()); + + // compute thunder color + ThunderColor.modulateFromui(WeatherManager.getCurrWeatherState().ThunderColor, (uint) (256.f * WeatherManager.getThunderLevel())); + + // Update the lighting + LightCycleManager.setHour(DayNightCycleHour, WeatherManager, ThunderColor); + + #ifdef RENDER_CLOUDS + if (Filter3D[FilterCloud]) + { + H_AUTO_USE ( RZ_Client_Main_Loop_Update_Cloud_Scape ); + updateClouds(); + } + #endif + + ContinentMngr.getFogState(MainFog, LightCycleManager.getLightLevel(), LightCycleManager.getLightDesc().DuskRatio, LightCycleManager.getState(), View.viewPos(), MainFogState); + + // TODO: ZBuffer clear was originally before this, but should not be necessary normally. + // The anim function renders new clouds. Ensure this does not break. + // These are old-style nel clouds. + + #ifdef RENDER_CLOUDS + if (CloudScape != NULL && Filter3D[FilterCloud]) + { + H_AUTO_USE ( RZ_Client_Main_Loop_Anim_Cloud_Scape ); + + Driver->enableFog (false); + + // Force polygon mode to filled + NL3D::UDriver::TPolygonMode oldMode = Driver->getPolygonMode(); + Driver->setPolygonMode(NL3D::UDriver::Filled); + + CloudScape->anim (DT); // WARNING this function work with screen + + Driver->enableFog (true); + + // Reset backuped polygon mode + Driver->setPolygonMode(oldMode); + } + #endif + + // Update new sky + if (ContinentMngr.cur() && !ContinentMngr.cur()->Indoor) + { + if(Driver->getPolygonMode() == UDriver::Filled) + { + if (Filter3D[FilterSky]) + { + CSky &sky = ContinentMngr.cur()->CurrentSky; + if (sky.getScene()) + { + s_SkyMode = NewSky; + sky.getScene()->animate(TimeInSec-FirstTimeInSec); + // Setup the sky camera + preRenderNewSky(); + } + else + { + s_SkyMode = OldSky; + } + } + } + } +} + +// *************************************************************************************************************************** +// Render all scenes +void renderScene() +{ // Update Filter Flags Scene->enableElementRender(UScene::FilterAllMeshNoVP, Filter3D[FilterMeshNoVP]); Scene->enableElementRender(UScene::FilterAllMeshVP, Filter3D[FilterMeshVP]); @@ -1170,36 +729,13 @@ void renderAll(bool forceFullDetail) if(Scene_Profile) Scene->profileNextRender(); - TSkyMode skyMode = NoSky; - if (ContinentMngr.cur() && !ContinentMngr.cur()->Indoor) - { - if(Driver->getPolygonMode() == UDriver::Filled) - { - if (Filter3D[FilterSky]) - { - CSky &sky = ContinentMngr.cur()->CurrentSky; - if (sky.getScene()) - { - skyMode = NewSky; - sky.getScene()->animate(TimeInSec-FirstTimeInSec); - // Setup the sky camera - preRenderNewSky(); - } - else - { - skyMode = OldSky; - } - } - } - } - // initialisation of polygons renderer CLandscapePolyDrawer::getInstance().beginRenderLandscapePolyPart(); // Start Part Rendering beginRenderCanopyPart(); beginRenderMainScenePart(); - beginRenderSkyPart(skyMode); + beginRenderSkyPart(); // Render part // WARNING: always must begin rendering with at least UScene::RenderOpaque, // else dynamic shadows won't work @@ -1209,32 +745,17 @@ void renderAll(bool forceFullDetail) // render of polygons on landscape CLandscapePolyDrawer::getInstance().renderLandscapePolyPart(); - if (skyMode != NoSky) renderSkyPart((UScene::TRenderPart) (UScene::RenderOpaque | UScene::RenderTransparent), skyMode); + if (s_SkyMode != NoSky) renderSkyPart((UScene::TRenderPart) (UScene::RenderOpaque | UScene::RenderTransparent)); renderCanopyPart((UScene::TRenderPart) (UScene::RenderTransparent | UScene::RenderFlare)); renderMainScenePart((UScene::TRenderPart) (UScene::RenderTransparent | UScene::RenderFlare)); - if (skyMode == NewSky) renderSkyPart(UScene::RenderFlare, skyMode); + if (s_SkyMode == NewSky) renderSkyPart(UScene::RenderFlare); // End Part Rendering - endRenderSkyPart(skyMode); + endRenderSkyPart(); endRenderMainScenePart(); endRenderCanopyPart(); // reset depth range Driver->setDepthRange(0.f, CANOPY_DEPTH_RANGE_START); - - // restore load balancing mode - if (forceFullDetail) - { - Scene->setMaxSkeletonsInNotCLodForm(maxFullDetailChar); - Scene->setPolygonBalancingMode(oldBalancingMode); - if (skyScene) - { - skyScene->setPolygonBalancingMode(oldSkyBalancingMode); - } - } - - // apply bloom effect - if (ClientCfg.Bloom) - CBloomEffect::getInstance().endBloom(); } @@ -1538,6 +1059,14 @@ bool mainLoop() while( !UserEntity->permanentDeath() && !game_exit ) { + // If an action handler execute. NB: MUST BE DONE BEFORE ANY THING ELSE PROFILE CRASH!!!!!!!!!!!!!!!!! + testLaunchProfile(); + + // Test and may run a VBLock profile (only once) + testLaunchProfileVBLock(); + + // Start Bench + H_AUTO_USE ( RZ_Client_Main_Loop ) if (isBGDownloadEnabled()) { @@ -1612,11 +1141,6 @@ bool mainLoop() } { - // If an action handler execute. NB: MUST BE DONE BEFORE ANY THING ELSE PROFILE CRASH!!!!!!!!!!!!!!!!! - testLaunchProfile(); - - // Test and may run a VBLock profile (only once) - testLaunchProfileVBLock(); // Stop the Outgame music, with fade effect outgameFader.fade(); @@ -1624,10 +1148,6 @@ bool mainLoop() // update quit feature updateGameQuitting(); - // Start Bench - H_AUTO_USE ( RZ_Client_Main_Loop ) - - // update module manager NLNET::IModuleManager::getInstance().updateModules(); @@ -1862,9 +1382,30 @@ bool mainLoop() // Update Camera Position/Orientation. CVector currViewPos = View.currentViewPos(); - MainCam.setPos(currViewPos);; - MainCam.setRotQuat(View.currentView()); - + MainCam.setTransformMode(UTransformable::RotQuat); + MainCam.setPos(currViewPos); + MainCam.setRotQuat(View.currentViewQuat()); + if (StereoHMD) + { + NLMISC::CQuat hmdOrient = StereoHMD->getOrientation(); + NLMISC::CMatrix camMatrix = MainCam.getMatrix(); + NLMISC::CMatrix hmdMatrix; + hmdMatrix.setRot(hmdOrient); + NLMISC::CMatrix posMatrix; // minimal head modeling, will be changed in the future + posMatrix.translate(StereoHMD->getEyePosition()); + NLMISC::CMatrix mat = ((camMatrix * hmdMatrix) * posMatrix); + MainCam.setPos(mat.getPos()); + MainCam.setRotQuat(mat.getRot()); + } + if (StereoDisplay) + { + StereoDisplay->updateCamera(0, &MainCam); + if (SceneRoot) + { + UCamera cam = SceneRoot->getCam(); + StereoDisplay->updateCamera(1, &cam); + } + } // see if camera is below water (useful for sort order) if (ContinentMngr.cur()) @@ -1955,9 +1496,6 @@ bool mainLoop() } - ////////////////////////// - // RENDER THE FRAME 3D // - ////////////////////////// if (!ClientCfg.Light) { CClientDate newDate(RT.getRyzomDay(), DayNightCycleHour); @@ -2044,9 +1582,6 @@ bool mainLoop() } } - // Set the matrix in 3D Mode. - Driver->setMatrixMode3D(MainCam); - // R2ED pre render update if (ClientCfg.R2EDEnabled) @@ -2054,237 +1589,306 @@ bool mainLoop() R2::getEditor().updateBeforeRender(); } - - // Position the camera to prepare the render if (!ClientCfg.Light) { - // Render if(Render) { - #ifdef USE_WATER_ENV_MAP - if (WaterEnvMapRefCount > 0) // water env map needed + // Update water env map (happens when continent changed etc) + updateWaterEnvMap(); + + // Update weather + updateWeather(); + } + } + + uint i = 0; + uint bloomStage = 0; + while ((!StereoDisplay && i == 0) || (StereoDisplay && StereoDisplay->nextPass())) + { + ++i; + /////////////////// + // SETUP CAMERAS // + /////////////////// + + if (StereoDisplay) + { + // modify cameras for stereo display + const CViewport &vp = StereoDisplay->getCurrentViewport(); + Driver->setViewport(vp); + nlassert(Scene); + Scene->setViewport(vp); + if (SceneRoot) { - if (!WaterEnvMap) + SceneRoot->setViewport(vp); + } + //MainCam.setTransformMode(UTransformable::DirectMatrix); + StereoDisplay->getCurrentMatrix(0, &MainCam); + StereoDisplay->getCurrentFrustum(0, &MainCam); + if (SceneRoot) + { + // matrix updated during commitCamera from maincam + UCamera cam = SceneRoot->getCam(); + StereoDisplay->getCurrentFrustum(1, &cam); + } + } + + // Commit camera changes + commitCamera(); + + ////////////////////////// + // RENDER THE FRAME 3D // + ////////////////////////// + + bool stereoRenderTarget = (StereoDisplay != NULL) && StereoDisplay->beginRenderTarget(); + + if (!StereoDisplay || StereoDisplay->wantClear()) + { + if (Render) + { + if (ClientCfg.Bloom) { - CSky &sky = ContinentMngr.cur()->CurrentSky; - if (sky.getScene()) + nlassert(bloomStage == 0); + // set bloom parameters before applying bloom effect + CBloomEffect::getInstance().setSquareBloom(ClientCfg.SquareBloom); + CBloomEffect::getInstance().setDensityBloom((uint8)ClientCfg.DensityBloom); + // start bloom effect (just before the first scene element render) + CBloomEffect::instance().initBloom(); + bloomStage = 1; + } + } + + // Clear buffers + clearBuffers(); + } + + if (!StereoDisplay || StereoDisplay->wantScene()) + { + if (!ClientCfg.Light) + { + // Render + if(Render) + { + // nb : force full detail if a screenshot is asked + // todo : move outside render code + bool fullDetail = ScreenshotRequest != ScreenshotRequestNone && ClientCfg.ScreenShotFullDetail; + if (fullDetail) { - WaterEnvMapSkyCam = sky.getScene()->createCamera(); // deleted in unselect - WaterEnvMapCanopyCam = SceneRoot->createCamera(); // deleted in unselect - // Create water env map if not already created - WaterEnvMap = Driver->createWaterEnvMap(); - if(WaterEnvMap) - { - WaterEnvMap->init(128, 256, ClientCfg.WaterEnvMapUpdateTime); - WaterEnvMap->setWaterEnvMapRenderCallback(&WaterEnvMapRdr); - Scene->setWaterEnvMap(WaterEnvMap); - } + s_ForceFullDetail.backup(); + s_ForceFullDetail.set(); + } + + // Render scene + renderScene(); + + if (fullDetail) + { + s_ForceFullDetail.restore(); } } - WaterEnvMapRdr.CurrDate = SmoothedClientDate; - WaterEnvMapRdr.AnimationDate = SmoothedClientDate; - if (ClientCfg.R2EDEnabled && R2::getEditor().getFixedLighting()) - { - WaterEnvMapRdr.CurrDate.Hour = 12.f; - } - WaterEnvMapRdr.CurrFogColor = MainFogState.FogColor; - WaterEnvMapRdr.CurrTime = TimeInSec - FirstTimeInSec; - WaterEnvMapRdr.CurrWeather = WeatherManager.getWeatherValue(); - CSky &sky = ContinentMngr.cur()->CurrentSky; - WaterEnvMap->setAlpha(sky.getWaterEnvMapAlpha()); - Scene->updateWaterEnvMaps(TimeInSec - FirstTimeInSec); } - #endif - renderAll(ScreenshotRequest != ScreenshotRequestNone && ClientCfg.ScreenShotFullDetail); // nb : force full detail if a screenshot is asked + } - // for that frame and - // tmp : display height grid - //static volatile bool displayHeightGrid = true; - /*if (displayHeightGrid) + if (!StereoDisplay || StereoDisplay->wantInterface3D()) + { + if (!ClientCfg.Light) { - HeightGrid.display(*Driver); - }*/ - // display results? - if(Scene_Profile) + // Render + if (Render) + { + if (ClientCfg.Bloom && bloomStage == 1) + { + // End the actual bloom effect visible in the scene. + if (StereoDisplay) Driver->setViewport(NL3D::CViewport()); + CBloomEffect::instance().endBloom(); + if (StereoDisplay) Driver->setViewport(StereoDisplay->getCurrentViewport()); + bloomStage = 2; + } + + // for that frame and + // tmp : display height grid + //static volatile bool displayHeightGrid = true; + /*if (displayHeightGrid) + { + HeightGrid.display(*Driver); + }*/ + // display results? + if(Scene_Profile) + { + displaySceneProfiles(); + Scene_Profile= false; + } + // Render the primitives + { + H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) + PrimFiles.display (*Driver); + } + } /* if (Render) */ + + // Draw Extra 3D Objects + Driver->setMatrixMode3D(MainCam); + Driver->setModelMatrix(CMatrix::Identity); + + // Display PACS borders. + if (PACSBorders) + { + H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) + displayPACSBorders(); + displayPACSPrimitive(); + } + + // display Sound box + if (SoundBox) + { + H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) + displaySoundBox(); + } + + // display Debug of Clusters + if (DebugClusters) + { + H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) + displayDebugClusters(); + } + } /* if (!ClientCfg.Light) */ + else { - displaySceneProfiles(); - Scene_Profile= false; + // static UTextureFile *backgroundBitmap = NULL; + // if (backgroundBitmap == NULL) + // backgroundBitmap = Driver->createTextureFile("temp_background.tga"); + // Driver->setMatrixMode2D11(); + // Driver->drawBitmap (0.f, 0.f, 1024.f/1024.f, 1024.f/768.f, (UTexture&)*backgroundBitmap); + // Driver->setMatrixMode3D(MainCam); + + Driver->clearBuffers(CRGBA (0,0,0,0)); + displayPACSBorders(); + displayPACSPrimitive(); } - // Render the primitives + + if (!ClientCfg.Light && !Landscape) + { + displayPACSBorders(); + } + + // Display some things not in the scene like the name, the entity path, etc. + EntitiesMngr.updatePostRender(); + + // Render the stat graphs if needed { H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) - PrimFiles.display (*Driver); + CGraph::render (ShowInfos); } - } - else + + } /* if (!StereoDisplay || StereoDisplay->wantInterface3D()) */ + + if (!StereoDisplay || StereoDisplay->wantInterface2D()) { - Driver->clearBuffers(ClientCfg.BGColor); - } + // Render in 2D Mode to display 2D Interfaces and 2D texts. + Driver->setMatrixMode2D11(); - // Draw Extra 3D Objects - Driver->setMatrixMode3D(MainCam); - Driver->setModelMatrix(CMatrix::Identity); - - // Display PACS borders. - if (PACSBorders) - { - H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) - displayPACSBorders(); - displayPACSPrimitive(); - } - - // display Sound box - if (SoundBox) - { - H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) - displaySoundBox(); - } - - // display Debug of Clusters - if (DebugClusters) - { - H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) - displayDebugClusters(); - } - - } - else - { -// static UTextureFile *backgroundBitmap = NULL; -// if (backgroundBitmap == NULL) -// backgroundBitmap = Driver->createTextureFile("temp_background.tga"); -// Driver->setMatrixMode2D11(); -// Driver->drawBitmap (0.f, 0.f, 1024.f/1024.f, 1024.f/768.f, (UTexture&)*backgroundBitmap); -// Driver->setMatrixMode3D(MainCam); - - Driver->clearBuffers(CRGBA (0,0,0,0)); - displayPACSBorders(); - displayPACSPrimitive(); - } - - if (!ClientCfg.Light && !Landscape) - { - displayPACSBorders(); - } - - // Display some things not in the scene like the name, the entity path, etc. - EntitiesMngr.updatePostRender(); - - // R2ED pre render update - if (ClientCfg.R2EDEnabled) - { - // IMPORTANT : this should be called after CEntitiesMngr::updatePostRender() because - // entity may be added / removed there ! - R2::getEditor().updateAfterRender(); - } - - // Update FXs (remove them). - FXMngr.update(); - - // Render the stat graphs if needed - { - H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) - CGraph::render (ShowInfos); - } - - // Render in 2D Mode to display 2D Interfaces and 2D texts. - Driver->setMatrixMode2D11(); - - // draw a big quad to represent thunder strokes - if (Render && WeatherManager.getThunderLevel() != 0.f) - { - H_AUTO_USE ( RZ_Client_Main_Loop_Render_Thunder ) - Driver->drawQuad(0, 0, 1, 1, ThunderColor); - - // TODO : boris : add sound here ! - } - - // Update the contextual menu - { - H_AUTO_USE ( RZ_Client_Main_Loop_Interface ) - - // Update the game cursor. - ContextCur.check(); - GameContextMenu.update(); - - // validate dialogs - validateDialogs(GameContextMenu); - - // Display interface v3 - Driver->enableFog (false); - if (!Driver->isLost()) - { - if(ShowInterface) - pIMinstance->updateFrameViews (MainCam); - if(DebugUIView) - pIMinstance->displayUIViewBBoxs(DebugUIFilter); - if(DebugUICtrl) - pIMinstance->displayUICtrlBBoxs(DebugUIFilter); - if(DebugUIGroup) - pIMinstance->displayUIGroupBBoxs(DebugUIFilter); - } - - // special case in OpenGL : all scene has been display in render target, - // now, final texture is display with a quad - if(!ClientCfg.Light && ClientCfg.Bloom) - CBloomEffect::getInstance().endInterfacesDisplayBloom(); - } - - { - H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) - if (!Driver->isLost()) - { - // If show information is Active. - if(ShowInfos == 1) - displayDebug(); - - // If show information is Active. - if(ShowInfos == 2) - displayNetDebug(); - - // If show information is Active. - if(ShowInfos == 4) - displayDebugFps(); - - // If show information is Active. - if(ShowInfos == 5) - displayDebugUIUnderMouse(); - - // If show information is Active. - displayStreamingDebug(); - - // If Show Help is active -> Display an help. - if(ShowHelp) - displayHelp(); - - // Yoyo: indicate profiling state - if( Profiling ) - displaySpecialTextProgress("Profiling"); - - // Display frame rate - - // Create a shadow when displaying a text. - TextContext->setShaded(true); - // Set the font size. - TextContext->setFontSize(10); - // Set the text color - TextContext->setColor(CRGBA(255,255,255)); - - // temporary values for conversions - float x, y, width, height; - - for(uint i = 0; i < ClientCfg.Logos.size(); i++) + // draw a big quad to represent thunder strokes + /*if (Render && WeatherManager.getThunderLevel() != 0.f) { - std::vector res; - explode(ClientCfg.Logos[i],std::string(":"), res); - if(res.size()==9 && idrawQuad(0, 0, 1, 1, ThunderColor); + + // TODO : boris : add sound here ! + // Needs more explosions + }*/ + + // Update the contextual menu + { + H_AUTO_USE ( RZ_Client_Main_Loop_Interface ) + + // Update the game cursor. + ContextCur.check(); + GameContextMenu.update(); + + // validate dialogs + validateDialogs(GameContextMenu); + + // Display interface v3 + Driver->enableFog (false); + if (!Driver->isLost()) { - fromString(res[5], x); - fromString(res[6], y); - fromString(res[7], width); - fromString(res[8], height); - Driver->drawBitmap(x/(float)ClientCfg.Width, y/(float)ClientCfg.Height, width/(float)ClientCfg.Width, height/(float)ClientCfg.Height, *LogoBitmaps[i]); + if(ShowInterface) + pIMinstance->updateFrameViews (MainCam); + if(DebugUIView) + pIMinstance->displayUIViewBBoxs(DebugUIFilter); + if(DebugUICtrl) + pIMinstance->displayUICtrlBBoxs(DebugUIFilter); + if(DebugUIGroup) + pIMinstance->displayUIGroupBBoxs(DebugUIFilter); + } + + // special case in OpenGL : all scene has been display in render target, + // now, final texture is display with a quad + if (!ClientCfg.Light && ClientCfg.Bloom && Render && bloomStage == 2) + { + // End bloom effect system after drawing the 3d interface (z buffer related). + if (StereoDisplay) Driver->setViewport(NL3D::CViewport()); + CBloomEffect::instance().endInterfacesDisplayBloom(); + if (StereoDisplay) Driver->setViewport(StereoDisplay->getCurrentViewport()); + bloomStage = 0; + } + } + + { + H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) + if (!Driver->isLost()) + { + // If show information is Active. + if(ShowInfos == 1) + displayDebug(); + + // If show information is Active. + if(ShowInfos == 2) + displayNetDebug(); + + // If show information is Active. + if(ShowInfos == 4) + displayDebugFps(); + + // If show information is Active. + if(ShowInfos == 5) + displayDebugUIUnderMouse(); + + // If show information is Active. + displayStreamingDebug(); + + // If Show Help is active -> Display an help. + if(ShowHelp) + displayHelp(); + + // Yoyo: indicate profiling state + if( Profiling ) + displaySpecialTextProgress("Profiling"); + + // Display frame rate + + // Create a shadow when displaying a text. + TextContext->setShaded(true); + // Set the font size. + TextContext->setFontSize(10); + // Set the text color + TextContext->setColor(CRGBA(255,255,255)); + + // temporary values for conversions + float x, y, width, height; + + for(uint i = 0; i < ClientCfg.Logos.size(); i++) + { + std::vector res; + explode(ClientCfg.Logos[i],std::string(":"), res); + if(res.size()==9 && idrawBitmap(x/(float)ClientCfg.Width, y/(float)ClientCfg.Height, width/(float)ClientCfg.Width, height/(float)ClientCfg.Height, *LogoBitmaps[i]); + } + } } } @@ -2305,6 +1909,17 @@ bool mainLoop() } } + // R2ED post render update + if (ClientCfg.R2EDEnabled) + { + // IMPORTANT : this should be called after CEntitiesMngr::updatePostRender() because + // entity may be added / removed there ! + R2::getEditor().updateAfterRender(); + } + + // Update FXs (remove them). + FXMngr.update(); + // Detect disconnection / server down: display information text // but keep the rendering so that the player can remember where he is // and what he was doing. He can't move because the connection quality returns false. @@ -2318,211 +1933,216 @@ bool mainLoop() // from the EGS, resume the sequence because the EGS is down and won't reply. FarTP.onServerQuitOk(); } - } - } - // Yoyo: MovieShooter. - if(MovieShooterSaving) - { - H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) - - // Add the buffer frame to the movie. - if(!MovieShooter.addFrame(TimeInSec, Driver)) - { - // Fail to add the frame => abort. - endMovieShooting(); - } - else - { - // Ok, just add a display. - displaySpecialTextProgress("MovieShooting"); - } - } - - if (isRecordingCamera()) - { - displaySpecialTextProgress("CameraRecording"); - } - - // Temp for weather test - if (ClientCfg.ManualWeatherSetup && ContinentMngr.cur() && ContinentMngr.cur()->WeatherFunction) - { - H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) - static float displayHourDelta = 0.04f; // static for edition during debug.. - - // Display weather function - if (DisplayWeatherFunction) - { - uint64 currDay = RT.getRyzomDay(); - float currHour = DayNightCycleHour; - float singleHourDelta = fmodf(currHour, 1.f); - uint32 wndWidth, wndHeight; - Driver->getWindowSize(wndWidth, wndHeight); - Driver->setMatrixMode2D(CFrustum(0, 800, 600, 0, 0, 1, false)); - const float lineHeight = 100.f; - - // draw the weather function - for(uint x = 0; x < wndWidth; ++x) + // Yoyo: MovieShooter. + if(MovieShooterSaving) { - float weatherValue; - if(ContinentMngr.cur()) - weatherValue = ::getBlendedWeather(currDay, currHour, *WeatherFunctionParams, ContinentMngr.cur()->WeatherFunction); + H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) + + // Add the buffer frame to the movie. + if(!MovieShooter.addFrame(TimeInSec, Driver)) + { + // Fail to add the frame => abort. + endMovieShooting(); + } else - weatherValue = ::getBlendedWeather(currDay, currHour, *WeatherFunctionParams, 0); - - NLMISC::clamp(weatherValue, 0.f, 1.f); - CRGBA seasonToColor[EGSPD::CSeason::Invalid] = { - CRGBA::Green, - CRGBA::Yellow, - CRGBA::Red, - CRGBA::Blue - }; - Driver->drawLine((float) x, 0.f, (float) x, lineHeight * weatherValue, seasonToColor[CRyzomTime::getSeasonByDay((uint32)currDay)]); - currHour += displayHourDelta; - if (currHour >= 24.f) - { - ++currDay; - currHour -= 24.f; - } - singleHourDelta += displayHourDelta; - if (singleHourDelta >= 1.f) - { - singleHourDelta -= 1.f; - Driver->drawLine((float) x, 100.f, (float) x, 130, CRGBA::Red); + // Ok, just add a display. + displaySpecialTextProgress("MovieShooting"); } } - if(ContinentMngr.cur()) + if (isRecordingCamera()) { - // draw lines for current weather setups - uint numWeatherSetups = ContinentMngr.cur()->WeatherFunction[CurrSeason].getNumWeatherSetups(); - for (uint y = 0; y < numWeatherSetups; ++y) + displaySpecialTextProgress("CameraRecording"); + } + + // Temp for weather test + if (ClientCfg.ManualWeatherSetup && ContinentMngr.cur() && ContinentMngr.cur()->WeatherFunction) + { + H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) + static float displayHourDelta = 0.04f; // static for edition during debug.. + + // Display weather function + if (DisplayWeatherFunction) { - float py = lineHeight * (y / (float) numWeatherSetups); - Driver->drawLine(0.f, py, 800.f, py, CRGBA::Magenta); + uint64 currDay = RT.getRyzomDay(); + float currHour = DayNightCycleHour; + float singleHourDelta = fmodf(currHour, 1.f); + uint32 wndWidth, wndHeight; + Driver->getWindowSize(wndWidth, wndHeight); + Driver->setMatrixMode2D(CFrustum(0, 800, 600, 0, 0, 1, false)); + const float lineHeight = 100.f; + + // draw the weather function + for(uint x = 0; x < wndWidth; ++x) + { + float weatherValue; + if(ContinentMngr.cur()) + weatherValue = ::getBlendedWeather(currDay, currHour, *WeatherFunctionParams, ContinentMngr.cur()->WeatherFunction); + else + weatherValue = ::getBlendedWeather(currDay, currHour, *WeatherFunctionParams, 0); + + NLMISC::clamp(weatherValue, 0.f, 1.f); + CRGBA seasonToColor[EGSPD::CSeason::Invalid] = + { + CRGBA::Green, + CRGBA::Yellow, + CRGBA::Red, + CRGBA::Blue + }; + Driver->drawLine((float) x, 0.f, (float) x, lineHeight * weatherValue, seasonToColor[CRyzomTime::getSeasonByDay((uint32)currDay)]); + currHour += displayHourDelta; + if (currHour >= 24.f) + { + ++currDay; + currHour -= 24.f; + } + singleHourDelta += displayHourDelta; + if (singleHourDelta >= 1.f) + { + singleHourDelta -= 1.f; + Driver->drawLine((float) x, 100.f, (float) x, 130, CRGBA::Red); + } + } + + if(ContinentMngr.cur()) + { + // draw lines for current weather setups + uint numWeatherSetups = ContinentMngr.cur()->WeatherFunction[CurrSeason].getNumWeatherSetups(); + for (uint y = 0; y < numWeatherSetups; ++y) + { + float py = lineHeight * (y / (float) numWeatherSetups); + Driver->drawLine(0.f, py, 800.f, py, CRGBA::Magenta); + } + } + } + + // Ctrl+ & Ctrl- change the weather value + if (Actions.valide ("inc_time")) + { + ManualWeatherValue += DT * 0.04f; + } + if (Actions.valide ("dec_time")) + { + ManualWeatherValue -= DT * 0.04f; + } + NLMISC::clamp(ManualWeatherValue, 0.f, 1.f); + + if (ForcedDayNightCycleHour < 0) // if time is forced then can't change it manually ... + { + // Ctrl-K increase hour + if (Actions.valide ("inc_hour")) + { + RT.increaseTickOffset( (uint32)(2000 * displayHourDelta) ); + RT.updateRyzomClock(NetMngr.getCurrentServerTick(), ryzomGetLocalTime() * 0.001); + } + + // Ctrl-L decrease hour + if (Actions.valide ("dec_hour")) + { + RT.decreaseTickOffset( (uint32)(2000 * displayHourDelta) ); + RT.updateRyzomClock(NetMngr.getCurrentServerTick(), ryzomGetLocalTime() * 0.001); + CTimedFXManager::getInstance().setDate(CClientDate(RT.getRyzomDay(), (float) RT.getRyzomTime())); + if (IGCallbacks) + { + IGCallbacks->changeSeason(); // the season doesn't change, but this force fxs to be recreated + } + } + } + + // Ctrl-M generate statistics in a file + /* + if (Actions.valide ("weather_stats")) + { + // Only usable if there is a continent loaded. + if(ContinentMngr.cur()) + CPredictWeather::generateWeatherStats("weather_stats.csv", WeatherFunctionParams, ContinentMngr.cur()->WeatherFunction); + }*/ + + // Ctrl-B decrease display factor + if (Actions.valide ("dec_display_factor")) + { + displayHourDelta *= 0.90f; + } + // Ctrl-J increase display factor + if (Actions.valide ("inc_display_factor")) + { + displayHourDelta *= 1.1f; + displayHourDelta = std::min(1000.f, displayHourDelta); } } - } - // Ctrl+ & Ctrl- change the weather value - if (Actions.valide ("inc_time")) - { - ManualWeatherValue += DT * 0.04f; - } - if (Actions.valide ("dec_time")) - { - ManualWeatherValue -= DT * 0.04f; - } - NLMISC::clamp(ManualWeatherValue, 0.f, 1.f); - - if (ForcedDayNightCycleHour < 0) // if time is forced then can't change it manually ... - { - // Ctrl-K increase hour - if (Actions.valide ("inc_hour")) + // Ctrl-AltGR-Z show timed FXs + if (ShowTimedFX) { - RT.increaseTickOffset( (uint32)(2000 * displayHourDelta) ); - RT.updateRyzomClock(NetMngr.getCurrentServerTick(), ryzomGetLocalTime() * 0.001); - } - - // Ctrl-L decrease hour - if (Actions.valide ("dec_hour")) - { - RT.decreaseTickOffset( (uint32)(2000 * displayHourDelta) ); - RT.updateRyzomClock(NetMngr.getCurrentServerTick(), ryzomGetLocalTime() * 0.001); - CTimedFXManager::getInstance().setDate(CClientDate(RT.getRyzomDay(), (float) RT.getRyzomTime())); - if (IGCallbacks) + if (!Driver->isLost()) { - IGCallbacks->changeSeason(); // the season doesn't change, but this force fxs to be recreated + CTimedFXManager::getInstance().displayFXBoxes(ShowTimedFXMode); } } - } - // Ctrl-M generate statistics in a file - /* - if (Actions.valide ("weather_stats")) - { - // Only usable if there is a continent loaded. - if(ContinentMngr.cur()) - CPredictWeather::generateWeatherStats("weather_stats.csv", WeatherFunctionParams, ContinentMngr.cur()->WeatherFunction); - }*/ + #if !FINAL_VERSION + CVector2f camPos(Scene->getCam().getPos().x, Scene->getCam().getPos().y); + if (!ClientCfg.Light) + { + if (DisplayMicroLifeZones) + { + CMicroLifeManager::getInstance().renderMLZones(camPos); + } + } + if (DisplayWaterMap) + { + if (ContinentMngr.cur()) + { + ContinentMngr.cur()->WaterMap.render(camPos); + } + } + #endif - // Ctrl-B decrease display factor - if (Actions.valide ("dec_display_factor")) - { - displayHourDelta *= 0.90f; - } - // Ctrl-J increase display factor - if (Actions.valide ("inc_display_factor")) - { - displayHourDelta *= 1.1f; - displayHourDelta = std::min(1000.f, displayHourDelta); - } - } + #ifdef NL_DEBUG + if (!ClientCfg.Light) + { + if (DisplayMicroLifeActiveTiles) + { + CMicroLifeManager::getInstance().renderActiveTiles(); + } + } + #endif + // tmp : debug of ground fxs + //TestGroundFX.displayFXBoxes(); - // Ctrl-AltGR-Z show timed FXs - if (ShowTimedFX) - { - if (!Driver->isLost()) - { - CTimedFXManager::getInstance().displayFXBoxes(ShowTimedFXMode); - } - } - -#if !FINAL_VERSION - CVector2f camPos(Scene->getCam().getPos().x, Scene->getCam().getPos().y); - if (!ClientCfg.Light) - { - if (DisplayMicroLifeZones) + // Temp for sound debug { - CMicroLifeManager::getInstance().renderMLZones(camPos); - } - } - if (DisplayWaterMap) - { - if (ContinentMngr.cur()) - { - ContinentMngr.cur()->WaterMap.render(camPos); - } - } + H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) + + if (SoundMngr != 0) + { + static bool drawSound = false; + static float camHeigh = 150.0f; + + #if FINAL_VERSION + if (ClientCfg.ExtendedCommands) #endif + if (Actions.valide ("draw_sound")) + drawSound = !drawSound; - #ifdef NL_DEBUG - if (!ClientCfg.Light) - { - if (DisplayMicroLifeActiveTiles) - { - CMicroLifeManager::getInstance().renderActiveTiles(); + if (Actions.valide ("inc_camera_height")) + camHeigh -= 10.0f; + if (Actions.valide ("dec_camera_height")) + camHeigh += 10.0f; + + if (drawSound) + SoundMngr->drawSounds(camHeigh); + } } - } - #endif - // tmp : debug of ground fxs - //TestGroundFX.displayFXBoxes(); + } /* if (!StereoDisplay || StereoDisplay->wantInterface2D()) */ - // Temp for sound debug - { - H_AUTO_USE ( RZ_Client_Main_Loop_Debug ) - - if (SoundMngr != 0) + if (StereoDisplay) { - static bool drawSound = false; - static float camHeigh = 150.0f; - -#if FINAL_VERSION - if (ClientCfg.ExtendedCommands) -#endif - if (Actions.valide ("draw_sound")) - drawSound = !drawSound; - - if (Actions.valide ("inc_camera_height")) - camHeigh -= 10.0f; - if (Actions.valide ("dec_camera_height")) - camHeigh += 10.0f; - - if (drawSound) - SoundMngr->drawSounds(camHeigh); + StereoDisplay->endRenderTarget(); } - } + } /* stereo pass */ // Draw to screen. static CQuat MainCamOri; @@ -2581,169 +2201,11 @@ bool mainLoop() // TMP TMP static volatile bool dumpValidPolys = false; - if (dumpValidPolys) - { - struct CPolyDisp : public CInterfaceElementVisitor - { - virtual void visitCtrl(CCtrlBase *ctrl) - { - CCtrlPolygon *cp = dynamic_cast(ctrl); - if (cp) - { - sint32 cornerX, cornerY; - cp->getParent()->getCorner(cornerX, cornerY, cp->getParentPosRef()); - for(sint32 y = 0; y < (sint32) Screen.getHeight(); ++y) - { - for(sint32 x = 0; x < (sint32) Screen.getWidth(); ++x) - { - if (cp->contains(CVector2f((float) (x - cornerX), (float) (y - cornerY)))) - { - ((CRGBA *) &Screen.getPixels()[0])[x + (Screen.getHeight() - 1 - y) * Screen.getWidth()] = CRGBA::Magenta; - } - } - } - } - } - CBitmap Screen; - } polyDisp; - Driver->getBuffer(polyDisp.Screen); - CInterfaceManager::getInstance()->visit(&polyDisp); - COFile output("poly.tga"); - polyDisp.Screen.writeTGA(output); - dumpValidPolys = false; - }; + if (dumpValidPolys) { tempDumpValidPolys(); dumpValidPolys = false; } // TMP TMP static volatile bool dumpColPolys = false; - if (dumpColPolys) - { - CPackedWorld *pw = R2::getEditor().getIslandCollision().getPackedIsland(); - if (pw) - { - static CMaterial material; - static CMaterial wiredMaterial; - static CMaterial texturedMaterial; - static CVertexBuffer vb; - static bool initDone = false; - if (!initDone) - { - vb.setVertexFormat(CVertexBuffer::PositionFlag); - vb.setPreferredMemory(CVertexBuffer::AGPVolatile, false); - material.initUnlit(); - material.setDoubleSided(true); - material.setZFunc(CMaterial::lessequal); - wiredMaterial.initUnlit(); - wiredMaterial.setDoubleSided(true); - wiredMaterial.setZFunc(CMaterial::lessequal); - wiredMaterial.setColor(CRGBA(255, 255, 255, 250)); - wiredMaterial.texEnvOpAlpha(0, CMaterial::Replace); - wiredMaterial.texEnvArg0Alpha(0, CMaterial::Diffuse, CMaterial::SrcAlpha); - wiredMaterial.setBlend(true); - wiredMaterial.setBlendFunc(CMaterial::srcalpha, CMaterial::invsrcalpha); - texturedMaterial.initUnlit(); - texturedMaterial.setDoubleSided(true); - texturedMaterial.setZFunc(CMaterial::lessequal); - initDone = true; - } - // just add a projected texture - R2::getEditor().getIslandCollision().loadEntryPoints(); - R2::CScenarioEntryPoints &sep = R2::CScenarioEntryPoints::getInstance(); - CVectorD playerPos = UserEntity->pos(); - R2::CScenarioEntryPoints::CCompleteIsland *island = sep.getCompleteIslandFromCoords(CVector2f((float) playerPos.x, (float) playerPos.y)); - static CSString currIsland; - if (island && island->Island != currIsland) - { - currIsland = island->Island; - CTextureFile *newTex = new CTextureFile(currIsland + "_sp.tga"); - newTex->setWrapS(ITexture::Clamp); - newTex->setWrapT(ITexture::Clamp); - texturedMaterial.setTexture(0, newTex); - texturedMaterial.texEnvOpRGB(0, CMaterial::Replace); - texturedMaterial.texEnvArg0RGB(0, CMaterial::Texture, CMaterial::SrcColor); - texturedMaterial.setTexCoordGen(0, true); - texturedMaterial.setTexCoordGenMode(0, CMaterial::TexCoordGenObjectSpace); - CMatrix mat; - CVector scale((float) (island->XMax - island->XMin), - (float) (island->YMax - island->YMin), 0.f); - scale.x = 1.f / favoid0(scale.x); - scale.y = 1.f / favoid0(scale.y); - scale.z = 0.f; - mat.setScale(scale); - mat.setPos(CVector(- island->XMin * scale.x, - island->YMin * scale.y, 0.f)); - // - CMatrix uvScaleMat; - // - uint texWidth = (uint) (island->XMax - island->XMin); - uint texHeight = (uint) (island->YMax - island->YMin); - float UScale = (float) texWidth / raiseToNextPowerOf2(texWidth); - float VScale = (float) texHeight / raiseToNextPowerOf2(texHeight); - // - uvScaleMat.setScale(CVector(UScale, - VScale, 0.f)); - uvScaleMat.setPos(CVector(0.f, VScale, 0.f)); - // - texturedMaterial.enableUserTexMat(0, true); - texturedMaterial.setUserTexMat(0, uvScaleMat * mat); - } - const CFrustum &frust = MainCam.getFrustum(); - - // - IDriver *driver = ((CDriverUser *) Driver)->getDriver(); - - driver->enableFog(true); - const CRGBA clearColor = CRGBA(0, 0, 127, 0); - driver->setupFog(frust.Far * 0.8f, frust.Far, clearColor); - CViewport vp; - vp.init(0.f, 0.f, 1.f, 1.f); - driver->setupViewport(vp); - CScissor scissor; - viewportToScissor(vp, scissor); - driver->setupScissor(scissor); - // - driver->setFrustum(frust.Left, frust.Right, frust.Bottom, frust.Top, frust.Near, frust.Far, frust.Perspective); - driver->setupViewMatrix(MainCam.getMatrix().inverted()); - driver->setupModelMatrix(CMatrix::Identity); - // - // - const CVector localFrustCorners[8] = - { - CVector(frust.Left, frust.Near, frust.Top), - CVector(frust.Right, frust.Near, frust.Top), - CVector(frust.Right, frust.Near, frust.Bottom), - CVector(frust.Left, frust.Near, frust.Bottom), - CVector(frust.Left * frust.Far / frust.Near, frust.Far, frust.Top * frust.Far / frust.Near), - CVector(frust.Right * frust.Far / frust.Near, frust.Far, frust.Top * frust.Far / frust.Near), - CVector(frust.Right * frust.Far / frust.Near, frust.Far, frust.Bottom * frust.Far / frust.Near), - CVector(frust.Left * frust.Far / frust.Near, frust.Far, frust.Bottom * frust.Far / frust.Near) - }; - // roughly compute covered zones - // - /* - sint frustZoneMinX = INT_MAX; - sint frustZoneMaxX = INT_MIN; - sint frustZoneMinY = INT_MAX; - sint frustZoneMaxY = INT_MIN; - for(uint k = 0; k < sizeofarray(localFrustCorners); ++k) - { - CVector corner = camMat * localFrustCorners[k]; - sint zoneX = (sint) (corner.x / 160.f) - zoneMinX; - sint zoneY = (sint) floorf(corner.y / 160.f) - zoneMinY; - frustZoneMinX = std::min(frustZoneMinX, zoneX); - frustZoneMinY = std::min(frustZoneMinY, zoneY); - frustZoneMaxX = std::max(frustZoneMaxX, zoneX); - frustZoneMaxY = std::max(frustZoneMaxY, zoneY); - } - */ - - const uint TRI_BATCH_SIZE = 10000; // batch size for rendering - static std::vector zones; - zones.clear(); - pw->getZones(zones); - for(uint k = 0; k < zones.size(); ++k) - { - zones[k]->render(vb, *driver, texturedMaterial, wiredMaterial, MainCam.getMatrix(), TRI_BATCH_SIZE, localFrustCorners); - } - } - } + if (dumpColPolys) { tempDumpColPolys(); } if (ClientCfg.R2EDEnabled) { @@ -2898,6 +2360,9 @@ bool mainLoop() frameToSkip--; } + /////////////// + // FAR_TP -> // + /////////////// // Enter a network loop during the FarTP process, without doing the whole real main loop. // This code must remain at the very end of the main loop. if(LoginSM.getCurrentState() == CLoginStateMachine::st_enter_far_tp_main_loop) @@ -2981,7 +2446,10 @@ bool mainLoop() connectionState = NetMngr.getConnectionState(); CLuaManager::getInstance().executeLuaScript("game:onFarTpEnd()"); - } + } + /////////////// + // <- FAR_TP // + /////////////// } // end of main loop @@ -3049,690 +2517,6 @@ bool mainLoop() return ryzom_exit || (Driver == NULL) || (!Driver->isActive ()); }// mainLoop // -//--------------------------------------------------- -// displayDebug : -// Display some debug infos. -//--------------------------------------------------- -void displayDebugFps() -{ - float lineStep = ClientCfg.DebugLineStep; - float line; - - // Initialize Pen // - //----------------// - // Create a shadow when displaying a text. - TextContext->setShaded(true); - // Set the font size. - TextContext->setFontSize(ClientCfg.DebugFontSize); - // Set the text color - TextContext->setColor(ClientCfg.DebugFontColor); - - // TOP LEFT // - //----------// - TextContext->setHotSpot(UTextContext::TopLeft); - line = 0.9f; - // Ms per frame - { - float spf = smoothFPS.getSmoothValue (); - // Ms per frame - TextContext->printfAt(0.1f, line, "FPS %.1f ms - %.1f fps", spf*1000, 1.f/spf); - line-= lineStep; - // More Smoothed Ms per frame - spf = moreSmoothFPS.getSmoothValue (); - TextContext->printfAt(0.1f, line, "Smoothed FPS %.1f ms - %.1f fps", spf*1000, 1.f/spf); - line-= lineStep; - } -} - -static NLMISC::CRefPtr HighlightedDebugUI; - -// displayDebug : -// Display information about ui elements that are under the mouse -//--------------------------------------------------- -void displayDebugUIUnderMouse() -{ - float lineStep = ClientCfg.DebugLineStep; - float line; - - // Initialize Pen // - //----------------// - // Create a shadow when displaying a text. - TextContext->setShaded(true); - // Set the font size. - TextContext->setFontSize(ClientCfg.DebugFontSize); - - - - // TOP LEFT // - //----------// - TextContext->setHotSpot(UTextContext::TopLeft); - line = 0.9f; - - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - // for now only accessible with R2ED - if (ClientCfg.R2EDEnabled) - { - TextContext->setColor(CRGBA::Cyan); - TextContext->printfAt(0.1f, line, "Press default key (ctrl+shift+A) to cycle prev"); - line-= lineStep; - TextContext->printfAt(0.1f, line, "Press default key (ctrl+shift+Q) to cycle next"); - line-= lineStep; - TextContext->printfAt(0.1f, line, "Press default key (ctrl+shift+W) to inspect element"); - line-= 2 * lineStep; - } - // - const vector &rICL = CWidgetManager::getInstance()->getCtrlsUnderPointer (); - const vector &rIGL = CWidgetManager::getInstance()->getGroupsUnderPointer (); - // If previous highlighted element is found in the list, then keep it, else reset to first element - if (std::find(rICL.begin(), rICL.end(), HighlightedDebugUI) == rICL.end() && - std::find(rIGL.begin(), rIGL.end(), HighlightedDebugUI) == rIGL.end()) - { - if (!rICL.empty()) - { - HighlightedDebugUI = rICL[0]; - } - else - if (!rIGL.empty()) - { - HighlightedDebugUI = rIGL[0]; - } - else - { - HighlightedDebugUI = NULL; - } - } - // - TextContext->setColor(CRGBA::Green); - TextContext->printfAt(0.1f, line, "Controls under cursor "); - line -= lineStep * 1.4f; - TextContext->printfAt(0.1f, line, "----------------------"); - line -= lineStep; - for(uint k = 0; k < rICL.size(); ++k) - { - if (rICL[k]) - { - TextContext->setColor(rICL[k] != HighlightedDebugUI ? ClientCfg.DebugFontColor : CRGBA::Red); - TextContext->printfAt(0.1f, line, "id = %s, address = 0x%p, parent = 0x%p", rICL[k]->getId().c_str(), rICL[k], rICL[k]->getParent()); - } - else - { - TextContext->setColor(CRGBA::Blue); - TextContext->printfAt(0.1f, line, " control found !!!"); - } - line-= lineStep; - } - // - TextContext->setColor(CRGBA::Green); - TextContext->printfAt(0.1f, line, "Groups under cursor "); - line -= lineStep * 1.4f; - TextContext->printfAt(0.1f, line, "----------------------"); - line-= lineStep; - for(uint k = 0; k < rIGL.size(); ++k) - { - if (rIGL[k]) - { - TextContext->setColor(rIGL[k] != HighlightedDebugUI ? ClientCfg.DebugFontColor : CRGBA::Red); - TextContext->printfAt(0.1f, line, "id = %s, address = 0x%p, parent = 0x%p", rIGL[k]->getId().c_str(), rIGL[k], rIGL[k]->getParent()); - } - else - { - TextContext->setColor(CRGBA::Blue); - TextContext->printfAt(0.1f, line, " group found !!!"); - } - line-= lineStep; - } -} - - - -// get all element under the mouse in a single vector -static void getElementsUnderMouse(vector &ielem) -{ - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - const vector &rICL = CWidgetManager::getInstance()->getCtrlsUnderPointer(); - const vector &rIGL = CWidgetManager::getInstance()->getGroupsUnderPointer(); - ielem.clear(); - ielem.insert(ielem.end(), rICL.begin(), rICL.end()); - ielem.insert(ielem.end(), rIGL.begin(), rIGL.end()); -} - -class CHandlerDebugUiPrevElementUnderMouse : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) - { - vector ielem; - getElementsUnderMouse(ielem); - for(uint k = 0; k < ielem.size(); ++k) - { - if (HighlightedDebugUI == ielem[k]) - { - HighlightedDebugUI = ielem[k == 0 ? ielem.size() - 1 : k - 1]; - return; - } - } - } -}; -REGISTER_ACTION_HANDLER( CHandlerDebugUiPrevElementUnderMouse, "debug_ui_prev_element_under_mouse"); - -class CHandlerDebugUiNextElementUnderMouse : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) - { - vector ielem; - getElementsUnderMouse(ielem); - for(uint k = 0; k < ielem.size(); ++k) - { - if (HighlightedDebugUI == ielem[k]) - { - HighlightedDebugUI = ielem[(k + 1) % ielem.size()]; - return; - } - } - } -}; -REGISTER_ACTION_HANDLER( CHandlerDebugUiNextElementUnderMouse, "debug_ui_next_element_under_mouse"); - -class CHandlerDebugUiDumpElementUnderMouse : public IActionHandler -{ - virtual void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) - { - if (HighlightedDebugUI == NULL) return; - CLuaState *lua = CLuaManager::getInstance().getLuaState(); - if (!lua) return; - CLuaStackRestorer lsr(lua, 0); - CLuaIHM::pushUIOnStack(*lua, HighlightedDebugUI); - lua->pushGlobalTable(); - CLuaObject env(*lua); - env["inspect"].callNoThrow(1, 0); - } -}; -REGISTER_ACTION_HANDLER( CHandlerDebugUiDumpElementUnderMouse, "debug_ui_inspect_element_under_mouse"); - - -//--------------------------------------------------- -// displayDebug : -// Display some debug infos. -//--------------------------------------------------- -void displayDebug() -{ - float lineStep = ClientCfg.DebugLineStep; - float line; - - // Initialize Pen // - //----------------// - // Create a shadow when displaying a text. - TextContext->setShaded(true); - // Set the font size. - TextContext->setFontSize(ClientCfg.DebugFontSize); - // Set the text color - TextContext->setColor(ClientCfg.DebugFontColor); - - // TOP LEFT // - //----------// - TextContext->setHotSpot(UTextContext::TopLeft); - line = 0.9f; - // FPS and Ms per frame - { - // smooth across frames. - double deltaTime = smoothFPS.getSmoothValue (); - // FPS and Ms per frame - if(deltaTime != 0.f) - TextContext->printfAt(0.f, line,"%.1f fps", 1.f/deltaTime); - else - TextContext->printfAt(0.f, line,"%.1f fps", 0.f); - TextContext->printfAt(0.1f, line, "%d ms", (uint)(deltaTime*1000)); - } - line -= lineStep; - line -= lineStep; - - // USER - // Front - TextContext->printfAt(0.0f, line, " %f (%f,%f,%f) front", atan2(UserEntity->front().y, UserEntity->front().x), UserEntity->front().x, UserEntity->front().y, UserEntity->front().z); - line -= lineStep; - // Dir - TextContext->printfAt(0.0f, line, " %f (%f,%f,%f) dir", atan2(UserEntity->dir().y, UserEntity->dir().x), UserEntity->dir().x, UserEntity->dir().y, UserEntity->dir().z); - line -= lineStep; - // NB Stage - TextContext->printfAt(0.0f, line, " NB Stage: %d", UserEntity->nbStage()); - line -= lineStep; - // NB Animation FXs still remaining in the remove list. - TextContext->printfAt(0.0f, line, " NB FXs to remove: %d", UserEntity->nbAnimFXToRemove()); - line -= lineStep; - // Mode. - TextContext->printfAt(0.0f, line, " Mode: %d (%s)", (sint)UserEntity->mode(), MBEHAV::modeToString(UserEntity->mode()).c_str()); - line -= lineStep; - // Behaviour. - TextContext->printfAt(0.0f, line, " Behaviour: %d (%s)", (sint)UserEntity->behaviour(), MBEHAV::behaviourToString(UserEntity->behaviour()).c_str()); - line -= lineStep; - // Display the target mount. - TextContext->printfAt(0.0f, line, " Mount: %d", UserEntity->mount()); - line -= lineStep; - // Display the target rider. - TextContext->printfAt(0.0f, line, " Rider: %d", UserEntity->rider()); - line -= lineStep; - // Display the current animation name. - TextContext->printfAt(0.0f, line, " Current Animation Name: %s", UserEntity->currentAnimationName().c_str()); - line -= lineStep; - // Display the current move animation set name. - TextContext->printfAt(0.0f, line, " Current AnimationSet Name (MOVE): %s", UserEntity->currentAnimationSetName(MOVE).c_str()); - line -= lineStep; - // Display Missing Animations - if(::CAnimation::MissingAnim.empty() == false) - { - TextContext->printfAt(0.0f, line, " '%u' Missing Animations, 1st: '%s'", ::CAnimation::MissingAnim.size(), (*(::CAnimation::MissingAnim.begin())).c_str()); - line -= lineStep; - } - // Display Missing LoD - if(LodCharactersNotFound.empty() == false) - { - TextContext->printfAt(0.0f, line, " '%u' Missing LoD, 1st: '%s'", LodCharactersNotFound.size(), (*(LodCharactersNotFound.begin())).c_str()); - line -= lineStep; - } - - // Watched Entity - line -= lineStep; - // Now Displaying the selection. - TextContext->printfAt(0.0f, line, "--*** Watched entity ***--"); - line -= lineStep; - // Display information about the debug entity slot. - if(WatchedEntitySlot != CLFECOMMON::INVALID_SLOT) - { - // Get a pointer on the target. - CEntityCL *watchedEntity = EntitiesMngr.entity(WatchedEntitySlot); - if(watchedEntity) - { - // Display Debug Information about the Selection. - watchedEntity->displayDebug(0.0f, line, -lineStep); - - // Distance of the target - CVectorD diffvector = UserEntity->pos() - watchedEntity->pos(); - TextContext->printfAt(0.0f, line, " Distance: %10.2f (Manhattan: %.2f)", diffvector.norm(), fabs(diffvector.x) + fabs(diffvector.y) ); - line -= lineStep; - } - // Target not allocated - else - { - TextContext->printfAt(0.0f, line, "Not allocated (%d)", WatchedEntitySlot); - line -= lineStep; - } - } - // No Target - else - { - TextContext->printfAt(0.0f, line, "None"); - line -= lineStep; - } - - /* Ca rame grave ! - - uint nMem = NLMEMORY::GetAllocatedMemory(); - line -= lineStep; - TextContext->printfAt(0.0f, line, "Mem Used: %d",nMem);*/ - - // 3D Filters information: -#ifdef _PROFILE_ON_ - line-= lineStep; - TextContext->printfAt(0.0f, line, "3D Filters:"); - line-= lineStep; - TextContext->printfAt(0.0f, line, "MeshNoVP: %s", Filter3D[FilterMeshNoVP]?"Ok":"NOT RENDERED!"); - line-= lineStep; - TextContext->printfAt(0.0f, line, "MeshVP: %s", Filter3D[FilterMeshVP]?"Ok":"NOT RENDERED!"); - line-= lineStep; - TextContext->printfAt(0.0f, line, "FXs: %s", Filter3D[FilterFXs]?"Ok":"NOT RENDERED!"); - line-= lineStep; - if (Landscape) - { - TextContext->printfAt(0.0f, line, "Landscape: %s", Filter3D[FilterLandscape]?"Ok":"NOT RENDERED!"); - line-= lineStep; - } - else - { - TextContext->printfAt(0.0f, line, "Landscape not enabled"); - } - TextContext->printfAt(0.0f, line, "Vegetable: %s", Filter3D[FilterVegetable]?"Ok":"NOT RENDERED!"); - line-= lineStep; - TextContext->printfAt(0.0f, line, "Skeleton: %s", Filter3D[FilterSkeleton]?"Ok":"NOT RENDERED!"); - line-= lineStep; - TextContext->printfAt(0.0f, line, "Water: %s", Filter3D[FilterWater]?"Ok":"NOT RENDERED!"); - line-= lineStep; - TextContext->printfAt(0.0f, line, "Cloud: %s", Filter3D[FilterCloud]?"Ok":"NOT RENDERED!"); - line-= lineStep; - TextContext->printfAt(0.0f, line, "CoarseMesh: %s", Filter3D[FilterCoarseMesh]?"Ok":"NOT RENDERED!"); - line-= lineStep; - TextContext->printfAt(0.0f, line, "Sky: %s", Filter3D[FilterSky]?"Ok":"NOT RENDERED!"); - line-= lineStep; - // Materials Infos - TextContext->printfAt(0.0f, line, "SetupedMatrix: %d", Driver->profileSetupedModelMatrix() ); - line-= lineStep; - TextContext->printfAt(0.0f, line, "SetupedMaterials: %d", Driver->profileSetupedMaterials() ); - line-= lineStep; - // Display camera cluster system - TextContext->printfAt(0.0f, line, "ClusterSystem: %p", MainCam.getClusterSystem() ); - line-= 2 * lineStep; - // Lua stuffs - CInterfaceManager *pIM = CInterfaceManager::getInstance(); - TextContext->printfAt(0.0f, line, "Lua mem (kb) : %d / %d", CLuaManager::getInstance().getLuaState()->getGCCount(), CLuaManager::getInstance().getLuaState()->getGCThreshold()); - line-= lineStep; - TextContext->printfAt(0.0f, line, "Lua stack size = %d", CLuaManager::getInstance().getLuaState()->getTop()); - line-= lineStep; - -#endif - - // TOP LEFT // - //-----------// - TextContext->setHotSpot(UTextContext::TopLeft); - line = 1.f; - string str; -#if FINAL_VERSION - str = "FV"; -#else - str = "DEV"; -#endif - if(ClientCfg.ExtendedCommands) - str += "_E"; - str += " "RYZOM_VERSION; - TextContext->printfAt(0.f, line, "Version %s", str.c_str()); - - // TOP MIDDLE // - //------------// - TextContext->setHotSpot(UTextContext::MiddleTop); - line = 1.f; - // Motion Mode - TextContext->printfAt(0.5f, line, "%s", UserControls.modeStr().c_str()); - line -= lineStep; - - // TOP RIGHT // - //-----------// - TextContext->setHotSpot(UTextContext::TopRight); - line = 1.f; - //// 3D Infos - // Video mem allocated. - TextContext->printfAt(1.f, line, "Video mem. : %f", Driver->profileAllocatedTextureMemory()/(1024.f*1024.f)); - line -= lineStep; - // Video mem used since last swapBuffers(). - TextContext->printfAt(1.f, line, "Video mem. since last swap buffer: %f", Driver->getUsedTextureMemory()/(1024.f*1024.f)); - line -= lineStep; - // Get the last face count asked from the main scene before reduction. - TextContext->printfAt(1.f, line, "Nb Skin Face Asked: %f", Scene->getGroupNbFaceAsked("Skin")); - line -= lineStep; - TextContext->printfAt(1.f, line, "Nb Fx Face Asked: %f", Scene->getGroupNbFaceAsked("Fx")); - line -= lineStep; - // All Triangles In - CPrimitiveProfile pIn; - CPrimitiveProfile pOut; - Driver->profileRenderedPrimitives(pIn, pOut); - TextContext->printfAt(1.f, line, "Tri In : %d", pIn.NTriangles+2*pIn.NQuads); - line -= lineStep; - // All Triangles Out - TextContext->printfAt(1.f, line, "Tri Out : %d", pOut.NTriangles+2*pIn.NQuads); - line -= lineStep; - // Current Cluster - string strPos; - // Check there is a PACS Primitive before using it. - if(UserEntity->getPrimitive() && GR) - { - UGlobalPosition gPos; - UserEntity->getPrimitive()->getGlobalPosition(gPos, dynamicWI); - string strPos = GR->getIdentifier(gPos); - } - else - strPos = "No Primitive"; - TextContext->printfAt(1.f, line, "Cluster : %s", strPos.c_str()); - line -= lineStep; - //// SOUND Infos - line -= lineStep; - if(SoundMngr) - { - TextContext->printfAt(1.f, line, "Sound source instance: %u", SoundMngr->getSourcesInstanceCount()); - line -= lineStep; - TextContext->printfAt(1.f, line, "Logical playing SoundSource: %u", SoundMngr->getMixer()->getPlayingSourcesCount ()); - line -= lineStep; - TextContext->printfAt(1.f, line, "Audio tracks: %u/%u", SoundMngr->getMixer()->getUsedTracksCount(), SoundMngr->getMixer()->getPolyphony()); - line -= lineStep; - if (SoundMngr->getMixer()->getMutedPlayingSourcesCount() > 0) - { - TextContext->printfAt(1.f, line, "Source muted: %u !", SoundMngr->getMixer()->getMutedPlayingSourcesCount()); - line -= lineStep; - } - TextContext->printfAt(1.f, line, "Samples in memory: %g MB", SoundMngr->getLoadingSamplesSize() / (1024.0f*1024.0f)); - line -= lineStep; - - } - - // BOTTOM RIGHT // - //--------------// - TextContext->setHotSpot(UTextContext::BottomRight); - line = 0.f; - //// POSITION - CVector postmp = View.viewPos(); - // Pos - TextContext->printfAt(1.f, line, "Position : %d %d %d",(int)postmp.x,(int)postmp.y,(int)postmp.z); - line += lineStep; - // Body Heading - TextContext->printfAt(1.f, line, "Front : %.2f %.2f %.2f", UserEntity->front().x, UserEntity->front().y, UserEntity->front().z); - line += lineStep; - // Speed - TextContext->printfAt(1.f, line, "Speed : %.2f", (float) UserEntity->speed()); - line += lineStep; - // Zone - if (!ClientCfg.Light) - { - if (Landscape) - { - TextContext->printfAt(1.f, line, "Zone: %s", Landscape->getZoneName(postmp).c_str()); - line += lineStep; - } - } - // Prim File - string primFile = PrimFiles.getCurrentPrimitive (); - if (!primFile.empty ()) - { - TextContext->printfAt(1.f, line, "Prim File: %s", primFile.c_str ()); - line += lineStep; - } - - //// CONNECTION - line += lineStep; - // Ryzom Day. - TextContext->printfAt(1.f, line, "Ryzom Day : %d", RT.getRyzomDay()); - line += lineStep; - // hour in the game - float dayNightCycleHour = (float)RT.getRyzomTime(); - TextContext->printfAt(1.f, line, "Ryzom Time : %2u:%02u", int(dayNightCycleHour), int((dayNightCycleHour-int(dayNightCycleHour))*60.0f)); - line += lineStep; - // light hour in the game, used to display te day/night - TextContext->printfAt(1.f, line, "Ryzom Light Time : %2u:%02u (%s)", int(DayNightCycleHour), int((DayNightCycleHour-int(DayNightCycleHour))*60.0f), LightCycleManager.getStateString().c_str()); - line += lineStep; - // Server GameCycle - TextContext->printfAt(1.f, line, "Server GameCycle : %u", (uint)NetMngr.getCurrentServerTick()); - line += lineStep; - // Current GameCycle - TextContext->printfAt(1.f, line, "Current GameCycle : %u", (uint)NetMngr.getCurrentClientTick()); - line += lineStep; - // Current GameCycle - TextContext->printfAt(1.f, line, "Ms per Cycle : %d", NetMngr.getMsPerTick()); - line += lineStep; - // Packet Loss - TextContext->printfAt(1.f, line, "Packet Loss : %.1f %%", NetMngr.getMeanPacketLoss()*100.0f); - line += lineStep; - // Packet Loss - TextContext->printfAt(1.f, line, "Packets Lost : %u", NetMngr.getTotalLostPackets()); - line += lineStep; - // Mean Upload - TextContext->printfAt(1.f, line, "Mean Upld : %.3f kbps", NetMngr.getMeanUpload()); - line += lineStep; - // Mean Download - TextContext->printfAt(1.f, line, "Mean Dnld : %.3f kbps", NetMngr.getMeanDownload()); - line += lineStep; - - // Mean Download - TextContext->printfAt(1.f, line, "Nb in Vision : %d(%d,%d,%d)", - EntitiesMngr.nbEntitiesAllocated(), - EntitiesMngr.nbUser(), - EntitiesMngr.nbPlayer(), - EntitiesMngr.nbChar()); - line += lineStep; - - // Number of database changes - TextContext->printfAt(1.f, line, "DB Changes : %u", NbDatabaseChanges ); - line += lineStep; - - // Ping - TextContext->printfAt(1.f, line, "DB Ping : %u ms", Ping.getValue()); - line += lineStep; - - - - - - // Manual weather setup - { - if(ContinentMngr.cur()) // Only usable if there is a continent loaded. - { - if (!ForceTrueWeatherValue) - { - const CWeatherFunction &wf = ContinentMngr.cur()->WeatherFunction[CurrSeason]; - float wv; - if (ClientCfg.ManualWeatherSetup) - { - wv = std::max(wf.getNumWeatherSetups() - 1, 0u) * ManualWeatherValue; - } - else - { - wv = std::max(wf.getNumWeatherSetups() - 1, 0u) * ::getBlendedWeather(RT.getRyzomDay(), RT.getRyzomTime(), *WeatherFunctionParams, ContinentMngr.cur()->WeatherFunction); - } - const CWeatherSetup *ws = wf.getWeatherSetup((uint) floorf(wv)); - std::string name0 = ws ? NLMISC::CStringMapper::unmap(ws->SetupName) : "???"; - ws = wf.getWeatherSetup(std::min((uint) (floorf(wv) + 1), wf.getNumWeatherSetups() - 1)); - std::string name1 = ws ? NLMISC::CStringMapper::unmap(ws->SetupName) : "???"; - TextContext->printfAt(1.f, line, "Weather value : %.02f : %s -> %s", ws ? wv : 0.f, name0.c_str(), name1.c_str()); - line += lineStep; - } - else - { - TextContext->printfAt(1.f, line, "Weather value : %.02f", WeatherManager.getWeatherValue() * std::max(ContinentMngr.cur()->WeatherFunction[CurrSeason].getNumWeatherSetups() - 1, 0u)); - line += lineStep; - TextContext->printfAt(1.f, line, "TEST WEATHER FUNCTION"); - line += lineStep; - } - // season - TextContext->printfAt(1.f, line, "Season : %s", EGSPD::CSeason::toString(CurrSeason).c_str()); - line += lineStep; - } - } - - // fog dist - if (ContinentMngr.cur()) - { - TextContext->printfAt(1.f, line, "Continent fog min near = %.1f, max far = %.1f", ContinentMngr.cur()->FogStart, ContinentMngr.cur()->FogEnd); - line += lineStep; - CFogState tmpFog; - ContinentMngr.getFogState(MainFog, LightCycleManager.getLightLevel(), LightCycleManager.getLightDesc().DuskRatio, LightCycleManager.getState(), View.viewPos(), tmpFog); - TextContext->printfAt(1.f, line, "Continent fog curr near = %.1f, curr far = %.1f", tmpFog.FogStartDist, tmpFog.FogEndDist); - line += lineStep; - } - const CWeatherState &ws = WeatherManager.getCurrWeatherState(); - TextContext->printfAt(1.f, line, "Weather fog near = %.1f, far = %.1f", ws.FogNear[MainFog], ws.FogFar[MainFog]); - line += lineStep; - TextContext->printfAt(1.f, line, "Final fog near = %.1f, far = %.1f", MainFogState.FogStartDist, MainFogState.FogEndDist); - line += lineStep; - float left, right, bottom, top, znear, zfar; - Scene->getCam().getFrustum(left, right, bottom, top, znear, zfar); - TextContext->printfAt(1.f, line, "Clip near = %.1f, far = %.1f", znear, zfar); - line += lineStep; - - // Connection states - TextContext->printfAt(1.f, line, "State : %s", NetMngr.getConnectionStateCStr() ); - line += lineStep; - -// UGlobalPosition globalPos; -// UserEntity->getPrimitive()->getGlobalPosition(globalPos, dynamicWI); -// uint32 material = GR->getMaterial( globalPos ); -// TextContext->printfAt(0.5f,0.5f,"Material : %d Gpos=(inst=%d,surf=%d,x=%.2f,y=%.2f",material, globalPos.InstanceId, globalPos.LocalPosition.Surface, globalPos.LocalPosition.Estimation.x, globalPos.LocalPosition.Estimation.y); - - // No more shadow when displaying a text. - TextContext->setShaded(false); -}// displayDebug // - -//----------------------------------------------- -// Macro to Display a Text -//----------------------------------------------- -#define DISP_TEXT(x, text) \ - /* Display the text at the right place */ \ - TextContext->printfAt(x, line, text); \ - /* Change the line */ \ - line += lineStep; \ - -//--------------------------------------------------- -// displayHelp : -// Display an Help. -//--------------------------------------------------- -void displayHelp() -{ - float line = 1.f; - float lineStep = -ClientCfg.HelpLineStep; - - // Create a shadow when displaying a text. - TextContext->setShaded(true); - // Set the font size. - TextContext->setFontSize(ClientCfg.HelpFontSize); - // Set the text color - TextContext->setColor(ClientCfg.HelpFontColor); - - - line = 1.f; - TextContext->setHotSpot(UTextContext::TopLeft); - DISP_TEXT(0.0f, "SHIFT + F1 : This Menu") - DISP_TEXT(0.0f, "SHIFT + F2 : Display Debug Infos") - DISP_TEXT(0.0f, "SHIFT + F3 : Wire mode"); - DISP_TEXT(0.0f, "SHIFT + F4 : Do not Render the Scene"); - DISP_TEXT(0.0f, "SHIFT + F5 : Toogle Display OSD interfaces"); -// DISP_TEXT(0.0f, "SHIFT + F6 : Not used"); - DISP_TEXT(0.0f, "SHIFT + F7 : Compass Mode (User/Camera)"); - DISP_TEXT(0.0f, "SHIFT + F8 : Camera Mode (INSERT to change your position)"); - DISP_TEXT(0.0f, "SHIFT + F9 : Free Mouse"); - DISP_TEXT(0.0f, "SHIFT + F10 : Take a Screen Shot (+CTRL) for jpg"); -// DISP_TEXT(0.0f, "SHIFT + F11 : Test"); - DISP_TEXT(0.0f, "SHIFT + ESCAPE : Quit"); - DISP_TEXT(0.0f, "SHIFT + C : First/Third Person View"); - - line = 1.f; - TextContext->setHotSpot(UTextContext::TopRight); - DISP_TEXT(1.0f, "UP : FORWARD"); - DISP_TEXT(1.0f, "DOWN : BACKWARD"); - DISP_TEXT(1.0f, "LEFT : ROTATE LEFT"); - DISP_TEXT(1.0f, "RIGHT : ROTATE RIGHT"); - DISP_TEXT(1.0f, "CTRL + LEFT : STRAFE LEFT"); - DISP_TEXT(1.0f, "CTRL + RIGHT : STRAFE RIGHT"); - DISP_TEXT(1.0f, "END : Auto Walk"); - DISP_TEXT(1.0f, "DELETE : Walk/Run"); - DISP_TEXT(1.0f, "PG UP : Look Up"); - DISP_TEXT(1.0f, "PG DOWN : Look Down"); -// DISP_TEXT(1.0f, "CTRL + I : Inventory"); -// DISP_TEXT(1.0f, "CTRL + C : Spells composition interface"); -// DISP_TEXT(1.0f, "CTRL + S : Memorized Spells interface"); - DISP_TEXT(1.0f, "CTRL + B : Show/Hide PACS Borders"); - DISP_TEXT(1.0f, "CTRL + P : Player target himself"); - DISP_TEXT(1.0f, "CTRL + D : Unselect target"); - DISP_TEXT(1.0f, "CTRL + TAB : Next Chat Mode (say/shout"); - DISP_TEXT(1.0f, "CTRL + R : Reload Client.cfg File"); -// DISP_TEXT(1.0f, "CTRL + N : Toggle Night / Day lighting"); - DISP_TEXT(1.0f, "CTRL + F2 : Profile on / off"); - DISP_TEXT(1.0f, "CTRL + F3 : Movie Shooter record / stop"); - DISP_TEXT(1.0f, "CTRL + F4 : Movie Shooter replay"); - DISP_TEXT(1.0f, "CTRL + F5 : Movie Shooter save"); -#ifndef NL_USE_DEFAULT_MEMORY_MANAGER - DISP_TEXT(1.0f, "CTRL + F6 : Save memory stat report"); -#endif // NL_USE_DEFAULT_MEMORY_MANAGER - DISP_TEXT(1.0f, "CTRL + F7 : Show / hide prim file"); - DISP_TEXT(1.0f, "CTRL + F8 : Change prim file UP"); - DISP_TEXT(1.0f, "CTRL + F9 : Change prim file DOWN"); - - // No more shadow when displaying a text. - TextContext->setShaded(false); -}// displayHelp // - - //--------------------------------------------------- // Just Display some text with ... anim at some place. //--------------------------------------------------- diff --git a/code/ryzom/client/src/main_loop.h b/code/ryzom/client/src/main_loop.h index c8cd0af5a..21f64d37e 100644 --- a/code/ryzom/client/src/main_loop.h +++ b/code/ryzom/client/src/main_loop.h @@ -29,9 +29,13 @@ const uint NUM_MISSION_OPTIONS = 8; bool mainLoop(); // render all -void renderAll(bool forceFullDetail = false); +void renderScene(); +void renderScene(bool forceFullDetail, bool bloom); void setDefaultChatWindow(CChatWindow *defaultChatWindow); +// Commit sky scene camera for rendering +void commitCamera(); + void updateDayNightCycleHour(); diff --git a/code/ryzom/client/src/main_loop_debug.cpp b/code/ryzom/client/src/main_loop_debug.cpp new file mode 100644 index 000000000..dbcb47b96 --- /dev/null +++ b/code/ryzom/client/src/main_loop_debug.cpp @@ -0,0 +1,774 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include "main_loop_debug.h" + +#include +#include + +#include "game_share/ryzom_version.h" + +#include "global.h" +#include "client_cfg.h" +#include "user_entity.h" +#include "debug_client.h" +#include "entities.h" +#include "motion/user_controls.h" +#include "pacs_client.h" +#include "sound_manager.h" +#include "view.h" +#include "prim_file.h" +#include "weather.h" +#include "light_cycle_manager.h" +#include "net_manager.h" +#include "ping.h" +#include "world_database_manager.h" +#include "continent_manager.h" +#include "client_sheets/weather_function_params_sheet.h" +#include "weather_manager_client.h" +#include "fog_map.h" +#include "misc.h" +#include "interface_v3/interface_manager.h" + +using namespace NLMISC; +using namespace NL3D; +using namespace NLGUI; + +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** + +extern std::set LodCharactersNotFound; +extern uint32 NbDatabaseChanges; +extern CFogState MainFogState; +extern CPing Ping; +extern bool Filter3D[RYZOM_MAX_FILTER_3D]; + +//namespace /* anonymous */ { + +NLMISC::CValueSmoother smoothFPS; +NLMISC::CValueSmoother moreSmoothFPS(64); + +//} /* anonymous namespace */ + +//--------------------------------------------------- +// displayDebug : +// Display some debug infos. +//--------------------------------------------------- +void displayDebug() +{ + float lineStep = ClientCfg.DebugLineStep; + float line; + + // Initialize Pen // + //----------------// + // Create a shadow when displaying a text. + TextContext->setShaded(true); + // Set the font size. + TextContext->setFontSize(ClientCfg.DebugFontSize); + // Set the text color + TextContext->setColor(ClientCfg.DebugFontColor); + + // TOP LEFT // + //----------// + TextContext->setHotSpot(UTextContext::TopLeft); + line = 0.9f; + // FPS and Ms per frame + { + // smooth across frames. + double deltaTime = smoothFPS.getSmoothValue (); + // FPS and Ms per frame + if(deltaTime != 0.f) + TextContext->printfAt(0.f, line,"%.1f fps", 1.f/deltaTime); + else + TextContext->printfAt(0.f, line,"%.1f fps", 0.f); + TextContext->printfAt(0.1f, line, "%d ms", (uint)(deltaTime*1000)); + } + line -= lineStep; + line -= lineStep; + + // USER + // Front + TextContext->printfAt(0.0f, line, " %f (%f,%f,%f) front", atan2(UserEntity->front().y, UserEntity->front().x), UserEntity->front().x, UserEntity->front().y, UserEntity->front().z); + line -= lineStep; + // Dir + TextContext->printfAt(0.0f, line, " %f (%f,%f,%f) dir", atan2(UserEntity->dir().y, UserEntity->dir().x), UserEntity->dir().x, UserEntity->dir().y, UserEntity->dir().z); + line -= lineStep; + // NB Stage + TextContext->printfAt(0.0f, line, " NB Stage: %d", UserEntity->nbStage()); + line -= lineStep; + // NB Animation FXs still remaining in the remove list. + TextContext->printfAt(0.0f, line, " NB FXs to remove: %d", UserEntity->nbAnimFXToRemove()); + line -= lineStep; + // Mode. + TextContext->printfAt(0.0f, line, " Mode: %d (%s)", (sint)UserEntity->mode(), MBEHAV::modeToString(UserEntity->mode()).c_str()); + line -= lineStep; + // Behaviour. + TextContext->printfAt(0.0f, line, " Behaviour: %d (%s)", (sint)UserEntity->behaviour(), MBEHAV::behaviourToString(UserEntity->behaviour()).c_str()); + line -= lineStep; + // Display the target mount. + TextContext->printfAt(0.0f, line, " Mount: %d", UserEntity->mount()); + line -= lineStep; + // Display the target rider. + TextContext->printfAt(0.0f, line, " Rider: %d", UserEntity->rider()); + line -= lineStep; + // Display the current animation name. + TextContext->printfAt(0.0f, line, " Current Animation Name: %s", UserEntity->currentAnimationName().c_str()); + line -= lineStep; + // Display the current move animation set name. + TextContext->printfAt(0.0f, line, " Current AnimationSet Name (MOVE): %s", UserEntity->currentAnimationSetName(MOVE).c_str()); + line -= lineStep; + // Display Missing Animations + if(::CAnimation::MissingAnim.empty() == false) + { + TextContext->printfAt(0.0f, line, " '%u' Missing Animations, 1st: '%s'", ::CAnimation::MissingAnim.size(), (*(::CAnimation::MissingAnim.begin())).c_str()); + line -= lineStep; + } + // Display Missing LoD + if(LodCharactersNotFound.empty() == false) + { + TextContext->printfAt(0.0f, line, " '%u' Missing LoD, 1st: '%s'", LodCharactersNotFound.size(), (*(LodCharactersNotFound.begin())).c_str()); + line -= lineStep; + } + + // Watched Entity + line -= lineStep; + // Now Displaying the selection. + TextContext->printfAt(0.0f, line, "--*** Watched entity ***--"); + line -= lineStep; + // Display information about the debug entity slot. + if(WatchedEntitySlot != CLFECOMMON::INVALID_SLOT) + { + // Get a pointer on the target. + CEntityCL *watchedEntity = EntitiesMngr.entity(WatchedEntitySlot); + if(watchedEntity) + { + // Display Debug Information about the Selection. + watchedEntity->displayDebug(0.0f, line, -lineStep); + + // Distance of the target + CVectorD diffvector = UserEntity->pos() - watchedEntity->pos(); + TextContext->printfAt(0.0f, line, " Distance: %10.2f (Manhattan: %.2f)", diffvector.norm(), fabs(diffvector.x) + fabs(diffvector.y) ); + line -= lineStep; + } + // Target not allocated + else + { + TextContext->printfAt(0.0f, line, "Not allocated (%d)", WatchedEntitySlot); + line -= lineStep; + } + } + // No Target + else + { + TextContext->printfAt(0.0f, line, "None"); + line -= lineStep; + } + + /* Ca rame grave ! + + uint nMem = NLMEMORY::GetAllocatedMemory(); + line -= lineStep; + TextContext->printfAt(0.0f, line, "Mem Used: %d",nMem);*/ + + // 3D Filters information: +#ifdef _PROFILE_ON_ + line-= lineStep; + TextContext->printfAt(0.0f, line, "3D Filters:"); + line-= lineStep; + TextContext->printfAt(0.0f, line, "MeshNoVP: %s", Filter3D[FilterMeshNoVP]?"Ok":"NOT RENDERED!"); + line-= lineStep; + TextContext->printfAt(0.0f, line, "MeshVP: %s", Filter3D[FilterMeshVP]?"Ok":"NOT RENDERED!"); + line-= lineStep; + TextContext->printfAt(0.0f, line, "FXs: %s", Filter3D[FilterFXs]?"Ok":"NOT RENDERED!"); + line-= lineStep; + if (Landscape) + { + TextContext->printfAt(0.0f, line, "Landscape: %s", Filter3D[FilterLandscape]?"Ok":"NOT RENDERED!"); + line-= lineStep; + } + else + { + TextContext->printfAt(0.0f, line, "Landscape not enabled"); + } + TextContext->printfAt(0.0f, line, "Vegetable: %s", Filter3D[FilterVegetable]?"Ok":"NOT RENDERED!"); + line-= lineStep; + TextContext->printfAt(0.0f, line, "Skeleton: %s", Filter3D[FilterSkeleton]?"Ok":"NOT RENDERED!"); + line-= lineStep; + TextContext->printfAt(0.0f, line, "Water: %s", Filter3D[FilterWater]?"Ok":"NOT RENDERED!"); + line-= lineStep; + TextContext->printfAt(0.0f, line, "Cloud: %s", Filter3D[FilterCloud]?"Ok":"NOT RENDERED!"); + line-= lineStep; + TextContext->printfAt(0.0f, line, "CoarseMesh: %s", Filter3D[FilterCoarseMesh]?"Ok":"NOT RENDERED!"); + line-= lineStep; + TextContext->printfAt(0.0f, line, "Sky: %s", Filter3D[FilterSky]?"Ok":"NOT RENDERED!"); + line-= lineStep; + // Materials Infos + TextContext->printfAt(0.0f, line, "SetupedMatrix: %d", Driver->profileSetupedModelMatrix() ); + line-= lineStep; + TextContext->printfAt(0.0f, line, "SetupedMaterials: %d", Driver->profileSetupedMaterials() ); + line-= lineStep; + // Display camera cluster system + TextContext->printfAt(0.0f, line, "ClusterSystem: %p", MainCam.getClusterSystem() ); + line-= 2 * lineStep; + // Lua stuffs + CInterfaceManager *pIM = CInterfaceManager::getInstance(); + TextContext->printfAt(0.0f, line, "Lua mem (kb) : %d / %d", CLuaManager::getInstance().getLuaState()->getGCCount(), CLuaManager::getInstance().getLuaState()->getGCThreshold()); + line-= lineStep; + TextContext->printfAt(0.0f, line, "Lua stack size = %d", CLuaManager::getInstance().getLuaState()->getTop()); + line-= lineStep; + +#endif + + // TOP LEFT // + //-----------// + TextContext->setHotSpot(UTextContext::TopLeft); + line = 1.f; + string str; +#if FINAL_VERSION + str = "FV"; +#else + str = "DEV"; +#endif + if(ClientCfg.ExtendedCommands) + str += "_E"; + str += " "RYZOM_VERSION; + TextContext->printfAt(0.f, line, "Version %s", str.c_str()); + + // TOP MIDDLE // + //------------// + TextContext->setHotSpot(UTextContext::MiddleTop); + line = 1.f; + // Motion Mode + TextContext->printfAt(0.5f, line, "%s", UserControls.modeStr().c_str()); + line -= lineStep; + + // TOP RIGHT // + //-----------// + TextContext->setHotSpot(UTextContext::TopRight); + line = 1.f; + //// 3D Infos + // Video mem allocated. + TextContext->printfAt(1.f, line, "Video mem. : %f", Driver->profileAllocatedTextureMemory()/(1024.f*1024.f)); + line -= lineStep; + // Video mem used since last swapBuffers(). + TextContext->printfAt(1.f, line, "Video mem. since last swap buffer: %f", Driver->getUsedTextureMemory()/(1024.f*1024.f)); + line -= lineStep; + // Get the last face count asked from the main scene before reduction. + TextContext->printfAt(1.f, line, "Nb Skin Face Asked: %f", Scene->getGroupNbFaceAsked("Skin")); + line -= lineStep; + TextContext->printfAt(1.f, line, "Nb Fx Face Asked: %f", Scene->getGroupNbFaceAsked("Fx")); + line -= lineStep; + // All Triangles In + CPrimitiveProfile pIn; + CPrimitiveProfile pOut; + Driver->profileRenderedPrimitives(pIn, pOut); + TextContext->printfAt(1.f, line, "Tri In : %d", pIn.NTriangles+2*pIn.NQuads); + line -= lineStep; + // All Triangles Out + TextContext->printfAt(1.f, line, "Tri Out : %d", pOut.NTriangles+2*pIn.NQuads); + line -= lineStep; + // Current Cluster + string strPos; + // Check there is a PACS Primitive before using it. + if(UserEntity->getPrimitive() && GR) + { + UGlobalPosition gPos; + UserEntity->getPrimitive()->getGlobalPosition(gPos, dynamicWI); + string strPos = GR->getIdentifier(gPos); + } + else + strPos = "No Primitive"; + TextContext->printfAt(1.f, line, "Cluster : %s", strPos.c_str()); + line -= lineStep; + //// SOUND Infos + line -= lineStep; + if(SoundMngr) + { + TextContext->printfAt(1.f, line, "Sound source instance: %u", SoundMngr->getSourcesInstanceCount()); + line -= lineStep; + TextContext->printfAt(1.f, line, "Logical playing SoundSource: %u", SoundMngr->getMixer()->getPlayingSourcesCount ()); + line -= lineStep; + TextContext->printfAt(1.f, line, "Audio tracks: %u/%u", SoundMngr->getMixer()->getUsedTracksCount(), SoundMngr->getMixer()->getPolyphony()); + line -= lineStep; + if (SoundMngr->getMixer()->getMutedPlayingSourcesCount() > 0) + { + TextContext->printfAt(1.f, line, "Source muted: %u !", SoundMngr->getMixer()->getMutedPlayingSourcesCount()); + line -= lineStep; + } + TextContext->printfAt(1.f, line, "Samples in memory: %g MB", SoundMngr->getLoadingSamplesSize() / (1024.0f*1024.0f)); + line -= lineStep; + + } + + // BOTTOM RIGHT // + //--------------// + TextContext->setHotSpot(UTextContext::BottomRight); + line = 0.f; + //// POSITION + CVector postmp = View.viewPos(); + // Pos + TextContext->printfAt(1.f, line, "Position : %d %d %d",(int)postmp.x,(int)postmp.y,(int)postmp.z); + line += lineStep; + // Body Heading + TextContext->printfAt(1.f, line, "Front : %.2f %.2f %.2f", UserEntity->front().x, UserEntity->front().y, UserEntity->front().z); + line += lineStep; + // Speed + TextContext->printfAt(1.f, line, "Speed : %.2f", (float) UserEntity->speed()); + line += lineStep; + // Zone + if (!ClientCfg.Light) + { + if (Landscape) + { + TextContext->printfAt(1.f, line, "Zone: %s", Landscape->getZoneName(postmp).c_str()); + line += lineStep; + } + } + // Prim File + string primFile = PrimFiles.getCurrentPrimitive (); + if (!primFile.empty ()) + { + TextContext->printfAt(1.f, line, "Prim File: %s", primFile.c_str ()); + line += lineStep; + } + + //// CONNECTION + line += lineStep; + // Ryzom Day. + TextContext->printfAt(1.f, line, "Ryzom Day : %d", RT.getRyzomDay()); + line += lineStep; + // hour in the game + float dayNightCycleHour = (float)RT.getRyzomTime(); + TextContext->printfAt(1.f, line, "Ryzom Time : %2u:%02u", int(dayNightCycleHour), int((dayNightCycleHour-int(dayNightCycleHour))*60.0f)); + line += lineStep; + // light hour in the game, used to display te day/night + TextContext->printfAt(1.f, line, "Ryzom Light Time : %2u:%02u (%s)", int(DayNightCycleHour), int((DayNightCycleHour-int(DayNightCycleHour))*60.0f), LightCycleManager.getStateString().c_str()); + line += lineStep; + // Server GameCycle + TextContext->printfAt(1.f, line, "Server GameCycle : %u", (uint)NetMngr.getCurrentServerTick()); + line += lineStep; + // Current GameCycle + TextContext->printfAt(1.f, line, "Current GameCycle : %u", (uint)NetMngr.getCurrentClientTick()); + line += lineStep; + // Current GameCycle + TextContext->printfAt(1.f, line, "Ms per Cycle : %d", NetMngr.getMsPerTick()); + line += lineStep; + // Packet Loss + TextContext->printfAt(1.f, line, "Packet Loss : %.1f %%", NetMngr.getMeanPacketLoss()*100.0f); + line += lineStep; + // Packet Loss + TextContext->printfAt(1.f, line, "Packets Lost : %u", NetMngr.getTotalLostPackets()); + line += lineStep; + // Mean Upload + TextContext->printfAt(1.f, line, "Mean Upld : %.3f kbps", NetMngr.getMeanUpload()); + line += lineStep; + // Mean Download + TextContext->printfAt(1.f, line, "Mean Dnld : %.3f kbps", NetMngr.getMeanDownload()); + line += lineStep; + + // Mean Download + TextContext->printfAt(1.f, line, "Nb in Vision : %d(%d,%d,%d)", + EntitiesMngr.nbEntitiesAllocated(), + EntitiesMngr.nbUser(), + EntitiesMngr.nbPlayer(), + EntitiesMngr.nbChar()); + line += lineStep; + + // Number of database changes + TextContext->printfAt(1.f, line, "DB Changes : %u", NbDatabaseChanges ); + line += lineStep; + + // Ping + TextContext->printfAt(1.f, line, "DB Ping : %u ms", Ping.getValue()); + line += lineStep; + + + + + + // Manual weather setup + { + if(ContinentMngr.cur()) // Only usable if there is a continent loaded. + { + if (!ForceTrueWeatherValue) + { + const CWeatherFunction &wf = ContinentMngr.cur()->WeatherFunction[CurrSeason]; + float wv; + if (ClientCfg.ManualWeatherSetup) + { + wv = std::max(wf.getNumWeatherSetups() - 1, 0u) * ManualWeatherValue; + } + else + { + wv = std::max(wf.getNumWeatherSetups() - 1, 0u) * ::getBlendedWeather(RT.getRyzomDay(), RT.getRyzomTime(), *WeatherFunctionParams, ContinentMngr.cur()->WeatherFunction); + } + const CWeatherSetup *ws = wf.getWeatherSetup((uint) floorf(wv)); + std::string name0 = ws ? NLMISC::CStringMapper::unmap(ws->SetupName) : "???"; + ws = wf.getWeatherSetup(std::min((uint) (floorf(wv) + 1), wf.getNumWeatherSetups() - 1)); + std::string name1 = ws ? NLMISC::CStringMapper::unmap(ws->SetupName) : "???"; + TextContext->printfAt(1.f, line, "Weather value : %.02f : %s -> %s", ws ? wv : 0.f, name0.c_str(), name1.c_str()); + line += lineStep; + } + else + { + TextContext->printfAt(1.f, line, "Weather value : %.02f", WeatherManager.getWeatherValue() * std::max(ContinentMngr.cur()->WeatherFunction[CurrSeason].getNumWeatherSetups() - 1, 0u)); + line += lineStep; + TextContext->printfAt(1.f, line, "TEST WEATHER FUNCTION"); + line += lineStep; + } + // season + TextContext->printfAt(1.f, line, "Season : %s", EGSPD::CSeason::toString(CurrSeason).c_str()); + line += lineStep; + } + } + + // fog dist + if (ContinentMngr.cur()) + { + TextContext->printfAt(1.f, line, "Continent fog min near = %.1f, max far = %.1f", ContinentMngr.cur()->FogStart, ContinentMngr.cur()->FogEnd); + line += lineStep; + CFogState tmpFog; + ContinentMngr.getFogState(MainFog, LightCycleManager.getLightLevel(), LightCycleManager.getLightDesc().DuskRatio, LightCycleManager.getState(), View.viewPos(), tmpFog); + TextContext->printfAt(1.f, line, "Continent fog curr near = %.1f, curr far = %.1f", tmpFog.FogStartDist, tmpFog.FogEndDist); + line += lineStep; + } + const CWeatherState &ws = WeatherManager.getCurrWeatherState(); + TextContext->printfAt(1.f, line, "Weather fog near = %.1f, far = %.1f", ws.FogNear[MainFog], ws.FogFar[MainFog]); + line += lineStep; + TextContext->printfAt(1.f, line, "Final fog near = %.1f, far = %.1f", MainFogState.FogStartDist, MainFogState.FogEndDist); + line += lineStep; + float left, right, bottom, top, znear, zfar; + Scene->getCam().getFrustum(left, right, bottom, top, znear, zfar); + TextContext->printfAt(1.f, line, "Clip near = %.1f, far = %.1f", znear, zfar); + line += lineStep; + + // Connection states + TextContext->printfAt(1.f, line, "State : %s", NetMngr.getConnectionStateCStr() ); + line += lineStep; + +// UGlobalPosition globalPos; +// UserEntity->getPrimitive()->getGlobalPosition(globalPos, dynamicWI); +// uint32 material = GR->getMaterial( globalPos ); +// TextContext->printfAt(0.5f,0.5f,"Material : %d Gpos=(inst=%d,surf=%d,x=%.2f,y=%.2f",material, globalPos.InstanceId, globalPos.LocalPosition.Surface, globalPos.LocalPosition.Estimation.x, globalPos.LocalPosition.Estimation.y); + + // No more shadow when displaying a text. + TextContext->setShaded(false); +}// displayDebug // + +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** + +//--------------------------------------------------- +// displayDebug : +// Display some debug infos. +//--------------------------------------------------- +void displayDebugFps() +{ + float lineStep = ClientCfg.DebugLineStep; + float line; + + // Initialize Pen // + //----------------// + // Create a shadow when displaying a text. + TextContext->setShaded(true); + // Set the font size. + TextContext->setFontSize(ClientCfg.DebugFontSize); + // Set the text color + TextContext->setColor(ClientCfg.DebugFontColor); + + // TOP LEFT // + //----------// + TextContext->setHotSpot(UTextContext::TopLeft); + line = 0.9f; + // Ms per frame + { + float spf = smoothFPS.getSmoothValue (); + // Ms per frame + TextContext->printfAt(0.1f, line, "FPS %.1f ms - %.1f fps", spf*1000, 1.f/spf); + line-= lineStep; + // More Smoothed Ms per frame + spf = moreSmoothFPS.getSmoothValue (); + TextContext->printfAt(0.1f, line, "Smoothed FPS %.1f ms - %.1f fps", spf*1000, 1.f/spf); + line-= lineStep; + } +} + +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** + +static NLMISC::CRefPtr HighlightedDebugUI; + +// displayDebug : +// Display information about ui elements that are under the mouse +//--------------------------------------------------- +void displayDebugUIUnderMouse() +{ + float lineStep = ClientCfg.DebugLineStep; + float line; + + // Initialize Pen // + //----------------// + // Create a shadow when displaying a text. + TextContext->setShaded(true); + // Set the font size. + TextContext->setFontSize(ClientCfg.DebugFontSize); + + + + // TOP LEFT // + //----------// + TextContext->setHotSpot(UTextContext::TopLeft); + line = 0.9f; + + CInterfaceManager *pIM = CInterfaceManager::getInstance(); + // for now only accessible with R2ED + if (ClientCfg.R2EDEnabled) + { + TextContext->setColor(CRGBA::Cyan); + TextContext->printfAt(0.1f, line, "Press default key (ctrl+shift+A) to cycle prev"); + line-= lineStep; + TextContext->printfAt(0.1f, line, "Press default key (ctrl+shift+Q) to cycle next"); + line-= lineStep; + TextContext->printfAt(0.1f, line, "Press default key (ctrl+shift+W) to inspect element"); + line-= 2 * lineStep; + } + // + const std::vector &rICL = CWidgetManager::getInstance()->getCtrlsUnderPointer (); + const std::vector &rIGL = CWidgetManager::getInstance()->getGroupsUnderPointer (); + // If previous highlighted element is found in the list, then keep it, else reset to first element + if (std::find(rICL.begin(), rICL.end(), HighlightedDebugUI) == rICL.end() && + std::find(rIGL.begin(), rIGL.end(), HighlightedDebugUI) == rIGL.end()) + { + if (!rICL.empty()) + { + HighlightedDebugUI = rICL[0]; + } + else + if (!rIGL.empty()) + { + HighlightedDebugUI = rIGL[0]; + } + else + { + HighlightedDebugUI = NULL; + } + } + // + TextContext->setColor(CRGBA::Green); + TextContext->printfAt(0.1f, line, "Controls under cursor "); + line -= lineStep * 1.4f; + TextContext->printfAt(0.1f, line, "----------------------"); + line -= lineStep; + for(uint k = 0; k < rICL.size(); ++k) + { + if (rICL[k]) + { + TextContext->setColor(rICL[k] != HighlightedDebugUI ? ClientCfg.DebugFontColor : CRGBA::Red); + TextContext->printfAt(0.1f, line, "id = %s, address = 0x%p, parent = 0x%p", rICL[k]->getId().c_str(), rICL[k], rICL[k]->getParent()); + } + else + { + TextContext->setColor(CRGBA::Blue); + TextContext->printfAt(0.1f, line, " control found !!!"); + } + line-= lineStep; + } + // + TextContext->setColor(CRGBA::Green); + TextContext->printfAt(0.1f, line, "Groups under cursor "); + line -= lineStep * 1.4f; + TextContext->printfAt(0.1f, line, "----------------------"); + line-= lineStep; + for(uint k = 0; k < rIGL.size(); ++k) + { + if (rIGL[k]) + { + TextContext->setColor(rIGL[k] != HighlightedDebugUI ? ClientCfg.DebugFontColor : CRGBA::Red); + TextContext->printfAt(0.1f, line, "id = %s, address = 0x%p, parent = 0x%p", rIGL[k]->getId().c_str(), rIGL[k], rIGL[k]->getParent()); + } + else + { + TextContext->setColor(CRGBA::Blue); + TextContext->printfAt(0.1f, line, " group found !!!"); + } + line-= lineStep; + } +} + +// get all element under the mouse in a single vector +static void getElementsUnderMouse(std::vector &ielem) +{ + CInterfaceManager *pIM = CInterfaceManager::getInstance(); + const std::vector &rICL = CWidgetManager::getInstance()->getCtrlsUnderPointer(); + const std::vector &rIGL = CWidgetManager::getInstance()->getGroupsUnderPointer(); + ielem.clear(); + ielem.insert(ielem.end(), rICL.begin(), rICL.end()); + ielem.insert(ielem.end(), rIGL.begin(), rIGL.end()); +} + +class CHandlerDebugUiPrevElementUnderMouse : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) + { + std::vector ielem; + getElementsUnderMouse(ielem); + for(uint k = 0; k < ielem.size(); ++k) + { + if (HighlightedDebugUI == ielem[k]) + { + HighlightedDebugUI = ielem[k == 0 ? ielem.size() - 1 : k - 1]; + return; + } + } + } +}; +REGISTER_ACTION_HANDLER( CHandlerDebugUiPrevElementUnderMouse, "debug_ui_prev_element_under_mouse"); + +class CHandlerDebugUiNextElementUnderMouse : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) + { + std::vector ielem; + getElementsUnderMouse(ielem); + for(uint k = 0; k < ielem.size(); ++k) + { + if (HighlightedDebugUI == ielem[k]) + { + HighlightedDebugUI = ielem[(k + 1) % ielem.size()]; + return; + } + } + } +}; +REGISTER_ACTION_HANDLER( CHandlerDebugUiNextElementUnderMouse, "debug_ui_next_element_under_mouse"); + +class CHandlerDebugUiDumpElementUnderMouse : public IActionHandler +{ + virtual void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) + { + if (HighlightedDebugUI == NULL) return; + CLuaState *lua = CLuaManager::getInstance().getLuaState(); + if (!lua) return; + CLuaStackRestorer lsr(lua, 0); + CLuaIHM::pushUIOnStack(*lua, HighlightedDebugUI); + lua->pushGlobalTable(); + CLuaObject env(*lua); + env["inspect"].callNoThrow(1, 0); + } +}; +REGISTER_ACTION_HANDLER( CHandlerDebugUiDumpElementUnderMouse, "debug_ui_inspect_element_under_mouse"); + +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** + +//----------------------------------------------- +// Macro to Display a Text +//----------------------------------------------- +#define DISP_TEXT(x, text) \ + /* Display the text at the right place */ \ + TextContext->printfAt(x, line, text); \ + /* Change the line */ \ + line += lineStep; \ + +//--------------------------------------------------- +// displayHelp : +// Display an Help. +//--------------------------------------------------- +void displayHelp() +{ + float line = 1.f; + float lineStep = -ClientCfg.HelpLineStep; + + // Create a shadow when displaying a text. + TextContext->setShaded(true); + // Set the font size. + TextContext->setFontSize(ClientCfg.HelpFontSize); + // Set the text color + TextContext->setColor(ClientCfg.HelpFontColor); + + + line = 1.f; + TextContext->setHotSpot(UTextContext::TopLeft); + DISP_TEXT(0.0f, "SHIFT + F1 : This Menu") + DISP_TEXT(0.0f, "SHIFT + F2 : Display Debug Infos") + DISP_TEXT(0.0f, "SHIFT + F3 : Wire mode"); + DISP_TEXT(0.0f, "SHIFT + F4 : Do not Render the Scene"); + DISP_TEXT(0.0f, "SHIFT + F5 : Toogle Display OSD interfaces"); +// DISP_TEXT(0.0f, "SHIFT + F6 : Not used"); + DISP_TEXT(0.0f, "SHIFT + F7 : Compass Mode (User/Camera)"); + DISP_TEXT(0.0f, "SHIFT + F8 : Camera Mode (INSERT to change your position)"); + DISP_TEXT(0.0f, "SHIFT + F9 : Free Mouse"); + DISP_TEXT(0.0f, "SHIFT + F10 : Take a Screen Shot (+CTRL) for jpg"); +// DISP_TEXT(0.0f, "SHIFT + F11 : Test"); + DISP_TEXT(0.0f, "SHIFT + ESCAPE : Quit"); + DISP_TEXT(0.0f, "SHIFT + C : First/Third Person View"); + + line = 1.f; + TextContext->setHotSpot(UTextContext::TopRight); + DISP_TEXT(1.0f, "UP : FORWARD"); + DISP_TEXT(1.0f, "DOWN : BACKWARD"); + DISP_TEXT(1.0f, "LEFT : ROTATE LEFT"); + DISP_TEXT(1.0f, "RIGHT : ROTATE RIGHT"); + DISP_TEXT(1.0f, "CTRL + LEFT : STRAFE LEFT"); + DISP_TEXT(1.0f, "CTRL + RIGHT : STRAFE RIGHT"); + DISP_TEXT(1.0f, "END : Auto Walk"); + DISP_TEXT(1.0f, "DELETE : Walk/Run"); + DISP_TEXT(1.0f, "PG UP : Look Up"); + DISP_TEXT(1.0f, "PG DOWN : Look Down"); +// DISP_TEXT(1.0f, "CTRL + I : Inventory"); +// DISP_TEXT(1.0f, "CTRL + C : Spells composition interface"); +// DISP_TEXT(1.0f, "CTRL + S : Memorized Spells interface"); + DISP_TEXT(1.0f, "CTRL + B : Show/Hide PACS Borders"); + DISP_TEXT(1.0f, "CTRL + P : Player target himself"); + DISP_TEXT(1.0f, "CTRL + D : Unselect target"); + DISP_TEXT(1.0f, "CTRL + TAB : Next Chat Mode (say/shout"); + DISP_TEXT(1.0f, "CTRL + R : Reload Client.cfg File"); +// DISP_TEXT(1.0f, "CTRL + N : Toggle Night / Day lighting"); + DISP_TEXT(1.0f, "CTRL + F2 : Profile on / off"); + DISP_TEXT(1.0f, "CTRL + F3 : Movie Shooter record / stop"); + DISP_TEXT(1.0f, "CTRL + F4 : Movie Shooter replay"); + DISP_TEXT(1.0f, "CTRL + F5 : Movie Shooter save"); +#ifndef NL_USE_DEFAULT_MEMORY_MANAGER + DISP_TEXT(1.0f, "CTRL + F6 : Save memory stat report"); +#endif // NL_USE_DEFAULT_MEMORY_MANAGER + DISP_TEXT(1.0f, "CTRL + F7 : Show / hide prim file"); + DISP_TEXT(1.0f, "CTRL + F8 : Change prim file UP"); + DISP_TEXT(1.0f, "CTRL + F9 : Change prim file DOWN"); + + // No more shadow when displaying a text. + TextContext->setShaded(false); +}// displayHelp // + +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** + +/* end of file */ \ No newline at end of file diff --git a/code/ryzom/client/src/main_loop_debug.h b/code/ryzom/client/src/main_loop_debug.h new file mode 100644 index 000000000..70139290e --- /dev/null +++ b/code/ryzom/client/src/main_loop_debug.h @@ -0,0 +1,31 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef CL_MAIN_LOOP_DEBUG_H +#define CL_MAIN_LOOP_DEBUG_H + +#include + +// Display some debug infos. +void displayDebug(); +void displayDebugFps(); +void displayDebugUIUnderMouse(); +// Display an Help. +void displayHelp(); + +#endif // CL_MAIN_LOOP_DEBUG_H + +/* end of file */ \ No newline at end of file diff --git a/code/ryzom/client/src/main_loop_temp.cpp b/code/ryzom/client/src/main_loop_temp.cpp new file mode 100644 index 000000000..0b3f24fa3 --- /dev/null +++ b/code/ryzom/client/src/main_loop_temp.cpp @@ -0,0 +1,226 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include "main_loop_temp.h" + +#include "global.h" + +// tempDumpValidPolys +#include +#include +#include "interface_v3/interface_manager.h" + +// tempDumpColPolys +#include +#include "r2/editor.h" +#include "user_entity.h" +#include + +using namespace NLMISC; +using namespace NL3D; + +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** + +// TMP TMP +void tempDumpValidPolys() +{ + struct CPolyDisp : public CInterfaceElementVisitor + { + virtual void visitCtrl(CCtrlBase *ctrl) + { + CCtrlPolygon *cp = dynamic_cast(ctrl); + if (cp) + { + sint32 cornerX, cornerY; + cp->getParent()->getCorner(cornerX, cornerY, cp->getParentPosRef()); + for(sint32 y = 0; y < (sint32) Screen.getHeight(); ++y) + { + for(sint32 x = 0; x < (sint32) Screen.getWidth(); ++x) + { + if (cp->contains(CVector2f((float) (x - cornerX), (float) (y - cornerY)))) + { + ((CRGBA *) &Screen.getPixels()[0])[x + (Screen.getHeight() - 1 - y) * Screen.getWidth()] = CRGBA::Magenta; + } + } + } + } + } + CBitmap Screen; + } polyDisp; + Driver->getBuffer(polyDisp.Screen); + CInterfaceManager::getInstance()->visit(&polyDisp); + COFile output("poly.tga"); + polyDisp.Screen.writeTGA(output); +} + +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** + +// TMP TMP +static void viewportToScissor(const CViewport &vp, CScissor &scissor) +{ + scissor.X = vp.getX(); + scissor.Y = vp.getY(); + scissor.Width = vp.getWidth(); + scissor.Height = vp.getHeight(); +} + +// TMP TMP +void tempDumpColPolys() +{ + CPackedWorld *pw = R2::getEditor().getIslandCollision().getPackedIsland(); + if (pw) + { + static CMaterial material; + static CMaterial wiredMaterial; + static CMaterial texturedMaterial; + static CVertexBuffer vb; + static bool initDone = false; + if (!initDone) + { + vb.setVertexFormat(CVertexBuffer::PositionFlag); + vb.setPreferredMemory(CVertexBuffer::AGPVolatile, false); + material.initUnlit(); + material.setDoubleSided(true); + material.setZFunc(CMaterial::lessequal); + wiredMaterial.initUnlit(); + wiredMaterial.setDoubleSided(true); + wiredMaterial.setZFunc(CMaterial::lessequal); + wiredMaterial.setColor(CRGBA(255, 255, 255, 250)); + wiredMaterial.texEnvOpAlpha(0, CMaterial::Replace); + wiredMaterial.texEnvArg0Alpha(0, CMaterial::Diffuse, CMaterial::SrcAlpha); + wiredMaterial.setBlend(true); + wiredMaterial.setBlendFunc(CMaterial::srcalpha, CMaterial::invsrcalpha); + texturedMaterial.initUnlit(); + texturedMaterial.setDoubleSided(true); + texturedMaterial.setZFunc(CMaterial::lessequal); + initDone = true; + } + // just add a projected texture + R2::getEditor().getIslandCollision().loadEntryPoints(); + R2::CScenarioEntryPoints &sep = R2::CScenarioEntryPoints::getInstance(); + CVectorD playerPos = UserEntity->pos(); + R2::CScenarioEntryPoints::CCompleteIsland *island = sep.getCompleteIslandFromCoords(CVector2f((float) playerPos.x, (float) playerPos.y)); + static CSString currIsland; + if (island && island->Island != currIsland) + { + currIsland = island->Island; + CTextureFile *newTex = new CTextureFile(currIsland + "_sp.tga"); + newTex->setWrapS(ITexture::Clamp); + newTex->setWrapT(ITexture::Clamp); + texturedMaterial.setTexture(0, newTex); + texturedMaterial.texEnvOpRGB(0, CMaterial::Replace); + texturedMaterial.texEnvArg0RGB(0, CMaterial::Texture, CMaterial::SrcColor); + texturedMaterial.setTexCoordGen(0, true); + texturedMaterial.setTexCoordGenMode(0, CMaterial::TexCoordGenObjectSpace); + CMatrix mat; + CVector scale((float) (island->XMax - island->XMin), + (float) (island->YMax - island->YMin), 0.f); + scale.x = 1.f / favoid0(scale.x); + scale.y = 1.f / favoid0(scale.y); + scale.z = 0.f; + mat.setScale(scale); + mat.setPos(CVector(- island->XMin * scale.x, - island->YMin * scale.y, 0.f)); + // + CMatrix uvScaleMat; + // + uint texWidth = (uint) (island->XMax - island->XMin); + uint texHeight = (uint) (island->YMax - island->YMin); + float UScale = (float) texWidth / raiseToNextPowerOf2(texWidth); + float VScale = (float) texHeight / raiseToNextPowerOf2(texHeight); + // + uvScaleMat.setScale(CVector(UScale, - VScale, 0.f)); + uvScaleMat.setPos(CVector(0.f, VScale, 0.f)); + // + texturedMaterial.enableUserTexMat(0, true); + texturedMaterial.setUserTexMat(0, uvScaleMat * mat); + } + const CFrustum &frust = MainCam.getFrustum(); + + // + IDriver *driver = ((CDriverUser *) Driver)->getDriver(); + + driver->enableFog(true); + const CRGBA clearColor = CRGBA(0, 0, 127, 0); + driver->setupFog(frust.Far * 0.8f, frust.Far, clearColor); + CViewport vp; + vp.init(0.f, 0.f, 1.f, 1.f); + driver->setupViewport(vp); + CScissor scissor; + viewportToScissor(vp, scissor); + driver->setupScissor(scissor); + // + driver->setFrustum(frust.Left, frust.Right, frust.Bottom, frust.Top, frust.Near, frust.Far, frust.Perspective); + driver->setupViewMatrix(MainCam.getMatrix().inverted()); + driver->setupModelMatrix(CMatrix::Identity); + // + // + const CVector localFrustCorners[8] = + { + CVector(frust.Left, frust.Near, frust.Top), + CVector(frust.Right, frust.Near, frust.Top), + CVector(frust.Right, frust.Near, frust.Bottom), + CVector(frust.Left, frust.Near, frust.Bottom), + CVector(frust.Left * frust.Far / frust.Near, frust.Far, frust.Top * frust.Far / frust.Near), + CVector(frust.Right * frust.Far / frust.Near, frust.Far, frust.Top * frust.Far / frust.Near), + CVector(frust.Right * frust.Far / frust.Near, frust.Far, frust.Bottom * frust.Far / frust.Near), + CVector(frust.Left * frust.Far / frust.Near, frust.Far, frust.Bottom * frust.Far / frust.Near) + }; + // roughly compute covered zones + // + /* + sint frustZoneMinX = INT_MAX; + sint frustZoneMaxX = INT_MIN; + sint frustZoneMinY = INT_MAX; + sint frustZoneMaxY = INT_MIN; + for(uint k = 0; k < sizeofarray(localFrustCorners); ++k) + { + CVector corner = camMat * localFrustCorners[k]; + sint zoneX = (sint) (corner.x / 160.f) - zoneMinX; + sint zoneY = (sint) floorf(corner.y / 160.f) - zoneMinY; + frustZoneMinX = std::min(frustZoneMinX, zoneX); + frustZoneMinY = std::min(frustZoneMinY, zoneY); + frustZoneMaxX = std::max(frustZoneMaxX, zoneX); + frustZoneMaxY = std::max(frustZoneMaxY, zoneY); + } + */ + + const uint TRI_BATCH_SIZE = 10000; // batch size for rendering + static std::vector zones; + zones.clear(); + pw->getZones(zones); + for(uint k = 0; k < zones.size(); ++k) + { + zones[k]->render(vb, *driver, texturedMaterial, wiredMaterial, MainCam.getMatrix(), TRI_BATCH_SIZE, localFrustCorners); + } + } +} + +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** +// ******************************************************************** + +/* end of file */ \ No newline at end of file diff --git a/code/ryzom/client/src/main_loop_temp.h b/code/ryzom/client/src/main_loop_temp.h new file mode 100644 index 000000000..4f24972f7 --- /dev/null +++ b/code/ryzom/client/src/main_loop_temp.h @@ -0,0 +1,30 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef CL_MAIN_LOOP_TEMP_H +#define CL_MAIN_LOOP_TEMP_H + +#include + +// TMP TMP +void tempDumpValidPolys(); + +// TMP TMP +void tempDumpColPolys(); + +#endif // CL_MAIN_LOOP_TEMP_H + +/* end of file */ \ No newline at end of file diff --git a/code/ryzom/client/src/main_loop_utilities.cpp b/code/ryzom/client/src/main_loop_utilities.cpp new file mode 100644 index 000000000..7afba0a9f --- /dev/null +++ b/code/ryzom/client/src/main_loop_utilities.cpp @@ -0,0 +1,341 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include "main_loop_utilities.h" + +#include +#include + +#include "game_share/scenario_entry_points.h" + +#include "client_cfg.h" +#include "misc.h" +#include "global.h" +#include "world_database_manager.h" +#include "continent_manager.h" +#include "user_entity.h" +#include "view.h" +#include "ig_client.h" +#include "entities.h" +#include "input.h" +#include "sound_manager.h" +#include "camera.h" + +using namespace NLMISC; +using namespace NL3D; + +//--------------------------------------------------- +// Compare ClientCfg and LastClientCfg to know what we must update +//--------------------------------------------------- +void updateFromClientCfg() +{ + CClientConfig::setValues(); + ClientCfg.IsInvalidated = false; + + // GRAPHICS - GENERAL + //--------------------------------------------------- + if ((ClientCfg.Windowed != LastClientCfg.Windowed) || + (ClientCfg.Width != LastClientCfg.Width) || + (ClientCfg.Height != LastClientCfg.Height) || + (ClientCfg.Depth != LastClientCfg.Depth) || + (ClientCfg.Frequency != LastClientCfg.Frequency)) + { + setVideoMode(UDriver::CMode(ClientCfg.Width, ClientCfg.Height, (uint8)ClientCfg.Depth, + ClientCfg.Windowed, ClientCfg.Frequency)); + } + + if (ClientCfg.DivideTextureSizeBy2 != LastClientCfg.DivideTextureSizeBy2) + { + if (ClientCfg.DivideTextureSizeBy2) + Driver->forceTextureResize(2); + else + Driver->forceTextureResize(1); + } + + //--------------------------------------------------- + if (ClientCfg.WaitVBL != LastClientCfg.WaitVBL) + { + if(ClientCfg.WaitVBL) + Driver->setSwapVBLInterval(1); + else + Driver->setSwapVBLInterval(0); + } + + // GRAPHICS - LANDSCAPE + //--------------------------------------------------- + if (ClientCfg.LandscapeThreshold != LastClientCfg.LandscapeThreshold) + { + if (Landscape) Landscape->setThreshold(ClientCfg.getActualLandscapeThreshold()); + } + + //--------------------------------------------------- + if (ClientCfg.LandscapeTileNear != LastClientCfg.LandscapeTileNear) + { + if (Landscape) Landscape->setTileNear(ClientCfg.LandscapeTileNear); + } + + //--------------------------------------------------- + if (Landscape) + { + if (ClientCfg.Vision != LastClientCfg.Vision) + { + if (!ClientCfg.Light) + { + // Not in an indoor ? + if (ContinentMngr.cur() && !ContinentMngr.cur()->Indoor) + { + // Refresh All Zone in streaming according to the refine position + std::vector zonesAdded; + std::vector zonesRemoved; + const R2::CScenarioEntryPoints::CCompleteIsland *ci = R2::CScenarioEntryPoints::getInstance().getCompleteIslandFromCoords(CVector2f((float) UserEntity->pos().x, (float) UserEntity->pos().y)); + Landscape->refreshAllZonesAround(View.refinePos(), ClientCfg.Vision + ExtraZoneLoadingVision, zonesAdded, zonesRemoved, ProgressBar, ci ? &(ci->ZoneIDs) : NULL); + LandscapeIGManager.unloadArrayZoneIG(zonesRemoved); + LandscapeIGManager.loadArrayZoneIG(zonesAdded); + } + } + } + } + + //--------------------------------------------------- + if (ClientCfg.Vision != LastClientCfg.Vision || ClientCfg.FoV!=LastClientCfg.FoV || + ClientCfg.Windowed != LastClientCfg.Windowed || ClientCfg.ScreenAspectRatio != LastClientCfg.ScreenAspectRatio ) + { + updateCameraPerspective(); + } + + //--------------------------------------------------- + if (Landscape) + { + if (ClientCfg.MicroVeget != LastClientCfg.MicroVeget) + { + if(ClientCfg.MicroVeget) + { + // if configured, enable the vegetable and load the texture. + Landscape->enableVegetable(true); + // Default setup. TODO later by gameDev. + Landscape->setVegetableWind(CVector(0.5, 0.5, 0).normed(), 0.5, 1, 0); + // Default setup. should work well for night/day transition in 30 minutes. + // Because all vegetables will be updated every 20 seconds => 90 steps. + Landscape->setVegetableUpdateLightingFrequency(1/20.f); + // Density (percentage to ratio) + Landscape->setVegetableDensity(ClientCfg.MicroVegetDensity/100.f); + } + else + { + Landscape->enableVegetable(false); + } + } + } + + //--------------------------------------------------- + if (ClientCfg.MicroVegetDensity != LastClientCfg.MicroVegetDensity) + { + // Density (percentage to ratio) + if (Landscape) Landscape->setVegetableDensity(ClientCfg.MicroVegetDensity/100.f); + } + + // GRAPHICS - SPECIAL EFFECTS + //--------------------------------------------------- + if (ClientCfg.FxNbMaxPoly != LastClientCfg.FxNbMaxPoly) + { + if (Scene->getGroupLoadMaxPolygon("Fx") != ClientCfg.FxNbMaxPoly) + Scene->setGroupLoadMaxPolygon("Fx", ClientCfg.FxNbMaxPoly); + } + + //--------------------------------------------------- + if (ClientCfg.Cloud != LastClientCfg.Cloud) + { + if (ClientCfg.Cloud) + { + InitCloudScape = true; + CloudScape = Scene->createCloudScape(); + } + else + { + if (CloudScape != NULL) + Scene->deleteCloudScape(CloudScape); + CloudScape = NULL; + } + } + + //--------------------------------------------------- + if (ClientCfg.CloudQuality != LastClientCfg.CloudQuality) + { + if (CloudScape != NULL) + CloudScape->setQuality(ClientCfg.CloudQuality); + } + + //--------------------------------------------------- + if (ClientCfg.CloudUpdate != LastClientCfg.CloudUpdate) + { + if (CloudScape != NULL) + CloudScape->setNbCloudToUpdateIn80ms(ClientCfg.CloudUpdate); + } + + //--------------------------------------------------- + if (ClientCfg.Shadows != LastClientCfg.Shadows) + { + // Enable/Disable Receive on Landscape + if(Landscape) + { + Landscape->enableReceiveShadowMap(ClientCfg.Shadows); + } + // Enable/Disable Cast for all entities + for(uint i=0;iupdateCastShadowMap(); + } + } + + // GRAPHICS - CHARACTERS + //--------------------------------------------------- + if (ClientCfg.SkinNbMaxPoly != LastClientCfg.SkinNbMaxPoly) + { + if (Scene->getGroupLoadMaxPolygon("Skin") != ClientCfg.SkinNbMaxPoly) + Scene->setGroupLoadMaxPolygon("Skin", ClientCfg.SkinNbMaxPoly); + } + + //--------------------------------------------------- + if (ClientCfg.NbMaxSkeletonNotCLod != LastClientCfg.NbMaxSkeletonNotCLod ) + { + Scene->setMaxSkeletonsInNotCLodForm(ClientCfg.NbMaxSkeletonNotCLod); + } + + //--------------------------------------------------- + if (ClientCfg.CharacterFarClip != LastClientCfg.CharacterFarClip) + { + // Nothing to do + } + + //--------------------------------------------------- + if (ClientCfg.HDEntityTexture != LastClientCfg.HDEntityTexture) + { + // Don't reload Texture, will be done at next Game Start + } + + // INTERFACE works + + + // INPUTS + //--------------------------------------------------- + if (ClientCfg.CursorSpeed != LastClientCfg.CursorSpeed) + SetMouseSpeed (ClientCfg.CursorSpeed); + + if (ClientCfg.CursorAcceleration != LastClientCfg.CursorAcceleration) + SetMouseAcceleration (ClientCfg.CursorAcceleration); + + if (ClientCfg.HardwareCursor != LastClientCfg.HardwareCursor) + { + if (ClientCfg.HardwareCursor != IsMouseCursorHardware()) + { + InitMouseWithCursor (ClientCfg.HardwareCursor); + } + } + + + // SOUND + //--------------------------------------------------- + bool mustReloadSoundMngrContinent= false; + + // disable/enable sound? + if (ClientCfg.SoundOn != LastClientCfg.SoundOn) + { + if (SoundMngr && !ClientCfg.SoundOn) + { + nlwarning("Deleting sound manager..."); + delete SoundMngr; + SoundMngr = NULL; + } + else if (SoundMngr == NULL && ClientCfg.SoundOn) + { + nlwarning("Creating sound manager..."); + SoundMngr = new CSoundManager(); + try + { + SoundMngr->init(NULL); + } + catch(const Exception &e) + { + nlwarning("init : Error when creating 'SoundMngr' : %s", e.what()); + SoundMngr = 0; + } + + // re-init with good SFX/Music Volume + if(SoundMngr) + { + SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume); + SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume); + } + } + else + { + nlwarning("Sound config error !"); + } + + mustReloadSoundMngrContinent= true; + } + + // change EAX? + if ( SoundMngr && LastClientCfg.SoundOn && + (ClientCfg.UseEax != LastClientCfg.UseEax) ) + { + SoundMngr->reset(); + + mustReloadSoundMngrContinent= true; + } + + // change SoundForceSoftwareBuffer? + if ( SoundMngr && LastClientCfg.SoundOn && + (ClientCfg.SoundForceSoftwareBuffer != LastClientCfg.SoundForceSoftwareBuffer) ) + { + SoundMngr->reset(); + + mustReloadSoundMngrContinent= true; + } + + // change MaxTrack? don't reset + if ( SoundMngr && LastClientCfg.SoundOn && + (ClientCfg.MaxTrack != LastClientCfg.MaxTrack)) + { + SoundMngr->getMixer()->changeMaxTrack(ClientCfg.MaxTrack); + } + + // change SoundFX Volume? don't reset + if (SoundMngr && ClientCfg.SoundSFXVolume != LastClientCfg.SoundSFXVolume) + { + SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume); + } + + // change Game Music Volume? don't reset + if (SoundMngr && ClientCfg.SoundGameMusicVolume != LastClientCfg.SoundGameMusicVolume) + { + SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume); + } + + // reload only if active and reseted + if (mustReloadSoundMngrContinent && SoundMngr && ContinentMngr.cur() && !ContinentMngr.cur()->Indoor && UserEntity) + { + SoundMngr->loadContinent(ContinentMngr.getCurrentContinentSelectName(), UserEntity->pos()); + } + + // Ok backup the new clientcfg + LastClientCfg = ClientCfg; +} + +/* end of file */ \ No newline at end of file diff --git a/code/ryzom/client/src/main_loop_utilities.h b/code/ryzom/client/src/main_loop_utilities.h new file mode 100644 index 000000000..d8ea3dedf --- /dev/null +++ b/code/ryzom/client/src/main_loop_utilities.h @@ -0,0 +1,32 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef CL_MAIN_LOOP_UTILITIES_H +#define CL_MAIN_LOOP_UTILITIES_H + +#include + +// Update Utilities (configuration etc) +// Only put utility update functions here that are used in the main loop. +// This is mainly for system configuration related functions +// such as config file changes. + +/// Compare ClientCfg and LastClientCfg to know what we must update +void updateFromClientCfg(); + +#endif // CL_MAIN_LOOP_UTILITIES_H + +/* end of file */ diff --git a/code/ryzom/client/src/ping.cpp b/code/ryzom/client/src/ping.cpp new file mode 100644 index 000000000..5a07a2b9d --- /dev/null +++ b/code/ryzom/client/src/ping.cpp @@ -0,0 +1,74 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include "ping.h" + +#include "interface_v3/interface_manager.h" +#include "time_client.h" + +using namespace NLMISC; +using namespace NLGUI; + +void CPing::init() +{ + CInterfaceManager *pIM = CInterfaceManager::getInstance(); + if(pIM) + { + CCDBNodeLeaf *pNodeLeaf = CDBManager::getInstance()->getDbProp("SERVER:DEBUG_INFO:Ping", false); + if(pNodeLeaf) + { + ICDBNode::CTextId textId; + pNodeLeaf->addObserver(this, textId); + // nlwarning("CPing: cannot add the observer"); + } + else + nlwarning("CPing: 'SERVER:DEBUG_INFO:Ping' does not exist."); + } +} + +void CPing::release() +{ + CInterfaceManager *pIM = CInterfaceManager::getInstance(); + if(pIM) + { + CCDBNodeLeaf *pNodeLeaf = CDBManager::getInstance()->getDbProp("SERVER:DEBUG_INFO:Ping", false); + if(pNodeLeaf) + { + ICDBNode::CTextId textId; + pNodeLeaf->removeObserver(this, textId); + } + else + nlwarning("CPing: 'SERVER:DEBUG_INFO:Ping' does not exist."); + } +} + +void CPing::update(NLMISC::ICDBNode* node) +{ + CCDBNodeLeaf *leaf = safe_cast(node); + uint32 before = (uint32)leaf->getValue32(); + uint32 current = (uint32)(0xFFFFFFFF & ryzomGetLocalTime()); + if(before > current) + { + //nlwarning("DB PING Pb before '%u' after '%u'.", before, current); + if(ClientCfg.Check) + nlstop; + } + _Ping = current - before; + _RdyToPing = true; +} + +/* end of file */ \ No newline at end of file diff --git a/code/ryzom/client/src/ping.h b/code/ryzom/client/src/ping.h new file mode 100644 index 000000000..46a7e2c13 --- /dev/null +++ b/code/ryzom/client/src/ping.h @@ -0,0 +1,62 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef CL_PING_H +#define CL_PING_H + +#include +#include + +/////////// +// CLASS // +/////////// +/** + * Class to manage the ping computed with the database. + * \author Guillaume PUZIN + * \author Nevrax France + * \date 2003 + */ +class CPing : public NLMISC::ICDBNode::IPropertyObserver +{ +private: + uint32 _Ping; + bool _RdyToPing; + +public: + // Constructor. + CPing() {_Ping = 0; _RdyToPing = true;} + // Destructor. + ~CPing() {;} + + // Add an observer on the database for the ping. + void init(); + + // Release the observer on the database for the ping. + void release(); + + // Method called when the ping message is back. + virtual void update(NLMISC::ICDBNode* node); + + // return the ping in ms. + uint32 getValue() {return _Ping;} + + void rdyToPing(bool rdy) {_RdyToPing = rdy;} + bool rdyToPing() const {return _RdyToPing;} +}; + +#endif // CL_PING_H + +/* end of file */ \ No newline at end of file diff --git a/code/ryzom/client/src/profiling.cpp b/code/ryzom/client/src/profiling.cpp new file mode 100644 index 000000000..a5a0f770f --- /dev/null +++ b/code/ryzom/client/src/profiling.cpp @@ -0,0 +1,160 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include "profiling.h" + +// NeL includes +#include + +// Project includes +#include "misc.h" +#include "sound_manager.h" + +/////////// +// USING // +/////////// +using namespace NLMISC; +using namespace NL3D; + +//////////// +// EXTERN // +//////////// +extern UDriver *Driver; + +///////////// +// GLOBALS // +///////////// +bool Profiling = false; // Are we in Profile mode? +uint ProfileNumFrame = 0; +bool WantProfiling = false; +bool ProfilingVBLock = false; +bool WantProfilingVBLock = false; + +// ******************************************************************** + +/// Test Profiling and run? +void testLaunchProfile() +{ + if(!WantProfiling) + return; + + // comes from ActionHandler + WantProfiling= false; + +#ifdef _PROFILE_ON_ + if( !Profiling ) + { + // start the bench. + NLMISC::CHTimer::startBench(); + ProfileNumFrame = 0; + Driver->startBench(); + if (SoundMngr) + SoundMngr->getMixer()->startDriverBench(); + // state + Profiling= true; + } + else + { + // end the bench. + if (SoundMngr) + SoundMngr->getMixer()->endDriverBench(); + NLMISC::CHTimer::endBench(); + Driver->endBench(); + + + // Display and save profile to a File. + CLog log; + CFileDisplayer fileDisplayer(NLMISC::CFile::findNewFile(getLogDirectory() + "profile.log")); + CStdDisplayer stdDisplayer; + log.addDisplayer(&fileDisplayer); + log.addDisplayer(&stdDisplayer); + // diplay + NLMISC::CHTimer::displayHierarchicalByExecutionPathSorted(&log, CHTimer::TotalTime, true, 48, 2); + NLMISC::CHTimer::displayHierarchical(&log, true, 48, 2); + NLMISC::CHTimer::displayByExecutionPath(&log, CHTimer::TotalTime); + NLMISC::CHTimer::display(&log, CHTimer::TotalTime); + NLMISC::CHTimer::display(&log, CHTimer::TotalTimeWithoutSons); + Driver->displayBench(&log); + + if (SoundMngr) + SoundMngr->getMixer()->displayDriverBench(&log); + + // state + Profiling= false; + } +#endif // #ifdef _PROFILE_ON_ +} + +// ******************************************************************** + +/// Test ProfilingVBLock and run? +void testLaunchProfileVBLock() +{ + // If running, must stop for this frame. + if(ProfilingVBLock) + { + std::vector strs; + Driver->endProfileVBHardLock(strs); + nlinfo("Profile VBLock"); + nlinfo("**************"); + for(uint i=0;iprofileVBHardAllocation(strs); + for(uint i=0;iendProfileIBLock(strs); + nlinfo("Profile Index Buffer Lock"); + nlinfo("**************"); + for(uint i=0;iprofileIBAllocation(strs); + for(uint i=0;istartProfileVBHardLock(); + Driver->startProfileIBLock(); + } +} + +/* end of file */ \ No newline at end of file diff --git a/code/ryzom/client/src/profiling.h b/code/ryzom/client/src/profiling.h new file mode 100644 index 000000000..2499fa20b --- /dev/null +++ b/code/ryzom/client/src/profiling.h @@ -0,0 +1,36 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef CL_PROFILING_H +#define CL_PROFILING_H + +#include + +extern bool Profiling; // Are we in Profile mode? +extern uint ProfileNumFrame; +extern bool WantProfiling; +extern bool ProfilingVBLock; +extern bool WantProfilingVBLock; + +/// Test Profiling and run? +void testLaunchProfile(); + +/// Test ProfilingVBLock and run? +void testLaunchProfileVBLock(); + +#endif // CL_PROFILING_H + +/* end of file */ \ No newline at end of file diff --git a/code/ryzom/client/src/projectile_manager.cpp b/code/ryzom/client/src/projectile_manager.cpp index 80db533c5..6b4e6c7c1 100644 --- a/code/ryzom/client/src/projectile_manager.cpp +++ b/code/ryzom/client/src/projectile_manager.cpp @@ -648,7 +648,7 @@ void CProjectileManager::CProjectile::shutDown(CCharacterCL *target) target->buildAlignMatrix(userMatrix); FX[k].forceSetUserMatrix(userMatrix); } - if (!FX[k].removeByID('STOP') && !FX[k].removeByID('main')) + if (!FX[k].removeByID(NELID("STOP")) && !FX[k].removeByID(NELID("main"))) { FX[k].activateEmitters(false); //nlwarning("Projectile with a particle system that has no 'STOP' emitter"); diff --git a/code/ryzom/client/src/r2/island_collision.cpp b/code/ryzom/client/src/r2/island_collision.cpp index 5018e41aa..fbc5a14ba 100644 --- a/code/ryzom/client/src/r2/island_collision.cpp +++ b/code/ryzom/client/src/r2/island_collision.cpp @@ -429,7 +429,7 @@ CPackedWorld *CIslandCollision::reloadPackedIsland(const CScenarioEntryPoints::C try { CIFile f(CPath::lookup(islandDesc.Island + ".island_hm")); - f.serialCheck((uint32) 'MHSI'); + f.serialCheck(NELID("MHSI")); f.serial(_HeightMap); } catch(const Exception &e) diff --git a/code/ryzom/client/src/release.cpp b/code/ryzom/client/src/release.cpp index 0c975aebe..dae95767c 100644 --- a/code/ryzom/client/src/release.cpp +++ b/code/ryzom/client/src/release.cpp @@ -35,6 +35,7 @@ #include "nel/3d/u_scene.h" #include "nel/3d/u_visual_collision_manager.h" #include "nel/3d/u_shape_bank.h" +#include "nel/3d/stereo_hmd.h" // Client #include "global.h" #include "release.h" @@ -467,8 +468,6 @@ void releaseOutGame() // flush the server string cache STRING_MANAGER::CStringManagerClient::instance()->flushStringCache(); - ClientCfg.release (); - // Disconnect the client from the server. NetMngr.disconnect(); @@ -559,6 +558,15 @@ void release() CEntityAnimationManager::delInstance(); EAM= NULL; + nldebug("VR [C]: VR Shutting down"); + if (StereoDisplay) + { + delete StereoDisplay; + StereoDisplay = NULL; + StereoHMD = NULL; + } + IStereoDisplay::releaseAllLibraries(); + // Delete the driver. if(Driver) { diff --git a/code/ryzom/client/src/string_manager_client.h b/code/ryzom/client/src/string_manager_client.h index 89e05acd0..14f541c10 100644 --- a/code/ryzom/client/src/string_manager_client.h +++ b/code/ryzom/client/src/string_manager_client.h @@ -341,8 +341,8 @@ private: void serial(NLMISC::IStream &f) { - f.serialCheck((uint32)'_RTS'); - f.serialCheck((uint32)'KCAP'); + f.serialCheck(NELID("_RTS")); + f.serialCheck(NELID("KCAP")); f.serialVersion(0); f.serial(PackedVersion); f.serial(LanguageCode); diff --git a/code/ryzom/client/src/timed_fx_manager.cpp b/code/ryzom/client/src/timed_fx_manager.cpp index 6ea6f273b..89b71974f 100644 --- a/code/ryzom/client/src/timed_fx_manager.cpp +++ b/code/ryzom/client/src/timed_fx_manager.cpp @@ -544,7 +544,7 @@ void CTimedFXManager::CManagedFX::shutDown(NL3D::UScene *scene, CFXManager &fxMa // fx isn't spwaned, so must tell fx to stop its emitters if (Instance.isSystemPresent() && Instance.isValid()) { - if (!Instance.removeByID('main') && !Instance.removeByID('STOP')) + if (!Instance.removeByID(NELID("main")) && !Instance.removeByID(NELID("STOP"))) { // if a specific emitter has not be tagged, just stop all emitters if there's no better solution Instance.activateEmitters(false); diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index 5f7fc3868..c8652fd43 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -3552,12 +3552,13 @@ void CUserEntity::CSpeedFactor::update(ICDBNode *node) // virtual //nlinfo("SpeedFactor changed to %f / %"NL_I64"u", _Value, leaf->getValue64()); // clamp the value (2.0 is the egg item or the level 6 speed up power up, nothing should be faster) - if(_Value > 2.0f) - { + // commented because ring editor speed is in fact faster + //if(_Value > 2.0f) + //{ //nlwarning("HACK: you try to change the speed factor to %f", _Value); //nlstop; //_Value = 2.0f; - } + //} }// CSpeedFactor::update // diff --git a/code/ryzom/client/src/view.cpp b/code/ryzom/client/src/view.cpp index ded81013d..4bc52af08 100644 --- a/code/ryzom/client/src/view.cpp +++ b/code/ryzom/client/src/view.cpp @@ -183,7 +183,6 @@ CVector CView::currentViewPos() const //----------------------------------------------- // currentView : -// Set the user position. //----------------------------------------------- CVector CView::currentView() const { @@ -200,6 +199,14 @@ CVector CView::currentView() const return _View; }// currentView // +NLMISC::CQuat CView::currentViewQuat() const +{ + CMatrix mat; + mat.setRot(CVector::I, currentView(), CVector::K); + mat.normalize(CMatrix::YZX); + return mat.getRot(); +} + //----------------------------------------------- // currentCameraTarget : //----------------------------------------------- diff --git a/code/ryzom/client/src/view.h b/code/ryzom/client/src/view.h index 69fcea994..e1c57d4ca 100644 --- a/code/ryzom/client/src/view.h +++ b/code/ryzom/client/src/view.h @@ -115,6 +115,8 @@ public: CVector currentViewPos() const; // Return the current view (rear or normal) CVector currentView() const; + // Return the current view as a quaternion + NLMISC::CQuat currentViewQuat() const; // Return the current Camera Target (for 3rd person only. 1st person: return currentViewPos()) CVector currentCameraTarget() const; diff --git a/code/ryzom/common/data_common/database.xml b/code/ryzom/common/data_common/database.xml index 6157693c6..fc0d1d209 100644 --- a/code/ryzom/common/data_common/database.xml +++ b/code/ryzom/common/data_common/database.xml @@ -1,1665 +1,1665 @@ - - - - - - - inline void _setProp(CCDBSynchronised &db, - ICDBStructNode *node, TCharConnectionState value, bool - forceSending = false) { db.x_setProp(node, uint64(value), - forceSending); } inline void _getProp(const CCDBSynchronised - &db, ICDBStructNode *node, TCharConnectionState - &value) { value = - (TCharConnectionState)db.x_getProp(node); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + inline void _setProp(CCDBSynchronised &db, + ICDBStructNode *node, TCharConnectionState value, bool + forceSending = false) { db.x_setProp(node, uint64(value), + forceSending); } inline void _getProp(const CCDBSynchronised + &db, ICDBStructNode *node, TCharConnectionState + &value) { value = + (TCharConnectionState)db.x_getProp(node); } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/ryzom/common/data_common/msg.xml b/code/ryzom/common/data_common/msg.xml index df2011edf..3fa75650e 100644 --- a/code/ryzom/common/data_common/msg.xml +++ b/code/ryzom/common/data_common/msg.xml @@ -1,1165 +1,1165 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/ryzom/common/src/game_share/persistent_data_template.h b/code/ryzom/common/src/game_share/persistent_data_template.h index 87a110d16..560603f0a 100644 --- a/code/ryzom/common/src/game_share/persistent_data_template.h +++ b/code/ryzom/common/src/game_share/persistent_data_template.h @@ -325,9 +325,11 @@ static _TOKENS_CLASSNAME _TOKENS_OBJNAME; #else +#ifdef NL_OS_WINDOWS #pragma message( " ") #pragma message( "NON-OPTIMISED: Persistent data class " NL_MACRO_TO_STR(PERSISTENT_CLASS) " not using a token family") #pragma message( " ") +#endif #endif diff --git a/code/ryzom/common/src/game_share/security_check.cpp b/code/ryzom/common/src/game_share/security_check.cpp index bbc0d46d1..6acd2aeac 100644 --- a/code/ryzom/common/src/game_share/security_check.cpp +++ b/code/ryzom/common/src/game_share/security_check.cpp @@ -43,7 +43,7 @@ void CSecurityCheckForFastDisconnection::forwardSecurityCode(NLMISC::IStream& ms } // -CSecurityCode CSecurityCheckForFastDisconnection::encode(char *passPhrase) +CSecurityCode CSecurityCheckForFastDisconnection::encode(const char *passPhrase) { if (!passPhrase) throw Exception("Null passPhrase"); @@ -56,7 +56,7 @@ CSecurityCode CSecurityCheckForFastDisconnection::encode(char *passPhrase) } // -void CSecurityCheckForFastDisconnection::check(char *passPhrase) +void CSecurityCheckForFastDisconnection::check(const char *passPhrase) { if (SecurityCode != encode(passPhrase)) throw Exception("Check not passed"); diff --git a/code/ryzom/common/src/game_share/security_check.h b/code/ryzom/common/src/game_share/security_check.h index 60c736f72..640fec93a 100644 --- a/code/ryzom/common/src/game_share/security_check.h +++ b/code/ryzom/common/src/game_share/security_check.h @@ -61,9 +61,9 @@ public: /// Set cookie void setCookie(const NLNET::CLoginCookie& cookie) { Block.Cookie.set(cookie.getUserAddr(), cookie.getUserKey(), cookie.getUserId()); } // don't use the default generated bitwise assignment operator, because of padding junk that would be copied /// Return the security code - CSecurityCode encode(char *passPhrase); + CSecurityCode encode(const char *passPhrase); /// Check the security code - void check(char *passPhrase); + void check(const char *passPhrase); /// Read some data from stream void receiveSecurityCode(NLMISC::IStream& msgin); diff --git a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp index 6a15900d0..b593c7a37 100644 --- a/code/ryzom/server/src/ai_data_service/pacs_scan.cpp +++ b/code/ryzom/server/src/ai_data_service/pacs_scan.cpp @@ -2277,7 +2277,7 @@ public: sint32 xmax = (sint32) max.x(); sint32 ymin = (sint32) (sint16) min.y(); sint32 ymax = (sint32) (sint16) max.y(); - output.serialCheck((uint32) 'OBSI'); + output.serialCheck(NELID("OBSI")); output.serial(xmin); output.serial(xmax); output.serial(ymin); diff --git a/code/ryzom/server/src/ai_service/ai_pos_mirror_inline.h b/code/ryzom/server/src/ai_service/ai_pos_mirror_inline.h index b75c54f1a..4185adafa 100644 --- a/code/ryzom/server/src/ai_service/ai_pos_mirror_inline.h +++ b/code/ryzom/server/src/ai_service/ai_pos_mirror_inline.h @@ -155,6 +155,11 @@ inline double CAIVectorMirror::distTo(const CAIPos &dest) const return (dest-CAIVector(*this)).norm(); } +inline double CAIVectorMirror::distSqTo(const CAIPos &dest) const +{ + return (dest-CAIVector(*this)).sqrnorm(); +} + inline double CAIVectorMirror::quickDistTo(const CAIPos &dest) const { double dx=fabs((dest.x()-x()).asDouble()), dy=fabs((dest.y()-y()).asDouble()); @@ -172,6 +177,11 @@ inline double CAIVectorMirror::distTo(const CAIVector &dest) const return (dest-CAIVector(*this)).norm(); } +inline double CAIVectorMirror::distSqTo(const CAIVector &dest) const +{ + return (dest-CAIVector(*this)).sqrnorm(); +} + inline double CAIVectorMirror::quickDistTo(const CAIVector &dest) const { double dx=fabs((dest.x()-x()).asDouble()), dy=fabs((dest.y()-y()).asDouble()); @@ -189,6 +199,11 @@ inline double CAIVectorMirror::distTo(const CAIVectorMirror &dest) const return (dest-*this).norm(); } +inline double CAIVectorMirror::distSqTo(const CAIVectorMirror &dest) const +{ + return (dest-*this).sqrnorm(); +} + inline double CAIVectorMirror::quickDistTo(const CAIVectorMirror &dest) const { double dx=fabs((dest.x()-x()).asDouble()), dy=fabs((dest.y()-y()).asDouble()); return (dx>dy)? (dx+dy/2): (dy+dx/2); diff --git a/code/ryzom/server/src/ai_service/ai_profile_fauna.cpp b/code/ryzom/server/src/ai_service/ai_profile_fauna.cpp index 41b0504d9..354cccdfc 100644 --- a/code/ryzom/server/src/ai_service/ai_profile_fauna.cpp +++ b/code/ryzom/server/src/ai_service/ai_profile_fauna.cpp @@ -310,9 +310,9 @@ void CWanderFaunaProfile::updateProfile(uint ticksSinceLastUpdate) CFollowPathContext fpcWanderFaunaProfileUpdate("WanderFaunaProfileUpdate"); // calculate distance from bot position to magnet point (used in all the different processes) - _magnetDist=_Bot->pos().distTo(_Bot->spawnGrp().magnetPos()); - - if (_magnetDist>_Bot->spawnGrp().magnetRadiusFar()) + _magnetDistSq=_Bot->pos().distSqTo(_Bot->spawnGrp().magnetPos()); + double grpMagnetRadiusFar=_Bot->spawnGrp().magnetRadiusFar(); + if (_magnetDistSq>(grpMagnetRadiusFar*grpMagnetRadiusFar)) { _Bot->setMode( MBEHAV::NORMAL ); @@ -405,11 +405,12 @@ void CGrazeFaunaProfile::updateProfile(uint ticksSinceLastUpdate) CFollowPathContext fpcGrazeFaunaProfileUpdate("GrazeFaunaProfileUpdate"); // calculate distance from bot position to magnet point (used in all the different processes) - _magnetDist=_Bot->pos().distTo(_Bot->spawnGrp().magnetPos()); + _magnetDistSq=_Bot->pos().distSqTo(_Bot->spawnGrp().magnetPos()); if (!_ArrivedInZone) { - if (_magnetDist>_Bot->spawnGrp().magnetRadiusFar()) + float grpMagnetRadiusFar=_Bot->spawnGrp().magnetRadiusFar(); + if (_magnetDistSq>(grpMagnetRadiusFar*grpMagnetRadiusFar)) { _Bot->setMode( MBEHAV::NORMAL ); @@ -501,7 +502,8 @@ void CGrazeFaunaProfile::updateProfile(uint ticksSinceLastUpdate) } // && _state==0 ) // means wait in movementmagnet. - if ( _magnetDist<=_Bot->spawnGrp().magnetRadiusNear() + const float grpMagnetRadiusNear=_Bot->spawnGrp().magnetRadiusNear(); + if ( _magnetDistSq<=(grpMagnetRadiusNear*grpMagnetRadiusNear) && _MovementMagnet->getMovementType()==CMovementMagnet::Movement_Anim) { if (_Bot->getPersistent().grp().getType()==AITYPES::FaunaTypePredator) @@ -564,11 +566,12 @@ void CRestFaunaProfile::updateProfile(uint ticksSinceLastUpdate) CFollowPathContext fpcRestFaunaProfileUpdate("RestFaunaProfileUpdate"); // calculate distance from bot position to magnet point (used in all the different processes) - _magnetDist=_Bot->pos().distTo(_Bot->spawnGrp().magnetPos()); + _magnetDistSq=_Bot->pos().distSqTo(_Bot->spawnGrp().magnetPos()); if (!_ArrivedInZone) { - if (_magnetDist>_Bot->spawnGrp().magnetRadiusFar()) + float grpMagnetRadiusFar=_Bot->spawnGrp().magnetRadiusFar(); + if (_magnetDistSq>(grpMagnetRadiusFar*grpMagnetRadiusFar)) { if (!_OutOfMagnet) { @@ -656,7 +659,8 @@ void CRestFaunaProfile::updateProfile(uint ticksSinceLastUpdate) break; } - if ( _magnetDist<=_Bot->spawnGrp().magnetRadiusNear() + const float grpMagnetRadiusNear=_Bot->spawnGrp().magnetRadiusNear(); + if ( _magnetDistSq<=(grpMagnetRadiusNear*grpMagnetRadiusNear) && _MovementMagnet->getMovementType()==CMovementMagnet::Movement_Anim) { _Bot->setMode(MBEHAV::REST); diff --git a/code/ryzom/server/src/ai_service/ai_profile_fauna.h b/code/ryzom/server/src/ai_service/ai_profile_fauna.h index 1c3499080..e85f2b709 100644 --- a/code/ryzom/server/src/ai_service/ai_profile_fauna.h +++ b/code/ryzom/server/src/ai_service/ai_profile_fauna.h @@ -137,7 +137,7 @@ public: protected: RYAI_MAP_CRUNCH::TAStarFlag _DenyFlags; CSpawnBotFauna* _Bot; - double _magnetDist; ///< distance from bot to his magnet at last move + double _magnetDistSq; ///< square distance from bot to his magnet at last move static CFaunaProfileFloodLogger _FloodLogger; }; @@ -166,7 +166,7 @@ private: CAITimer _CycleTimer; uint _CycleTimerBaseTime; bool _ArrivedInZone; - double _magnetDist; ///< distance from bot to his magnet at last move + double _magnetDistSq; ///< square distance from bot to his magnet at last move RYAI_MAP_CRUNCH::TAStarFlag _DenyFlags; static CFaunaProfileFloodLogger _FloodLogger; }; @@ -196,7 +196,7 @@ private: CAITimer _CycleTimer; uint _CycleTimerBaseTime; bool _ArrivedInZone; - double _magnetDist; // distance from bot to his magnet at last move + double _magnetDistSq; // square distance from bot to his magnet at last move RYAI_MAP_CRUNCH::TAStarFlag _DenyFlags; static CFaunaProfileFloodLogger _FloodLogger; }; diff --git a/code/ryzom/server/src/ai_service/ai_vector_mirror.h b/code/ryzom/server/src/ai_service/ai_vector_mirror.h index dc03305bc..0464de4fb 100644 --- a/code/ryzom/server/src/ai_service/ai_vector_mirror.h +++ b/code/ryzom/server/src/ai_service/ai_vector_mirror.h @@ -83,14 +83,17 @@ public: // Methods. // a few handy utility methods inline CAngle angleTo(const CAIPos &dest) const; inline double distTo(const CAIPos &dest) const; + inline double distSqTo(const CAIPos &dest) const; inline double quickDistTo(const CAIPos &dest) const; inline CAngle angleTo(const CAIVector &dest) const; inline double distTo(const CAIVector &dest) const; + inline double distSqTo(const CAIVector &dest) const; inline double quickDistTo(const CAIVector &dest) const; inline CAngle angleTo(const CAIVectorMirror &dest) const; inline double distTo(const CAIVectorMirror &dest) const; + inline double distSqTo(const CAIVectorMirror &dest) const; inline double quickDistTo(const CAIVectorMirror &dest) const; protected: diff --git a/code/ryzom/server/src/ai_service/commands.cpp b/code/ryzom/server/src/ai_service/commands.cpp index 92193e6c5..07e9023bf 100644 --- a/code/ryzom/server/src/ai_service/commands.cpp +++ b/code/ryzom/server/src/ai_service/commands.cpp @@ -1700,7 +1700,7 @@ NLMISC_COMMAND(scriptHex,"execute a hex-encoded script for a group in the given return true; } -static char* hexEncoderTcl = +static const char* hexEncoderTcl = "proc copy_encoded {} {" " # Get the args from the text fields" " set group [ .group.name get 1.0 end ]" diff --git a/code/ryzom/server/src/ai_service/nf_grp_npc.cpp b/code/ryzom/server/src/ai_service/nf_grp_npc.cpp index 0672269fc..25fd7e4e0 100644 --- a/code/ryzom/server/src/ai_service/nf_grp_npc.cpp +++ b/code/ryzom/server/src/ai_service/nf_grp_npc.cpp @@ -1607,6 +1607,7 @@ Then user events are triggered on the group to inform it about what happens: - user_event_3: triggered after the player has given the mission items to the npc. Warning: this function can only be called after the event "player_target_npc". +Warning: only works on an R2 shard for R2 plot items. Arguments: s(missionItems), s(missionText), c(groupToNotify) -> @param[in] missionItems is the list of mission items, the string format is "item1:qty1;item2:qty2;...". @@ -1709,38 +1710,6 @@ void receiveMissionItems_ssc_(CStateInstance* entity, CScriptStack& stack) DEBUG_STOP; return; } - // if LD use this the function outside a ring shard - if (IsRingShard) - { - - // Here we destroy the item: so we do not want that a user create a scenario where we destroy - // other players precious items - - static std::set r2PlotItemSheetId; // :TODO: use R2Share::CRingAccess - // lazy intialisation - if (r2PlotItemSheetId.empty()) - { - for (uint32 i = 0 ; i <= 184 ; ++i) - { - r2PlotItemSheetId.insert( CSheetId( NLMISC::toString("r2_plot_item_%d.sitem", i))); - } - } - - // A npc give a mission to take an item given by another npc - // but the item instead of being a r2_plot_item is a normal item like system_mp or big armor - if ( r2PlotItemSheetId.find(sheetId) == r2PlotItemSheetId.end()) - { - nlwarning("!!!!!!!!!!!!"); - nlwarning("!!!!!!!!!!!! Someone is trying to hack us"); - nlwarning("!!!!!!!!!!!!"); - nlwarning("ERROR/HACK : an npc is trying to give to a player a item that is not a plot item SheetId='%s' sheetIdAsInt=%u",sheetId.toString().c_str(), sheetId.asInt()); - nlwarning("His ai instanceId is %u, use log to know the sessionId and the user ", msg.InstanceId ); - nlwarning("!!!!!!!!!!!!"); - nlwarning("!!!!!!!!!!!!"); - return ; - } - - } uint32 quantity; NLMISC::fromString(itemAndQty[1], quantity); @@ -1774,6 +1743,7 @@ Then user events are triggered on the group to inform it about what happens: - user_event_1: triggered after the player has received the mission items from the npc. Warning: this function can only be called after the event "player_target_npc". +Warning: only works on an R2 shard for R2 plot items. Arguments: s(missionItems), s(missionText), c(groupToNotify) -> @param[in] missionItems is the list of mission items, the string format is "item1:qty1;item2:qty2;...". @@ -1877,37 +1847,6 @@ void giveMissionItems_ssc_(CStateInstance* entity, CScriptStack& stack) return; } - - // if LD use this the function outside a ring shard - if (IsRingShard) - { - - static std::set r2PlotItemSheetId; // :TODO: use R2Share::CRingAccess - // lazy intialisation - if (r2PlotItemSheetId.empty()) - { - for (uint32 i = 0 ; i <= 184 ; ++i) - { - r2PlotItemSheetId.insert( CSheetId( NLMISC::toString("r2_plot_item_%d.sitem", i))); - } - } - - // A npc give a mission to give a item to another npc - // but the item instead of being a r2_plot_item is a normal item like system_mp or big armor - if ( r2PlotItemSheetId.find(sheetId) == r2PlotItemSheetId.end()) - { - nlwarning("!!!!!!!!!!!!"); - nlwarning("!!!!!!!!!!!! Someone is trying to hack us"); - nlwarning("!!!!!!!!!!!!"); - nlwarning("ERROR/HACK : an npc is trying to give to a player a item that is not a plot item SheetId='%s' sheetIdAsInt=%u",sheetId.toString().c_str(), sheetId.asInt()); - nlwarning("His ai instanceId is %u, use log to know the sessionId and the user ", msg.InstanceId ); - nlwarning("!!!!!!!!!!!!"); - nlwarning("!!!!!!!!!!!!"); - return ; - } - - } - uint32 quantity; NLMISC::fromString(itemAndQty[1], quantity); if (quantity == 0) diff --git a/code/ryzom/server/src/ai_share/ai_spawn_commands.h b/code/ryzom/server/src/ai_share/ai_spawn_commands.h index 96f2d99a0..059f08f1b 100644 --- a/code/ryzom/server/src/ai_share/ai_spawn_commands.h +++ b/code/ryzom/server/src/ai_share/ai_spawn_commands.h @@ -1,59 +1,59 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - - +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + + #ifndef RYAI_SPAWN_COMMANDS_H #define RYAI_SPAWN_COMMANDS_H - -#include "nel/misc/types_nl.h" -#include "nel/misc/debug.h" - -#include - - -//class CAISpawnCtrl -//{ -//public: -// static bool spawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawn(aiInstance, name); } -// static bool spawnMap (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnMap(aiInstance, name); } -// static bool spawnMgr (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnMgr(aiInstance, name); } -// static bool spawnGrp (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnGrp(aiInstance, name); } -// static bool spawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnAll(aiInstance); } -// -// static bool despawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawn(aiInstance, name); } -// static bool despawnMap (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnMap(aiInstance, name); } -// static bool despawnMgr (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnMgr(aiInstance, name); } -// static bool despawnGrp (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnGrp(aiInstance, name); } -// static bool despawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnAll(aiInstance); } -// -//protected: -// virtual bool _spawn (int aiInstance, const std::string &name)=0; -// virtual bool _spawnMap (int aiInstance, const std::string &name)=0; -// virtual bool _spawnMgr (int aiInstance, const std::string &name)=0; -// virtual bool _spawnGrp (int aiInstance, const std::string &name)=0; -// virtual bool _spawnAll (int aiInstance)=0; -// -// virtual bool _despawn (int aiInstance, const std::string &name)=0; -// virtual bool _despawnMap (int aiInstance, const std::string &name)=0; -// virtual bool _despawnMgr (int aiInstance, const std::string &name)=0; -// virtual bool _despawnGrp (int aiInstance, const std::string &name)=0; -// virtual bool _despawnAll (int aiInstance)=0; -// -// static CAISpawnCtrl *_instance; -//}; - -#endif + +#include "nel/misc/types_nl.h" +#include "nel/misc/debug.h" + +#include + + +//class CAISpawnCtrl +//{ +//public: +// static bool spawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawn(aiInstance, name); } +// static bool spawnMap (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnMap(aiInstance, name); } +// static bool spawnMgr (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnMgr(aiInstance, name); } +// static bool spawnGrp (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnGrp(aiInstance, name); } +// static bool spawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_spawnAll(aiInstance); } +// +// static bool despawn (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawn(aiInstance, name); } +// static bool despawnMap (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnMap(aiInstance, name); } +// static bool despawnMgr (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnMgr(aiInstance, name); } +// static bool despawnGrp (const std::string &name, int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnGrp(aiInstance, name); } +// static bool despawnAll (int aiInstance=-1) { nlassert(_instance!=NULL); return _instance->_despawnAll(aiInstance); } +// +//protected: +// virtual bool _spawn (int aiInstance, const std::string &name)=0; +// virtual bool _spawnMap (int aiInstance, const std::string &name)=0; +// virtual bool _spawnMgr (int aiInstance, const std::string &name)=0; +// virtual bool _spawnGrp (int aiInstance, const std::string &name)=0; +// virtual bool _spawnAll (int aiInstance)=0; +// +// virtual bool _despawn (int aiInstance, const std::string &name)=0; +// virtual bool _despawnMap (int aiInstance, const std::string &name)=0; +// virtual bool _despawnMgr (int aiInstance, const std::string &name)=0; +// virtual bool _despawnGrp (int aiInstance, const std::string &name)=0; +// virtual bool _despawnAll (int aiInstance)=0; +// +// static CAISpawnCtrl *_instance; +//}; + +#endif diff --git a/code/ryzom/server/src/ai_share/ai_vector.h b/code/ryzom/server/src/ai_share/ai_vector.h index 34a82bb82..8c818b70a 100644 --- a/code/ryzom/server/src/ai_share/ai_vector.h +++ b/code/ryzom/server/src/ai_share/ai_vector.h @@ -130,6 +130,7 @@ public: // Methods. template CAngle angleTo(const V &v) const { return CAngle(atan2((v.y()-y()).asDouble(), (v.x()-x()).asDouble())); } template double distTo(const V &v) const { return (*this-v).norm(); } + template double distSqTo(const V &v) const { return (*this-v).sqrnorm(); } template double quickDistTo(const V &v) const { double dx=fabs((v.x()-x()).asDouble()), dy=fabs((v.y()-y()).asDouble()); return (dx>dy)? (dx+dy/2): (dy+dx/2); } diff --git a/code/ryzom/server/src/ai_share/world_map.cpp b/code/ryzom/server/src/ai_share/world_map.cpp index fae9ad50f..eae84acbf 100644 --- a/code/ryzom/server/src/ai_share/world_map.cpp +++ b/code/ryzom/server/src/ai_share/world_map.cpp @@ -553,7 +553,7 @@ void CWorldMap::clear() void CWorldMap::serial(NLMISC::IStream &f) { - f.serialCheck((uint32)'WMAP'); + f.serialCheck(NELID("WMAP")); // Version // 0: initial version diff --git a/code/ryzom/server/src/ai_share/world_map.h b/code/ryzom/server/src/ai_share/world_map.h index 48dcfee77..f9e46ecfc 100644 --- a/code/ryzom/server/src/ai_share/world_map.h +++ b/code/ryzom/server/src/ai_share/world_map.h @@ -1633,18 +1633,27 @@ CTopology::CTopology() { } +// convert a 2 characters string to uint16 +#ifdef NL_LITTLE_ENDIAN +# define NELID16(x) (uint16((x[0] << 8) | (x[1]))) +#else +# define NELID16(x) (uint16((x[1] << 8) | (x[0]))) +#endif + + + inline void CTopology::serial(NLMISC::IStream& f) { uint version = 0; - uint16 check = (uint16)'Tp'; + uint16 check = NELID16("Tp"); f.serial(check); - if (check != (uint16)'TP') + if (check != NELID16("TP")) { - nlassert(check == (uint16)'Tp'); + nlassert(check == NELID16("Tp")); version = f.serialVersion(3); } @@ -2285,7 +2294,7 @@ sint CWhiteCell::getHeight(CWorldPosition const& wpos) const inline void CWhiteCell::serial(NLMISC::IStream& f) { - f.serialCheck((uint16)'WC'); + f.serialCheck(NELID16("WC")); if (f.isReading()) _HeightMap = I16x16Layer::load(f); else diff --git a/code/ryzom/server/src/entities_game_service/fame_pd.cpp b/code/ryzom/server/src/entities_game_service/fame_pd.cpp index cf27d6459..db2104c5d 100644 --- a/code/ryzom/server/src/entities_game_service/fame_pd.cpp +++ b/code/ryzom/server/src/entities_game_service/fame_pd.cpp @@ -21,7 +21,7 @@ namespace EGSPD { -static const struct { char* Name; CFameTrend::TFameTrend Value; } TFameTrendConvert[] = +static const struct { const char* Name; CFameTrend::TFameTrend Value; } TFameTrendConvert[] = { { "FameUpward", CFameTrend::FameUpward }, { "FameDownward", CFameTrend::FameDownward }, diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.cpp b/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.cpp index f62af0007..03a105445 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.cpp +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild_member_module.cpp @@ -494,7 +494,7 @@ bool CGuildMemberModule::canAffectGrade(EGSPD::CGuildGrade::TGuildGrade)const CMissionGuild * CGuildMemberModule::pickMission( TAIAlias alias ) { /// todo guild mission - return false; + return NULL; } //---------------------------------------------------------------------------- diff --git a/code/ryzom/server/src/entities_game_service/harvest_source.cpp b/code/ryzom/server/src/entities_game_service/harvest_source.cpp index 6c5f85a61..dcae55a60 100644 --- a/code/ryzom/server/src/entities_game_service/harvest_source.cpp +++ b/code/ryzom/server/src/entities_game_service/harvest_source.cpp @@ -1270,7 +1270,7 @@ bool forageTestDoExtract( testSource->extractMaterial( req, abs, ForageQualityCeilingFactor.get(), ForageQualitySlowFactor.get(), res, successFactor, 0, row, propDrop ); fprintf( f, "%g;%g;%g;%g;%g;%g;%g;%g;%g;%u;%u;\n", res[CHarvestSource::A], res[CHarvestSource::Q], - testSource->getD(), testSource->getE(), 0 /*testSource->getC()*/, + testSource->getD(), testSource->getE(), 0.f /*testSource->getC()*/, reqS, reqA, reqQ, testSource->quantity(), testSource->getImpactScheme()*5, 127 ); if ( (!eventD) && (testSource->getD() > 127) ) diff --git a/code/ryzom/server/src/entities_game_service/modules/r2_mission_item.cpp b/code/ryzom/server/src/entities_game_service/modules/r2_mission_item.cpp index d51682761..7feea7f00 100644 --- a/code/ryzom/server/src/entities_game_service/modules/r2_mission_item.cpp +++ b/code/ryzom/server/src/entities_game_service/modules/r2_mission_item.cpp @@ -26,6 +26,7 @@ #include "player_manager/player_manager.h" #include "player_manager/character.h" #include "server_share/log_item_gen.h" +#include "egs_sheets/egs_sheets.h" using namespace std; using namespace NLMISC; @@ -155,46 +156,58 @@ void CR2MissionItem::giveMissionItem(const NLMISC::CEntityId &eid, TSessionId se std::vector< CGameItemPtr > itemDropToEgg; for( uint32 j = 0; j < items.size(); ++j ) { - CGameItemPtr item = c->createItem(1, items[j].Quantity, items[j].SheetId); - - if( item != NULL ) + const CStaticItem* sitem = CSheets::getForm(items[j].SheetId); + if (sitem == NULL) { - if( c->addItemToInventory(INVENTORIES::bag, item) ) - { -/* // check eid is registered as character have instantiated mission item for this scenario - TMissionItemInstanciatedOwner::iterator it = _OwnerOfInstanciatedItemFromScenario.find(scenarioId); - if( it == _OwnerOfInstanciatedItemFromScenario.end() ) - { - pair< TMissionItemInstanciatedOwner::iterator, bool > ret = _OwnerOfInstanciatedItemFromScenario.insert( make_pair( scenarioId, vector< CEntityId >() ) ); - if( ret.second ) - { - (*ret.first).second.push_back( eid ); - } - } - else - { - bool found = false; - for( uint32 i = 0; i < (*it).second.size(); ++ i ) - { - if( (*it).second[i] == eid ) - { - found = true; - break; - } - } - if ( ! found) { (*it).second.push_back(eid); } - } -*/ - keepR2ItemAssociation(eid, scenarioId); - } - else - { - itemDropToEgg.push_back(item); - } + nlwarning("Attempted to give deprecated sitem sheet %s to player character %s in session %i", items[j].SheetId.toString().c_str(), c->getName().toUtf8().c_str(), sessionId.asInt()); + } + else if (sitem->Family != ITEMFAMILY::SCROLL_R2) + { + nlwarning("Attempted hack to give non-R2 item %s to player character %s in session %i", items[j].SheetId.toString().c_str(), c->getName().toUtf8().c_str(), sessionId.asInt()); } else { - nlwarning("CR2MissionItem::giveMissionItem: can't create item %s", items[j].SheetId.toString().c_str()); + CGameItemPtr item = c->createItem(1, items[j].Quantity, items[j].SheetId); + + if( item != NULL ) + { + if( c->addItemToInventory(INVENTORIES::bag, item) ) + { + /* // check eid is registered as character have instantiated mission item for this scenario + TMissionItemInstanciatedOwner::iterator it = _OwnerOfInstanciatedItemFromScenario.find(scenarioId); + if( it == _OwnerOfInstanciatedItemFromScenario.end() ) + { + pair< TMissionItemInstanciatedOwner::iterator, bool > ret = _OwnerOfInstanciatedItemFromScenario.insert( make_pair( scenarioId, vector< CEntityId >() ) ); + if( ret.second ) + { + (*ret.first).second.push_back( eid ); + } + } + else + { + bool found = false; + for( uint32 i = 0; i < (*it).second.size(); ++ i ) + { + if( (*it).second[i] == eid ) + { + found = true; + break; + } + } + if ( ! found) { (*it).second.push_back(eid); } + } + */ + keepR2ItemAssociation(eid, scenarioId); + } + else + { + itemDropToEgg.push_back(item); + } + } + else + { + nlwarning("CR2MissionItem::giveMissionItem: can't create item %s", items[j].SheetId.toString().c_str()); + } } } if(itemDropToEgg.size() != 0) @@ -273,24 +286,36 @@ void CR2MissionItem::destroyMissionItem(const NLMISC::CEntityId &eid, const std: CSheetId itemSheetId = items[j].SheetId; uint32 quantity = items[j].Quantity; - CInventoryPtr inv = c->getInventory(INVENTORIES::bag); - nlassert( inv != NULL ); - _destroyMissionItem( inv, itemSheetId, quantity ); - if( quantity > 0) + const CStaticItem* sitem = CSheets::getForm(items[j].SheetId); + if (sitem == NULL) { - for( uint32 j = INVENTORIES::pet_animal; j < INVENTORIES::max_pet_animal; ++j ) - { - inv = c->getInventory((INVENTORIES::TInventory)j); - nlassert(inv != NULL); - _destroyMissionItem( inv, itemSheetId, quantity ); - if(quantity == 0) - break; - } + nlwarning("Attempted to take deprecated sitem sheet %s from player character %s", items[j].SheetId.toString().c_str(), c->getName().toUtf8().c_str()); + } + else if (sitem->Family != ITEMFAMILY::SCROLL_R2) + { + nlwarning("Attempted hack to take non-R2 item %s from player character %s", items[j].SheetId.toString().c_str(), c->getName().toUtf8().c_str()); + } + else + { + CInventoryPtr inv = c->getInventory(INVENTORIES::bag); + nlassert( inv != NULL ); + _destroyMissionItem( inv, itemSheetId, quantity ); + if( quantity > 0) + { + for( uint32 j = INVENTORIES::pet_animal; j < INVENTORIES::max_pet_animal; ++j ) + { + inv = c->getInventory((INVENTORIES::TInventory)j); + nlassert(inv != NULL); + _destroyMissionItem( inv, itemSheetId, quantity ); + if(quantity == 0) + break; + } + } + // TODO: if we can't found enough quantity of item to destroy, we need decide if we must manage that as an error + // if(quantity > 0) + // { + // } } - // TODO: if we can't found enough quantity of item to destroy, we need decide if we must manage that as an error -// if(quantity > 0) -// { -// } } } } diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/combat_action.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/combat_action.cpp index ac50c52cd..c6cddb5e5 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/combat_action.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/combat_action.cpp @@ -29,11 +29,8 @@ CCombatAction * CCombatAIActionFactory::buildAiAction(const CStaticAiAction *aiA nlassert(phrase); #endif const AI_ACTION::TAiActionType actionType = aiAction->getType(); - if (actionType != AI_ACTION::Melee && actionType != AI_ACTION::Range) - { - return false; - } - + if (actionType != AI_ACTION::Melee && actionType != AI_ACTION::Range) return NULL; + AI_ACTION::TAiEffectType effectType = aiAction->getData().Combat.EffectFamily; //get appropriate factory diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp index fbb16a296..010176023 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/fg_prospection_phrase.cpp @@ -1936,7 +1936,7 @@ void CDepositMapsBatchTask::run() CSString res; disp.write( res ); res = res.replace( "\n", "
\n" ); - fprintf( outputF, res.c_str() ); + fprintf( outputF, "%s", res.c_str() ); // Close files fclose( inputF ); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character_interface.h b/code/ryzom/server/src/entities_game_service/player_manager/character_interface.h index ecc133f54..7e6a47064 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character_interface.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/character_interface.h @@ -22,13 +22,17 @@ class CEntityState; class COfflineEntityState; class CCharacterRespawnPoints; class CFarPosition; -class NLNET::CMessage; class CModuleParent; +namespace NLNET +{ + class CMessage; +} + namespace R2 { struct TUserRole; -}; +} class CRingRewardPoints; diff --git a/code/ryzom/server/src/general_utilities_service/stat_char_commands.cpp b/code/ryzom/server/src/general_utilities_service/stat_char_commands.cpp index 1db7c68b8..a8203bb03 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_char_commands.cpp +++ b/code/ryzom/server/src/general_utilities_service/stat_char_commands.cpp @@ -349,13 +349,13 @@ static std::string getActiveOutputPath() if (TheCharScanScriptFile==NULL) { nlwarning("There is no active script file right now from which to extract output directory"); - return false; + return ""; } bool isOK=true; // write the current script file to a tmp file isOK=TheCharScanScriptFile->writeToFile(TmpScriptFileName); - if (!isOK) return false; + if (!isOK) return ""; // create a new script object and assign the tmp file to it CCharScanScript script; diff --git a/code/ryzom/server/src/input_output_service/chat_manager.cpp b/code/ryzom/server/src/input_output_service/chat_manager.cpp index a4765c300..50c58fce6 100644 --- a/code/ryzom/server/src/input_output_service/chat_manager.cpp +++ b/code/ryzom/server/src/input_output_service/chat_manager.cpp @@ -636,6 +636,18 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr ) { if (session->WriteRight) // player must have the right to speak in the channel { + // If universal channel check if player muted + if (session->getChan()->UniversalChannel) + { + if(_MutedUsers.find( eid ) != _MutedUsers.end()) + { + nldebug("IOSCM: chat The player %s:%x is muted", + TheDataset.getEntityId(sender).toString().c_str(), + sender.getIndex()); + return; + } + } + if (!session->getChan()->getDontBroadcastPlayerInputs()) { // add msg to the historic diff --git a/code/ryzom/server/src/input_output_service/messages.cpp b/code/ryzom/server/src/input_output_service/messages.cpp index 1abec0011..4af959590 100644 --- a/code/ryzom/server/src/input_output_service/messages.cpp +++ b/code/ryzom/server/src/input_output_service/messages.cpp @@ -336,7 +336,7 @@ void cbImpulsionFilter( CMessage& msgin, const string &serviceName, TServiceId s } // impulsionFilter // -static char*DebugChatModeName[] = +static const char* DebugChatModeName[] = { "say", "shout", diff --git a/code/ryzom/server/src/input_output_service/parameter_traits.cpp b/code/ryzom/server/src/input_output_service/parameter_traits.cpp index 8eecfd1de..a0b45fcf7 100644 --- a/code/ryzom/server/src/input_output_service/parameter_traits.cpp +++ b/code/ryzom/server/src/input_output_service/parameter_traits.cpp @@ -42,7 +42,7 @@ extern CVariable VerboseStringManager; #define LOG if (!VerboseStringManager) {} else nlinfo -char *OperatorNames[] = +const char *OperatorNames[] = { "equal", "notEqual", diff --git a/code/ryzom/server/src/logger_service/logger_service.cpp b/code/ryzom/server/src/logger_service/logger_service.cpp index 245fe4c89..dba4cae57 100644 --- a/code/ryzom/server/src/logger_service/logger_service.cpp +++ b/code/ryzom/server/src/logger_service/logger_service.cpp @@ -521,9 +521,7 @@ public: BsiGlobal); saveFile.FileName = threadResult.OutputFilename; - char *newLine="\n"; - - + const char *newLine="\n"; list::const_iterator first(threadResult.Lines->begin()), last(threadResult.Lines->end()); for (uint32 localCounter = 0; first != last; ++first, ++localCounter) diff --git a/code/ryzom/server/src/pd_lib/db_delta_file.cpp b/code/ryzom/server/src/pd_lib/db_delta_file.cpp index ded4e57c1..4ca800256 100644 --- a/code/ryzom/server/src/pd_lib/db_delta_file.cpp +++ b/code/ryzom/server/src/pd_lib/db_delta_file.cpp @@ -259,7 +259,7 @@ bool CDBDeltaFile::preload() */ bool CDBDeltaFile::serialHeader() { - serialCheck((uint32)'DbDt'); + serialCheck(NELID("DbDt")); uint version = serialVersion(0); if (isReading()) @@ -280,7 +280,7 @@ bool CDBDeltaFile::serialHeader() serial(_Header); } - serialCheck((uint32)'Data'); + serialCheck(NELID("Data")); _DataStart = ftell(_File); diff --git a/code/ryzom/server/src/pd_lib/db_delta_file.h b/code/ryzom/server/src/pd_lib/db_delta_file.h index a8d8776cf..f33feaa52 100644 --- a/code/ryzom/server/src/pd_lib/db_delta_file.h +++ b/code/ryzom/server/src/pd_lib/db_delta_file.h @@ -189,7 +189,7 @@ private: void serial(NLMISC::IStream& s) { - s.serialCheck((uint32)'DHdr'); + s.serialCheck(NELID("DHdr")); uint version = s.serialVersion(0); s.serial(RowSize); diff --git a/code/ryzom/server/src/pd_lib/db_reference_file.cpp b/code/ryzom/server/src/pd_lib/db_reference_file.cpp index 7ae9ecb1c..edb8c596e 100644 --- a/code/ryzom/server/src/pd_lib/db_reference_file.cpp +++ b/code/ryzom/server/src/pd_lib/db_reference_file.cpp @@ -483,7 +483,7 @@ bool CDBReferenceFile::read(uint32 index, uint8* rowdata) */ bool CDBReferenceFile::serialHeader() { - serialCheck((uint32)'DbRf'); + serialCheck(NELID("DbRf")); uint version = serialVersion(0); if (isReading()) @@ -504,7 +504,7 @@ bool CDBReferenceFile::serialHeader() serial(_Header); } - serialCheck((uint32)'Data'); + serialCheck(NELID("Data")); _DataStart = ftell(_File); diff --git a/code/ryzom/server/src/pd_lib/db_reference_file.h b/code/ryzom/server/src/pd_lib/db_reference_file.h index 72fcffb88..269e5278f 100644 --- a/code/ryzom/server/src/pd_lib/db_reference_file.h +++ b/code/ryzom/server/src/pd_lib/db_reference_file.h @@ -199,7 +199,7 @@ private: void serial(NLMISC::IStream& s) { - s.serialCheck((uint32)'RHdr'); + s.serialCheck(NELID("RHdr")); uint version = s.serialVersion(0); s.serial(BaseIndex); diff --git a/code/ryzom/server/src/pd_lib/pd_messages.h b/code/ryzom/server/src/pd_lib/pd_messages.h index 0dac4215c..25ea12c4b 100644 --- a/code/ryzom/server/src/pd_lib/pd_messages.h +++ b/code/ryzom/server/src/pd_lib/pd_messages.h @@ -1436,7 +1436,7 @@ inline uint32 CDbMessage::getMessageHeaderSize() */ inline void CUpdateLog::serial(NLMISC::IStream& f) { - f.serialCheck((uint32)'ULOG'); + f.serialCheck(NELID("ULOG")); uint version = f.serialVersion(1); diff --git a/code/ryzom/server/src/pd_lib/pd_server_utils.cpp b/code/ryzom/server/src/pd_lib/pd_server_utils.cpp index 9b27b1d23..1ca303b0f 100644 --- a/code/ryzom/server/src/pd_lib/pd_server_utils.cpp +++ b/code/ryzom/server/src/pd_lib/pd_server_utils.cpp @@ -331,7 +331,7 @@ void CDatabaseState::serial(NLMISC::IStream& s) { s.xmlPush("database_state"); - s.serialCheck((uint32)'DBST'); + s.serialCheck(NELID("DBST")); uint version = s.serialVersion(0); s.xmlPush("name"); diff --git a/code/ryzom/server/src/pd_lib/pd_server_utils.h b/code/ryzom/server/src/pd_lib/pd_server_utils.h index 97f0ebec0..ac67e8a7a 100644 --- a/code/ryzom/server/src/pd_lib/pd_server_utils.h +++ b/code/ryzom/server/src/pd_lib/pd_server_utils.h @@ -60,7 +60,7 @@ public: { s.xmlPush("reference"); - s.serialCheck((uint32)'RIDX'); + s.serialCheck(NELID("RIDX")); uint version = s.serialVersion(0); s.xmlPush("database"); diff --git a/code/ryzom/server/src/pd_lib/pd_string_mapper.cpp b/code/ryzom/server/src/pd_lib/pd_string_mapper.cpp index f4277b61a..184d4bb7f 100644 --- a/code/ryzom/server/src/pd_lib/pd_string_mapper.cpp +++ b/code/ryzom/server/src/pd_lib/pd_string_mapper.cpp @@ -73,7 +73,7 @@ void CPDStringMapper::setMapping(const std::string& str, uint32 id) */ void CPDStringMapper::serial(NLMISC::IStream& f) { - f.serialCheck((uint32)'PDSM'); + f.serialCheck(NELID("PDSM")); uint version = f.serialVersion(0); diff --git a/code/ryzom/server/src/pd_lib/pd_utils.h b/code/ryzom/server/src/pd_lib/pd_utils.h index 07744d3ad..73a0268d8 100644 --- a/code/ryzom/server/src/pd_lib/pd_utils.h +++ b/code/ryzom/server/src/pd_lib/pd_utils.h @@ -714,7 +714,7 @@ public: void serial(NLMISC::IStream& f) { - f.serialCheck((uint32)'IALC'); + f.serialCheck(NELID("IALC")); f.serialVersion(0); f.serial(_NextIndex); diff --git a/code/ryzom/server/src/pd_support_service/daily_commands.cpp b/code/ryzom/server/src/pd_support_service/daily_commands.cpp index 429823160..e3f6d718c 100644 --- a/code/ryzom/server/src/pd_support_service/daily_commands.cpp +++ b/code/ryzom/server/src/pd_support_service/daily_commands.cpp @@ -104,7 +104,7 @@ public: FILE* fileHandle= fopen(DailyActivityLogFileName,"ab"); nlassert(fileHandle!=NULL); fprintf(fileHandle,"%02u/%02u/%u CDailyTaskScheduler: Started: %02u:%02u, Finished: %02u:%02u, Executed %u commands Started %u Jobs\n", - ptm->tm_mday, ptm->tm_mon+1, ptm->tm_year+1900, startTime/3600%24, startTime/60%60, endTime/3600%24, endTime/60%60, commandsVar==NULL?0:commandsVar->size(), jobsRemaining ); + ptm->tm_mday, ptm->tm_mon+1, ptm->tm_year+1900, (uint)startTime/3600%24, (uint)startTime/60%60, (uint)endTime/3600%24, (uint)endTime/60%60, commandsVar==NULL?0:commandsVar->size(), jobsRemaining ); nlinfo("JobManager state: %s",CJobManager::getInstance()->getStatus().c_str()); fclose(fileHandle); } diff --git a/code/ryzom/server/src/pd_support_service/stat_char_commands.cpp b/code/ryzom/server/src/pd_support_service/stat_char_commands.cpp index 611bd9b6b..ed5641455 100644 --- a/code/ryzom/server/src/pd_support_service/stat_char_commands.cpp +++ b/code/ryzom/server/src/pd_support_service/stat_char_commands.cpp @@ -518,13 +518,13 @@ static std::string getActiveOutputPath() if (TheCharScanScriptFile==NULL) { nlwarning("There is no active script file right now from which to extract output directory"); - return false; + return ""; } bool isOK=true; // write the current script file to a tmp file isOK=TheCharScanScriptFile->writeToFile(TmpScriptFileName); - if (!isOK) return false; + if (!isOK) return ""; // create a new script object and assign the tmp file to it CCharScanScriptFile script; diff --git a/code/ryzom/server/src/persistant_data_service/db_manager.cpp b/code/ryzom/server/src/persistant_data_service/db_manager.cpp index 3160b9689..6acdf687c 100644 --- a/code/ryzom/server/src/persistant_data_service/db_manager.cpp +++ b/code/ryzom/server/src/persistant_data_service/db_manager.cpp @@ -176,7 +176,7 @@ CTimestamp CDbManager::_LastUpdateTime; */ CDatabase* CDbManager::createDatabase(TDatabaseId id, CLog* log) { - CHECK_DB_MGR_INIT(createDatabase, false); + CHECK_DB_MGR_INIT(createDatabase, NULL); // check db doesn't exist yet CDatabase* db = getDatabase(id); @@ -229,7 +229,7 @@ bool CDbManager::deleteDatabase(TDatabaseId id, CLog* log) */ CDatabase* CDbManager::loadDatabase(TDatabaseId id, const string& description, CLog* log) { - CHECK_DB_MGR_INIT(loadDatabase, false); + CHECK_DB_MGR_INIT(loadDatabase, NULL); nlinfo("CDbManager::loadDatabase(): load/setup database '%d'", id); diff --git a/code/ryzom/server/src/persistant_data_service/pds_database.cpp b/code/ryzom/server/src/persistant_data_service/pds_database.cpp index 13202bb1e..66b272d5c 100644 --- a/code/ryzom/server/src/persistant_data_service/pds_database.cpp +++ b/code/ryzom/server/src/persistant_data_service/pds_database.cpp @@ -1195,7 +1195,7 @@ CDatabase* CDatabase::adapt(const string& description) if (!buildReference()) { PDS_WARNING("adapt(): failed to buildReference()"); - return false; + return NULL; } } diff --git a/code/ryzom/server/src/persistant_data_service/pds_type.cpp b/code/ryzom/server/src/persistant_data_service/pds_type.cpp index eb8ea5f19..46f9fb924 100644 --- a/code/ryzom/server/src/persistant_data_service/pds_type.cpp +++ b/code/ryzom/server/src/persistant_data_service/pds_type.cpp @@ -194,7 +194,7 @@ string CType::getIndexName(TEnumValue value, bool verbose) const if (!isIndex()) { PDS_WARNING("getIndexName(): type is not an index"); - return false; + return ""; } if (isEnum()) diff --git a/code/ryzom/server/src/server_share/light_ig_loader.cpp b/code/ryzom/server/src/server_share/light_ig_loader.cpp index f9fd3aa1f..de29ad949 100644 --- a/code/ryzom/server/src/server_share/light_ig_loader.cpp +++ b/code/ryzom/server/src/server_share/light_ig_loader.cpp @@ -114,7 +114,7 @@ void CLightIGLoader::loadIG(const string &filename) // Serial a header - _File.serialCheck ((uint32)'TPRG'); + _File.serialCheck (NELID("TPRG")); // Serial a version number sint version = _File.serialVersion (5); diff --git a/code/ryzom/server/src/shard_unifier_service/name_manager.cpp b/code/ryzom/server/src/shard_unifier_service/name_manager.cpp index ff05659c1..5b50f6359 100644 --- a/code/ryzom/server/src/shard_unifier_service/name_manager.cpp +++ b/code/ryzom/server/src/shard_unifier_service/name_manager.cpp @@ -1187,9 +1187,14 @@ bool CNameManager::loadForbiddenNames() while (true) { char str[512]; - fgets(str, 511, fp); + char *fgres = fgets(str, 511, fp); if(feof(fp)) break; + if (fgres == NULL) + { + nlwarning("NAMEMGR: Error reading file"); + break; + } if (strlen(str) > 0) { str[strlen(str)-1] = '\0'; diff --git a/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp b/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp index 987d4c86b..8d6c2a91f 100644 --- a/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp +++ b/code/ryzom/server/src/shard_unifier_service/ring_session_manager.cpp @@ -208,7 +208,7 @@ namespace RSMGR public: CRingSessionManager() : _DontUsePerm(false), - _CharSync(false) + _CharSync(NULL) { CRingSessionManagerSkel::init(this); CWelcomeServiceClientSkel::init(this); diff --git a/code/ryzom/tools/client/client_config/display_dlg.cpp b/code/ryzom/tools/client/client_config/display_dlg.cpp index 0c9c98a92..71faa2a58 100644 --- a/code/ryzom/tools/client/client_config/display_dlg.cpp +++ b/code/ryzom/tools/client/client_config/display_dlg.cpp @@ -47,14 +47,14 @@ uint CPUFrequency; bool GetGLInformation () { // *** INIT VARIABLES - + GLExtensions.clear (); GLRenderer = ""; GLVendor = ""; GLVersion = ""; // *** INIT OPENGL - + // Register a window class WNDCLASS wc; memset(&wc,0,sizeof(wc)); @@ -79,14 +79,14 @@ bool GetGLInformation () WndRect.right=100; WndRect.bottom=100; HWND hWnd = CreateWindow ( "RyzomGetGlInformation", - "", - WndFlags, - CW_USEDEFAULT,CW_USEDEFAULT, - WndRect.right,WndRect.bottom, - NULL, - NULL, - GetModuleHandle(NULL), - NULL); + "", + WndFlags, + CW_USEDEFAULT,CW_USEDEFAULT, + WndRect.right,WndRect.bottom, + NULL, + NULL, + GetModuleHandle(NULL), + NULL); if (!hWnd) return false; @@ -384,7 +384,7 @@ void CDisplayDlg::updateState () TextWnd1.EnableWindow (Windowed == 1); TextWnd2.EnableWindow (Windowed == 1); TextWnd3.EnableWindow (Windowed == 1); - + // Fill the combobox values ModeCtrl.ResetContent (); uint i; @@ -411,11 +411,11 @@ void CDisplayDlg::updateState () BOOL CDisplayDlg::OnInitDialog() { CDialog::OnInitDialog(); - + updateState (); - + return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE + // EXCEPTION: OCX Property Pages should return FALSE } // *************************************************************************** diff --git a/code/ryzom/tools/client/client_config_qt/CMakeLists.txt b/code/ryzom/tools/client/client_config_qt/CMakeLists.txt index 87c5d7b05..82c1f6e3d 100644 --- a/code/ryzom/tools/client/client_config_qt/CMakeLists.txt +++ b/code/ryzom/tools/client/client_config_qt/CMakeLists.txt @@ -1,6 +1,5 @@ -INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${QT_INCLUDES} ) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${NEL_INCLUDE_DIR} ${QT_INCLUDES}) +INCLUDE( ${QT_USE_FILE} ) FILE( GLOB SRC *.cpp *.h ) @@ -36,9 +35,6 @@ SET( CLIENT_CONFIG_TRANS CONFIGURE_FILE( translations/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY ) SET( CLIENT_CONFIG_RCS resources.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc ) -SET( QT_USE_QTGUI TRUE ) -SET( QT_USE_QTOPENGL TRUE ) -SET( QT_USE_QTCORE TRUE ) QT4_ADD_TRANSLATION( CLIENT_CONFIG_QM ${CLIENT_CONFIG_TRANS} ) QT4_ADD_RESOURCES( CLIENT_CONFIG_RC_SRCS ${CLIENT_CONFIG_RCS} ) QT4_WRAP_CPP( CLIENT_CONFIG_MOC_SRC ${CLIENT_CONFIG_HDR} ) @@ -52,6 +48,11 @@ ADD_EXECUTABLE( ryzom_configuration_qt WIN32 MACOSX_BUNDLE ${SRC} ${CLIENT_CONFI NL_DEFAULT_PROPS( ryzom_configuration_qt "Ryzom, Tools: Ryzom Configuration Qt" ) NL_ADD_RUNTIME_FLAGS( ryzom_configuration_qt ) NL_ADD_LIB_SUFFIX( ryzom_configuration_qt ) -TARGET_LINK_LIBRARIES( ryzom_configuration_qt nelmisc nel3d ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY} ) -INSTALL( TARGETS ryzom_configuration_qt RUNTIME DESTINATION games COMPONENT client BUNDLE DESTINATION /Applications ) +TARGET_LINK_LIBRARIES( ryzom_configuration_qt nelmisc nel3d ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY}) + +IF(WITH_PCH) + ADD_NATIVE_PRECOMPILED_HEADER(ryzom_configuration_qt ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) +ENDIF(WITH_PCH) + +INSTALL(TARGETS ryzom_configuration_qt RUNTIME DESTINATION games COMPONENT client BUNDLE DESTINATION /Applications) diff --git a/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp b/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp index 5c6801152..df3596980 100644 --- a/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp +++ b/code/ryzom/tools/client/client_config_qt/client_config_dialog.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "client_config_dialog.h" #include "general_settings_widget.h" diff --git a/code/ryzom/tools/client/client_config_qt/config.cpp b/code/ryzom/tools/client/client_config_qt/config.cpp index 93a757b27..55854862f 100644 --- a/code/ryzom/tools/client/client_config_qt/config.cpp +++ b/code/ryzom/tools/client/client_config_qt/config.cpp @@ -14,7 +14,8 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "Config.h" +#include "stdpch.h" +#include "config.h" CConfig::CConfig() { @@ -237,7 +238,7 @@ void CConfig::setFloat( const char *key, float value ) } } -void CConfig::setString( const char *key, std::string &value ) +void CConfig::setString( const char *key, const std::string &value ) { NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key ); @@ -252,4 +253,4 @@ void CConfig::setString( const char *key, std::string &value ) { nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() ); } -} \ No newline at end of file +} diff --git a/code/ryzom/tools/client/client_config_qt/config.h b/code/ryzom/tools/client/client_config_qt/config.h index df48e19e0..d9ddb536e 100644 --- a/code/ryzom/tools/client/client_config_qt/config.h +++ b/code/ryzom/tools/client/client_config_qt/config.h @@ -108,7 +108,7 @@ public: @param key - the key we want to alter @param value - the value we want to set */ - void setString( const char *key, std::string &value ); + void setString( const char *key, const std::string &value ); private: // config file diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.cpp b/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.cpp index 211a4911b..0e0293555 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/display_settings_advanced_widget.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "display_settings_advanced_widget.h" + #include "system.h" CDisplaySettingsAdvancedWidget::CDisplaySettingsAdvancedWidget( QWidget *parent ) : diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp b/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp index aeddcf628..74b48cc45 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/display_settings_details_widget.cpp @@ -14,9 +14,11 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "system.h" +#include "stdpch.h" #include "display_settings_details_widget.h" +#include "system.h" + CDisplaySettingsDetailsWidget::CDisplaySettingsDetailsWidget( QWidget *parent ) : CWidgetBase( parent ) { diff --git a/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp b/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp index f6775a0b7..f0dba2a07 100644 --- a/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/display_settings_widget.cpp @@ -14,9 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include -#include +#include "stdpch.h" #include "display_settings_widget.h" + #include "system.h" #include @@ -30,6 +30,10 @@ CDisplaySettingsWidget::CDisplaySettingsWidget( QWidget *parent ) : ypositionLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), ypositionLineEdit ) ); load(); +#ifndef Q_OS_WIN32 + direct3dRadioButton->setEnabled(false); +#endif + connect( autoRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( openglRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( direct3dRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); @@ -71,7 +75,7 @@ void CDisplaySettingsWidget::load() CVideoMode mode; - mode.widht = s.config.getInt( "Width" ); + mode.width = s.config.getInt( "Width" ); mode.height = s.config.getInt( "Height" ); mode.depth = s.config.getInt( "Depth" ); mode.frequency = s.config.getInt( "Frequency" ); @@ -86,7 +90,7 @@ void CDisplaySettingsWidget::load() windowedRadioButton->setChecked( true ); } - widthLineEdit->setText( QString( "%1" ).arg( mode.widht ) ); + widthLineEdit->setText( QString( "%1" ).arg( mode.width ) ); heightLineEdit->setText( QString( "%1" ).arg( mode.height ) ); xpositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionX" ) ) ); ypositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionY" ) ) ); @@ -99,8 +103,10 @@ void CDisplaySettingsWidget::save() if( openglRadioButton->isChecked() ) s.config.setString( "Driver3D", std::string( "OpenGL" ) ); +#ifdef Q_OS_WIN32 else if( direct3dRadioButton->isChecked() ) s.config.setString( "Driver3D", std::string( "Direct3D" ) ); +#endif else s.config.setString( "Driver3D", std::string( "Auto" ) ); @@ -112,12 +118,14 @@ void CDisplaySettingsWidget::save() CVideoMode mode; // OpenGL should be available everywhere! +#ifdef Q_OS_WIN32 if( direct3dRadioButton->isChecked() ) mode = s.d3dInfo.modes[ index ]; else +#endif mode = s.openglInfo.modes[ index ]; - s.config.setInt( "Width", mode.widht ); + s.config.setInt( "Width", mode.width ); s.config.setInt( "Height", mode.height ); s.config.setInt( "Depth", mode.depth ); s.config.setInt( "Frequency", mode.frequency ); @@ -151,24 +159,27 @@ void CDisplaySettingsWidget::updateVideoModes() videomodeComboBox->clear(); + std::vector< CVideoMode >::iterator itr, iend; + +#ifdef Q_OS_WIN32 if( direct3dRadioButton->isChecked() ) { - for( std::vector< CVideoMode >::iterator itr = s.d3dInfo.modes.begin(); itr != s.d3dInfo.modes.end(); ++itr ) - { - std::stringstream ss; - ss << itr->widht << "x" << itr->height << " " << itr->depth << " bit @" << itr->frequency; - videomodeComboBox->addItem( ss.str().c_str() ); - } + itr = s.d3dInfo.modes.begin(); + iend = s.d3dInfo.modes.end(); } else +#endif { // OpenGL should be available everywhere! - for( std::vector< CVideoMode >::iterator itr = s.openglInfo.modes.begin(); itr != s.openglInfo.modes.end(); ++itr ) - { - std::stringstream ss; - ss << itr->widht << "x" << itr->height << " " << itr->depth << " bit @" << itr->frequency; - videomodeComboBox->addItem( ss.str().c_str() ); - } + itr = s.openglInfo.modes.begin(); + iend = s.openglInfo.modes.end(); + } + + while(itr != iend) + { + videomodeComboBox->addItem(QString("%1x%2 %3 bit @%4").arg(itr->width).arg(itr->height).arg(itr->depth).arg(itr->frequency)); + + ++itr; } } @@ -192,6 +203,7 @@ uint32 CDisplaySettingsWidget::findVideoModeIndex( CVideoMode *mode ) CVideoMode &m = *mode; CSystem &s = CSystem::GetInstance(); +#ifdef Q_OS_WIN32 if( direct3dRadioButton->isChecked() ) { for( uint32 i = 0; i < s.d3dInfo.modes.size(); i++ ) @@ -199,6 +211,7 @@ uint32 CDisplaySettingsWidget::findVideoModeIndex( CVideoMode *mode ) return i; } else +#endif { // Again OpenGL should be available everywhere! for( uint32 i = 0; i < s.openglInfo.modes.size(); i++ ) diff --git a/code/ryzom/tools/client/client_config_qt/general_settings_widget.cpp b/code/ryzom/tools/client/client_config_qt/general_settings_widget.cpp index fcb85dec2..bb402b328 100644 --- a/code/ryzom/tools/client/client_config_qt/general_settings_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/general_settings_widget.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "general_settings_widget.h" + #include "system.h" #include @@ -46,7 +48,7 @@ void CGeneralSettingsWidget::load() { CSystem &s = CSystem::GetInstance(); - sint32 cbIndex = getIndexForLanguageCode( QString( s.config.getString( "LanguageCode" ).c_str() ) ); + sint32 cbIndex = getIndexForLanguageCode( QString::fromUtf8( s.config.getString( "LanguageCode" ).c_str() ) ); if( cbIndex != -1 ){ languageComboBox->setCurrentIndex( cbIndex ); onLanguageChanged(); @@ -111,7 +113,7 @@ void CGeneralSettingsWidget::changeEvent( QEvent *event ) QWidget::changeEvent( event ); } -int CGeneralSettingsWidget::getIndexForLanguageCode( QString &languageCode ) +int CGeneralSettingsWidget::getIndexForLanguageCode(const QString &languageCode) { for( sint32 i = 0; i < NUM_LANGUAGE_CODES; i++ ) if( languageCode.compare( languageCodes[ i ] ) == 0 ) diff --git a/code/ryzom/tools/client/client_config_qt/general_settings_widget.h b/code/ryzom/tools/client/client_config_qt/general_settings_widget.h index c8d530ea5..412658a72 100644 --- a/code/ryzom/tools/client/client_config_qt/general_settings_widget.h +++ b/code/ryzom/tools/client/client_config_qt/general_settings_widget.h @@ -19,7 +19,6 @@ #include "ui_general_settings_widget.h" #include "widget_base.h" -#include class QTranslator; @@ -37,7 +36,7 @@ class CGeneralSettingsWidget : public CWidgetBase, public Ui::general_settings_w public: CGeneralSettingsWidget( QWidget *parent = NULL ); - ~CGeneralSettingsWidget(); + virtual ~CGeneralSettingsWidget(); void load(); void save(); @@ -54,7 +53,7 @@ private: @param languageCode - Reference to the language code, we are trying to find. @return Returns the index on success, returns -1 if the language code cannot be found. */ - sint32 getIndexForLanguageCode( QString &languageCode ); + sint32 getIndexForLanguageCode(const QString &languageCode); // Contains the language codes used in the config file // They are in the same order as the options in languageComboBox diff --git a/code/ryzom/tools/client/client_config_qt/main.cpp b/code/ryzom/tools/client/client_config_qt/main.cpp index 758598e92..0f41c508b 100644 --- a/code/ryzom/tools/client/client_config_qt/main.cpp +++ b/code/ryzom/tools/client/client_config_qt/main.cpp @@ -14,7 +14,8 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include +#include "stdpch.h" + #include "client_config_dialog.h" #include "system.h" diff --git a/code/ryzom/tools/client/client_config_qt/sound_settings_widget.cpp b/code/ryzom/tools/client/client_config_qt/sound_settings_widget.cpp index 5436ac2b4..be637f8d8 100644 --- a/code/ryzom/tools/client/client_config_qt/sound_settings_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/sound_settings_widget.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "sound_settings_widget.h" + #include "system.h" CSoundSettingsWidget::CSoundSettingsWidget( QWidget *parent ) : diff --git a/code/ryzom/tools/client/client_config_qt/sound_settings_widget.h b/code/ryzom/tools/client/client_config_qt/sound_settings_widget.h index d98a89d82..c995f1206 100644 --- a/code/ryzom/tools/client/client_config_qt/sound_settings_widget.h +++ b/code/ryzom/tools/client/client_config_qt/sound_settings_widget.h @@ -19,7 +19,6 @@ #include "ui_sound_settings_widget.h" #include "widget_base.h" -#include /** @brief The sound settings page of the configuration tool diff --git a/code/ryzom/tools/client/client_config_qt/stdpch.cpp b/code/ryzom/tools/client/client_config_qt/stdpch.cpp new file mode 100644 index 000000000..a3d45576c --- /dev/null +++ b/code/ryzom/tools/client/client_config_qt/stdpch.cpp @@ -0,0 +1,17 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "stdpch.h" diff --git a/code/ryzom/tools/client/client_config_qt/stdpch.h b/code/ryzom/tools/client/client_config_qt/stdpch.h new file mode 100644 index 000000000..6f6655761 --- /dev/null +++ b/code/ryzom/tools/client/client_config_qt/stdpch.h @@ -0,0 +1,29 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#ifndef STDPCH_H +#define STDPCH_H + +#include + +#include +#include + +#include +#include + +#endif + diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.cpp b/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.cpp index 894ea07ac..140a75adc 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "sys_info_d3d_widget.h" + #include "system.h" CSysInfoD3DWidget::CSysInfoD3DWidget( QWidget *parent ) : @@ -22,9 +24,11 @@ CSysInfoD3DWidget::CSysInfoD3DWidget( QWidget *parent ) : { setupUi( this ); +#ifdef Q_OS_WIN32 descriptionLabel->setText( CSystem::GetInstance().d3dInfo.device.c_str() ); driverLabel->setText( CSystem::GetInstance().d3dInfo.driver.c_str() ); versionLabel->setText( CSystem::GetInstance().d3dInfo.driverVersion.c_str() ); +#endif } CSysInfoD3DWidget::~CSysInfoD3DWidget() diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.h b/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.h index 6f79782ae..a77d89fa9 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.h +++ b/code/ryzom/tools/client/client_config_qt/sys_info_d3d_widget.h @@ -17,7 +17,7 @@ #ifndef SYSINFOD3DWIDGET_H #define SYSINFOD3DWIDGET_H -#include "ui_sys_Info_d3d_widget.h" +#include "ui_sys_info_d3d_widget.h" /** @@ -28,7 +28,7 @@ class CSysInfoD3DWidget : public QWidget, public Ui::sys_info_d3d_widget Q_OBJECT public: CSysInfoD3DWidget( QWidget *parent = NULL ); - ~CSysInfoD3DWidget(); + virtual ~CSysInfoD3DWidget(); protected: void changeEvent( QEvent *event ); diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.cpp b/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.cpp index 0665025be..55deea24e 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/sys_info_opengl_widget.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "sys_info_opengl_widget.h" + #include "system.h" CSysInfoOpenGLWidget::CSysInfoOpenGLWidget( QWidget *parent ) : diff --git a/code/ryzom/tools/client/client_config_qt/sys_info_widget.cpp b/code/ryzom/tools/client/client_config_qt/sys_info_widget.cpp index 26d52ddb8..fcc0940dd 100644 --- a/code/ryzom/tools/client/client_config_qt/sys_info_widget.cpp +++ b/code/ryzom/tools/client/client_config_qt/sys_info_widget.cpp @@ -14,7 +14,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "sys_info_widget.h" + #include "system.h" CSysInfoWidget::CSysInfoWidget( QWidget *parent ) : diff --git a/code/ryzom/tools/client/client_config_qt/system.cpp b/code/ryzom/tools/client/client_config_qt/system.cpp index c4c93f76d..6070e4abd 100644 --- a/code/ryzom/tools/client/client_config_qt/system.cpp +++ b/code/ryzom/tools/client/client_config_qt/system.cpp @@ -14,18 +14,17 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "stdpch.h" #include "system.h" -#include + #include #include #include -CSystem *CSystem::instance = NULL; - CSystem::CSystem() { GatherSysInfo(); -#ifdef WIN32 +#ifdef Q_OS_WIN32 GatherD3DInfo(); #endif GatherOpenGLInfo(); @@ -33,9 +32,32 @@ CSystem::CSystem() CSystem::~CSystem() { - instance = 0; } +bool CSystem::parseDriverVersion(const std::string &device, uint64 driver, std::string &version) +{ + // file version + uint32 version1 = driver >> 48; + uint32 version2 = (driver >> 32) & 0xffff; + uint32 version3 = (driver >> 16) & 0xffff; + uint32 version4 = driver & 0xffff; + + if (device.find("NVIDIA") != std::string::npos) + { + // nvidia should be something like 9.18.13.2018 and 9.18.13.1422 + // which respectively corresponds to drivers 320.18 and 314.22 + uint32 nvVersionMajor = (version3 % 10) * 100 + (version4 / 100); + uint32 nvVersionMinor = version4 % 100; + + version = NLMISC::toString("%u.%u", nvVersionMajor, nvVersionMinor); + } + else + { + version = NLMISC::toString("%u.%u.%u.%u", version1, version2, version3, version4); + } + + return true; +} void CSystem::GatherSysInfo() { @@ -46,24 +68,7 @@ void CSystem::GatherSysInfo() { sysInfo.videoDevice = device; - ////////////////////////////////////////////////////////////// - // FIXME - // This is taken from the original configuration tool, and - // it generates the same *wrong* version number - ////////////////////////////////////////////////////////////// - uint32 version = static_cast< uint32 >( driver & 0xffff ); - std::stringstream ss; - - ss << ( version / 1000 % 10 ); - ss << "."; - ss << ( version / 100 % 10 ); - ss << "."; - ss << ( version / 10 % 10 ); - ss << "."; - ss << ( version % 10 ); - - sysInfo.videoDriverVersion = ss.str(); - ////////////////////////////////////////////////////////////// + CSystem::parseDriverVersion(device, driver, sysInfo.videoDriverVersion); } else { @@ -77,7 +82,7 @@ void CSystem::GatherSysInfo() sysInfo.totalRAM /= ( 1024 * 1024 ); } -#ifdef WIN32 +#ifdef Q_OS_WIN32 void CSystem::GatherD3DInfo() { NL3D::IDriver *driver = NULL; @@ -92,16 +97,7 @@ void CSystem::GatherD3DInfo() d3dInfo.device = adapter.Description; d3dInfo.driver = adapter.Driver; - sint64 ver = adapter.DriverVersion; - std::stringstream ss; - ss << static_cast< uint16 >( ver >> 48 ); - ss << "."; - ss << static_cast< uint16 >( ver >> 32 ); - ss << "."; - ss << static_cast< uint16 >( ver >> 16 ); - ss << "."; - ss << static_cast< uint16 >( ver & 0xFFFF ); - d3dInfo.driverVersion = ss.str(); + CSystem::parseDriverVersion(d3dInfo.device, adapter.DriverVersion, d3dInfo.driverVersion); } GetVideoModes( d3dInfo.modes, driver ); @@ -109,7 +105,7 @@ void CSystem::GatherD3DInfo() driver->release(); } - catch( NLMISC::Exception &e ) + catch(const NLMISC::Exception &e) { nlwarning( e.what() ); } @@ -146,15 +142,13 @@ void CSystem::GatherOpenGLInfo() delete gl; - NL3D::IDriver *driver = NULL; try { - driver = NL3D::CDRU::createGlDriver(); + NL3D::IDriver *driver = NL3D::CDRU::createGlDriver(); GetVideoModes( openglInfo.modes, driver ); driver->release(); } - - catch( NLMISC::Exception &e ) + catch(const NLMISC::Exception &e) { nlwarning( e.what() ); } @@ -171,11 +165,11 @@ void CSystem::GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driv { CVideoMode mode; mode.depth = itr->Depth; - mode.widht = itr->Width; + mode.width = itr->Width; mode.height = itr->Height; mode.frequency = itr->Frequency; dst.push_back( mode ); } } -} \ No newline at end of file +} diff --git a/code/ryzom/tools/client/client_config_qt/system.h b/code/ryzom/tools/client/client_config_qt/system.h index bcb5f90bf..1cc25a4bf 100644 --- a/code/ryzom/tools/client/client_config_qt/system.h +++ b/code/ryzom/tools/client/client_config_qt/system.h @@ -27,22 +27,22 @@ class IDriver; struct CVideoMode { - unsigned int widht; - unsigned int height; - unsigned int depth; - unsigned int frequency; + uint16 width; + uint16 height; + uint8 depth; + uint8 frequency; CVideoMode() { - widht = 0; + width = 0; height = 0; depth = 0; frequency = 0; } - bool operator==( CVideoMode &o ) + bool operator== (const CVideoMode &o) { - if( ( o.widht == widht ) && ( o.height == height ) && ( o.depth == depth ) && ( o.frequency == frequency ) ) + if ((o.width == width) && (o.height == height) && (o.depth == depth) && (o.frequency == frequency)) return true; else return false; @@ -60,11 +60,8 @@ public: static CSystem &GetInstance() { - if( instance == 0 ) - { - instance = new CSystem; - } - return *instance; + static CSystem sInstance; + return sInstance; } struct CSysInfo @@ -74,16 +71,18 @@ public: std::string osName; std::string cpuName; uint64 totalRAM; - } sysInfo; + } + sysInfo; -#ifdef WIN32 +#ifdef Q_OS_WIN32 struct CD3DInfo { std::string device; std::string driver; std::string driverVersion; std::vector< CVideoMode > modes; - } d3dInfo; + } + d3dInfo; #endif struct COpenGLInfo @@ -93,20 +92,22 @@ public: std::string driverVersion; std::string extensions; std::vector< CVideoMode > modes; - } openglInfo; + } + openglInfo; CConfig config; private: void GatherSysInfo(); -#ifdef WIN32 +#ifdef Q_OS_WIN32 void GatherD3DInfo(); #endif void GatherOpenGLInfo(); - void GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driver ) const; + void GetVideoModes(std::vector &dst, NL3D::IDriver *driver) const; - static CSystem *instance; + static bool parseDriverVersion(const std::string &device, uint64 driver, std::string &version); }; #endif // SYSTEM_H + diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/formitem.h b/code/ryzom/tools/leveldesign/georges_editor_qt/src/formitem.h index 18a0ae23e..3f4ad0c98 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/formitem.h +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/formitem.h @@ -1,5 +1,5 @@ /* -Georges Editor Qt +Georges Editor Qt Copyright (C) 2010 Adrian Jaekel This program is free software: you can redistribute it and/or modify @@ -14,58 +14,58 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ - -#ifndef FORMITEM_H -#define FORMITEM_H - -// NeL includes -#include - -// Qt includes -#include -#include - -namespace NLQT -{ - - class CFormItem - - { - public: - CFormItem(NLGEORGES::UFormElm *elm, const QList &data, - CFormItem *parent = 0, - NLGEORGES::UFormElm::TWhereIsValue = NLGEORGES::UFormElm::ValueForm, - NLGEORGES::UFormElm::TWhereIsNode = NLGEORGES::UFormElm::NodeForm); - ~CFormItem(); - - void appendChild(CFormItem *child); - - CFormItem *child(int row); - int childCount() const; - int columnCount() const; - QVariant data(int column) const; - int row() const; - CFormItem *parent(); - bool setData(int column, const QVariant &value); - NLGEORGES::UFormElm* getFormElm() {return formElm;} - NLGEORGES::UFormElm::TWhereIsValue valueFrom() - { - return whereV; - } - NLGEORGES::UFormElm::TWhereIsNode nodeFrom() - { - return whereN; - } - - private: - QList childItems; - QList itemData; - CFormItem *parentItem; - NLGEORGES::UFormElm* formElm; - NLGEORGES::UFormElm::TWhereIsValue whereV; - NLGEORGES::UFormElm::TWhereIsNode whereN; - }; // CFormItem - -} -#endif // FORMITEM_H +*/ + +#ifndef FORMITEM_H +#define FORMITEM_H + +// NeL includes +#include + +// Qt includes +#include +#include + +namespace NLQT +{ + + class CFormItem + + { + public: + CFormItem(NLGEORGES::UFormElm *elm, const QList &data, + CFormItem *parent = 0, + NLGEORGES::UFormElm::TWhereIsValue = NLGEORGES::UFormElm::ValueForm, + NLGEORGES::UFormElm::TWhereIsNode = NLGEORGES::UFormElm::NodeForm); + ~CFormItem(); + + void appendChild(CFormItem *child); + + CFormItem *child(int row); + int childCount() const; + int columnCount() const; + QVariant data(int column) const; + int row() const; + CFormItem *parent(); + bool setData(int column, const QVariant &value); + NLGEORGES::UFormElm* getFormElm() {return formElm;} + NLGEORGES::UFormElm::TWhereIsValue valueFrom() + { + return whereV; + } + NLGEORGES::UFormElm::TWhereIsNode nodeFrom() + { + return whereN; + } + + private: + QList childItems; + QList itemData; + CFormItem *parentItem; + NLGEORGES::UFormElm* formElm; + NLGEORGES::UFormElm::TWhereIsValue whereV; + NLGEORGES::UFormElm::TWhereIsNode whereN; + }; // CFormItem + +} +#endif // FORMITEM_H diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.cpp index e0285a3fb..8b9092b4c 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.cpp @@ -25,6 +25,7 @@ #include "nel/sound/u_audio_mixer.h" #include "PageBgFades.h" +#include "resource.h" using namespace std; diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.cpp index bc0d108f4..239c5b370 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.cpp @@ -25,6 +25,7 @@ #include "nel/sound/u_audio_mixer.h" #include "PageBgFlags.h" +#include "resource.h" using namespace std; diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.cpp b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.cpp index 46856b955..b3add5365 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.cpp +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.cpp @@ -21,6 +21,7 @@ #include "georges_plugin_sound.h" #include #include "PageComtext.h" +#include "resource.h" using namespace std; diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/std_sound_plugin.h b/code/ryzom/tools/leveldesign/georges_plugin_sound/std_sound_plugin.h index 3e5c33d17..9122d1f49 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/std_sound_plugin.h +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/std_sound_plugin.h @@ -14,16 +14,18 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#ifndef STDAFX_H +#define STDAFX_H + #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers #define NOMINMAX #define _WIN32_WINNT 0x0500 #include // MFC core and standard components #include // MFC extensions -#include "resource.h" #include "nel/misc/types_nl.h" #include "nel/misc/debug.h" #include "nel/georges/u_form_elm.h" -#include "georges_plugin_sound.h" +#endif diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp index 4fdd68869..5e54e5298 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp @@ -177,8 +177,8 @@ GenderExtractor::GenderExtractor(const std::string & literal, const std::string& static const char * es[] ={"e", "e1", "e2", "e3"}; - static char * fs[] ={"f", "f1", "f2", "f3"}; - static char * hs[] ={"h", "h1", "h2", "h3"}; + static const char * fs[] ={"f", "f1", "f2", "f3"}; + static const char * hs[] ={"h", "h1", "h2", "h3"}; const char * e = es[level]; const char * f = fs[level]; diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp index 853d487ba..bf405ab5c 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/variables.cpp @@ -331,7 +331,7 @@ REGISTER_VAR_INDIRECT(CVarSBrick, "var_sbrick"); /* for special item */ -char *SpecialItemProp[] = +const char *SpecialItemProp[] = { "Durability", "Weight", diff --git a/code/ryzom/tools/server/admin/functions_mysql.php b/code/ryzom/tools/server/admin/functions_mysql.php index 6778bbeff..79c968ca9 100644 --- a/code/ryzom/tools/server/admin/functions_mysql.php +++ b/code/ryzom/tools/server/admin/functions_mysql.php @@ -69,7 +69,8 @@ class sql_db } else { - return false; + echo "Connection to mySQL failed!"; + exit; } } diff --git a/code/ryzom/tools/server/brick_param_extractor/brick_param_extractor.cpp b/code/ryzom/tools/server/brick_param_extractor/brick_param_extractor.cpp index 0ff24e0f9..1a4257a99 100644 --- a/code/ryzom/tools/server/brick_param_extractor/brick_param_extractor.cpp +++ b/code/ryzom/tools/server/brick_param_extractor/brick_param_extractor.cpp @@ -490,6 +490,8 @@ void COutputFile::generateOutput() const outbuff+="/*\n"; outbuff+="\tFILE: "; outbuff+=_FileName+"\n\n"; + outbuff+="#ifndef RY_EGS_STATIC_BRICK_CPP_H\n"; + outbuff+="#define RY_EGS_STATIC_BRICK_CPP_H\n\n"; outbuff+="\tWARNING: This file is autogenerated - any modifications will be lost at next regeneration\n\n"; outbuff+="*/\n\n"; @@ -505,6 +507,8 @@ void COutputFile::generateOutput() const _Structures[i].generateOutput(outbuff); } + outbuff+="#endif\n\n"; + // read in the previous version of the output file char *inbuff=NULL; FILE *inf=fopen(_FileName.c_str(),"rb"); @@ -631,17 +635,11 @@ void COutputFile::CStruct::generateOutput(std::string &outbuff) const for (i=0;i<_Params.size();++i) { outbuff+="\t\t"; - outbuff+=_Params[i]._Name+"="; - if (_Params[i]._Type==COutputFile::INT) outbuff+="atoi("; - if (_Params[i]._Type==COutputFile::FLOAT) outbuff+="(float)atof("; - outbuff+="args["; + outbuff+="NLMISC::fromString(args["; if (i>100) outbuff+=('0'+((i/100)%10)); if (i>10) outbuff+=('0'+((i/10)%10)); outbuff+=('0'+(i%10)); - if (_Params[i]._Type==COutputFile::INT || _Params[i]._Type==COutputFile::FLOAT) - outbuff+="].c_str());\n"; - else - outbuff+="].c_str();\n"; + outbuff+="], "+_Params[i]._Name+");\n"; } outbuff+="\n"; outbuff+="\t\treturn *this;\n"; diff --git a/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp b/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp index e7a1b2a33..a9d1daa9e 100644 --- a/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp +++ b/code/ryzom/tools/server/build_world_packed_col/build_world_packed_col.cpp @@ -276,7 +276,7 @@ int main(int argc, char* argv[]) try { CIFile f(builderConfig.CWMapCachePath + "/" + shortname + ".cw_height"); - f.serialCheck((uint32) 'OBSI'); + f.serialCheck(NELID("OBSI")); f.serial(xmin); f.serial(xmax); f.serial(ymin); @@ -322,7 +322,7 @@ int main(int argc, char* argv[]) // now extract each island height // read back coordinates CIFile f(builderConfig.CWMapCachePath + "/" + shortname + ".cw_height"); - f.serialCheck((uint32) 'OBSI'); + f.serialCheck(NELID("OBSI")); f.serial(xmin); f.serial(xmax); f.serial(ymin); @@ -349,7 +349,7 @@ int main(int argc, char* argv[]) try { COFile f(builderConfig.OutputPath + "/" + completeIslands[l]->Island + ".island_hm"); - f.serialCheck((uint32) 'MHSI'); + f.serialCheck(NELID("MHSI")); f.serial(island); // export tga for check if (builderConfig.HeightMapsAsTga) diff --git a/code/ryzom/tools/server/build_world_packed_col/packed_world_builder.cpp b/code/ryzom/tools/server/build_world_packed_col/packed_world_builder.cpp index d08982ae4..810540cf8 100644 --- a/code/ryzom/tools/server/build_world_packed_col/packed_world_builder.cpp +++ b/code/ryzom/tools/server/build_world_packed_col/packed_world_builder.cpp @@ -401,7 +401,7 @@ void CPackedWorldBuilder::fly(std::vector &islands, float camSpeed // fly into scene try { - CNELU::init(1024, 768, CViewport(), 32, true, NULL, false, true); + CNELU::init(1024, 768, CViewport(), 32, true, EmptyWindow, false, true); } catch(const Exception &e) { diff --git a/code/ryzom/tools/server/build_world_packed_col/test_col_world.cpp b/code/ryzom/tools/server/build_world_packed_col/test_col_world.cpp index 21f85b760..27e56403f 100644 --- a/code/ryzom/tools/server/build_world_packed_col/test_col_world.cpp +++ b/code/ryzom/tools/server/build_world_packed_col/test_col_world.cpp @@ -607,7 +607,7 @@ int main(int argc, char* argv[]) // fly into scene try { - CNELU::init(1024, 768, CViewport(), 32, true, NULL, false, true); + CNELU::init(1024, 768, CViewport(), 32, true, EmptyWindow, false, true); } catch(const Exception &e) { diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/assigned.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/assigned.php index 6d2a558c3..8de17a9e2 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/assigned.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/assigned.php @@ -1,13 +1,24 @@ execute("SELECT ticket_user.ExternId FROM `assigned` JOIN `ticket_user` ON assigned.User = ticket_user.TUserId WHERE `Ticket` = :ticket_id", Array('ticket_id' => $ticket_id)); @@ -48,6 +70,12 @@ class Assigned{ } + /** + * Check if a ticket is already assigned (in case the user_id param is used, it will check if it's assigned to that user) + * @param $ticket_id the Id of the ticket that's being queried + * @param $user_id the id of the user, default parameter = 0, by using a user_id, it will check if that user is assigned to the ticket. + * @return true in case it's assigned, false in case it isn't. + */ public static function isAssigned( $ticket_id, $user_id = 0) { $dbl = new DBLayer("lib"); //check if ticket is already assigned @@ -62,16 +90,29 @@ class Assigned{ } ////////////////////////////////////////////Methods//////////////////////////////////////////////////// - + + /** + * A constructor. + * Empty constructor + */ public function __construct() { } - //set values + + /** + * sets the object's attributes. + * @param $values should be an array of the form array('User' => user_id, 'Ticket' => ticket_id). + */ public function set($values) { $this->setUser($values['User']); $this->setTicket($values['Ticket']); } + + /** + * creates a new 'assigned' entry. + * this method will use the object's attributes for creating a new 'assigned' entry in the database. + */ public function create() { $dbl = new DBLayer("lib"); $query = "INSERT INTO `assigned` (`User`,`Ticket`) VALUES (:user, :ticket)"; @@ -79,7 +120,11 @@ class Assigned{ $dbl->execute($query, $values); } - //delete entry + + /** + * deletes an existing 'assigned' entry. + * this method will use the object's attributes for deleting an existing 'assigned' entry in the database. + */ public function delete() { $dbl = new DBLayer("lib"); $query = "DELETE FROM `assigned` WHERE `User` = :user_id and `Ticket` = :ticket_id"; @@ -87,10 +132,14 @@ class Assigned{ $dbl->execute($query, $values); } - //Load with sGroupId - public function load( $user_id, $user_id) { + /** + * loads the object's attributes. + * loads the object's attributes by giving a ticket_id, it will put the matching user_id and the ticket_id into the attributes. + * @param $ticket_id the id of the ticket that should be loaded + */ + public function load($ticket_id) { $dbl = new DBLayer("lib"); - $statement = $dbl->execute("SELECT * FROM `assigned` WHERE `Ticket` = :ticket_id AND `User` = :user_id", Array('ticket_id' => $ticket_id, 'user_id' => $user_id)); + $statement = $dbl->execute("SELECT * FROM `assigned` WHERE `Ticket` = :ticket_id", Array('ticket_id' => $ticket_id)); $row = $statement->fetch(); $this->set($row); } @@ -98,22 +147,37 @@ class Assigned{ ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + /** + * get user attribute of the object. + */ public function getUser(){ return $this->user; } + + /** + * get ticket attribute of the object. + */ public function getTicket(){ return $this->ticket; } ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + /** + * set user attribute of the object. + * @param $u integer id of the user + */ public function setUser($u){ $this->user = $u; } - public function setTicket($g){ - $this->ticket = $g; + /** + * set ticket attribute of the object. + * @param $t integer id of the ticket + */ + public function setTicket($t){ + $this->ticket = $t; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/dblayer.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/dblayer.php index c5b7375c3..af826d084 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/dblayer.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/dblayer.php @@ -1,8 +1,19 @@ PDO->prepare($query); $statement->execute(); return $statement; } + /** + * execute a query that has parameters + * @param $query the mysql query + * @param $params the parameters that are being used by the query + * @return returns a PDOStatement object + */ public function execute($query,$params){ $statement = $this->PDO->prepare($query); $statement->execute($params); return $statement; } + /** + * execute a query (an insertion query) that has parameters and return the id of it's insertion + * @param $query the mysql query + * @param $params the parameters that are being used by the query + * @return returns the id of the last inserted element. + */ public function executeReturnId($query,$params){ $statement = $this->PDO->prepare($query); $this->PDO->beginTransaction(); diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/forwarded.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/forwarded.php index 003811fe9..54fece58c 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/forwarded.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/forwarded.php @@ -1,13 +1,26 @@ load($ticket_id); @@ -29,6 +48,11 @@ class Forwarded{ } + /** + * check if the ticket is forwarded + * @param $ticket_id the id of the ticket. + * @return returns true if the ticket is forwarded, else return false; + */ public static function isForwarded( $ticket_id) { $dbl = new DBLayer("lib"); if( $dbl->execute(" SELECT * FROM `forwarded` WHERE `Ticket` = :ticket_id", array('ticket_id' => $ticket_id))->rowCount()){ @@ -41,15 +65,29 @@ class Forwarded{ ////////////////////////////////////////////Methods//////////////////////////////////////////////////// + + /** + * A constructor. + * Empty constructor + */ public function __construct() { } - //set values + + /** + * sets the object's attributes. + * @param $values should be an array of the form array('Group' => group_id, 'Ticket' => ticket_id). + */ public function set($values) { $this->setGroup($values['Group']); $this->setTicket($values['Ticket']); } + + /** + * creates a new 'forwarded' entry. + * this method will use the object's attributes for creating a new 'forwarded' entry in the database. + */ public function create() { $dbl = new DBLayer("lib"); $query = "INSERT INTO `forwarded` (`Group`,`Ticket`) VALUES (:group, :ticket)"; @@ -57,7 +95,11 @@ class Forwarded{ $dbl->execute($query, $values); } - //delete entry + + /** + * deletes an existing 'forwarded' entry. + * this method will use the object's attributes for deleting an existing 'forwarded' entry in the database. + */ public function delete() { $dbl = new DBLayer("lib"); $query = "DELETE FROM `forwarded` WHERE `Group` = :group_id and `Ticket` = :ticket_id"; @@ -65,7 +107,12 @@ class Forwarded{ $dbl->execute($query, $values); } - //Load with sGroupId + + /** + * loads the object's attributes. + * loads the object's attributes by giving a ticket_id, it will put the matching group_id and the ticket_id into the attributes. + * @param $ticket_id the id of the ticket that should be loaded + */ public function load( $ticket_id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM `forwarded` WHERE `Ticket` = :ticket_id", Array('ticket_id' => $ticket_id)); @@ -75,21 +122,35 @@ class Forwarded{ ////////////////////////////////////////////Getters//////////////////////////////////////////////////// - + + /** + * get group attribute of the object. + */ public function getGroup(){ return $this->group; } + /** + * get ticket attribute of the object. + */ public function getTicket(){ return $this->ticket; } ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + /** + * set group attribute of the object. + * @param $g integer id of the group + */ public function setGroup($g){ $this->group = $g; } + /** + * set ticket attribute of the object. + * @param $t integer id of the ticket + */ public function setTicket($t){ $this->ticket = $t; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/gui_elements.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/gui_elements.php index cb932afe5..e09de1621 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/gui_elements.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/gui_elements.php @@ -1,40 +1,63 @@ ', $function); - $intermediate_result = NULL; - foreach($fnames as $fname) { - if(substr($fname, -2) == "()") { - $fname = substr($fname, 0, strlen($fname)-2); - if($intermediate_result == NULL) { - $intermediate_result = $element->$fname(); + if(!empty($inputList)){ + foreach($inputList as $element){ + $j = 0; + foreach($funcArray as $function){ + $fnames = explode('->', $function); + $intermediate_result = NULL; + foreach($fnames as $fname) { + if(substr($fname, -2) == "()") { + $fname = substr($fname, 0, strlen($fname)-2); + if($intermediate_result == NULL) { + $intermediate_result = $element->$fname(); + } else { + $intermediate_result = $intermediate_result->$fname(); + } } else { - $intermediate_result = $intermediate_result->$fname(); - } - } else { - if($intermediate_result == NULL) { - $intermediate_result = $element->$fname(); - } else { - $intermediate_result = $intermediate_result->$fname(); + if($intermediate_result == NULL) { + $intermediate_result = $element->$fname(); + } else { + $intermediate_result = $intermediate_result->$fname(); + } } } + $result[$i][$fieldArray[$j]] = $intermediate_result; + $j++; } - $result[$i][$fieldArray[$j]] = $intermediate_result; - $j++; + $i++; } - $i++; } return $result; } - + /** + * creates an array of information out of a list of objects which can be used to form a table with a key as id. + * The idea is comparable to the make_table() function, though this time the results are stored in the index that is returned by the idFunction() + * @param $inputList the list of objects of which we want to make a table. + * @param $funcArray a list of methods of that object we want to perform. + * @param $idFunction a function that returns an id that will be used as index to store our result + * @return an array which holds the results of the methods in $funcArray on each object in the $inputList, though thearrays indexes are formed by using the idFunction. + */ public static function make_table_with_key_is_id( $inputList, $funcArray, $idFunction){ $result = Array(); foreach($inputList as $element){ @@ -46,6 +69,11 @@ class Gui_Elements{ } + /** + * returns the elapsed time from a timestamp up till now. + * @param $ptime a timestamp. + * @return a string in the form of A years, B months, C days, D hours, E minutes, F seconds ago. + */ public static function time_elapsed_string($ptime){ global $TIME_FORMAT; $ptime = DateTime::createFromFormat($TIME_FORMAT, $ptime)->getTimestamp(); diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php index 233f44510..9f8d61cbc 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/helpers.php @@ -1,24 +1,46 @@ setCompileDir($SITEBASE.'/templates_c/'); + $smarty->setCacheDir($SITEBASE.'/cache/'); + $smarty -> setConfigDir($SITEBASE . '/configs/' ); // turn smarty debugging on/off - $smarty -> debugging = false; + $smarty -> debugging = false; // caching must be disabled for multi-language support - $smarty -> caching = false; + $smarty -> caching = false; $smarty -> cache_lifetime = 120; + //needed by smarty. helpers :: create_folders (); - - if ( helpers::check_if_game_client() or $forcelibrender = false ){ + global $FORCE_INGAME; + + //if ingame, then use the ingame templates + if ( helpers::check_if_game_client() or $FORCE_INGAME ){ $smarty -> template_dir = $AMS_LIB . '/ingame_templates/'; $smarty -> setConfigDir( $AMS_LIB . '/configs' ); $variables = parse_ini_file( $AMS_LIB . '/configs/ingame_layout.ini', true ); @@ -34,12 +56,13 @@ class Helpers{ $smarty -> assign( $key, $value ); } - + //load page specific variables that are language dependent $variables = Helpers::handle_language(); foreach ( $variables[$template] as $key => $value ){ $smarty -> assign( $key, $value ); } - + + //smarty inheritance for loading the matching wrapper layout (with the matching menu bar) if( isset($vars['permission']) && $vars['permission'] == 3 ){ $inherited = "extends:layout_admin.tpl|"; }else if( isset($vars['permission']) && $vars['permission'] == 2){ @@ -49,10 +72,20 @@ class Helpers{ }else{ $inherited =""; } - // extends:' . $inherited .'|register.tpl - $smarty -> display( $inherited . $template . '.tpl' ); - } + //if $returnHTML is set to true, return the html by fetching the template else display the template. + if($returnHTML == true){ + return $smarty ->fetch($inherited . $template . '.tpl' ); + }else{ + $smarty -> display( $inherited . $template . '.tpl' ); + } + } + + + /** + * creates the folders that are needed for smarty. + * @todo for the drupal module it might be possible that drupal_mkdir needs to be used instead of mkdir, also this should be in the install.php instead. + */ static public function create_folders(){ global $AMS_LIB; global $SITEBASE; @@ -65,61 +98,109 @@ class Helpers{ $SITEBASE . '/configs' ); foreach ( $arr as & $value ){ + if ( !file_exists( $value ) ){ - echo $value; - mkdir( $value); + print($value); + mkdir($value); } } } + + /** + * check if the http request is sent ingame or not. + * @return returns true in case it's sent ingame, else false is returned. + */ static public function check_if_game_client() { // if HTTP_USER_AGENT is not set then its ryzom core - if ( strpos($_SERVER['HTTP_USER_AGENT'],"Ryzom") === 0){ + global $FORCE_INGAME; + if ( ( isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'],"Ryzom") === 0)) || $FORCE_INGAME || ! isset($_SERVER['HTTP_USER_AGENT']) ){ return true; }else{ return false; - } + } } + + /** + * Handles the language specific aspect. + * The language can be changed by setting the $_GET['Language'] & $_GET['setLang'] together. This will also change the language entry of the user in the db. + * Cookies are also being used in case the user isn't logged in. + * @return returns the parsed content of the language .ini file related to the users language setting. + */ static public function handle_language(){ global $DEFAULT_LANGUAGE; global $AMS_TRANS; - //if language get param is given = set cookie - //else if no get param is given and a cookie is set, use that language, else use default. - if ( isset( $_GET['language'] ) ) { - //check if the language is supported - if ( file_exists( $AMS_TRANS . '/' . $_GET['language'] . '.ini' ) ){ - //if it's supported, set cookie! - setcookie( 'language',$_GET['language'], time() + 60*60*24*30 ); - $language = $_GET['language']; + //if user wants to change the language + if(isset($_GET['Language']) && isset($_GET['setLang'])){ + //The ingame client sometimes sends full words, derive those! + switch($_GET['Language']){ + + case "English": + $lang = "en"; + break; + + case "French": + $lang = "fr"; + break; + + default: + $lang = $_GET['Language']; + } + //if the file exists en the setLang = true + if( file_exists( $AMS_TRANS . '/' . $lang . '.ini' ) && $_GET['setLang'] == "true"){ + //set a cookie & session var and incase logged in write it to the db! + setcookie( 'Language', $lang , time() + 60*60*24*30 ); + $_SESSION['Language'] = $lang; + if(WebUsers::isLoggedIn()){ + WebUsers::setLanguage($_SESSION['id'],$lang); + } }else{ - //the language is not supported, use the default. - $language = $DEFAULT_LANGUAGE; + $_SESSION['Language'] = $DEFAULT_LANGUAGE; } }else{ - //if no get param is given, check if a cookie value for language is set - if ( isset( $_COOKIE['language'] ) ) { - $language = $_COOKIE['language']; - } - //else use the default - else{ - $language = $DEFAULT_LANGUAGE; + //if the session var is not set yet + if(!isset($_SESSION['Language'])){ + //check if a cookie already exists for it + if ( isset( $_COOKIE['Language'] ) ) { + $_SESSION['Language'] = $_COOKIE['Language']; + //else use the default language + }else{ + $_SESSION['Language'] = $DEFAULT_LANGUAGE; + } } } - - return parse_ini_file( $AMS_TRANS . '/' . $language . '.ini', true ); + + if ($_SESSION['Language'] == ""){ + $_SESSION['Language'] = $DEFAULT_LANGUAGE; + } + return parse_ini_file( $AMS_TRANS . '/' . $_SESSION['Language'] . '.ini', true ); + } - - //Time output function for handling the time display function. - static public function outputTime($time){ + + /** + * Time output function for handling the time display. + * @return returns the time in the format specified in the $TIME_FORMAT global variable. + */ + static public function outputTime($time, $str = 1){ global $TIME_FORMAT; - return date($TIME_FORMAT,strtotime($time)); + if($str){ + return date($TIME_FORMAT,strtotime($time)); + }else{ + return date($TIME_FORMAT,$time); + } } + /** + * Auto login function for ingame use. + * This function will allow users who access the website ingame, to log in without entering the username and password. It uses the COOKIE entry in the open_ring db. + * it checks if the cookie sent by the http request matches the one in the db. This cookie in the db is changed everytime the user relogs. + * @return returns "FALSE" if the cookies didn't match, else it returns an array with the user's id and name. + */ static public function check_login_ingame(){ if ( helpers :: check_if_game_client () or $forcelibrender = false ){ $dbr = new DBLayer("ring"); diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/in_support_group.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/in_support_group.php index b01517db2..bf10d3d9a 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/in_support_group.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/in_support_group.php @@ -1,13 +1,23 @@ user_id, 'Group' => support_groups_id). + */ public function set($values) { $this->setUser($values['User']); $this->setGroup($values['Group']); } + + /** + * creates a new 'in_support_group' entry. + * this method will use the object's attributes for creating a new 'in_support_group' entry in the database. + */ public function create() { $dbl = new DBLayer("lib"); $query = "INSERT INTO `in_support_group` (`User`,`Group`) VALUES (:user, :group)"; @@ -36,7 +59,11 @@ class In_Support_Group{ $dbl->execute($query, $values); } - //delete entry + + /** + * deletes an existing 'in_support_group' entry. + * this method will use the object's attributes for deleting an existing 'in_support_group' entry in the database. + */ public function delete() { $dbl = new DBLayer("lib"); $query = "DELETE FROM `in_support_group` WHERE `User` = :user_id and `Group` = :group_id"; @@ -44,31 +71,48 @@ class In_Support_Group{ $dbl->execute($query, $values); } - //Load with sGroupId - public function load( $user_id, $group_id) { + /* + public function load($group_id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM `in_support_group` WHERE `Group` = :group_id", Array('group_id' => $group_id)); $row = $statement->fetch(); $this->set($row); } + */ ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + /** + * get user attribute of the object. + */ public function getUser(){ return $this->user; } + + /** + * get group attribute of the object. + */ public function getGroup(){ return $this->group; } ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + /** + * set user attribute of the object. + * @param $u integer id of the user + */ public function setUser($u){ $this->user = $u; } + + /** + * set group attribute of the object. + * @param $g integer id of the support group + */ public function setGroup($g){ $this->group = $g; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/mail_handler.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/mail_handler.php index 4c5e14caf..dde8d4e02 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/mail_handler.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/mail_handler.php @@ -1,52 +1,124 @@ getTId() . " ----------\n You received a new reply on your ticket: " . $ticketObj->getTitle() . - "\n --------------------\n\n"; - $subject = "New reply on [Ticket #" . $ticketObj->getTId() ."]"; - $endTxt = "\n\n----------\nYou can reply on this message to answer directly on the ticket!"; - $txt = $txt . $content . $endTxt; - self::send_mail($ticketObj->getAuthor(),$subject,$txt, $ticketObj->getTId(),$author); - }else if($type == "NEW"){ - $txt = "---------- Ticket #". $ticketObj->getTId() . " ----------\n Your ticket: " . $ticketObj->getTitle() . " is newly created"; - if($ticketObj->getAuthor() != $author){ - $txt = $txt . " by " . Ticket_User::get_username_from_id($author); - }else{ - $author = $ticketObj->getAuthor(); - } - $txt = $txt . "\n --------------------\n\n"; - $subject = "New ticket created [Ticket #" . $ticketObj->getTId() ."]"; - $endTxt = "\n\n----------\nYou can reply on this message to answer directly on the ticket!"; - $txt = $txt . $content . $endTxt; - self::send_mail($ticketObj->getAuthor(),$subject,$txt, $ticketObj->getTId()); + global $MAIL_LOG_PATH; + //error_log("Receiver: {$receiver}, content: {$content}, type: {$type}, SendingId: {$sender} \n", 3, $MAIL_LOG_PATH); + if($sender == 0){ + //if it is not forwarded (==public == which returns 0) then make it NULL which is needed to be placed in the DB. + $sender = NULL; } + global $AMS_TRANS; + if(is_numeric($receiver)){ + $webUser = new WebUsers($receiver); + $lang = $webUser->getLanguage(); + }else{ + global $DEFAULT_LANGUAGE; + $lang = $DEFAULT_LANGUAGE; + } + $variables = parse_ini_file( $AMS_TRANS . '/' . $lang . '.ini', true ); + $mailText = array(); + foreach ( $variables['email'] as $key => $value ){ + $mailText[$key] = $value; + } + + switch($type){ + case "REPLY": + $webUser = new WebUsers($receiver); + if($webUser->getReceiveMail()){ + $subject = $mailText['email_subject_new_reply'] . $ticketObj->getTId() ."]"; + $txt = $mailText['email_body_new_reply_1']. $ticketObj->getTId() . $mailText['email_body_new_reply_2'] . $ticketObj->getTitle() . + $mailText['email_body_new_reply_3'] . $content . $mailText['email_body_new_reply_4']; + self::send_mail($receiver,$subject,$txt, $ticketObj->getTId(),$sender); + } + break; + + case "NEW": + $webUser = new WebUsers($receiver); + if($webUser->getReceiveMail()){ + $subject = $mailText['email_subject_new_ticket'] . $ticketObj->getTId() ."]"; + $txt = $mailText['email_body_new_ticket_1'] . $ticketObj->getTId() . $mailText['email_body_new_ticket_2'] . $ticketObj->getTitle() . $mailText['email_body_new_ticket_3'] + . $content . $mailText['email_body_new_ticket_4']; + self::send_mail($receiver,$subject,$txt, $ticketObj->getTId(), $sender); + } + break; + + case "WARNAUTHOR": + if(is_numeric($sender)){ + $sender = Ticket_User::get_email_by_user_id($sender); + } + $subject = $mailText['email_subject_warn_author'] . $ticketObj->getTId() ."]"; + $txt = $mailText['email_body_warn_author_1'] . $ticketObj->getTitle() .$mailText['email_body_warn_author_2'].$sender.$mailText['email_body_warn_author_3']. + $sender. $mailText['email_body_warn_author_4'] ; + self::send_mail($receiver,$subject,$txt, $ticketObj->getTId(), NULL); + break; + + case "WARNSENDER": + $subject = $mailText['email_subject_warn_sender']; + $txt = $mailText['email_body_warn_sender']; + self::send_mail($receiver,$subject,$txt, $ticketObj->getTId(), NULL); + break; + + case "WARNUNKNOWNSENDER": + $subject = $mailText['email_subject_warn_unknown_sender']; + $txt = $mailText['email_body_warn_unknown_sender']; + self::send_mail($receiver,$subject,$txt, $ticketObj->getTId(), NULL); + break; + + } } } - - public static function send_mail($recipient, $subject, $body, $ticket_id = 0, $from = 1) { + /** + * send mail function that will add the email to the db. + * this function is being used by the send_ticketing_mail() function. It adds the email as an entry to the `email` table in the database, which will be sent later on when we run the cron job. + * @param $recipient if integer, then it refers to the id of the user to whom we want to mail, if it's a string(email-address) then we will use that. + * @param $subject the subject of the email + * @param $body the body of the email + * @param $ticket_id the id of the ticket + * @param $from the sending support_group's id (NULL in case the default group is sending)) + */ + public static function send_mail($recipient, $subject, $body, $ticket_id = 0, $from = NULL) { + $id_user = NULL; if(is_numeric($recipient)) { $id_user = $recipient; $recipient = NULL; } + $query = "INSERT INTO email (Recipient,Subject,Body,Status,Attempts,Sender,UserId,MessageId,TicketId) VALUES (:recipient, :subject, :body, :status, :attempts, :sender, :id_user, :messageId, :ticketId)"; $values = array('recipient' => $recipient, 'subject' => $subject, 'body' => $body, 'status' => 'NEW', 'attempts'=> 0, 'sender' => $from,'id_user' => $id_user, 'messageId' => 0, 'ticketId'=> $ticket_id); $db = new DBLayer("lib"); @@ -55,37 +127,44 @@ class Mail_Handler{ } - //the main function + /** + * the cron funtion (workhorse of the mailing system). + * The cron job will create a child process, which will first send the emails that are in the email table in the database, we use some kind of semaphore (a temp file) to make sure that + * if the cron job is called multiple times, it wont email those mails multiple times. After this, we will read the mail inboxes of the support groups and the default group using IMAP + * and we will add new tickets or new replies according to the incoming emails. + */ function cron() { global $cfg; - $inbox_username = $cfg['mail']['username']; - $inbox_password = $cfg['mail']['password']; + global $MAIL_LOG_PATH; + $default_groupemail = $cfg['mail']['default_groupemail']; + $default_groupname = $cfg['mail']['default_groupname']; + /* $inbox_host = $cfg['mail']['host']; - $oms_reply_to = "Ryzom Ticketing Support "; + $oms_reply_to = "Ryzom Ticketing Support ";*/ global $MAIL_DIR; - - // Deliver new mail - echo("mail cron\n"); + error_log("========================================================\n", 3, $MAIL_LOG_PATH); + error_log("mailing cron Job started at: ". Helpers::outputTime(time(),0) . "\n", 3, $MAIL_LOG_PATH); //creates child process $pid = self::mail_fork(); $pidfile = '/tmp/ams_cron_email_pid'; - - //INFO: if $pid = - //-1: "Could not fork!\n"; - // 0: "In child!\n"; - //>0: "In parent!\n"; if($pid) { // We're the parent process, do nothing! + //INFO: if $pid = + //-1: "Could not fork!\n"; + // 0: "In child!\n"; + //>0: "In parent!\n"; } else { + //deliver new mail //make db connection here because the children have to make the connection. $this->db = new DBLayer("lib"); //if $pidfile doesn't exist yet, then start sending the mails that are in the db. if(!file_exists($pidfile)) { + //create the file and write the child processes id in it! $pid = getmypid(); $file = fopen($pidfile, 'w'); @@ -101,67 +180,95 @@ class Mail_Handler{ $message_id = self::new_message_id($email['TicketId']); //if recipient isn't given, then use the email of the id_user instead! - echo("Emailing {$email['Recipient']}\n"); if(!$email['Recipient']) { $email['Recipient'] = Ticket_User::get_email_by_user_id($email['UserId']); } - //create sending email adres based on the $sender id - if($email['Sender'] != 0) { - $username = Ticket_User::get_username_from_id($email['Sender']); - $from = "$username <$username@$inbox_host>"; + //create sending email adres based on the $sender id which refers to the department id + if($email['Sender'] == NULL) { + $from = $default_groupname ." <".$default_groupemail.">"; } else { - $from = $oms_reply_to; + $group = Support_Group::getGroup($email['Sender']); + $from = $group->getName()." <".$group->getGroupEmail().">"; } + $headers = "From: $from\r\n" . "Message-ID: " . $message_id ; - print("recip: " . $email['Recipient']); - print("subj: " .$email['Subject']); - print("body: " . $email['Body']); - print("headers: " . $headers); + if(mail($email['Recipient'], $email['Subject'], $email['Body'], $headers)) { $status = "DELIVERED"; - echo("Emailed {$email['Recipient']}\n"); + error_log("Emailed {$email['Recipient']}\n", 3, $MAIL_LOG_PATH); } else { $status = "FAILED"; - echo("Email to {$email['Recipient']} failed\n"); + error_log("Email to {$email['Recipient']} failed\n", 3, $MAIL_LOG_PATH); } //change the status of the emails. $this->db->execute('update email set Status = ?, MessageId = ?, Attempts = Attempts + 1 where MailId = ?', array($status, $message_id, $email['MailId'])); - //db_exec('update email set status = ?, message_id = ?, attempts = attempts + 1 where id_email = ?', array($status, $message_id, $email['id_email'])); + } unlink($pidfile); } // Check mail + $sGroups = Support_Group::getGroups(); - //$mailbox = imap_open("{localhost:110/pop3/novalidate-cert}INBOX", $inbox_username, $inbox_password); - $mbox = imap_open($cfg['mail']['server'], $inbox_username, $inbox_password) or die('Cannot connect to mail server: ' . imap_last_error()); - $message_count = imap_num_msg($mbox); - - for ($i = 1; $i <= $message_count; ++$i) { - - //return task ID - self::incoming_mail_handler($mbox, $i); - $tid = 1; //self::ams_create_email($from, $subject, $txt, $html, $to, $from); - - if($tid) { - //TODO: base file on Ticket + reply id - /* $file = fopen($MAIL_DIR."/mail/".$tid, 'w'); - fwrite($file, $entire_email); - fclose($file); */ - } - //mark message $i of $mbox for deletion! - imap_delete($mbox, $i); + //decrypt passwords in the db! + $crypter = new MyCrypt($cfg['crypt']); + foreach($sGroups as $group){ + $group->setIMAP_Password($crypter->decrypt($group->getIMAP_Password())); } - //delete marked messages - imap_expunge($mbox); - imap_close($mbox); + $defaultGroup = new Support_Group(); + $defaultGroup->setSGroupId(0); + $defaultGroup->setGroupEmail($default_groupemail); + $defaultGroup->setIMAP_MailServer($cfg['mail']['default_mailserver']); + $defaultGroup->setIMAP_Username($cfg['mail']['default_username']); + $defaultGroup->setIMAP_Password($cfg['mail']['default_password']); + + //add default group to the list + $sGroups[] = $defaultGroup; + + foreach($sGroups as $group){ + //check if group has mailing stuff filled in! + if($group->getGroupEmail() != "" && $group->getIMAP_MailServer() != "" && $group->getIMAP_Username() != "" && $group->getIMAP_Password() != ""){ + $mbox = imap_open($group->getIMAP_MailServer(), $group->getIMAP_Username(), $group->getIMAP_Password()) or die('Cannot connect to mail server: ' . imap_last_error()); + $message_count = imap_num_msg($mbox); + + for ($i = 1; $i <= $message_count; ++$i) { + + //return task ID + $tkey = self::incoming_mail_handler($mbox, $i,$group); + + if($tkey) { + //base file on Ticket + timestamp + $file = fopen($MAIL_DIR."/ticket".$tkey, 'w'); + error_log("Email was written to ".$MAIL_DIR."/ticket".$tkey."\n", 3, $MAIL_LOG_PATH); + fwrite($file, imap_fetchheader($mbox, $i) . imap_body($mbox, $i)); + fclose($file); + + //mark message $i of $mbox for deletion! + imap_delete($mbox, $i); + } + + } + //delete marked messages + imap_expunge($mbox); + imap_close($mbox); + } + } + error_log("Child Cron job finished at ". Helpers::outputTime(time(),0) . "\n", 3, $MAIL_LOG_PATH); + error_log("========================================================\n", 3, $MAIL_LOG_PATH); } + } + /** + * creates a new message id for a email about to send. + * @param $ticketId the ticket id of the ticket that is mentioned in the email. + * @return returns a string, that consist out of some variable parts, a consistent part and the ticket_id. The ticket_id will be used lateron, if someone replies on the message, + * to see to which ticket the reply should be added. + */ function new_message_id($ticketId) { $time = time(); $pid = getmypid(); @@ -172,21 +279,57 @@ class Mail_Handler{ } + /** + * try to fetch the ticket_id out of the subject. + * The subject should have a substring of the form [Ticket \#ticket_id], where ticket_id should be the integer ID of the ticket. + * @param $subject the subject of an incomming email. + * @return if the ticket's id is succesfully parsed, it will return the ticket_id, else it returns 0. + */ function get_ticket_id_from_subject($subject){ $startpos = strpos($subject, "[Ticket #"); - $tempString = substr($subject, $startpos+9); - $endpos = strpos($tempString, "]"); - $ticket_id = substr($tempString, 0, $endpos); + if($startpos){ + $tempString = substr($subject, $startpos+9); + $endpos = strpos($tempString, "]"); + if($endpos){ + $ticket_id = substr($tempString, 0, $endpos); + }else{ + $ticket_id = 0; + } + }else{ + $ticket_id = 0; + } return $ticket_id; } - function incoming_mail_handler($mbox,$i){ + /** + * Handles an incomming email + * Read the content of one email by using imap's functionality. If a ticket id is found inside the message_id or else in the subject line, then a reply will be added + * (if the email is not being sent from the authors email address it won't be added though and a warning will be sent to both parties). If no ticket id is found, then a new + * ticket will be created. + * @param $mbox a mailbox object + * @param $i the email's id in the mailbox (integer) + * @param $group the group object that owns the inbox. + * @return a string based on the found ticket i and timestamp (will be used to store a copy of the email locally) + */ + function incoming_mail_handler($mbox,$i,$group){ + + global $MAIL_LOG_PATH; $header = imap_header($mbox, $i); $subject = self::decode_utf8($header->subject); + $entire_email = imap_fetchheader($mbox, $i) . imap_body($mbox, $i); + $subject = self::decode_utf8($header->subject); + $to = $header->to[0]->mailbox; + $from = $header->from[0]->mailbox . '@' . $header->from[0]->host; + $fromEmail = $header->from[0]->mailbox . '@' . $header->from[0]->host; + $txt = self::get_part($mbox, $i, "TEXT/PLAIN"); + //$html = self::get_part($mbox, $i, "TEXT/HTML"); - print_r($header); + //get the id out of the email address of the person sending the email. + if($from !== NULL && !is_numeric($from)){ + $from = Ticket_User::get_id_from_email($from); + } //get ticket_id out of the message-id or else out of the subject line $ticket_id = 0; @@ -201,114 +344,73 @@ class Mail_Handler{ $ticket_id = self::get_ticket_id_from_subject($subject); } - //if ticket id is found - if($ticket_id){ - - $entire_email = imap_fetchheader($mbox, $i) . imap_body($mbox, $i); - $subject = self::decode_utf8($header->subject); - $to = $header->to[0]->mailbox; - $from = $header->from[0]->mailbox . '@' . $header->from[0]->host; - $txt = self::get_part($mbox, $i, "TEXT/PLAIN"); - //$html = self::get_part($mbox, $i, "TEXT/HTML"); - - //use the line ---------- Ticket # to make a distincton between the old message and the reply - $endpos = strpos($txt, ">---------- Ticket #"); - if($endpos){ - $txt = substr($txt, 0, $endpos); - }else{ - $endpos = strpos($txt, "---------- Ticket #"); - if($endpos){ - $txt = substr($txt, 0, $endpos); - } - } - - - //get the id out of the email address of the person sending the email. - if($from !== NULL && !is_numeric($from)) $from = Ticket_User::get_id_from_email($from); - - $user = new Ticket_User(); - $user->load_With_TUserId($from); + //if ticket id is found, that means it is a reply on an existing ticket + if($ticket_id && is_numeric($ticket_id) && $ticket_id > 0){ $ticket = new Ticket(); $ticket->load_With_TId($ticket_id); - //if user has access to it! - if((Ticket_User::isMod($user) or ($ticket->getAuthor() == $user->getTUserId())) and $txt != ""){ - Ticket::createReply($txt, $user->getTUserId(), $ticket->getTId(), 0); + //if email is sent from an existing email address in the db (else it will give an error while loading the user object) + if($from != "FALSE"){ + + $user = new Ticket_User(); + $user->load_With_TUserId($from); + + //if user has access to it! + if((Ticket_User::isMod($user) or ($ticket->getAuthor() == $user->getTUserId())) and $txt != ""){ + + Ticket::createReply($txt, $user->getTUserId(), $ticket->getTId(), 0); + error_log("Email found that is a reply to a ticket at:".$group->getGroupEmail()."\n", 3, $MAIL_LOG_PATH); + + }else{ + //if user has no access to it + //Warn real ticket owner + person that send the mail + Mail_Handler::send_ticketing_mail($ticket->getAuthor(),$ticket, NULL , "WARNAUTHOR" , $from); + Mail_Handler::send_ticketing_mail($from ,$ticket, NULL , "WARNSENDER" , NULL); + + error_log("Email found that was a reply to a ticket, though send by another user to ".$group->getGroupEmail()."\n", 3, $MAIL_LOG_PATH); + + } + + }else{ + + //if a reply to a ticket is being sent by a non-user! + //Warn real ticket owner + person that send the mail + Mail_Handler::send_ticketing_mail($ticket->getAuthor() ,$ticket, NULL , "WARNAUTHOR" , $fromEmail); + Mail_Handler::send_ticketing_mail($fromEmail ,$ticket, NULL , "WARNUNKNOWNSENDER" , NULL); + + error_log("Email found that was a reply to a ticket, though send by an unknown email address to ".$group->getGroupEmail()."\n", 3, $MAIL_LOG_PATH); + } + + return $ticket_id .".".time(); + }else if($from != "FALSE"){ + + //if ticket_id isn't found, create a new ticket! + //if an existing email address mailed the ticket + + //if not default group, then forward it by giving the $group->getSGroupId's param + $newTicketId = Ticket::create_Ticket($subject, $txt,1, $from, $from, $group->getSGroupId()); + + error_log("Email regarding new ticket found at:".$group->getGroupEmail()."\n", 3, $MAIL_LOG_PATH); + + return $newTicketId .".".time(); + + + }else{ + //if it's a email that has nothing to do with ticketing, return 0; + error_log("Email found that isn't a reply or new ticket, at:".$group->getGroupEmail()."\n", 3, $MAIL_LOG_PATH); + return 0; } } - /*function ams_create_email($from, $subject, $body, $html, $recipient = 0, $sender = NULL) { - - //TODO: - if($recipient == 0 && !is_string($recipient)) { - global $user; - $recipient = $user->uid; - } - - if($sender !== NULL && !is_numeric($sender)) $sender = self::get_id_from_username($sender); - if(!is_numeric($recipient)) $recipient = self::get_id_from_username($recipient); - - $message = array( - 'creator' => $sender, - 'owner' => $recipient, - 'type' => 'email', - 'summary' => $subject, - 'data' => array ( - 'subject' => $subject, - 'body' => $body, - 'html' => $html, - 'sender' => oms_get_username_from_id($sender), - 'from' => $from, - 'recipient' => oms_get_username_from_id($recipient), - 'time' => time(), - ), - ); - - //TO ASK: - oms_task_create($message); - oms_task_index($message, array('subject', 'body', 'sender', 'recipient')); - //--------------------------- - return $message['id_task']; - }*/ - - - /*function oms_get_email($id) { - - $message = oms_task_load($id); - if($message) { - oms_prepare_email($message); - return $message; - } else { - return FALSE; - } - - }*/ - - - - /*function oms_prepare_email(&$message) { - - $data = $message['data']; - $data['id_message'] = $message['id_task']; - $data['read'] = ($message['status'] != 'NEW' && $message['status'] != 'UNREAD'); - $message = $data; - - }*/ - - - - /*function oms_email_mark_read($mid) { - - db_exec("update task set status = 'READ' where id_task = ? and type = 'email' and module = 'email'", array($mid)); - - }*/ - - - + /** + * decode utf8 + * @param $str str to be decoded + * @return decoded string + */ function decode_utf8($str) { preg_match_all("/=\?UTF-8\?B\?([^\?]+)\?=/i",$str, $arr); @@ -320,10 +422,12 @@ class Mail_Handler{ } - - - - + /** + * returns the mime type of a structure of a email + * @param &$structure the structure of an email message. + * @return "TEXT", "MULTIPART","MESSAGE", "APPLICATION", "AUDIO","IMAGE", "VIDEO", "OTHER","TEXT/PLAIN" + * @todo take care of the HTML part of incoming emails. + */ function get_mime_type(&$structure) { $primary_mime_type = array("TEXT", "MULTIPART","MESSAGE", "APPLICATION", "AUDIO","IMAGE", "VIDEO", "OTHER"); @@ -335,7 +439,7 @@ class Mail_Handler{ } - + //to document.. function get_part($stream, $msg_number, $mime_type, $structure = false, $part_number = false) { if(!$structure) { @@ -375,4 +479,5 @@ class Mail_Handler{ } // END OF FUNCTION -} \ No newline at end of file +} + diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/mycrypt.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/mycrypt.php new file mode 100644 index 000000000..6c027e52a --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/mycrypt.php @@ -0,0 +1,85 @@ +config = $cryptinfo; + } + + /** + * encrypts by using the given enc_method and hash_method. + * It will first check if the methods are supported, if not it will throw an error, if so it will encrypt the $data + * @param $data the string that we want to encrypt. + * @return the encrypted string. + */ + public function encrypt($data) { + + self::check_methods($this->config['enc_method'], $this->config['hash_method']); + $iv = self::hashIV($this->config['key'], $this->config['hash_method'], openssl_cipher_iv_length($this->config['enc_method'])); + $infostr = sprintf('$%s$%s$', $this->config['enc_method'], $this->config['hash_method']); + return $infostr . openssl_encrypt($data, $this->config['enc_method'], $this->config['key'], false, $iv); + } + + /** + * decrypts by using the given enc_method and hash_method. + * @param $edata the encrypted string that we want to decrypt + * @return the decrypted string. + */ + public function decrypt($edata) { + $e_arr = explode('$', $edata); + if( count($e_arr) != 4 ) { + Throw new Exception('Given data is missing crucial sections.'); + } + $this->config['enc_method'] = $e_arr[1]; + $this->config['hash_method'] = $e_arr[2]; + self::check_methods($this->config['enc_method'], $this->config['hash_method']); + $iv = self::hashIV($this->config['key'], $this->config['hash_method'], openssl_cipher_iv_length($this->config['enc_method'])); + return openssl_decrypt($e_arr[3], $this->config['enc_method'], $this->config['key'], false, $iv); + } + + /** + * hashes the key by using a hash method specified. + * @param $key the key to be hashed + * @param $method the metho of hashing to be used + * @param $iv_size the size of the initialization vector. + * @return return the hashed key up till the size of the iv_size param. + */ + private static function hashIV($key, $method, $iv_size) { + $myhash = hash($method, $key, TRUE); + while( strlen($myhash) < $iv_size ) { + $myhash .= hash($method, $myhash, TRUE); + } + return substr($myhash, 0, $iv_size); + } + + /** + * checks if the encryption and hash methods are supported + * @param $enc the encryption method. + * @param $hash the hash method. + * @throw Exception in case a method is not supported. + */ + private static function check_methods($enc, $hash) { + + if( ! function_exists('openssl_encrypt') ) { + Throw new Exception('openssl_encrypt() not supported.'); + } else if( ! in_array($enc, openssl_get_cipher_methods()) ) { + Throw new Exception('Encryption method ' . $enc . ' not supported.'); + } else if( ! in_array(strtolower($hash), hash_algos()) ) { + Throw new Exception('Hashing method ' . $hash . ' not supported.'); + } + } + + + +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/pagination.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/pagination.php index 3c4473170..182d9f5af 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/pagination.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/pagination.php @@ -1,12 +1,28 @@ current= 1; @@ -52,22 +68,47 @@ class Pagination{ } + /** + * return the number of the 'last' object attribute + * @return the number of the last page + */ public function getLast(){ return $this->last; } + + /** + * return the number of the 'current' object attribute + * @return the number of the current page + */ public function getCurrent(){ return $this->current; } + + /** + * return the elements array of the object + * @return the elements of a specific page (these are instantiations of the class passed as parameter ($resultClass) to the constructor) + */ public function getElements(){ return $this->element_array; } + + /** + * return total amount of rows for the original query + * @return the total amount of rows for the original query + */ public function getAmountOfRows(){ return $this->amountOfRows; } + /** + * return the page links. + * (for browsing the pages, placed under a table for example) the $nrOfLinks parameter specifies the amount of links you want to return. + * it will show the links closest to the current page on both sides (in case one side can't show more, it will show more on the other side) + * @return an array of integerswhich refer to the clickable pagenumbers for browsing other pages. + */ public function getLinks($nrOfLinks){ $pageLinks = Array(); //if amount of showable links is greater than the amount of pages: show all! diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/querycache.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/querycache.php index 9ca6c627d..3da0887c9 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/querycache.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/querycache.php @@ -1,21 +1,37 @@ sid, 'type' => type, 'query' => query, 'db' => db). + */ public function set($values) { $this->setSID($values['SID']); $this->setType($values['type']); @@ -24,7 +40,11 @@ class Querycache{ } - //return constructed element based on SID + /** + * loads the object's attributes. + * loads the object's attributes by giving a SID as parameter + * @param $id the id of the querycaches row + */ public function load_With_SID( $id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ams_querycache WHERE SID=:id", array('id' => $id)); @@ -33,7 +53,9 @@ class Querycache{ } - //update private data to DB. + /** + * updates the entry. + */ public function update(){ $dbl = new DBLayer("lib"); $query = "UPDATE ams_querycache SET type= :t, query = :q, db = :d WHERE SID=:id"; @@ -43,39 +65,64 @@ class Querycache{ ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + /** + * get SID attribute of the object. + */ public function getSID(){ return $this->SID; } - + /** + * get type attribute of the object. + */ public function getType(){ return $this->type; } - + /** + * get query attribute of the object. + */ public function getQuery(){ return $this->query; } + /** + * get db attribute of the object. + */ public function getDb(){ return $this->db; } ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + /** + * set SID attribute of the object. + * @param $s integer id + */ public function setSID($s){ $this->SID = $s; } - + /** + * set type attribute of the object. + * @param $t type of the query, could be changePassword, changePermissions, changeEmail, createUser + */ public function setType($t){ $this->type = $t; } + /** + * set query attribute of the object. + * @param $q query string + */ public function setQuery($q){ $this->query= $q; } + /** + * set db attribute of the object. + * @param $d the name of the database in the config global var that we want to use. + */ public function setDb($d){ $this->db= $d; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/support_group.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/support_group.php index 4ee3e79fe..005f775c1 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/support_group.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/support_group.php @@ -1,14 +1,27 @@ execute("SELECT * FROM support_group WHERE SGroupId = :id", array('id' => $id)); @@ -19,7 +32,11 @@ class Support_Group{ } - //return all groups + + /** + * return all support_group objects. + * @return an array containing all support_group objects. + */ public static function getGroups() { $dbl = new DBLayer("lib"); $statement = $dbl->executeWithoutParams("SELECT * FROM support_group ORDER BY Name ASC"); @@ -34,16 +51,34 @@ class Support_Group{ return $result; } - //wrapper for creating a support group - public static function createSupportGroup( $name, $tag) { + + /** + * Wrapper for creating a support group. + * It will check if the support group doesn't exist yet, if the tag or name already exists then NAME_TAKEN or TAG_TAKEN will be returned. + * If the name is bigger than 20 characters or smaller than 4 and the tag greater than 7 or smaller than 2 a SIZE_ERROR will be returned. + * Else it will return SUCCESS + * @return a string that specifies if it was a success or not (SUCCESS, SIZE_ERROR, NAME_TAKEN or TAG_TAKEN ) + */ + public static function createSupportGroup( $name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password) { if(strlen($name) < 21 && strlen($name) > 4 &&strlen($tag) < 8 && strlen($tag) > 1 ){ $notExists = self::supportGroup_EntryNotExists($name, $tag); if ( $notExists == "SUCCESS" ){ $sGroup = new self(); - $sGroup->setName($name); - $sGroup->setTag($tag); + $values = array('Name' => $name, 'Tag' => $tag, 'GroupEmail' => $groupemail, 'IMAP_MailServer' => $imap_mailserver, 'IMAP_Username' => $imap_username, 'IMAP_Password' => $imap_password); + $sGroup->setName($values['Name']); + $sGroup->setTag($values['Tag']); + $sGroup->setGroupEmail($values['GroupEmail']); + $sGroup->setIMAP_MailServer($values['IMAP_MailServer']); + $sGroup->setIMAP_Username($values['IMAP_Username']); + + //encrypt password! + global $cfg; + $crypter = new MyCrypt($cfg['crypt']); + $enc_password = $crypter->encrypt($values['IMAP_Password']); + $sGroup->setIMAP_Password($enc_password); $sGroup->create(); + return "SUCCESS"; }else{ //return NAME_TAKEN or TAG_TAKEN @@ -55,7 +90,12 @@ class Support_Group{ } } - //check if group exists + /** + * check if support group name/tag doesn't exist yet. + * @param $name the name of the group we want to check + * @param $tag the tag of the group we want to check + * @return if name is already taken return NAME_TAKEN, else if tag is already taken return TAG_TAKEN, else return success. + */ public static function supportGroup_EntryNotExists( $name, $tag) { $dbl = new DBLayer("lib"); //check if name is already used @@ -70,7 +110,11 @@ class Support_Group{ } - //check if group exists + /** + * check if support group entry coupled to a given id exist or not. + * @param $id the id of the group we want to check + * @return true or false. + */ public static function supportGroup_Exists( $id) { $dbl = new DBLayer("lib"); //check if supportgroup id exist @@ -82,14 +126,23 @@ class Support_Group{ } - //return constructed element based on SGroupId + /** + * construct an object based on the SGroupId. + * @param $id the id of the group we want to construct + * @return the constructed support group object + */ public static function constr_SGroupId( $id) { $instance = new self(); $instance->setSGroup($id); return $instance; } - //returns list of all users that are enlisted to a support group + + /** + * get list of all users that are enlisted to a support group. + * @param $group_id the id of the group we want to query + * @return an array of ticket_user objects that are in the support group. + */ public static function getAllUsersOfSupportGroup($group_id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM `in_support_group` INNER JOIN `ticket_user` ON ticket_user.TUserId = in_support_group.User WHERE in_support_group.Group=:id", array('id' => $group_id)); @@ -105,7 +158,13 @@ class Support_Group{ return $result; } - //wrapper for adding user to a support group + + /** + * wrapper for deleting a support group. + * We will first check if the group really exists, if not than "GROUP_NOT_EXISING" will be returned. + * @param $group_id the id of the group we want to delete + * @return an array of ticket_user objects that are in the support group. + */ public static function deleteSupportGroup($group_id) { //check if group id exists @@ -120,7 +179,15 @@ class Support_Group{ } - //wrapper for adding user to a support group + /** + * wrapper for deleting a user that's in a specified support group. + * We will first check if the group really exists, if not than "GROUP_NOT_EXISING" will be returned. + * Afterwards we will check if the user exists in the support group, if not "USER_NOT_IN_GROUP" will be returned. + * Else the users entry in the in_support_group table will be deleted and "SUCCESS" will be returned. + * @param $user_id the id of the user we want to remove out of the group. + * @param $group_id the id of the group the user should be in + * @return a string (SUCCESS, USER_NOT_IN_GROUP or GROUP_NOT_EXISTING) + */ public static function deleteUserOfSupportGroup( $user_id, $group_id) { //check if group id exists @@ -149,7 +216,16 @@ class Support_Group{ } - //wrapper for adding user to a support group + + /** + * wrapper for adding a user to a specified support group. + * We will first check if the group really exists, if not than "GROUP_NOT_EXISING" will be returned. + * Afterwards we will check if the user exists in the support group, if so "ALREADY_ADDED" will be returned. + * Else the user will be added to the in_support_group table and "SUCCESS" will be returned. + * @param $user_id the id of the user we want to add to the group. + * @param $group_id the id of the group the user wants to be in + * @return a string (SUCCESS, ALREADY_ADDED or GROUP_NOT_EXISTING) + */ public static function addUserToSupportGroup( $user_id, $group_id) { //check if group id exists if (self::supportGroup_Exists($group_id)){ @@ -176,7 +252,12 @@ class Support_Group{ } - //returns list of all category objects + + /** + * return all support_group objects. + * @return an array containing all support_group objects. + * @deprecated should be removed in the future, because getGroups does the same. + */ public static function getAllSupportGroups() { $dbl = new DBLayer("lib"); $statement = $dbl->executeWithoutParams("SELECT * FROM `support_group`"); @@ -191,24 +272,47 @@ class Support_Group{ } ////////////////////////////////////////////Methods//////////////////////////////////////////////////// + + /** + * A constructor. + * Empty constructor + */ public function __construct() { } - //set values + + /** + * sets the object's attributes. + * @param $values should be an array of the form array('SGroupId' => groupid, 'Name' => name, 'Tag' => tag, 'GroupEmail' => mail, 'IMAP_MailServer' => server, 'IMAP_Username' => username,'IMAP_Password' => pass). + */ public function set($values) { $this->setSGroupId($values['SGroupId']); $this->setName($values['Name']); $this->setTag($values['Tag']); + $this->setGroupEmail($values['GroupEmail']); + $this->setIMAP_MailServer($values['IMAP_MailServer']); + $this->setIMAP_Username($values['IMAP_Username']); + $this->setIMAP_Password($values['IMAP_Password']); } + + /** + * creates a new 'support_group' entry. + * this method will use the object's attributes for creating a new 'support_group' entry in the database. + */ public function create() { $dbl = new DBLayer("lib"); - $query = "INSERT INTO support_group (Name, Tag) VALUES (:name, :tag)"; - $values = Array('name' => $this->name, 'tag' => $this->tag); + $query = "INSERT INTO support_group (Name, Tag, GroupEmail, IMAP_MailServer, IMAP_Username, IMAP_Password) VALUES (:name, :tag, :groupemail, :imap_mailserver, :imap_username, :imap_password)"; + $values = Array('name' => $this->getName(), 'tag' => $this->getTag(), 'groupemail' => $this->getGroupEmail(), 'imap_mailserver' => $this->getIMAP_MailServer(), 'imap_username' => $this->getIMAP_Username(), 'imap_password' => $this->getIMAP_Password()); $dbl->execute($query, $values); } - //Load with sGroupId + + /** + * loads the object's attributes. + * loads the object's attributes by giving a group id, it will put the matching groups attributes in the object. + * @param $id the id of the support group that should be loaded + */ public function load_With_SGroupId( $id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM `support_group` WHERE `SGroupId` = :id", array('id' => $id)); @@ -217,15 +321,21 @@ class Support_Group{ } - //update private data to DB. + /** + * update the objects attributes to the db. + */ public function update(){ $dbl = new DBLayer("lib"); - $query = "UPDATE `support_group` SET `Name` = :name, `Tag` = :tag WHERE `SGroupId` = :id"; - $values = Array('id' => $this->getSGroupId(), 'name' => $this->getName(), 'tag' => $this->getTag() ); + $query = "UPDATE `support_group` SET `Name` = :name, `Tag` = :tag, `GroupEmail` = :groupemail, `IMAP_MailServer` = :mailserver, `IMAP_Username` = :username, `IMAP_Password` = :password WHERE `SGroupId` = :id"; + $values = Array('id' => $this->getSGroupId(), 'name' => $this->getName(), 'tag' => $this->getTag(), 'groupemail' => $this->getGroupEmail(), 'mailserver' => $this->getIMAP_MailServer(), 'username' => $this->getIMAP_Username(), 'password' => $this->getIMAP_Password() ); $statement = $dbl->execute($query, $values); } - //delete entry + + /** + * deletes an existing 'support_group' entry. + * this method will use the object's attributes for deleting an existing 'support_group' entry in the database. + */ public function delete(){ $dbl = new DBLayer("lib"); $query = "DELETE FROM `support_group` WHERE `SGroupId` = :id"; @@ -235,31 +345,109 @@ class Support_Group{ ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + /** + * get sGroupId attribute of the object. + */ public function getSGroupId(){ return $this->sGroupId; } + /** + * get name attribute of the object. + */ public function getName(){ return $this->name; } + /** + * get tag attribute of the object. + */ public function getTag(){ return $this->tag; } + /** + * get groupEmail attribute of the object. + */ + public function getGroupEmail(){ + return $this->groupEmail; + } + + /** + * get iMAP_MailServer attribute of the object. + */ + public function getIMAP_MailServer(){ + return $this->iMAP_MailServer; + } + + /** + * get iMAP_Username attribute of the object. + */ + public function getIMAP_Username(){ + return $this->iMAP_Username; + } + + /** + * get iMAP_Password attribute of the object. + */ + public function getIMAP_Password(){ + return $this->iMap_Password; + } ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + /** + * set sGroupId attribute of the object. + * @param $id integer id of the group + */ public function setSGroupId($id){ $this->sGroupId = $id; } + /** + * set name attribute of the object. + * @param $n name of the group + */ public function setName($n){ $this->name = $n; } + /** + * set tag attribute of the object. + * @param $t tag of the group + */ public function setTag($t){ $this->tag = $t; } + /** + * set groupEmail attribute of the object. + * @param $ge email of the group + */ + public function setGroupEmail($ge){ + $this->groupEmail = $ge; + } + /** + * set iMAP_MailServer attribute of the object. + * @param $ms mailserver of the group + */ + public function setIMAP_MailServer($ms){ + $this->iMAP_MailServer = $ms; + } + + /** + * set iMAP_Username attribute of the object. + * @param $u imap username of the group + */ + public function setIMAP_Username($u){ + $this->iMAP_Username = $u; + } + + /** + * set iMAP_Password attribute of the object. + * @param $p imap password of the group + */ + public function setIMAP_Password($p){ + $this->iMap_Password = $p; + } } \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/sync.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/sync.php index 12376d9b4..5e8d2d37d 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/sync.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/sync.php @@ -1,16 +1,17 @@ $decode[0]); + //make connection with and put into shard db & delete from the lib + $sth = $db->execute("SELECT UId FROM user WHERE Login= :username;", $values); + $result = $sth->fetchAll(); + foreach ($result as $UId) { + $ins_values = array('id' => $UId['UId']); + $db->execute("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES (:id, 'r2', 'OPEN');", $ins_values); + $db->execute("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES (:id , 'ryzom_open', 'OPEN');", $ins_values); + } + break; case 'change_pass': $decode = json_decode($record['query']); $values = array('user' => $decode[0], 'pass' => $decode[1]); @@ -47,7 +59,7 @@ class Sync{ print('Syncing completed'); } catch (PDOException $e) { - print('Something went wrong!'); + print('Something went wrong! The shard is probably still offline!'); print_r($e); } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php index a9bceacd3..21e2614d5 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php @@ -1,24 +1,32 @@ execute(" SELECT * FROM `ticket` WHERE `TId` = :ticket_id", array('ticket_id' => $id) )->rowCount() ){ return true; }else{ @@ -26,26 +34,31 @@ class Ticket{ } } - /*FUNCTION: getStatusArray - * returns all possible statusses - * + + /** + * return an array of the possible statuses + * @return an array containing the string values that represent the different statuses. */ public static function getStatusArray() { return Array("Waiting on user reply","Waiting on support","Waiting on Dev reply","Closed"); } - - /*FUNCTION: getPriorityArray - * returns all possible statusses - * + + + /** + * return an array of the possible priorities + * @return an array containing the string values that represent the different priorities. */ public static function getPriorityArray() { return Array("Low","Normal","High","Super Dupa High"); } - /*FUNCTION: getEntireTicket - * return all ticket of the given author's id. - * + /** + * return an entire ticket. + * returns the ticket object and an array of all replies to that ticket. + * @param $id the id of the ticket. + * @param $view_as_admin true if the viewer of the ticket is a mod, else false (depending on this it will also show the hidden comments) + * @return an array containing the 'ticket_obj' and a 'reply_array', which is an array containing all replies to that ticket. */ public static function getEntireTicket($id,$view_as_admin) { $ticket = new Ticket(); @@ -55,10 +68,12 @@ class Ticket{ } - /*FUNCTION: getTicketTitlesOf - * return all ticket of the given author's id. - * - */ + /** + * return all tickets of a specific user. + * an array of all tickets created by a specific user are returned by this function. + * @param $author the id of the user of whom we want all tickets from. + * @return an array containing all ticket objects related to a user. + */ public static function getTicketsOf($author) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket INNER JOIN ticket_user ON ticket.Author = ticket_user.TUserId and ticket_user.ExternId=:id", array('id' => $author)); @@ -79,33 +94,63 @@ class Ticket{ } - /*FUNCTION: create_Ticket() - * creates a ticket + first initial reply and fills in the content of it! - * - */ - public static function create_Ticket( $title, $content, $category, $author, $real_author) { - + + /** + * function that creates a new ticket. + * A new ticket will be created, in case the extra_info != 0 and the http request came from ingame, then a ticket_info page will be created. + * A log entry will be written, depending on the $real_authors value. In case the for_support_group parameter is set, the ticket will be forwarded immediately. + * Also the mail handler will create a new email that will be sent to the author to notify him that his ticket is freshly created. + * @param $title the title we want to give to the ticket. + * @param $content the content we want to give to the starting post of the ticket. + * @param $category the id of the category that should be related to the ticket. + * @param $author the person who's id will be stored in the database as creator of the ticket. + * @param $real_author should be the same id, or a moderator/admin who creates a ticket for another user (this is used for logging purposes). + * @param $for_support_group in case you directly want to forward the ticket after creating it. (default value = 0 = don't forward) + * @param $extra_info used for creating an ticket_info page related to the ticket, this only happens when the ticket is made ingame. + * @return the created tickets id. + */ + public static function create_Ticket( $title, $content, $category, $author, $real_author, $for_support_group = 0, $extra_info = 0) { + + //create the new ticket! $ticket = new Ticket(); - $values = array("Title" => $title, "Status"=> 1, "Queue"=> 0, "Ticket_Category" => $category, "Author" => $author, "Priority" => 0); + $values = array("Title" => $title, "Timestamp"=>0, "Status"=> 1, "Queue"=> 0, "Ticket_Category" => $category, "Author" => $author, "Priority" => 0); $ticket->set($values); $ticket->create(); $ticket_id = $ticket->getTId(); + //if ingame then add an extra info + if(Helpers::check_if_game_client() && $extra_info != 0){ + $extra_info['Ticket'] = $ticket_id; + Ticket_Info::create_Ticket_Info($extra_info); + } + + //write a log entry if ( $author == $real_author){ Ticket_Log::createLogEntry( $ticket_id, $author, 1); }else{ Ticket_Log::createLogEntry( $ticket_id, $real_author, 2, $author); } - Ticket_Reply::createReply($content, $author, $ticket_id, 0, $author); - Mail_Handler::send_ticketing_mail($ticket, $content, "NEW", $real_author); + Ticket_Reply::createReply($content, $author, $ticket_id, 0, $author); + + //forwards the ticket directly after creation to the supposed support group + if($for_support_group){ + Ticket::forwardTicket(0, $ticket_id, $for_support_group); + } + + //send email that new ticket has been created + Mail_Handler::send_ticketing_mail($ticket->getAuthor(), $ticket, $content, "NEW", $ticket->getForwardedGroupId()); return $ticket_id; } - /*FUNCTION: updateTicketStatus() - * - * - */ + + /** + * updates the ticket's status. + * A log entry about this will be created only if the newStatus is different from the current status. + * @param $ticket_id the id of the ticket of which we want to change the status. + * @param $newStatus the new status value (integer) + * @param $author the user (id) that performed the update status action + */ public static function updateTicketStatus( $ticket_id, $newStatus, $author) { $ticket = new Ticket(); @@ -119,10 +164,15 @@ class Ticket{ } - /*FUNCTION: updateTicketStatusAndPriority() - * creates a ticket + first initial reply and fills in the content of it! - * - */ + /** + * updates the ticket's status & priority. + * A log entry about this will be created only if the newStatus is different from the current status and also when the newPriority is different from the current priority. + * @todo break this function up into a updateStatus (already exists) and updatePriority function and perhaps write a wrapper function for the combo. + * @param $ticket_id the id of the ticket of which we want to change the status & priority + * @param $newStatus the new status value (integer) + * @param $newPriority the new priority value (integer) + * @param $author the user (id) that performed the update + */ public static function updateTicketStatusAndPriority( $ticket_id, $newStatus, $newPriority, $author) { $ticket = new Ticket(); @@ -139,7 +189,12 @@ class Ticket{ } - //return the latest reply. + + /** + * return the latest reply of a ticket + * @param $ticket_id the id of the ticket. + * @return a ticket_reply object. + */ public static function getLatestReply( $ticket_id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket_reply WHERE Ticket =:id ORDER BY TReplyId DESC LIMIT 1 ", array('id' => $ticket_id)); @@ -148,6 +203,16 @@ class Ticket{ return $reply; } + + /** + * create a new reply for a ticket. + * A reply will only be added if the content isn't empty and if the ticket isn't closed. + * The ticket creator will be notified by email that someone else replied on his ticket. + * @param $content the content of the reply + * @param $author the author of the reply + * @param $ticket_id the id of the ticket to which we want to add the reply. + * @param $hidden boolean that specifies if the reply should only be shown to mods/admins or all users. + */ public static function createReply($content, $author, $ticket_id, $hidden){ //if not empty if(! ( Trim ( $content ) === '' )){ @@ -160,7 +225,7 @@ class Ticket{ //notify ticket author that a new reply is added! if($ticket->getAuthor() != $author){ - Mail_Handler::send_ticketing_mail($ticket, $content, "REPLY", $author); + Mail_Handler::send_ticketing_mail($ticket->getAuthor(), $ticket, $content, "REPLY", $ticket->getForwardedGroupId()); } @@ -172,7 +237,14 @@ class Ticket{ } } - //returns SUCCESS_ASSIGNED, TICKET_NOT_EXISTING or ALREADY_ASSIGNED + + /** + * assign a ticket to a user. + * Checks if the ticket exists, if so then it will try to assign the user to it, a log entry will be written about this. + * @param $user_id the id of user trying to be assigned to the ticket. + * @param $ticket_id the id of the ticket that we try to assign to the user. + * @return SUCCESS_ASSIGNED, TICKET_NOT_EXISTING or ALREADY_ASSIGNED + */ public static function assignTicket($user_id, $ticket_id){ if(self::ticketExists($ticket_id)){ $returnvalue = Assigned::assignTicket($user_id, $ticket_id); @@ -183,7 +255,14 @@ class Ticket{ } } - //returns SUCCESS_UNASSIGNED, TICKET_NOT_EXISTING or NOT_ASSIGNED + + /** + * unassign a ticket of a user. + * Checks if the ticket exists, if so then it will try to unassign the user of it, a log entry will be written about this. + * @param $user_id the id of user trying to be assigned to the ticket. + * @param $ticket_id the id of the ticket that we try to assign to the user. + * @return SUCCESS_UNASSIGNED, TICKET_NOT_EXISTING or NOT_ASSIGNED + */ public static function unAssignTicket($user_id, $ticket_id){ if(self::ticketExists($ticket_id)){ $returnvalue = Assigned::unAssignTicket($user_id, $ticket_id); @@ -194,15 +273,28 @@ class Ticket{ } } + + /** + * forward a ticket to a specific support group. + * Checks if the ticket exists, if so then it will try to forward the ticket to the support group specified, a log entry will be written about this. + * if no log entry should be written then the user_id should be 0, else te $user_id will be used in the log to specify who forwarded it. + * @param $user_id the id of user trying to forward the ticket. + * @param $ticket_id the id of the ticket that we try to forward to a support group. + * @param $group_id the id of the support group. + * @return SUCCESS_FORWARDED, TICKET_NOT_EXISTING or INVALID_SGROUP + */ public static function forwardTicket($user_id, $ticket_id, $group_id){ if(self::ticketExists($ticket_id)){ if(isset($group_id) && $group_id != ""){ - //unassign the ticket incase the ticket is assined to yourself - self::unAssignTicket($user_id, $ticket_id); //forward the ticket $returnvalue = Forwarded::forwardTicket($group_id, $ticket_id); - //make a log entry of this action - Ticket_Log::createLogEntry( $ticket_id, $user_id, 8, $group_id); + + if($user_id != 0){ + //unassign the ticket incase the ticket is assined to yourself + self::unAssignTicket($user_id, $ticket_id); + //make a log entry of this action + Ticket_Log::createLogEntry( $ticket_id, $user_id, 8, $group_id); + } return $returnvalue; }else{ return "INVALID_SGROUP"; @@ -216,25 +308,39 @@ class Ticket{ ////////////////////////////////////////////Methods//////////////////////////////////////////////////// + + /** + * A constructor. + * Empty constructor + */ public function __construct() { } - //Set ticket object + /** + * sets the object's attributes. + * @param $values should be an array of the form array('TId' => ticket_id, 'Title' => title, 'Status'=> status, 'Timestamp' => ts, 'Queue' => queue, + * 'Ticket_Category' => tc, 'Author' => author, 'Priority' => priority). + */ public function set($values){ if(isset($values['TId'])){ $this->tId = $values['TId']; } $this->title = $values['Title']; $this->status = $values['Status']; + $this->timestamp = $values['Timestamp']; $this->queue = $values['Queue']; $this->ticket_category = $values['Ticket_Category']; $this->author = $values['Author']; $this->priority = $values['Priority']; } - //create ticket by writing private data to DB. + + /** + * creates a new 'ticket' entry. + * this method will use the object's attributes for creating a new 'ticket' entry in the database. + */ public function create(){ $dbl = new DBLayer("lib"); $query = "INSERT INTO ticket (Timestamp, Title, Status, Queue, Ticket_Category, Author, Priority) VALUES (now(), :title, :status, :queue, :tcat, :author, :priority)"; @@ -242,7 +348,12 @@ class Ticket{ $this->tId = $dbl->executeReturnId($query, $values); ; } - //return constructed element based on TId + + /** + * loads the object's attributes. + * loads the object's attributes by giving a TId (ticket id). + * @param $id the id of the ticket that should be loaded + */ public function load_With_TId( $id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket WHERE TId=:id", array('id' => $id)); @@ -257,7 +368,10 @@ class Ticket{ $this->priority = $row['Priority']; } - //update private data to DB. + + /** + * update the objects attributes to the db. + */ public function update(){ $dbl = new DBLayer("lib"); $query = "UPDATE ticket SET Timestamp = :timestamp, Title = :title, Status = :status, Queue = :queue, Ticket_Category = :tcat, Author = :author, Priority = :priority WHERE TId=:id"; @@ -265,62 +379,102 @@ class Ticket{ $statement = $dbl->execute($query, $values); } - /*FUNCTION: postreply - * returns all possible statusses - * - * - public function postReply() { - return Array("Waiting on user reply","Waiting on support","Waiting on Dev reply","Closed"); - }*/ + + /** + * check if a ticket has a ticket_info page or not. + * @return true or false + */ + public function hasInfo(){ + return Ticket_Info::TicketHasInfo($this->getTId()); + } + + ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + /** + * get tId attribute of the object. + */ public function getTId(){ return $this->tId; } + /** + * get timestamp attribute of the object in the format defined in the outputTime function of the Helperclass. + */ public function getTimestamp(){ return Helpers::outputTime($this->timestamp); } + /** + * get title attribute of the object. + */ public function getTitle(){ return $this->title; } + /** + * get status attribute of the object. + */ public function getStatus(){ return $this->status; } + /** + * get status attribute of the object in the form of text (string). + */ public function getStatusText(){ $statusArray = Ticket::getStatusArray(); return $statusArray[$this->getStatus()]; } + /** + * get category attribute of the object in the form of text (string). + */ public function getCategoryName(){ $category = Ticket_Category::constr_TCategoryId($this->getTicket_Category()); return $category->getName(); } + /** + * get queue attribute of the object. + */ public function getQueue(){ return $this->queue; } + /** + * get ticket_category attribute of the object (int). + */ public function getTicket_Category(){ return $this->ticket_category; } + /** + * get author attribute of the object (int). + */ public function getAuthor(){ return $this->author; } + /** + * get priority attribute of the object (int). + */ public function getPriority(){ return $this->priority; } + /** + * get priority attribute of the object in the form of text (string). + */ public function getPriorityText(){ $priorityArray = Ticket::getPriorityArray(); return $priorityArray[$this->getPriority()]; } + /** + * get the user assigned to the ticket. + * or return 0 in case not assigned. + */ public function getAssigned(){ $user_id = Assigned::getUserAssignedToTicket($this->getTId()); if ($user_id == ""){ @@ -330,6 +484,10 @@ class Ticket{ } } + /** + * get the name of the support group to whom the ticket is forwarded + * or return 0 in case not forwarded. + */ public function getForwardedGroupName(){ $group_id = Forwarded::getSGroupOfTicket($this->getTId()); if ($group_id == ""){ @@ -339,6 +497,10 @@ class Ticket{ } } + /** + * get the id of the support group to whom the ticket is forwarded + * or return 0 in case not forwarded. + */ public function getForwardedGroupId(){ $group_id = Forwarded::getSGroupOfTicket($this->getTId()); if ($group_id == ""){ @@ -349,34 +511,66 @@ class Ticket{ } ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + /** + * set tId attribute of the object. + * @param $id integer id of the ticket + */ public function setTId($id){ $this->tId = $id; } + /** + * set timestamp attribute of the object. + * @param $ts timestamp of the ticket + */ public function setTimestamp($ts){ $this->timestamp = $ts; } + /** + * set title attribute of the object. + * @param $t title of the ticket + */ public function setTitle($t){ $this->title = $t; } + /** + * set status attribute of the object. + * @param $s status of the ticket(int) + */ public function setStatus($s){ $this->status = $s; } + /** + * set queue attribute of the object. + * @param $q queue of the ticket + */ public function setQueue($q){ $this->queue = $q; } + /** + * set ticket_category attribute of the object. + * @param $tc ticket_category id of the ticket(int) + */ public function setTicket_Category($tc){ $this->ticket_category = $tc; } + /** + * set author attribute of the object. + * @param $a author of the ticket + */ public function setAuthor($a){ $this->author = $a; } + /** + * set priority attribute of the object. + * @param $p priority of the ticket + */ public function setPriority($p){ $this->priority = $p; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_category.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_category.php index c2fd6a5d4..92e603d12 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_category.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_category.php @@ -1,14 +1,19 @@ setTCategoryId($id); return $instance; } - //returns list of all category objects + + /** + * return a list of all category objects. + * @return an array consisting of all category objects. + */ public static function getAllCategories() { $dbl = new DBLayer("lib"); $statement = $dbl->executeWithoutParams("SELECT * FROM ticket_category"); @@ -43,10 +55,19 @@ class Ticket_Category{ ////////////////////////////////////////////Methods//////////////////////////////////////////////////// + /** + * A constructor. + * Empty constructor + */ public function __construct() { } - //return constructed element based on TCategoryId + + /** + * loads the object's attributes. + * loads the object's attributes by giving a categories id. + * @param $id the id of the ticket_category that should be loaded + */ public function load_With_TCategoryId( $id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket_category WHERE TCategoryId=:id", array('id' => $id)); @@ -56,7 +77,9 @@ class Ticket_Category{ } - //update private data to DB. + /** + * update object attributes to the DB. + */ public function update(){ $dbl = new DBLayer("lib"); $query = "UPDATE ticket_category SET Name = :name WHERE TCategoryId=:id"; @@ -66,6 +89,9 @@ class Ticket_Category{ ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + /** + * get name attribute of the object. + */ public function getName(){ if ($this->name == ""){ $this->load_With_TCategoryId($this->tCategoryId); @@ -73,7 +99,9 @@ class Ticket_Category{ return $this->name; } - + /** + * get tCategoryId attribute of the object. + */ public function getTCategoryId(){ return $this->tCategoryId; } @@ -81,10 +109,18 @@ class Ticket_Category{ ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + /** + * set name attribute of the object. + * @param $n name of the category + */ public function setName($n){ $this->name = $n; } + /** + * set tCategoryId attribute of the object. + * @param $id integer id of the category + */ public function setTCategoryId($id){ $this->tCategoryId = $id; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_content.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_content.php index bc9ca8398..445cad867 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_content.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_content.php @@ -1,14 +1,25 @@ setTContentId($id); @@ -18,10 +29,18 @@ class Ticket_Content{ ////////////////////////////////////////////Methods//////////////////////////////////////////////////// + /** + * A constructor. + * Empty constructor + */ public function __construct() { } - //Creates a ticket_content entry in the DB + + /** + * creates a new 'tickt_content' entry. + * this method will use the object's attributes for creating a new 'ticket_content' entry in the database. + */ public function create() { $dbl = new DBLayer("lib"); $query = "INSERT INTO ticket_content (Content) VALUES (:content)"; @@ -29,7 +48,12 @@ class Ticket_Content{ $this->tContentId = $dbl->executeReturnId($query, $values); ; } - //return constructed element based on TContentId + + /** + * loads the object's attributes. + * loads the object's attributes by giving a ticket_content's id, + * @param $id the id of the ticket_content entry that should be loaded + */ public function load_With_TContentId( $id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket_content WHERE TContentId=:id", array('id' => $id)); @@ -38,7 +62,9 @@ class Ticket_Content{ $this->content = $row['Content']; } - //update private data to DB. + /** + * update the object's attributes to the database. + */ public function update(){ $dbl = new DBLayer("lib"); $query = "UPDATE ticket_content SET Content = :content WHERE TContentId=:id"; @@ -48,6 +74,9 @@ class Ticket_Content{ ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + /** + * get content attribute of the object. + */ public function getContent(){ if ($this->content == ""){ $this->load_With_TContentId($this->tContentId); @@ -55,7 +84,9 @@ class Ticket_Content{ return $this->content; } - + /** + * get tContentId attribute of the object. + */ public function getTContentId(){ return $this->tContentId; } @@ -63,10 +94,18 @@ class Ticket_Content{ ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + /** + * set content attribute of the object. + * @param $c content of a reply + */ public function setContent($c){ $this->content = $c; } + /** + * set tContentId attribute of the object. + * @param $c integer id of ticket_content entry + */ public function setTContentId($c){ $this->tContentId = $c; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_info.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_info.php new file mode 100644 index 000000000..fc852d093 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_info.php @@ -0,0 +1,414 @@ +set($info_array); + $ticket_info->create(); + } + + + /** + * check if a specific ticket has extra info or not. + * Not all tickets have extra info, only tickets made ingame do. This function checks if a specific ticket does have a ticket_info entry linked to it. + * @param $ticket_id the id of the ticket that we want to query + * @return true or false + */ + public static function TicketHasInfo($ticket_id) { + $dbl = new DBLayer("lib"); + //check if ticket is already assigned + if( $dbl->execute(" SELECT * FROM `ticket_info` WHERE `Ticket` = :ticket_id", array('ticket_id' => $ticket_id) )->rowCount() ){ + return true; + }else{ + return false; + } + } + + + ////////////////////////////////////////////Methods//////////////////////////////////////////////////// + + /** + * A constructor. + * Empty constructor + */ + public function __construct() { + } + + + /** + * sets the object's attributes. + * @param $values should be an array. + */ + public function set($values) { + $this->setTicket($values['Ticket']); + $this->setShardId($values['ShardId']); + $this->setUser_Position($values['UserPosition']); + $this->setView_Position($values['ViewPosition']); + $this->setClient_Version($values['ClientVersion']); + $this->setPatch_Version($values['PatchVersion']); + $this->setServer_Tick($values['ServerTick']); + $this->setConnect_State($values['ConnectState']); + $this->setLocal_Address($values['LocalAddress']); + $this->setMemory($values['Memory']); + $this->setOS($values['OS']); + $this->setProcessor($values['Processor']); + $this->setCPUId($values['CPUID']); + $this->setCPU_Mask($values['CpuMask']); + $this->setHT($values['HT']); + $this->setNel3D($values['NeL3D']); + $this->setUser_Id($values['UserId']); + + } + + /** + * loads the object's attributes by using a ticket_info id. + * loads the object's attributes by giving a ticket_info's entry id. + * @param $id the id of the ticket_info entry that should be loaded + */ + public function load_With_TInfoId( $id) { + $dbl = new DBLayer("lib"); + $statement = $dbl->execute("SELECT * FROM ticket_info WHERE TInfoId=:id", array('id' => $id)); + $row = $statement->fetch(); + $this->set($row); + } + + + /** + * loads the object's attributes by using a ticket's id. + * loads the object's attributes by giving a ticket's entry id. + * @param $id the id of the ticket, the ticket_info entry of that ticket should be loaded. + */ + public function load_With_Ticket( $id) { + $dbl = new DBLayer("lib"); + $statement = $dbl->execute("SELECT * FROM ticket_info WHERE Ticket=:id", array('id' => $id)); + $row = $statement->fetch(); + $this->set($row); + } + + + /** + * creates a new 'ticket_info' entry. + * this method will use the object's attributes for creating a new 'ticket_info' entry in the database. + */ + public function create() { + $dbl = new DBLayer("lib"); + $query = "INSERT INTO ticket_info ( Ticket, ShardId, UserPosition,ViewPosition, ClientVersion, PatchVersion,ServerTick, ConnectState, LocalAddress, Memory, OS, +Processor, CPUID, CpuMask, HT, NeL3D, UserId) VALUES ( :ticket, :shardid, :userposition, :viewposition, :clientversion, :patchversion, :servertick, :connectstate, :localaddress, :memory, :os, :processor, :cpuid, :cpu_mask, :ht, :nel3d, :user_id )"; + $values = Array('ticket' => $this->getTicket(), 'shardid' => $this->getShardId(), 'userposition' => $this->getUser_Position(), 'viewposition' => $this->getView_Position(), 'clientversion' => $this->getClient_Version(), +'patchversion' => $this->getPatch_Version(), 'servertick' => $this->getServer_Tick(), 'connectstate' => $this->getConnect_State(), 'localaddress' => $this->getLocal_Address(), 'memory' => $this->getMemory(), 'os'=> $this->getOS(), 'processor' => $this->getProcessor(), 'cpuid' => $this->getCPUId(), +'cpu_mask' => $this->getCpu_Mask(), 'ht' => $this->getHT(), 'nel3d' => $this->getNel3D(), 'user_id' => $this->getUser_Id()); + $dbl->execute($query, $values); + } + + + ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + + /** + * get tInfoId attribute of the object. + */ + public function getTInfoId(){ + return $this->tInfoId; + } + + /** + * get ticket attribute of the object. + */ + public function getTicket(){ + return $this->ticket; + } + + /** + * get shardid attribute of the object. + */ + public function getShardId(){ + return $this->shardid; + } + + /** + * get user_position attribute of the object. + */ + public function getUser_Position(){ + return $this->user_position; + } + + /** + * get view_position attribute of the object. + */ + public function getView_Position(){ + return $this->view_position; + } + + /** + * get client_version attribute of the object. + */ + public function getClient_Version(){ + return $this->client_version; + } + + /** + * get patch_version attribute of the object. + */ + public function getPatch_Version(){ + return $this->patch_version; + } + + /** + * get server_tick attribute of the object. + */ + public function getServer_Tick(){ + return $this->server_tick; + } + + /** + * get connect_state attribute of the object. + */ + public function getConnect_State(){ + return $this->connect_state; + } + + /** + * get local_address attribute of the object. + */ + public function getLocal_Address(){ + return $this->local_address; + } + + /** + * get memory attribute of the object. + */ + public function getMemory(){ + return $this->memory; + } + + /** + * get os attribute of the object. + */ + public function getOS(){ + return $this->os; + } + + /** + * get processor attribute of the object. + */ + public function getProcessor(){ + return $this->processor; + } + + /** + * get cpu_id attribute of the object. + */ + public function getCPUId(){ + return $this->cpu_id; + } + + /** + * get cpu_mask attribute of the object. + */ + public function getCPU_Mask(){ + return $this->cpu_mask; + } + + /** + * get ht attribute of the object. + */ + public function getHT(){ + return $this->ht; + } + + /** + * get nel3d attribute of the object. + */ + public function getNel3D(){ + return $this->nel3d; + } + + /** + * get user_id attribute of the object. + */ + public function getUser_Id(){ + return $this->user_id; + } + + + ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + + /** + * set tInfoId attribute of the object. + * @param $id integer id of ticket_info object itself + */ + public function setTInfoId($id){ + $this->tInfoId = $id; + } + + /** + * set ticket attribute of the object. + * @param $t integer id of the ticket linked to the info object + */ + public function setTicket($t){ + $this->ticket = $t; + } + + /** + * set shardid attribute of the object. + * @param $s (integer) shard id + */ + public function setShardId($s){ + $this->shardid = $s; + } + + /** + * set user_position attribute of the object. + * @param $u the users position + */ + public function setUser_Position($u){ + $this->user_position = $u; + } + + /** + * set view_position attribute of the object. + * @param $v the view position + */ + public function setView_Position($v){ + $this->view_position = $v; + } + + /** + * set client_version attribute of the object. + * @param $c client version number + */ + public function setClient_Version($c){ + $this->client_version = $c; + } + + /** + * set patch_version attribute of the object. + * @param $p patch version number + */ + public function setPatch_Version($p){ + $this->patch_version = $p; + } + + /** + * set server_tick attribute of the object. + * @param $s integer that resembles the server tick + */ + public function setServer_Tick($s){ + $this->server_tick = $s; + } + + /** + * set connect_state attribute of the object. + * @param $c string that defines the connect state. + */ + public function setConnect_State($c){ + $this->connect_state = $c; + } + + /** + * set local_address attribute of the object. + * @param $l local address + */ + public function setLocal_Address($l){ + $this->local_address = $l; + } + + /** + * set memory attribute of the object. + * @param $m memory usage + */ + public function setMemory($m){ + $this->memory = $m; + } + + /** + * set os attribute of the object. + * @param $o set os version information + */ + public function setOS($o){ + $this->os = $o; + } + + /** + * set processor attribute of the object. + * @param $p processor information + */ + public function setProcessor($p){ + $this->processor = $p; + } + + /** + * set cpu_id attribute of the object. + * @param $c cpu id information + */ + public function setCPUId($c){ + $this->cpu_id = $c; + } + + /** + * set cpu_mask attribute of the object. + * @param $c mask of the cpu + */ + public function setCPU_Mask($c){ + $this->cpu_mask = $c; + } + + /** + * set ht attribute of the object. + */ + public function setHT($h){ + $this->ht = $h; + } + + /** + * set nel3d attribute of the object. + * @param $n version information about NeL3D + */ + public function setNel3D($n){ + $this->nel3d = $n; + } + + /** + * set user_id attribute of the object. + * @param $u the user_id. + */ + public function setUser_Id($u){ + $this->user_id = $u; + } + + +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_log.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_log.php index d011049d7..bfb679348 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_log.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_log.php @@ -1,12 +1,29 @@ execute("SELECT * FROM ticket_log INNER JOIN ticket_user ON ticket_log.Author = ticket_user.TUserId and ticket_log.Ticket=:id ORDER BY ticket_log.TLogId ASC", array('id' => $ticket_id)); @@ -42,13 +63,21 @@ class Ticket_Log{ $instanceLog->setAuthor($instanceAuthor); $instanceLog->setTicket($ticket_id); $instanceLog->setQuery($log['Query']); - $result[] = $instanceLog; } return $result; } - //Creates a log entry + + /** + * create a new log entry. + * It will check if the $TICKET_LOGGING global var is true, this var is used to turn logging on and off. In case it's on, the log message will be stored. + * the action id and argument (which is -1 by default), will be json encoded and stored in the query field in the db. + * @param $ticket_id the id of the ticket related to the new log entry + * @param $author_id the id of the user that instantiated the logging. + * @param $action the action id (see the list in the class description) + * @param $arg argument for the action (default = -1) + */ public static function createLogEntry( $ticket_id, $author_id, $action, $arg = -1) { global $TICKET_LOGGING; if($TICKET_LOGGING){ @@ -60,14 +89,23 @@ class Ticket_Log{ } - //return constructed element based on TLogId + /** + * return constructed element based on TLogId + * @param $id ticket_log id of the entry that we want to load into our object. + * @return constructed ticket_log object. + */ public static function constr_TLogId( $id) { $instance = new self(); $instance->setTLogId($id); return $instance; } - //returns list of all logs of a ticket + /** + * return all log entries related to a ticket. + * @param $ticket_id the id of the ticket of which we want all related log entries returned. + * @return an array of ticket_log objects, here the author is an integer. + * @todo only use one of the 2 comparable functions in the future and make the other depricated. + */ public static function getAllLogs($ticket_id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket_log INNER JOIN ticket_user ON ticket_log.Author = ticket_user.TUserId and ticket_log.Ticket=:id", array('id' => $ticket_id)); @@ -84,10 +122,17 @@ class Ticket_Log{ ////////////////////////////////////////////Methods//////////////////////////////////////////////////// + /** + * A constructor. + * Empty constructor + */ public function __construct() { } - //set values + /** + * sets the object's attributes. + * @param $values should be an array. + */ public function set($values) { $this->setTLogId($values['TLogId']); $this->setTimestamp($values['Timestamp']); @@ -96,7 +141,11 @@ class Ticket_Log{ $this->setAuthor($values['Author']); } - //Load with tlogId + /** + * loads the object's attributes. + * loads the object's attributes by giving a ticket_log entries ID (TLogId). + * @param id the id of the ticket_log entry that should be loaded + */ public function load_With_TLogId( $id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket_log WHERE TLogId=:id", array('id' => $id)); @@ -105,7 +154,9 @@ class Ticket_Log{ } - //update private data to DB. + /** + * update attributes of the object to the DB. + */ public function update(){ $dbl = new DBLayer("lib"); $query = "UPDATE ticket_log SET Timestamp = :timestamp, Query = :query, Author = :author, Ticket = :ticket WHERE TLogId=:id"; @@ -115,36 +166,61 @@ class Ticket_Log{ ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + /** + * get tLogId attribute of the object. + */ public function getTLogId(){ return $this->tLogId; } + /** + * get timestamp attribute of the object. + */ public function getTimestamp(){ return Helpers::outputTime($this->timestamp); } + /** + * get query attribute of the object. + */ public function getQuery(){ return $this->query; } + /** + * get author attribute of the object. + */ public function getAuthor(){ return $this->author; } + /** + * get ticket attribute of the object. + */ public function getTicket(){ return $this->ticket; } + /** + * get the action id out of the query by decoding it. + */ public function getAction(){ $decodedQuery = json_decode($this->query); return $decodedQuery[0]; } + /** + * get the argument out of the query by decoding it. + */ public function getArgument(){ $decodedQuery = json_decode($this->query); return $decodedQuery[1]; } + /** + * get the action text(string) array. + * this is being read from the language .ini files. + */ public function getActionTextArray(){ $variables = Helpers::handle_language(); $result = array(); @@ -156,22 +232,42 @@ class Ticket_Log{ ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + /** + * set tLogId attribute of the object. + * @param $id integer id of the log entry + */ public function setTLogId($id){ $this->tLogId = $id; } + /** + * set timestamp attribute of the object. + * @param $t timestamp of the log entry + */ public function setTimestamp($t){ $this->timestamp = $t; } + /** + * set query attribute of the object. + * @param $q the encoded query + */ public function setQuery($q){ $this->query = $q; } + /** + * set author attribute of the object. + * @param $a integer id of the user who created the log entry + */ public function setAuthor($a){ $this->author = $a; } + /** + * set ticket attribute of the object. + * @param $t integer id of ticket of which the log entry is related to. + */ public function setTicket($t){ $this->ticket = $t; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php index 8751efbaa..e72f1024d 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php @@ -1,35 +1,56 @@ query = "SELECT ticket . * FROM ticket LEFT JOIN assigned ON ticket.TId = assigned.Ticket WHERE assigned.Ticket IS NULL"; $this->params = array(); } + /** + * loads the 'all' tickets query into the objects attributes. + */ public function loadAllTickets(){ $this->query = "SELECT * FROM `ticket`"; $this->params = array(); } + /** + * loads the 'all open' tickets query into the objects attributes. + */ public function loadAllOpenTickets(){ $this->query = "SELECT * FROM ticket INNER JOIN ticket_user ON ticket.Author = ticket_user.TUserId and ticket.Status!=3"; $this->params = array(); } + /** + * loads the 'closed' tickets query into the objects attributes. + */ public function loadAllClosedTickets(){ $this->query = "SELECT * FROM ticket INNER JOIN ticket_user ON ticket.Author = ticket_user.TUserId and ticket.Status=3"; $this->params = array(); } + /** + * loads the 'todo' tickets query & params into the objects attributes. + * first: find the tickets assigned to the user with status = waiting on support, + * second find all not assigned tickets that aren't forwarded yet. + * find all tickets assigned to someone else witht status waiting on support, with timestamp of last reply > 1 day, + * find all non-assigned tickets forwarded to the support groups to which that user belongs + * @param $user_id the user's id to whom the tickets should be assigned + */ public function loadToDoTickets($user_id){ - //first: find the tickets assigned to the user with status = waiting on support - //second find all not assigned tickets that aren't forwarded yet. - //find all tickets assigned to someone else witht status waiting on support, with timestamp of last reply > 1 day - //find all non-assigned tickets forwarded to the support groups to which that user belongs $this->query = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User LEFT JOIN `forwarded` f ON t.TId = f.Ticket WHERE (tu.ExternId = :user_id AND t.Status = 1) OR (a.Ticket IS NULL AND f.Group IS NULL) @@ -39,6 +60,26 @@ class Ticket_Queue{ $this->params = array('user_id' => $user_id); } + /** + * loads the 'tickets asssigned to a user and waiting on support' query & params into the objects attributes. + * @param $user_id the user's id to whom the tickets should be assigned + */ + public function loadAssignedandWaiting($user_id){ + $this->query = "SELECT * FROM `ticket` t LEFT JOIN `assigned` a ON t.TId = a.Ticket LEFT JOIN `ticket_user` tu ON tu.TUserId = a.User + WHERE (tu.ExternId = :user_id AND t.Status = 1)"; + $this->params = array('user_id' => $user_id); + } + + + /** + * loads the 'created' query & params into the objects attributes. + * This function creates dynamically a query based on the selected features. + * @param $who specifies if we want to user the user_id or group_id to form the query. + * @param $userid the user's id to whom the tickets should be assigned/not assigned + * @param $groupid the group's id to whom the tickets should be forwarded/not forwarded + * @param $what specifies what kind of tickets we want to return: waiting for support, waiting on user, closed + * @param $how specifies if the tickets should be or shouldn't be assigned/forwarded to the group/user selected. + */ public function createQueue($userid, $groupid, $what, $how, $who){ if($who == "user"){ @@ -77,12 +118,21 @@ class Ticket_Queue{ } $this->query = $query; $this->params = $params; - } + } + + ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + + /** + * get query attribute of the object. + */ public function getQuery(){ return $this->query; } + /** + * get params attribute of the object. + */ public function getParams(){ return $this->params; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue_handler.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue_handler.php index 8930a0651..5ea8d8781 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue_handler.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue_handler.php @@ -1,14 +1,31 @@ queue = new Ticket_Queue(); } + /** + * returns the tickets that are related in someway defined by $input. + * The $input parameter should be a string that defines what kind of queue should be loaded. A new pagination object will be instantiated and will load 10 entries, + * related to the $_GET['pagenum'] variable. + * @param $input identifier that defines what queue to load. + * @param $user_id the id of the user that browses the queues, some queues can be depending on this. + * @return an array consisting of ticket objects, beware, the author & category of a ticket, are objects on their own (no integers are used this time). + */ public function getTickets($input, $user_id){ switch ($input){ @@ -33,26 +50,89 @@ class Ticket_Queue_Handler{ default: return "ERROR"; } + $this->pagination = new Pagination($this->queue->getQuery(),"lib",10,"Ticket",$this->queue->getParams()); - foreach( $this->pagination->getElements() as $element ){ - $catInstance = new Ticket_Category(); - $catInstance->load_With_TCategoryId($element->getTicket_Category()); - $element->setTicket_Category($catInstance); - - $userInstance = new Ticket_User(); - $userInstance->load_With_TUserId($element->getAuthor()); - $element->setAuthor($userInstance); + $elemArray = $this->pagination->getElements(); + if(!empty($elemArray)){ + foreach( $elemArray as $element ){ + $catInstance = new Ticket_Category(); + $catInstance->load_With_TCategoryId($element->getTicket_Category()); + $element->setTicket_Category($catInstance); + + $userInstance = new Ticket_User(); + $userInstance->load_With_TUserId($element->getAuthor()); + $element->setAuthor($userInstance); + } } return $this->pagination->getElements(); } + + /** + * get pagination attribute of the object. + */ public function getPagination(){ return $this->pagination; } + /** + * creates the queue. + * afterwards the getTickets function should be called, else a lot of extra parameters had to be added to the getTickets function.. + */ public function createQueue($userid, $groupid, $what, $how, $who){ $this->queue->createQueue($userid, $groupid, $what, $how, $who); } + + ////////////////////////////////////////////Info retrievers about ticket statistics//////////////////////////////////////////////////// + + /** + * get the number of tickets in the todo queue for a specific user. + * @param $user_id the user being queried + */ + public static function getNrOfTicketsToDo($user_id){ + $queueHandler = new Ticket_Queue_Handler(); + $queueHandler->queue->loadToDoTickets($user_id); + $query = $queueHandler->queue->getQuery(); + $params = $queueHandler->queue->getParams(); + $dbl = new DBLayer("lib"); + return $dbl->execute($query,$params)->rowCount(); + } + + /** + * get the number of tickets assigned to a specific user and waiting for support. + * @param $user_id the user being queried + */ + public static function getNrOfTicketsAssignedWaiting($user_id){ + $queueHandler = new Ticket_Queue_Handler(); + $queueHandler->queue->loadAssignedandWaiting($user_id); + $query = $queueHandler->queue->getQuery(); + $params = $queueHandler->queue->getParams(); + $dbl = new DBLayer("lib"); + return $dbl->execute($query,$params)->rowCount(); + } + + /** + * get the total number of tickets. + */ + public static function getNrOfTickets(){ + $queueHandler = new Ticket_Queue_Handler(); + $queueHandler->queue->loadAllTickets(); + $query = $queueHandler->queue->getQuery(); + $params = $queueHandler->queue->getParams(); + $dbl = new DBLayer("lib"); + return $dbl->execute($query,$params)->rowCount(); + } + + /** + * get the ticket object of the latest added ticket. + */ + public static function getNewestTicket(){ + $dbl = new DBLayer("lib"); + $statement = $dbl->executeWithoutParams("SELECT * FROM `ticket` ORDER BY `TId` DESC LIMIT 1 "); + $ticket = new Ticket(); + $ticket->set($statement->fetch()); + return $ticket; + } } \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php index dafbdf74b..8e784543d 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php @@ -1,16 +1,23 @@ setTReplyId($id); @@ -18,22 +25,31 @@ class Ticket_Reply{ } - //return constructed element based on TCategoryId + /** + * return all replies on a specific ticket. + * @param $ticket_id the id of the ticket of which we want the replies. + * @param $view_as_admin if the browsing user is an admin/mod it should be 1, this will also show the hidden replies. + * @return an array with ticket_reply objects (beware the author and content are objects on their own, not integers!) + */ public static function getRepliesOfTicket( $ticket_id, $view_as_admin) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket_reply INNER JOIN ticket_content INNER JOIN ticket_user ON ticket_reply.Content = ticket_content.TContentId and ticket_reply.Ticket=:id and ticket_user.TUserId = ticket_reply.Author ORDER BY ticket_reply.TReplyId ASC", array('id' => $ticket_id)); $row = $statement->fetchAll(); $result = Array(); foreach($row as $tReply){ + //only add hidden replies if the user is a mod/admin if(! $tReply['Hidden'] || $view_as_admin){ + //load author $instanceAuthor = Ticket_User::constr_TUserId($tReply['Author']); $instanceAuthor->setExternId($tReply['ExternId']); $instanceAuthor->setPermission($tReply['Permission']); + //load content $instanceContent = new Ticket_Content(); $instanceContent->setTContentId($tReply['TContentId']); $instanceContent->setContent($tReply['Content']); + //load reply and add the author and content object in it. $instanceReply = new self(); $instanceReply->setTReplyId($tReply['TReplyId']); $instanceReply->setTimestamp($tReply['Timestamp']); @@ -47,6 +63,16 @@ class Ticket_Reply{ return $result; } + /** + * creates a new reply on a ticket. + * Creates a ticket_content entry and links it with a new created ticket_reply, a log entry will be written about this. + * In case the ticket creator replies on a ticket, he will set the status by default to 'waiting on support'. + * @param $content the content of the reply + * @param $author the id of the reply creator. + * @param $ticket_id the id of the ticket of which we want the replies. + * @param $hidden should be 0 or 1 + * @param $ticket_creator the ticket's starter his id. + */ public static function createReply($content, $author, $ticket_id , $hidden, $ticket_creator){ $ticket_content = new Ticket_Content(); $ticket_content->setContent($content); @@ -66,12 +92,19 @@ class Ticket_Reply{ } ////////////////////////////////////////////Methods//////////////////////////////////////////////////// - + + /** + * A constructor. + * Empty constructor + */ public function __construct() { } - //Set ticket_reply object + /** + * sets the object's attributes. + * @param $values should be an array. + */ public function set($values){ $this->setTicket($values['Ticket']); $this->setContent($values['Content']); @@ -84,7 +117,10 @@ class Ticket_Reply{ } } - //create ticket by writing private data to DB. + /** + * creates a new 'ticket_reply' entry. + * this method will use the object's attributes for creating a new 'ticket_reply' entry in the database (the now() function will create the timestamp). + */ public function create(){ $dbl = new DBLayer("lib"); $query = "INSERT INTO ticket_reply (Ticket, Content, Author, Timestamp, Hidden) VALUES (:ticket, :content, :author, now(), :hidden)"; @@ -92,7 +128,11 @@ class Ticket_Reply{ $this->tReplyId = $dbl->executeReturnId($query, $values); } - //return constructed element based on TId + /** + * loads the object's attributes. + * loads the object's attributes by giving a ticket_reply's id. + * @param $id the id of the ticket_reply that should be loaded + */ public function load_With_TReplyId( $id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket_reply WHERE TReplyId=:id", array('id' => $id)); @@ -105,7 +145,9 @@ class Ticket_Reply{ $this->hidden = $row['Hidden']; } - //update private data to DB. + /** + * updates a ticket_reply entry based on the objects attributes. + */ public function update(){ $dbl = new DBLayer("lib"); $query = "UPDATE ticket SET Ticket = :ticket, Content = :content, Author = :author, Timestamp = :timestamp, Hidden = :hidden WHERE TReplyId=:id"; @@ -115,56 +157,95 @@ class Ticket_Reply{ ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + /** + * get ticket attribute of the object. + */ public function getTicket(){ return $this->ticket; } - - + + /** + * get content attribute of the object. + */ public function getContent(){ return $this->content; } - + + /** + * get author attribute of the object. + */ public function getAuthor(){ return $this->author; } + /** + * get timestamp attribute of the object. + * The output format is defined by the Helpers class function, outputTime(). + */ public function getTimestamp(){ return Helpers::outputTime($this->timestamp); } - + /** + * get tReplyId attribute of the object. + */ public function getTReplyId(){ return $this->tReplyId; } + /** + * get hidden attribute of the object. + */ public function getHidden(){ return $this->hidden; } ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + /** + * set ticket attribute of the object. + * @param $t integer id of the ticket + */ public function setTicket($t){ $this->ticket = $t; } - + /** + * set content attribute of the object. + * @param $c integer id of the ticket_content entry + */ public function setContent($c){ $this->content = $c; } + /** + * set author attribute of the object. + * @param $a integer id of the user + */ public function setAuthor($a){ $this->author = $a; } + /** + * set timestamp attribute of the object. + * @param $t timestamp of the reply + */ public function setTimestamp($t){ $this->timestamp = $t; } - + /** + * set tReplyId attribute of the object. + * @param $i integer id of the ticket_reply + */ public function setTReplyId($i){ $this->tReplyId = $i; } + /** + * set hidden attribute of the object. + * @param $h should be 0 or 1 + */ public function setHidden($h){ $this->hidden = $h; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php index fe3529925..46125e284 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php @@ -1,13 +1,24 @@ getPermission() > 1){ return true; @@ -23,6 +40,12 @@ class Ticket_User{ return false; } + + /** + * check if a ticket_user object is an admin or not. + * @param $user the ticket_user object itself + * @return true or false + */ public static function isAdmin($user){ if(isset($user) && $user->getPermission() == 3){ return true; @@ -30,7 +53,12 @@ class Ticket_User{ return false; } - //return constructed element based on TUserId + + /** + * return constructed ticket_user object based on TUserId. + * @param $id the TUserId of the entry. + * @return constructed ticket_user object + */ public static function constr_TUserId( $id) { $instance = new self(); $instance->setTUserId($id); @@ -38,7 +66,11 @@ class Ticket_User{ } - //return all mods/admins + + /** + * return a list of all mods/admins. + * @return an array consisting of ticket_user objects that are mods & admins. + */ public static function getModsAndAdmins() { $dbl = new DBLayer("lib"); $statement = $dbl->executeWithoutParams("SELECT * FROM `ticket_user` WHERE `Permission` > 1"); @@ -52,7 +84,12 @@ class Ticket_User{ return $result; } - //return constructed element based on ExternId + + /** + * return constructed ticket_user object based on ExternId. + * @param $id the ExternId of the entry. + * @return constructed ticket_user object + */ public static function constr_ExternId( $id) { $instance = new self(); $dbl = new DBLayer("lib"); @@ -62,9 +99,14 @@ class Ticket_User{ $instance->permission = $row['Permission']; $instance->externId = $row['ExternId']; return $instance; - } + + /** + * change the permission of a ticket_user. + * @param $user_id the TUserId of the entry. + * @param $perm the new permission value. + */ public static function change_permission($user_id, $perm){ $user = new Ticket_User(); $user->load_With_TUserId($user_id); @@ -73,6 +115,11 @@ class Ticket_User{ } + /** + * return the email address of a ticket_user. + * @param $id the TUserId of the entry. + * @return string containing the email address of that user. + */ public static function get_email_by_user_id($id){ $user = new Ticket_User(); $user->load_With_TUserId($id); @@ -81,6 +128,11 @@ class Ticket_User{ } + /** + * return the username of a ticket_user. + * @param $id the TUserId of the entry. + * @return string containing username of that user. + */ public static function get_username_from_id($id){ $user = new Ticket_User(); $user->load_With_TUserId($id); @@ -89,25 +141,47 @@ class Ticket_User{ } + /** + * return the TUserId of a ticket_user by giving a username. + * @param $username the username of a user. + * @return the TUserId related to that username. + */ public static function get_id_from_username($username){ $externId = WebUsers::getId($username); $user = Ticket_User::constr_ExternId($externId); return $user->getTUserId(); } - + /** + * return the ticket_user id from an email address. + * @param $email the emailaddress of a user. + * @return the ticket_user id related to that email address, in case none, return "FALSE". + */ public static function get_id_from_email($email){ $webUserId = WebUsers::getIdFromEmail($email); - $user = Ticket_User::constr_ExternId($webUserId); - return $user->getTUserId(); + if($webUserId != "FALSE"){ + $user = Ticket_User::constr_ExternId($webUserId); + return $user->getTUserId(); + }else{ + return "FALSE"; + } } ////////////////////////////////////////////Methods//////////////////////////////////////////////////// + + /** + * A constructor. + * Empty constructor + */ public function __construct() { } - //set values + + /** + * sets the object's attributes. + * @param $values should be an array of the form array('TUserId' => id, 'Permission' => perm, 'ExternId' => ext_id). + */ public function set($values) { $this->setTUserId($values['TUserId']); $this->setPermission($values['Permission']); @@ -115,7 +189,11 @@ class Ticket_User{ } - //return constructed element based on TUserId + /** + * loads the object's attributes. + * loads the object's attributes by giving a TUserId. + * @param $id the id of the ticket_user that should be loaded + */ public function load_With_TUserId( $id) { $dbl = new DBLayer("lib"); $statement = $dbl->execute("SELECT * FROM ticket_user WHERE TUserId=:id", array('id' => $id)); @@ -125,7 +203,10 @@ class Ticket_User{ $this->externId = $row['ExternId']; } - //update private data to DB. + + /** + * update the object's attributes to the db. + */ public function update(){ $dbl = new DBLayer("lib"); $query = "UPDATE ticket_user SET Permission = :perm, ExternId = :ext_id WHERE TUserId=:id"; @@ -135,16 +216,23 @@ class Ticket_User{ ////////////////////////////////////////////Getters//////////////////////////////////////////////////// + /** + * get permission attribute of the object. + */ public function getPermission(){ return $this->permission; } - + /** + * get externId attribute of the object. + */ public function getExternId(){ return $this->externId; } - + /** + * get tUserId attribute of the object. + */ public function getTUserId(){ return $this->tUserId; } @@ -152,15 +240,27 @@ class Ticket_User{ ////////////////////////////////////////////Setters//////////////////////////////////////////////////// + /** + * set permission attribute of the object. + * @param $perm integer that indicates the permission level. (1= user, 2= mod, 3= admin) + */ public function setPermission($perm){ $this->permission = $perm; } + /** + * set externId attribute of the object. + * @param $id the external id. + */ public function setExternId($id){ $this->externId = $id; } + /** + * set tUserId attribute of the object. + * @param $id the ticket_user id + */ public function setTUserId($id){ $this->tUserId= $id; } diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php index d5ba0963a..7dbb1bfda 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php @@ -1,10 +1,15 @@ 12 ){ @@ -93,9 +95,9 @@ class Users{ } /** - * Function checkUserNameExists - * - * @takes $username + * check if username already exists. + * This is the base function, it should be overwritten by the WebUsers class. + * @param $username the username * @return string Info: Returns true or false if the user is in the www db. */ protected function checkUserNameExists($username){ @@ -106,12 +108,11 @@ class Users{ /** - * Function checkPassword - * - * @takes $pass + * checks if the password is valid. + * @param $pass the password willing to be used. * @return string Info: Returns a string based on if the password is valid, if valid then "success" is returned */ - private function checkPassword( $pass ) + public function checkPassword( $pass ) { if ( isset( $pass ) ){ if ( strlen( $pass ) > 20 ){ @@ -129,9 +130,10 @@ class Users{ /** - * Function confirmPassword - * - * @takes $pass + * checks if the confirmPassword matches the original. + * @param $pass_result the result of the previous password check. + * @param $pass the original pass. + * @param $confirmpass the confirmation password. * @return string Info: Verify's $_POST["Password"] is the same as $_POST["ConfirmPass"] */ private function confirmPassword($pass_result,$pass,$confirmpass) @@ -151,10 +153,9 @@ class Users{ /** - * Function checkEmail - * - * @takes $email - * @return + * wrapper to check if the email address is valid. + * @param $email the email address + * @return "success", else in case it isn't valid an error will be returned. */ public function checkEmail( $email ) { @@ -174,10 +175,10 @@ class Users{ /** - * Function checkEmailExists - * - * @takes $username - * @return string Info: Returns true or false if the user is in the www db. + * check if email already exists. + * This is the base function, it should be overwritten by the WebUsers class. + * @param $email the email address + * @return string Info: Returns true or false if the email is in the www db. */ protected function checkEmailExists($email){ //TODO: You should overwrite this method with your own version! @@ -186,13 +187,12 @@ class Users{ } - /** - * Function validEmail - * - * @takes $email - * @return true or false depending on if its a valid email format. + /** + * check if the emailaddress structure is valid. + * @param $email the email address + * @return true or false */ - private function validEmail( $email ){ + public function validEmail( $email ){ $isValid = true; $atIndex = strrpos( $email, "@" ); if ( is_bool( $atIndex ) && !$atIndex ){ @@ -238,9 +238,8 @@ class Users{ /** - * Function generateSALT - * - * @takes $length, which is by default 2 + * generate a SALT. + * @param $length the length of the SALT which is by default 2 * @return a random salt of 2 chars */ public static function generateSALT( $length = 2 ) @@ -278,10 +277,11 @@ class Users{ - /** - * Function create - * - * @takes $array with name,pass and mail + /** + * creates a user in the shard. + * incase the shard is offline it will place it in the ams_querycache. You have to create a user first in the CMS/WWW and use the id for this function. + * @param $values with name,pass and mail + * @param $user_id the extern id of the user (the id given by the www/CMS) * @return ok if it's get correctly added to the shard, else return lib offline and put in libDB, if libDB is also offline return liboffline. */ public static function createUser($values, $user_id){ @@ -308,11 +308,52 @@ class Users{ } + /** + * creates permissions in the shard db for a user. + * incase the shard is offline it will place it in the ams_querycache. + * @param $pvalues with username + */ + public static function createPermissions($pvalues) { + + try { + $values = array('username' => $pvalues[0]); + $dbs = new DBLayer("shard"); + $sth = $dbs->execute("SELECT UId FROM user WHERE Login= :username;", $values); + $result = $sth->fetchAll(); + foreach ($result as $UId) { + $ins_values = array('id' => $UId['UId']); + $dbs->execute("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES (:id, 'r2', 'OPEN');", $ins_values); + $dbs->execute("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES (:id , 'ryzom_open', 'OPEN');", $ins_values); + } + } + catch (PDOException $e) { + //oh noooz, the shard is offline! Put it in query queue at ams_lib db! + $dbl = new DBLayer("lib"); + $dbl->execute("INSERT INTO ams_querycache (type, query, db) VALUES (:type, :query, :db)",array("type" => "createPermissions", + "query" => json_encode(array($pvalues[0])), "db" => "shard")); + + + } + return true; + } + + /** + * check if username and password matches. + * This is the base function, it should be overwritten by the WebUsers class. + * @param $user the inserted username + * @param $pass the inserted password + */ protected function checkLoginMatch($user,$pass){ print('This is the base class!'); } + /** + * check if the changing of a password is valid. + * a mod/admin doesn't has to fill in the previous password when he wants to change the password, however for changing his own password he has to fill it in. + * @param $values an array containing the CurrentPass, ConfirmNewPass, NewPass and adminChangesOthers + * @return if it is valid "success will be returned, else an array with errors will be returned. + */ public function check_change_password($values){ //if admin isn't changing others if(!$values['adminChangesOther']){ @@ -366,6 +407,13 @@ class Users{ } } + /** + * sets the shards password. + * in case the shard is offline, the entry will be stored in the ams_querycache. + * @param $user the usersname of the account of which we want to change the password. + * @param $pass the new password. + * @return ok if it worked, if the lib or shard is offline it will return liboffline or shardoffline. + */ protected function setAmsPassword($user, $pass){ $values = Array('user' => $user, 'pass' => $pass); @@ -389,6 +437,13 @@ class Users{ } } + /** + * sets the shards email. + * in case the shard is offline, the entry will be stored in the ams_querycache. + * @param $user the usersname of the account of which we want to change the emailaddress. + * @param $mail the new email address + * @return ok if it worked, if the lib or shard is offline it will return liboffline or shardoffline. + */ protected function setAmsEmail($user, $mail){ $values = Array('user' => $user, 'mail' => $mail); diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/configs/ingame_layout.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/configs/ingame_layout.ini index e76cf2acf..f19d43265 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/configs/ingame_layout.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/configs/ingame_layout.ini @@ -14,6 +14,9 @@ title_bg_color = "#303030" ;default info text color info_color = "#00CED1" +;notification color +notification_color = "red" + ;Account (user/admin/mod) name color team_color = "red" user_color = "green" diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/cron/mail_cron.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/cron/mail_cron.php index 9d669e866..557a57417 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/cron/mail_cron.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/cron/mail_cron.php @@ -1,5 +1,10 @@ - + @@ -39,7 +39,7 @@ onfocus="javascript:showTooltip('{$password_message}', this);" /> - + @@ -52,11 +52,11 @@ onfocus="javascript:showTooltip('{$cpassword_message}', this);" /> - + - + - + @@ -78,17 +78,16 @@ value="1" onfocus="javascript:showTooltip('', this);" />{$tac_tag} - + {if isset($TAC_ERROR) && $TAC_ERROR eq "TRUE"}{/if}
-
+ @@ -58,6 +58,27 @@ diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/dashboard.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/dashboard.tpl new file mode 100644 index 000000000..24b8c7878 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/dashboard.tpl @@ -0,0 +1,81 @@ +{block name=content} + + + + + + + + + + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/home.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/home.tpl deleted file mode 100644 index 81ba9d934..000000000 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/home.tpl +++ /dev/null @@ -1,55 +0,0 @@ -{block name=content} - - - - - - - - - - -{/block} - diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_admin.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_admin.tpl index b3ce83d86..afe29e778 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_admin.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_admin.tpl @@ -1,18 +1,18 @@ {extends file="layout.tpl"} {block name=menu} - + - + - + - + - + - + {/block} diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_mod.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_mod.tpl index 34911226f..65d10c611 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_mod.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_mod.tpl @@ -1,18 +1,18 @@ {extends file="layout.tpl"} {block name=menu} - + - + - + - + - + - + {/block} diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_user.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_user.tpl index b876fa1c5..233ba2ad4 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_user.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/layout_user.tpl @@ -1,23 +1,12 @@ {extends file="layout.tpl"} {block name=menu} - -
  • Dashboard
  • -
  • Profile
  • -
  • Settings
  • - -
  • Create New Ticket
  • -
  • Logout
  • - - - - - + - + - + {/block} diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/login.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/login.tpl index ad6f48e0d..03d0bd7aa 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/login.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/login.tpl @@ -3,14 +3,13 @@

    {$login_info}

    - +

    Username:

    -

    Password: @@ -34,7 +33,7 @@

    {/if}

    - {$login_register_message} {$login_register_message_here}! + {$login_register_message} {$login_register_message_here}!

    Title: + + + {if $ingame} + + + + + + + + + + + + + + + + + + {/if}
    + + + + + + + + + +

    {$home_title}

    +
    + + + + + + + + + + +
    + + +
    +
    + + + + +
    + + +
    + + +
    + + + + + + + + + + + + + +
    Tickets Waiting for Direct ActionTickets TodoNewest TicketTotal amount of Tickets
    {$nrAssignedWaiting}{$nrToDo}{$newestTicketTitle}{$nrTotalTickets}
    +
    +
    +
    + + +
    + + +
    +

    {$home_info}

    +

    This is the GSOC project of Daan Janssens mentored by Matthew Lagoe.

    +
    +
    +
    +
    + +
    - - - - - - - - - -

    {$home_title}

    -
    - - - - - - - - - - -
    - - -
    -
    - - -
    - - -
    - - -
    -

    {$home_info}

    -
    -
    -
    -
    - -
    Dashboard
    Dashboard
    Profile
    Profile
    Settings
    Settings
    |
    Users
    Users
    Queues
    Queues
    Support Groups
    Support Groups
    Dashboard
    Dashboard
    Profile
    Profile
    Settings
    Settings
    |
    Users
    Users
    Queues
    Queues
    Support Groups
    Support Groups
    Dashboard
    Profile
    Profile
    Settings
    Settings
    |
    Create New Ticket
    Create New Ticket
    diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/register.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/register.tpl index 03cb7c9d3..9fa8fef32 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/register.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/register.tpl @@ -6,7 +6,7 @@
    {$welcome_message}
    -click hereeeee + @@ -23,7 +23,7 @@ "javascript:showTooltip('{$username_tooltip}', this);" />
    {if isset($Username)}{$Username}{/if}{if isset($USERNAME_ERROR) && $USERNAME_ERROR eq "TRUE"}{$USERNAME}{/if}
    {if isset($PASSWORD_ERROR) && $PASSWORD_ERROR eq "TRUE"}{$Password}{/if}{if isset($PASSWORD_ERROR) && $PASSWORD_ERROR eq "TRUE"}{$PASSWORD}{/if}
    {if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}{$ConfirmPass}{/if}{if isset($CPASSWORD_ERROR) && $CPASSWORD_ERROR eq "TRUE"}{$CPASSWORD}{/if}
    {$email_tag}{$email_tag} {if isset($EMAIL_ERROR) && $EMAIL_ERROR eq "TRUE"}{$Email}{/if}{if isset($EMAIL_ERROR) && $EMAIL_ERROR eq "TRUE"}{$EMAIL}{/if}
    {$tac_message}{$tac_message}
    -
    - +
    - - + + {if isset($isAdmin) and $isAdmin eq 'TRUE' and $target_id neq 1} {if $userPermission eq 1} - - + + {else if $userPermission eq 2 } - - + + {else if $userPermission eq 3 } - - + + {/if} {/if} @@ -40,7 +40,7 @@ - + @@ -70,7 +70,7 @@

    Change Password

    - +
    Browse UserSend TicketBrowse UserSend TicketMake ModeratorMake AdminMake ModeratorMake AdminDemote to UserMake AdminDemote to UserMake AdminDemote to UserDemote to ModeratorDemote to UserDemote to Moderator

    Change Settings

    Change Settings of {$target_username}

    {if !isset($changesOther) or $changesOther eq "FALSE"} @@ -124,12 +124,12 @@ + @@ -60,7 +60,7 @@ +

    Change Email

    - +
    New Email: - + {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}{$EMAIL}{/if}
    @@ -156,7 +156,7 @@ +

    Change Info

    - + @@ -201,6 +201,36 @@

    + +
    Firstname:
    +
    +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/sgroup_list.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/sgroup_list.tpl index 6279d8fe4..3a6dcc52f 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/sgroup_list.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/sgroup_list.tpl @@ -35,17 +35,47 @@ + {if isset($isAdmin) && $isAdmin eq 'TRUE'}{/if} {foreach from=$grouplist item=group} - + - {if isset($isAdmin) && $isAdmin eq 'TRUE'}{/if} + + {if isset($isAdmin) && $isAdmin eq 'TRUE'}{/if} {/foreach}
    + +
    +

    Ticket-Update Mail Settings

    +
    + + +
    + Receive ticket updates + + +
    + + + +

    + +

    +
    +

    Add a Support group

    -
    + - - - - - - - - + + + +
    Group name:
    Group Tag:
    + + + + + + + + + + + + + + + +
    Group name:
    Group Tag:
    Group EmailAddress:
    +
    + + + + + + + + + + + + + + + +
    IMAP MailServer IP:
    IMAP Username:
    IMAP Password:
    +

    @@ -86,15 +116,17 @@
    ID Name TagEmailAction
    {$group.sGroupId}{$group.name}{$group.name} {$group.tag}Delete{$group.groupemail}Delete
    diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_queue.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_queue.tpl index eeda5813e..956b5e20d 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_queue.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_queue.tpl @@ -8,11 +8,11 @@
    - - - - - + + + + +
    Todo ticketsAll ticketsAll open ticketsTicket ArchiveNot Assigned TicketsTodo ticketsAll ticketsAll open ticketsTicket ArchiveNot Assigned Tickets

    Tickets

    - + @@ -129,8 +129,8 @@ {foreach from=$tickets item=ticket} - - + + @@ -139,19 +139,19 @@ {if $ticket.forwardedGroupName eq "0"} {$public_sgroup} {else} - {$ticket.forwardedGroupName} + {$ticket.forwardedGroupName} {/if} @@ -27,7 +27,7 @@ - + diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_sgroup.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_sgroup.tpl index 388cf8e32..2f0c29695 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_sgroup.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_sgroup.tpl @@ -34,7 +34,7 @@
    {$ticket.tId}{$ticket.title}{if $ticket.assignedText neq ""} {$ticket.assignedText}{else} {$not_assigned} {/if}{$ticket.title}{if $ticket.assignedText neq ""} {$ticket.assignedText}{else} {$not_assigned} {/if} {$ticket.timestamp} {$ticket.category} {if $ticket.status eq 0}{else if $ticket.status eq 1}{else if $ticket.status eq 2}{/if}{$ticket.statusText} {if $ticket.assigned eq 0} - + {else if $ticket.assigned eq $user_id} -
    + diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_reply.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_reply.tpl index b6aa90cb2..9b0a6296a 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_reply.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_reply.tpl @@ -8,8 +8,8 @@
    - - + +
    Show TicketShow Ticket LogShow TicketShow Ticket Log

    Reply ID#{$reply_id} of Ticket #{$ticket_id}

    Reply ID#{$reply_id} of Ticket #{$ticket_id}

    Add user to the list

    {if isset($isAdmin) && $isAdmin eq 'TRUE'} - + @@ -92,8 +92,8 @@ {foreach from=$userlist item=user} - - {if isset($isAdmin) && $isAdmin eq 'TRUE'}{/if} + + {if isset($isAdmin) && $isAdmin eq 'TRUE'}{/if} {/foreach}
    Username:
    {$user.tUserId}{$user.name}Delete{$user.name}Delete
    @@ -102,6 +102,64 @@

    + + +
    + + +
    +

    Mail settings

    + + + + + + + + + + + + + + + + + + + + + + + +
    Group Email:
    IMAP Mail Server:
    IMAP Username:
    IMAP Password:
    + + + + +

    + +

    + + {if isset($RESULT_OF_MODIFYING) and $RESULT_OF_MODIFYING eq "SUCCESS"} +

    + {$modify_mail_of_group_success} +

    + {else if isset($RESULT_OF_MODIFYING) and $RESULT_OF_MODIFYING eq "EMAIL_NOT_VALID"} +

    + {$email_not_valid} +

    + {else if isset($RESULT_OF_MODIFYING) and $RESULT_OF_MODIFYING eq "NO_PASSWORD"} +

    + {$no_password_given} +

    + {/if} + + +
    +
    +
    diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_ticket.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_ticket.tpl index 5058a5776..97f1d3c53 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_ticket.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_ticket.tpl @@ -8,8 +8,9 @@ - {if isset($isMod) and $isMod eq "TRUE"}{/if} - + {if isset($isMod) and $isMod eq "TRUE"}{/if} + + {if $hasInfo}{/if}
    Show Ticket LogSend Other TicketShow Ticket LogSend Other TicketShow Additional Info
    @@ -73,13 +74,13 @@ {if $ticket_forwardedGroupName eq "0"} {$public_sgroup} {else} - {$ticket_forwardedGroupName} + {$ticket_forwardedGroupName} {/if} - Assigned To: {if $ticket_assignedTo neq ""} {$ticket_assignedToText}{else} {$not_assigned} {/if} + Assigned To: {if $ticket_assignedTo neq ""} {$ticket_assignedToText}{else} {$not_assigned} {/if} @@ -124,7 +125,7 @@ -
    + @@ -192,13 +193,13 @@

    Ticket Assigning: {if $ticket_assignedTo eq 0} - + {else if $ticket_assignedTo eq $user_id} -
    + @@ -232,7 +233,7 @@

    + + + + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_ticket_log.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_ticket_log.tpl index 57dff23b6..f79735064 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_ticket_log.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_ticket_log.tpl @@ -8,7 +8,7 @@ @@ -53,7 +53,7 @@ ","

    Forward to Group: - +

    + + + + + + + +
    + + + + +
    + + + {if isset($isMod) and $isMod eq "TRUE"}{/if} + + + +
    Show Ticket LogSend Other TicketShow Ticket
    +
    +
    +
    + + + + + + + + + +

    Additional Info For Ticket [#{$ticket_id}]

    +
    + + + + + + + + + + +
    + + +
    +
    + + +
    + + +
    + + +
    + + + + +
    + + +
    +

    Ingame related

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Shard ID: {$shard_id}
    User_Id: {$user_id}
    User Position: {$user_position}
    View Position: {$view_position}
    Client_Version: {$client_version}
    Patch_Version: {$patch_version}
    Server_Tick: {$server_tick}
    +
    +
    + + +
    +

    Hardware & Software related

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Memory: {$memory}
    Processor: {$processor}
    Cpu_Id: {$cpu_id}
    Cpu_Mask: {$cpu_mask}
    HT: {$ht}
    OS: {$os}
    NeL3D: {$nel3d}
    +
    +
    + + +
    +

    Network related

    + + + + + + + + + + +
    Connect_State: {$connect_state}
    Local_Address: {$local_address}
    +
    +
    +
    +
    +
    +
    + +
    - +
    Show TicketShow Ticket
    + {if isset($isAdmin) && $isAdmin eq 'TRUE'}{/if} @@ -28,6 +29,7 @@ + {if isset($isAdmin) && $isAdmin eq 'TRUE'}{/if} {/foreach} @@ -71,6 +73,42 @@ +
    + +
    +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    +
    diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_queue.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_queue.tpl index 179767589..6cb2069fa 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_queue.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_queue.tpl @@ -34,7 +34,7 @@ @@ -108,13 +108,13 @@
    ","
    -

    Title: {$ticket_title}

    +

    Title: {$ticket_title}

    diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_user.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_user.tpl index 93110b895..51c5bb77a 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_user.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/show_user.tpl @@ -8,18 +8,18 @@ + + + + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/autoload/webusers.php b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/autoload/webusers.php new file mode 100644 index 000000000..dadf4cc5e --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/autoload/webusers.php @@ -0,0 +1,327 @@ +uId = $UId; + } + + + /** + * sets the object's attributes. + * @param $values should be an array. + */ + public function set($values){ + $this->uId = $values['uid']; + $this->login = $values['name']; + $this->email = $values['mail']; + //$this->firstname = $values['FirstName']; + //$this->lastname = $values['LastName']; + //$this->gender = $values['Gender']; + //$this->country = $values['Country']; + //$this->receiveMail = $values['ReceiveMail']; + //$this->language = $values['Language']; + } + + + /** + * function that checks if a username exists already or not. + * This function overrides the function of the base class. + * @param $username the username in question + * @return string Info: Returns 0 if the user is not in the web db, else a positive number is returned. + */ + protected function checkUserNameExists($username){ + return db_query("SELECT COUNT(*) FROM {users} WHERE name = :name", array(':name' => $username))->fetchField(); + } + + + /** + * function that checks if a email exists already or not. + * This function overrides the function of the base class. + * @param $email the email address in question. + * @return string Info: Returns 0 if the email address is not in the web db, else a positive number is returned. + */ + protected function checkEmailExists($email){ + return db_query("SELECT COUNT(*) FROM {users} WHERE mail = :mail", array(':mail' => $email))->fetchField(); + } + + + /** + * check if the login username and password match the db. + * @param $username the inserted username + * @param $password the inserted password (unhashed) + * @return the logged in user's db row as array if login was a success, else "fail" will be returned. + */ + public function checkLoginMatch($username,$password){ + if(!user_authenticate($username, $password)){ + return 'fail'; + }else{ + return db_query("SELECT * FROM {users} WHERE name = :name", array(':name' => $username))->fetchAssoc(); + } + } + + + /** + * returns te id for a given username + * @param $username the username + * @return the user's id linked to the username + */ + public static function getId($username){ + $row = db_query("SELECT * FROM {users} WHERE name = :name", array(':name' => $username))->fetchAssoc(); + return $row['uid']; + } + + + /** + * returns te id for a given emailaddress + * @param $email the emailaddress + * @return the user's id linked to the emailaddress + */ + public static function getIdFromEmail($email){ + $dbw = new DBLayer("web"); + $statement = $dbw->execute("SELECT * FROM ams_user WHERE Email=:email", array('email' => $email)); + $row = $statement->fetch(); + if(!empty($row)){ + return $row['UId']; + }else{ + return "FALSE"; + } + } + + + /** + * get uId attribute of the object. + */ + public function getUId(){ + return $this->uId; + } + + + /** + * get login attribute of the object.(username) + */ + public function getUsername(){ + + if(! isset($this->login) || $this->login == ""){ + $row = db_query("SELECT * FROM {users} WHERE uid = :id", array(':id' => $this->uId))->fetchAssoc(); + $this->set($row); + } + return $this->login; + } + + + /** + * get email attribute of the object. + */ + public function getEmail(){ + if(! isset($this->email) || $this->email == ""){ + $row = db_query("SELECT * FROM {users} WHERE uid = :id", array(':id' => $this->uId))->fetchAssoc(); + $this->set($row); + } + return $this->email; + } + + + /** + * get basic info of the object. + * @return returns an array in the form of Array('FirstName' => $this->firstname, 'LastName' => $this->lastname, 'Gender' => $this->gender, 'Country' => $this->country, 'ReceiveMail' => $this->receiveMail) + */ + public function getInfo(){ + $dbw = new DBLayer("web"); + if(! (isset($this->firstname) && isset($this->lastname) && isset($this->gender) && isset($this->country) && isset($this->receiveMail) ) || + $this->firstname == "" || $this->lastname == "" || $this->gender == "" || $this->country == "" || $this->receiveMail == ""){ + $statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId)); + $row = $statement->fetch(); + $this->set($row); + } + $result = Array('FirstName' => $this->firstname, 'LastName' => $this->lastname, 'Gender' => $this->gender, 'Country' => $this->country, 'ReceiveMail' => $this->receiveMail); + return $result; + } + + + /** + * get receiveMail attribute of the object. + */ + public function getReceiveMail(){ + $dbw = new DBLayer("web"); + if(! isset($this->receiveMail) || $this->receiveMail == ""){ + $statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId)); + $row = $statement->fetch(); + $this->set($row); + } + return $this->receiveMail; + } + + + /** + * get language attribute of the object. + */ + public function getLanguage(){ + return $DEFAULT_LANGUAGE; + } + + + /** + * check if the user is logged in. + * @return true or false + */ + public function isLoggedIn(){ + if(isset($_SESSION['user'])){ + return true; + } + return false; + } + + + /** + * update the password. + * update the password in the shard + update the password in the www/CMS version. + * @param $user the username + * @param $pass the new password. + * @return ok if it worked, if the lib or shard is offline it will return liboffline or shardoffline. + */ + public function setPassword($user, $pass){ + $hashpass = crypt($pass, WebUsers::generateSALT()); + $reply = WebUsers::setAmsPassword($user, $hashpass); + $drupal_pass = user_hash_password($pass); + $values = Array('user' => $user, 'pass' => $drupal_pass); + try { + //make connection with and put into shard db + db_query("UPDATE {users} SET pass = :pass WHERE name = :user", $values); + } + catch (PDOException $e) { + //ERROR: the web DB is offline + } + return $reply; + } + + + /** + * update the emailaddress. + * update the emailaddress in the shard + update the emailaddress in the www/CMS version. + * @param $user the username + * @param $mail the new emailaddress. + * @return ok if it worked, if the lib or shard is offline it will return liboffline or shardoffline. + */ + public function setEmail($user, $mail){ + $reply = WebUsers::setAmsEmail($user, $mail); + $values = Array('user' => $user, 'mail' => $mail); + try { + //make connection with and put into shard db + db_query("UPDATE {users} SET mail = :mail WHERE name = :user", $values); + + } + catch (PDOException $e) { + //ERROR: the web DB is offline + } + return $reply; + } + + + /** + * update the setReceiveMail value in the db. + * update the receiveMail in the www/CMS version. + * @param $user the username + * @param $receivemail the receivemail setting . + */ + public static function setReceiveMail($user, $receivemail){ + $values = Array('user' => $user, 'receivemail' => $receivemail); + try { + //make connection with and put into shard db + $dbw = new DBLayer("web"); + $dbw->execute("UPDATE ams_user SET ReceiveMail = :receivemail WHERE UId = :user ",$values); + } + catch (PDOException $e) { + //ERROR: the web DB is offline + } + } + + + /** + * update the language value in the db. + * update the language in the www/CMS version. + * @param $user the username + * @param $language the new language value. + */ + public static function setLanguage($user, $language){ + $values = Array('user' => $user, 'language' => $language); + try { + //make connection with and put into shard db + $dbw = new DBLayer("web"); + $dbw->execute("UPDATE ams_user SET Language = :language WHERE UId = :user ",$values); + } + catch (PDOException $e) { + //ERROR: the web DB is offline + } + } + + + /** + * return all users. + * @return return an array of users + */ + public function getUsers(){ + $dbl = new DBLayer("web"); + $data = $dbl->executeWithoutParams("SELECT * FROM ams_user"); + return $data; + } + + + /** + * return the query that should get all users. + * @return string: the query to receive all users. + */ + public static function getAllUsersQuery(){ + return "SELECT * FROM users WHERE `uid` > 0"; + } + + + /** + * creates a webuser. + * it will set the language matching to the language cookie setting and add it to the www/CMS's DB. + * @param $name the username + * @param $pass the unhashed password + * @param $mail the email address + */ + public static function createWebuser($name, $pass, $mail){ + + //register account with the correct language (check if cookie is already set)! + if ( isset( $_COOKIE['Language'] ) ) { + $lang = $_COOKIE['Language']; + }else{ + global $DEFAULT_LANGUAGE; + $lang = $DEFAULT_LANGUAGE; + } + + $values = Array('name' => $name, 'pass' => $pass, 'mail' => $mail, 'lang' => $lang); + + try { + $dbw = new DBLayer("web"); + return $dbw->executeReturnId("INSERT INTO ams_user (Login, Password, Email, Language) VALUES (:name, :pass, :mail, :lang)",$values); + } + catch (PDOException $e) { + //ERROR: the web DB is offline + } + } + +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/config.default.php b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/config.default.php new file mode 100644 index 000000000..ec810a402 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/config.default.php @@ -0,0 +1,111 @@ +getInfo(); + if(Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) && ($_GET['id']!= $_SESSION['id'])){ + $result['changesOther'] = "TRUE"; + } + $result['target_id'] = $_GET['id']; + $result['current_mail'] = $webUser->getEmail(); + $result['target_username'] = $webUser->getUsername(); + } + }else{ + $webUser = new Webusers($_SESSION['id']); + //$result = $webUser->getInfo(); + $result['target_id'] = $_SESSION['id']; + $result['current_mail'] = $webUser->getEmail(); + $result['target_username'] = $webUser->getUsername(); + + } + //Sanitize Data + $result['current_mail'] = filter_var($result['current_mail'], FILTER_SANITIZE_EMAIL); + $result['target_username'] = filter_var($result['target_username'], FILTER_SANITIZE_STRING); + //$result['FirstName'] = filter_var($result['FirstName'], FILTER_SANITIZE_STRING); + //$result['LastName'] = filter_var($result['LastName'], FILTER_SANITIZE_STRING); + //$result['Country'] = filter_var($result['Country'], FILTER_SANITIZE_STRING); + //$result['Gender'] = filter_var($result['Gender'], FILTER_SANITIZE_NUMBER_INT); + //$result['ReceiveMail'] = filter_var($result['ReceiveMail'], FILTER_SANITIZE_NUMBER_INT); + //$result['country_array'] = getCountryArray(); + global $INGAME_WEBPATH; + $result['ingame_webpath'] = $INGAME_WEBPATH; + return $result; + }else{ + //ERROR: not logged in! + header("Location: index.php"); + exit; + } +} + + +function getCountryArray(){ + +$countries = array( +'AA'=>'None Selected', +'AF'=>'Afghanistan', +'AL'=>'Albania', +'DZ'=>'Algeria', +'AS'=>'American Samoa', +'AD'=>'Andorra', +'AO'=>'Angola', +'AI'=>'Anguilla', +'AQ'=>'Antarctica', +'AG'=>'Antigua And Barbuda', +'AR'=>'Argentina', +'AM'=>'Armenia', +'AW'=>'Aruba', +'AU'=>'Australia', +'AT'=>'Austria', +'AZ'=>'Azerbaijan', +'BS'=>'Bahamas', +'BH'=>'Bahrain', +'BD'=>'Bangladesh', +'BB'=>'Barbados', +'BY'=>'Belarus', +'BE'=>'Belgium', +'BZ'=>'Belize', +'BJ'=>'Benin', +'BM'=>'Bermuda', +'BT'=>'Bhutan', +'BO'=>'Bolivia', +'BA'=>'Bosnia And Herzegovina', +'BW'=>'Botswana', +'BV'=>'Bouvet Island', +'BR'=>'Brazil', +'IO'=>'British Indian Ocean Territory', +'BN'=>'Brunei', +'BG'=>'Bulgaria', +'BF'=>'Burkina Faso', +'BI'=>'Burundi', +'KH'=>'Cambodia', +'CM'=>'Cameroon', +'CA'=>'Canada', +'CV'=>'Cape Verde', +'KY'=>'Cayman Islands', +'CF'=>'Central African Republic', +'TD'=>'Chad', +'CL'=>'Chile', +'CN'=>'China', +'CX'=>'Christmas Island', +'CC'=>'Cocos (Keeling) Islands', +'CO'=>'Columbia', +'KM'=>'Comoros', +'CG'=>'Congo', +'CK'=>'Cook Islands', +'CR'=>'Costa Rica', +'CI'=>'Cote D\'Ivorie (Ivory Coast)', +'HR'=>'Croatia (Hrvatska)', +'CU'=>'Cuba', +'CY'=>'Cyprus', +'CZ'=>'Czech Republic', +'CD'=>'Democratic Republic Of Congo (Zaire)', +'DK'=>'Denmark', +'DJ'=>'Djibouti', +'DM'=>'Dominica', +'DO'=>'Dominican Republic', +'TP'=>'East Timor', +'EC'=>'Ecuador', +'EG'=>'Egypt', +'SV'=>'El Salvador', +'GQ'=>'Equatorial Guinea', +'ER'=>'Eritrea', +'EE'=>'Estonia', +'ET'=>'Ethiopia', +'FK'=>'Falkland Islands (Malvinas)', +'FO'=>'Faroe Islands', +'FJ'=>'Fiji', +'FI'=>'Finland', +'FR'=>'France', +'FX'=>'France, Metropolitan', +'GF'=>'French Guinea', +'PF'=>'French Polynesia', +'TF'=>'French Southern Territories', +'GA'=>'Gabon', +'GM'=>'Gambia', +'GE'=>'Georgia', +'DE'=>'Germany', +'GH'=>'Ghana', +'GI'=>'Gibraltar', +'GR'=>'Greece', +'GL'=>'Greenland', +'GD'=>'Grenada', +'GP'=>'Guadeloupe', +'GU'=>'Guam', +'GT'=>'Guatemala', +'GN'=>'Guinea', +'GW'=>'Guinea-Bissau', +'GY'=>'Guyana', +'HT'=>'Haiti', +'HM'=>'Heard And McDonald Islands', +'HN'=>'Honduras', +'HK'=>'Hong Kong', +'HU'=>'Hungary', +'IS'=>'Iceland', +'IN'=>'India', +'ID'=>'Indonesia', +'IR'=>'Iran', +'IQ'=>'Iraq', +'IE'=>'Ireland', +'IL'=>'Israel', +'IT'=>'Italy', +'JM'=>'Jamaica', +'JP'=>'Japan', +'JO'=>'Jordan', +'KZ'=>'Kazakhstan', +'KE'=>'Kenya', +'KI'=>'Kiribati', +'KW'=>'Kuwait', +'KG'=>'Kyrgyzstan', +'LA'=>'Laos', +'LV'=>'Latvia', +'LB'=>'Lebanon', +'LS'=>'Lesotho', +'LR'=>'Liberia', +'LY'=>'Libya', +'LI'=>'Liechtenstein', +'LT'=>'Lithuania', +'LU'=>'Luxembourg', +'MO'=>'Macau', +'MK'=>'Macedonia', +'MG'=>'Madagascar', +'MW'=>'Malawi', +'MY'=>'Malaysia', +'MV'=>'Maldives', +'ML'=>'Mali', +'MT'=>'Malta', +'MH'=>'Marshall Islands', +'MQ'=>'Martinique', +'MR'=>'Mauritania', +'MU'=>'Mauritius', +'YT'=>'Mayotte', +'MX'=>'Mexico', +'FM'=>'Micronesia', +'MD'=>'Moldova', +'MC'=>'Monaco', +'MN'=>'Mongolia', +'MS'=>'Montserrat', +'MA'=>'Morocco', +'MZ'=>'Mozambique', +'MM'=>'Myanmar (Burma)', +'NA'=>'Namibia', +'NR'=>'Nauru', +'NP'=>'Nepal', +'NL'=>'Netherlands', +'AN'=>'Netherlands Antilles', +'NC'=>'New Caledonia', +'NZ'=>'New Zealand', +'NI'=>'Nicaragua', +'NE'=>'Niger', +'NG'=>'Nigeria', +'NU'=>'Niue', +'NF'=>'Norfolk Island', +'KP'=>'North Korea', +'MP'=>'Northern Mariana Islands', +'NO'=>'Norway', +'OM'=>'Oman', +'PK'=>'Pakistan', +'PW'=>'Palau', +'PA'=>'Panama', +'PG'=>'Papua New Guinea', +'PY'=>'Paraguay', +'PE'=>'Peru', +'PH'=>'Philippines', +'PN'=>'Pitcairn', +'PL'=>'Poland', +'PT'=>'Portugal', +'PR'=>'Puerto Rico', +'QA'=>'Qatar', +'RE'=>'Reunion', +'RO'=>'Romania', +'RU'=>'Russia', +'RW'=>'Rwanda', +'SH'=>'Saint Helena', +'KN'=>'Saint Kitts And Nevis', +'LC'=>'Saint Lucia', +'PM'=>'Saint Pierre And Miquelon', +'VC'=>'Saint Vincent And The Grenadines', +'SM'=>'San Marino', +'ST'=>'Sao Tome And Principe', +'SA'=>'Saudi Arabia', +'SN'=>'Senegal', +'SC'=>'Seychelles', +'SL'=>'Sierra Leone', +'SG'=>'Singapore', +'SK'=>'Slovak Republic', +'SI'=>'Slovenia', +'SB'=>'Solomon Islands', +'SO'=>'Somalia', +'ZA'=>'South Africa', +'GS'=>'South Georgia And South Sandwich Islands', +'KR'=>'South Korea', +'ES'=>'Spain', +'LK'=>'Sri Lanka', +'SD'=>'Sudan', +'SR'=>'Suriname', +'SJ'=>'Svalbard And Jan Mayen', +'SZ'=>'Swaziland', +'SE'=>'Sweden', +'CH'=>'Switzerland', +'SY'=>'Syria', +'TW'=>'Taiwan', +'TJ'=>'Tajikistan', +'TZ'=>'Tanzania', +'TH'=>'Thailand', +'TG'=>'Togo', +'TK'=>'Tokelau', +'TO'=>'Tonga', +'TT'=>'Trinidad And Tobago', +'TN'=>'Tunisia', +'TR'=>'Turkey', +'TM'=>'Turkmenistan', +'TC'=>'Turks And Caicos Islands', +'TV'=>'Tuvalu', +'UG'=>'Uganda', +'UA'=>'Ukraine', +'AE'=>'United Arab Emirates', +'UK'=>'United Kingdom', +'US'=>'United States', +'UM'=>'United States Minor Outlying Islands', +'UY'=>'Uruguay', +'UZ'=>'Uzbekistan', +'VU'=>'Vanuatu', +'VA'=>'Vatican City (Holy See)', +'VE'=>'Venezuela', +'VN'=>'Vietnam', +'VG'=>'Virgin Islands (British)', +'VI'=>'Virgin Islands (US)', +'WF'=>'Wallis And Futuna Islands', +'EH'=>'Western Sahara', +'WS'=>'Western Samoa', +'YE'=>'Yemen', +'YU'=>'Yugoslavia', +'ZM'=>'Zambia', +'ZW'=>'Zimbabwe' +); + +return $countries; + +} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/inc/show_user.php b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/inc/show_user.php new file mode 100644 index 000000000..dc4548361 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/inc/show_user.php @@ -0,0 +1,46 @@ +getUsername(); + $result['mail'] = $webUser->getEmail(); + //$info = $webUser->getInfo(); + //$result['firstName'] = $info['FirstName']; + //$result['lastName'] = $info['LastName']; + //$result['country'] = $info['Country']; + //$result['gender'] = $info['Gender']; + + $ticket_user = Ticket_User::constr_ExternId($result['target_id']); + $result['userPermission'] = $ticket_user->getPermission(); + if(Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))){ + $result['isAdmin'] = "TRUE"; + } + $ticketlist = Ticket::getTicketsOf($ticket_user->getTUserId()); + + $result['ticketlist'] = Gui_Elements::make_table($ticketlist, Array("getTId","getTimestamp","getTitle","getStatus","getStatusText","getStatusText","getCategoryName"), Array("tId","timestamp","title","status","statustext","statusText","category")); + global $INGAME_WEBPATH; + $result['ingame_webpath'] = $INGAME_WEBPATH; + return $result; + + }else{ + //ERROR: No access! + $_SESSION['error_code'] = "403"; + header("Location: index.php?page=error"); + exit; + } + }else{ + //ERROR: not logged in! + header("Location: index.php"); + exit; + } +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ryzommanage.info b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ryzommanage.info new file mode 100644 index 000000000..f5e91be64 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ryzommanage.info @@ -0,0 +1,11 @@ +; $Id$ +name = Ryzom Account Manager +description = Ryzom Login Service Integration - inserts and updates users and manages accounts. +core = 7.x +package = Ryzom Plugins +configure = admin/settings/ryzommanage + +; Information added by drupal.org packaging script on 2012-04-24 +version = "7.x-.01" +core = "7.x" + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ryzommanage.install b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ryzommanage.install new file mode 100644 index 000000000..4575f2dbd --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ryzommanage.install @@ -0,0 +1,31 @@ + 'Ryzom Manager', + 'machine_name' => 'ryzommanage', + 'description' => 'Ryzom Login Service integration - inserts and updates users and manages accounts.', + 'module' => 'ryzommanage', + ); + $vocab = (object) $vocab; + db_query("CREATE TABLE ryzommanage_querycache ( + `SID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , + `type` VARCHAR( 64 ) NOT NULL , + `query` VARCHAR( 512 ) NOT NULL + );"); + +} + +function ryzommanage_uninstall() { + db_query("DROP TABLE ryzommanage_querycache;"); +} + +function _ryzommanage_vocab_fields() { + +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ryzommanage.module b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ryzommanage.module new file mode 100644 index 000000000..52faa4c56 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ryzommanage.module @@ -0,0 +1,1034 @@ + ring users ---- nel user & nel permission ---- hook_user_cancel ---- remove character data on server +menu items that do stuff + +*/ +error_reporting(E_ALL); +ini_set('display_errors', 'on'); +ini_set('display_startup_errors', TRUE); + +//load globals before requiring them +global $TOS_URL; +global $AMS_LIB; +global $SITEBASE; +global $AMS_TRANS; +global $DEFAULT_LANGUAGE; +global $cfg; +global $TICKET_LOGGING; +global $TIME_FORMAT; +global $TICKET_MAILING_SUPPORT; +global $IMAGELOC_WEBPATH; +global $WEBPATH; +global $INGAME_WEBPATH; +global $BASE_WEBPATH; +global $INGAME_LAYOUT; +global $FORCE_INGAME; + +//require additional pages & register the autoload function. +require 'config.php'; +require 'ams_lib/libinclude.php'; +spl_autoload_register('__autoload'); + +/* +Drupal 7 ryzom core module +Copyright (C) 2013 Matthew Lagoe (Botanic) & Paige Offerdahl (Tobi) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +//output template + +function loadTemplate($template,$vars) +{ + extract($vars); + include($template); +} + +//validate registration webpage +function ryzommanage_form_alter(&$form, &$form_state, $form_id) +{ + if($form_id == "user_register_form") + { + $form['#validate'][] = '_webpage_registration'; + } elseif($form_id == "user_profile_form") { + $form['#validate'][] = '_webpage_profile'; + } +} + +function _webpage_registration(&$form_state) +{ + $webUser = new WebUsers(); + $user = $webUser->checkUser($form_state['account']['name']['#value']); + $email = $webUser->validEmail($form_state['account']['mail']['#value']); + + if ($user != "success") { + form_set_error('name', t($user)); + } + if ($email != "success") { + form_set_error('mail', t('Not a valid email address, please check it and try again.')); + } + +} + +function _webpage_profile(&$form_state) +{ + $webUser = new WebUsers(); + $email = $webUser->validEmail($form_state['account']['mail']['#value']); + + if ($email != "success") { + form_set_error('mail', t('Not a valid email address, please check it and try again.')); + } + if (($webUser->checkPassword($form_state['account']['pass']['#value']['pass1']) == "success" ) and ( $form_state['account']['pass']['#value']['pass1'] == + $form_state['account']['pass']['#value']['pass2'] )) { + } +} + +/** + * + * Function ryzommanage_menu + * + * @takes Nothing + * @return array $items + * + * Info: Creates the menu item in the admin interface + * + */ +function ryzommanage_menu() +{ + $items = array(); + //page for client registration + $items['register'] = array( + 'title' => 'register', + 'page callback' => '_collect_register', + 'page arguments' => array(1, 2), + 'access callback' => 'user_access', + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK + ); + + $items['login'] = array( + 'title' => 'Login', + 'page callback' => '_collect_login', + 'page arguments' => array(1, 2), + 'access callback' => 'user_access', + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK + ); + + $items['ams'] = array( + 'title' => 'Ryzom Account Management System', + 'page callback' => '_ams_callback', + 'access callback' => 'user_access', + 'access arguments' => array('access content'), + 'type' => MENU_NORMAL_ITEM + ); + + $items['ingame'] = array( + 'title' => 'Ingame AMS', + 'page callback' => '_collect_ingame_ams', + 'page arguments' => array(1, 2), + 'access callback' => 'user_access', + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK + ); + + //main menu item + $items['admin/config/ryzommanage'] = array( + 'title' => 'Ryzom Server Integration', + 'description' => 'Ryzom integration information.', + 'page callback' => 'system_admin_menu_block_page', + 'access arguments' => array( + 'administer site configuration' + ), + 'file' => 'system.admin.inc', + 'file path' => drupal_get_path('module', 'system') + ); + // First submenu item + $items['admin/config/ryzommanage/serversettings'] = array( + 'title' => 'Ryzom Server Settings', + 'description' => 'This is the first child item in the section', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'ryzommanage_admin' + ), + 'access arguments' => array( + 'administer site configuration' + ) + ); + // Second submenu item + $items['admin/config/ryzommanage/nameregister'] = array( + 'title' => 'Name Registration Settings', + 'description' => 'Configure default behavior of name registration module.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array( + 'name_registration_admin_settings' + ), + 'access arguments' => array( + 'administer site configuration' + ) + ); + return $items; +} + +//an empty call back function, because we need an empty page! +//without this the page gets access denied, perhaps for later use.. +function _ams_callback(){ + return array(); +} + +/** + * + * Function ryzommanage_menu + * + * @takes Int $element, &$form_state + * @return Nothing + * + * Info: Used by ryzommanage_mysqlport to validate ryzommanage_admin will run form_error if port is not between 1 and 65535. + * + */ +function _check_port_value($element, &$form_state) +{ + if ((!is_numeric(parse_size($element['#value']))) or ((parse_size($element['#value']) > 65535) or (parse_size($element['#value']) < 1))) { + form_error($element, t($element['#value'] . ' is not a valid value for the MySQL port, it must be a valid value. You must choose a number between 1 and 65535.')); + } +} +/** + * + * Function ryzommanage_block_info + * + * @takes Nothing + * @return array $blocks + * + * Info: Info for block that shows the user menu + * + */ +function ryzommanage_block_info() +{ + $blocks['ryzommanage_usersblock'] = array( + // info: The name of the block. + 'info' => t('Ryzom Manage User Block'), + 'status' => TRUE, + 'region' => '-1', // Not usually provided. + 'visibility' => BLOCK_VISIBILITY_LISTED // Not usually provided. + ); + + $blocks['ryzommanage_amsblock'] = array( + // info: The name of the block. + 'info' => t('Ryzom AMS Block'), + 'status' => TRUE, + 'region' => '-1', // Not usually provided. + 'visibility' => BLOCK_VISIBILITY_LISTED, + 'pages' => 'ams' + ); + return $blocks; +} +/** + * + * Function ryzommanage_block_view + * + * @takes Nothing + * @return array $block + * + * Info: View for block + * + */ +function ryzommanage_block_view($delta = '') +{ + $block = array(); + //The $delta parameter tells us which block is being requested. + switch ($delta) { + case 'ryzommanage_usersblock': + $block['subject'] = t("uppercase this please"); + $block['content'] = top_bar(); + break; + + case 'ryzommanage_amsblock': + //$block['subject'] = t("Ryzom Account Management System"); + $block['content'] = _ams_handler(); + break; + } + return $block; +} + + + +/* +* Core function, similar to the www index.php version. +*/ +function _ams_handler($ingame = false) +{ + global $BASE_WEBPATH; + global $SITEBASE; + global $INGAME_WEBPATH; + + //Decide what page to load + if ( ! isset( $_GET["page"]) ){ + if(isset($_SESSION['user'])){ + if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){ + $page = 'dashboard'; + }else{ + $page = 'show_user'; + } + }else{ + //default page + if($ingame){ + header("Location: ".$INGAME_WEBPATH."?page=login"); + }else{ + header("Location: ".$BASE_WEBPATH."/user/login"); + } + exit; + } + }else{ + $page = $_GET["page"]; + } + + //perform an action in case one is specified + //else check if a php page is included in the inc folder, else just set page to the get param + if ( isset( $_POST["function"] ) ){ + $filename = $SITEBASE . '/func/' . $_POST["function"] . '.php'; + if(is_file($filename)){ + require($filename); + $return = $_POST["function"](); + } + }else{ + $filename = $SITEBASE . '/inc/' . $page . '.php'; + if(is_file($filename)){ + require_once($filename); + $return = $page(); + } + } + + //add username to the return array in case logged in. + if(isset($_SESSION['user'])){ + $return['username'] = $_SESSION['user']; + } + + //Set permission + if(isset($_SESSION['ticket_user'])){ + $return['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); + }else{ + //default permission + $return['permission'] = 0; + } + + //handle error page + if($page == 'error'){ + $return['permission'] = 0; + $return['no_visible_elements'] = 'FALSE'; + } + + //return $page; + if ($ingame){ + helpers :: loadTemplate( $page , $return ); + }else{ + return helpers :: loadTemplate( $page , $return, true); + } + +} + + + +/** + * + * Function _collect_register + * + * @takes + * @return Nothing + * + * Info: Determins what to send back to client, if the client is ryzom core then send the http data if its a browser send to / + * + */ +function _collect_register($nids, $collection) +{ + Sync::syncdata(); + //if not using ryzom core client show registration page + if (Helpers::check_if_game_client()) { + return_client_httpdata(); + } else { + //redirect to registration page + global $BASE_WEBPATH; + header("Location: ".$BASE_WEBPATH. "/user/register"); + } +} + + + +/** + * + * Function _collect_ingame_ams + * + * @takes + * @return Nothing + * + * Info: Determins what to send back to client, if the client is ryzom core then send the http data if its a browser send to / + * + */ +function _collect_ingame_ams($nids, $collection) +{ + //if not using ryzom core client show registration page + if (Helpers::check_if_game_client()) { + _ams_handler(true); + } else { + //redirect to registration page + global $WEBPATH; + header("Location: ". $WEBPATH); + } +} + + +/** + * + * Function _collect_register + * + * @takes + * @return Nothing + * + * Info: Determins what to send back to client, if the client is ryzom core then send the http data if its a browser send to / + * + */ +function _collect_login($nids, $collection) +{ + global $WEBPATH; + global $BASE_WEBPATH; + $result = Helpers::check_login_ingame(); + if ($result != "FALSE") { + //handle successful ingame login + $_SESSION['user'] = $result['name']; + $_SESSION['id'] = WebUsers::getId($result['name']); + $_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id'])); + + if ($account = user_load( $_SESSION['id'])) { + global $user; + $user->uid = $_SESSION['id']; + $user->name = $account->name; + $user->timezone = $account->timezone; + user_login_finalize(); + } + header( 'Location: '.$WEBPATH ); + } else { + //redirect to registration page + header("Location: ".$BASE_WEBPATH."/user/login"); + } +} + + +/** + * + * Function confirmPassword + * + * @takes $pass + * @return string + * + * Info: Verify's $_POST["Password"] is the same as $_POST["ConfirmPass"] + * + */ +function confirmPassword() +{ + if (($_POST["Password"]) != ($_POST["ConfirmPass"])) { + return "Passwords do not match."; + } else { + return "success"; + } + return "fail"; +} + + +/** + * + * Function ryzommanage_user_insert + * + * @takes $pass + * @return string + * + * Info: Hook that's being called after creating a drupal user, we need to do it like this to access the drupals newly created user's id. + * + */ +function ryzommanage_user_insert(&$edit, $account, $category){ + if (isset($edit['unhashpass'])) { + $pass = $edit['unhashpass']; + } elseif (isset($_POST['pass']['pass1'])) { + $pass = $_POST['pass']['pass1']; + } + createUser(array($edit['name'], $pass, $edit['mail']), $account->uid); +} + +function createUser($values, $user_id) +{ + + $login = $values[0]; + $pass = $values[1]; + $email = $values[2]; + + /*$salt = generateSALT(); + $hashpass = crypt($pass, $salt);*/ + + $hashpass = crypt($pass, WebUsers::generateSALT()); + + $params = array( + 'name' => $login, + 'pass' => $hashpass, + 'mail' => $email + ); + + //Create the user on the shard + in case shard is offline put copy of query in query db + //returns: ok, shardoffline or liboffline + $result = WebUsers::createUser($params, $user_id); + Users::createPermissions(array($login)); +} + +/*function createPermissions($values) { + + try { + $hostname = variable_get('ryzommanage_serverurl', 'localhost'); + $port = variable_get('ryzommanage_mysqlport', '3306'); + $dbname = variable_get('ryzommanage_dbname', 'nel'); + $username = variable_get('ryzommanage_username', 'root'); + $password = variable_get('ryzommanage_password', ''); + $dbh = new PDO("mysql:host=$hostname;port=$port;dbname=$dbname", $username, $password); + $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } + catch (PDOException $e) { + watchdog('ryzommanage', $e->getMessage(), NULL, WATCHDOG_ERROR); + $nid = db_insert('ryzommanage_querycache')->fields(array( + "SID" => NULL, + "type" => "createPermissions", + "query" => json_encode(array( + $values[0] + )) + ))->execute(); + return true; + } + + try { + $sth = $dbh->prepare("SELECT UId FROM user WHERE Login='" . $values[0] . "';"); + $sth->execute(); + $result = $sth->fetchAll(); + foreach ($result as $UId) { + $statement = $dbh->prepare("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES ('" . $UId['UId'] . "', 'r2', 'OPEN');"); + $statement->execute($values); + $statement = $dbh->prepare("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES ('" . $UId['UId'] . "', 'ryzom_open', 'OPEN');"); + $statement->execute($values); + } + } + catch (PDOException $e) { + watchdog('ryzommanage', $e->getMessage(), NULL, WATCHDOG_ERROR); + $nid = db_insert('ryzommanage_querycache')->fields(array( + "SID" => NULL, + "type" => "createPermissions", + "query" => json_encode(array( + $values[0] + )) + ))->execute(); + return true; + } + + return true; +}*/ + +function ryzommanage_user_login(&$edit, $account){ + $_SESSION['user'] = $account->name; + $_SESSION['id'] = $account->uid; + $_SESSION['ticket_user'] = serialize(Ticket_User::constr_ExternId($_SESSION['id'])); +} + +function login_form($login_form) +{ + $login_form['#action'] = url(current_path(), array( + 'query' => drupal_get_destination(), + 'external' => FALSE + )); + $login_form['#id'] = 'user-login-form'; + $login_form['#validate'] = user_login_default_validators(); + $login_form['#submit'][] = 'user_login_submit'; + $login_form['name'] = array( + '#type' => 'textfield', + '#title' => t('Username'), + '#maxlength' => 12, + '#size' => 15, + '#required' => TRUE + ); + $login_form['pass'] = array( + '#type' => 'password', + '#title' => t('Password'), + '#maxlength' => 20, + '#size' => 15, + '#required' => TRUE + ); + $items = array(); + if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) { + $items[] = l(t('Create new account'), 'user/register', array( + 'attributes' => array( + 'title' => t('Create a new user account.') + ) + )); + } + $items[] = l(t('Request new password'), 'user/password', array( + 'attributes' => array( + 'title' => t('Request new password via e-mail.') + ) + )); + $login_form['links'] = array( + '#markup' => theme('item_list', array( + 'items' => $items + )) + ); + $login_form['remember_me'] = array( + '#type' => 'checkbox', + '#title' => t('Remember Me'), + '#default_value' => 0 + ); + $login_form['actions'] = array( + '#type' => 'actions' + ); + $login_form['actions']['submit'] = array( + '#type' => 'submit', + '#value' => t('Log in') + ); + return $login_form; +} + +function top_bar() +{ + global $user; + global $WEBPATH; + global $BASE_WEBPATH; + $userId = $user->uid; + if (user_is_logged_in()) { + // Logged in user + //check permission, if user + if(ticket_user::isMod(unserialize($_SESSION['ticket_user']))){ + return ""; + + }else{ + return ""; + } + + } else { + return drupal_get_form('login_form'); + // Not logged in + } +} + + + +function ryzommanage_user_presave(&$edit, $account, $category) +{ + if (isset($edit['unhashpass'])) { + $pass = $edit['unhashpass']; + } elseif (isset($_POST['pass']['pass1'])) { + $pass = $_POST['pass']['pass1']; + } + + if (!isset($edit['name'])) { + $name = $user->name; + } else { + $name = $edit['name']; + } + + if ($account->is_new == 1 ) { + //createUser(array($edit['name'], $pass, $edit['mail'])); + } else { + user_edit( array($edit['name'], $pass)); + } +} + +function ryzommanage_form_user_register_form_alter(&$form, &$form_state, $form_id) { + // Modification for the form with the given form ID goes here. For example, if + // FORM_ID is "user_register_form" this code would run only on the user + // registration form. + + // Change the data for the username and email fields + $form['account']['name']['#maxlength'] = '12'; + $form['account']['name']['#description'] = '5-12 lower-case characters and numbers. The login (username) you create here will be your login name.
    The name of your game characters will be chosen later on.
    '; + $form['account']['mail']['#description'] = 'Please verify that the e-mail address you enter here is valid and will remain valid in the future.
    It will be used to manage your Tempest in the Aether account.
    '; + // Add a checkbox to registration form about agreeing to terms of use. + $form['terms_of_use'] = array( + '#type' => 'checkbox', + '#title' => t("I agree with the terms and conditions."), + '#required' => TRUE, + ); + +} + +function ryzommanage_form_user_profile_form_alter(&$form, &$form_state, $form_id) { + // Modification for the form with the given form ID goes here. For example, if + // FORM_ID is "user_register_form" this code would run only on the user + // registration form. + + // Change the data for the password field + $form['account']['pass']['#description'] = 'Password must be 5-20 characters.
    '; +} + +function user_edit($values) { + + $username = $values[0]; + $newpassword = $values[1]; + + $salt = WebUsers::generateSALT(); + $pass = crypt($newpassword, $salt); + + $webUser = new WebUsers(); + $webUser->setAmsPassword($username,$pass); + return true; +} + + +/** + * + * Function ryzommanage_cron + * + * @takes + * @return + * + * Info: Runs the syncdata function with the drupal cron + * + */ +function ryzommanage_cron() { + + Sync::syncdata(); + +} + +function name_registration_admin_settings() { + global $TOS_URL; + $form = array(); + $form['ryzommanage_game-name'] = array( + '#type' => 'textfield', + '#title' => t('Game Name'), + '#default_value' => variable_get('ryzommanage_game-name', ''), + '#description' => t("Name of game used on registration pages."), + '#required' => TRUE + ); + //this is not the TOS url used in the create account page, you change that in the config of the client with the ConditionsTermsURL value + $form['ryzommanage_TOS'] = array( + '#type' => 'textfield', + '#title' => t('Terms of Service URL'), + '#default_value' => $TOS_URL, + '#description' => t("The url of the TOS for your server."), + '#required' => TRUE + ); + $form['ryzommanage_register-welcome'] = array( + '#type' => 'textarea', + '#title' => t('Registration Welcome Message'), + '#default_value' => variable_get('ryzommanage_register-welcome', ''), + '#description' => t("Registration welcome message on first page of create account."), + '#required' => TRUE + ); + + return system_settings_form($form); +} + + +/** + * + * Function ryzommanage_admin + * + * @takes Nothing + * @return array $form + * + * Info: Creates the box's etc that go in the ryzom admin menu + * + */ +function ryzommanage_admin() +{ + $form = array(); + //admin menu items + global $cfg; + + $form['ryzommanage_shardserverurl'] = array( + '#type' => 'textfield', + '#title' => t('Shard server url'), + '#default_value' => $cfg['db']['shard']['host'], + '#description' => t("The url of the ryzom server to integrate with."), + '#required' => TRUE + ); + $form['ryzommanage_shardmysqlport'] = array( + '#type' => 'textfield', + '#title' => t('Port for MySQL of the Shard'), + '#size' => 5, + '#maxlength' => 5, + '#default_value' => $cfg['db']['shard']['port'], + '#description' => t("The MySQL port of the ryzom server to integrate with."), + '#required' => TRUE, + '#element_validate' => array( + '_check_port_value' + ) + ); + $form['ryzommanage_sharddbname'] = array( + '#type' => 'textfield', + '#title' => t('Shard Database Name'), + '#default_value' => $cfg['db']['shard']['name'], + '#description' => t("The MySQL database name to connect to."), + '#required' => TRUE + ); + $form['ryzommanage_shardusername'] = array( + '#type' => 'textfield', + '#title' => t('Shard MySQL Username'), + '#default_value' => $cfg['db']['shard']['user'], + '#description' => t("The MySQL username to connect with."), + '#required' => TRUE + ); + $form['ryzommanage_shardpassword'] = array( + '#type' => 'password_confirm', + '#title' => t('Shard MySQL Password'), + '#description' => t("Confirm the MySQL password."), + '#suffix' => '
    ' + ); + + $form['ryzommanage_libserverurl'] = array( + '#type' => 'textfield', + '#title' => t('Lib server url'), + '#default_value' => $cfg['db']['lib']['host'], + '#description' => t("The url of the ryzom's lib db to integrate with."), + '#required' => TRUE + ); + $form['ryzommanage_libmysqlport'] = array( + '#type' => 'textfield', + '#title' => t('Port for MySQL of the Lib'), + '#size' => 5, + '#maxlength' => 5, + '#default_value' => $cfg['db']['lib']['port'], + '#description' => t("The MySQL port of the ryzom's lib db to integrate with."), + '#required' => TRUE, + '#element_validate' => array( + '_check_port_value' + ) + ); + $form['ryzommanage_libdbname'] = array( + '#type' => 'textfield', + '#title' => t('Lib Database Name'), + '#default_value' => $cfg['db']['lib']['name'], + '#description' => t("The MySQL database name to connect to."), + '#required' => TRUE + ); + $form['ryzommanage_libusername'] = array( + '#type' => 'textfield', + '#title' => t('Lib MySQL Username'), + '#default_value' => $cfg['db']['lib']['user'], + '#description' => t("The MySQL username to connect with."), + '#required' => TRUE + ); + $form['ryzommanage_libpassword'] = array( + '#type' => 'password_confirm', + '#title' => t('Lib MySQL Password'), + '#description' => t("Confirm the MySQL password."), + '#suffix' => '
    ' + ); + + + $form['ryzommanage_ringserverurl'] = array( + '#type' => 'textfield', + '#title' => t('Ring server url'), + '#default_value' => $cfg['db']['ring']['host'], + '#description' => t("The url of the ryzom's ring db to integrate with."), + '#required' => TRUE + ); + $form['ryzommanage_ringmysqlport'] = array( + '#type' => 'textfield', + '#title' => t('Port for MySQL of the Lib'), + '#size' => 5, + '#maxlength' => 5, + '#default_value' => $cfg['db']['ring']['port'], + '#description' => t("The MySQL port of the ryzom ring db to integrate with."), + '#required' => TRUE, + '#element_validate' => array( + '_check_port_value' + ) + ); + $form['ryzommanage_ringdbname'] = array( + '#type' => 'textfield', + '#title' => t('Ring Database Name'), + '#default_value' => $cfg['db']['ring']['name'], + '#description' => t("The MySQL database name to connect to."), + '#required' => TRUE + ); + $form['ryzommanage_ringusername'] = array( + '#type' => 'textfield', + '#title' => t('Ring MySQL Username'), + '#default_value' => $cfg['db']['ring']['user'], + '#description' => t("The MySQL username to connect with."), + '#required' => TRUE + ); + $form['ryzommanage_ringpassword'] = array( + '#type' => 'password_confirm', + '#title' => t('Ring MySQL Password'), + '#description' => t("Confirm the MySQL password.") + ); + return system_settings_form($form); +} + +/** + * + * Function return_client_httpdata + * + * @takes + * @return + * + * Info: Returns ryzom core formatted html for use in registration via client + * + */ +function return_client_httpdata() +{ + //needs $cpass = confirmPassword(($_POST["Password"]) != ($_POST["ConfirmPass"])); !!!!!! + //check if values exist + if (isset($_POST["Username"]) and isset($_POST["Password"]) and isset($_POST["Email"]) ) + { + //check values + $user = checkUser($_POST["Username"]); + $pass = checkPassword($_POST["Password"]); + $cpass = confirmPassword(($_POST["Password"]) != ($_POST["ConfirmPass"])); + $email = checkEmail($_POST["Email"]); + } else { + $user = ""; + $pass = ""; + $cpass = ""; + $email = ""; + } + //if all are good then create user + if (($user == "success") and ($pass == "success") and ($cpass == "success") and ($email == "success") and (isset($_POST["TaC"]))) { + $edit = array( + 'name' => $_POST["Username"], + 'pass' => $_POST["Password"], + 'mail' => $_POST["Email"], + 'init' => $_POST["Email"], + 'unhashpass' => $_POST["Password"], + 'status' => 1, + 'access' => REQUEST_TIME + ); + user_save(NULL, $edit); + header('Location: email_sent.php'); + exit; + } else { + $pageElements = array( + 'GAME_NAME' => variable_get('ryzommanage_game-name', ''), + 'WELCOME_MESSAGE' => variable_get('ryzommanage_register-welcome', ''), + 'USERNAME' => $user, + 'PASSWORD' => $pass, + 'CPASSWORD' => $cpass, + 'EMAIL' => $email + ); + if ($user != "success") { + $pageElements['USERNAME_ERROR'] = 'TRUE'; + } else { + $pageElements['USERNAME_ERROR'] = 'FALSE'; + } + + if ($pass != "success") { + $pageElements['PASSWORD_ERROR'] = 'TRUE'; + } else { + $pageElements['PASSWORD_ERROR'] = 'FALSE'; + } + if ($cpass != "success") { + $pageElements['CPASSWORD_ERROR'] = 'TRUE'; + } else { + $pageElements['CPASSWORD_ERROR'] = 'FALSE'; + } + if ($email != "success") { + $pageElements['EMAIL_ERROR'] = 'TRUE'; + } else { + $pageElements['EMAIL_ERROR'] = 'FALSE'; + } + if (isset($_POST["TaC"])) { + $pageElements['TAC_ERROR'] = 'FALSE'; + } else { + $pageElements['TAC_ERROR'] = 'TRUE'; + } + loadTemplate('templates/ingame_register.phtml',$pageElements); + } +} + +/** +* Implements hook_help. +* +* Displays help and module information. +* +* @param path +* Which path of the site we're using to display help +* @param arg +* Array that holds the current path as returned from arg() function +*/ +function ryzommanage_help($path, $arg) { + switch ($path) { + case "admin/help#ryzommanage": + return '

    ' . t("A module that handles account registration and a ticketing service regarding ryzomcore.") . '

    '; + break; + } +} + +function ryzommanage_enable() { + // Check if our field is not already created. + if (!field_info_field('firstname')) { + $field = array( + 'field_name' => 'firstname', + 'type' => 'text', + ); + field_create_field($field); + + // Create the instance on the bundle. + $instance = array( + 'field_name' => 'firstname', + 'entity_type' => 'user', + 'label' => 'First Name', + 'bundle' => 'user', + // If you don't set the "required" property then the field wont be required by default. + 'required' => FALSE, + 'settings' => array( + // Here you inform either or not you want this field showing up on the registration form. + + ), + 'widget' => array( + 'type' => 'textfield', + 'weight' => '1', + ), + ); + field_create_instance($instance); + } + + if (!field_info_field('secondname')) { + $field = array( + 'field_name' => 'secondname', + 'type' => 'text', + ); + field_create_field($field); + + // Create the instance on the bundle. + $instance = array( + 'field_name' => 'secondname', + 'entity_type' => 'user', + 'label' => 'Second Name', + 'bundle' => 'user', + // If you don't set the "required" property then the field wont be required by default. + 'required' => FALSE, + 'settings' => array( + // Here you inform either or not you want this field showing up on the registration form. + ), + 'widget' => array( + 'type' => 'textfield', + 'weight' => '1', + ), + ); + field_create_instance($instance); + } +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/createticket.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/createticket.tpl new file mode 100644 index 000000000..c1ca81e07 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/createticket.tpl @@ -0,0 +1,38 @@ +{block name=content} + +

    Create a new Ticket

    +
    +
    - - + + {if isset($isAdmin) and $isAdmin eq 'TRUE' and $target_id neq 1} {if $userPermission eq 1} - - + + {else if $userPermission eq 2 } - - + + {else if $userPermission eq 3 } - - + + {/if} {/if} @@ -138,7 +138,7 @@ {foreach from=$ticketlist item=ticket} - + diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/userlist.tpl b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/userlist.tpl index 4e5f2a4ae..c2e226ca3 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/userlist.tpl +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/ingame_templates/userlist.tpl @@ -44,24 +44,24 @@ {foreach from=$userlist item=element} - + {if $element.permission eq 1}{/if} {if $element.permission eq 2}{/if} {if $element.permission eq 3}{/if} @@ -73,11 +73,11 @@ diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php index e5deb6030..230c6849c 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/libinclude.php @@ -1,12 +1,19 @@ Register If you don't have an account yet, create one " +here = "here" +login_message = "You can always try to login by clicking " + +[reset_password] +title = "Reset your password" +reset_password_message = "Fill in your new password!" + +password_tag = "Desired Password" +password_tooltip = "Pick a hard to guess password (it must be 5-20 characters)." +password_message = "Password must be 5-20 characters." +password_default = "Password" + +cpassword_tag = "Confirm Password" +cpassword_tooltip = "Retype your Password" +cpassword_message = "Retype your Password" +cpassword_default = "Re-enter Password" + + + [syncing] syncing_title = "LibDB-Query List" syncing_info = "Here you can see the entire list of elements in the LibDB-Query table. You can easily remove elements and by pressing 'Synchronize' you can start the syncing process manually!" @@ -53,6 +82,9 @@ user_already_added = "The user is already part of the group!" group_not_existing = "The group doesn't exist!" user_not_existing = "The user doesn't seem to exist" not_mod_or_admin = "You can only add Moderators or Admins!" +modify_mail_of_group_success = "The Support Group's email settings have been modified!" +email_not_valid = "The group email address is invalid!" +no_password_given = "Be aware that there was no password filled in, so the password is empty atm!" [sgroup_list] group_success = "The group has been created!" @@ -62,6 +94,8 @@ group_size_error = "The name has to be between 4-20 chars and the tag between 2- [createticket] +[show_ticket_info] + [show_ticket_log] [show_reply] @@ -91,7 +125,8 @@ userlist_info = "welcome to the userlist" login_info = "Please login with your Username and Password." login_error_message = "The username/password were not correct!" login_register_message ="Register If you don't have an account yet, create one" -login_register_message_here = "here" +login_here = "here" +login_forgot_password_message = "In case you forgot your password, click" [logout] logout_message = "You've been logged out successfully!" @@ -99,6 +134,14 @@ login_title = "Login" login_timer = "You will be redirected to the login page in " login_text = "Or click here if you don't want to wait!" + +[reset_success] +reset_success_message = "You've changed the password succesfully!" +reset_success_title = "Login" +reset_success_timer = "You will be redirected to the login page in " +login_text = "Or click here if you don't want to wait!" + + [register_feedback] status_ok = "You registered like a baws!" status_shardoffline = "It seems the shard is offline, you can use the web-account, but you will need to wait for the shard." @@ -134,3 +177,65 @@ tac_tag1= "YES, I agree to the " tac_tag2="terms of service" tac_message = "You must accept the Terms of Service." +[email] + +;NEWREPLY========================================================================== +email_subject_new_reply = "New reply on [Ticket #" +email_body_new_reply_1 = "---------- Ticket #" +email_body_new_reply_2 = " ---------- +You received a new reply on your ticket: " +email_body_new_reply_3 = " +-------------------- +Reply Content: +" +email_body_new_reply_4 = " +-------------------- +You can reply on this message to answer directly on the ticket!" + +;NEWTICKET +;========================================================================== +email_subject_new_ticket = "New ticket created [Ticket #" +email_body_new_ticket_1 = "---------- Ticket #" +email_body_new_ticket_2 = " ---------- +Your ticket: " +email_body_new_ticket_3 = " ,is newly created +---------- +" +email_body_new_ticket_4 = " +---------- +You can reply on this message to answer directly on the ticket!" + +;WARNAUTHOR +;========================================================================== +email_subject_warn_author = "Someone tried to reply to your ticket: [Ticket #" +email_body_warn_author_1 = "Someone tried to reply at your ticket: " +email_body_warn_author_2 = " by sending an email from " +email_body_warn_author_3 = " ! Please use the email address matching to your account if you want to auto reply + +If " +email_body_warn_author_4 = " isn't one of your email addresses, please contact us by replying to this ticket!" + +;WARNSENDER +;========================================================================== +email_subject_warn_sender = "You tried to reply to someone elses ticket!" +email_body_warn_sender = "It seems you tried to reply to someone elses ticket, please use the matching email address to that account! + +This action is notified to the real ticket owner!" + +;WARNUNKNOWNENDER +;========================================================================== +email_subject_warn_unknown_sender = "You tried to reply to someone's ticket!" +email_body_warn_unknown_sender = "It seems you tried to reply to someone's ticket, However this email address isn't linked to any account, please use the matching email address to that account! + +This action is notified to the real ticket owner!" +;=========================================================================== + +;FORGOTPASSWORD +;=========================================================================== +email_subject_forgot_password = "Request to reset your password" +email_body_forgot_password_header = "A request to reset your account's password has been made, you can do this by going to the following link: +" +email_body_forgot_password_footer = " +---------- +If you didn't make this request, please ignore this message." +;=========================================================================== \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini index 9127fd0a3..b4fa1fcf6 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/fr.ini @@ -1,12 +1,38 @@ ; This is a sample configuration file ; Comments start with ';', as in php.ini -[home] +[dashboard] home_title = "Presentation" home_info = "Bienvenue sur le Ryzom Core - Account Management System" [settings] +[forgot_password] +title = "Oubliez votre passport?" +forgot_password_message = "Entrer votre email address pour reseter le passport!" +email_tag = "Email Address" +email_tooltip = "le emailaddress liee au compte dont vous avez oublie le mot de passe." +email_default = "Email" +email_doesnt_exist = "C'est emailaddress ne correspond pas a n'importe quel utilisateur!" +email_sent = "Un e-mail avec des instructions a ete envoye a l'adresse email!" +register_message =" Inscrivez-vous Si vous n'avez pas encore de compte, creez-en un " +here = "ici" +login_message = "vous pouvez toujours fait au bon chance a " + +[reset_password] +title = "reset votre email" +reset_password_message = "Entrer votre nouveaux mot de passe!" + +password_tag = "desire Mot de passe:" +password_tooltip = "Prendre un mot de passe dificille, il faut etre 5-20 caracteres" +password_message = "mot de passe doit être 5-20 caractères." +password_default = "Mot de passe" + +cpassword_tag = "Confirmer le mot de passe:" +cpassword_message = "Retapez votre mot de passe" +cpassword_tooltip = "Retapez votre mot de passe" +cpassword_default = "Re-entrer mot de passe" + [syncing] syncing_title = "LibDB-Query Liste" syncing_info = "Ici vous pouvez voir la liste complete des elements dans le tableau libdb-Query. Vous pouvez facilement supprimer des elements et appuyant sur 'Synchroniser', vous pouvez commencer le processus de synchronisation manuellement!" @@ -49,6 +75,10 @@ user_already_added = "cet user est deja membre de la groupe!" group_not_existing = "cet Groupe n' existe pas!" user_not_existing = "cet user n'existe pas" not_mod_or_admin = "C'est possible d'ajoute seulement des mods et admins!" +modify_mail_of_group_success = "Les parametres de messagerie du Groupe d'appui ont ete modifies!" +email_not_valid = "L'adresse email de groupe est invalide!" +no_password_given = "Soyez conscient qu'il n'y avait aucun mot de passe remplie, de sorte que le mot de passe est atm vide!" + [sgroup_list] group_success = "le group est cree!" @@ -58,6 +88,8 @@ group_size_error = "le nom doit etre 4-20 chars et le tag 2-4!" [createticket] +[show_ticket_info] + [show_reply] [show_ticket_log] @@ -87,7 +119,8 @@ userlist_info = "bienvenue sur le userlist page!" login_info = "S'il vous plait vous connecter avec votre nom d'utilisateur et mot de passe." login_error_message = "Le remplie nom d'utilisateur / mot de passe ne sont pas correctes!" login_register_message =" Inscrivez-vous Si vous n'avez pas encore de compte, creez-en un" -login_register_message_here = "ici" +login_here = "ici" +login_forgot_password_message = "Dans le cas ou vous avez oublie votre mot de passe, cliquez" [logout] logout_message = "Vous avez été déconnecté avec succès!" @@ -95,6 +128,12 @@ login_title = "Identifier" login_timer = "Vous serez redirigé vers la page de connexion à " login_text = "Ou cliquez ici si vous ne voulez pas attendre!" +[reset_success] +logout_message = "Vous avez changez votre passport bien!" +login_title = "Identifier" +login_timer = "Vous serez redirigé vers la page de connexion à " +login_text = "Ou cliquez ici si vous ne voulez pas attendre!" + [register_feedback] status_ok = "Vous vous êtes inscrit comme un patron!" status_shardoffline = "Il semble que le shard est déconnecté, vous pouvez utiliser le web-compte, mais vous devrez attendre pour le tesson." @@ -128,4 +167,67 @@ email_default = "email" tac_tag1 = "OUI, j'accepte les " tac_tag2 = "termes de service" -tac_message = "Vous devez accepter les Conditions d'utilisation." \ No newline at end of file +tac_message = "Vous devez accepter les Conditions d'utilisation." + +[email] + +;NEWREPLY========================================================================== +email_subject_new_reply = "Nouvelle message sur [Billet #" +email_body_new_reply_1 = "---------- Billet #" +email_body_new_reply_2 = " ---------- +Vous avez recu un nouvelle message sur: " +email_body_new_reply_3 = " +-------------------- +Repondre Contenu: +" +email_body_new_reply_4 = " +-------------------- +Vous ne pouvez pas repondre a ce message pour repondre directement sur le billet! " + +;NEWTICKET +;========================================================================== +email_subject_new_ticket = "nouvelle billet est cree [Billet #" +email_body_new_ticket_1 = "---------- Billet #" +email_body_new_ticket_2 = " ---------- +Votre Billet: " +email_body_new_ticket_3 = " est nouvelle cree +---------- +" +email_body_new_ticket_4 = " +---------- +Vous ne pouvez pas repondre a ce message pour repondre directement sur le billet!" + +;WARNAUTHOR +;========================================================================== +email_subject_warn_author = "Quelqu'un a essayé de répondre à votre billet: [Ticket #" +email_body_warn_author_1 = "Quelqu'un a essayé de répondre à votre billet: " +email_body_warn_author_2 = " en envoyant un courriel à partir de " +email_body_warn_author_3 = " ! Veuillez utiliser l'adresse e-mail correspondant à votre compte si vous souhaitez réponse automatique. + +Si " +email_body_warn_author_4 = " n'est pas l'une de vos adresses e-mail, s'il vous plaît contactez-nous en répondant à ce billet!" + +;WARNSENDER +;========================================================================== +email_subject_warn_sender = "Vous avez tenté de répondre à quelqu'un billet elses!" +email_body_warn_sender = "Il semble que vous avez essayé de répondre à quelqu'un billet elses, copiez l'adresse e-mail correspondant à ce compte! + +Cet acte est notifié au propriétaire du billet de vrai! " + +;WARNUNKNOWNENDER +;========================================================================== +email_subject_warn_unknown_sender = "Vous avez tenté de répondre à la billetterie de quelqu'un!" +email_body_warn_unknown_sender = "Il semble que vous avez essayé de répondre à la billetterie de quelqu'un, mais cette adresse e-mail n'est pas liée à un compte, veuillez utiliser l'adresse e-mail correspondant à ce compte! + +Cet acte est notifié au propriétaire du billet de vrai!" +;=========================================================================== + +;FORGOTPASSWORD +;=========================================================================== +email_subject_forgot_password = "Demande pour reinitialiser votre mot de passe" +email_body_forgot_password_header = "Une demande de reinitialiser le mot de passe de votre compte a ete faite, vous pouvez le faire en allant sur le lien suivant: +" +email_body_forgot_password_footer = " +---------- +Si vous n'avez pas fait cette demande, s'il vous plait ignorer ce message." +;=========================================================================== \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/credits.txt b/code/ryzom/tools/server/ryzom_ams/credits.txt new file mode 100644 index 000000000..d2878080a --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/credits.txt @@ -0,0 +1,7 @@ +################################################################### +CREDITS REGARDING THE AMS +################################################################## +- Muhammad Usman (Charisma Layout http://usman.it/themes/charisma/) +- prdatur (Icon Set http://opengameart.org/users/prdatur) +- Tobi (original Drupal Module) +- Botanic (Mentoring & original drupal module) diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage.info b/code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/ryzommanage.info similarity index 100% rename from code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage.info rename to code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/ryzommanage.info diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage.install b/code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/ryzommanage.install similarity index 100% rename from code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage.install rename to code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/ryzommanage.install diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage.module b/code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/ryzommanage.module similarity index 100% rename from code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage.module rename to code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/ryzommanage.module diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/templates/ingame_register.phtml b/code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/templates/ingame_register.phtml new file mode 100644 index 000000000..1f0fc0859 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/oldmodule/templates/ingame_register.phtml @@ -0,0 +1,116 @@ +
    + RYZOM CORE INGAME REGISTRATION +
    + +
    + +
    + + +
    Edit UserSend TicketEdit UserSend TicketMake ModeratorMake AdminMake ModeratorMake AdminDemote to UserMake AdminDemote to UserMake AdminDemote to UserDemote to ModeratorDemote to UserDemote to Moderator
    {$ticket.tId}{$ticket.title}{$ticket.title} {$ticket.timestamp} {$ticket.category}
    {$element.id}{$element.username}{$element.username} {$element.email}UserModeratorAdmin - Show User - Edit User + Show User + Edit User {if isset($isAdmin) and $isAdmin eq 'TRUE' and $element.id neq 1} {if $element.permission eq 1} - Make Moderator - Make Admin + Make Moderator + Make Admin {else if $element.permission eq 2 } - Demote to User - Make Admin + Demote to User + Make Admin {else if $element.permission eq 3 } - Demote to User - Demote to Moderator + Demote to User + Demote to Moderator {/if} {/if}
    - + {foreach from=$links item=link} - + {/foreach} - +
    ««{$link}{$link}»»
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + You must accept the Terms of Service';} + else { + echo ' +
    id="caption-Username">Desired Username: + + width="42%">
    id="caption-Password">Desired Password: + + width="42%">
    id="caption-ConfirmPass">Confirm Password: + width="42%">
    id="caption-Email">Email Address (to which a confirmation email will be sent): + account.', this);" /> + width="42%">
    + colspan="2">YES, I agree to the terms of + service';}; ?> +
    + +
    + +
    + + +
    + +
    + 5-12 lower-case characters and numbers. The login (username) you create here will be + your login name. The name of your game characters will be chosen later on. +
    + +
    + 5-20 characters. +
    + +
    + Retype your Password +
    + +
    + Please verify that the e-mail address you enter here is valid and will remain valid + in the future. It will be used to manage your account. +
    + +
    \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/ingame_templates/settings.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/ingame_templates/settings.tpl new file mode 100644 index 000000000..4e94e633c --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/ingame_templates/settings.tpl @@ -0,0 +1,161 @@ +{block name=content} +
    + + + + + + + +
    + + + + +
    + + + + + {if isset($isAdmin) and $isAdmin eq 'TRUE' and $target_id neq 1} + {if $userPermission eq 1} + + + {else if $userPermission eq 2 } + + + {else if $userPermission eq 3 } + + + {/if} + {/if} + +
    Browse UserSend TicketMake ModeratorMake AdminDemote to UserMake AdminDemote to UserDemote to Moderator
    +
    +
    +
    + + + + + + + + + +

    Change Settings of {$target_username}

    +
    + + + + + + + + + + +
    + + +
    +
    + + + +
    + + +
    + + +
    + +

    Change Password

    + +
    + + {if !isset($changesOther) or $changesOther eq "FALSE"} + + + +

    + + {/if} + + + +
    + Current Password: + + + {if isset($MATCH_ERROR) and $MATCH_ERROR eq "TRUE"}The password is incorrect{/if} +
    + New Password: + + + {if isset($NEWPASSWORD_ERROR) and $NEWPASSWORD_ERROR eq "TRUE"}{$newpass_error_message}{/if} +
    + Confirm New Password: + + + {if isset($CNEWPASSWORD_ERROR) and $CNEWPASSWORD_ERROR eq "TRUE"}{$confirmnewpass_error_message}{/if} +
    + {if isset($SUCCESS_PASS) and $SUCCESS_PASS eq "OK"} +

    + The password has been changed! +

    + {/if} + + + + + +

    + +
    + +
    +
    +
    + + +
    + + +
    +

    Change Email

    + +
    + + +
    + New Email: + + + {if isset($EMAIL_ERROR) and $EMAIL_ERROR eq "TRUE"}{$EMAIL}{/if} +
    + {if isset($SUCCESS_MAIL) and $SUCCESS_MAIL eq "OK"} +

    + The email has been changed! +

    + {/if} + + + +

    + +

    + +
    +
    +
    +
    + +
    + + + + + + + + + + + + +
    + + +
    + + +
    + + +
    + + + +
    + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/dashboard.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/dashboard.tpl new file mode 100644 index 000000000..83def588a --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/dashboard.tpl @@ -0,0 +1,77 @@ +{block name=content} + + + + + + + + + + + +
    + +
    Tickets Waiting for Direct Action: + {$nrAssignedWaiting}
    +
    +
    + +
    Tickets Todo: + {$nrToDo}
    +
    +
    + + +
    Newest Ticket: + {$newestTicketTitle}
    +
    +
    + + +
    Total amount of Tickets: + {$nrTotalTickets}
    +
    +
    + +

    +
    +
    +

    {$home_title}

    +
    + + + + +
    +
    +
    +

    {$home_info}

    +

    This is the GSOC project of Daan Janssens mentored by Matthew Lagoe.

    +

    The features as admin covered in this project are:

    +
      +
    • Manage user accounts
    • +
    • Make users moderator or admin
    • +
    • browse user's tickets
    • +
    • Create a new ticket for a specific user as admin
    • +
    • Create a new support group (and link an email to it)
    • +
    • Add mods to support groups
    • +
    • Assign ticket to you
    • +
    • Forward ticket to a support group
    • +
    • Add hidden messages to a ticket only viewable by other mods
    • +
    • Browse ticket queues or create one dynamically
    • +
    • Sync changes after the game server is back up after being down for a while
    • +
    • Browse the log of a ticket
    • +
    • Browse additional info sent along when a ticket is created ingame
    • +
    • All the above can be done while ingame too
    • +
    + +
    +
    +
    +
    + + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/ingame_register.phtml b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/ingame_register.phtml new file mode 100644 index 000000000..1f0fc0859 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/ingame_register.phtml @@ -0,0 +1,116 @@ +
    + RYZOM CORE INGAME REGISTRATION +
    + +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + You must accept the Terms of Service';} + else { + echo ' +
    id="caption-Username">Desired Username: + + width="42%">
    id="caption-Password">Desired Password: + + width="42%">
    id="caption-ConfirmPass">Confirm Password: + width="42%">
    id="caption-Email">Email Address (to which a confirmation email will be sent): + account.', this);" /> + width="42%">
    + colspan="2">YES, I agree to the terms of + service';}; ?> +
    + +
    + +
    +
    + +
    + +
    + 5-12 lower-case characters and numbers. The login (username) you create here will be + your login name. The name of your game characters will be chosen later on. +
    + +
    + 5-20 characters. +
    + +
    + Retype your Password +
    + +
    + Please verify that the e-mail address you enter here is valid and will remain valid + in the future. It will be used to manage your account. +
    + +
    \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout.tpl new file mode 100644 index 000000000..f889a43a6 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout.tpl @@ -0,0 +1,2 @@ +{block name=content}{/block} + \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_admin.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_admin.tpl new file mode 100644 index 000000000..881ccb18a --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_admin.tpl @@ -0,0 +1,2 @@ +{extends file="layout.tpl"} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_mod.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_mod.tpl new file mode 100644 index 000000000..c5ed6c10b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_mod.tpl @@ -0,0 +1,3 @@ +{extends file="layout.tpl"} + + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_user.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_user.tpl new file mode 100644 index 000000000..62185e613 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/layout_user.tpl @@ -0,0 +1 @@ +{extends file="layout.tpl"} diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/sgroup_list.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/sgroup_list.tpl new file mode 100644 index 000000000..231250fda --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/sgroup_list.tpl @@ -0,0 +1,105 @@ +{block name=content} + +

    List of all Support Groups

    + + + + + + + + + {if isset($isAdmin) && $isAdmin eq 'TRUE'}{/if} + + + + {foreach from=$grouplist item=group} + + + + + + {if isset($isAdmin) && $isAdmin eq 'TRUE'}{/if} + + {/foreach} + + +
    IDNameTagEmailAction
    {$group.sGroupId}{$group.name}{$group.tag}{$group.groupemail}Delete
    + + {if isset($isAdmin) && $isAdmin eq 'TRUE'} + +

    Add a support group

    + +
    + + + + + + + + + + +
    + + + + + + +
    + + + + + + + + +
    +
    + + + + + + +
    + + + + + + + + +
    +
    + + +
    + + +
    + {if isset($RESULT_OF_ADDING) and $RESULT_OF_ADDING eq "SUCCESS"} + +

    {$group_success}

    +
    + {else if isset($RESULT_OF_ADDING) and $RESULT_OF_ADDING eq "NAME_TAKEN"} + +

    {$group_name_taken}

    +
    + {else if isset($RESULT_OF_ADDING) and $RESULT_OF_ADDING eq "TAG_TAKEN"} + +

    {$group_tag_taken}

    +
    + {else if isset($RESULT_OF_ADDING) and $RESULT_OF_ADDING eq "SIZE_ERROR"} + +

    {$group_size_error}

    +
    + {/if} + + {/if} +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_queue.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_queue.tpl new file mode 100644 index 000000000..2a274f47e --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_queue.tpl @@ -0,0 +1,204 @@ +{block name=content} +

    Ticket Queue {$queue_view}

    + + + + + + + + + + + + + + + + + +
    + + + + + + + + +
    Todo ticketsAll ticketsAll open ticketsTicket ArchiveNot Assigned Tickets
    +
    +
    + + + + + + + +
    + + + + + + + + + + + +
    + Show + + + + tickets + + + + to + + + + + + + + + + +
    +
    + + +
    +
    +
    + {if isset($ACTION_RESULT) and $ACTION_RESULT eq "SUCCESS_ASSIGNED"} + + {$success_assigned} + + {else if isset($ACTION_RESULT) and $ACTION_RESULT eq "SUCCESS_UNASSIGNED"} + + {$success_unassigned} + + {else if isset($ACTION_RESULT) and $ACTION_RESULT eq "TICKET_NOT_EXISTING"} + + {$ticket_not_existing} + + {else if isset($ACTION_RESULT) and $ACTION_RESULT eq "ALREADY_ASSIGNED"} + + {$ticket_already_assigned} + + {else if isset($ACTION_RESULT) and $ACTION_RESULT eq "NOT_ASSIGNED"} + + {$ticket_not_assigned} + + {/if} +
    + + + + + + + + + + + + + + + {foreach from=$tickets item=ticket} + + + + + + + + + + + {/foreach} + + +
    IDTitleAssignedTimestampCategoryStatusSupportGroupActions
    {$ticket.tId}{$ticket.title}{if $ticket.assignedText neq ""} {$ticket.assignedText} {else} {$not_assigned} {/if}{$ticket.timestamp}{$ticket.category} {$ticket.statusText} + + {if $ticket.forwardedGroupName eq "0"} + {$public_sgroup} + {else} + {$ticket.forwardedGroupName} + {/if} + + + {if $ticket.assigned eq 0} +
    + + + +
    + {else if $ticket.assigned eq $user_id} +
    + + + +
    + {/if} +
    + +
    + « | + {foreach from=$links item=link} + {if $link == $currentPage}{/if}{$link}{if $link == $currentPage}{/if} | + {/foreach} + » +
    +
    + + + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_reply.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_reply.tpl new file mode 100644 index 000000000..287d59f8b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_reply.tpl @@ -0,0 +1,24 @@ +{block name=content} +

    Show Reply

    + +

    Reply ID#{$reply_id} of Ticket #{$ticket_id}

    + + + + +
    +

    {$reply_timestamp} + {if $author_permission eq '1'} + {if isset($isMod) and $isMod eq "TRUE"} {$authorName}{else} {$authorName} {/if}

    + {else if $author_permission gt '1'} + {if isset($isMod) and $isMod eq "TRUE"} {$authorName}{else} {$authorName} {/if}

    + {/if} +

    {if $hidden eq 1}{/if}{$reply_content}{if $hidden eq 1}{/if}

    + +
    + + + + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_sgroup.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_sgroup.tpl new file mode 100644 index 000000000..0f1d55d17 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_sgroup.tpl @@ -0,0 +1,118 @@ +{block name=content} + +

    {$groupsname} Members List

    + + + + + + {if isset($isAdmin) && $isAdmin eq 'TRUE'}{/if} + + + + + {foreach from=$userlist item=user} + + + + {if isset($isAdmin) && $isAdmin eq 'TRUE'}{/if} + + {/foreach} + + +
    IDNameAction
    {$user.tUserId}{$user.name} Delete
    + + {if isset($isAdmin) && $isAdmin eq 'TRUE'} +

    Add user to '{$groupsname}'

    + + + + +
    +
    + + + + + +
    +
    + + + + {if isset($RESULT_OF_ADDING) and $RESULT_OF_ADDING eq "SUCCESS"} + +

    {$add_to_group_success}

    +
    + {else if isset($RESULT_OF_ADDING) and $RESULT_OF_ADDING eq "ALREADY_ADDED"} + +

    {$user_already_added}

    +
    + {else if isset($RESULT_OF_ADDING) and $RESULT_OF_ADDING eq "GROUP_NOT_EXISTING"} + +

    {$group_not_existing}

    +
    + {else if isset($RESULT_OF_ADDING) and $RESULT_OF_ADDING eq "USER_NOT_EXISTING"} + +

    {$user_not_existing}

    +
    + {else if isset($RESULT_OF_ADDING) and $RESULT_OF_ADDING eq "NOT_MOD_OR_ADMIN"} + +

    {$not_mod_or_admin}

    +
    + {/if} + + +

    Modify Email Settings

    +
    + + + + + + + + + + + + + +
    + + + + + +
    + + + + + +
    + + + +
    +
    + + {if isset($RESULT_OF_MODIFYING) and $RESULT_OF_MODIFYING eq "SUCCESS"} + + {$modify_mail_of_group_success} + + {else if isset($RESULT_OF_MODIFYING) and $RESULT_OF_MODIFYING eq "EMAIL_NOT_VALID"} + + {$email_not_valid} + + {else if isset($RESULT_OF_MODIFYING) and $RESULT_OF_MODIFYING eq "NO_PASSWORD"} + + {$no_password_given} + + {/if} + + + {/if} + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket.tpl new file mode 100644 index 000000000..5a4963795 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket.tpl @@ -0,0 +1,188 @@ +{block name=content} +

    Title: {$ticket_title} [ID#{$ticket_tId}]

    + + + + {if isset($isMod) and $isMod eq "TRUE"} + + + {/if} + {if isset($isMod) and $isMod eq "TRUE"}{/if} + + + {if $hasInfo}{/if} + + +
    + Ticket Assigning: + {if $ticket_assignedTo eq 0} +
    + + + +
    + {else if $ticket_assignedTo eq $user_id} +
    + + + +
    + {/if} +
    + Forward to Group: +
    + + + + +
    +
    Show Ticket LogSend Other TicketShow ticket Info
    + + + + {if isset($ACTION_RESULT) and $ACTION_RESULT eq "SUCCESS_ASSIGNED"} + +

    {$success_assigned}

    +
    + {else if isset($ACTION_RESULT) and $ACTION_RESULT eq "SUCCESS_UNASSIGNED"} + +

    {$success_unassigned}

    +
    + {else if isset($ACTION_RESULT) and $ACTION_RESULT eq "TICKET_NOT_EXISTING"} + +

    {$ticket_not_existing}

    +
    + {else if isset($ACTION_RESULT) and $ACTION_RESULT eq "ALREADY_ASSIGNED"} + +

    {$ticket_already_assigned}

    +
    + {else if isset($ACTION_RESULT) and $ACTION_RESULT eq "NOT_ASSIGNED"} + +

    {$ticket_not_assigned}

    +
    + {/if} + + {if isset($ACTION_RESULT) and $ACTION_RESULT eq "INVALID_SGROUP"} + +

    {$invalid_sgroup}

    +
    + {else if isset($ACTION_RESULT) and $ACTION_RESULT eq "TICKET_NOT_EXISTING"} + +

    {$ticket_not_existing}

    +
    + {else if isset($ACTION_RESULT) and $ACTION_RESULT eq "SUCCESS_FORWARDED"} + +

    {$success_forwarded}

    +
    + {/if} + +
    + + + + + + + + + + + + + + + + +
    Original Submitted: {$ticket_timestamp}Last Updated: {$ticket_lastupdate}Status: {if $ticket_status neq 3}Open{/if} {$ticket_statustext}
    Category: {$ticket_category}Priority: {$ticket_prioritytext}Support Group: + + {if $ticket_forwardedGroupName eq "0"} + {$public_sgroup} + {else} + {$ticket_forwardedGroupName} + {/if} + +
    Assigned To: {if $ticket_assignedTo neq ""} {$ticket_assignedToText} {else} {$not_assigned} {/if}
    + + + + + {foreach from=$ticket_replies item=reply} + + + + {/foreach} + + {if $ticket_status eq 3} + + + + {/if} + + + + + + + + + + + +
    +

    + {$reply.timestamp} + {if $reply.permission eq '1'} + {if isset($isMod) and $isMod eq "TRUE"} {$reply.author}{else} {$reply.author} {/if} + {else if $reply.permission gt '1'} + {if isset($isMod) and $isMod eq "TRUE"} {$reply.author}{else} {$reply.author} {/if} + {/if} +

    +

    {if $reply.hidden eq 1}{/if}{$reply.replyContent}{if $reply.hidden eq 1}{/if}

    +
    +

    Ticket is closed.

    +
    + + {if $ticket_status neq 3} + {$t_reply}: + + + {if isset($isMod) and $isMod eq "TRUE"} + + Hide reply for user. + {/if} + {/if} +
    + {if isset($isMod) and $isMod eq "TRUE"} +
    + + +
    +
    + + +
    + {/if} +
    + + + + +
    + + + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket_info.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket_info.tpl new file mode 100644 index 000000000..b8100c158 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket_info.tpl @@ -0,0 +1,79 @@ +{block name=content} +

    [#{$ticket_id}] {$ticket_title}

    + +

    Actions

    + + + {if isset($isMod) and $isMod eq "TRUE"}{/if} + + + +
    Show Ticket LogSend Other TicketShow Ticket
    + +

    Additional Info

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Ingame related
    Shard ID: {$shard_id}
    User_Id: {$user_id}
    User Position: {$user_position}
    View Position: {$view_position}
    Client_Version: {$client_version}
    Patch_Version: {$patch_version}
    Server_Tick: {$server_tick}
    Hardware & Software related
    Memory: {$memory}
    Processor: {$processor}
    Cpu_Id: {$cpu_id}
    Cpu_Mask: {$cpu_mask}
    HT: {$ht}
    OS: {$os}
    NeL3D: {$nel3d}
    Network related
    Connect_State: {$connect_state}
    Local_Address: {$local_address}
    + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket_log.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket_log.tpl new file mode 100644 index 000000000..dfd44b11b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_ticket_log.tpl @@ -0,0 +1,26 @@ +{block name=content} + +

    Log of Ticket #{$ticket_id}

    + Title: {$ticket_title} + + + + + + + + + + {foreach from=$ticket_logs item=log} + + + + + + {/foreach} + + +
    IDTimestampQuery
    {$log.tLogId}{$log.timestamp}{$log.query}
    + +{/block} + \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_user.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_user.tpl new file mode 100644 index 000000000..a7b5a95b1 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/show_user.tpl @@ -0,0 +1,93 @@ +{block name=content} + +

    Profile of {$target_name}

    + + + + + + + + + + + + + + +
    Email:{$mail}
    Role: + {if $userPermission eq 1}User{/if} + {if $userPermission eq 2}Moderator{/if} + {if $userPermission eq 3}Admin{/if} +
    + + + +

    Actions

    + + + + + {if isset($isAdmin) and $isAdmin eq 'TRUE' and $target_id neq 1} + {if $userPermission eq 1} + + + {else if $userPermission eq 2 } + + + {else if $userPermission eq 3 } + + + {/if} + + {/if} + +
    + Edit User + + Send Ticket + + Make Moderator + + Make Admin + + Demote to User + + Make Admin + + Demote to User + + Demote to Moderator +
    + + + +

    Tickets of {$target_name}

    + + + + + + + + + + + + {foreach from=$ticketlist item=ticket} + + + + + + + + + {/foreach} + + +
    IDTitleTimestampCategoryStatus
    {$ticket.tId}{$ticket.title}{$ticket.timestamp}{$ticket.category}{$ticket.statusText}
    + + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/userlist.tpl b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/userlist.tpl new file mode 100644 index 000000000..b6eab4abb --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/templates/userlist.tpl @@ -0,0 +1,62 @@ +{block name=content} + + + + + + + + + + + + + {foreach from=$userlist item=element} + + + + + {if $element.permission eq 1}{/if} + {if $element.permission eq 2}{/if} + {if $element.permission eq 3}{/if} + + + {/foreach} + + +
    IdUsernameEmailPermissionAction
    {$element.id}{$element.username}{$element.email}UserModeratorAdmin + + + + {if isset($isAdmin) and $isAdmin eq 'TRUE' and $element.id neq 1} + + {if $element.permission eq 1} + + + {else if $element.permission eq 2 } + + + {else if $element.permission eq 3 } + + + {/if} + {/if} + +
    + Show User + + Edit User + Make ModeratorMake AdminDemote to UserMake AdminDemote to UserDemote to Moderator
    +
    +
    + + « | + {foreach from=$links item=link} + {if $link == $currentPage}{/if}{$link}{if $link == $currentPage}{/if} | + {/foreach} + » + +
    + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/todo.txt b/code/ryzom/tools/server/ryzom_ams/todo.txt new file mode 100644 index 000000000..0611c9503 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/todo.txt @@ -0,0 +1,10 @@ +-Make Permission www dependend, so it can be implemented in drupal with hook_permission(); +-in helpers make_folders mkdir($value); should be drupal_mkdir(); +-fix the callback in add_user_to_sgroup.php and show_sgroup.php in the func dir +-put mycrypt stuff from func/modify_email_of_sgroup in the setPassword itself. +-fix the error paths by making them use the ingame_path & outgame paths too + +module related: +-put the install.php stuff into the module.install file +-add extra data fields that can be changed like the gender, country + diff --git a/code/ryzom/tools/server/ryzom_ams/www/config.php b/code/ryzom/tools/server/ryzom_ams/www/config.default.php similarity index 50% rename from code/ryzom/tools/server/ryzom_ams/www/config.php rename to code/ryzom/tools/server/ryzom_ams/www/config.default.php index 82c010e58..c559b8b2c 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/config.php +++ b/code/ryzom/tools/server/ryzom_ams/www/config.default.php @@ -1,40 +1,37 @@ uId = $UId; } + + /** + * sets the object's attributes. + * @param $values should be an array. + */ public function set($values){ $this->uId = $values['UId']; $this->login = $values['Login']; @@ -22,53 +40,61 @@ class WebUsers extends Users{ $this->lastname = $values['LastName']; $this->gender = $values['Gender']; $this->country = $values['Country']; + $this->receiveMail = $values['ReceiveMail']; + $this->language = $values['Language']; } - /** - * Function checkUserNameExists - * - * @takes $username - * @return string Info: Returns true or false if the user is in the web db. - */ - protected function checkUserNameExists($username){ - $dbw = new DBLayer("web"); - return $dbw->execute("SELECT * FROM ams_user WHERE Login = :name",array('name' => $username))->rowCount(); - } + + /** + * function that checks if a username exists already or not. + * This function overrides the function of the base class. + * @param $username the username in question + * @return string Info: Returns 0 if the user is not in the web db, else a positive number is returned. + */ + protected function checkUserNameExists($username){ + $dbw = new DBLayer("web"); + return $dbw->execute("SELECT * FROM ams_user WHERE Login = :name",array('name' => $username))->rowCount(); + } - /** - * Function checkEmailExists - * - * @takes $username - * @return string Info: Returns true or false if the user is in the www db. - */ - protected function checkEmailExists($email){ - $dbw = new DBLayer("web"); - return $dbw->execute("SELECT * FROM ams_user WHERE Email = :email",array('email' => $email))->rowCount(); - } + /** + * function that checks if a email exists already or not. + * This function overrides the function of the base class. + * @param $email the email address in question. + * @return string Info: Returns 0 if the email address is not in the web db, else a positive number is returned. + */ + protected function checkEmailExists($email){ + $dbw = new DBLayer("web"); + return $dbw->execute("SELECT * FROM ams_user WHERE Email = :email",array('email' => $email))->rowCount(); + } - /** - * Function checkUserPassMatch - * - * @takes $username,$password - * @return string Info: Returns true or false if a login match is found in the web db - */ - public function checkLoginMatch($username,$password){ - $dbw = new DBLayer("web"); - $statement = $dbw->execute("SELECT * FROM ams_user WHERE Login=:user", array('user' => $username)); - $row = $statement->fetch(); - - $salt = substr($row['Password'],0,2); - $hashed_input_pass = crypt($password, $salt); - if($hashed_input_pass == $row['Password']){ - return $row; - }else{ - return "fail"; - } - } + /** + * check if the login username and password match the db. + * @param $username the inserted username + * @param $password the inserted password (unhashed) + * @return the logged in user's db row as array if login was a success, else "fail" will be returned. + */ + public function checkLoginMatch($username,$password){ + + $dbw = new DBLayer("web"); + $statement = $dbw->execute("SELECT * FROM ams_user WHERE Login=:user", array('user' => $username)); + $row = $statement->fetch(); + $salt = substr($row['Password'],0,2); + $hashed_input_pass = crypt($password, $salt); + if($hashed_input_pass == $row['Password']){ + return $row; + }else{ + return "fail"; + } + } - //returns te id for a given username + + /** + * returns te id for a given username + * @param $username the username + * @return the user's id linked to the username + */ public static function getId($username){ $dbw = new DBLayer("web"); $statement = $dbw->execute("SELECT * FROM ams_user WHERE Login=:username", array('username' => $username)); @@ -76,93 +102,257 @@ class WebUsers extends Users{ return $row['UId']; } - //returns te id for a given username + + /** + * returns te id for a given emailaddress + * @param $email the emailaddress + * @return the user's id linked to the emailaddress + */ public static function getIdFromEmail($email){ $dbw = new DBLayer("web"); $statement = $dbw->execute("SELECT * FROM ams_user WHERE Email=:email", array('email' => $email)); $row = $statement->fetch(); - return $row['UId']; + if(!empty($row)){ + return $row['UId']; + }else{ + return "FALSE"; + } } + + /** + * get uId attribute of the object. + */ public function getUId(){ return $this->uId; } - public function getUsername(){ - $dbw = new DBLayer("web"); - if(! isset($this->login) || $this->login == ""){ - $statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId)); - $row = $statement->fetch(); - $this->set($row); - } - return $this->login; - } - public function getEmail(){ - $dbw = new DBLayer("web"); - if(! isset($this->email) || $this->email == ""){ + /** + * get login attribute of the object.(username) + */ + public function getUsername(){ + $dbw = new DBLayer("web"); + if(! isset($this->login) || $this->login == ""){ + $statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId)); + $row = $statement->fetch(); + $this->set($row); + } + return $this->login; + } + + + /** + * get email attribute of the object. + */ + public function getEmail(){ + $dbw = new DBLayer("web"); + if(! isset($this->email) || $this->email == ""){ + $statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId)); + $row = $statement->fetch(); + $this->set($row); + } + return $this->email; + } + + /** + * get the hashed password + */ + public function getHashedPass(){ + $dbw = new DBLayer("web"); $statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId)); $row = $statement->fetch(); - $this->set($row); + return $row['Password']; } - return $this->email; - } - public function getInfo(){ - $dbw = new DBLayer("web"); - if(! (isset($this->firstname) && isset($this->lastname) && isset($this->gender) && isset($this->country) ) || - $this->firstname == "" || $this->lastname == "" || $this->gender == "" || $this->country == ""){ - $statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId)); - $row = $statement->fetch(); - $this->set($row); + + /** + * get basic info of the object. + * @return returns an array in the form of Array('FirstName' => $this->firstname, 'LastName' => $this->lastname, 'Gender' => $this->gender, 'Country' => $this->country, 'ReceiveMail' => $this->receiveMail) + */ + public function getInfo(){ + $dbw = new DBLayer("web"); + if(! (isset($this->firstname) && isset($this->lastname) && isset($this->gender) && isset($this->country) && isset($this->receiveMail) ) || + $this->firstname == "" || $this->lastname == "" || $this->gender == "" || $this->country == "" || $this->receiveMail == ""){ + $statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId)); + $row = $statement->fetch(); + $this->set($row); + } + $result = Array('FirstName' => $this->firstname, 'LastName' => $this->lastname, 'Gender' => $this->gender, 'Country' => $this->country, 'ReceiveMail' => $this->receiveMail); + return $result; } - $result = Array('FirstName' => $this->firstname, 'LastName' => $this->lastname, 'Gender' => $this->gender, 'Country' => $this->country); - return $result; - } - public function isLoggedIn(){ - if(isset($_SESSION['user'])){ - return true; - } - return false; - } - public function setPassword($user, $pass){ - $reply = WebUsers::setAmsPassword($user, $pass); - $values = Array('user' => $user, 'pass' => $pass); - try { - //make connection with and put into shard db - $dbw = new DBLayer("web"); - $dbw->execute("UPDATE ams_user SET Password = :pass WHERE Login = :user ",$values); + /** + * get receiveMail attribute of the object. + */ + public function getReceiveMail(){ + $dbw = new DBLayer("web"); + if(! isset($this->receiveMail) || $this->receiveMail == ""){ + $statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId)); + $row = $statement->fetch(); + $this->set($row); + } + return $this->receiveMail; + } + + + /** + * get language attribute of the object. + */ + public function getLanguage(){ + $dbw = new DBLayer("web"); + if(! isset($this->language) || $this->language == ""){ + $statement = $dbw->execute("SELECT * FROM ams_user WHERE UId=:id", array('id' => $this->uId)); + $row = $statement->fetch(); + $this->set($row); + } + return $this->language; + } + + + /** + * check if the user is logged in. + * @return true or false + */ + public function isLoggedIn(){ + if(isset($_SESSION['user'])){ + return true; + } + return false; + } + + + /** + * update the password. + * update the password in the shard + update the password in the www/CMS version. + * @param $user the username + * @param $pass the new password. + * @return ok if it worked, if the lib or shard is offline it will return liboffline or shardoffline. + */ + public function setPassword($user, $pass){ + + $hashpass = crypt($pass, WebUsers::generateSALT()); + $reply = WebUsers::setAmsPassword($user, $hashpass); + $values = Array('user' => $user, 'pass' => $hashpass); + try { + //make connection with and put into shard db + $dbw = new DBLayer("web"); + $dbw->execute("UPDATE ams_user SET Password = :pass WHERE Login = :user ",$values); + } + catch (PDOException $e) { + //ERROR: the web DB is offline + } + return $reply; + } + + + /** + * update the emailaddress. + * update the emailaddress in the shard + update the emailaddress in the www/CMS version. + * @param $user the username + * @param $mail the new emailaddress. + * @return ok if it worked, if the lib or shard is offline it will return liboffline or shardoffline. + */ + public function setEmail($user, $mail){ + $reply = WebUsers::setAmsEmail($user, $mail); + $values = Array('user' => $user, 'mail' => $mail); + try { + //make connection with and put into shard db + $dbw = new DBLayer("web"); + $dbw->execute("UPDATE ams_user SET Email = :mail WHERE Login = :user ",$values); + } + catch (PDOException $e) { + //ERROR: the web DB is offline + } + return $reply; + } + + + /** + * update the setReceiveMail value in the db. + * update the receiveMail in the www/CMS version. + * @param $user the username + * @param $receivemail the receivemail setting . + */ + public static function setReceiveMail($user, $receivemail){ + $values = Array('user' => $user, 'receivemail' => $receivemail); + try { + //make connection with and put into shard db + $dbw = new DBLayer("web"); + $dbw->execute("UPDATE ams_user SET ReceiveMail = :receivemail WHERE UId = :user ",$values); + } + catch (PDOException $e) { + //ERROR: the web DB is offline + } + } + + + /** + * update the language value in the db. + * update the language in the www/CMS version. + * @param $user the username + * @param $language the new language value. + */ + public static function setLanguage($user, $language){ + $values = Array('user' => $user, 'language' => $language); + try { + //make connection with and put into shard db + $dbw = new DBLayer("web"); + $dbw->execute("UPDATE ams_user SET Language = :language WHERE UId = :user ",$values); + } + catch (PDOException $e) { + //ERROR: the web DB is offline + } + } + + + /** + * return all users. + * @return return an array of users + */ + public function getUsers(){ + $dbl = new DBLayer("web"); + $data = $dbl->executeWithoutParams("SELECT * FROM ams_user"); + return $data; + } + + + /** + * return the query that should get all users. + * @return string: the query to receive all users. + */ + public static function getAllUsersQuery(){ + return "SELECT * FROM ams_user"; + } + + + /** + * creates a webuser. + * it will set the language matching to the language cookie setting and add it to the www/CMS's DB. + * @param $name the username + * @param $pass the unhashed password + * @param $mail the email address + */ + public static function createWebuser($name, $pass, $mail){ + + //register account with the correct language (check if cookie is already set)! + if ( isset( $_COOKIE['Language'] ) ) { + $lang = $_COOKIE['Language']; + }else{ + global $DEFAULT_LANGUAGE; + $lang = $DEFAULT_LANGUAGE; + } + + $values = Array('name' => $name, 'pass' => $pass, 'mail' => $mail, 'lang' => $lang); + + try { + $dbw = new DBLayer("web"); + return $dbw->executeReturnId("INSERT INTO ams_user (Login, Password, Email, Language) VALUES (:name, :pass, :mail, :lang)",$values); } catch (PDOException $e) { - //ERROR: the web DB is offline + //ERROR: the web DB is offline } - return $reply; - } - - public function setEmail($user, $mail){ - $reply = WebUsers::setAmsEmail($user, $mail); - $values = Array('user' => $user, 'mail' => $mail); - try { - //make connection with and put into shard db - $dbw = new DBLayer("web"); - $dbw->execute("UPDATE ams_user SET Email = :mail WHERE Login = :user ",$values); - } - catch (PDOException $e) { - //ERROR: the web DB is offline - } - return $reply; - } - - public function getUsers(){ - $dbl = new DBLayer("web"); - $data = $dbl->executeWithoutParams("SELECT * FROM ams_user"); - return $data; - } - - public static function getAllUsersQuery(){ - return "SELECT * FROM ams_user"; - } + } } \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/blank.php b/code/ryzom/tools/server/ryzom_ams/www/html/blank.php deleted file mode 100644 index e6d4b3268..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/blank.php +++ /dev/null @@ -1,33 +0,0 @@ - - - -
    - -
    - -
    -
    -
    -

    Blank

    -
    - - - -
    -
    -
    - -
    -
    - -
    - - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/calendar.php b/code/ryzom/tools/server/ryzom_ams/www/html/calendar.php deleted file mode 100644 index 83f714dfe..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/calendar.php +++ /dev/null @@ -1,45 +0,0 @@ - - -
    - -
    - -
    -
    -
    -

    Calendar

    -
    - - - -
    -
    -
    -
    -

    Draggable Events

    -
    Default
    -
    Completed
    -
    Warning
    -
    Important
    -
    Info
    -
    Other
    -

    - -

    -
    - -
    - -
    -
    -
    -
    - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/chart.php b/code/ryzom/tools/server/ryzom_ams/www/html/chart.php deleted file mode 100644 index 10cd049ed..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/chart.php +++ /dev/null @@ -1,120 +0,0 @@ - - - -
    - -
    - -
    - -
    -
    -

    Chart with points

    -
    - - - -
    -
    -
    -
    -

    Mouse position at (0, 0).

    -
    -
    - -
    -
    -

    Flot

    -
    - - - -
    -
    -
    -
    -
    -
    - -
    -
    -

    Stack Example

    -
    - - - -
    -
    -
    -
    - -

    - - -

    - -

    - - - -

    -
    -
    - -
    - -
    -
    -
    -

    Pie

    -
    - - - -
    -
    -
    -
    -
    -
    - -
    -
    -

    Realtime

    -
    - - - -
    -
    -
    -
    -

    You can update a chart periodically to get a real-time effect by using a timer to insert the new data in the plot and redraw it.

    -

    Time between updates: milliseconds

    -
    -
    - -
    -
    -

    Donut

    -
    - - - -
    -
    -
    -
    -
    -
    -
    -
    - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/error.php b/code/ryzom/tools/server/ryzom_ams/www/html/error.php deleted file mode 100644 index b84bd7de7..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/error.php +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - Error - - - -

    - 404 -

    -

    Not
    Found

    -
    -
    - The page your are looking for is not found. -
    Go Home -
    - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/file-manager.php b/code/ryzom/tools/server/ryzom_ams/www/html/file-manager.php deleted file mode 100644 index 251b42847..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/file-manager.php +++ /dev/null @@ -1,36 +0,0 @@ - - -
    - -
    - -
    -
    -
    -

    File Manager

    -
    - - - -
    -
    -
    -
    - - As its a demo, you currently have read-only permission, in your server you may do everything like, upload or delete. It will work on a server only. -
    -
    -
    -
    - -
    - - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/footer.php b/code/ryzom/tools/server/ryzom_ams/www/html/footer.php deleted file mode 100644 index e7053a9c6..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/footer.php +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/form.php b/code/ryzom/tools/server/ryzom_ams/www/html/form.php deleted file mode 100644 index fce48a142..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/form.php +++ /dev/null @@ -1,333 +0,0 @@ - - - -
    - -
    - -
    -
    -
    -

    Form Elements

    -
    - - - -
    -
    -
    -
    -
    - Datepicker, Autocomplete, WYSIWYG -
    - -
    - -

    Start typing to activate auto complete!

    -
    -
    -
    - -
    - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - - -
    -
    -
    - -
    -
    - -
    - - -
    -
    -
    -

    Form Elements

    -
    - - - -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - Some value here -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - Something may have gone wrong -
    -
    -
    - -
    - - Please correct the error -
    -
    -
    - -
    - - Woohoo! -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - - -
    -
    -
    - -
    -
    - -
    - -
    -
    -
    -

    Form Elements

    -
    - - - -
    -
    -
    -
    -
    -
    - -
    -
    - @ -
    -

    Here's some help text

    -
    -
    -
    - -
    -
    - .00 -
    - Here's more help text -
    -
    -
    - -
    -
    - $.00 -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    - -
    -
    -
    - - -
    -
    -
    -
    -
    - -
    - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/add_sgroup.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/add_sgroup.php index 9fc59d917..14a9b9f87 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/func/add_sgroup.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/add_sgroup.php @@ -1,22 +1,40 @@ getPermission(); - $result['no_visible_elements'] = 'FALSE'; - $result['username'] = $_SESSION['user']; - global $SITEBASE; - require_once($SITEBASE . 'inc/sgroup_list.php'); - $result= array_merge($result, sgroup_list()); - helpers :: loadtemplate( 'sgroup_list', $result); + //create a new support group + $result['RESULT_OF_ADDING'] = Support_Group::createSupportGroup($name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password); + //$result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); + //$result['no_visible_elements'] = 'FALSE'; + //$result['username'] = $_SESSION['user']; + //global $SITEBASE; + //require($SITEBASE . '/inc/sgroup_list.php'); + //$result= array_merge($result, sgroup_list()); + //return helpers :: loadtemplate( 'sgroup_list', $result, true); + if (Helpers::check_if_game_client()) { + header("Location: ".$INGAME_WEBPATH."?page=sgroup_list"); + }else{ + header("Location: ".$WEBPATH."?page=sgroup_list"); + } exit; }else{ @@ -31,4 +49,4 @@ function add_sgroup(){ exit; } -} \ No newline at end of file +} diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user.php index 7e81b2751..aad237ae7 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user.php @@ -1,9 +1,18 @@ $_POST["Username"], 'Password' => $_POST["Password"], 'ConfirmPass' => $_POST["ConfirmPass"], 'Email' => $_POST["Email"]); $webUser = new WebUsers(); + + //check if the POST variables are valid, before actual registering $result = $webUser->check_Register($params); // if all are good then create user @@ -18,23 +27,30 @@ function add_user(){ 'access' => $_SERVER['REQUEST_TIME'] ); $status = write_user( $edit ); + if(Helpers::check_if_game_client()){ + //if registering ingame then we have to set the header and dont need to reload the template. + header('Location: email_sent.php'); + exit; + } $pageElements['status'] = $status; $pageElements['no_visible_elements'] = 'TRUE'; + $pageElements['ingame_webpath'] = $INGAME_WEBPATH; helpers :: loadtemplate( 'register_feedback', $pageElements); exit; }else{ - // pass error + // pass error and reload template accordingly $result['prevUsername'] = $_POST["Username"]; $result['prevPassword'] = $_POST["Password"]; $result['prevConfirmPass'] = $_POST["ConfirmPass"]; $result['prevEmail'] = $_POST["Email"]; $result['no_visible_elements'] = 'TRUE'; + $pageElements['ingame_webpath'] = $INGAME_WEBPATH; helpers :: loadtemplate( 'register', $result); exit; } } - +//use the valid userdata to create the new user. function write_user($newUser){ //create salt here, because we want it to be the same on the web/server @@ -47,13 +63,13 @@ function write_user($newUser){ ); try{ - //make connection with web db and put it in there - $dbw = new DBLayer("web"); - $user_id = $dbw->executeReturnId("INSERT INTO ams_user (Login, Password, Email) VALUES (:name, :pass, :mail)",$params); + //make new webuser + $user_id = WebUsers::createWebuser($params['name'], $params['pass'], $params['mail']); //Create the user on the shard + in case shard is offline put copy of query in query db //returns: ok, shardoffline or liboffline $result = WebUsers::createUser($params, $user_id); + Users::createPermissions(array($newUser["name"])); }catch (PDOException $e) { diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user_to_sgroup.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user_to_sgroup.php index 3eb79b928..fe225a8f2 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user_to_sgroup.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/add_user_to_sgroup.php @@ -1,30 +1,45 @@ getPermission()>1){ + //add it to the support group $result['RESULT_OF_ADDING'] = Support_Group::addUserToSupportGroup($user_id, $id); }else{ + //return error message. $result['RESULT_OF_ADDING'] = "NOT_MOD_OR_ADMIN"; } }else{ $result['RESULT_OF_ADDING'] = "USER_NOT_EXISTING"; } - $result['permission'] = $_SESSION['ticket_user']->getPermission(); - $result['no_visible_elements'] = 'FALSE'; - $result['username'] = $_SESSION['user']; - global $SITEBASE; - require_once($SITEBASE . 'inc/show_sgroup.php'); - $result= array_merge($result, show_sgroup()); - helpers :: loadtemplate( 'show_sgroup', $result); + //$result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); + //$result['no_visible_elements'] = 'FALSE'; + //$result['username'] = $_SESSION['user']; + //global $SITEBASE; + //require_once($SITEBASE . 'inc/show_sgroup.php'); + //$result= array_merge($result, show_sgroup()); + //helpers :: loadtemplate( 'show_sgroup', $result); + if (Helpers::check_if_game_client()) { + header("Location: ".$INGAME_WEBPATH."?page=show_sgroup&id=".$id); + }else{ + header("Location: ".$WEBPATH."?page=show_sgroup&id=".$id); + } exit; }else{ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/change_info.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/change_info.php index 311935e9c..7e65c4d09 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/func/change_info.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/change_info.php @@ -1,5 +1,11 @@ getUsername(); } @@ -20,8 +28,7 @@ function change_info(){ $webUser = new WebUsers($_POST['target_id']); //use current info to check for changes $current_info = $webUser->getInfo(); - - + $current_info['FirstName'] = filter_var($current_info['FirstName'], FILTER_SANITIZE_STRING); $current_info['LastName'] = filter_var($current_info['LastName'], FILTER_SANITIZE_STRING); $current_info['Country'] = filter_var($current_info['Country'], FILTER_SANITIZE_STRING); @@ -76,16 +83,19 @@ function change_info(){ $dbw->execute($query,$values); } + //reload the settings inc function before recalling the settings template. global $SITEBASE; - require_once($SITEBASE . 'inc/settings.php'); + require_once($SITEBASE . '/inc/settings.php'); $result = settings(); if($updated){ $result['info_updated'] = "OK"; } - $result['permission'] = $_SESSION['ticket_user']->getPermission(); + $result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); $result['username'] = $_SESSION['user']; $result['no_visible_elements'] = 'FALSE'; $result['target_id'] = $_POST['target_id']; + global $INGAME_WEBPATH; + $result['ingame_webpath'] = $INGAME_WEBPATH; helpers :: loadtemplate( 'settings', $result); exit; @@ -112,4 +122,4 @@ function change_info(){ print_r($e); exit; } -} \ No newline at end of file +} diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/change_mail.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/change_mail.php index ac24fa5b0..095e545ac 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/func/change_mail.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/change_mail.php @@ -1,5 +1,11 @@ getUsername(); } $webUser = new WebUsers($_POST['target_id']); + //check if emailaddress is valid. $reply = $webUser->checkEmail($_POST['NewEmail']); global $SITEBASE; - require_once($SITEBASE . 'inc/settings.php'); + require_once($SITEBASE . '/inc/settings.php'); $result = settings(); if ( $reply != "success" ){ @@ -32,18 +41,19 @@ function change_mail(){ $result['prevNewEmail'] = filter_var($_POST["NewEmail"], FILTER_SANITIZE_EMAIL); if ($reply== "success"){ + //if validation was successful, update the emailaddress $status = WebUsers::setEmail($target_username, filter_var($_POST["NewEmail"], FILTER_SANITIZE_EMAIL) ); if($status == 'ok'){ $result['SUCCESS_MAIL'] = "OK"; }else if($status == 'shardoffline'){ $result['SUCCESS_MAIL'] = "SHARDOFF"; } - $result['permission'] = $_SESSION['ticket_user']->getPermission(); + $result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); $result['no_visible_elements'] = 'FALSE'; $result['username'] = $_SESSION['user']; $result['target_id'] = $_POST['target_id']; if(isset($_GET['id'])){ - if(Ticket_User::isMod($_SESSION['ticket_user']) && ($_POST['target_id'] != $_SESSION['id'])){ + if(Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) && ($_POST['target_id'] != $_SESSION['id'])){ $result['isMod'] = "TRUE"; } } @@ -52,12 +62,12 @@ function change_mail(){ }else{ $result['EMAIL'] = $reply; - $result['permission'] = $_SESSION['ticket_user']->getPermission(); + $result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); $result['no_visible_elements'] = 'FALSE'; $result['username'] = $_SESSION['user']; $result['target_id'] = $_POST['target_id']; if(isset($_GET['id'])){ - if(Ticket_User::isMod($_SESSION['ticket_user']) && ($_POST['target_id'] != $_SESSION['id'])){ + if(Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) && ($_POST['target_id'] != $_SESSION['id'])){ $result['isMod'] = "TRUE"; } } diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/change_password.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/change_password.php index b3971202d..51907a635 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/func/change_password.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/change_password.php @@ -1,5 +1,11 @@ getUsername(); //isAdmin is true when it's the admin, but the target_id != own id @@ -26,16 +34,15 @@ function change_password(){ if ($result == "success"){ //edit stuff into db global $SITEBASE; - require_once($SITEBASE . 'inc/settings.php'); + require_once($SITEBASE . '/inc/settings.php'); $succresult = settings(); - $hashpass = crypt($_POST["NewPass"], WebUsers::generateSALT()); - $status = WebUsers::setPassword($target_username, $hashpass); + $status = WebUsers::setPassword($target_username, $_POST["NewPass"]); if($status == 'ok'){ $succresult['SUCCESS_PASS'] = "OK"; }else if($status == 'shardoffline'){ $succresult['SUCCESS_PASS'] = "SHARDOFF"; } - $succresult['permission'] = $_SESSION['ticket_user']->getPermission(); + $succresult['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); $succresult['no_visible_elements'] = 'FALSE'; $succresult['username'] = $_SESSION['user']; $succresult['target_id'] = $_POST['target_id']; @@ -47,13 +54,13 @@ function change_password(){ $result['prevCurrentPass'] = filter_var($_POST["CurrentPass"], FILTER_SANITIZE_STRING); $result['prevNewPass'] = filter_var($_POST["NewPass"], FILTER_SANITIZE_STRING); $result['prevConfirmNewPass'] = filter_var($_POST["ConfirmNewPass"], FILTER_SANITIZE_STRING); - $result['permission'] = $_SESSION['ticket_user']->getPermission(); + $result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); $result['no_visible_elements'] = 'FALSE'; $result['username'] = $_SESSION['user']; $result['target_id'] = $_POST['target_id']; global $SITEBASE; - require_once($SITEBASE . 'inc/settings.php'); + require_once($SITEBASE . '/inc/settings.php'); $settings = settings(); $result = array_merge($result,$settings); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/change_receivemail.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/change_receivemail.php new file mode 100644 index 000000000..2c3fdc9b6 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/change_receivemail.php @@ -0,0 +1,59 @@ +getTUserId(); + //if the ticket is being made for the executing user himself + $author = unserialize($_SESSION['ticket_user'])->getTUserId(); }else{ + //if a mod tries to make a ticket for someone else $author= Ticket_User::constr_ExternId($_POST['target_id'])->getTUserId(); } - $ticket_id = Ticket::create_Ticket($title, $content, $category, $author, $_SESSION['ticket_user']->getTUserId()); - header("Location: index.php?page=show_ticket&id=".$ticket_id); + //create the ticket & return the id of the newly created ticket. + $ticket_id = Ticket::create_Ticket($title, $content, $category, $author, unserialize($_SESSION['ticket_user'])->getTUserId(),0, $_POST); + //redirect to the new ticket. + if (Helpers::check_if_game_client()) { + header("Location: ".$INGAME_WEBPATH."?page=show_ticket&id=".$ticket_id); + }else{ + header("Location: ".$WEBPATH."?page=show_ticket&id=".$ticket_id); + } exit; }catch (PDOException $e) { diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/forgot_password.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/forgot_password.php new file mode 100644 index 000000000..3ec14667b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/forgot_password.php @@ -0,0 +1,50 @@ +getUsername(); + $target_hashedPass = $webUser->getHashedPass(); + $hashed_key = hash('sha512',$target_hashedPass); + + if ( isset( $_COOKIE['Language'] ) ) { + $lang = $_COOKIE['Language']; + }else{ + global $DEFAULT_LANGUAGE; + $lang = $DEFAULT_LANGUAGE; + } + + global $AMS_TRANS; + $variables = parse_ini_file( $AMS_TRANS . '/' . $lang . '.ini', true ); + $mailText = array(); + foreach ( $variables['email'] as $key => $value ){ + $mailText[$key] = $value; + } + + //create the reset url + global $WEBPATH; + $resetURL = $WEBPATH . "?page=reset_password&user=". $target_username . "&email=" . $email . "&key=" . $hashed_key; + //set email stuff + $recipient = $email; + $subject = $mailText['email_subject_forgot_password']; + $body = $mailText['email_body_forgot_password_header'] . $resetURL . $mailText['email_body_forgot_password_footer']; + Mail_Handler::send_mail($recipient, $subject, $body, NULL); + $result['EMAIL_SUCCESS'] = 'TRUE'; + $result['prevEmail'] = $email; + $result['no_visible_elements'] = 'TRUE'; + helpers :: loadtemplate( 'forgot_password', $result); + exit; + + +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/login.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/login.php index 49ef2a435..b0b6b5add 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/func/login.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/login.php @@ -1,19 +1,42 @@ getLanguage(); + $GETString = ""; + foreach($_GET as $key => $value){ + $GETString = $GETString . $key . '=' . $value . "&"; + } + if($GETString != ""){ + $GETString = '?'.$GETString; + } + + //go back to the index page. - header( 'Location: index.php' ); + if (Helpers::check_if_game_client()) { + header( 'Location: '. $INGAME_WEBPATH . $GETString); + }else{ + header( 'Location: '. $WEBPATH . $GETString); + } exit; }else{ //handle login failure diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/modify_email_of_sgroup.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/modify_email_of_sgroup.php new file mode 100644 index 000000000..b90d4cca6 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/modify_email_of_sgroup.php @@ -0,0 +1,66 @@ +setGroupEmail($groupemail); + $group->setIMAP_MailServer(filter_var($_POST['IMAP_MailServer'],FILTER_SANITIZE_STRING)); + $group->setIMAP_Username(filter_var($_POST['IMAP_Username'],FILTER_SANITIZE_STRING)); + + //encrypt password! + global $cfg; + $crypter = new MyCrypt($cfg['crypt']); + $enc_password = $crypter->encrypt($password); + $group->setIMAP_Password($enc_password); + $group->update(); + $result['RESULT_OF_MODIFYING'] = "SUCCESS"; + if($password == ""){ + $result['RESULT_OF_MODIFYING'] = "NO_PASSWORD"; + } + }else{ + $result['RESULT_OF_MODIFYING'] = "EMAIL_NOT_VALID"; + } + + $result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); + $result['no_visible_elements'] = 'FALSE'; + $result['username'] = $_SESSION['user']; + //global $SITEBASE; + //require_once($SITEBASE . 'inc/show_sgroup.php'); + //$result= array_merge($result, show_sgroup()); + //helpers :: loadtemplate( 'show_sgroup', $result); + if (Helpers::check_if_game_client()) { + header("Location: ".$INGAME_WEBPATH."?page=show_sgroup&id=".$sgroupid); + }else{ + header("Location: ".$WEBPATH."?page=show_sgroup&id=".$sgroupid); + } + exit; + + }else{ + //ERROR: No access! + $_SESSION['error_code'] = "403"; + header("Location: index.php?page=error"); + exit; + } + }else{ + //ERROR: not logged in! + header("Location: index.php"); + exit; + } + +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php index 76f8ee71e..1e0a4e0ba 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php @@ -1,32 +1,51 @@ load_With_TId($ticket_id); - - if(($target_ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || Ticket_User::isMod($_SESSION['ticket_user']) ){ + + //check if the user who executed this function is a mod/admin or the topic creator himself. + if(($target_ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId()) || Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) ){ try{ - $author = $_SESSION['ticket_user']->getTUserId(); - - $content = $_POST['Content']; + $author = unserialize($_SESSION['ticket_user'])->getTUserId(); + if(isset($_POST['Content'])){ + $content = $_POST['Content']; + }else{ + $content=""; + } $hidden = 0; - if(isset($_POST['hidden']) && Ticket_User::isMod($_SESSION['ticket_user'])){ + + if(isset($_POST['hidden']) && Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){ $hidden = 1; } + + //create the reply Ticket::createReply($content, $author, $ticket_id, $hidden); - if(isset($_POST['ChangeStatus']) && isset($_POST['ChangePriority']) && Ticket_User::isMod($_SESSION['ticket_user'])){ + //try to update the status & priority in case these are set. + if(isset($_POST['ChangeStatus']) && isset($_POST['ChangePriority']) && Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){ $newStatus = filter_var($_POST['ChangeStatus'], FILTER_SANITIZE_NUMBER_INT); $newPriority = filter_var($_POST['ChangePriority'], FILTER_SANITIZE_NUMBER_INT); Ticket::updateTicketStatusAndPriority($ticket_id,$newStatus, $newPriority, $author); } - header("Location: index.php?page=show_ticket&id=".$ticket_id); + if (Helpers::check_if_game_client()) { + header("Location: ".$INGAME_WEBPATH."?page=show_ticket&id=".$ticket_id); + }else{ + header("Location: ".$WEBPATH."?page=show_ticket&id=".$ticket_id); + } exit; }catch (PDOException $e) { diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/func/reset_password.php b/code/ryzom/tools/server/ryzom_ams/www/html/func/reset_password.php new file mode 100644 index 000000000..c665b72a4 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/func/reset_password.php @@ -0,0 +1,44 @@ +getHashedPass()) == $key) ){ + $params = Array( 'user' => $user, 'CurrentPass' => "dummy", 'NewPass' => $password, 'ConfirmNewPass' => $confirmpass, 'adminChangesOther' => true); + $result = $webUser->check_change_password($params); + if ($result == "success"){ + $result = array(); + $status = WebUsers::setPassword($user, $password); + if($status == 'ok'){ + $result['SUCCESS_PASS'] = "OK"; + }else if($status == 'shardoffline'){ + $result['SUCCESS_PASS'] = "SHARDOFF"; + } + $result['no_visible_elements'] = 'TRUE'; + helpers :: loadtemplate( 'reset_success', $result); + exit; + } + $GETString = ""; + foreach($_GET as $key => $value){ + $GETString = $GETString . $key . '=' . $value . "&"; + } + if($GETString != ""){ + $GETString = '?'.$GETString; + } + $result['getstring'] = $GETString; + $result['prevNewPass'] = $password; + $result['prevConfirmNewPass'] = $confirmpass; + $result['no_visible_elements'] = 'TRUE'; + helpers :: loadtemplate( 'reset_password', $result); + exit; + + } +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/gallery.php b/code/ryzom/tools/server/ryzom_ams/www/html/gallery.php deleted file mode 100644 index a822e00ab..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/gallery.php +++ /dev/null @@ -1,41 +0,0 @@ - - -
    - -
    - -
    -
    -
    -

    Gallery

    -
    - - - -
    -
    -
    -

    - -

    -
    - -
    -
    - -
    - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/grid.php b/code/ryzom/tools/server/ryzom_ams/www/html/grid.php deleted file mode 100644 index cd278aa3d..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/grid.php +++ /dev/null @@ -1,240 +0,0 @@ - - - -
    - -
    - -
    -
    -
    -

    Grid 12

    -
    - - - -
    -
    -
    -
    -
    span 4
    -
    span 4
    -
    span 4
    -
    -
    -
    -
    - -
    -
    -
    -

    Grid 3

    -
    - -
    -
    -
    -
    -
    span 4
    -
    span 4
    -
    span 4
    -
    -
    -
    -
    -
    -

    Grid 3

    -
    - -
    -
    -
    -
    -
    span 4
    -
    span 4
    -
    span 4
    -
    -
    -
    -
    -
    -

    Grid 3

    -
    - -
    -
    -
    -
    -
    span 4
    -
    span 4
    -
    span 4
    -
    -
    -
    -
    -
    -

    Plain

    -
    -
    -
    -
    span 4
    -
    span 4
    -
    span 4
    -
    -
    -
    -
    - -
    -
    -
    -

    Grid 6

    -
    - - - -
    -
    -
    -
    -
    span 4
    -
    span 4
    -
    span 4
    -
    -
    -
    - -
    -
    -

    Grid 6

    -
    - - - -
    -
    -
    -
    -
    span 4
    -
    span 4
    -
    span 4
    -
    -
    -
    -
    -
    -
    -
    -

    Grid 4

    -
    - - - -
    -
    -
    -
    -
    span 4
    -
    span 4
    -
    span 4
    -
    -
    -
    - -
    -
    -

    Grid 4

    -
    - - - -
    -
    -
    -
    -
    span 4
    -
    span 4
    -
    span 4
    -
    -
    -
    - -
    -
    -

    Grid 4

    -
    - - - -
    -
    -
    -
    -
    span 4
    -
    span 4
    -
    span 4
    -
    -
    -
    -
    - -
    -
    -
    -

    Box less area

    -

    The flat boxes can be created using grids. But you can also use grids inside grids, which makes the layout 100% flexible!

    -
    -
    -
    - -
    -
    1
    -
    1
    -
    1
    -
    1
    -
    1
    -
    1
    -
    1
    -
    1
    -
    1
    -
    1
    -
    1
    -
    1
    -
    - -
    -
    4
    -
    4
    -
    4
    -
    - -
    -
    3
    -
    3
    -
    3
    -
    3
    -
    - -
    -
    4
    -
    8
    -
    - -
    -
    6
    -
    6
    -
    - -
    -
    12
    -
    - - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/header.php b/code/ryzom/tools/server/ryzom_ams/www/html/header.php deleted file mode 100644 index c3af26217..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/header.php +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - Free HTML5 Bootstrap Admin Template - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - - - - - -
    - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/icon.php b/code/ryzom/tools/server/ryzom_ams/www/html/icon.php deleted file mode 100644 index 071b4252d..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/icon.php +++ /dev/null @@ -1,355 +0,0 @@ - - - -
    - -
    - -
    -
    -
    -

    Icons

    -
    - - - -
    -
    -
    -
    - -
    -
    -
      -
    • icon-glass
    • -
    • icon-music
    • -
    • icon-search
    • -
    • icon-envelope
    • -
    • icon-heart
    • -
    • icon-star
    • -
    • icon-star-empty
    • -
    • icon-user
    • -
    • icon-film
    • -
    • icon-th-large
    • -
    • icon-th
    • -
    • icon-th-list
    • -
    • icon-ok
    • -
    • icon-remove
    • -
    • icon-zoom-in
    • -
    • icon-zoom-out
    • -
    • icon-off
    • -
    • icon-signal
    • -
    • icon-cog
    • -
    • icon-trash
    • -
    • icon-home
    • -
    • icon-file
    • -
    • icon-time
    • -
    • icon-road
    • -
    • icon-download-alt
    • -
    • icon-download
    • -
    • icon-upload
    • -
    • icon-inbox
    • -
    • icon-play-circle
    • -
    • icon-repeat
    • -
    • icon-refresh
    • -
    • icon-list-alt
    • -
    • icon-lock
    • -
    • icon-flag
    • -
    • icon-headphones
    • -
    -
    -
    -
      -
    • icon-volume-off
    • -
    • icon-volume-down
    • -
    • icon-volume-up
    • -
    • icon-qrcode
    • -
    • icon-barcode
    • -
    • icon-tag
    • -
    • icon-tags
    • -
    • icon-book
    • -
    • icon-bookmark
    • -
    • icon-print
    • -
    • icon-camera
    • -
    • icon-font
    • -
    • icon-bold
    • -
    • icon-italic
    • -
    • icon-text-height
    • -
    • icon-text-width
    • -
    • icon-align-left
    • -
    • icon-align-center
    • -
    • icon-align-right
    • -
    • icon-align-justify
    • -
    • icon-list
    • -
    • icon-indent-left
    • -
    • icon-indent-right
    • -
    • icon-facetime-video
    • -
    • icon-picture
    • -
    • icon-pencil
    • -
    • icon-map-marker
    • -
    • icon-adjust
    • -
    • icon-tint
    • -
    • icon-edit
    • -
    • icon-share
    • -
    • icon-check
    • -
    • icon-move
    • -
    • icon-step-backward
    • -
    • icon-fast-backward
    • -
    -
    -
    -
      -
    • icon-backward
    • -
    • icon-play
    • -
    • icon-pause
    • -
    • icon-stop
    • -
    • icon-forward
    • -
    • icon-fast-forward
    • -
    • icon-step-forward
    • -
    • icon-eject
    • -
    • icon-chevron-left
    • -
    • icon-chevron-right
    • -
    • icon-plus-sign
    • -
    • icon-minus-sign
    • -
    • icon-remove-sign
    • -
    • icon-ok-sign
    • -
    • icon-question-sign
    • -
    • icon-info-sign
    • -
    • icon-screenshot
    • -
    • icon-remove-circle
    • -
    • icon-ok-circle
    • -
    • icon-ban-circle
    • -
    • icon-arrow-left
    • -
    • icon-arrow-right
    • -
    • icon-arrow-up
    • -
    • icon-arrow-down
    • -
    • icon-share-alt
    • -
    • icon-resize-full
    • -
    • icon-resize-small
    • -
    • icon-plus
    • -
    • icon-minus
    • -
    • icon-asterisk
    • -
    • icon-exclamation-sign
    • -
    • icon-gift
    • -
    • icon-leaf
    • -
    • icon-fire
    • -
    • icon-eye-open
    • -
    -
    -
    -
      -
    • icon-eye-close
    • -
    • icon-warning-sign
    • -
    • icon-plane
    • -
    • icon-calendar
    • -
    • icon-random
    • -
    • icon-comment
    • -
    • icon-magnet
    • -
    • icon-chevron-up
    • -
    • icon-chevron-down
    • -
    • icon-retweet
    • -
    • icon-shopping-cart
    • -
    • icon-folder-close
    • -
    • icon-folder-open
    • -
    • icon-resize-vertical
    • -
    • icon-resize-horizontal
    • -
    • icon-hdd
    • -
    • icon-bullhorn
    • -
    • icon-bell
    • -
    • icon-certificate
    • -
    • icon-thumbs-up
    • -
    • icon-thumbs-down
    • -
    • icon-hand-right
    • -
    • icon-hand-left
    • -
    • icon-hand-up
    • -
    • icon-hand-down
    • -
    • icon-circle-arrow-right
    • -
    • icon-circle-arrow-left
    • -
    • icon-circle-arrow-up
    • -
    • icon-circle-arrow-down
    • -
    • icon-globe
    • -
    • icon-wrench
    • -
    • icon-tasks
    • -
    • icon-filter
    • -
    • icon-briefcase
    • -
    • icon-fullscreen
    • -
    -
    -
    - -
    - -
    -
    -

    Built as a sprite

    -

    Instead of making every icon an extra request, we've compiled them into a sprite—a bunch of images in one file that uses CSS to position the images with background-position. This is the same method we use on Twitter.com and it has worked well for us.

    -

    All icons classes are prefixed with .icon- for proper namespacing and scoping, much like our other components. This will help avoid conflicts with other tools.

    -
    -
    -

    How to use

    -

    Bootstrap uses an <i> tag for all icons, but they have no case class—only a shared prefix. To use, place the following code just about anywhere:

    -
    <i class="icon-search"></i>
    -

    There are also styles available for inverted (white) icons, made ready with one extra class:

    -
    <i class="icon-search icon-white"></i>
    -
    In dark themes (Cyborg and Slate) normal icons become white and icon-white become black.
    -

    There are 140 classes to choose from for your icons. Just add an <i> tag with the right classes and you're set. You can find the full list in sprites.less or right here in this document.

    -

    - Heads up! - When using beside strings of text, as in buttons or nav links, be sure to leave a space after the <i> tag for proper spacing. -

    -
    -
    -

    Use cases

    -

    Icons are great, but where would one use them? Here are a few ideas:

    -
      -
    • As visuals for your sidebar navigation
    • -
    • For a purely icon-driven navigation
    • -
    • For buttons to help convey the meaning of an action
    • -
    • With links to share context on a user's destination
    • -
    -

    Essentially, anywhere you can put an <i> tag, you can put an icon.

    -
    -
    - -

    Examples

    -

    Use them in buttons, button groups for a toolbar, navigation, or prepended form inputs.

    -
    -
    -
    -
    - - - - -
    - -
    -

    - Refresh - Checkout - Delete -

    -

    - Comment - Settings - More Info -

    -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -

    Icon sets

    -

    Default icon set has gray style suitable for white and light backgrounds, but a number of functional classes can be applied for different icon color styles. - These classes include a 5-color (blue, green, red, yellow and gray) .icon-color class, a black .icon-black class, a white .icon-white class, and a dark-gray .icon-darkgray class. -

    - Note: place your cursor on the chosen icon image to see its class. -
    -
    -
    -

    Default Icon Sets

    -

    Default icon classes .icon or .icon32 are best suitable for white and light backgrounds.

    -

    16x16 pixels icon set

    -

    Set .icon class for 16x16 pixels icon followed by a class corresponding to the chosen image.

    -
    <span class="icon icon-home"/>
    -
    -

    32x32 pixels icon set

    Set .icon32 class for 32x32 pixels icon followed by a class corresponding to the chosen image.

    <span class="icon32 icon-user"/>

    Special class for the whole section

    To use gray icon set for the whole section set .icons-gray class on the parent element.

    -
    <div class="icons-gray">
    -	<span class="icon icon-add"/>
    -	<span class="icon icon-remove"/>
    -</div>
    -											
    -

    Dark-gray Icon Sets

    Dark-gray icon sets are used for default :hover effect. - The .icon-darkgray class should be used for the icons on light and middle gray backgrounds.

    16x16 pixels icon set

    Set .icon class for 16x16 pixels icon, then .icon-darkgray class for color and a class corresponding to the chosen image.

    <span class="icon icon-darkgray icon-add"/>

    32x32 pixels icon set

    Set .icon32 class for 32x32 pixels icon, then .icon-darkgray class for color and a class corresponding to the chosen image.

    <span class="icon32 icon-darkgray icon-remove"/>

    Special class for the whole section

    To use dark-gray icon set for the whole section set .icons-darkgray class on the parent element.

    <div class="icons-darkgray">
    -	<span class="icon icon-add"/>
    -	<span class="icon icon-remove"/>
    -</div>

    Color Icon Sets

    Color icon sets are used for default .active icon effect. - The .icon-color class should be used for the icons on white and light backgrounds.

    16x16 pixels icon set

    Set .icon class for 16x16 pixels icon, then .icon-color class for color and a class corresponding to the chosen image.

    <span class="icon icon-color icon-triangle-n"/>

    32x32 pixels icon set

    Set .icon32 class for 32x32 pixels icon, then .icon-color class for color and a class corresponding to the chosen image.

    <span class="icon32 icon-color icon-triangle-s"/>

    Special class for the whole section

    To use color icon set for the whole section set .icons-color - class on the parent element.

    <div class="icons-color">
    -	<span class="icon icon-triangle-n"/>
    -	<span class="icon icon-triangle-s"/>
    -</div>

    Black Icon Sets

    The .icon-black class could be used for the icons on light and middle gray backgrounds.

    16x16 pixels icon set

    Set .icon class for 16x16 pixels icon, then .icon-black class for color and a class corresponding to the chosen image.

    <span class="icon icon-black icon-folder-open"/>

    32x32 pixels icon set

    Set .icon32 class for 32x32 pixels icon, then .icon-black class for color and a class corresponding to the chosen image.

    <span class="icon32 icon-black icon-folder-collapsed"/>

    Special class for the whole section

    To use black icon set for the whole section set .icons-black - class on the parent element.

    <div class="icons-black">
    -	<span class="icon icon-folder-open"/>
    -	<span class="icon icon-folder-collapsed"/>
    -</div>
    -

    White Icon Sets

    The .icon-white class should be used for the icons on vivid and dark backgrounds.

    16x16 pixels icon set

    Set .icon class for 16x16 pixels icon, then .icon-white class for color and a class corresponding to the chosen image.

    <span class="icon icon-white icon-bullet-on"/>

    32x32 pixels icon set

    Set .icon32 class for 32x32 pixels icon, then .icon-white class for color and a class corresponding to the chosen image.

    <span class="icon32 icon-white icon-bullet-off"/>

    Special class for the whole section

    To use white icon set for the whole section set .icons-white class on the parent element.

    <div class="icons-white">
    -	<span class="icon icon-bullet-on"/>
    -	<span class="icon icon-bullet-off"/>
    -</div>
    -

    Blue Icon Sets

    The .icon-blue class could be used for the icons on light or dark backgrounds.

    16x16 pixels icon set

    Set .icon class for 16x16 pixels icon, then .icon-blue class for color and a class corresponding to the chosen image.

    <span class="icon icon-blue icon-carat-1-n"/>

    32x32 pixels icon set

    Set .icon32 class for 32x32 pixels icon, then .icon-blue class for color and a class corresponding to the chosen image.

    <span class="icon32 icon-blue icon-carat-1-s"/>

    Special class for the whole section

    To use blue icon set for the whole section set .icons-blue - class on the parent element.

    <div class="icons-blue">
    -	<span class="icon icon-carat-1-n"/>
    -	<span class="icon icon-carat-1-s"/>
    -</div>
    -

    Green Icon Sets

    The .icon-green class could be used for the icons on light or dark backgrounds.

    16x16 pixels icon set

    Set .icon class for 16x16 pixels icon, then .icon-green class for color and a class corresponding to the chosen image.

    <span class="icon icon-green icon-arrow-e"/>

    32x32 pixels icon set

    Set .icon32 class for 32x32 pixels icon, then .icon-green class for color and a class corresponding to the chosen image.

    <span class="icon32 icon-green icon-arrow-w"/>

    Special class for the whole section

    To use green icon set for the whole section set .icons-green - class on the parent element.

    <div class="icons-green">
    -	<span class="icon icon-arrow-e"/>
    -	<span class="icon icon-arrow-w"/>
    -</div>
    -

    Red Icon Sets

    The .icon-red class could be used for the icons on light or dark backgrounds.

    16x16 pixels icon set

    Set .icon class for 16x16 pixels icon, then .icon-red class for color and a class corresponding to the chosen image.

    <span class="icon icon-red icon-arrowthick-ne"/>

    32x32 pixels icon set

    Set .icon32 class for 32x32 pixels icon, then .icon-red class for color and a class corresponding to the chosen image.

    <span class="icon32 icon-red icon-arrowthick-sw"/>

    Special class for the whole section

    To use red icon set for the whole section set .icons-red - class on the parent element.

    <div class="icons-red">
    -	<span class="icon icon-arrowthick-ne"/>
    -	<span class="icon icon-arrowthick-sw"/>
    -</div>
    -

    Orange Icon Sets

    The .icon-orange class could be used for the icons on light or dark backgrounds.

    16x16 pixels icon set

    Set .icon class for 16x16 pixels icon, then .icon-orange class for color and a class corresponding to the chosen image.

    <span class="icon icon-orange icon-undo"/>

    32x32 pixels icon set

    Set .icon32 class for 32x32 pixels icon, then .icon-orange class for color and a class corresponding to the chosen image.

    <span class="icon32 icon-orange icon-redo"/>

    Special class for the whole section

    To use orange icon set for the whole section set .icons-orange - class on the parent element.

    <div class="icons-orange">
    -	<span class="icon icon-undo"/>
    -	<span class="icon icon-redo"/>
    -</div>
    -
    - - -
    -
    -
    - -
    - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/client.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/client.png new file mode 100755 index 000000000..d9c327ad5 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/client.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/connect.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/connect.png new file mode 100644 index 000000000..f3675f0f4 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/connect.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/cpuid.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/cpuid.png new file mode 100755 index 000000000..019d08bef Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/cpuid.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/ht.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/ht.png new file mode 100755 index 000000000..5bc1cfd1d Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/ht.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/local.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/local.png new file mode 100755 index 000000000..00eb97422 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/local.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/mask.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/mask.png new file mode 100755 index 000000000..2dd19175d Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/mask.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/memory.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/memory.png new file mode 100755 index 000000000..c1b4a26c3 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/memory.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/nel.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/nel.png new file mode 100755 index 000000000..344c05ff9 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/nel.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/os.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/os.png new file mode 100755 index 000000000..d8a50a5e2 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/os.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/patch.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/patch.png new file mode 100755 index 000000000..cf468d125 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/patch.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/position.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/position.png new file mode 100755 index 000000000..476e3693d Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/position.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/processor.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/processor.png new file mode 100755 index 000000000..98297fcaa Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/processor.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/server.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/server.png new file mode 100755 index 000000000..83eac6283 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/server.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/shard.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/shard.png new file mode 100755 index 000000000..752ff61ff Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/shard.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/user.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/user.png new file mode 100755 index 000000000..f0f204148 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/user.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/img/info/view.png b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/view.png new file mode 100755 index 000000000..00363775c Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams/www/html/img/info/view.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/change_permission.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/change_permission.php index 084aa3923..9c18aa036 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/change_permission.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/change_permission.php @@ -1,24 +1,42 @@ getTUserId(), $value); - header("Location: index.php?page=show_user&id=".$user_id); + if (Helpers::check_if_game_client()) { + header("Location: ".$INGAME_WEBPATH."?page=show_user&id=".$user_id); + }else{ + header("Location: ".$WEBPATH."?page=show_user&id=".$user_id); + } exit; }else{ //ERROR: GET PARAMS not given or trying to change admin - header("Location: index.php?page=show_user&id=".$user_id); + if (Helpers::check_if_game_client()) { + header("Location: ".$INGAME_WEBPATH."?page=show_user&id=".$user_id); + }else{ + header("Location: ".$WEBPATH."?page=show_user&id=".$user_id); + } exit; } diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/createticket.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/createticket.php index 4c3dce7b8..3a2b371fc 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/createticket.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/createticket.php @@ -1,5 +1,10 @@ getTUserId(); + $result['nrToDo'] = Ticket_Queue_Handler::getNrOfTicketsToDo(unserialize($_SESSION['ticket_user'])->getTUserId()); + $result['nrAssignedWaiting'] = Ticket_Queue_Handler::getNrOfTicketsAssignedWaiting(unserialize($_SESSION['ticket_user'])->getTUserId()); + $result['nrTotalTickets'] = Ticket_Queue_Handler::getNrOfTickets(); + $ticket = Ticket_Queue_Handler::getNewestTicket(); + $result['newestTicketId'] = $ticket->getTId(); + $result['newestTicketTitle'] = $ticket->getTitle(); + $result['newestTicketAuthor'] = Ticket_User::get_username_from_id($ticket->getAuthor()); + global $INGAME_WEBPATH; + $result['ingame_webpath'] = $INGAME_WEBPATH; + return $result; + + }else{ + //ERROR: No access! + $_SESSION['error_code'] = "403"; + header("Location: index.php?page=error"); + exit; + + } + + }else{ + //ERROR: not logged in! + header("Location: index.php"); + exit; + } + + +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/error.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/error.php index eca129ff6..84de1083d 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/error.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/error.php @@ -1,5 +1,9 @@ $value){ + $GETString = $GETString . $key . '=' . $value . "&"; + } + if($GETString != ""){ + $GETString = '?'.$GETString; + } + $pageElements['getstring'] = $GETString; + return $pageElements; + } diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/logout.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/logout.php index 83ed2080d..6f1c30169 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/logout.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/logout.php @@ -1,6 +1,10 @@ getHashedPass()) == $key) ){ + //you are allowed on the page! + + $GETString = ""; + foreach($_GET as $key => $value){ + $GETString = $GETString . $key . '=' . $value . "&"; + } + if($GETString != ""){ + $GETString = '?'.$GETString; + } + $pageElements['getstring'] = $GETString; + + return $pageElements; + + }else{ + global $WEBPATH; + $_SESSION['error_code'] = "403"; + header("Location: ".$WEBPATH."?page=error"); + exit; + } +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php index d8ee51a16..ca06ee060 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php @@ -1,10 +1,15 @@ getInfo(); - if(Ticket_User::isMod($_SESSION['ticket_user']) && ($_GET['id']!= $_SESSION['id'])){ + if(Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) && ($_GET['id']!= $_SESSION['id'])){ $result['changesOther'] = "TRUE"; } $result['target_id'] = $_GET['id']; $result['current_mail'] = $webUser->getEmail(); + $result['target_username'] = $webUser->getUsername(); } }else{ $webUser = new Webusers($_SESSION['id']); $result = $webUser->getInfo(); $result['target_id'] = $_SESSION['id']; $result['current_mail'] = $webUser->getEmail(); - - //Sanitize Data - $result['current_mail'] = filter_var($result['current_mail'], FILTER_SANITIZE_EMAIL); - //$result['Login'] = filter_var($result['Login'], FILTER_SANITIZE_STRING); - $result['FirstName'] = filter_var($result['FirstName'], FILTER_SANITIZE_STRING); - $result['LastName'] = filter_var($result['LastName'], FILTER_SANITIZE_STRING); - $result['Country'] = filter_var($result['Country'], FILTER_SANITIZE_STRING); - $result['Gender'] = filter_var($result['Gender'], FILTER_SANITIZE_NUMBER_INT); + $result['target_username'] = $webUser->getUsername(); + } + //Sanitize Data + $result['current_mail'] = filter_var($result['current_mail'], FILTER_SANITIZE_EMAIL); + $result['target_username'] = filter_var($result['target_username'], FILTER_SANITIZE_STRING); + $result['FirstName'] = filter_var($result['FirstName'], FILTER_SANITIZE_STRING); + $result['LastName'] = filter_var($result['LastName'], FILTER_SANITIZE_STRING); + $result['Country'] = filter_var($result['Country'], FILTER_SANITIZE_STRING); + $result['Gender'] = filter_var($result['Gender'], FILTER_SANITIZE_NUMBER_INT); + $result['ReceiveMail'] = filter_var($result['ReceiveMail'], FILTER_SANITIZE_NUMBER_INT); $result['country_array'] = getCountryArray(); + global $INGAME_WEBPATH; + $result['ingame_webpath'] = $INGAME_WEBPATH; return $result; }else{ //ERROR: not logged in! diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/sgroup_list.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/sgroup_list.php index 3d380c2d2..50edd64ad 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/sgroup_list.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/sgroup_list.php @@ -1,20 +1,34 @@ getTUserId(); + $user_id = unserialize($_SESSION['ticket_user'])->getTUserId(); $queueArray = array(); $queue_handler = new Ticket_Queue_handler(); //Pagination Base Links - $result['pagination_base_link'] = "index.php?page=show_queue&get=".$result['queue_view'] ; + if (Helpers::check_if_game_client()) { + $result['pagination_base_link'] = $INGAME_WEBPATH."?page=show_queue&get=".$result['queue_view'] ; + }else{ + $result['pagination_base_link'] = $WEBPATH."?page=show_queue&get=".$result['queue_view'] ; + } + + //form url to keep the getters constant + if (Helpers::check_if_game_client()) { + $result['getURL'] = $INGAME_WEBPATH."?page=show_queue&get=" . $result['queue_view']; + }else{ + $result['getURL'] = $WEBPATH."?page=show_queue&get=" . $result['queue_view']; + } + + if(isset($_GET['pagenum'])){ + $result['getURL'] = $result['getURL'] . "&pagenum=".$_GET['pagenum']; + } if(isset($_GET['get']) && ($_GET['get'] == "create") && isset($_GET['userid']) && isset($_GET['groupid']) && isset($_GET['what']) && isset($_GET['how']) && isset($_GET['who'])){ $userid = filter_var($_GET['userid'], FILTER_SANITIZE_NUMBER_INT); @@ -22,13 +47,24 @@ function show_queue(){ $what = filter_var($_GET['what'], FILTER_SANITIZE_STRING); $how = filter_var($_GET['how'], FILTER_SANITIZE_STRING); $who = filter_var($_GET['who'], FILTER_SANITIZE_STRING); + //create the custom queue $queue_handler->CreateQueue($userid, $groupid, $what, $how, $who); - $result['pagination_base_link'] = "index.php?page=show_queue&get=create&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who; + + if (Helpers::check_if_game_client()) { + $result['pagination_base_link'] = $INGAME_WEBPATH."?page=show_queue&get=create&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who; + }else{ + $result['pagination_base_link'] = $WEBPATH."?page=show_queue&get=create&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who; + } + + $result['prev_created_userid'] = $userid; $result['prev_created_groupid'] = $groupid; $result['prev_created_what'] = $what; $result['prev_created_how'] = $how; $result['prev_created_who'] = $who; + + $result['getURL'] = $result['getURL'] . "&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who; + } //if an action is set @@ -50,17 +86,20 @@ function show_queue(){ $what = filter_var($_POST['what'], FILTER_SANITIZE_STRING); $how = filter_var($_POST['how'], FILTER_SANITIZE_STRING); $who = filter_var($_POST['who'], FILTER_SANITIZE_STRING); + //create the custom queue $queue_handler->CreateQueue($userid, $groupid, $what, $how, $who); - $result['pagination_base_link'] = "index.php?page=show_queue&get=create&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who; + if (Helpers::check_if_game_client()) { + $result['pagination_base_link'] = $INGAME_WEBPATH."?page=show_queue&get=create&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who; + }else{ + $result['pagination_base_link'] = $WEBPATH."?page=show_queue&get=create&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who; + } $result['prev_created_userid'] = $userid; $result['prev_created_groupid'] = $groupid; $result['prev_created_what'] = $what; $result['prev_created_how'] = $how; $result['prev_created_who'] = $who; - - - - + $result['getURL'] = $result['getURL'] . "&userid=".$userid."&groupid=".$groupid."&what=".$what."&how=".$how."&who=".$who; + break; } @@ -76,7 +115,6 @@ function show_queue(){ //if queue_view is a valid parameter value if ($queueArray != "ERROR"){ - $result['tickets'] = Gui_Elements::make_table($queueArray, Array("getTId","getTitle","getTimestamp","getAuthor()->getExternId","getTicket_Category()->getName","getStatus","getStatusText","getAssigned","getForwardedGroupName","getForwardedGroupId"), Array("tId","title","timestamp","authorExtern","category","status","statusText","assigned","forwardedGroupName","forwardedGroupId")); $i = 0; foreach( $result['tickets'] as $ticket){ @@ -87,7 +125,7 @@ function show_queue(){ $result['tickets'][$i]['timestamp_elapsed'] = Gui_Elements::time_elapsed_string($ticket['timestamp']); $i++; } - $result['user_id'] = $_SESSION['ticket_user']->getTUserId(); + $result['user_id'] = unserialize($_SESSION['ticket_user'])->getTUserId(); //Queue creator field info $result['grouplist'] = Gui_Elements::make_table(Support_Group::getGroups(), Array("getSGroupId","getName"), Array("sGroupId","name")); @@ -98,13 +136,15 @@ function show_queue(){ $result['teamlist'][$i]['name'] = $web_teammember->getUsername(); $i++; } + global $INGAME_WEBPATH; + $result['ingame_webpath'] = $INGAME_WEBPATH; return $result; }else{ //ERROR: Doesn't exist! $_SESSION['error_code'] = "404"; - header("Location: index.php?page=error"); + header("Location: ams?page=error"); exit; } diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_reply.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_reply.php index 1640c5938..9a0ecc9cc 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_reply.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_reply.php @@ -1,5 +1,10 @@ load_With_TId($reply->getTicket()); - if(( $ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId() && ! $reply->getHidden()) || Ticket_User::isMod($_SESSION['ticket_user'] )){ + //check if the user is allowed to see the reply + if(( $ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId() && ! $reply->getHidden()) || Ticket_User::isMod(unserialize($_SESSION['ticket_user']) )){ $content = new Ticket_Content(); $content->load_With_TContentId($reply->getContent()); @@ -27,9 +33,11 @@ function show_reply(){ $result['author'] = $author->getExternId(); $webUser = new WebUsers($author->getExternId()); $result['authorName'] = $webUser->getUsername(); - if(Ticket_User::isMod($_SESSION['ticket_user'])){ + if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){ $result['isMod'] = "TRUE"; } + global $INGAME_WEBPATH; + $result['ingame_webpath'] = $INGAME_WEBPATH; return $result; }else{ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_sgroup.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_sgroup.php index f4f5edd64..76dbe7b18 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_sgroup.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_sgroup.php @@ -1,28 +1,43 @@ getName(); + $result['groupemail'] = $group->getGroupEmail(); + $result['imap_mailserver'] = $group->getIMAP_MailServer(); + $result['imap_username'] = $group->getIMAP_Username(); $result['userlist'] = Gui_Elements::make_table(Support_Group::getAllUsersOfSupportGroup($result['target_id']), Array("getTUserId","getPermission","getExternId"), Array("tUserId","permission","externId")); $i = 0; foreach( $result['userlist'] as $user){ @@ -30,6 +45,8 @@ function show_sgroup(){ $result['userlist'][$i]['name'] = $webuser->getUsername(); $i++; } + global $INGAME_WEBPATH; + $result['ingame_webpath'] = $INGAME_WEBPATH; return $result; @@ -37,7 +54,7 @@ function show_sgroup(){ //ERROR: No page specified! $_SESSION['error_code'] = "404"; - header("Location: index.php?page=error"); + header("Location: ams?page=error"); exit; } diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php index 3179a0e25..aff9c5e19 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php @@ -1,15 +1,22 @@ getTUserId(); + $result['user_id'] = unserialize($_SESSION['ticket_user'])->getTUserId(); $result['ticket_id'] = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT); $target_ticket = new Ticket(); $target_ticket->load_With_TId($result['ticket_id']); - if(Ticket_User::isMod($_SESSION['ticket_user'] )){ + if(Ticket_User::isMod(unserialize($_SESSION['ticket_user'] ))){ if(isset($_POST['action'])){ switch($_POST['action']){ case "forward": @@ -30,14 +37,15 @@ function show_ticket(){ } } - if(($target_ticket->getAuthor() == $_SESSION['ticket_user']->getTUserId()) || Ticket_User::isMod($_SESSION['ticket_user'] )){ + if(($target_ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId()) || Ticket_User::isMod(unserialize($_SESSION['ticket_user']) )){ $show_as_admin = false; - if(Ticket_User::isMod($_SESSION['ticket_user'])){ + if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){ $show_as_admin = true; } + $entire_ticket = Ticket::getEntireTicket( $result['ticket_id'],$show_as_admin); - Ticket_Log::createLogEntry($result['ticket_id'],$_SESSION['ticket_user']->getTUserId(), 3); + Ticket_Log::createLogEntry($result['ticket_id'],unserialize($_SESSION['ticket_user'])->getTUserId(), 3); $result['ticket_tId'] = $entire_ticket['ticket_obj']->getTId(); $result['ticket_forwardedGroupName'] = $entire_ticket['ticket_obj']->getForwardedGroupName(); $result['ticket_forwardedGroupId'] = $entire_ticket['ticket_obj']->getForwardedGroupId(); @@ -61,11 +69,14 @@ function show_ticket(){ $result['ticket_replies'][$i]['author'] = $webReplyUser->getUsername(); $i++; } - if(Ticket_User::isMod($_SESSION['ticket_user'])){ + if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){ $result['isMod'] = "TRUE"; $result['statusList'] = Ticket::getStatusArray(); $result['sGroups'] = Gui_Elements::make_table_with_key_is_id(Support_Group::getAllSupportGroups(), Array("getName"), "getSGroupId" ); } + $result['hasInfo'] = $target_ticket->hasInfo(); + global $INGAME_WEBPATH; + $result['ingame_webpath'] = $INGAME_WEBPATH; return $result; }else{ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_info.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_info.php new file mode 100644 index 000000000..f78a60e6c --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_info.php @@ -0,0 +1,60 @@ +load_With_TId($result['ticket_id']); + + if( $target_ticket->hasInfo() && (($target_ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId()) || Ticket_User::isMod(unserialize($_SESSION['ticket_user']) ))){ + $result['ticket_title'] = $target_ticket->getTitle(); + $result['ticket_author'] = $target_ticket->getAuthor(); + + $ticket_info = new Ticket_Info(); + $ticket_info->load_With_Ticket($result['ticket_id']); + $result['shard_id'] = $ticket_info->getShardId(); + $result['user_position'] = $ticket_info->getUser_Position(); + $result['view_position'] = $ticket_info->getView_Position(); + $result['client_version'] = $ticket_info->getClient_Version(); + $result['patch_version'] = $ticket_info->getPatch_Version(); + $result['server_tick'] = $ticket_info->getServer_Tick(); + $result['connect_state'] = $ticket_info->getConnect_State(); + $result['local_address'] = $ticket_info->getLocal_Address(); + $result['memory'] = $ticket_info->getMemory(); + $result['os'] = $ticket_info->getOS(); + $result['processor'] = $ticket_info->getProcessor(); + $result['cpu_id'] = $ticket_info->getCPUId(); + $result['cpu_mask'] = $ticket_info->getCPU_Mask(); + $result['ht'] = $ticket_info->getHT(); + $result['nel3d'] = $ticket_info->getNel3D(); + $result['user_id'] = $ticket_info->getUser_Id(); + global $IMAGELOC_WEBPATH; + $result['IMAGELOC_WEBPATH'] = $IMAGELOC_WEBPATH; + + if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){ + $result['isMod'] = "TRUE"; + } + global $INGAME_WEBPATH; + $result['ingame_webpath'] = $INGAME_WEBPATH; + return $result; + + }else{ + //ERROR: No access! + $_SESSION['error_code'] = "403"; + header("Location: index.php?page=error"); + exit; + } + }else{ + //ERROR: not logged in! + header("Location: index.php"); + exit; + } +} \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_log.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_log.php index 5d4cbb76b..85db661f9 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_log.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_log.php @@ -1,19 +1,31 @@ load_With_TId($result['ticket_id']); $result['ticket_title'] = $target_ticket->getTitle(); + + //return all logs related to a ticket. $ticket_logs = Ticket_Log::getLogsOfTicket( $result['ticket_id']); $log_action_array = Ticket_Log::getActionTextArray(); + //fetch information about each returned ticket in a format that is usable for the template $result['ticket_logs'] = Gui_Elements::make_table($ticket_logs, Array("getTLogId","getTimestamp","getAuthor()->getExternId","getAction","getArgument()"), Array("tLogId","timestamp","authorExtern","action","argument")); $i = 0; + //for each ticket add action specific informaton to the to-be-shown text: uses the query_backpart foreach( $result['ticket_logs'] as $log){ $webUser = new WebUsers($log['authorExtern']); $author = $webUser->getUsername(); @@ -23,7 +35,11 @@ function show_ticket_log(){ $webUser2 = new WebUsers($log['argument']); $query_backpart = $webUser2->getUsername(); }else if($log['action'] == 4){ - $query_backpart = "ID#" . $log['argument'] . ""; + if (Helpers::check_if_game_client()) { + $query_backpart = "ID#" . $log['argument'] . ""; + }else{ + $query_backpart = "ID#" . $log['argument'] . ""; + } }else if($log['action'] == 5){ $statusArray = Ticket::getStatusArray(); $query_backpart = $statusArray[$log['argument'] ]; @@ -31,15 +47,21 @@ function show_ticket_log(){ $priorityArray = Ticket::getPriorityArray(); $query_backpart = $priorityArray[$log['argument'] ]; }else if($log['action'] == 8){ - $query_backpart = "" . Support_Group::getGroup($log['argument'])->getName() . ""; + if (Helpers::check_if_game_client()) { + $query_backpart = "" . Support_Group::getGroup($log['argument'])->getName() . ""; + }else{ + $query_backpart = "" . Support_Group::getGroup($log['argument'])->getName() . ""; + } } $result['ticket_logs'][$i]['query'] = $author . " " . $log_action_array[$log['action']] . " " . $query_backpart; $result['ticket_logs'][$i]['timestamp_elapsed'] = Gui_Elements::time_elapsed_string($log['timestamp']); $i++; } - if(Ticket_User::isMod($_SESSION['ticket_user'])){ + if(Ticket_User::isMod(unserialize($_SESSION['ticket_user']))){ $result['isMod'] = "TRUE"; } + global $INGAME_WEBPATH; + $result['ingame_webpath'] = $INGAME_WEBPATH; return $result; }else{ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php index a8774ba83..0fafcfddd 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php @@ -1,10 +1,16 @@ getPermission(); - if(Ticket_User::isAdmin($_SESSION['ticket_user'])){ + if(Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))){ $result['isAdmin'] = "TRUE"; } $ticketlist = Ticket::getTicketsOf($ticket_user->getTUserId()); $result['ticketlist'] = Gui_Elements::make_table($ticketlist, Array("getTId","getTimestamp","getTitle","getStatus","getStatusText","getStatusText","getCategoryName"), Array("tId","timestamp","title","status","statustext","statusText","category")); + global $INGAME_WEBPATH; + $result['ingame_webpath'] = $INGAME_WEBPATH; return $result; }else{ @@ -41,4 +49,4 @@ function show_user(){ header("Location: index.php"); exit; } -} \ No newline at end of file +} diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/syncing.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/syncing.php index bca38bd74..7cc790a1a 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/syncing.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/syncing.php @@ -1,15 +1,23 @@ getElements() , Array("getSID","getType"), Array("id","type")); $pageResult['links'] = $pagination->getLinks(5); $pageResult['lastPage'] = $pagination->getLast(); $pageResult['currentPage'] = $pagination->getCurrent(); + global $INGAME_WEBPATH; + $pageResult['ingame_webpath'] = $INGAME_WEBPATH; //check if shard is online try{ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php index 9e4c8a079..6f9117e11 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php @@ -1,7 +1,11 @@ getElements() , Array("getUId","getUsername","getEmail"), Array("id","username","email")); @@ -15,9 +19,13 @@ function userlist(){ $i++; } - if (Ticket_User::isAdmin($_SESSION['ticket_user'])){ + if (Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))){ $pageResult['isAdmin'] = "TRUE"; } + global $INGAME_WEBPATH; + $pageResult['ingame_webpath'] = $INGAME_WEBPATH; + global $BASE_WEBPATH; + $pageResult['base_webpath'] = $BASE_WEBPATH; return $pageResult; }else{ //ERROR: No access! @@ -25,4 +33,4 @@ function userlist(){ header("Location: index.php?page=error"); exit; } -} \ No newline at end of file +} diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/index.php b/code/ryzom/tools/server/ryzom_ams/www/html/index.php index b14cbb40c..40b4e6535 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/index.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/index.php @@ -1,4 +1,16 @@ getPermission(); + $return['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); }else{ //default permission $return['permission'] = 0; @@ -48,7 +91,7 @@ if(isset($_SESSION['ticket_user'])){ //hide sidebar + topbar in case of login/register -if($page == 'login' || $page == 'register' || $page == 'logout'){ +if($page == 'login' || $page == 'register' || $page == 'logout' || $page == 'forgot_password' || $page == 'reset_password'){ $return['no_visible_elements'] = 'TRUE'; }else{ $return['no_visible_elements'] = 'FALSE'; @@ -59,5 +102,6 @@ if($page == 'error'){ $return['permission'] = 0; $return['no_visible_elements'] = 'FALSE'; } -//print_r($return); + +//load the template with the variables in the $return array helpers :: loadTemplate( $page , $return ); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/index_charisma.php b/code/ryzom/tools/server/ryzom_ams/www/html/index_charisma.php deleted file mode 100644 index b4b943104..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/index_charisma.php +++ /dev/null @@ -1,329 +0,0 @@ - - - -
    - -
    - - -
    -
    -
    -

    Introduction

    -
    - - - -
    -
    -
    -

    Charisma free, premium quality, responsive, multiple skin admin template.

    -

    Its a live demo of the template. I have created Charisma to ease the repeat work I have to do on my projects. Now I re-use Charisma as a base for my admin panel work and I am sharing it with you :)

    -

    All pages in the menu are functional, take a look at all, please share this with your followers.

    - -

    - Back to article - Download Page -

    -
    -
    -
    -
    - -
    -
    -
    -

    Tabs

    -
    - - - -
    -
    -
    - - -
    -
    -

    Charisma a fully featued template

    -

    Its a fully featured, responsive template for your admin panel. Its optimized for tablet and mobile phones. Scan the QR code below to view it in your mobile device.

    QR Code -
    -
    -

    Custom small text

    -

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur bibendum ornare dolor.

    -

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur bibendum ornare dolor, quis ullamcorper ligula sodales at. Nulla tellus elit, varius non commodo eget, mattis vel eros. In sed ornare nulla. Donec consectetur, velit a pharetra ultricies, diam lorem lacinia risus, ac commodo orci erat eu massa. Sed sit amet nulla ipsum. Donec felis mauris, vulputate sed tempor at, aliquam a ligula. Pellentesque non pulvinar nisi.

    -
    -
    -

    Messages small text

    -

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur bibendum ornare dolor, quis ullamcorper ligula sodales at. Nulla tellus elit, varius non commodo eget, mattis vel eros. In sed ornare nulla. Donec consectetur, velit a pharetra ultricies, diam lorem lacinia risus, ac commodo orci erat eu massa. Sed sit amet nulla ipsum. Donec felis mauris, vulputate sed tempor at, aliquam a ligula. Pellentesque non pulvinar nisi.

    -

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur bibendum ornare dolor.

    -
    -
    -
    -
    - -
    -
    -

    Member Activity

    -
    - - -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -

    Realtime Traffic

    -
    - - -
    -
    -
    -
    -

    You can update a chart periodically to get a real-time effect by using a timer to insert the new data in the plot and redraw it.

    -

    Time between updates: milliseconds

    -
    -
    -
    - -
    -
    -
    -

    Buttons

    -
    - - - -
    -
    -
    -

    - - - -

    -

    - - - -

    -

    - - - -

    -

    - - - - -

    -

    - - - - -

    -

    - - - -

    -
    -
    - -
    -
    -

    Buttons

    -
    - - - -
    -
    -
    -

    - - -

    -

    - - -

    -

    - - -

    -

    - -

    - - -
    -
    - - -
    - - - - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/sql/DBScheme.png b/code/ryzom/tools/server/ryzom_ams/www/html/sql/DBScheme.png index 16bced7cc..63cb4c92b 100644 Binary files a/code/ryzom/tools/server/ryzom_ams/www/html/sql/DBScheme.png and b/code/ryzom/tools/server/ryzom_ams/www/html/sql/DBScheme.png differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/sql/importusers.php b/code/ryzom/tools/server/ryzom_ams/www/html/sql/importusers.php new file mode 100644 index 000000000..af8715f5b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/sql/importusers.php @@ -0,0 +1,44 @@ +executeWithoutParams($sql); + $users = $statement->fetchAll(); + foreach($users as $user){ + //add user to web + $dbw = new DBLayer("web"); + if (! $dbw->execute("SELECT * FROM ams_user WHERE Login = :name",array('name' => $user['Login']))->rowCount()){ + $query = "INSERT INTO ams_user (Login, Password, Email, Language) VALUES (:name, :pass, :mail, :lang)"; + global $DEFAULT_LANGUAGE; + $vars = array('name' => $user['Login'], 'pass' => $user['Password'], 'mail' => $user['Email'], 'lang' => $DEFAULT_LANGUAGE); + $id = $dbw->executeReturnId($query,$vars); + $dbl = new DBLayer("lib"); + $query = "INSERT INTO `ticket_user` (Permission, ExternId) VALUES (1, :id)"; + $vars = array('id' => $id); + $dbl->execute($query,$vars); + } + } + print "The users were imported! "; + }catch (PDOException $e){ + print "There was an error while creating the admin account! "; + } + + + \ No newline at end of file diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/sql/install.php b/code/ryzom/tools/server/ryzom_ams/www/html/sql/install.php index cf8a514e4..0130f1a65 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/sql/install.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/sql/install.php @@ -1,9 +1,17 @@ executeWithoutParams($sql); print "The Lib & Web database were correctly installed!
    "; @@ -386,11 +453,12 @@ 'name' => "admin", 'pass' => $hashpass, 'mail' => "admin@admin.com", - 'permission' => 3 + 'permission' => 3, + 'lang' => "en" ); try{ $dbw = new DBLayer("web"); - $user_id = $dbw->executeReturnId("INSERT INTO ams_user (Login, Password, Email, Permission) VALUES (:name, :pass, :mail, :permission)",$params); + $user_id = $dbw->executeReturnId("INSERT INTO ams_user (Login, Password, Email, Permission, Language) VALUES (:name, :pass, :mail, :permission, :lang)",$params); Users::createUser($params, $user_id); $dbl = new DBLayer("lib"); $dbl->execute("UPDATE ticket_user SET Permission = 3 WHERE TUserId = :user_id",array('user_id' => $user_id)); diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/sql/ticketsql.sql b/code/ryzom/tools/server/ryzom_ams/www/html/sql/ticketsql.sql index e7864e628..2fd0a6049 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/sql/ticketsql.sql +++ b/code/ryzom/tools/server/ryzom_ams/www/html/sql/ticketsql.sql @@ -241,6 +241,10 @@ CREATE TABLE IF NOT EXISTS `mydb`.`support_group` ( `SGroupId` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT , `Name` VARCHAR(22) NOT NULL , `Tag` VARCHAR(7) NOT NULL , + `GroupEmail` VARCHAR(45) NULL , + `IMAP_MailServer` VARCHAR(60) NULL , + `IMAP_Username` VARCHAR(45) NULL , + `IMAP_Password` VARCHAR(45) NULL , PRIMARY KEY (`SGroupId`) , UNIQUE INDEX `Name_UNIQUE` (`Name` ASC) , UNIQUE INDEX `Tag_UNIQUE` (`Tag` ASC) ) @@ -305,19 +309,14 @@ CREATE TABLE IF NOT EXISTS `mydb`.`email` ( `Body` VARCHAR(400) NULL , `Status` VARCHAR(45) NULL , `Attempts` VARCHAR(45) NULL DEFAULT 0 , - `Sender` INT(10) UNSIGNED NOT NULL , - `UserId` INT(10) UNSIGNED NOT NULL , - `MessageId` VARCHAR(45) NOT NULL , - `TicketId` INT UNSIGNED NOT NULL , + `UserId` INT(10) UNSIGNED NULL , + `MessageId` VARCHAR(45) NULL , + `TicketId` INT UNSIGNED NULL , + `Sender` INT(10) UNSIGNED NULL , PRIMARY KEY (`MailId`) , - INDEX `fk_email_ticket_user1` (`Sender` ASC) , INDEX `fk_email_ticket_user2` (`UserId` ASC) , INDEX `fk_email_ticket1` (`TicketId` ASC) , - CONSTRAINT `fk_email_ticket_user1` - FOREIGN KEY (`Sender` ) - REFERENCES `mydb`.`ticket_user` (`TUserId` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION, + INDEX `fk_email_support_group1` (`Sender` ASC) , CONSTRAINT `fk_email_ticket_user2` FOREIGN KEY (`UserId` ) REFERENCES `mydb`.`ticket_user` (`TUserId` ) @@ -327,6 +326,47 @@ CREATE TABLE IF NOT EXISTS `mydb`.`email` ( FOREIGN KEY (`TicketId` ) REFERENCES `mydb`.`ticket` (`TId` ) ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_email_support_group1` + FOREIGN KEY (`Sender` ) + REFERENCES `mydb`.`support_group` (`SGroupId` ) + ON DELETE CASCADE + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `mydb`.`ticket_info` +-- ----------------------------------------------------- +DROP TABLE IF EXISTS `mydb`.`ticket_info` ; + +CREATE TABLE IF NOT EXISTS `mydb`.`ticket_info` ( + `TInfoId` INT UNSIGNED NOT NULL AUTO_INCREMENT , + `Ticket` INT UNSIGNED NOT NULL , + `ShardId` INT NULL , + `UserPosition` VARCHAR(65) NULL , + `ViewPosition` VARCHAR(65) NULL , + `ClientVersion` VARCHAR(65) NULL , + `PatchVersion` VARCHAR(65) NULL , + `ServerTick` VARCHAR(40) NULL , + `ConnectState` VARCHAR(40) NULL , + `LocalAddress` VARCHAR(60) NULL , + `Memory` VARCHAR(60) NULL , + `OS` VARCHAR(120) NULL , + `Processor` VARCHAR(120) NULL , + `CPUID` VARCHAR(50) NULL , + `CpuMask` VARCHAR(50) NULL , + `HT` VARCHAR(65) NULL , + `NeL3D` VARCHAR(120) NULL , + `PlayerName` VARCHAR(45) NULL , + `UserId` INT NULL , + `TimeInGame` VARCHAR(50) NULL , + PRIMARY KEY (`TInfoId`) , + INDEX `fk_ticket_info_ticket1` (`Ticket` ASC) , + CONSTRAINT `fk_ticket_info_ticket1` + FOREIGN KEY (`Ticket` ) + REFERENCES `mydb`.`ticket` (`TId` ) + ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/sql/ticketsystemmodel.mwb b/code/ryzom/tools/server/ryzom_ams/www/html/sql/ticketsystemmodel.mwb index baf11d335..090f61a7f 100644 Binary files a/code/ryzom/tools/server/ryzom_ams/www/html/sql/ticketsystemmodel.mwb and b/code/ryzom/tools/server/ryzom_ams/www/html/sql/ticketsystemmodel.mwb differ diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/table.php b/code/ryzom/tools/server/ryzom_ams/www/html/table.php deleted file mode 100644 index 0a023296c..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/table.php +++ /dev/null @@ -1,1844 +0,0 @@ - - - -
    - -
    - -
    -
    -
    -

    Members

    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    UsernameDate registeredRoleStatusActions
    David R2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Chris Jack2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Jack Chris2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Muhammad Usman2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Sheikh Heera2012/02/01Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Helen Garner2012/02/01Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Saruar Ahmed2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Ahemd Saruar2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    David R2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Chris Jack2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Jack Chris2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Muhammad Usman2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Sheikh Heera2012/02/01Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Helen Garner2012/02/01Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Saruar Ahmed2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Ahemd Saruar2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    David R2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Chris Jack2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Jack Chris2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Muhammad Usman2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Sheikh Heera2012/02/01Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Helen Garner2012/02/01Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Saruar Ahmed2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Ahemd Saruar2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    David R2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Chris Jack2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Jack Chris2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Muhammad Usman2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Sheikh Heera2012/02/01Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Helen Garner2012/02/01Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Saruar Ahmed2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Ahemd Saruar2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    David R2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Chris Jack2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Jack Chris2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Muhammad Usman2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Sheikh Heera2012/02/01Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Helen Garner2012/02/01Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Saruar Ahmed2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Ahemd Saruar2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Habib Rizwan2012/01/21Staff - Active - - - - View - - - - Edit - - - - Delete - -
    Rizwan Habib2012/01/21Staff - Active - - - - View - - - - Edit - - - - Delete - -
    Amrin Sana2012/08/23Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Sana Amrin2012/08/23Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Ifrah Jannat2012/06/01Admin - Inactive - - - - View - - - - Edit - - - - Delete - -
    Jannat Ifrah2012/06/01Admin - Inactive - - - - View - - - - Edit - - - - Delete - -
    Robert2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Dave Robert2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Brown Robert2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Usman Muhammad2012/01/01Member - Active - - - - View - - - - Edit - - - - Delete - -
    Abdullah2012/02/01Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Dow John2012/02/01Admin - Inactive - - - - View - - - - Edit - - - - Delete - -
    John R2012/02/01Admin - Inactive - - - - View - - - - Edit - - - - Delete - -
    Paul Wilson2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Wilson Paul2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Heera Sheikh2012/01/21Staff - Active - - - - View - - - - Edit - - - - Delete - -
    Sheikh Heera2012/01/21Staff - Active - - - - View - - - - Edit - - - - Delete - -
    Christopher2012/08/23Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Andro Christopher2012/08/23Staff - Banned - - - - View - - - - Edit - - - - Delete - -
    Jhon Doe2012/06/01Admin - Inactive - - - - View - - - - Edit - - - - Delete - -
    Lorem Ipsum2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Abraham2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Brown Blue2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    Worth Name2012/03/01Member - Pending - - - - View - - - - Edit - - - - Delete - -
    -
    -
    - -
    - -
    -
    -
    -

    Simple Table

    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    UsernameDate registeredRoleStatus
    Muhammad Usman2012/01/01Member - Active -
    White Horse2012/02/01Staff - Banned -
    Sheikh Heera2012/02/01Admin - Inactive -
    Saruar2012/03/01Member - Pending -
    Sana Amrin2012/01/21Staff - Active -
    - -
    -
    - -
    -
    -

    Striped Table

    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    UsernameDate registeredRoleStatus
    Muhammad Usman2012/01/01Member - Active -
    White Horse2012/02/01Staff - Banned -
    Sheikh Heera2012/02/01Admin - Inactive -
    Saruar2012/03/01Member - Pending -
    Sana Amrin2012/01/21Staff - Active -
    - -
    -
    -
    - -
    -
    -
    -

    Bordered Table

    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    UsernameDate registeredRoleStatus
    Muhammad Usman2012/01/01Member - Active -
    White Horse2012/02/01Staff - Banned -
    Sheikh Heera2012/02/01Admin - Inactive -
    Saruar2012/03/01Member - Pending -
    Sana Amrin2012/01/21Staff - Active -
    - -
    -
    - -
    -
    -

    Condensed Table

    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    UsernameDate registeredRoleStatus
    Muhammad Usman2012/01/01Member - Active -
    White Horse2012/02/01Staff - Banned -
    Sheikh Heera2012/02/01Admin - Inactive -
    Saruar2012/03/01Member - Pending -
    Sana Amrin2012/01/21Staff - Active -
    - -
    -
    - -
    - -
    -
    -
    -

    Combined All

    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    UsernameDate registeredRoleStatus
    Muhammad Usman2012/01/01Member - Active -
    White Horse2012/02/01Staff - Banned -
    Sheikh Heera2012/02/01Admin - Inactive -
    Saruar2012/03/01Member - Pending -
    Sana Amrin2012/01/21Staff - Active -
    - -
    -
    -
    - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/dashboard.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/dashboard.tpl new file mode 100644 index 000000000..778ced05f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/dashboard.tpl @@ -0,0 +1,72 @@ +{block name=content} + + + + +
    +
    +
    +

    {$home_title}

    +
    + + + + +
    +
    +
    +

    {$home_info}

    +

    This is the GSOC project of Daan Janssens mentored by Matthew Lagoe.

    +

    The features as admin covered in this project are:

    +
      +
    • Manage user accounts
    • +
    • Make users moderator or admin
    • +
    • browse user's tickets
    • +
    • Create a new ticket for a specific user as admin
    • +
    • Create a new support group (and link an email to it)
    • +
    • Add mods to support groups
    • +
    • Assign ticket to you
    • +
    • Forward ticket to a support group
    • +
    • Add hidden messages to a ticket only viewable by other mods
    • +
    • Browse ticket queues or create one dynamically
    • +
    • Sync changes after the game server is back up after being down for a while
    • +
    • Browse the log of a ticket
    • +
    • Browse additional info sent along when a ticket is created ingame
    • +
    • All the above can be done while ingame too
    • +
    + +
    +
    +
    +
    + + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/forgot_password.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/forgot_password.tpl new file mode 100644 index 000000000..9b080d42a --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/forgot_password.tpl @@ -0,0 +1,54 @@ +{extends file="layout.tpl"} +{block name=content} + +
    + +
    + +
    + +
    +{/block} + + diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl deleted file mode 100644 index 6198b53a1..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/home.tpl +++ /dev/null @@ -1,53 +0,0 @@ -{block name=content} - - - - -
    -
    -
    -

    {$home_title}

    -
    - - - - -
    -
    -
    -

    {$home_info}

    - -
    -
    -
    -
    -{/block} - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl index f8fb5078c..fa97211d7 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout.tpl @@ -103,8 +103,8 @@ {/if}
    - - + +
    @@ -141,8 +141,8 @@ {if isset($no_visible_elements) and $no_visible_elements eq "TRUE"}
    - - + +
    {/if} @@ -181,6 +181,16 @@ + diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_user.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_user.tpl index 8da6ca313..301af12b6 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_user.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/layout_user.tpl @@ -1,8 +1,7 @@ {extends file="layout.tpl"} {block name=menu} -
  • Dashboard
  • -
  • Profile
  • +
  • Profile
  • Settings
  • Create New Ticket
  • diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/login.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/login.tpl index 2fbde3b50..d003906c5 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/login.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/login.tpl @@ -12,7 +12,7 @@
    {$login_info}
    -
    +
    @@ -43,7 +43,7 @@
    {/if}
    - {$login_register_message} {$login_register_message_here}! + {$login_register_message} {$login_here}.
    {$login_forgot_password_message} {$login_here}
    diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/register.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/register.tpl index bcf4de48b..44d81f9c7 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/register.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/register.tpl @@ -64,7 +64,7 @@ isset($TAC) and $TAC eq "success"}success{else}{/if}">
    - {$tac_tag1}{$tac_tag2} + {$tac_tag1}{$tac_tag2}
    @@ -106,17 +106,9 @@ {/if} -
    - -
    - - -
    - - - - -
    +

    + +

    diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/reset_password.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/reset_password.tpl new file mode 100644 index 000000000..6dfda9253 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/reset_password.tpl @@ -0,0 +1,66 @@ +{extends file="layout.tpl"} +{block name=content} + +
    + +
    + +
    + +
    +{/block} + + diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/reset_success.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/reset_success.tpl new file mode 100644 index 000000000..fed77e893 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/reset_success.tpl @@ -0,0 +1,47 @@ +{extends file="layout.tpl"} +{block name=content} + +
    + +
    + +
    + +
    +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/settings.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/settings.tpl index 0a7aa263c..599427946 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/settings.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/settings.tpl @@ -101,6 +101,7 @@
    + {if isset($SUCCESS_MAIL) and $SUCCESS_MAIL eq "OK"}
    The email has been changed! @@ -124,6 +125,40 @@
    +
    +

    Ticket updates

    +
    + + +
    +
    +
    +
    +
    + Ticket-Update Mail Settings + +
    + +
    + +
    + +
    + + + +
    + +
    + +
    +
    +
    +
    +
    diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/sgroup_list.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/sgroup_list.tpl index 57ab6e01f..a139aec34 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/sgroup_list.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/sgroup_list.tpl @@ -19,6 +19,7 @@
    ID Name TagEmailAction
    {$group.sGroupId} {$group.name} {$group.tag}{$group.groupemail} Delete
    {if $ticket.assigned eq 0} -
    +
    {else if $ticket.assigned eq $user_id} -
    + diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_sgroup.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_sgroup.tpl index 15c1d7b80..921b0edd1 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_sgroup.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_sgroup.tpl @@ -10,7 +10,7 @@
    - All members of the {$groupsname} Support Group + {$groupsname} Support Group Members @@ -49,7 +49,7 @@ - Add a user to the group '{$groupsname}' + Add user to '{$groupsname}'
    @@ -95,6 +95,83 @@
    +
    +

    Modify Email Settings

    +
    + + +
    +
    +
    +
    + + + + Mail settings of '{$groupsname}' + +
    + +
    +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    + + + + +
    + +
    + +
    +
    + + {if isset($RESULT_OF_MODIFYING) and $RESULT_OF_MODIFYING eq "SUCCESS"} +
    + {$modify_mail_of_group_success} +
    + {else if isset($RESULT_OF_MODIFYING) and $RESULT_OF_MODIFYING eq "EMAIL_NOT_VALID"} +
    + {$email_not_valid} +
    + {else if isset($RESULT_OF_MODIFYING) and $RESULT_OF_MODIFYING eq "NO_PASSWORD"} +
    + {$no_password_given} +
    + {/if} + + +
    +
    {/if} diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl index aae1bf9f9..1ac5b2f46 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket.tpl @@ -224,6 +224,7 @@
  • {if isset($isMod) and $isMod eq "TRUE"}
  • Show Ticket Log
  • {/if}
  • Send Other Ticket
  • + {if $hasInfo}
  • Show ticket Info
  • {/if}
  • diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket_info.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket_info.tpl new file mode 100644 index 000000000..ed09e1892 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/show_ticket_info.tpl @@ -0,0 +1,110 @@ +{block name=content} +
    +
    + +
    +
    + Additional Info +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Ingame related
    Shard ID: {$shard_id}
    User_Id: {$user_id}
    User Position: {$user_position}
    View Position: {$view_position}
    Client_Version: {$client_version}
    Patch_Version: {$patch_version}
    Server_Tick: {$server_tick}
    Hardware & Software related
    Memory: {$memory}
    Processor: {$processor}
    Cpu_Id: {$cpu_id}
    Cpu_Mask: {$cpu_mask}
    HT: {$ht}
    OS: {$os}
    NeL3D: {$nel3d}
    Network related
    Connect_State: {$connect_state}
    Local_Address: {$local_address}
    +
    +
    + + + +
    +
    +

    Actions

    +
    + + +
    +
    +
    +
    + + Actions +
    + + +
    +
    +
    +
    + +{/block} + diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/tour.php b/code/ryzom/tools/server/ryzom_ams/www/html/tour.php deleted file mode 100644 index d4e24047f..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/tour.php +++ /dev/null @@ -1,32 +0,0 @@ - - - -
    - -
    - -
    -
    -
    -

    Tour

    -
    - - - -
    -
    -
    - Click Here to restart the tour
    - You can create Custom Tour, like this.
    For more help on implementing tour go here -
    -
    -
    - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/typography.php b/code/ryzom/tools/server/ryzom_ams/www/html/typography.php deleted file mode 100644 index b49b9430d..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/typography.php +++ /dev/null @@ -1,176 +0,0 @@ - - -
    - -
    - -
    -
    -
    -

    Typography

    -
    - - - -
    -
    -
    - -
    -
    -

    Sample text and paragraphs

    -

    - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur bibendum ornare dolor, quis ullamcorper ligula sodales at. Nulla tellus elit, varius non commodo eget, mattis vel eros. In sed ornare nulla. Donec consectetur, velit a pharetra ultricies, diam lorem lacinia risus, ac commodo orci erat eu massa. Sed sit amet nulla ipsum. Donec felis mauris, vulputate sed tempor at, aliquam a ligula. Pellentesque non pulvinar nisi. -

    -

    - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur bibendum ornare dolor, quis ullamcorper ligula sodales at. Nulla tellus elit, varius non commodo eget, mattis vel eros. In sed ornare nulla. Donec consectetur, velit a pharetra ultricies, diam lorem lacinia risus, ac commodo orci erat eu massa. Sed sit amet nulla ipsum. Donec felis mauris, vulputate sed tempor at, aliquam a ligula. Pellentesque non pulvinar nisi. -

    -
    -
    -

    Example body text

    -

    Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam id dolor id nibh ultricies vehicula ut id elit.

    -

    Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec sed odio dui.

    -
    -
    -
    -

    h1. Heading 1

    -

    h2. Heading 2

    -

    h3. Heading 3

    -

    h4. Heading 4

    -
    h5. Heading 5
    -
    h6. Heading 6
    -
    -
    -
    - -
    -
    -

    Example blockquotes

    -
    -
    -

    Default blockquotes are styled as such:

    -
    -

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis.

    - Someone famous in Body of work -
    -
    -
    -

    You can always float your blockquote to the right:

    -
    -

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis.

    - Someone famous in Body of work -
    -
    -
    -
    -
    -
    -
    -

    More Sample Text

    -

    - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur bibendum ornare dolor, quis ullamcorper ligula sodales at. Nulla tellus elit, varius non commodo eget, mattis vel eros. In sed ornare nulla. Donec consectetur, velit a pharetra ultricies, diam lorem lacinia risus, ac commodo orci erat eu massa. Sed sit amet nulla ipsum. Donec felis mauris, vulputate sed tempor at, aliquam a ligula. Pellentesque non pulvinar nisi. -

    -
    -
    -

    And Paragraphs

    -

    - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur bibendum ornare dolor, quis ullamcorper ligula sodales at. Nulla tellus elit, varius non commodo eget, mattis vel eros. In sed ornare nulla. Donec consectetur, velit a pharetra ultricies, diam lorem lacinia risus, ac commodo orci erat eu massa. Sed sit amet nulla ipsum. Donec felis mauris, vulputate sed tempor at, aliquam a ligula. Pellentesque non pulvinar nisi. -

    -
    -
    -
    -
    -

    Example use of Tooltips

    -

    Hover over the links below to see tooltips:

    -
    -

    Tight pants next level keffiyeh you probably haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american appadata-rel have a terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A really ironic artisan whatever keytar, scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral. -

    -
    -
    -
    -
    -
    - -
    -
    -

    Unordered List

    -
    - -
    -
    -
    -
      -
    • Lorem ipsum dolor sit amet
    • -
    • Consectetur adipiscing elit
    • -
    • Integer molestie lorem at massa
    • -
    • Facilisis in pretium nisl aliquet
    • -
    • Nulla volutpat aliquam velit -
        -
      • Phasellus iaculis neque
      • -
      • Purus sodales ultricies
      • -
      • Vestibulum laoreet porttitor sem
      • -
      • Ac tristique libero volutpat at
      • -
      -
    • -
    • Faucibus porta lacus fringilla vel
    • -
    • Aenean sit amet erat nunc
    • -
    • Eget porttitor lorem
    • -
    -
    -
    - -
    -
    -

    Ordered List

    -
    - -
    -
    -
    -
      -
    1. Lorem ipsum dolor sit amet
    2. -
    3. Consectetur adipiscing elit
    4. -
    5. Integer molestie lorem at massa
    6. -
    7. Facilisis in pretium nisl aliquet
    8. -
    9. Nulla volutpat aliquam velit
    10. -
    11. Faucibus porta lacus fringilla vel
    12. -
    13. Aenean sit amet erat nunc
    14. -
    15. Eget porttitor lorem
    16. -
    -
    -
    - -
    -
    -

    Description List

    -
    - -
    -
    -
    -
    -
    Description lists
    -
    A description list is perfect for defining terms.
    -
    Euismod
    -
    Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.
    -
    Donec id elit non mi porta gravida at eget metus.
    -
    Malesuada porta
    -
    Etiam porta sem malesuada magna mollis euismod.
    -
    -
    -
    - - - -
    - - diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/ui.php b/code/ryzom/tools/server/ryzom_ams/www/html/ui.php deleted file mode 100644 index c0bda6be2..000000000 --- a/code/ryzom/tools/server/ryzom_ams/www/html/ui.php +++ /dev/null @@ -1,287 +0,0 @@ - - - -
    - -
    - -
    -
    -
    -

    Extended Elements

    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    Multiple File Upload

    - -

    Star Rating

    -
    -
    <div class="raty"></div>

    Toggle Switch

    - - <input data-no-uniform="true" type="checkbox" class="iphone-toggle">

    Auto Growing Textarea

    - - <textarea class="autogrow"></textarea>

    Popover

    - Hover for popover - <a href="#" class="btn btn-danger" data-rel="popover" data-content="And here's some amazing content. It's very engaging. right?" title="A Title">hover for popover</a>

    Slider

    -
    -
    <div class="slider"></div>

    Dialog

    - Click for dialog -

    Tooltip

    - Hover for tooltip - <a href="#" title="Tooltip, you can change the position." data-rel="tooltip" class="btn btn-warning">Hover for tooltip</a>
    -
    -
    - -
    - -
    -
    -
    -

    Progress Bars

    -
    - - - -
    -
    -
    -

    Basic

    -
    -
    -
    -

    Striped

    -
    -
    -
    -

    Animated

    -
    -
    -
    -

    Additional Colors

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -

    Labels and Annotations

    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    LabelsMarkup
    - Default - - <span class="label">Default</span> -
    - Success - - <span class="label label-success">Success</span> -
    - Warning - - <span class="label label-warning">Warning</span> -
    - Important - - <span class="label label-important">Important</span> -
    - Info - - <span class="label label-info">Info</span> -
    - Inverse - - <span class="label label-inverse">Inverse</span> -
    -
    -
    - -
    -
    -
    -
    -

    Alerts

    -
    - - - -
    -
    -
    -
    - - Oh snap! Change a few things up and try submitting again. -
    -
    - - Well done! You successfully read this important alert message. -
    -
    - - Heads up! This alert needs your attention, but it's not super important. -
    -
    - -

    Warning!

    -

    Best check yo self, you're not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

    -
    -
    -
    - -
    -
    -

    Notifications

    -
    - - - -
    -
    -
    -
    - Click buttons below to see Pop Notifications. -
    -

    - - - - -

    -

    - - -

    - -

    - - -

    - -

    - -

    -
    -
    - -
    -
    -

    Ajax Loaders

    -
    - - - -
    -
    -
    -
      - -
    • - -
    - From / More http://ajaxload.info/ -
    -
    -
    - - - diff --git a/code/ryzom/tools/server/ryzom_ams_docs/doxygen/Doxyfile b/code/ryzom/tools/server/ryzom_ams_docs/doxygen/Doxyfile new file mode 100644 index 000000000..8c4cad40f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/doxygen/Doxyfile @@ -0,0 +1,2312 @@ +# Doxyfile 1.8.5 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "Ryzom Account Management System" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = 1.0 + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify an logo or icon that is included in +# the documentation. The maximum height of the logo should not exceed 55 pixels +# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo +# to the output directory. + +PROJECT_LOGO = logo.png + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = ../ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese- +# Traditional, Croatian, Czech, Danish, Dutch, English, Esperanto, Farsi, +# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en, +# Korean, Korean-en, Latvian, Norwegian, Macedonian, Persian, Polish, +# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, +# Turkish, Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a +# new page for each member. If set to NO, the documentation of a member will be +# part of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. +# +# Note For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by by putting a % sign in front of the word +# or globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO these classes will be included in the various overviews. This option has +# no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the +# todo list. This list is created by putting \todo commands in the +# documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the +# test list. This list is created by putting \test commands in the +# documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES the list +# will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. Do not use file names with spaces, bibtex cannot handle them. See +# also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO doxygen will only warn about wrong or incomplete parameter +# documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. +# Note: If this tag is empty the current directory is searched. + +INPUT = ../../ryzom_ams \ + info.php + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank the +# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, +# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, +# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, +# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, +# *.qsf, *.as and *.js. + +FILE_PATTERNS = *.php + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = ../../ryzom_ams/ams_lib/smarty \ + ../../ryzom_ams/ams_lib/plugins \ + ../../ryzom_ams/www/html/misc \ + ../../ryzom_ams/www/html/templates_c \ + ../../ryzom_ams/drupal + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = Smarty_CacheResource_Apc \ + "Smarty_CacheResource_Memcache " \ + Smarty_CacheResource_Mysql \ + Smarty_Resource_Extendsall \ + Smarty_Resource_Mysql \ + Smarty_Resource_Mysqls \ + Resource \ + CacheResource + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = img + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER ) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES, then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = NO + +# If the CLANG_ASSISTED_PARSING tag is set to YES, then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more acurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# compiled with the --with-libclang option. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- +# defined cascading style sheet that is included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefor more robust against future updates. +# Doxygen will copy the style sheet file to the output directory. For an example +# see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the stylesheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler ( hhc.exe). If non-empty +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated ( +# YES) or that it should be included in the master .chm file ( NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated ( +# YES) or a normal table of contents ( NO) in the .chm file. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using prerendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://www.mathjax.org/mathjax + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /
    "]||(!O.indexOf("
    "]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
    ","
    "]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

    ";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
    ";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0) +{I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
    ").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function() +{G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
    ';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); + +/* + * jQuery hashchange event - v1.3 - 7/21/2010 + * http://benalman.com/projects/jquery-hashchange-plugin/ + * + * Copyright (c) 2010 "Cowboy" Ben Alman + * Dual licensed under the MIT and GPL licenses. + * http://benalman.com/about/license/ + */ +(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$(' +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/logo.png b/code/ryzom/tools/server/ryzom_ams_docs/html/logo.png new file mode 100644 index 000000000..a072d6eaf Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams_docs/html/logo.png differ diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/mail__cron_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/mail__cron_8php.html new file mode 100644 index 000000000..d08742e2a --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/mail__cron_8php.html @@ -0,0 +1,134 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/cron/mail_cron.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/cron/mail_cron.php File Reference
    +
    +
    + + + + +

    +Variables

     $mail_handler = new Mail_Handler()
     This small piece of php code calls the cron() function of the Mail_Handler.
    +

    Variable Documentation

    + +
    +
    + + + + +
    $mail_handler = new Mail_Handler()
    +
    +
    + +

    This small piece of php code calls the cron() function of the Mail_Handler.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/mail__handler_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/mail__handler_8php.html new file mode 100644 index 000000000..51c5ead9e --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/mail__handler_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/mail_handler.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/mail_handler.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Mail_Handler
     Handles the mailing functionality. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/modify__email__of__sgroup_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/modify__email__of__sgroup_8php.html new file mode 100644 index 000000000..12cc4f71b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/modify__email__of__sgroup_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/func/modify_email_of_sgroup.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/func/modify_email_of_sgroup.php File Reference
    +
    +
    + + + + +

    +Functions

     modify_email_of_sgroup ()
     This function is beign used to modify the email related to a support group.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    modify_email_of_sgroup ()
    +
    +
    + +

    This function is beign used to modify the email related to a support group.

    +

    It will first check if the user who executed this function is an admin. If this is not the case the page will be redirected to an error page. the new email will be validated and in case it's valid we'll add it to the db. Before adding it, we will encrypt the password by using the MyCrypt class. Afterwards the password gets updated and the page redirected again.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/mycrypt_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/mycrypt_8php.html new file mode 100644 index 000000000..6c440fabe --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/mycrypt_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/mycrypt.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/mycrypt.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  MyCrypt
     Basic encryption/decryption class. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/nav_f.png b/code/ryzom/tools/server/ryzom_ams_docs/html/nav_f.png new file mode 100644 index 000000000..1b07a1620 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams_docs/html/nav_f.png differ diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/nav_h.png b/code/ryzom/tools/server/ryzom_ams_docs/html/nav_h.png new file mode 100644 index 000000000..01f5fa6a5 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams_docs/html/nav_h.png differ diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/open.png b/code/ryzom/tools/server/ryzom_ams_docs/html/open.png new file mode 100644 index 000000000..7b35d2c2c Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams_docs/html/open.png differ diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/pages.html b/code/ryzom/tools/server/ryzom_ams_docs/html/pages.html new file mode 100644 index 000000000..493c8b632 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/pages.html @@ -0,0 +1,111 @@ + + + + + +Ryzom Account Management System: Related Pages + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + +
    +
    +
    +
    Related Pages
    +
    +
    +
    Here is a list of all related documentation pages:
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/pagination_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/pagination_8php.html new file mode 100644 index 000000000..880e06a36 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/pagination_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/pagination.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/pagination.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Pagination
     Handles returning arrays based on a given pagenumber. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/querycache_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/querycache_8php.html new file mode 100644 index 000000000..0a9593825 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/querycache_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/querycache.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/querycache.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Querycache
     class for storing changes when shard is offline. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/register_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/register_8php.html new file mode 100644 index 000000000..d326886af --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/register_8php.html @@ -0,0 +1,137 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/register.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/register.php File Reference
    +
    +
    + + + + +

    +Functions

     register ()
     This function is beign used to load info that's needed for the register page.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    register ()
    +
    +
    + +

    This function is beign used to load info that's needed for the register page.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/reply__on__ticket_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/reply__on__ticket_8php.html new file mode 100644 index 000000000..aed5249ba --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/reply__on__ticket_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/func/reply_on_ticket.php File Reference
    +
    +
    + + + + +

    +Functions

     reply_on_ticket ()
     This function is beign used to reply on a ticket.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    reply_on_ticket ()
    +
    +
    + +

    This function is beign used to reply on a ticket.

    +

    It will first check if the user who executed this function is a mod/admin or the topic creator himself. If this is not the case the page will be redirected to an error page. in case the isset($_POST['hidden'] is set and the user is a mod, the message will be hidden for the topic starter. The reply will be created. If $_POST['ChangeStatus']) & $_POST['ChangePriority'] is set it will try to update the status and priority. Afterwards the page is being redirecte to the ticket again.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_24.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_24.html new file mode 100644 index 000000000..476d13496 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_24.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_24.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_24.js new file mode 100644 index 000000000..8e8a493e9 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_24.js @@ -0,0 +1,91 @@ +var searchData= +[ + ['_24allow_5funknown',['$ALLOW_UNKNOWN',['../drupal__module_2ryzommanage_2config_8php.html#a384355265e4331097d55252f901eddff',1,'$ALLOW_UNKNOWN(): config.php'],['../www_2config_8php.html#a384355265e4331097d55252f901eddff',1,'$ALLOW_UNKNOWN(): config.php']]], + ['_24amountofrows',['$amountOfRows',['../classPagination.html#a6b5c716eec440d8dc5b9754c53c545ec',1,'Pagination']]], + ['_24ams_5fcachedir',['$AMS_CACHEDIR',['../drupal__module_2ryzommanage_2config_8php.html#a92879a931e7a7d0ae6919e70a1529747',1,'$AMS_CACHEDIR(): config.php'],['../www_2config_8php.html#a92879a931e7a7d0ae6919e70a1529747',1,'$AMS_CACHEDIR(): config.php']]], + ['_24ams_5flib',['$AMS_LIB',['../drupal__module_2ryzommanage_2config_8php.html#a75086b9c8602bf3417773bae7ef0cdc8',1,'$AMS_LIB(): config.php'],['../www_2config_8php.html#a75086b9c8602bf3417773bae7ef0cdc8',1,'$AMS_LIB(): config.php']]], + ['_24ams_5ftrans',['$AMS_TRANS',['../drupal__module_2ryzommanage_2config_8php.html#acc96a0076127356b4f9f00f4bdfa9b65',1,'$AMS_TRANS(): config.php'],['../www_2config_8php.html#acc96a0076127356b4f9f00f4bdfa9b65',1,'$AMS_TRANS(): config.php']]], + ['_24author',['$author',['../classTicket.html#ac35b828f7d4064a7c9f849c255468ee3',1,'Ticket\$author()'],['../classTicket__Log.html#ac35b828f7d4064a7c9f849c255468ee3',1,'Ticket_Log\$author()'],['../classTicket__Reply.html#ac35b828f7d4064a7c9f849c255468ee3',1,'Ticket_Reply\$author()']]], + ['_24base_5fwebpath',['$BASE_WEBPATH',['../drupal__module_2ryzommanage_2config_8php.html#a2e954ee09fb5f52b9d05caf9dfc3d5ad',1,'$BASE_WEBPATH(): config.php'],['../www_2config_8php.html#a2e954ee09fb5f52b9d05caf9dfc3d5ad',1,'$BASE_WEBPATH(): config.php']]], + ['_24cfg',['$cfg',['../drupal__module_2ryzommanage_2config_8php.html#a32f90fc68bcb40de0bae38354fd0a5fe',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a6b776651fa7defe140c03ed3bd86aa96',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a68f172c430a17022c9f74ae1acd24a00',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a1805c74760836f682459a12a17d50589',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a94213b6df61b8a6b62abbe7c956493a4',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a4b555022064138fee1d7edea873c5e9e',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a1b49c1f0de42e603443bea2c93276c13',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a7c5f3fd8aea7ae8363c6cdc9addd9b62',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a7b5bbf5b3c541b46d06deaffeeb76424',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a1dca44c652dd54f6879957cf8d4a039c',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a56e7e53dac48b99f62d41d387c8624e6',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#adc2648938b5135f1f2aab1d92d33418e',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a1324eeda6b288c0a26d7071db555090c',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a63d97fffb2ff86525bb6cacb74113a73',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a7147f422b8150cd3f3c8a68325208607',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a53f42728714b4e86b885c12f7846cd06',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#aa68c438d0b6b38d756d8724bac554f1b',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#ae4ae1095a3543d5607464a88e6330a07',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a7cf20f61de759c233272150b12e866d8',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#aed7bed5da2b934c742cb60d23c06f752',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a1606e0620d5a628b865e0df5c217ce7e',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a41e3a386ec52e0f05bdcad04acecf619',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#ac2c263a1e16ebd69dbf247e8d82c9f63',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a9996bf49f150442cf9d564725d0dea24',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#aa7eb09eb019c344553a61b54606cb650',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a79b711e7ee81b7435a8dba7cb132b34a',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a8578ffa00c2dbcf5d34a97bcff79058b',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a50d80d35dbd37739f844a93a36fce557',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a55031a1c3c2b9d87e37558811b311ff8',1,'$cfg(): config.php'],['../www_2config_8php.html#a32f90fc68bcb40de0bae38354fd0a5fe',1,'$cfg(): config.php'],['../www_2config_8php.html#a6b776651fa7defe140c03ed3bd86aa96',1,'$cfg(): config.php'],['../www_2config_8php.html#a68f172c430a17022c9f74ae1acd24a00',1,'$cfg(): config.php'],['../www_2config_8php.html#a1805c74760836f682459a12a17d50589',1,'$cfg(): config.php'],['../www_2config_8php.html#a94213b6df61b8a6b62abbe7c956493a4',1,'$cfg(): config.php'],['../www_2config_8php.html#a4b555022064138fee1d7edea873c5e9e',1,'$cfg(): config.php'],['../www_2config_8php.html#a1b49c1f0de42e603443bea2c93276c13',1,'$cfg(): config.php'],['../www_2config_8php.html#a7c5f3fd8aea7ae8363c6cdc9addd9b62',1,'$cfg(): config.php'],['../www_2config_8php.html#a7b5bbf5b3c541b46d06deaffeeb76424',1,'$cfg(): config.php'],['../www_2config_8php.html#a1dca44c652dd54f6879957cf8d4a039c',1,'$cfg(): config.php'],['../www_2config_8php.html#a56e7e53dac48b99f62d41d387c8624e6',1,'$cfg(): config.php'],['../www_2config_8php.html#adc2648938b5135f1f2aab1d92d33418e',1,'$cfg(): config.php'],['../www_2config_8php.html#a1324eeda6b288c0a26d7071db555090c',1,'$cfg(): config.php'],['../www_2config_8php.html#a63d97fffb2ff86525bb6cacb74113a73',1,'$cfg(): config.php'],['../www_2config_8php.html#a7147f422b8150cd3f3c8a68325208607',1,'$cfg(): config.php'],['../www_2config_8php.html#a53f42728714b4e86b885c12f7846cd06',1,'$cfg(): config.php'],['../www_2config_8php.html#aa68c438d0b6b38d756d8724bac554f1b',1,'$cfg(): config.php'],['../www_2config_8php.html#ae4ae1095a3543d5607464a88e6330a07',1,'$cfg(): config.php'],['../www_2config_8php.html#a7cf20f61de759c233272150b12e866d8',1,'$cfg(): config.php'],['../www_2config_8php.html#aed7bed5da2b934c742cb60d23c06f752',1,'$cfg(): config.php'],['../www_2config_8php.html#a1606e0620d5a628b865e0df5c217ce7e',1,'$cfg(): config.php'],['../www_2config_8php.html#a41e3a386ec52e0f05bdcad04acecf619',1,'$cfg(): config.php'],['../www_2config_8php.html#ac2c263a1e16ebd69dbf247e8d82c9f63',1,'$cfg(): config.php'],['../www_2config_8php.html#a9996bf49f150442cf9d564725d0dea24',1,'$cfg(): config.php'],['../www_2config_8php.html#aa7eb09eb019c344553a61b54606cb650',1,'$cfg(): config.php'],['../www_2config_8php.html#a79b711e7ee81b7435a8dba7cb132b34a',1,'$cfg(): config.php'],['../www_2config_8php.html#a8578ffa00c2dbcf5d34a97bcff79058b',1,'$cfg(): config.php'],['../www_2config_8php.html#a50d80d35dbd37739f844a93a36fce557',1,'$cfg(): config.php'],['../www_2config_8php.html#a55031a1c3c2b9d87e37558811b311ff8',1,'$cfg(): config.php'],['../install_8php.html#a449cc4bf6cfd310810993b3ef5251aa5',1,'$cfg(): install.php']]], + ['_24client_5fversion',['$client_version',['../classTicket__Info.html#ac43fbb88dcd0696ad49d5f805f369a61',1,'Ticket_Info']]], + ['_24config',['$config',['../classMyCrypt.html#a49c7011be9c979d9174c52a8b83e5d8e',1,'MyCrypt']]], + ['_24config_5fpath',['$CONFIG_PATH',['../drupal__module_2ryzommanage_2config_8php.html#ae15921e2ebd5885ecf37d31a2cf6ab7a',1,'$CONFIG_PATH(): config.php'],['../www_2config_8php.html#ae15921e2ebd5885ecf37d31a2cf6ab7a',1,'$CONFIG_PATH(): config.php']]], + ['_24connect_5fstate',['$connect_state',['../classTicket__Info.html#a33f4c9badf7f0c5c6728bba0ffacd66e',1,'Ticket_Info']]], + ['_24content',['$content',['../classTicket__Content.html#a57b284fe00866494b33afa80ba729bed',1,'Ticket_Content\$content()'],['../classTicket__Reply.html#a57b284fe00866494b33afa80ba729bed',1,'Ticket_Reply\$content()']]], + ['_24country',['$country',['../classWebUsers.html#a1437a5f6eb157f0eb267a26e0ad4f1ba',1,'WebUsers']]], + ['_24cpu_5fid',['$cpu_id',['../classTicket__Info.html#abea88d0d04f0d548115a0e85eef42e42',1,'Ticket_Info']]], + ['_24cpu_5fmask',['$cpu_mask',['../classTicket__Info.html#a9b0c63551b567630d1aa82f33c328ab0',1,'Ticket_Info']]], + ['_24create_5fring',['$CREATE_RING',['../drupal__module_2ryzommanage_2config_8php.html#a16031d9d4e5065229bc3b00dfd4202fa',1,'$CREATE_RING(): config.php'],['../www_2config_8php.html#a16031d9d4e5065229bc3b00dfd4202fa',1,'$CREATE_RING(): config.php']]], + ['_24current',['$current',['../classPagination.html#a2c4c58e377f6c66ca38c8ea97666fc5e',1,'Pagination']]], + ['_24db',['$db',['../classMail__Handler.html#a1fa3127fc82f96b1436d871ef02be319',1,'Mail_Handler\$db()'],['../classQuerycache.html#a1fa3127fc82f96b1436d871ef02be319',1,'Querycache\$db()']]], + ['_24default_5flanguage',['$DEFAULT_LANGUAGE',['../drupal__module_2ryzommanage_2config_8php.html#a7b56c2ed5a82ceb21fc73cef77beb150',1,'$DEFAULT_LANGUAGE(): config.php'],['../www_2config_8php.html#a7b56c2ed5a82ceb21fc73cef77beb150',1,'$DEFAULT_LANGUAGE(): config.php']]], + ['_24element_5farray',['$element_array',['../classPagination.html#a8fa0f6a15481ba69e7be913eaa15594c',1,'Pagination']]], + ['_24email',['$email',['../classWebUsers.html#ad634f418b20382e2802f80532d76d3cd',1,'WebUsers']]], + ['_24externid',['$externId',['../classTicket__User.html#af51400fe5820e964cb38fcc60b3afd84',1,'Ticket_User']]], + ['_24firstname',['$firstname',['../classWebUsers.html#a55793c72c535d153ffd3f0e43377898b',1,'WebUsers']]], + ['_24force_5fingame',['$FORCE_INGAME',['../drupal__module_2ryzommanage_2config_8php.html#aabd939b29ed900f5fc489f1a957fc6ce',1,'$FORCE_INGAME(): config.php'],['../www_2config_8php.html#aabd939b29ed900f5fc489f1a957fc6ce',1,'$FORCE_INGAME(): config.php']]], + ['_24gender',['$gender',['../classWebUsers.html#a0f1d7cfb9dc6f494b9014885205fc47e',1,'WebUsers']]], + ['_24group',['$group',['../classForwarded.html#ad530a85733b0ec1dc321859fd8faa0dc',1,'Forwarded\$group()'],['../classIn__Support__Group.html#ad530a85733b0ec1dc321859fd8faa0dc',1,'In_Support_Group\$group()']]], + ['_24groupemail',['$groupEmail',['../classSupport__Group.html#ab7ad611af238b28f1f65a32cb152acd1',1,'Support_Group']]], + ['_24hidden',['$hidden',['../classTicket__Reply.html#a4a374564d2858d8ae869a8fb890aad56',1,'Ticket_Reply']]], + ['_24ht',['$ht',['../classTicket__Info.html#a969583a6605ed731abf5849a5202db1e',1,'Ticket_Info']]], + ['_24imageloc_5fwebpath',['$IMAGELOC_WEBPATH',['../drupal__module_2ryzommanage_2config_8php.html#a16820074dcd11e4881ca6461377db000',1,'$IMAGELOC_WEBPATH(): config.php'],['../www_2config_8php.html#a16820074dcd11e4881ca6461377db000',1,'$IMAGELOC_WEBPATH(): config.php']]], + ['_24imap_5fmailserver',['$iMAP_MailServer',['../classSupport__Group.html#ad9f2ef2089fe446a9ac49a19a450d636',1,'Support_Group']]], + ['_24imap_5fpassword',['$iMAP_Password',['../classSupport__Group.html#a4166a2fc4b594ee425d7f40870e16455',1,'Support_Group']]], + ['_24imap_5fusername',['$iMAP_Username',['../classSupport__Group.html#a2b549eb4d5773efd741a2990817af0ea',1,'Support_Group']]], + ['_24ingame_5flayout',['$INGAME_LAYOUT',['../drupal__module_2ryzommanage_2config_8php.html#a0deedf69fea8c97030373e15a68c4cc5',1,'$INGAME_LAYOUT(): config.php'],['../www_2config_8php.html#a0deedf69fea8c97030373e15a68c4cc5',1,'$INGAME_LAYOUT(): config.php']]], + ['_24ingame_5fwebpath',['$INGAME_WEBPATH',['../drupal__module_2ryzommanage_2config_8php.html#ae9f6aa9c61501bca7b8851925c636d87',1,'$INGAME_WEBPATH(): config.php'],['../www_2config_8php.html#ae9f6aa9c61501bca7b8851925c636d87',1,'$INGAME_WEBPATH(): config.php']]], + ['_24language',['$language',['../classWebUsers.html#a83170d318260a5a2e2a79dccdd371b10',1,'WebUsers']]], + ['_24last',['$last',['../classPagination.html#acf48db609a946d13953d8060363fd1d3',1,'Pagination']]], + ['_24lastname',['$lastname',['../classWebUsers.html#a1d2ddb6354180329b59e8b90ed94dc7f',1,'WebUsers']]], + ['_24local_5faddress',['$local_address',['../classTicket__Info.html#a467dca5673d4c9f737dac972ab05720c',1,'Ticket_Info']]], + ['_24login',['$login',['../classWebUsers.html#afc31993e855f9631572adfedcfe6f34b',1,'WebUsers']]], + ['_24mail_5fdir',['$MAIL_DIR',['../drupal__module_2ryzommanage_2config_8php.html#a9f8fc644554910de5434f78a5f23044e',1,'$MAIL_DIR(): config.php'],['../www_2config_8php.html#a9f8fc644554910de5434f78a5f23044e',1,'$MAIL_DIR(): config.php']]], + ['_24mail_5fhandler',['$mail_handler',['../mail__cron_8php.html#a160a75d95407d877e9c2542e3ddd8c43',1,'mail_cron.php']]], + ['_24mail_5flog_5fpath',['$MAIL_LOG_PATH',['../drupal__module_2ryzommanage_2config_8php.html#afe6e9ed40480c14cb7a119fb84cb557a',1,'$MAIL_LOG_PATH(): config.php'],['../www_2config_8php.html#afe6e9ed40480c14cb7a119fb84cb557a',1,'$MAIL_LOG_PATH(): config.php']]], + ['_24memory',['$memory',['../classTicket__Info.html#a5e20a9a3e12271b3b8d685805590c9e0',1,'Ticket_Info']]], + ['_24name',['$name',['../classSupport__Group.html#ab2fc40d43824ea3e1ce5d86dee0d763b',1,'Support_Group\$name()'],['../classTicket__Category.html#ab2fc40d43824ea3e1ce5d86dee0d763b',1,'Ticket_Category\$name()']]], + ['_24nel3d',['$nel3d',['../classTicket__Info.html#a9b616e5fbafadc93aa4bdf3ccbf31498',1,'Ticket_Info']]], + ['_24os',['$os',['../classTicket__Info.html#a292791d5d8e3ded85cb2e8ec80dea0d9',1,'Ticket_Info']]], + ['_24pagination',['$pagination',['../classTicket__Queue__Handler.html#a388a4a950e936f746d3b9c1b56450ce7',1,'Ticket_Queue_Handler']]], + ['_24params',['$params',['../classTicket__Queue.html#afe68e6fbe7acfbffc0af0c84a1996466',1,'Ticket_Queue']]], + ['_24patch_5fversion',['$patch_version',['../classTicket__Info.html#a55fc0854f90ed36ab9774ba7bd2af53f',1,'Ticket_Info']]], + ['_24pdo',['$PDO',['../classDBLayer.html#acdb2149c05a21fe144fb05ec524a51f3',1,'DBLayer']]], + ['_24permission',['$permission',['../classTicket__User.html#aad04b6f3304fe6a13d5be37f7cd28938',1,'Ticket_User']]], + ['_24priority',['$priority',['../classTicket.html#a2677e505e860db863720ac4e216fd3f2',1,'Ticket']]], + ['_24processor',['$processor',['../classTicket__Info.html#a11fe8ad69d64b596f8b712b0b7e7e1e3',1,'Ticket_Info']]], + ['_24query',['$query',['../classQuerycache.html#af59a5f7cd609e592c41dc3643efd3c98',1,'Querycache\$query()'],['../classTicket__Log.html#af59a5f7cd609e592c41dc3643efd3c98',1,'Ticket_Log\$query()'],['../classTicket__Queue.html#af59a5f7cd609e592c41dc3643efd3c98',1,'Ticket_Queue\$query()']]], + ['_24queue',['$queue',['../classTicket.html#a4a0b48f6ae2fcb248a4f0288c7c344a6',1,'Ticket\$queue()'],['../classTicket__Queue__Handler.html#a4a0b48f6ae2fcb248a4f0288c7c344a6',1,'Ticket_Queue_Handler\$queue()']]], + ['_24receivemail',['$receiveMail',['../classWebUsers.html#a3c74ba660e348124f36d978b137f691d',1,'WebUsers']]], + ['_24server_5ftick',['$server_tick',['../classTicket__Info.html#aeac33ccad750e9ee81a22414db1224ab',1,'Ticket_Info']]], + ['_24sgroupid',['$sGroupId',['../classSupport__Group.html#a23265908fce0f131e03ba1ede7f42647',1,'Support_Group']]], + ['_24shardid',['$shardid',['../classTicket__Info.html#ac73283a0a8308fb7594543e4a049942c',1,'Ticket_Info']]], + ['_24sid',['$SID',['../classQuerycache.html#a69c31f890638fa4930097cf55ae27995',1,'Querycache']]], + ['_24sitebase',['$SITEBASE',['../drupal__module_2ryzommanage_2config_8php.html#a9eb41824afc2b8150c27648859f07357',1,'$SITEBASE(): config.php'],['../www_2config_8php.html#a9eb41824afc2b8150c27648859f07357',1,'$SITEBASE(): config.php']]], + ['_24status',['$status',['../classTicket.html#a58391ea75f2d29d5d708d7050b641c33',1,'Ticket']]], + ['_24support_5fgroup_5fimap_5fcryptkey',['$SUPPORT_GROUP_IMAP_CRYPTKEY',['../drupal__module_2ryzommanage_2config_8php.html#a3ed2ac4433023af3e95f8912f00125ea',1,'$SUPPORT_GROUP_IMAP_CRYPTKEY(): config.php'],['../www_2config_8php.html#a3ed2ac4433023af3e95f8912f00125ea',1,'$SUPPORT_GROUP_IMAP_CRYPTKEY(): config.php']]], + ['_24tag',['$tag',['../classSupport__Group.html#a81d5015d41ed8ec66e9db8cdc5db9555',1,'Support_Group']]], + ['_24tcategoryid',['$tCategoryId',['../classTicket__Category.html#a0111df4559c9f524272d94df0b7f9d6b',1,'Ticket_Category']]], + ['_24tcontentid',['$tContentId',['../classTicket__Content.html#a2249787a24edd706ae7a54609a601d6f',1,'Ticket_Content']]], + ['_24ticket',['$ticket',['../classAssigned.html#abf7832c7c53a3be2ca8a8fc305006bb0',1,'Assigned\$ticket()'],['../classForwarded.html#abf7832c7c53a3be2ca8a8fc305006bb0',1,'Forwarded\$ticket()'],['../classTicket__Info.html#abf7832c7c53a3be2ca8a8fc305006bb0',1,'Ticket_Info\$ticket()'],['../classTicket__Log.html#abf7832c7c53a3be2ca8a8fc305006bb0',1,'Ticket_Log\$ticket()'],['../classTicket__Reply.html#abf7832c7c53a3be2ca8a8fc305006bb0',1,'Ticket_Reply\$ticket()']]], + ['_24ticket_5fcategory',['$ticket_category',['../classTicket.html#a86e470072892575063c478122fb65184',1,'Ticket']]], + ['_24ticket_5flogging',['$TICKET_LOGGING',['../drupal__module_2ryzommanage_2config_8php.html#aa59491d29009336d89423cccd3adc5de',1,'$TICKET_LOGGING(): config.php'],['../www_2config_8php.html#aa59491d29009336d89423cccd3adc5de',1,'$TICKET_LOGGING(): config.php']]], + ['_24ticket_5fmailing_5fsupport',['$TICKET_MAILING_SUPPORT',['../drupal__module_2ryzommanage_2config_8php.html#a23c3d413e56a57bc04d69627a4ed2b14',1,'$TICKET_MAILING_SUPPORT(): config.php'],['../www_2config_8php.html#a23c3d413e56a57bc04d69627a4ed2b14',1,'$TICKET_MAILING_SUPPORT(): config.php']]], + ['_24tid',['$tId',['../classTicket.html#a3eda2fecc2433b6b6b3b957110e937ca',1,'Ticket']]], + ['_24time_5fformat',['$TIME_FORMAT',['../drupal__module_2ryzommanage_2config_8php.html#a613b2c043c06772e7119587b26eb9989',1,'$TIME_FORMAT(): config.php'],['../www_2config_8php.html#a613b2c043c06772e7119587b26eb9989',1,'$TIME_FORMAT(): config.php']]], + ['_24timestamp',['$timestamp',['../classTicket.html#a2b69de9676dd97c675cd4d9bcceb684c',1,'Ticket\$timestamp()'],['../classTicket__Log.html#a2b69de9676dd97c675cd4d9bcceb684c',1,'Ticket_Log\$timestamp()'],['../classTicket__Reply.html#a2b69de9676dd97c675cd4d9bcceb684c',1,'Ticket_Reply\$timestamp()']]], + ['_24tinfoid',['$tInfoId',['../classTicket__Info.html#a4c2ae13b7827d13b9629e3fc57335f8f',1,'Ticket_Info']]], + ['_24title',['$title',['../classTicket.html#ada57e7bb7c152edad18fe2f166188691',1,'Ticket']]], + ['_24tlogid',['$tLogId',['../classTicket__Log.html#a734657bd8aac85b5a33e03646c17eb65',1,'Ticket_Log']]], + ['_24tos_5furl',['$TOS_URL',['../drupal__module_2ryzommanage_2config_8php.html#aef688ce4c627fa2fbd8037fd2cceef78',1,'$TOS_URL(): config.php'],['../www_2config_8php.html#aef688ce4c627fa2fbd8037fd2cceef78',1,'$TOS_URL(): config.php']]], + ['_24treplyid',['$tReplyId',['../classTicket__Reply.html#a29f22c2783e510d4764a99a648a0cc36',1,'Ticket_Reply']]], + ['_24tuserid',['$tUserId',['../classTicket__User.html#a2f1828693b198682ae3e926e63a4c110',1,'Ticket_User']]], + ['_24type',['$type',['../classQuerycache.html#a9a4a6fba2208984cabb3afacadf33919',1,'Querycache']]], + ['_24uid',['$uId',['../classWebUsers.html#a8f11c60ae8f70a5059b97bc0ea9d0de5',1,'WebUsers']]], + ['_24user',['$user',['../classAssigned.html#a598ca4e71b15a1313ec95f0df1027ca5',1,'Assigned\$user()'],['../classIn__Support__Group.html#a598ca4e71b15a1313ec95f0df1027ca5',1,'In_Support_Group\$user()']]], + ['_24user_5fid',['$user_id',['../classTicket__Info.html#af0fcd925f00973e32f7214859dfb3c6b',1,'Ticket_Info']]], + ['_24user_5fposition',['$user_position',['../classTicket__Info.html#afc9fcd144a71e56898632daf43854aa7',1,'Ticket_Info']]], + ['_24view_5fposition',['$view_position',['../classTicket__Info.html#ae325cbe2a7e27757b90b12d595c4dfe9',1,'Ticket_Info']]], + ['_24webpath',['$WEBPATH',['../drupal__module_2ryzommanage_2config_8php.html#a562d30b98806af1e001a3ff855e8890a',1,'$WEBPATH(): config.php'],['../www_2config_8php.html#a562d30b98806af1e001a3ff855e8890a',1,'$WEBPATH(): config.php']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_5f.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_5f.html new file mode 100644 index 000000000..1f27755ab --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_5f.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_5f.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_5f.js new file mode 100644 index 000000000..844048eb7 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_5f.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['_5f_5fautoload',['__autoload',['../libinclude_8php.html#a2ecfde85f554ea0b3fef0993aef304a9',1,'libinclude.php']]], + ['_5f_5fconstruct',['__construct',['../classAssigned.html#a095c5d389db211932136b53f25f39685',1,'Assigned\__construct()'],['../classDBLayer.html#a800f8efee13692788b13ee57c5960092',1,'DBLayer\__construct()'],['../classForwarded.html#a095c5d389db211932136b53f25f39685',1,'Forwarded\__construct()'],['../classIn__Support__Group.html#a095c5d389db211932136b53f25f39685',1,'In_Support_Group\__construct()'],['../classMyCrypt.html#af200cbfd49bfea2fecf5629ab2361033',1,'MyCrypt\__construct()'],['../classPagination.html#a2a1aecb8f526796b3d62e8278edc07c3',1,'Pagination\__construct()'],['../classQuerycache.html#a095c5d389db211932136b53f25f39685',1,'Querycache\__construct()'],['../classSupport__Group.html#a095c5d389db211932136b53f25f39685',1,'Support_Group\__construct()'],['../classTicket.html#a095c5d389db211932136b53f25f39685',1,'Ticket\__construct()'],['../classTicket__Category.html#a095c5d389db211932136b53f25f39685',1,'Ticket_Category\__construct()'],['../classTicket__Content.html#a095c5d389db211932136b53f25f39685',1,'Ticket_Content\__construct()'],['../classTicket__Info.html#a095c5d389db211932136b53f25f39685',1,'Ticket_Info\__construct()'],['../classTicket__Log.html#a095c5d389db211932136b53f25f39685',1,'Ticket_Log\__construct()'],['../classTicket__Queue__Handler.html#a095c5d389db211932136b53f25f39685',1,'Ticket_Queue_Handler\__construct()'],['../classTicket__Reply.html#a095c5d389db211932136b53f25f39685',1,'Ticket_Reply\__construct()'],['../classTicket__User.html#a095c5d389db211932136b53f25f39685',1,'Ticket_User\__construct()'],['../classWebUsers.html#a4e63742e531873e01e1e97dd7530539b',1,'WebUsers\__construct($UId=0)'],['../classWebUsers.html#a4e63742e531873e01e1e97dd7530539b',1,'WebUsers\__construct($UId=0)']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_61.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_61.html new file mode 100644 index 000000000..a3164d553 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_61.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_61.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_61.js new file mode 100644 index 000000000..a077db22c --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_61.js @@ -0,0 +1,13 @@ +var searchData= +[ + ['add_5fsgroup',['add_sgroup',['../add__sgroup_8php.html#a45490c056bdd114ef28893fc29286d2b',1,'add_sgroup.php']]], + ['add_5fsgroup_2ephp',['add_sgroup.php',['../add__sgroup_8php.html',1,'']]], + ['add_5fuser',['add_user',['../add__user_8php.html#a69e8de25de7560db0292bb474882a489',1,'add_user.php']]], + ['add_5fuser_2ephp',['add_user.php',['../add__user_8php.html',1,'']]], + ['add_5fuser_5fto_5fsgroup',['add_user_to_sgroup',['../add__user__to__sgroup_8php.html#a6ad0c5a1bfd563e11a107bf0023b6150',1,'add_user_to_sgroup.php']]], + ['add_5fuser_5fto_5fsgroup_2ephp',['add_user_to_sgroup.php',['../add__user__to__sgroup_8php.html',1,'']]], + ['addusertosupportgroup',['addUserToSupportGroup',['../classSupport__Group.html#a4616317379ffef08dbaeea2a9dbba02c',1,'Support_Group']]], + ['assigned',['Assigned',['../classAssigned.html',1,'']]], + ['assigned_2ephp',['assigned.php',['../assigned_8php.html',1,'']]], + ['assignticket',['assignTicket',['../classAssigned.html#a51c3d5b6f78de455619581fd3e591f17',1,'Assigned\assignTicket()'],['../classTicket.html#a51c3d5b6f78de455619581fd3e591f17',1,'Ticket\assignTicket()']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_63.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_63.html new file mode 100644 index 000000000..56b5ad1e9 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_63.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_63.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_63.js new file mode 100644 index 000000000..c54f2f697 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_63.js @@ -0,0 +1,51 @@ +var searchData= +[ + ['change_5finfo',['change_info',['../change__info_8php.html#a1bbc74a7da07012d55b0b45726534265',1,'change_info.php']]], + ['change_5finfo_2ephp',['change_info.php',['../change__info_8php.html',1,'']]], + ['change_5fmail',['change_mail',['../change__mail_8php.html#a03d0bca67a96c8744bd74623e128ab83',1,'change_mail.php']]], + ['change_5fmail_2ephp',['change_mail.php',['../change__mail_8php.html',1,'']]], + ['change_5fpassword',['change_password',['../change__password_8php.html#a888360ab43db15eba1d5cc3623d4100f',1,'change_password.php']]], + ['change_5fpassword_2ephp',['change_password.php',['../change__password_8php.html',1,'']]], + ['change_5fpermission',['change_permission',['../classTicket__User.html#a78d4d6de74b1ee26cb9192f36e022416',1,'Ticket_User\change_permission()'],['../change__permission_8php.html#a9ad639fafd67bdc579cf3170cd0d26e7',1,'change_permission(): change_permission.php']]], + ['change_5fpermission_2ephp',['change_permission.php',['../change__permission_8php.html',1,'']]], + ['change_5freceivemail',['change_receivemail',['../change__receivemail_8php.html#a22ae748f60d7b4200dce30c94a52c421',1,'change_receivemail.php']]], + ['change_5freceivemail_2ephp',['change_receivemail.php',['../change__receivemail_8php.html',1,'']]], + ['check_5fchange_5fpassword',['check_change_password',['../classUsers.html#a9c78408d50465957eeb8068810315a8e',1,'Users']]], + ['check_5fif_5fgame_5fclient',['check_if_game_client',['../classHelpers.html#a4e3e5309a66456d81a1effdabcc9cd79',1,'Helpers']]], + ['check_5flogin_5fingame',['check_login_ingame',['../classHelpers.html#abd01528a1145831a4fc98eae7ffaca36',1,'Helpers']]], + ['check_5fmethods',['check_methods',['../classMyCrypt.html#ad72fefc790b0bb1ac6edc252427b0970',1,'MyCrypt']]], + ['check_5fregister',['check_Register',['../classUsers.html#a740de04dc3aa7cf3bed959540ffab8f8',1,'Users']]], + ['checkemail',['checkEmail',['../classUsers.html#a76646237ab053cdde386c06aa5437d8a',1,'Users']]], + ['checkemailexists',['checkEmailExists',['../classUsers.html#a37275e677004927b6b1a30e16c5b5b38',1,'Users\checkEmailExists()'],['../classWebUsers.html#a37275e677004927b6b1a30e16c5b5b38',1,'WebUsers\checkEmailExists($email)'],['../classWebUsers.html#a37275e677004927b6b1a30e16c5b5b38',1,'WebUsers\checkEmailExists($email)']]], + ['checkloginmatch',['checkLoginMatch',['../classUsers.html#af0b98012abb190cf4617999f008de27e',1,'Users\checkLoginMatch()'],['../classWebUsers.html#a11894eb69bb2f172baf5186e8f92246d',1,'WebUsers\checkLoginMatch($username, $password)'],['../classWebUsers.html#a11894eb69bb2f172baf5186e8f92246d',1,'WebUsers\checkLoginMatch($username, $password)']]], + ['checkpassword',['checkPassword',['../classUsers.html#a4cb5e34b56fb6de0ec318fb59e90838f',1,'Users']]], + ['checkuser',['checkUser',['../classUsers.html#adfffce17947a9f72d68838db250c9ab8',1,'Users']]], + ['checkusernameexists',['checkUserNameExists',['../classUsers.html#ac3a8cb9a038f6aef0bd98be091274122',1,'Users\checkUserNameExists()'],['../classWebUsers.html#ac3a8cb9a038f6aef0bd98be091274122',1,'WebUsers\checkUserNameExists($username)'],['../classWebUsers.html#ac3a8cb9a038f6aef0bd98be091274122',1,'WebUsers\checkUserNameExists($username)']]], + ['config_2ephp',['config.php',['../www_2config_8php.html',1,'']]], + ['config_2ephp',['config.php',['../drupal__module_2ryzommanage_2config_8php.html',1,'']]], + ['confirmpassword',['confirmPassword',['../classUsers.html#a2f5349025bed3874f08d80652cab2fe0',1,'Users']]], + ['constr_5fexternid',['constr_ExternId',['../classTicket__User.html#a4e5c577ed0a9da4b1c56397912f02ba0',1,'Ticket_User']]], + ['constr_5fsgroupid',['constr_SGroupId',['../classSupport__Group.html#a873beb80bd0b5d572704cdb6d2ec34eb',1,'Support_Group']]], + ['constr_5ftcategoryid',['constr_TCategoryId',['../classTicket__Category.html#a332d2dd59b46fc933a3c9a1b2967803a',1,'Ticket_Category']]], + ['constr_5ftcontentid',['constr_TContentId',['../classTicket__Content.html#aa28ad9a063c1914ff75d19afd25c707f',1,'Ticket_Content']]], + ['constr_5ftlogid',['constr_TLogId',['../classTicket__Log.html#a001ec13f64bb026b1c8a3b3bd02ee22b',1,'Ticket_Log']]], + ['constr_5ftreplyid',['constr_TReplyId',['../classTicket__Reply.html#a4b4493d28e8518a87667d285c49e5e24',1,'Ticket_Reply']]], + ['constr_5ftuserid',['constr_TUserId',['../classTicket__User.html#a10939bce9b667f26d3827993b4e3df1d',1,'Ticket_User']]], + ['create',['create',['../classAssigned.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Assigned\create()'],['../classForwarded.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Forwarded\create()'],['../classIn__Support__Group.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'In_Support_Group\create()'],['../classSupport__Group.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Support_Group\create()'],['../classTicket.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Ticket\create()'],['../classTicket__Content.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Ticket_Content\create()'],['../classTicket__Info.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Ticket_Info\create()'],['../classTicket__Reply.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Ticket_Reply\create()']]], + ['create_5ffolders',['create_folders',['../classHelpers.html#add8ef9ce82106c505f6f04c2a8e3b2b4',1,'Helpers']]], + ['create_5fticket',['create_Ticket',['../classTicket.html#a81b3285033bc3c9e89adfa8da34d61de',1,'Ticket\create_Ticket()'],['../create__ticket_8php.html#a65bcbfccf737c72927d15c06783cd9f4',1,'create_ticket(): create_ticket.php']]], + ['create_5fticket_2ephp',['create_ticket.php',['../create__ticket_8php.html',1,'']]], + ['create_5fticket_5finfo',['create_Ticket_Info',['../classTicket__Info.html#aaa4e26c92338b70e874135af9c02bba9',1,'Ticket_Info']]], + ['createlogentry',['createLogEntry',['../classTicket__Log.html#a345a2da9c23780c7e6aef7134baa1749',1,'Ticket_Log']]], + ['createpermissions',['createPermissions',['../classUsers.html#aeac9f32fd53c97c92e5c774e154399df',1,'Users']]], + ['createqueue',['createQueue',['../classTicket__Queue.html#af077496b6071af47c19a873bf025c1f3',1,'Ticket_Queue\createQueue()'],['../classTicket__Queue__Handler.html#af077496b6071af47c19a873bf025c1f3',1,'Ticket_Queue_Handler\createQueue()']]], + ['createreply',['createReply',['../classTicket.html#af6568341f5052034440f79c0e74707a3',1,'Ticket\createReply()'],['../classTicket__Reply.html#aa6fa056fff4ddafc3eabf3ed72143e1b',1,'Ticket_Reply\createReply()']]], + ['createsupportgroup',['createSupportGroup',['../classSupport__Group.html#a31ee7c68c0ffb77438bb9ff095962568',1,'Support_Group']]], + ['createticket',['createticket',['../createticket_8php.html#aa8253d883a3ba14c6449a13ed2bb9c8f',1,'createticket.php']]], + ['createticket_2ephp',['createticket.php',['../createticket_8php.html',1,'']]], + ['createticketcategory',['createTicketCategory',['../classTicket__Category.html#a506fc7f32de9547e91a5dbb68c391907',1,'Ticket_Category']]], + ['createticketuser',['createTicketUser',['../classTicket__User.html#a37c416f7d3723874f3ac49c7f9f5a21c',1,'Ticket_User']]], + ['createuser',['createUser',['../classUsers.html#ac93aebf1960fb12975b120a2c394a8af',1,'Users']]], + ['createwebuser',['createWebuser',['../classWebUsers.html#a0cb7168a6b8358106512804ff28cea17',1,'WebUsers\createWebuser($name, $pass, $mail)'],['../classWebUsers.html#a0cb7168a6b8358106512804ff28cea17',1,'WebUsers\createWebuser($name, $pass, $mail)']]], + ['cron',['cron',['../classMail__Handler.html#a1b65890aa4eb8c0c6129c3e787a53405',1,'Mail_Handler']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_64.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_64.html new file mode 100644 index 000000000..b53ff083e --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_64.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_64.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_64.js new file mode 100644 index 000000000..a897983e6 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_64.js @@ -0,0 +1,12 @@ +var searchData= +[ + ['dashboard',['dashboard',['../dashboard_8php.html#a54d0c80ff20df9df6439bb87608c375a',1,'dashboard.php']]], + ['dashboard_2ephp',['dashboard.php',['../dashboard_8php.html',1,'']]], + ['dblayer',['DBLayer',['../classDBLayer.html',1,'']]], + ['dblayer_2ephp',['dblayer.php',['../dblayer_8php.html',1,'']]], + ['decode_5futf8',['decode_utf8',['../classMail__Handler.html#a6fc5947eaa45b0724f8720b374481275',1,'Mail_Handler']]], + ['decrypt',['decrypt',['../classMyCrypt.html#aed69cdc691e1155856c905ee1c08d9b7',1,'MyCrypt']]], + ['delete',['delete',['../classAssigned.html#a13bdffdd926f26b825ea57066334ff01',1,'Assigned\delete()'],['../classForwarded.html#a13bdffdd926f26b825ea57066334ff01',1,'Forwarded\delete()'],['../classIn__Support__Group.html#a13bdffdd926f26b825ea57066334ff01',1,'In_Support_Group\delete()'],['../classSupport__Group.html#a13bdffdd926f26b825ea57066334ff01',1,'Support_Group\delete()']]], + ['deletesupportgroup',['deleteSupportGroup',['../classSupport__Group.html#ab4a7d3ba86333a058027c7d58b9137f1',1,'Support_Group']]], + ['deleteuserofsupportgroup',['deleteUserOfSupportGroup',['../classSupport__Group.html#ad2d1a010903640e39545085b93b9a4f1',1,'Support_Group']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_65.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_65.html new file mode 100644 index 000000000..66cc83487 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_65.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_65.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_65.js new file mode 100644 index 000000000..537250038 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_65.js @@ -0,0 +1,9 @@ +var searchData= +[ + ['encrypt',['encrypt',['../classMyCrypt.html#a07bcc8ef1d23370470ecb5ae8fc07dfa',1,'MyCrypt']]], + ['error',['error',['../error_8php.html#a43b8d30b879d4f09ceb059b02af2bc02',1,'error.php']]], + ['error_2ephp',['error.php',['../error_8php.html',1,'']]], + ['execute',['execute',['../classDBLayer.html#a9a0e3ecb193fecd94263eda79c54bcc4',1,'DBLayer']]], + ['executereturnid',['executeReturnId',['../classDBLayer.html#a9a8137347ec2d551de3ec54cfb3bdb1a',1,'DBLayer']]], + ['executewithoutparams',['executeWithoutParams',['../classDBLayer.html#a33552c5325c469ac1aa0d049d2312468',1,'DBLayer']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_66.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_66.html new file mode 100644 index 000000000..3d1f8b35e --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_66.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_66.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_66.js new file mode 100644 index 000000000..9959a693e --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_66.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['forwarded',['Forwarded',['../classForwarded.html',1,'']]], + ['forwarded_2ephp',['forwarded.php',['../forwarded_8php.html',1,'']]], + ['forwardticket',['forwardTicket',['../classForwarded.html#aa6f01e425a0f845ce55c2d90aeb11db0',1,'Forwarded\forwardTicket()'],['../classTicket.html#a3fdc6def6a0feaf4c2458811b8c75050',1,'Ticket\forwardTicket()']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_67.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_67.html new file mode 100644 index 000000000..41a459ae7 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_67.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_67.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_67.js new file mode 100644 index 000000000..d55d29ded --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_67.js @@ -0,0 +1,108 @@ +var searchData= +[ + ['generatesalt',['generateSALT',['../classUsers.html#afb7603ac9556c1069fbf1c0062251203',1,'Users']]], + ['get_5femail_5fby_5fuser_5fid',['get_email_by_user_id',['../classTicket__User.html#a7274bc305ccce731091c68d1607cb6e9',1,'Ticket_User']]], + ['get_5fid_5ffrom_5femail',['get_id_from_email',['../classTicket__User.html#a7feeb7a909bf6733de21300d0ea0e1bd',1,'Ticket_User']]], + ['get_5fid_5ffrom_5fusername',['get_id_from_username',['../classTicket__User.html#a0bcfa281f41b948eb42dd18992724543',1,'Ticket_User']]], + ['get_5fmime_5ftype',['get_mime_type',['../classMail__Handler.html#a719c5051ef00fbb0d7c7ce2c78e3b4e1',1,'Mail_Handler']]], + ['get_5fpart',['get_part',['../classMail__Handler.html#ab3a5e8f69692826c6dae96f873859642',1,'Mail_Handler']]], + ['get_5fticket_5fid_5ffrom_5fsubject',['get_ticket_id_from_subject',['../classMail__Handler.html#a8604569b1e012ea3b1fe466018f75ce2',1,'Mail_Handler']]], + ['get_5fusername_5ffrom_5fid',['get_username_from_id',['../classTicket__User.html#a266ff1e60e08dcd8c7e70f22f5a33e93',1,'Ticket_User']]], + ['getaction',['getAction',['../classTicket__Log.html#a189a4abe5faf11f4320d5d3f1d3d1715',1,'Ticket_Log']]], + ['getactiontextarray',['getActionTextArray',['../classTicket__Log.html#ac760071c0ce36337c16d8146fcb3bade',1,'Ticket_Log']]], + ['getallcategories',['getAllCategories',['../classTicket__Category.html#a1e4b8ecfd737337e35976126b521499f',1,'Ticket_Category']]], + ['getalllogs',['getAllLogs',['../classTicket__Log.html#aeaf1c995cc807afe241f6e7bdc684921',1,'Ticket_Log']]], + ['getallsupportgroups',['getAllSupportGroups',['../classSupport__Group.html#ad3fc18cb894f789d19a768ea63d9b673',1,'Support_Group']]], + ['getallusersofsupportgroup',['getAllUsersOfSupportGroup',['../classSupport__Group.html#a7f1662394a31e2a05e9863def178df12',1,'Support_Group']]], + ['getallusersquery',['getAllUsersQuery',['../classWebUsers.html#a2f8e928ed02e462b40e909965250fb7d',1,'WebUsers\getAllUsersQuery()'],['../classWebUsers.html#a2f8e928ed02e462b40e909965250fb7d',1,'WebUsers\getAllUsersQuery()']]], + ['getamountofrows',['getAmountOfRows',['../classPagination.html#ae43f78382809e3cd2aaa3c455cb0b2b4',1,'Pagination']]], + ['getargument',['getArgument',['../classTicket__Log.html#a88ec9370bcbdb60301f89e401c9e64e1',1,'Ticket_Log']]], + ['getassigned',['getAssigned',['../classTicket.html#a8234a4e23319778d234b3957f8b5d06c',1,'Ticket']]], + ['getauthor',['getAuthor',['../classTicket.html#a5286e30390ae3e1b274940286493dd24',1,'Ticket\getAuthor()'],['../classTicket__Log.html#a5286e30390ae3e1b274940286493dd24',1,'Ticket_Log\getAuthor()'],['../classTicket__Reply.html#a5286e30390ae3e1b274940286493dd24',1,'Ticket_Reply\getAuthor()']]], + ['getcategoryname',['getCategoryName',['../classTicket.html#a689e9d131777e7f1219ee0d65b088cb3',1,'Ticket']]], + ['getclient_5fversion',['getClient_Version',['../classTicket__Info.html#a5a9884f9f9b63d4a6ed8c6112704277d',1,'Ticket_Info']]], + ['getconnect_5fstate',['getConnect_State',['../classTicket__Info.html#a51a5247b7c82f60479ccdcfa33041c27',1,'Ticket_Info']]], + ['getcontent',['getContent',['../classTicket__Content.html#a58e43f09a06ce4e29b192c4e17ce7915',1,'Ticket_Content\getContent()'],['../classTicket__Reply.html#a58e43f09a06ce4e29b192c4e17ce7915',1,'Ticket_Reply\getContent()']]], + ['getcountryarray',['getCountryArray',['../drupal__module_2ryzommanage_2inc_2settings_8php.html#a9342547984d3c9a5ece41572951f8edf',1,'getCountryArray(): settings.php'],['../www_2html_2inc_2settings_8php.html#a9342547984d3c9a5ece41572951f8edf',1,'getCountryArray(): settings.php']]], + ['getcpu_5fmask',['getCPU_Mask',['../classTicket__Info.html#ae85e54574e6e0b17cd33b8c49255d228',1,'Ticket_Info']]], + ['getcpuid',['getCPUId',['../classTicket__Info.html#aba21caccb000efb673b8b66ca70a36c7',1,'Ticket_Info']]], + ['getcurrent',['getCurrent',['../classPagination.html#ad926899d7cac34a3f1a90e552d8eb27d',1,'Pagination']]], + ['getdb',['getDb',['../classQuerycache.html#aceb656ee5135578ab3a9947252caa772',1,'Querycache']]], + ['getelements',['getElements',['../classPagination.html#a97a3a3e912139aa222a7ca13fdb27d33',1,'Pagination']]], + ['getemail',['getEmail',['../classWebUsers.html#a02a01849f28e2535e888ae4ec87b20f2',1,'WebUsers\getEmail()'],['../classWebUsers.html#a02a01849f28e2535e888ae4ec87b20f2',1,'WebUsers\getEmail()']]], + ['getentireticket',['getEntireTicket',['../classTicket.html#a00572e06f01ae1cadb5949f1b45e8f04',1,'Ticket']]], + ['getexternid',['getExternId',['../classTicket__User.html#ace230deb485c9f115f7fea4ce92442a3',1,'Ticket_User']]], + ['getforwardedgroupid',['getForwardedGroupId',['../classTicket.html#aedbfa4efd5aaa96ac713817d12156f7e',1,'Ticket']]], + ['getforwardedgroupname',['getForwardedGroupName',['../classTicket.html#a34e17d1cc053a7b86ce2b58a3a347c7e',1,'Ticket']]], + ['getgroup',['getGroup',['../classForwarded.html#a4f44e7bc9de772c21b4304d11e87bf16',1,'Forwarded\getGroup()'],['../classIn__Support__Group.html#a4f44e7bc9de772c21b4304d11e87bf16',1,'In_Support_Group\getGroup()'],['../classSupport__Group.html#af6697615443145a2981e62aa741c3afa',1,'Support_Group\getGroup()']]], + ['getgroupemail',['getGroupEmail',['../classSupport__Group.html#a9d0f36a53db49c1f57e3cab8a61a7d90',1,'Support_Group']]], + ['getgroups',['getGroups',['../classSupport__Group.html#a562142b89699a1063ea9769030250365',1,'Support_Group']]], + ['gethidden',['getHidden',['../classTicket__Reply.html#a1d032efbce2b4edb7c269a1e13562f40',1,'Ticket_Reply']]], + ['getht',['getHT',['../classTicket__Info.html#a90d3c0edc1e767875c7fb98880886e73',1,'Ticket_Info']]], + ['getid',['getId',['../classWebUsers.html#a585ef354b38d0fad9d92f45e183b639f',1,'WebUsers\getId($username)'],['../classWebUsers.html#a585ef354b38d0fad9d92f45e183b639f',1,'WebUsers\getId($username)']]], + ['getidfromemail',['getIdFromEmail',['../classWebUsers.html#aee8d6b322defc5dfe8e47f382becca62',1,'WebUsers\getIdFromEmail($email)'],['../classWebUsers.html#aee8d6b322defc5dfe8e47f382becca62',1,'WebUsers\getIdFromEmail($email)']]], + ['getimap_5fmailserver',['getIMAP_MailServer',['../classSupport__Group.html#a30d67354e52f95489b93923440ff0661',1,'Support_Group']]], + ['getimap_5fpassword',['getIMAP_Password',['../classSupport__Group.html#a4983db184794db8f05ce93f5ba11ba7e',1,'Support_Group']]], + ['getimap_5fusername',['getIMAP_Username',['../classSupport__Group.html#a0ace9f66f2541d29e060cb7728030e93',1,'Support_Group']]], + ['getinfo',['getInfo',['../classWebUsers.html#a164026f74736817927e1cacd282a2e28',1,'WebUsers\getInfo()'],['../classWebUsers.html#a164026f74736817927e1cacd282a2e28',1,'WebUsers\getInfo()']]], + ['getlanguage',['getLanguage',['../classWebUsers.html#afcef2403c4111bc44ef0530f1e493909',1,'WebUsers\getLanguage()'],['../classWebUsers.html#afcef2403c4111bc44ef0530f1e493909',1,'WebUsers\getLanguage()']]], + ['getlast',['getLast',['../classPagination.html#a9316ede6960667d832997c8e20223623',1,'Pagination']]], + ['getlatestreply',['getLatestReply',['../classTicket.html#a3a4ce7e9c445dd245b3370304d0afd92',1,'Ticket']]], + ['getlinks',['getLinks',['../classPagination.html#aeecf550e63b55ecd5d737ecc46e07d3a',1,'Pagination']]], + ['getlocal_5faddress',['getLocal_Address',['../classTicket__Info.html#a49b4c851eff2f3d06531a39baa8423f5',1,'Ticket_Info']]], + ['getlogsofticket',['getLogsOfTicket',['../classTicket__Log.html#a37ad4d95b0bb2d5a6dfc2dd7c3744292',1,'Ticket_Log']]], + ['getmemory',['getMemory',['../classTicket__Info.html#a144248575cd034a40315155a9b48ff87',1,'Ticket_Info']]], + ['getmodsandadmins',['getModsAndAdmins',['../classTicket__User.html#a71099747902fb7e064ec1d4128ea4576',1,'Ticket_User']]], + ['getname',['getName',['../classSupport__Group.html#a3d0963e68bb313b163a73f2803c64600',1,'Support_Group\getName()'],['../classTicket__Category.html#a3d0963e68bb313b163a73f2803c64600',1,'Ticket_Category\getName()']]], + ['getnel3d',['getNel3D',['../classTicket__Info.html#abe3ae528bfd5495720c3adeff59fe11e',1,'Ticket_Info']]], + ['getnewestticket',['getNewestTicket',['../classTicket__Queue__Handler.html#ab5a79318a0c771083f03400093b3b2ec',1,'Ticket_Queue_Handler']]], + ['getnroftickets',['getNrOfTickets',['../classTicket__Queue__Handler.html#ada8f87ed8466c5e0477fa20359c3c8ad',1,'Ticket_Queue_Handler']]], + ['getnrofticketsassignedwaiting',['getNrOfTicketsAssignedWaiting',['../classTicket__Queue__Handler.html#a0d3daaaf5c79188eb62bb3adda11fa2a',1,'Ticket_Queue_Handler']]], + ['getnrofticketstodo',['getNrOfTicketsToDo',['../classTicket__Queue__Handler.html#ae8d1a2a66991583c05c173147e8dc657',1,'Ticket_Queue_Handler']]], + ['getos',['getOS',['../classTicket__Info.html#a9a1b88474ad97701d67a752d0c4d65c5',1,'Ticket_Info']]], + ['getpagination',['getPagination',['../classTicket__Queue__Handler.html#ab45a102a508e9727b108e8f24486c464',1,'Ticket_Queue_Handler']]], + ['getparams',['getParams',['../classTicket__Queue.html#ae32cd7c32721b02d676bb63b4b1366db',1,'Ticket_Queue']]], + ['getpatch_5fversion',['getPatch_Version',['../classTicket__Info.html#a6e41e115b03a1f152bd2c28c77d5fbac',1,'Ticket_Info']]], + ['getpermission',['getPermission',['../classTicket__User.html#a478067ecf173884c2ee3e5b94e746200',1,'Ticket_User']]], + ['getpriority',['getPriority',['../classTicket.html#a1e7a3c168dcd0901a0d2669c67575b55',1,'Ticket']]], + ['getpriorityarray',['getPriorityArray',['../classTicket.html#a509625cccc0b41f4ab3a658df705b3dc',1,'Ticket']]], + ['getprioritytext',['getPriorityText',['../classTicket.html#ae07f7808a12f2789593722f3293bd105',1,'Ticket']]], + ['getprocessor',['getProcessor',['../classTicket__Info.html#a3ace868ad456ff61f545cb44ee01c562',1,'Ticket_Info']]], + ['getquery',['getQuery',['../classQuerycache.html#a55f162785567258fe5138af282e588c2',1,'Querycache\getQuery()'],['../classTicket__Log.html#a55f162785567258fe5138af282e588c2',1,'Ticket_Log\getQuery()'],['../classTicket__Queue.html#a55f162785567258fe5138af282e588c2',1,'Ticket_Queue\getQuery()']]], + ['getqueue',['getQueue',['../classTicket.html#aa7a8055e5ee1eb792f29443ddb79c4d3',1,'Ticket']]], + ['getreceivemail',['getReceiveMail',['../classWebUsers.html#ae4680f622bd8d571530615fb616d37e7',1,'WebUsers\getReceiveMail()'],['../classWebUsers.html#ae4680f622bd8d571530615fb616d37e7',1,'WebUsers\getReceiveMail()']]], + ['getrepliesofticket',['getRepliesOfTicket',['../classTicket__Reply.html#a7e80a6437bb6ee90be42a32f3a82fe76',1,'Ticket_Reply']]], + ['getserver_5ftick',['getServer_Tick',['../classTicket__Info.html#a5a5799e4e54d3fa4858716b4464710c0',1,'Ticket_Info']]], + ['getsgroupid',['getSGroupId',['../classSupport__Group.html#a77d0961efe9609ebb268f8672e71bba4',1,'Support_Group']]], + ['getsgroupofticket',['getSGroupOfTicket',['../classForwarded.html#a4de002d45322cf62ce493f49933d33bd',1,'Forwarded']]], + ['getshardid',['getShardId',['../classTicket__Info.html#a36306b5367015050fb516fcaaff8351f',1,'Ticket_Info']]], + ['getsid',['getSID',['../classQuerycache.html#a5bac91964d19751986cccad6fad28dda',1,'Querycache']]], + ['getstatus',['getStatus',['../classTicket.html#a9d21636071f529e2154051d3ea6e5921',1,'Ticket']]], + ['getstatusarray',['getStatusArray',['../classTicket.html#aa728c6a1f8ddd7030acbf5a4ca913b50',1,'Ticket']]], + ['getstatustext',['getStatusText',['../classTicket.html#aab26af198dc3a59295747084b85435ff',1,'Ticket']]], + ['gettag',['getTag',['../classSupport__Group.html#ab86ba36154b20e6bbfa3ba705f12f9d6',1,'Support_Group']]], + ['gettcategoryid',['getTCategoryId',['../classTicket__Category.html#acb530a119e5e52230a92ece95cc7ec82',1,'Ticket_Category']]], + ['gettcontentid',['getTContentId',['../classTicket__Content.html#a9245dceab917ad08e5244c9395b347ae',1,'Ticket_Content']]], + ['getticket',['getTicket',['../classAssigned.html#a42ddf34a72af750b7013fa309b67e46c',1,'Assigned\getTicket()'],['../classForwarded.html#a42ddf34a72af750b7013fa309b67e46c',1,'Forwarded\getTicket()'],['../classTicket__Info.html#a42ddf34a72af750b7013fa309b67e46c',1,'Ticket_Info\getTicket()'],['../classTicket__Log.html#a42ddf34a72af750b7013fa309b67e46c',1,'Ticket_Log\getTicket()'],['../classTicket__Reply.html#a42ddf34a72af750b7013fa309b67e46c',1,'Ticket_Reply\getTicket()']]], + ['getticket_5fcategory',['getTicket_Category',['../classTicket.html#addff2fc457fe07664f4eb39efcea45f9',1,'Ticket']]], + ['gettickets',['getTickets',['../classTicket__Queue__Handler.html#a45e8c11ba9485041fa92c7c470a8f9f9',1,'Ticket_Queue_Handler']]], + ['getticketsof',['getTicketsOf',['../classTicket.html#aa426904463cd0eb50d9b2f4becdd242f',1,'Ticket']]], + ['gettid',['getTId',['../classTicket.html#aa7af74696d9898008992c494cec136dd',1,'Ticket']]], + ['gettimestamp',['getTimestamp',['../classTicket.html#a92aa1d82129ec8cd803d64c28efcb30f',1,'Ticket\getTimestamp()'],['../classTicket__Log.html#a92aa1d82129ec8cd803d64c28efcb30f',1,'Ticket_Log\getTimestamp()'],['../classTicket__Reply.html#a92aa1d82129ec8cd803d64c28efcb30f',1,'Ticket_Reply\getTimestamp()']]], + ['gettinfoid',['getTInfoId',['../classTicket__Info.html#ad7c7ccc1926763c252d32d1fee5a7f69',1,'Ticket_Info']]], + ['gettitle',['getTitle',['../classTicket.html#a95e859a4588a39a1824b717378a84c29',1,'Ticket']]], + ['gettlogid',['getTLogId',['../classTicket__Log.html#ab174d340ee116d8cc3aa377003421fc5',1,'Ticket_Log']]], + ['gettreplyid',['getTReplyId',['../classTicket__Reply.html#ade0c35755c1a1af8fa4c9bae8b4c51f1',1,'Ticket_Reply']]], + ['gettuserid',['getTUserId',['../classTicket__User.html#a4a31c27c61f9794200b647bf810461f5',1,'Ticket_User']]], + ['gettype',['getType',['../classQuerycache.html#a830b5c75df72b32396701bc563fbe3c7',1,'Querycache']]], + ['getuid',['getUId',['../classWebUsers.html#aa36a98da4146d85e7813e99df7d97497',1,'WebUsers\getUId()'],['../classWebUsers.html#aa36a98da4146d85e7813e99df7d97497',1,'WebUsers\getUId()']]], + ['getuser',['getUser',['../classAssigned.html#ae81b7186fb97a7c6457edcc68c9aa2ef',1,'Assigned\getUser()'],['../classIn__Support__Group.html#ae81b7186fb97a7c6457edcc68c9aa2ef',1,'In_Support_Group\getUser()']]], + ['getuser_5fid',['getUser_Id',['../classTicket__Info.html#a9c2fe31c14609e2255773d5a4dd154d8',1,'Ticket_Info']]], + ['getuser_5fposition',['getUser_Position',['../classTicket__Info.html#a3f5a46d846543219d6321d2f8751d1f0',1,'Ticket_Info']]], + ['getuserassignedtoticket',['getUserAssignedToTicket',['../classAssigned.html#afcfb156712a9477a97423a49238d13c5',1,'Assigned']]], + ['getusername',['getUsername',['../classWebUsers.html#a81b37a3c9d639574e394f80c1138c75e',1,'WebUsers\getUsername()'],['../classWebUsers.html#a81b37a3c9d639574e394f80c1138c75e',1,'WebUsers\getUsername()']]], + ['getusers',['getUsers',['../classWebUsers.html#a0fc10b64683021b70c7eb95fb514c119',1,'WebUsers\getUsers()'],['../classWebUsers.html#a0fc10b64683021b70c7eb95fb514c119',1,'WebUsers\getUsers()']]], + ['getview_5fposition',['getView_Position',['../classTicket__Info.html#a525dbd26fc788c7c152f6c686a9a5d11',1,'Ticket_Info']]], + ['gui_5felements',['Gui_Elements',['../classGui__Elements.html',1,'']]], + ['gui_5felements_2ephp',['gui_elements.php',['../gui__elements_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_68.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_68.html new file mode 100644 index 000000000..6df909782 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_68.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_68.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_68.js new file mode 100644 index 000000000..551ff1628 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_68.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['handle_5flanguage',['handle_language',['../classHelpers.html#a334920d0652c160c6145d3bd7be31a22',1,'Helpers']]], + ['hashiv',['hashIV',['../classMyCrypt.html#a1bdf94a5906655bf0965338c9d17ab27',1,'MyCrypt']]], + ['hasinfo',['hasInfo',['../classTicket.html#afca07df3cc25a0e1a15d3f69bd6afa62',1,'Ticket']]], + ['helpers',['Helpers',['../classHelpers.html',1,'']]], + ['helpers_2ephp',['helpers.php',['../helpers_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_69.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_69.html new file mode 100644 index 000000000..1a00b554d --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_69.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_69.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_69.js new file mode 100644 index 000000000..a0e19a9ec --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_69.js @@ -0,0 +1,14 @@ +var searchData= +[ + ['in_5fsupport_5fgroup',['In_Support_Group',['../classIn__Support__Group.html',1,'']]], + ['in_5fsupport_5fgroup_2ephp',['in_support_group.php',['../in__support__group_8php.html',1,'']]], + ['incoming_5fmail_5fhandler',['incoming_mail_handler',['../classMail__Handler.html#a2896dabadb8e435de7ba7bbb258f8a96',1,'Mail_Handler']]], + ['index_2ephp',['index.php',['../index_8php.html',1,'']]], + ['info_2ephp',['info.php',['../info_8php.html',1,'']]], + ['install_2ephp',['install.php',['../install_8php.html',1,'']]], + ['isadmin',['isAdmin',['../classTicket__User.html#ae8a7d91474cde916fced2127fab426d2',1,'Ticket_User']]], + ['isassigned',['isAssigned',['../classAssigned.html#ade127364a5e5635077119b7217b6059c',1,'Assigned']]], + ['isforwarded',['isForwarded',['../classForwarded.html#ac1fa2045188edf04b07c523e1c6f68a0',1,'Forwarded']]], + ['isloggedin',['isLoggedIn',['../classWebUsers.html#a33bdd79e5da367ebddd4cfbdbbfc7cff',1,'WebUsers\isLoggedIn()'],['../classWebUsers.html#a33bdd79e5da367ebddd4cfbdbbfc7cff',1,'WebUsers\isLoggedIn()']]], + ['ismod',['isMod',['../classTicket__User.html#a8d88cdbf205bf7d24be03157d25bb7d8',1,'Ticket_User']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6c.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6c.html new file mode 100644 index 000000000..f6383cc22 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6c.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6c.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6c.js new file mode 100644 index 000000000..d76ada768 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6c.js @@ -0,0 +1,28 @@ +var searchData= +[ + ['libinclude_2ephp',['libinclude.php',['../libinclude_8php.html',1,'']]], + ['load',['load',['../classAssigned.html#a689011be59ec3d216ebe6852f07ab37f',1,'Assigned\load()'],['../classForwarded.html#a689011be59ec3d216ebe6852f07ab37f',1,'Forwarded\load()']]], + ['load_5fwith_5fsgroupid',['load_With_SGroupId',['../classSupport__Group.html#a6beae177f45da42a57b100b5481f49bf',1,'Support_Group']]], + ['load_5fwith_5fsid',['load_With_SID',['../classQuerycache.html#ae960510ccb242704233c38d787242f53',1,'Querycache']]], + ['load_5fwith_5ftcategoryid',['load_With_TCategoryId',['../classTicket__Category.html#ab3a70940917530d91a39536a6d45a21d',1,'Ticket_Category']]], + ['load_5fwith_5ftcontentid',['load_With_TContentId',['../classTicket__Content.html#ad8b1226537a055701bcc3fe4af87257b',1,'Ticket_Content']]], + ['load_5fwith_5fticket',['load_With_Ticket',['../classTicket__Info.html#afcf4006cdd19b05919b5df34d3345ad2',1,'Ticket_Info']]], + ['load_5fwith_5ftid',['load_With_TId',['../classTicket.html#ac17d9e1158fb77707da1f6cd3e425d54',1,'Ticket']]], + ['load_5fwith_5ftinfoid',['load_With_TInfoId',['../classTicket__Info.html#a1681685f76483b7944bf6848b29caa4a',1,'Ticket_Info']]], + ['load_5fwith_5ftlogid',['load_With_TLogId',['../classTicket__Log.html#a76e8e991002c7e408f7b182556cdeade',1,'Ticket_Log']]], + ['load_5fwith_5ftreplyid',['load_With_TReplyId',['../classTicket__Reply.html#ac9a387c63aad0b81a8161d2515f697d9',1,'Ticket_Reply']]], + ['load_5fwith_5ftuserid',['load_With_TUserId',['../classTicket__User.html#af43df1ba39e073e4b3a0120e6e4d3140',1,'Ticket_User']]], + ['loadallclosedtickets',['loadAllClosedTickets',['../classTicket__Queue.html#af2a9b20ac9dc0e1992f717abbb418be7',1,'Ticket_Queue']]], + ['loadallnotassignedtickets',['loadAllNotAssignedTickets',['../classTicket__Queue.html#a771627a0bd387cd666474a6ef0d5eaaf',1,'Ticket_Queue']]], + ['loadallopentickets',['loadAllOpenTickets',['../classTicket__Queue.html#a3a1cf8a88a3604e093f7d276050f1c49',1,'Ticket_Queue']]], + ['loadalltickets',['loadAllTickets',['../classTicket__Queue.html#a80542bde30a8a589f1d088422cb7719b',1,'Ticket_Queue']]], + ['loadassignedandwaiting',['loadAssignedandWaiting',['../classTicket__Queue.html#a348c76f7ae32437b7e91b57671d6f33d',1,'Ticket_Queue']]], + ['loadtemplate',['loadTemplate',['../classHelpers.html#a78997ab39ba0237dc7a5441b58601211',1,'Helpers']]], + ['loadtodotickets',['loadToDoTickets',['../classTicket__Queue.html#ad88848edf9a9132eb0cfcac904a8459f',1,'Ticket_Queue']]], + ['login',['login',['../func_2login_8php.html#aa311da27ba5706f5710cea7706c8eae1',1,'login(): login.php'],['../inc_2login_8php.html#aa311da27ba5706f5710cea7706c8eae1',1,'login(): login.php']]], + ['login_2ephp',['login.php',['../func_2login_8php.html',1,'']]], + ['login_2ephp',['login.php',['../inc_2login_8php.html',1,'']]], + ['logout',['logout',['../drupal__module_2ryzommanage_2inc_2logout_8php.html#a082405d89acd6835c3a7c7a08a7adbab',1,'logout(): logout.php'],['../www_2html_2inc_2logout_8php.html#a082405d89acd6835c3a7c7a08a7adbab',1,'logout(): logout.php']]], + ['logout_2ephp',['logout.php',['../www_2html_2inc_2logout_8php.html',1,'']]], + ['logout_2ephp',['logout.php',['../drupal__module_2ryzommanage_2inc_2logout_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6d.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6d.html new file mode 100644 index 000000000..2e27d4d64 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6d.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6d.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6d.js new file mode 100644 index 000000000..fb08a60ab --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6d.js @@ -0,0 +1,13 @@ +var searchData= +[ + ['mail_5fcron_2ephp',['mail_cron.php',['../mail__cron_8php.html',1,'']]], + ['mail_5ffork',['mail_fork',['../classMail__Handler.html#ac6f9bcfab65cc93fdd4723284fff6b7a',1,'Mail_Handler']]], + ['mail_5fhandler',['Mail_Handler',['../classMail__Handler.html',1,'']]], + ['mail_5fhandler_2ephp',['mail_handler.php',['../mail__handler_8php.html',1,'']]], + ['make_5ftable',['make_table',['../classGui__Elements.html#a639930203d81ff01840ac90a51cbbfe7',1,'Gui_Elements']]], + ['make_5ftable_5fwith_5fkey_5fis_5fid',['make_table_with_key_is_id',['../classGui__Elements.html#ae3c8c19fce4cdd7d87d4ae759ab06f24',1,'Gui_Elements']]], + ['modify_5femail_5fof_5fsgroup',['modify_email_of_sgroup',['../modify__email__of__sgroup_8php.html#acb8c4a7ad3e36662d1d22ba56a98d0ab',1,'modify_email_of_sgroup.php']]], + ['modify_5femail_5fof_5fsgroup_2ephp',['modify_email_of_sgroup.php',['../modify__email__of__sgroup_8php.html',1,'']]], + ['mycrypt',['MyCrypt',['../classMyCrypt.html',1,'']]], + ['mycrypt_2ephp',['mycrypt.php',['../mycrypt_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6e.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6e.html new file mode 100644 index 000000000..1f92ee5b6 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6e.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6e.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6e.js new file mode 100644 index 000000000..0831ed960 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6e.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['new_5fmessage_5fid',['new_message_id',['../classMail__Handler.html#a667ca75b6c659157d855c3d19978a436',1,'Mail_Handler']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6f.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6f.html new file mode 100644 index 000000000..61827e82e --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6f.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6f.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6f.js new file mode 100644 index 000000000..f8a8b3016 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_6f.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['outputtime',['outputTime',['../classHelpers.html#a4370c805a72fe32c03b178b03ad2e393',1,'Helpers']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_70.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_70.html new file mode 100644 index 000000000..0340151b6 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_70.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_70.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_70.js new file mode 100644 index 000000000..e09f3f7d0 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_70.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['pagination',['Pagination',['../classPagination.html',1,'']]], + ['pagination_2ephp',['pagination.php',['../pagination_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_71.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_71.html new file mode 100644 index 000000000..b4dc1e6ee --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_71.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_71.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_71.js new file mode 100644 index 000000000..8b0805dd8 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_71.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['querycache',['Querycache',['../classQuerycache.html',1,'']]], + ['querycache_2ephp',['querycache.php',['../querycache_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_72.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_72.html new file mode 100644 index 000000000..0ab18d65f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_72.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_72.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_72.js new file mode 100644 index 000000000..ece0a9538 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_72.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['register',['register',['../register_8php.html#acc294a6cc8e69743746820e3d15e3f78',1,'register.php']]], + ['register_2ephp',['register.php',['../register_8php.html',1,'']]], + ['reply_5fon_5fticket',['reply_on_ticket',['../reply__on__ticket_8php.html#a79f0a445c77e8e1e59eb9e72cbf39dba',1,'reply_on_ticket.php']]], + ['reply_5fon_5fticket_2ephp',['reply_on_ticket.php',['../reply__on__ticket_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_73.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_73.html new file mode 100644 index 000000000..1ec8f174d --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_73.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_73.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_73.js new file mode 100644 index 000000000..aee17ff0a --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_73.js @@ -0,0 +1,90 @@ +var searchData= +[ + ['send_5fmail',['send_mail',['../classMail__Handler.html#a50308ad0711aee080dacef7e3f574699',1,'Mail_Handler']]], + ['send_5fticketing_5fmail',['send_ticketing_mail',['../classMail__Handler.html#abe649044c8b8bd8eb05787a401865e6d',1,'Mail_Handler']]], + ['set',['set',['../classAssigned.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Assigned\set()'],['../classForwarded.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Forwarded\set()'],['../classIn__Support__Group.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'In_Support_Group\set()'],['../classQuerycache.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Querycache\set()'],['../classSupport__Group.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Support_Group\set()'],['../classTicket.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Ticket\set()'],['../classTicket__Info.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Ticket_Info\set()'],['../classTicket__Log.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Ticket_Log\set()'],['../classTicket__Reply.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Ticket_Reply\set()'],['../classTicket__User.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Ticket_User\set()'],['../classWebUsers.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'WebUsers\set($values)'],['../classWebUsers.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'WebUsers\set($values)']]], + ['setamsemail',['setAmsEmail',['../classUsers.html#ad1cbb1fe6ee72f46dc385bec6e274363',1,'Users']]], + ['setamspassword',['setAmsPassword',['../classUsers.html#ab89812058b0a71baf492af4652d67501',1,'Users']]], + ['setauthor',['setAuthor',['../classTicket.html#a0c8f116992af7c8737c70119dae00d45',1,'Ticket\setAuthor()'],['../classTicket__Log.html#a0c8f116992af7c8737c70119dae00d45',1,'Ticket_Log\setAuthor()'],['../classTicket__Reply.html#a0c8f116992af7c8737c70119dae00d45',1,'Ticket_Reply\setAuthor()']]], + ['setclient_5fversion',['setClient_Version',['../classTicket__Info.html#af06e75f73ae40120cc371f6ddd9ab49c',1,'Ticket_Info']]], + ['setconnect_5fstate',['setConnect_State',['../classTicket__Info.html#a4de823fc3a051d3aac3d526badef313c',1,'Ticket_Info']]], + ['setcontent',['setContent',['../classTicket__Content.html#a76e94f05c5cc0044993a35492097df4d',1,'Ticket_Content\setContent()'],['../classTicket__Reply.html#a76e94f05c5cc0044993a35492097df4d',1,'Ticket_Reply\setContent()']]], + ['setcpu_5fmask',['setCPU_Mask',['../classTicket__Info.html#a5f19999ab39a2ac0b7d6f2ced9223ae6',1,'Ticket_Info']]], + ['setcpuid',['setCPUId',['../classTicket__Info.html#af1f04d3bdcbaf28b246eb94a484f397c',1,'Ticket_Info']]], + ['setdb',['setDb',['../classQuerycache.html#afa9c249972ca269a2b1a399ed2faf9b4',1,'Querycache']]], + ['setemail',['setEmail',['../classWebUsers.html#a0cd214763f395718db166fbd598689f4',1,'WebUsers\setEmail($user, $mail)'],['../classWebUsers.html#a0cd214763f395718db166fbd598689f4',1,'WebUsers\setEmail($user, $mail)']]], + ['setexternid',['setExternId',['../classTicket__User.html#ad38846bb954052a5293ae2d26cf810d2',1,'Ticket_User']]], + ['setgroup',['setGroup',['../classForwarded.html#a3116db27c2e2f33cbb10a9488db34da3',1,'Forwarded\setGroup()'],['../classIn__Support__Group.html#a3116db27c2e2f33cbb10a9488db34da3',1,'In_Support_Group\setGroup()']]], + ['setgroupemail',['setGroupEmail',['../classSupport__Group.html#abbb0e975fd21a42439970ebb3eba5fea',1,'Support_Group']]], + ['sethidden',['setHidden',['../classTicket__Reply.html#a0b67f1016974c7b153b8944a94c88045',1,'Ticket_Reply']]], + ['setht',['setHT',['../classTicket__Info.html#a9ef93ff2fede4bd9b1cb8da2129dee20',1,'Ticket_Info']]], + ['setimap_5fmailserver',['setIMAP_MailServer',['../classSupport__Group.html#a71f266f2bba1fc4fb6df4cf083988938',1,'Support_Group']]], + ['setimap_5fpassword',['setIMAP_Password',['../classSupport__Group.html#ad6fcb63d4ae129567e8bea8786a75d87',1,'Support_Group']]], + ['setimap_5fusername',['setIMAP_Username',['../classSupport__Group.html#a6856519261b543f27bc001616c2881eb',1,'Support_Group']]], + ['setlanguage',['setLanguage',['../classWebUsers.html#a5ab1bd5f0959a3c33a46c176d9412c80',1,'WebUsers\setLanguage($user, $language)'],['../classWebUsers.html#a5ab1bd5f0959a3c33a46c176d9412c80',1,'WebUsers\setLanguage($user, $language)']]], + ['setlocal_5faddress',['setLocal_Address',['../classTicket__Info.html#a144b42f39cea6b24624c6c547df6aeeb',1,'Ticket_Info']]], + ['setmemory',['setMemory',['../classTicket__Info.html#a6f6f6925a18d24d2ecd5166a325be609',1,'Ticket_Info']]], + ['setname',['setName',['../classSupport__Group.html#aa3dcc220094e19fef1f918a3a917dba7',1,'Support_Group\setName()'],['../classTicket__Category.html#aa3dcc220094e19fef1f918a3a917dba7',1,'Ticket_Category\setName()']]], + ['setnel3d',['setNel3D',['../classTicket__Info.html#a77fbf6da57aa02e075be0905dc6cdd48',1,'Ticket_Info']]], + ['setos',['setOS',['../classTicket__Info.html#aacb7cbb0f04959ae64ba1c3aac36df54',1,'Ticket_Info']]], + ['setpassword',['setPassword',['../classWebUsers.html#a91506e5f74c9884045e865ef7c314fed',1,'WebUsers\setPassword($user, $pass)'],['../classWebUsers.html#a91506e5f74c9884045e865ef7c314fed',1,'WebUsers\setPassword($user, $pass)']]], + ['setpatch_5fversion',['setPatch_Version',['../classTicket__Info.html#a1d0f55ed3b50a72bf882591474d2ff72',1,'Ticket_Info']]], + ['setpermission',['setPermission',['../classTicket__User.html#adf7c497fb026ee6e05f6ece91f541839',1,'Ticket_User']]], + ['setpriority',['setPriority',['../classTicket.html#a3080d0b46978a8f82022bbb6e5fc0c1c',1,'Ticket']]], + ['setprocessor',['setProcessor',['../classTicket__Info.html#a8b66f72ec1928b89058cd0a9b4dd8c11',1,'Ticket_Info']]], + ['setquery',['setQuery',['../classQuerycache.html#adbd6075ec5d3bd84122e52b0134ed8e7',1,'Querycache\setQuery()'],['../classTicket__Log.html#adbd6075ec5d3bd84122e52b0134ed8e7',1,'Ticket_Log\setQuery()']]], + ['setqueue',['setQueue',['../classTicket.html#a1595d3fe708fe4f453922054407a1c03',1,'Ticket']]], + ['setreceivemail',['setReceiveMail',['../classWebUsers.html#aa0f439ff7a5cd6377a557f545fbeb45c',1,'WebUsers\setReceiveMail($user, $receivemail)'],['../classWebUsers.html#aa0f439ff7a5cd6377a557f545fbeb45c',1,'WebUsers\setReceiveMail($user, $receivemail)']]], + ['setserver_5ftick',['setServer_Tick',['../classTicket__Info.html#ab6ff52082590b43d90f8f37fd5b31086',1,'Ticket_Info']]], + ['setsgroupid',['setSGroupId',['../classSupport__Group.html#aa49cb914be98fc354a45584c6f2b8be1',1,'Support_Group']]], + ['setshardid',['setShardId',['../classTicket__Info.html#a4026e593012113e253b80e3bbd5f6c13',1,'Ticket_Info']]], + ['setsid',['setSID',['../classQuerycache.html#a2f536a1f8c8e463eb0346ac375f2a24d',1,'Querycache']]], + ['setstatus',['setStatus',['../classTicket.html#a66605893c4afc9855f1e0cf8ccccac09',1,'Ticket']]], + ['settag',['setTag',['../classSupport__Group.html#a4de944a53debc51843530fe96296f220',1,'Support_Group']]], + ['settcategoryid',['setTCategoryId',['../classTicket__Category.html#a39a64c3f7ab33ba3f5a67c31647e889f',1,'Ticket_Category']]], + ['settcontentid',['setTContentId',['../classTicket__Content.html#ae07366727208e060372063e96591c5d4',1,'Ticket_Content']]], + ['setticket',['setTicket',['../classAssigned.html#a47c6ae5b3cd713fdbf0a7f4d568b7c27',1,'Assigned\setTicket()'],['../classForwarded.html#a47c6ae5b3cd713fdbf0a7f4d568b7c27',1,'Forwarded\setTicket()'],['../classTicket__Info.html#a47c6ae5b3cd713fdbf0a7f4d568b7c27',1,'Ticket_Info\setTicket()'],['../classTicket__Log.html#a47c6ae5b3cd713fdbf0a7f4d568b7c27',1,'Ticket_Log\setTicket()'],['../classTicket__Reply.html#a47c6ae5b3cd713fdbf0a7f4d568b7c27',1,'Ticket_Reply\setTicket()']]], + ['setticket_5fcategory',['setTicket_Category',['../classTicket.html#a4e38b2a263b5a934b76cd77f026308c3',1,'Ticket']]], + ['settid',['setTId',['../classTicket.html#a8c72dc7b09645b390043f5a4664e7c7f',1,'Ticket']]], + ['settimestamp',['setTimestamp',['../classTicket.html#a4e05995d5cc78cdc9ffe72d864811ac6',1,'Ticket\setTimestamp()'],['../classTicket__Log.html#aa8903a0020a17d745524806f4e751f4c',1,'Ticket_Log\setTimestamp()'],['../classTicket__Reply.html#aa8903a0020a17d745524806f4e751f4c',1,'Ticket_Reply\setTimestamp()']]], + ['settinfoid',['setTInfoId',['../classTicket__Info.html#a5e98fba0b50f74645a2fdaa8f4d0c1ea',1,'Ticket_Info']]], + ['settings',['settings',['../drupal__module_2ryzommanage_2inc_2settings_8php.html#ad7354383714c6ae99d6ee1bfb95ab49f',1,'settings(): settings.php'],['../www_2html_2inc_2settings_8php.html#ad7354383714c6ae99d6ee1bfb95ab49f',1,'settings(): settings.php']]], + ['settings_2ephp',['settings.php',['../drupal__module_2ryzommanage_2inc_2settings_8php.html',1,'']]], + ['settings_2ephp',['settings.php',['../www_2html_2inc_2settings_8php.html',1,'']]], + ['settitle',['setTitle',['../classTicket.html#ac765da6fa83b06ea39c0edc9b3e6c6c0',1,'Ticket']]], + ['settlogid',['setTLogId',['../classTicket__Log.html#aca708aae8c7320e11d9e08936ec74dec',1,'Ticket_Log']]], + ['settreplyid',['setTReplyId',['../classTicket__Reply.html#a7b91b481de87eb1515212d62b298cb94',1,'Ticket_Reply']]], + ['settuserid',['setTUserId',['../classTicket__User.html#a0faf8954e86346e7b566870b1a3c0a4a',1,'Ticket_User']]], + ['settype',['setType',['../classQuerycache.html#a0f29af8d4b9fdd8959739727a33acee5',1,'Querycache']]], + ['setuser',['setUser',['../classAssigned.html#af560ca7f201e2f871384a150e8ffd9aa',1,'Assigned\setUser()'],['../classIn__Support__Group.html#af560ca7f201e2f871384a150e8ffd9aa',1,'In_Support_Group\setUser()']]], + ['setuser_5fid',['setUser_Id',['../classTicket__Info.html#aec77405f6e096f2c0493383724f33034',1,'Ticket_Info']]], + ['setuser_5fposition',['setUser_Position',['../classTicket__Info.html#a41cfb7786d3252b2ec7aec42d77add9f',1,'Ticket_Info']]], + ['setview_5fposition',['setView_Position',['../classTicket__Info.html#a58912ec04451ab232d88bd78b6a8c2ea',1,'Ticket_Info']]], + ['sgroup_5flist',['sgroup_list',['../sgroup__list_8php.html#ab3af46486585b0ddced2de27a5d7a000',1,'sgroup_list.php']]], + ['sgroup_5flist_2ephp',['sgroup_list.php',['../sgroup__list_8php.html',1,'']]], + ['show_5fqueue',['show_queue',['../show__queue_8php.html#a48695b07fef725dbf0b4f261b1fe1547',1,'show_queue.php']]], + ['show_5fqueue_2ephp',['show_queue.php',['../show__queue_8php.html',1,'']]], + ['show_5freply',['show_reply',['../show__reply_8php.html#ad8e51d3b3a4bf996fb07199a08ca9a3e',1,'show_reply.php']]], + ['show_5freply_2ephp',['show_reply.php',['../show__reply_8php.html',1,'']]], + ['show_5fsgroup',['show_sgroup',['../show__sgroup_8php.html#a118719426cb30ed43e39c2af24cfea2d',1,'show_sgroup.php']]], + ['show_5fsgroup_2ephp',['show_sgroup.php',['../show__sgroup_8php.html',1,'']]], + ['show_5fticket',['show_ticket',['../show__ticket_8php.html#a1249d6cae97f6949ce3a7754fa1b7016',1,'show_ticket.php']]], + ['show_5fticket_2ephp',['show_ticket.php',['../show__ticket_8php.html',1,'']]], + ['show_5fticket_5finfo',['show_ticket_info',['../show__ticket__info_8php.html#a579a5c89b55189455a8237369a78f0d8',1,'show_ticket_info.php']]], + ['show_5fticket_5finfo_2ephp',['show_ticket_info.php',['../show__ticket__info_8php.html',1,'']]], + ['show_5fticket_5flog',['show_ticket_log',['../show__ticket__log_8php.html#ab37298a659581e85338601f2259ead49',1,'show_ticket_log.php']]], + ['show_5fticket_5flog_2ephp',['show_ticket_log.php',['../show__ticket__log_8php.html',1,'']]], + ['show_5fuser',['show_user',['../drupal__module_2ryzommanage_2inc_2show__user_8php.html#ac755ca62882d4caca41c7822793b8812',1,'show_user(): show_user.php'],['../www_2html_2inc_2show__user_8php.html#ac755ca62882d4caca41c7822793b8812',1,'show_user(): show_user.php']]], + ['show_5fuser_2ephp',['show_user.php',['../drupal__module_2ryzommanage_2inc_2show__user_8php.html',1,'']]], + ['show_5fuser_2ephp',['show_user.php',['../www_2html_2inc_2show__user_8php.html',1,'']]], + ['support_5fgroup',['Support_Group',['../classSupport__Group.html',1,'']]], + ['support_5fgroup_2ephp',['support_group.php',['../support__group_8php.html',1,'']]], + ['supportgroup_5fentrynotexists',['supportGroup_EntryNotExists',['../classSupport__Group.html#aa557f337f57a3bb530f1f04df78c0f1e',1,'Support_Group']]], + ['supportgroup_5fexists',['supportGroup_Exists',['../classSupport__Group.html#ac235662693dcc9c2be51e6f1a2c426b6',1,'Support_Group']]], + ['sync',['Sync',['../classSync.html',1,'']]], + ['sync_2ephp',['sync.php',['../sync_8php.html',1,'']]], + ['sync_5fcron_2ephp',['sync_cron.php',['../sync__cron_8php.html',1,'']]], + ['syncdata',['syncdata',['../classSync.html#ad1211cc677b7aafcc4ebcc25f3cacdda',1,'Sync']]], + ['syncing',['syncing',['../syncing_8php.html#a8d4df31796dab54a8d0c9c9ec32cf7f9',1,'syncing.php']]], + ['syncing_2ephp',['syncing.php',['../syncing_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_74.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_74.html new file mode 100644 index 000000000..fdc6589d0 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_74.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_74.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_74.js new file mode 100644 index 000000000..4c4c97839 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_74.js @@ -0,0 +1,24 @@ +var searchData= +[ + ['ticket',['Ticket',['../classTicket.html',1,'']]], + ['ticket_2ephp',['ticket.php',['../ticket_8php.html',1,'']]], + ['ticket_5fcategory',['Ticket_Category',['../classTicket__Category.html',1,'']]], + ['ticket_5fcategory_2ephp',['ticket_category.php',['../ticket__category_8php.html',1,'']]], + ['ticket_5fcontent',['Ticket_Content',['../classTicket__Content.html',1,'']]], + ['ticket_5fcontent_2ephp',['ticket_content.php',['../ticket__content_8php.html',1,'']]], + ['ticket_5finfo',['Ticket_Info',['../classTicket__Info.html',1,'']]], + ['ticket_5finfo_2ephp',['ticket_info.php',['../ticket__info_8php.html',1,'']]], + ['ticket_5flog',['Ticket_Log',['../classTicket__Log.html',1,'']]], + ['ticket_5flog_2ephp',['ticket_log.php',['../ticket__log_8php.html',1,'']]], + ['ticket_5fqueue',['Ticket_Queue',['../classTicket__Queue.html',1,'']]], + ['ticket_5fqueue_2ephp',['ticket_queue.php',['../ticket__queue_8php.html',1,'']]], + ['ticket_5fqueue_5fhandler',['Ticket_Queue_Handler',['../classTicket__Queue__Handler.html',1,'']]], + ['ticket_5fqueue_5fhandler_2ephp',['ticket_queue_handler.php',['../ticket__queue__handler_8php.html',1,'']]], + ['ticket_5freply',['Ticket_Reply',['../classTicket__Reply.html',1,'']]], + ['ticket_5freply_2ephp',['ticket_reply.php',['../ticket__reply_8php.html',1,'']]], + ['ticket_5fuser',['Ticket_User',['../classTicket__User.html',1,'']]], + ['ticket_5fuser_2ephp',['ticket_user.php',['../ticket__user_8php.html',1,'']]], + ['ticketexists',['ticketExists',['../classTicket.html#a091d7ec56d4dc4bf980b81e8069b76d0',1,'Ticket']]], + ['tickethasinfo',['TicketHasInfo',['../classTicket__Info.html#a361217eb1d85e13aa534dabfbbd64a86',1,'Ticket_Info']]], + ['time_5felapsed_5fstring',['time_elapsed_string',['../classGui__Elements.html#a04d9bc70e65231a470426f0a94b7583d',1,'Gui_Elements']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_75.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_75.html new file mode 100644 index 000000000..ab8455ed5 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_75.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_75.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_75.js new file mode 100644 index 000000000..ad5f4cb36 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_75.js @@ -0,0 +1,12 @@ +var searchData= +[ + ['unassignticket',['unAssignTicket',['../classAssigned.html#a8263a9c223957bb558a2c16d4431ca29',1,'Assigned\unAssignTicket()'],['../classTicket.html#a8263a9c223957bb558a2c16d4431ca29',1,'Ticket\unAssignTicket()']]], + ['update',['update',['../classQuerycache.html#a842e4774e3b3601a005b995c02f7e883',1,'Querycache\update()'],['../classSupport__Group.html#a842e4774e3b3601a005b995c02f7e883',1,'Support_Group\update()'],['../classTicket.html#a842e4774e3b3601a005b995c02f7e883',1,'Ticket\update()'],['../classTicket__Category.html#a842e4774e3b3601a005b995c02f7e883',1,'Ticket_Category\update()'],['../classTicket__Content.html#a842e4774e3b3601a005b995c02f7e883',1,'Ticket_Content\update()'],['../classTicket__Log.html#a842e4774e3b3601a005b995c02f7e883',1,'Ticket_Log\update()'],['../classTicket__Reply.html#a842e4774e3b3601a005b995c02f7e883',1,'Ticket_Reply\update()'],['../classTicket__User.html#a842e4774e3b3601a005b995c02f7e883',1,'Ticket_User\update()']]], + ['updateticketstatus',['updateTicketStatus',['../classTicket.html#a6da2625040e9f06c583e9303082c556f',1,'Ticket']]], + ['updateticketstatusandpriority',['updateTicketStatusAndPriority',['../classTicket.html#a64f08c8987c9eb00d4bfc9ef94e45326',1,'Ticket']]], + ['userexistsinsgroup',['userExistsInSGroup',['../classIn__Support__Group.html#a1a25afa24efc6c01ffd236f735281543',1,'In_Support_Group']]], + ['userlist',['userlist',['../userlist_8php.html#a55709a05f18e09358e2b02531eb859ad',1,'userlist.php']]], + ['userlist_2ephp',['userlist.php',['../userlist_8php.html',1,'']]], + ['users',['Users',['../classUsers.html',1,'']]], + ['users_2ephp',['users.php',['../users_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_76.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_76.html new file mode 100644 index 000000000..0ff5edd34 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_76.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_76.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_76.js new file mode 100644 index 000000000..1566125d3 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_76.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['validemail',['validEmail',['../classUsers.html#a73637e760498c5cea55074896ec982ac',1,'Users']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_77.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_77.html new file mode 100644 index 000000000..73323d316 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_77.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_77.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_77.js new file mode 100644 index 000000000..5a36cb483 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/all_77.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['webusers',['WebUsers',['../classWebUsers.html',1,'']]], + ['webusers_2ephp',['webusers.php',['../drupal__module_2ryzommanage_2autoload_2webusers_8php.html',1,'']]], + ['webusers_2ephp',['webusers.php',['../www_2html_2autoload_2webusers_8php.html',1,'']]], + ['write_5fuser',['write_user',['../add__user_8php.html#a09df49f177966f5b08af71ec43760e0c',1,'add_user.php']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_61.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_61.html new file mode 100644 index 000000000..85e5d72a3 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_61.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_61.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_61.js new file mode 100644 index 000000000..39d4914a1 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_61.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['assigned',['Assigned',['../classAssigned.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_64.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_64.html new file mode 100644 index 000000000..590270830 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_64.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_64.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_64.js new file mode 100644 index 000000000..db9b214c1 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_64.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['dblayer',['DBLayer',['../classDBLayer.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_66.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_66.html new file mode 100644 index 000000000..941988c65 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_66.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_66.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_66.js new file mode 100644 index 000000000..518614d90 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_66.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['forwarded',['Forwarded',['../classForwarded.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_67.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_67.html new file mode 100644 index 000000000..78b514df0 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_67.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_67.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_67.js new file mode 100644 index 000000000..e85658e41 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_67.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['gui_5felements',['Gui_Elements',['../classGui__Elements.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_68.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_68.html new file mode 100644 index 000000000..475eeb738 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_68.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_68.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_68.js new file mode 100644 index 000000000..9e86cb7a3 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_68.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['helpers',['Helpers',['../classHelpers.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_69.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_69.html new file mode 100644 index 000000000..961dbea27 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_69.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_69.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_69.js new file mode 100644 index 000000000..49e6133b0 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_69.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['in_5fsupport_5fgroup',['In_Support_Group',['../classIn__Support__Group.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_6d.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_6d.html new file mode 100644 index 000000000..abe6f0d1d --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_6d.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_6d.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_6d.js new file mode 100644 index 000000000..ae1e0f417 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_6d.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['mail_5fhandler',['Mail_Handler',['../classMail__Handler.html',1,'']]], + ['mycrypt',['MyCrypt',['../classMyCrypt.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_70.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_70.html new file mode 100644 index 000000000..e4b520874 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_70.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_70.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_70.js new file mode 100644 index 000000000..157d7c6b6 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_70.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['pagination',['Pagination',['../classPagination.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_71.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_71.html new file mode 100644 index 000000000..80a4fbb83 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_71.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_71.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_71.js new file mode 100644 index 000000000..e2ca060ac --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_71.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['querycache',['Querycache',['../classQuerycache.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_73.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_73.html new file mode 100644 index 000000000..a1bf0b912 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_73.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_73.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_73.js new file mode 100644 index 000000000..8941e45df --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_73.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['support_5fgroup',['Support_Group',['../classSupport__Group.html',1,'']]], + ['sync',['Sync',['../classSync.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_74.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_74.html new file mode 100644 index 000000000..f7f27cea7 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_74.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_74.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_74.js new file mode 100644 index 000000000..90ec7727d --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_74.js @@ -0,0 +1,12 @@ +var searchData= +[ + ['ticket',['Ticket',['../classTicket.html',1,'']]], + ['ticket_5fcategory',['Ticket_Category',['../classTicket__Category.html',1,'']]], + ['ticket_5fcontent',['Ticket_Content',['../classTicket__Content.html',1,'']]], + ['ticket_5finfo',['Ticket_Info',['../classTicket__Info.html',1,'']]], + ['ticket_5flog',['Ticket_Log',['../classTicket__Log.html',1,'']]], + ['ticket_5fqueue',['Ticket_Queue',['../classTicket__Queue.html',1,'']]], + ['ticket_5fqueue_5fhandler',['Ticket_Queue_Handler',['../classTicket__Queue__Handler.html',1,'']]], + ['ticket_5freply',['Ticket_Reply',['../classTicket__Reply.html',1,'']]], + ['ticket_5fuser',['Ticket_User',['../classTicket__User.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_75.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_75.html new file mode 100644 index 000000000..807d7426e --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_75.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_75.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_75.js new file mode 100644 index 000000000..432c5d270 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_75.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['users',['Users',['../classUsers.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_77.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_77.html new file mode 100644 index 000000000..e3967e972 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_77.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_77.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_77.js new file mode 100644 index 000000000..0e579ee3d --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/classes_77.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['webusers',['WebUsers',['../classWebUsers.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/close.png b/code/ryzom/tools/server/ryzom_ams_docs/html/search/close.png new file mode 100644 index 000000000..9342d3dfe Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams_docs/html/search/close.png differ diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_61.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_61.html new file mode 100644 index 000000000..5a8e45499 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_61.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_61.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_61.js new file mode 100644 index 000000000..db9b27c9e --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_61.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['add_5fsgroup_2ephp',['add_sgroup.php',['../add__sgroup_8php.html',1,'']]], + ['add_5fuser_2ephp',['add_user.php',['../add__user_8php.html',1,'']]], + ['add_5fuser_5fto_5fsgroup_2ephp',['add_user_to_sgroup.php',['../add__user__to__sgroup_8php.html',1,'']]], + ['assigned_2ephp',['assigned.php',['../assigned_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_63.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_63.html new file mode 100644 index 000000000..6611a5b91 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_63.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_63.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_63.js new file mode 100644 index 000000000..47c38c050 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_63.js @@ -0,0 +1,12 @@ +var searchData= +[ + ['change_5finfo_2ephp',['change_info.php',['../change__info_8php.html',1,'']]], + ['change_5fmail_2ephp',['change_mail.php',['../change__mail_8php.html',1,'']]], + ['change_5fpassword_2ephp',['change_password.php',['../change__password_8php.html',1,'']]], + ['change_5fpermission_2ephp',['change_permission.php',['../change__permission_8php.html',1,'']]], + ['change_5freceivemail_2ephp',['change_receivemail.php',['../change__receivemail_8php.html',1,'']]], + ['config_2ephp',['config.php',['../www_2config_8php.html',1,'']]], + ['config_2ephp',['config.php',['../drupal__module_2ryzommanage_2config_8php.html',1,'']]], + ['create_5fticket_2ephp',['create_ticket.php',['../create__ticket_8php.html',1,'']]], + ['createticket_2ephp',['createticket.php',['../createticket_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_64.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_64.html new file mode 100644 index 000000000..1a32bf882 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_64.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_64.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_64.js new file mode 100644 index 000000000..8307e204b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_64.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['dashboard_2ephp',['dashboard.php',['../dashboard_8php.html',1,'']]], + ['dblayer_2ephp',['dblayer.php',['../dblayer_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_65.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_65.html new file mode 100644 index 000000000..1eadd1b02 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_65.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_65.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_65.js new file mode 100644 index 000000000..ec7451ee2 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_65.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['error_2ephp',['error.php',['../error_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_66.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_66.html new file mode 100644 index 000000000..c05640363 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_66.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_66.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_66.js new file mode 100644 index 000000000..ab77df41b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_66.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['forwarded_2ephp',['forwarded.php',['../forwarded_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_67.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_67.html new file mode 100644 index 000000000..d5df283f3 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_67.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_67.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_67.js new file mode 100644 index 000000000..e6e52c243 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_67.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['gui_5felements_2ephp',['gui_elements.php',['../gui__elements_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_68.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_68.html new file mode 100644 index 000000000..8ead5893f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_68.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_68.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_68.js new file mode 100644 index 000000000..05d1801f3 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_68.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['helpers_2ephp',['helpers.php',['../helpers_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_69.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_69.html new file mode 100644 index 000000000..7fbd757cd --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_69.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_69.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_69.js new file mode 100644 index 000000000..74065c1ec --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_69.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['in_5fsupport_5fgroup_2ephp',['in_support_group.php',['../in__support__group_8php.html',1,'']]], + ['index_2ephp',['index.php',['../index_8php.html',1,'']]], + ['info_2ephp',['info.php',['../info_8php.html',1,'']]], + ['install_2ephp',['install.php',['../install_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_6c.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_6c.html new file mode 100644 index 000000000..642a54585 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_6c.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_6c.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_6c.js new file mode 100644 index 000000000..3b8359fc2 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_6c.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['libinclude_2ephp',['libinclude.php',['../libinclude_8php.html',1,'']]], + ['login_2ephp',['login.php',['../inc_2login_8php.html',1,'']]], + ['login_2ephp',['login.php',['../func_2login_8php.html',1,'']]], + ['logout_2ephp',['logout.php',['../www_2html_2inc_2logout_8php.html',1,'']]], + ['logout_2ephp',['logout.php',['../drupal__module_2ryzommanage_2inc_2logout_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_6d.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_6d.html new file mode 100644 index 000000000..d9d93006b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_6d.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_6d.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_6d.js new file mode 100644 index 000000000..b19770b9b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_6d.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['mail_5fcron_2ephp',['mail_cron.php',['../mail__cron_8php.html',1,'']]], + ['mail_5fhandler_2ephp',['mail_handler.php',['../mail__handler_8php.html',1,'']]], + ['modify_5femail_5fof_5fsgroup_2ephp',['modify_email_of_sgroup.php',['../modify__email__of__sgroup_8php.html',1,'']]], + ['mycrypt_2ephp',['mycrypt.php',['../mycrypt_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_70.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_70.html new file mode 100644 index 000000000..abcae9a6f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_70.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_70.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_70.js new file mode 100644 index 000000000..f1c0593fa --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_70.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['pagination_2ephp',['pagination.php',['../pagination_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_71.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_71.html new file mode 100644 index 000000000..bb4ccc7cc --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_71.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_71.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_71.js new file mode 100644 index 000000000..c2eeb72ca --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_71.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['querycache_2ephp',['querycache.php',['../querycache_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_72.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_72.html new file mode 100644 index 000000000..609fb48fc --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_72.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_72.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_72.js new file mode 100644 index 000000000..721d27957 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_72.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['register_2ephp',['register.php',['../register_8php.html',1,'']]], + ['reply_5fon_5fticket_2ephp',['reply_on_ticket.php',['../reply__on__ticket_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_73.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_73.html new file mode 100644 index 000000000..e0de9e6b5 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_73.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_73.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_73.js new file mode 100644 index 000000000..2ce5655bb --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_73.js @@ -0,0 +1,18 @@ +var searchData= +[ + ['settings_2ephp',['settings.php',['../drupal__module_2ryzommanage_2inc_2settings_8php.html',1,'']]], + ['settings_2ephp',['settings.php',['../www_2html_2inc_2settings_8php.html',1,'']]], + ['sgroup_5flist_2ephp',['sgroup_list.php',['../sgroup__list_8php.html',1,'']]], + ['show_5fqueue_2ephp',['show_queue.php',['../show__queue_8php.html',1,'']]], + ['show_5freply_2ephp',['show_reply.php',['../show__reply_8php.html',1,'']]], + ['show_5fsgroup_2ephp',['show_sgroup.php',['../show__sgroup_8php.html',1,'']]], + ['show_5fticket_2ephp',['show_ticket.php',['../show__ticket_8php.html',1,'']]], + ['show_5fticket_5finfo_2ephp',['show_ticket_info.php',['../show__ticket__info_8php.html',1,'']]], + ['show_5fticket_5flog_2ephp',['show_ticket_log.php',['../show__ticket__log_8php.html',1,'']]], + ['show_5fuser_2ephp',['show_user.php',['../www_2html_2inc_2show__user_8php.html',1,'']]], + ['show_5fuser_2ephp',['show_user.php',['../drupal__module_2ryzommanage_2inc_2show__user_8php.html',1,'']]], + ['support_5fgroup_2ephp',['support_group.php',['../support__group_8php.html',1,'']]], + ['sync_2ephp',['sync.php',['../sync_8php.html',1,'']]], + ['sync_5fcron_2ephp',['sync_cron.php',['../sync__cron_8php.html',1,'']]], + ['syncing_2ephp',['syncing.php',['../syncing_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_74.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_74.html new file mode 100644 index 000000000..017b3fe9f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_74.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_74.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_74.js new file mode 100644 index 000000000..47b5068e4 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_74.js @@ -0,0 +1,12 @@ +var searchData= +[ + ['ticket_2ephp',['ticket.php',['../ticket_8php.html',1,'']]], + ['ticket_5fcategory_2ephp',['ticket_category.php',['../ticket__category_8php.html',1,'']]], + ['ticket_5fcontent_2ephp',['ticket_content.php',['../ticket__content_8php.html',1,'']]], + ['ticket_5finfo_2ephp',['ticket_info.php',['../ticket__info_8php.html',1,'']]], + ['ticket_5flog_2ephp',['ticket_log.php',['../ticket__log_8php.html',1,'']]], + ['ticket_5fqueue_2ephp',['ticket_queue.php',['../ticket__queue_8php.html',1,'']]], + ['ticket_5fqueue_5fhandler_2ephp',['ticket_queue_handler.php',['../ticket__queue__handler_8php.html',1,'']]], + ['ticket_5freply_2ephp',['ticket_reply.php',['../ticket__reply_8php.html',1,'']]], + ['ticket_5fuser_2ephp',['ticket_user.php',['../ticket__user_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_75.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_75.html new file mode 100644 index 000000000..8ea7b3d4b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_75.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_75.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_75.js new file mode 100644 index 000000000..2d05f2341 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_75.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['userlist_2ephp',['userlist.php',['../userlist_8php.html',1,'']]], + ['users_2ephp',['users.php',['../users_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_77.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_77.html new file mode 100644 index 000000000..69f689782 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_77.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_77.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_77.js new file mode 100644 index 000000000..5c7ec501b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/files_77.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['webusers_2ephp',['webusers.php',['../drupal__module_2ryzommanage_2autoload_2webusers_8php.html',1,'']]], + ['webusers_2ephp',['webusers.php',['../www_2html_2autoload_2webusers_8php.html',1,'']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_5f.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_5f.html new file mode 100644 index 000000000..cb54e927d --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_5f.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_5f.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_5f.js new file mode 100644 index 000000000..844048eb7 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_5f.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['_5f_5fautoload',['__autoload',['../libinclude_8php.html#a2ecfde85f554ea0b3fef0993aef304a9',1,'libinclude.php']]], + ['_5f_5fconstruct',['__construct',['../classAssigned.html#a095c5d389db211932136b53f25f39685',1,'Assigned\__construct()'],['../classDBLayer.html#a800f8efee13692788b13ee57c5960092',1,'DBLayer\__construct()'],['../classForwarded.html#a095c5d389db211932136b53f25f39685',1,'Forwarded\__construct()'],['../classIn__Support__Group.html#a095c5d389db211932136b53f25f39685',1,'In_Support_Group\__construct()'],['../classMyCrypt.html#af200cbfd49bfea2fecf5629ab2361033',1,'MyCrypt\__construct()'],['../classPagination.html#a2a1aecb8f526796b3d62e8278edc07c3',1,'Pagination\__construct()'],['../classQuerycache.html#a095c5d389db211932136b53f25f39685',1,'Querycache\__construct()'],['../classSupport__Group.html#a095c5d389db211932136b53f25f39685',1,'Support_Group\__construct()'],['../classTicket.html#a095c5d389db211932136b53f25f39685',1,'Ticket\__construct()'],['../classTicket__Category.html#a095c5d389db211932136b53f25f39685',1,'Ticket_Category\__construct()'],['../classTicket__Content.html#a095c5d389db211932136b53f25f39685',1,'Ticket_Content\__construct()'],['../classTicket__Info.html#a095c5d389db211932136b53f25f39685',1,'Ticket_Info\__construct()'],['../classTicket__Log.html#a095c5d389db211932136b53f25f39685',1,'Ticket_Log\__construct()'],['../classTicket__Queue__Handler.html#a095c5d389db211932136b53f25f39685',1,'Ticket_Queue_Handler\__construct()'],['../classTicket__Reply.html#a095c5d389db211932136b53f25f39685',1,'Ticket_Reply\__construct()'],['../classTicket__User.html#a095c5d389db211932136b53f25f39685',1,'Ticket_User\__construct()'],['../classWebUsers.html#a4e63742e531873e01e1e97dd7530539b',1,'WebUsers\__construct($UId=0)'],['../classWebUsers.html#a4e63742e531873e01e1e97dd7530539b',1,'WebUsers\__construct($UId=0)']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_61.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_61.html new file mode 100644 index 000000000..7f395337e --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_61.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_61.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_61.js new file mode 100644 index 000000000..8bc0ff34b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_61.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['add_5fsgroup',['add_sgroup',['../add__sgroup_8php.html#a45490c056bdd114ef28893fc29286d2b',1,'add_sgroup.php']]], + ['add_5fuser',['add_user',['../add__user_8php.html#a69e8de25de7560db0292bb474882a489',1,'add_user.php']]], + ['add_5fuser_5fto_5fsgroup',['add_user_to_sgroup',['../add__user__to__sgroup_8php.html#a6ad0c5a1bfd563e11a107bf0023b6150',1,'add_user_to_sgroup.php']]], + ['addusertosupportgroup',['addUserToSupportGroup',['../classSupport__Group.html#a4616317379ffef08dbaeea2a9dbba02c',1,'Support_Group']]], + ['assignticket',['assignTicket',['../classAssigned.html#a51c3d5b6f78de455619581fd3e591f17',1,'Assigned\assignTicket()'],['../classTicket.html#a51c3d5b6f78de455619581fd3e591f17',1,'Ticket\assignTicket()']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_63.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_63.html new file mode 100644 index 000000000..9ebe11d69 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_63.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_63.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_63.js new file mode 100644 index 000000000..dfdf9b93d --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_63.js @@ -0,0 +1,42 @@ +var searchData= +[ + ['change_5finfo',['change_info',['../change__info_8php.html#a1bbc74a7da07012d55b0b45726534265',1,'change_info.php']]], + ['change_5fmail',['change_mail',['../change__mail_8php.html#a03d0bca67a96c8744bd74623e128ab83',1,'change_mail.php']]], + ['change_5fpassword',['change_password',['../change__password_8php.html#a888360ab43db15eba1d5cc3623d4100f',1,'change_password.php']]], + ['change_5fpermission',['change_permission',['../classTicket__User.html#a78d4d6de74b1ee26cb9192f36e022416',1,'Ticket_User\change_permission()'],['../change__permission_8php.html#a9ad639fafd67bdc579cf3170cd0d26e7',1,'change_permission(): change_permission.php']]], + ['change_5freceivemail',['change_receivemail',['../change__receivemail_8php.html#a22ae748f60d7b4200dce30c94a52c421',1,'change_receivemail.php']]], + ['check_5fchange_5fpassword',['check_change_password',['../classUsers.html#a9c78408d50465957eeb8068810315a8e',1,'Users']]], + ['check_5fif_5fgame_5fclient',['check_if_game_client',['../classHelpers.html#a4e3e5309a66456d81a1effdabcc9cd79',1,'Helpers']]], + ['check_5flogin_5fingame',['check_login_ingame',['../classHelpers.html#abd01528a1145831a4fc98eae7ffaca36',1,'Helpers']]], + ['check_5fmethods',['check_methods',['../classMyCrypt.html#ad72fefc790b0bb1ac6edc252427b0970',1,'MyCrypt']]], + ['check_5fregister',['check_Register',['../classUsers.html#a740de04dc3aa7cf3bed959540ffab8f8',1,'Users']]], + ['checkemail',['checkEmail',['../classUsers.html#a76646237ab053cdde386c06aa5437d8a',1,'Users']]], + ['checkemailexists',['checkEmailExists',['../classUsers.html#a37275e677004927b6b1a30e16c5b5b38',1,'Users\checkEmailExists()'],['../classWebUsers.html#a37275e677004927b6b1a30e16c5b5b38',1,'WebUsers\checkEmailExists($email)'],['../classWebUsers.html#a37275e677004927b6b1a30e16c5b5b38',1,'WebUsers\checkEmailExists($email)']]], + ['checkloginmatch',['checkLoginMatch',['../classUsers.html#af0b98012abb190cf4617999f008de27e',1,'Users\checkLoginMatch()'],['../classWebUsers.html#a11894eb69bb2f172baf5186e8f92246d',1,'WebUsers\checkLoginMatch($username, $password)'],['../classWebUsers.html#a11894eb69bb2f172baf5186e8f92246d',1,'WebUsers\checkLoginMatch($username, $password)']]], + ['checkpassword',['checkPassword',['../classUsers.html#a4cb5e34b56fb6de0ec318fb59e90838f',1,'Users']]], + ['checkuser',['checkUser',['../classUsers.html#adfffce17947a9f72d68838db250c9ab8',1,'Users']]], + ['checkusernameexists',['checkUserNameExists',['../classUsers.html#ac3a8cb9a038f6aef0bd98be091274122',1,'Users\checkUserNameExists()'],['../classWebUsers.html#ac3a8cb9a038f6aef0bd98be091274122',1,'WebUsers\checkUserNameExists($username)'],['../classWebUsers.html#ac3a8cb9a038f6aef0bd98be091274122',1,'WebUsers\checkUserNameExists($username)']]], + ['confirmpassword',['confirmPassword',['../classUsers.html#a2f5349025bed3874f08d80652cab2fe0',1,'Users']]], + ['constr_5fexternid',['constr_ExternId',['../classTicket__User.html#a4e5c577ed0a9da4b1c56397912f02ba0',1,'Ticket_User']]], + ['constr_5fsgroupid',['constr_SGroupId',['../classSupport__Group.html#a873beb80bd0b5d572704cdb6d2ec34eb',1,'Support_Group']]], + ['constr_5ftcategoryid',['constr_TCategoryId',['../classTicket__Category.html#a332d2dd59b46fc933a3c9a1b2967803a',1,'Ticket_Category']]], + ['constr_5ftcontentid',['constr_TContentId',['../classTicket__Content.html#aa28ad9a063c1914ff75d19afd25c707f',1,'Ticket_Content']]], + ['constr_5ftlogid',['constr_TLogId',['../classTicket__Log.html#a001ec13f64bb026b1c8a3b3bd02ee22b',1,'Ticket_Log']]], + ['constr_5ftreplyid',['constr_TReplyId',['../classTicket__Reply.html#a4b4493d28e8518a87667d285c49e5e24',1,'Ticket_Reply']]], + ['constr_5ftuserid',['constr_TUserId',['../classTicket__User.html#a10939bce9b667f26d3827993b4e3df1d',1,'Ticket_User']]], + ['create',['create',['../classAssigned.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Assigned\create()'],['../classForwarded.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Forwarded\create()'],['../classIn__Support__Group.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'In_Support_Group\create()'],['../classSupport__Group.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Support_Group\create()'],['../classTicket.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Ticket\create()'],['../classTicket__Content.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Ticket_Content\create()'],['../classTicket__Info.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Ticket_Info\create()'],['../classTicket__Reply.html#a435e7d7525d4bcd0ed5e34a469f3adf6',1,'Ticket_Reply\create()']]], + ['create_5ffolders',['create_folders',['../classHelpers.html#add8ef9ce82106c505f6f04c2a8e3b2b4',1,'Helpers']]], + ['create_5fticket',['create_Ticket',['../classTicket.html#a81b3285033bc3c9e89adfa8da34d61de',1,'Ticket\create_Ticket()'],['../create__ticket_8php.html#a65bcbfccf737c72927d15c06783cd9f4',1,'create_ticket(): create_ticket.php']]], + ['create_5fticket_5finfo',['create_Ticket_Info',['../classTicket__Info.html#aaa4e26c92338b70e874135af9c02bba9',1,'Ticket_Info']]], + ['createlogentry',['createLogEntry',['../classTicket__Log.html#a345a2da9c23780c7e6aef7134baa1749',1,'Ticket_Log']]], + ['createpermissions',['createPermissions',['../classUsers.html#aeac9f32fd53c97c92e5c774e154399df',1,'Users']]], + ['createqueue',['createQueue',['../classTicket__Queue.html#af077496b6071af47c19a873bf025c1f3',1,'Ticket_Queue\createQueue()'],['../classTicket__Queue__Handler.html#af077496b6071af47c19a873bf025c1f3',1,'Ticket_Queue_Handler\createQueue()']]], + ['createreply',['createReply',['../classTicket.html#af6568341f5052034440f79c0e74707a3',1,'Ticket\createReply()'],['../classTicket__Reply.html#aa6fa056fff4ddafc3eabf3ed72143e1b',1,'Ticket_Reply\createReply()']]], + ['createsupportgroup',['createSupportGroup',['../classSupport__Group.html#a31ee7c68c0ffb77438bb9ff095962568',1,'Support_Group']]], + ['createticket',['createticket',['../createticket_8php.html#aa8253d883a3ba14c6449a13ed2bb9c8f',1,'createticket.php']]], + ['createticketcategory',['createTicketCategory',['../classTicket__Category.html#a506fc7f32de9547e91a5dbb68c391907',1,'Ticket_Category']]], + ['createticketuser',['createTicketUser',['../classTicket__User.html#a37c416f7d3723874f3ac49c7f9f5a21c',1,'Ticket_User']]], + ['createuser',['createUser',['../classUsers.html#ac93aebf1960fb12975b120a2c394a8af',1,'Users']]], + ['createwebuser',['createWebuser',['../classWebUsers.html#a0cb7168a6b8358106512804ff28cea17',1,'WebUsers\createWebuser($name, $pass, $mail)'],['../classWebUsers.html#a0cb7168a6b8358106512804ff28cea17',1,'WebUsers\createWebuser($name, $pass, $mail)']]], + ['cron',['cron',['../classMail__Handler.html#a1b65890aa4eb8c0c6129c3e787a53405',1,'Mail_Handler']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_64.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_64.html new file mode 100644 index 000000000..d8b63943c --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_64.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_64.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_64.js new file mode 100644 index 000000000..da5e1ad06 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_64.js @@ -0,0 +1,9 @@ +var searchData= +[ + ['dashboard',['dashboard',['../dashboard_8php.html#a54d0c80ff20df9df6439bb87608c375a',1,'dashboard.php']]], + ['decode_5futf8',['decode_utf8',['../classMail__Handler.html#a6fc5947eaa45b0724f8720b374481275',1,'Mail_Handler']]], + ['decrypt',['decrypt',['../classMyCrypt.html#aed69cdc691e1155856c905ee1c08d9b7',1,'MyCrypt']]], + ['delete',['delete',['../classAssigned.html#a13bdffdd926f26b825ea57066334ff01',1,'Assigned\delete()'],['../classForwarded.html#a13bdffdd926f26b825ea57066334ff01',1,'Forwarded\delete()'],['../classIn__Support__Group.html#a13bdffdd926f26b825ea57066334ff01',1,'In_Support_Group\delete()'],['../classSupport__Group.html#a13bdffdd926f26b825ea57066334ff01',1,'Support_Group\delete()']]], + ['deletesupportgroup',['deleteSupportGroup',['../classSupport__Group.html#ab4a7d3ba86333a058027c7d58b9137f1',1,'Support_Group']]], + ['deleteuserofsupportgroup',['deleteUserOfSupportGroup',['../classSupport__Group.html#ad2d1a010903640e39545085b93b9a4f1',1,'Support_Group']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_65.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_65.html new file mode 100644 index 000000000..a77debae0 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_65.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_65.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_65.js new file mode 100644 index 000000000..348a0bc5f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_65.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['encrypt',['encrypt',['../classMyCrypt.html#a07bcc8ef1d23370470ecb5ae8fc07dfa',1,'MyCrypt']]], + ['error',['error',['../error_8php.html#a43b8d30b879d4f09ceb059b02af2bc02',1,'error.php']]], + ['execute',['execute',['../classDBLayer.html#a9a0e3ecb193fecd94263eda79c54bcc4',1,'DBLayer']]], + ['executereturnid',['executeReturnId',['../classDBLayer.html#a9a8137347ec2d551de3ec54cfb3bdb1a',1,'DBLayer']]], + ['executewithoutparams',['executeWithoutParams',['../classDBLayer.html#a33552c5325c469ac1aa0d049d2312468',1,'DBLayer']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_66.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_66.html new file mode 100644 index 000000000..319a5316a --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_66.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_66.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_66.js new file mode 100644 index 000000000..608fb4187 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_66.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['forwardticket',['forwardTicket',['../classForwarded.html#aa6f01e425a0f845ce55c2d90aeb11db0',1,'Forwarded\forwardTicket()'],['../classTicket.html#a3fdc6def6a0feaf4c2458811b8c75050',1,'Ticket\forwardTicket()']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_67.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_67.html new file mode 100644 index 000000000..d0ab42a3f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_67.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_67.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_67.js new file mode 100644 index 000000000..6f68d029b --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_67.js @@ -0,0 +1,106 @@ +var searchData= +[ + ['generatesalt',['generateSALT',['../classUsers.html#afb7603ac9556c1069fbf1c0062251203',1,'Users']]], + ['get_5femail_5fby_5fuser_5fid',['get_email_by_user_id',['../classTicket__User.html#a7274bc305ccce731091c68d1607cb6e9',1,'Ticket_User']]], + ['get_5fid_5ffrom_5femail',['get_id_from_email',['../classTicket__User.html#a7feeb7a909bf6733de21300d0ea0e1bd',1,'Ticket_User']]], + ['get_5fid_5ffrom_5fusername',['get_id_from_username',['../classTicket__User.html#a0bcfa281f41b948eb42dd18992724543',1,'Ticket_User']]], + ['get_5fmime_5ftype',['get_mime_type',['../classMail__Handler.html#a719c5051ef00fbb0d7c7ce2c78e3b4e1',1,'Mail_Handler']]], + ['get_5fpart',['get_part',['../classMail__Handler.html#ab3a5e8f69692826c6dae96f873859642',1,'Mail_Handler']]], + ['get_5fticket_5fid_5ffrom_5fsubject',['get_ticket_id_from_subject',['../classMail__Handler.html#a8604569b1e012ea3b1fe466018f75ce2',1,'Mail_Handler']]], + ['get_5fusername_5ffrom_5fid',['get_username_from_id',['../classTicket__User.html#a266ff1e60e08dcd8c7e70f22f5a33e93',1,'Ticket_User']]], + ['getaction',['getAction',['../classTicket__Log.html#a189a4abe5faf11f4320d5d3f1d3d1715',1,'Ticket_Log']]], + ['getactiontextarray',['getActionTextArray',['../classTicket__Log.html#ac760071c0ce36337c16d8146fcb3bade',1,'Ticket_Log']]], + ['getallcategories',['getAllCategories',['../classTicket__Category.html#a1e4b8ecfd737337e35976126b521499f',1,'Ticket_Category']]], + ['getalllogs',['getAllLogs',['../classTicket__Log.html#aeaf1c995cc807afe241f6e7bdc684921',1,'Ticket_Log']]], + ['getallsupportgroups',['getAllSupportGroups',['../classSupport__Group.html#ad3fc18cb894f789d19a768ea63d9b673',1,'Support_Group']]], + ['getallusersofsupportgroup',['getAllUsersOfSupportGroup',['../classSupport__Group.html#a7f1662394a31e2a05e9863def178df12',1,'Support_Group']]], + ['getallusersquery',['getAllUsersQuery',['../classWebUsers.html#a2f8e928ed02e462b40e909965250fb7d',1,'WebUsers\getAllUsersQuery()'],['../classWebUsers.html#a2f8e928ed02e462b40e909965250fb7d',1,'WebUsers\getAllUsersQuery()']]], + ['getamountofrows',['getAmountOfRows',['../classPagination.html#ae43f78382809e3cd2aaa3c455cb0b2b4',1,'Pagination']]], + ['getargument',['getArgument',['../classTicket__Log.html#a88ec9370bcbdb60301f89e401c9e64e1',1,'Ticket_Log']]], + ['getassigned',['getAssigned',['../classTicket.html#a8234a4e23319778d234b3957f8b5d06c',1,'Ticket']]], + ['getauthor',['getAuthor',['../classTicket.html#a5286e30390ae3e1b274940286493dd24',1,'Ticket\getAuthor()'],['../classTicket__Log.html#a5286e30390ae3e1b274940286493dd24',1,'Ticket_Log\getAuthor()'],['../classTicket__Reply.html#a5286e30390ae3e1b274940286493dd24',1,'Ticket_Reply\getAuthor()']]], + ['getcategoryname',['getCategoryName',['../classTicket.html#a689e9d131777e7f1219ee0d65b088cb3',1,'Ticket']]], + ['getclient_5fversion',['getClient_Version',['../classTicket__Info.html#a5a9884f9f9b63d4a6ed8c6112704277d',1,'Ticket_Info']]], + ['getconnect_5fstate',['getConnect_State',['../classTicket__Info.html#a51a5247b7c82f60479ccdcfa33041c27',1,'Ticket_Info']]], + ['getcontent',['getContent',['../classTicket__Content.html#a58e43f09a06ce4e29b192c4e17ce7915',1,'Ticket_Content\getContent()'],['../classTicket__Reply.html#a58e43f09a06ce4e29b192c4e17ce7915',1,'Ticket_Reply\getContent()']]], + ['getcountryarray',['getCountryArray',['../drupal__module_2ryzommanage_2inc_2settings_8php.html#a9342547984d3c9a5ece41572951f8edf',1,'getCountryArray(): settings.php'],['../www_2html_2inc_2settings_8php.html#a9342547984d3c9a5ece41572951f8edf',1,'getCountryArray(): settings.php']]], + ['getcpu_5fmask',['getCPU_Mask',['../classTicket__Info.html#ae85e54574e6e0b17cd33b8c49255d228',1,'Ticket_Info']]], + ['getcpuid',['getCPUId',['../classTicket__Info.html#aba21caccb000efb673b8b66ca70a36c7',1,'Ticket_Info']]], + ['getcurrent',['getCurrent',['../classPagination.html#ad926899d7cac34a3f1a90e552d8eb27d',1,'Pagination']]], + ['getdb',['getDb',['../classQuerycache.html#aceb656ee5135578ab3a9947252caa772',1,'Querycache']]], + ['getelements',['getElements',['../classPagination.html#a97a3a3e912139aa222a7ca13fdb27d33',1,'Pagination']]], + ['getemail',['getEmail',['../classWebUsers.html#a02a01849f28e2535e888ae4ec87b20f2',1,'WebUsers\getEmail()'],['../classWebUsers.html#a02a01849f28e2535e888ae4ec87b20f2',1,'WebUsers\getEmail()']]], + ['getentireticket',['getEntireTicket',['../classTicket.html#a00572e06f01ae1cadb5949f1b45e8f04',1,'Ticket']]], + ['getexternid',['getExternId',['../classTicket__User.html#ace230deb485c9f115f7fea4ce92442a3',1,'Ticket_User']]], + ['getforwardedgroupid',['getForwardedGroupId',['../classTicket.html#aedbfa4efd5aaa96ac713817d12156f7e',1,'Ticket']]], + ['getforwardedgroupname',['getForwardedGroupName',['../classTicket.html#a34e17d1cc053a7b86ce2b58a3a347c7e',1,'Ticket']]], + ['getgroup',['getGroup',['../classForwarded.html#a4f44e7bc9de772c21b4304d11e87bf16',1,'Forwarded\getGroup()'],['../classIn__Support__Group.html#a4f44e7bc9de772c21b4304d11e87bf16',1,'In_Support_Group\getGroup()'],['../classSupport__Group.html#af6697615443145a2981e62aa741c3afa',1,'Support_Group\getGroup()']]], + ['getgroupemail',['getGroupEmail',['../classSupport__Group.html#a9d0f36a53db49c1f57e3cab8a61a7d90',1,'Support_Group']]], + ['getgroups',['getGroups',['../classSupport__Group.html#a562142b89699a1063ea9769030250365',1,'Support_Group']]], + ['gethidden',['getHidden',['../classTicket__Reply.html#a1d032efbce2b4edb7c269a1e13562f40',1,'Ticket_Reply']]], + ['getht',['getHT',['../classTicket__Info.html#a90d3c0edc1e767875c7fb98880886e73',1,'Ticket_Info']]], + ['getid',['getId',['../classWebUsers.html#a585ef354b38d0fad9d92f45e183b639f',1,'WebUsers\getId($username)'],['../classWebUsers.html#a585ef354b38d0fad9d92f45e183b639f',1,'WebUsers\getId($username)']]], + ['getidfromemail',['getIdFromEmail',['../classWebUsers.html#aee8d6b322defc5dfe8e47f382becca62',1,'WebUsers\getIdFromEmail($email)'],['../classWebUsers.html#aee8d6b322defc5dfe8e47f382becca62',1,'WebUsers\getIdFromEmail($email)']]], + ['getimap_5fmailserver',['getIMAP_MailServer',['../classSupport__Group.html#a30d67354e52f95489b93923440ff0661',1,'Support_Group']]], + ['getimap_5fpassword',['getIMAP_Password',['../classSupport__Group.html#a4983db184794db8f05ce93f5ba11ba7e',1,'Support_Group']]], + ['getimap_5fusername',['getIMAP_Username',['../classSupport__Group.html#a0ace9f66f2541d29e060cb7728030e93',1,'Support_Group']]], + ['getinfo',['getInfo',['../classWebUsers.html#a164026f74736817927e1cacd282a2e28',1,'WebUsers\getInfo()'],['../classWebUsers.html#a164026f74736817927e1cacd282a2e28',1,'WebUsers\getInfo()']]], + ['getlanguage',['getLanguage',['../classWebUsers.html#afcef2403c4111bc44ef0530f1e493909',1,'WebUsers\getLanguage()'],['../classWebUsers.html#afcef2403c4111bc44ef0530f1e493909',1,'WebUsers\getLanguage()']]], + ['getlast',['getLast',['../classPagination.html#a9316ede6960667d832997c8e20223623',1,'Pagination']]], + ['getlatestreply',['getLatestReply',['../classTicket.html#a3a4ce7e9c445dd245b3370304d0afd92',1,'Ticket']]], + ['getlinks',['getLinks',['../classPagination.html#aeecf550e63b55ecd5d737ecc46e07d3a',1,'Pagination']]], + ['getlocal_5faddress',['getLocal_Address',['../classTicket__Info.html#a49b4c851eff2f3d06531a39baa8423f5',1,'Ticket_Info']]], + ['getlogsofticket',['getLogsOfTicket',['../classTicket__Log.html#a37ad4d95b0bb2d5a6dfc2dd7c3744292',1,'Ticket_Log']]], + ['getmemory',['getMemory',['../classTicket__Info.html#a144248575cd034a40315155a9b48ff87',1,'Ticket_Info']]], + ['getmodsandadmins',['getModsAndAdmins',['../classTicket__User.html#a71099747902fb7e064ec1d4128ea4576',1,'Ticket_User']]], + ['getname',['getName',['../classSupport__Group.html#a3d0963e68bb313b163a73f2803c64600',1,'Support_Group\getName()'],['../classTicket__Category.html#a3d0963e68bb313b163a73f2803c64600',1,'Ticket_Category\getName()']]], + ['getnel3d',['getNel3D',['../classTicket__Info.html#abe3ae528bfd5495720c3adeff59fe11e',1,'Ticket_Info']]], + ['getnewestticket',['getNewestTicket',['../classTicket__Queue__Handler.html#ab5a79318a0c771083f03400093b3b2ec',1,'Ticket_Queue_Handler']]], + ['getnroftickets',['getNrOfTickets',['../classTicket__Queue__Handler.html#ada8f87ed8466c5e0477fa20359c3c8ad',1,'Ticket_Queue_Handler']]], + ['getnrofticketsassignedwaiting',['getNrOfTicketsAssignedWaiting',['../classTicket__Queue__Handler.html#a0d3daaaf5c79188eb62bb3adda11fa2a',1,'Ticket_Queue_Handler']]], + ['getnrofticketstodo',['getNrOfTicketsToDo',['../classTicket__Queue__Handler.html#ae8d1a2a66991583c05c173147e8dc657',1,'Ticket_Queue_Handler']]], + ['getos',['getOS',['../classTicket__Info.html#a9a1b88474ad97701d67a752d0c4d65c5',1,'Ticket_Info']]], + ['getpagination',['getPagination',['../classTicket__Queue__Handler.html#ab45a102a508e9727b108e8f24486c464',1,'Ticket_Queue_Handler']]], + ['getparams',['getParams',['../classTicket__Queue.html#ae32cd7c32721b02d676bb63b4b1366db',1,'Ticket_Queue']]], + ['getpatch_5fversion',['getPatch_Version',['../classTicket__Info.html#a6e41e115b03a1f152bd2c28c77d5fbac',1,'Ticket_Info']]], + ['getpermission',['getPermission',['../classTicket__User.html#a478067ecf173884c2ee3e5b94e746200',1,'Ticket_User']]], + ['getpriority',['getPriority',['../classTicket.html#a1e7a3c168dcd0901a0d2669c67575b55',1,'Ticket']]], + ['getpriorityarray',['getPriorityArray',['../classTicket.html#a509625cccc0b41f4ab3a658df705b3dc',1,'Ticket']]], + ['getprioritytext',['getPriorityText',['../classTicket.html#ae07f7808a12f2789593722f3293bd105',1,'Ticket']]], + ['getprocessor',['getProcessor',['../classTicket__Info.html#a3ace868ad456ff61f545cb44ee01c562',1,'Ticket_Info']]], + ['getquery',['getQuery',['../classQuerycache.html#a55f162785567258fe5138af282e588c2',1,'Querycache\getQuery()'],['../classTicket__Log.html#a55f162785567258fe5138af282e588c2',1,'Ticket_Log\getQuery()'],['../classTicket__Queue.html#a55f162785567258fe5138af282e588c2',1,'Ticket_Queue\getQuery()']]], + ['getqueue',['getQueue',['../classTicket.html#aa7a8055e5ee1eb792f29443ddb79c4d3',1,'Ticket']]], + ['getreceivemail',['getReceiveMail',['../classWebUsers.html#ae4680f622bd8d571530615fb616d37e7',1,'WebUsers\getReceiveMail()'],['../classWebUsers.html#ae4680f622bd8d571530615fb616d37e7',1,'WebUsers\getReceiveMail()']]], + ['getrepliesofticket',['getRepliesOfTicket',['../classTicket__Reply.html#a7e80a6437bb6ee90be42a32f3a82fe76',1,'Ticket_Reply']]], + ['getserver_5ftick',['getServer_Tick',['../classTicket__Info.html#a5a5799e4e54d3fa4858716b4464710c0',1,'Ticket_Info']]], + ['getsgroupid',['getSGroupId',['../classSupport__Group.html#a77d0961efe9609ebb268f8672e71bba4',1,'Support_Group']]], + ['getsgroupofticket',['getSGroupOfTicket',['../classForwarded.html#a4de002d45322cf62ce493f49933d33bd',1,'Forwarded']]], + ['getshardid',['getShardId',['../classTicket__Info.html#a36306b5367015050fb516fcaaff8351f',1,'Ticket_Info']]], + ['getsid',['getSID',['../classQuerycache.html#a5bac91964d19751986cccad6fad28dda',1,'Querycache']]], + ['getstatus',['getStatus',['../classTicket.html#a9d21636071f529e2154051d3ea6e5921',1,'Ticket']]], + ['getstatusarray',['getStatusArray',['../classTicket.html#aa728c6a1f8ddd7030acbf5a4ca913b50',1,'Ticket']]], + ['getstatustext',['getStatusText',['../classTicket.html#aab26af198dc3a59295747084b85435ff',1,'Ticket']]], + ['gettag',['getTag',['../classSupport__Group.html#ab86ba36154b20e6bbfa3ba705f12f9d6',1,'Support_Group']]], + ['gettcategoryid',['getTCategoryId',['../classTicket__Category.html#acb530a119e5e52230a92ece95cc7ec82',1,'Ticket_Category']]], + ['gettcontentid',['getTContentId',['../classTicket__Content.html#a9245dceab917ad08e5244c9395b347ae',1,'Ticket_Content']]], + ['getticket',['getTicket',['../classAssigned.html#a42ddf34a72af750b7013fa309b67e46c',1,'Assigned\getTicket()'],['../classForwarded.html#a42ddf34a72af750b7013fa309b67e46c',1,'Forwarded\getTicket()'],['../classTicket__Info.html#a42ddf34a72af750b7013fa309b67e46c',1,'Ticket_Info\getTicket()'],['../classTicket__Log.html#a42ddf34a72af750b7013fa309b67e46c',1,'Ticket_Log\getTicket()'],['../classTicket__Reply.html#a42ddf34a72af750b7013fa309b67e46c',1,'Ticket_Reply\getTicket()']]], + ['getticket_5fcategory',['getTicket_Category',['../classTicket.html#addff2fc457fe07664f4eb39efcea45f9',1,'Ticket']]], + ['gettickets',['getTickets',['../classTicket__Queue__Handler.html#a45e8c11ba9485041fa92c7c470a8f9f9',1,'Ticket_Queue_Handler']]], + ['getticketsof',['getTicketsOf',['../classTicket.html#aa426904463cd0eb50d9b2f4becdd242f',1,'Ticket']]], + ['gettid',['getTId',['../classTicket.html#aa7af74696d9898008992c494cec136dd',1,'Ticket']]], + ['gettimestamp',['getTimestamp',['../classTicket.html#a92aa1d82129ec8cd803d64c28efcb30f',1,'Ticket\getTimestamp()'],['../classTicket__Log.html#a92aa1d82129ec8cd803d64c28efcb30f',1,'Ticket_Log\getTimestamp()'],['../classTicket__Reply.html#a92aa1d82129ec8cd803d64c28efcb30f',1,'Ticket_Reply\getTimestamp()']]], + ['gettinfoid',['getTInfoId',['../classTicket__Info.html#ad7c7ccc1926763c252d32d1fee5a7f69',1,'Ticket_Info']]], + ['gettitle',['getTitle',['../classTicket.html#a95e859a4588a39a1824b717378a84c29',1,'Ticket']]], + ['gettlogid',['getTLogId',['../classTicket__Log.html#ab174d340ee116d8cc3aa377003421fc5',1,'Ticket_Log']]], + ['gettreplyid',['getTReplyId',['../classTicket__Reply.html#ade0c35755c1a1af8fa4c9bae8b4c51f1',1,'Ticket_Reply']]], + ['gettuserid',['getTUserId',['../classTicket__User.html#a4a31c27c61f9794200b647bf810461f5',1,'Ticket_User']]], + ['gettype',['getType',['../classQuerycache.html#a830b5c75df72b32396701bc563fbe3c7',1,'Querycache']]], + ['getuid',['getUId',['../classWebUsers.html#aa36a98da4146d85e7813e99df7d97497',1,'WebUsers\getUId()'],['../classWebUsers.html#aa36a98da4146d85e7813e99df7d97497',1,'WebUsers\getUId()']]], + ['getuser',['getUser',['../classAssigned.html#ae81b7186fb97a7c6457edcc68c9aa2ef',1,'Assigned\getUser()'],['../classIn__Support__Group.html#ae81b7186fb97a7c6457edcc68c9aa2ef',1,'In_Support_Group\getUser()']]], + ['getuser_5fid',['getUser_Id',['../classTicket__Info.html#a9c2fe31c14609e2255773d5a4dd154d8',1,'Ticket_Info']]], + ['getuser_5fposition',['getUser_Position',['../classTicket__Info.html#a3f5a46d846543219d6321d2f8751d1f0',1,'Ticket_Info']]], + ['getuserassignedtoticket',['getUserAssignedToTicket',['../classAssigned.html#afcfb156712a9477a97423a49238d13c5',1,'Assigned']]], + ['getusername',['getUsername',['../classWebUsers.html#a81b37a3c9d639574e394f80c1138c75e',1,'WebUsers\getUsername()'],['../classWebUsers.html#a81b37a3c9d639574e394f80c1138c75e',1,'WebUsers\getUsername()']]], + ['getusers',['getUsers',['../classWebUsers.html#a0fc10b64683021b70c7eb95fb514c119',1,'WebUsers\getUsers()'],['../classWebUsers.html#a0fc10b64683021b70c7eb95fb514c119',1,'WebUsers\getUsers()']]], + ['getview_5fposition',['getView_Position',['../classTicket__Info.html#a525dbd26fc788c7c152f6c686a9a5d11',1,'Ticket_Info']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_68.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_68.html new file mode 100644 index 000000000..66b85be31 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_68.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_68.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_68.js new file mode 100644 index 000000000..68cc67ed7 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_68.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['handle_5flanguage',['handle_language',['../classHelpers.html#a334920d0652c160c6145d3bd7be31a22',1,'Helpers']]], + ['hashiv',['hashIV',['../classMyCrypt.html#a1bdf94a5906655bf0965338c9d17ab27',1,'MyCrypt']]], + ['hasinfo',['hasInfo',['../classTicket.html#afca07df3cc25a0e1a15d3f69bd6afa62',1,'Ticket']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_69.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_69.html new file mode 100644 index 000000000..e2041976c --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_69.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_69.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_69.js new file mode 100644 index 000000000..e23cc85fc --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_69.js @@ -0,0 +1,9 @@ +var searchData= +[ + ['incoming_5fmail_5fhandler',['incoming_mail_handler',['../classMail__Handler.html#a2896dabadb8e435de7ba7bbb258f8a96',1,'Mail_Handler']]], + ['isadmin',['isAdmin',['../classTicket__User.html#ae8a7d91474cde916fced2127fab426d2',1,'Ticket_User']]], + ['isassigned',['isAssigned',['../classAssigned.html#ade127364a5e5635077119b7217b6059c',1,'Assigned']]], + ['isforwarded',['isForwarded',['../classForwarded.html#ac1fa2045188edf04b07c523e1c6f68a0',1,'Forwarded']]], + ['isloggedin',['isLoggedIn',['../classWebUsers.html#a33bdd79e5da367ebddd4cfbdbbfc7cff',1,'WebUsers\isLoggedIn()'],['../classWebUsers.html#a33bdd79e5da367ebddd4cfbdbbfc7cff',1,'WebUsers\isLoggedIn()']]], + ['ismod',['isMod',['../classTicket__User.html#a8d88cdbf205bf7d24be03157d25bb7d8',1,'Ticket_User']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6c.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6c.html new file mode 100644 index 000000000..da371cfab --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6c.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6c.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6c.js new file mode 100644 index 000000000..51fb577db --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6c.js @@ -0,0 +1,23 @@ +var searchData= +[ + ['load',['load',['../classAssigned.html#a689011be59ec3d216ebe6852f07ab37f',1,'Assigned\load()'],['../classForwarded.html#a689011be59ec3d216ebe6852f07ab37f',1,'Forwarded\load()']]], + ['load_5fwith_5fsgroupid',['load_With_SGroupId',['../classSupport__Group.html#a6beae177f45da42a57b100b5481f49bf',1,'Support_Group']]], + ['load_5fwith_5fsid',['load_With_SID',['../classQuerycache.html#ae960510ccb242704233c38d787242f53',1,'Querycache']]], + ['load_5fwith_5ftcategoryid',['load_With_TCategoryId',['../classTicket__Category.html#ab3a70940917530d91a39536a6d45a21d',1,'Ticket_Category']]], + ['load_5fwith_5ftcontentid',['load_With_TContentId',['../classTicket__Content.html#ad8b1226537a055701bcc3fe4af87257b',1,'Ticket_Content']]], + ['load_5fwith_5fticket',['load_With_Ticket',['../classTicket__Info.html#afcf4006cdd19b05919b5df34d3345ad2',1,'Ticket_Info']]], + ['load_5fwith_5ftid',['load_With_TId',['../classTicket.html#ac17d9e1158fb77707da1f6cd3e425d54',1,'Ticket']]], + ['load_5fwith_5ftinfoid',['load_With_TInfoId',['../classTicket__Info.html#a1681685f76483b7944bf6848b29caa4a',1,'Ticket_Info']]], + ['load_5fwith_5ftlogid',['load_With_TLogId',['../classTicket__Log.html#a76e8e991002c7e408f7b182556cdeade',1,'Ticket_Log']]], + ['load_5fwith_5ftreplyid',['load_With_TReplyId',['../classTicket__Reply.html#ac9a387c63aad0b81a8161d2515f697d9',1,'Ticket_Reply']]], + ['load_5fwith_5ftuserid',['load_With_TUserId',['../classTicket__User.html#af43df1ba39e073e4b3a0120e6e4d3140',1,'Ticket_User']]], + ['loadallclosedtickets',['loadAllClosedTickets',['../classTicket__Queue.html#af2a9b20ac9dc0e1992f717abbb418be7',1,'Ticket_Queue']]], + ['loadallnotassignedtickets',['loadAllNotAssignedTickets',['../classTicket__Queue.html#a771627a0bd387cd666474a6ef0d5eaaf',1,'Ticket_Queue']]], + ['loadallopentickets',['loadAllOpenTickets',['../classTicket__Queue.html#a3a1cf8a88a3604e093f7d276050f1c49',1,'Ticket_Queue']]], + ['loadalltickets',['loadAllTickets',['../classTicket__Queue.html#a80542bde30a8a589f1d088422cb7719b',1,'Ticket_Queue']]], + ['loadassignedandwaiting',['loadAssignedandWaiting',['../classTicket__Queue.html#a348c76f7ae32437b7e91b57671d6f33d',1,'Ticket_Queue']]], + ['loadtemplate',['loadTemplate',['../classHelpers.html#a78997ab39ba0237dc7a5441b58601211',1,'Helpers']]], + ['loadtodotickets',['loadToDoTickets',['../classTicket__Queue.html#ad88848edf9a9132eb0cfcac904a8459f',1,'Ticket_Queue']]], + ['login',['login',['../func_2login_8php.html#aa311da27ba5706f5710cea7706c8eae1',1,'login(): login.php'],['../inc_2login_8php.html#aa311da27ba5706f5710cea7706c8eae1',1,'login(): login.php']]], + ['logout',['logout',['../drupal__module_2ryzommanage_2inc_2logout_8php.html#a082405d89acd6835c3a7c7a08a7adbab',1,'logout(): logout.php'],['../www_2html_2inc_2logout_8php.html#a082405d89acd6835c3a7c7a08a7adbab',1,'logout(): logout.php']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6d.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6d.html new file mode 100644 index 000000000..d01ac5376 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6d.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6d.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6d.js new file mode 100644 index 000000000..2f5fc5e1e --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6d.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['mail_5ffork',['mail_fork',['../classMail__Handler.html#ac6f9bcfab65cc93fdd4723284fff6b7a',1,'Mail_Handler']]], + ['make_5ftable',['make_table',['../classGui__Elements.html#a639930203d81ff01840ac90a51cbbfe7',1,'Gui_Elements']]], + ['make_5ftable_5fwith_5fkey_5fis_5fid',['make_table_with_key_is_id',['../classGui__Elements.html#ae3c8c19fce4cdd7d87d4ae759ab06f24',1,'Gui_Elements']]], + ['modify_5femail_5fof_5fsgroup',['modify_email_of_sgroup',['../modify__email__of__sgroup_8php.html#acb8c4a7ad3e36662d1d22ba56a98d0ab',1,'modify_email_of_sgroup.php']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6e.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6e.html new file mode 100644 index 000000000..d734dd07e --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6e.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6e.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6e.js new file mode 100644 index 000000000..0831ed960 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6e.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['new_5fmessage_5fid',['new_message_id',['../classMail__Handler.html#a667ca75b6c659157d855c3d19978a436',1,'Mail_Handler']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6f.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6f.html new file mode 100644 index 000000000..222f0f836 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6f.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6f.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6f.js new file mode 100644 index 000000000..f8a8b3016 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_6f.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['outputtime',['outputTime',['../classHelpers.html#a4370c805a72fe32c03b178b03ad2e393',1,'Helpers']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_72.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_72.html new file mode 100644 index 000000000..a4336f7c4 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_72.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_72.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_72.js new file mode 100644 index 000000000..857dcd26f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_72.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['register',['register',['../register_8php.html#acc294a6cc8e69743746820e3d15e3f78',1,'register.php']]], + ['reply_5fon_5fticket',['reply_on_ticket',['../reply__on__ticket_8php.html#a79f0a445c77e8e1e59eb9e72cbf39dba',1,'reply_on_ticket.php']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_73.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_73.html new file mode 100644 index 000000000..774d577f5 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_73.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_73.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_73.js new file mode 100644 index 000000000..50284d9b1 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_73.js @@ -0,0 +1,73 @@ +var searchData= +[ + ['send_5fmail',['send_mail',['../classMail__Handler.html#a50308ad0711aee080dacef7e3f574699',1,'Mail_Handler']]], + ['send_5fticketing_5fmail',['send_ticketing_mail',['../classMail__Handler.html#abe649044c8b8bd8eb05787a401865e6d',1,'Mail_Handler']]], + ['set',['set',['../classAssigned.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Assigned\set()'],['../classForwarded.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Forwarded\set()'],['../classIn__Support__Group.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'In_Support_Group\set()'],['../classQuerycache.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Querycache\set()'],['../classSupport__Group.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Support_Group\set()'],['../classTicket.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Ticket\set()'],['../classTicket__Info.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Ticket_Info\set()'],['../classTicket__Log.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Ticket_Log\set()'],['../classTicket__Reply.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Ticket_Reply\set()'],['../classTicket__User.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'Ticket_User\set()'],['../classWebUsers.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'WebUsers\set($values)'],['../classWebUsers.html#a8bdfe0a5256e35367225bcd6d278ef21',1,'WebUsers\set($values)']]], + ['setamsemail',['setAmsEmail',['../classUsers.html#ad1cbb1fe6ee72f46dc385bec6e274363',1,'Users']]], + ['setamspassword',['setAmsPassword',['../classUsers.html#ab89812058b0a71baf492af4652d67501',1,'Users']]], + ['setauthor',['setAuthor',['../classTicket.html#a0c8f116992af7c8737c70119dae00d45',1,'Ticket\setAuthor()'],['../classTicket__Log.html#a0c8f116992af7c8737c70119dae00d45',1,'Ticket_Log\setAuthor()'],['../classTicket__Reply.html#a0c8f116992af7c8737c70119dae00d45',1,'Ticket_Reply\setAuthor()']]], + ['setclient_5fversion',['setClient_Version',['../classTicket__Info.html#af06e75f73ae40120cc371f6ddd9ab49c',1,'Ticket_Info']]], + ['setconnect_5fstate',['setConnect_State',['../classTicket__Info.html#a4de823fc3a051d3aac3d526badef313c',1,'Ticket_Info']]], + ['setcontent',['setContent',['../classTicket__Content.html#a76e94f05c5cc0044993a35492097df4d',1,'Ticket_Content\setContent()'],['../classTicket__Reply.html#a76e94f05c5cc0044993a35492097df4d',1,'Ticket_Reply\setContent()']]], + ['setcpu_5fmask',['setCPU_Mask',['../classTicket__Info.html#a5f19999ab39a2ac0b7d6f2ced9223ae6',1,'Ticket_Info']]], + ['setcpuid',['setCPUId',['../classTicket__Info.html#af1f04d3bdcbaf28b246eb94a484f397c',1,'Ticket_Info']]], + ['setdb',['setDb',['../classQuerycache.html#afa9c249972ca269a2b1a399ed2faf9b4',1,'Querycache']]], + ['setemail',['setEmail',['../classWebUsers.html#a0cd214763f395718db166fbd598689f4',1,'WebUsers\setEmail($user, $mail)'],['../classWebUsers.html#a0cd214763f395718db166fbd598689f4',1,'WebUsers\setEmail($user, $mail)']]], + ['setexternid',['setExternId',['../classTicket__User.html#ad38846bb954052a5293ae2d26cf810d2',1,'Ticket_User']]], + ['setgroup',['setGroup',['../classForwarded.html#a3116db27c2e2f33cbb10a9488db34da3',1,'Forwarded\setGroup()'],['../classIn__Support__Group.html#a3116db27c2e2f33cbb10a9488db34da3',1,'In_Support_Group\setGroup()']]], + ['setgroupemail',['setGroupEmail',['../classSupport__Group.html#abbb0e975fd21a42439970ebb3eba5fea',1,'Support_Group']]], + ['sethidden',['setHidden',['../classTicket__Reply.html#a0b67f1016974c7b153b8944a94c88045',1,'Ticket_Reply']]], + ['setht',['setHT',['../classTicket__Info.html#a9ef93ff2fede4bd9b1cb8da2129dee20',1,'Ticket_Info']]], + ['setimap_5fmailserver',['setIMAP_MailServer',['../classSupport__Group.html#a71f266f2bba1fc4fb6df4cf083988938',1,'Support_Group']]], + ['setimap_5fpassword',['setIMAP_Password',['../classSupport__Group.html#ad6fcb63d4ae129567e8bea8786a75d87',1,'Support_Group']]], + ['setimap_5fusername',['setIMAP_Username',['../classSupport__Group.html#a6856519261b543f27bc001616c2881eb',1,'Support_Group']]], + ['setlanguage',['setLanguage',['../classWebUsers.html#a5ab1bd5f0959a3c33a46c176d9412c80',1,'WebUsers\setLanguage($user, $language)'],['../classWebUsers.html#a5ab1bd5f0959a3c33a46c176d9412c80',1,'WebUsers\setLanguage($user, $language)']]], + ['setlocal_5faddress',['setLocal_Address',['../classTicket__Info.html#a144b42f39cea6b24624c6c547df6aeeb',1,'Ticket_Info']]], + ['setmemory',['setMemory',['../classTicket__Info.html#a6f6f6925a18d24d2ecd5166a325be609',1,'Ticket_Info']]], + ['setname',['setName',['../classSupport__Group.html#aa3dcc220094e19fef1f918a3a917dba7',1,'Support_Group\setName()'],['../classTicket__Category.html#aa3dcc220094e19fef1f918a3a917dba7',1,'Ticket_Category\setName()']]], + ['setnel3d',['setNel3D',['../classTicket__Info.html#a77fbf6da57aa02e075be0905dc6cdd48',1,'Ticket_Info']]], + ['setos',['setOS',['../classTicket__Info.html#aacb7cbb0f04959ae64ba1c3aac36df54',1,'Ticket_Info']]], + ['setpassword',['setPassword',['../classWebUsers.html#a91506e5f74c9884045e865ef7c314fed',1,'WebUsers\setPassword($user, $pass)'],['../classWebUsers.html#a91506e5f74c9884045e865ef7c314fed',1,'WebUsers\setPassword($user, $pass)']]], + ['setpatch_5fversion',['setPatch_Version',['../classTicket__Info.html#a1d0f55ed3b50a72bf882591474d2ff72',1,'Ticket_Info']]], + ['setpermission',['setPermission',['../classTicket__User.html#adf7c497fb026ee6e05f6ece91f541839',1,'Ticket_User']]], + ['setpriority',['setPriority',['../classTicket.html#a3080d0b46978a8f82022bbb6e5fc0c1c',1,'Ticket']]], + ['setprocessor',['setProcessor',['../classTicket__Info.html#a8b66f72ec1928b89058cd0a9b4dd8c11',1,'Ticket_Info']]], + ['setquery',['setQuery',['../classQuerycache.html#adbd6075ec5d3bd84122e52b0134ed8e7',1,'Querycache\setQuery()'],['../classTicket__Log.html#adbd6075ec5d3bd84122e52b0134ed8e7',1,'Ticket_Log\setQuery()']]], + ['setqueue',['setQueue',['../classTicket.html#a1595d3fe708fe4f453922054407a1c03',1,'Ticket']]], + ['setreceivemail',['setReceiveMail',['../classWebUsers.html#aa0f439ff7a5cd6377a557f545fbeb45c',1,'WebUsers\setReceiveMail($user, $receivemail)'],['../classWebUsers.html#aa0f439ff7a5cd6377a557f545fbeb45c',1,'WebUsers\setReceiveMail($user, $receivemail)']]], + ['setserver_5ftick',['setServer_Tick',['../classTicket__Info.html#ab6ff52082590b43d90f8f37fd5b31086',1,'Ticket_Info']]], + ['setsgroupid',['setSGroupId',['../classSupport__Group.html#aa49cb914be98fc354a45584c6f2b8be1',1,'Support_Group']]], + ['setshardid',['setShardId',['../classTicket__Info.html#a4026e593012113e253b80e3bbd5f6c13',1,'Ticket_Info']]], + ['setsid',['setSID',['../classQuerycache.html#a2f536a1f8c8e463eb0346ac375f2a24d',1,'Querycache']]], + ['setstatus',['setStatus',['../classTicket.html#a66605893c4afc9855f1e0cf8ccccac09',1,'Ticket']]], + ['settag',['setTag',['../classSupport__Group.html#a4de944a53debc51843530fe96296f220',1,'Support_Group']]], + ['settcategoryid',['setTCategoryId',['../classTicket__Category.html#a39a64c3f7ab33ba3f5a67c31647e889f',1,'Ticket_Category']]], + ['settcontentid',['setTContentId',['../classTicket__Content.html#ae07366727208e060372063e96591c5d4',1,'Ticket_Content']]], + ['setticket',['setTicket',['../classAssigned.html#a47c6ae5b3cd713fdbf0a7f4d568b7c27',1,'Assigned\setTicket()'],['../classForwarded.html#a47c6ae5b3cd713fdbf0a7f4d568b7c27',1,'Forwarded\setTicket()'],['../classTicket__Info.html#a47c6ae5b3cd713fdbf0a7f4d568b7c27',1,'Ticket_Info\setTicket()'],['../classTicket__Log.html#a47c6ae5b3cd713fdbf0a7f4d568b7c27',1,'Ticket_Log\setTicket()'],['../classTicket__Reply.html#a47c6ae5b3cd713fdbf0a7f4d568b7c27',1,'Ticket_Reply\setTicket()']]], + ['setticket_5fcategory',['setTicket_Category',['../classTicket.html#a4e38b2a263b5a934b76cd77f026308c3',1,'Ticket']]], + ['settid',['setTId',['../classTicket.html#a8c72dc7b09645b390043f5a4664e7c7f',1,'Ticket']]], + ['settimestamp',['setTimestamp',['../classTicket.html#a4e05995d5cc78cdc9ffe72d864811ac6',1,'Ticket\setTimestamp()'],['../classTicket__Log.html#aa8903a0020a17d745524806f4e751f4c',1,'Ticket_Log\setTimestamp()'],['../classTicket__Reply.html#aa8903a0020a17d745524806f4e751f4c',1,'Ticket_Reply\setTimestamp()']]], + ['settinfoid',['setTInfoId',['../classTicket__Info.html#a5e98fba0b50f74645a2fdaa8f4d0c1ea',1,'Ticket_Info']]], + ['settings',['settings',['../drupal__module_2ryzommanage_2inc_2settings_8php.html#ad7354383714c6ae99d6ee1bfb95ab49f',1,'settings(): settings.php'],['../www_2html_2inc_2settings_8php.html#ad7354383714c6ae99d6ee1bfb95ab49f',1,'settings(): settings.php']]], + ['settitle',['setTitle',['../classTicket.html#ac765da6fa83b06ea39c0edc9b3e6c6c0',1,'Ticket']]], + ['settlogid',['setTLogId',['../classTicket__Log.html#aca708aae8c7320e11d9e08936ec74dec',1,'Ticket_Log']]], + ['settreplyid',['setTReplyId',['../classTicket__Reply.html#a7b91b481de87eb1515212d62b298cb94',1,'Ticket_Reply']]], + ['settuserid',['setTUserId',['../classTicket__User.html#a0faf8954e86346e7b566870b1a3c0a4a',1,'Ticket_User']]], + ['settype',['setType',['../classQuerycache.html#a0f29af8d4b9fdd8959739727a33acee5',1,'Querycache']]], + ['setuser',['setUser',['../classAssigned.html#af560ca7f201e2f871384a150e8ffd9aa',1,'Assigned\setUser()'],['../classIn__Support__Group.html#af560ca7f201e2f871384a150e8ffd9aa',1,'In_Support_Group\setUser()']]], + ['setuser_5fid',['setUser_Id',['../classTicket__Info.html#aec77405f6e096f2c0493383724f33034',1,'Ticket_Info']]], + ['setuser_5fposition',['setUser_Position',['../classTicket__Info.html#a41cfb7786d3252b2ec7aec42d77add9f',1,'Ticket_Info']]], + ['setview_5fposition',['setView_Position',['../classTicket__Info.html#a58912ec04451ab232d88bd78b6a8c2ea',1,'Ticket_Info']]], + ['sgroup_5flist',['sgroup_list',['../sgroup__list_8php.html#ab3af46486585b0ddced2de27a5d7a000',1,'sgroup_list.php']]], + ['show_5fqueue',['show_queue',['../show__queue_8php.html#a48695b07fef725dbf0b4f261b1fe1547',1,'show_queue.php']]], + ['show_5freply',['show_reply',['../show__reply_8php.html#ad8e51d3b3a4bf996fb07199a08ca9a3e',1,'show_reply.php']]], + ['show_5fsgroup',['show_sgroup',['../show__sgroup_8php.html#a118719426cb30ed43e39c2af24cfea2d',1,'show_sgroup.php']]], + ['show_5fticket',['show_ticket',['../show__ticket_8php.html#a1249d6cae97f6949ce3a7754fa1b7016',1,'show_ticket.php']]], + ['show_5fticket_5finfo',['show_ticket_info',['../show__ticket__info_8php.html#a579a5c89b55189455a8237369a78f0d8',1,'show_ticket_info.php']]], + ['show_5fticket_5flog',['show_ticket_log',['../show__ticket__log_8php.html#ab37298a659581e85338601f2259ead49',1,'show_ticket_log.php']]], + ['show_5fuser',['show_user',['../drupal__module_2ryzommanage_2inc_2show__user_8php.html#ac755ca62882d4caca41c7822793b8812',1,'show_user(): show_user.php'],['../www_2html_2inc_2show__user_8php.html#ac755ca62882d4caca41c7822793b8812',1,'show_user(): show_user.php']]], + ['supportgroup_5fentrynotexists',['supportGroup_EntryNotExists',['../classSupport__Group.html#aa557f337f57a3bb530f1f04df78c0f1e',1,'Support_Group']]], + ['supportgroup_5fexists',['supportGroup_Exists',['../classSupport__Group.html#ac235662693dcc9c2be51e6f1a2c426b6',1,'Support_Group']]], + ['syncdata',['syncdata',['../classSync.html#ad1211cc677b7aafcc4ebcc25f3cacdda',1,'Sync']]], + ['syncing',['syncing',['../syncing_8php.html#a8d4df31796dab54a8d0c9c9ec32cf7f9',1,'syncing.php']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_74.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_74.html new file mode 100644 index 000000000..e3c96c339 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_74.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_74.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_74.js new file mode 100644 index 000000000..62c7f6f79 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_74.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['ticketexists',['ticketExists',['../classTicket.html#a091d7ec56d4dc4bf980b81e8069b76d0',1,'Ticket']]], + ['tickethasinfo',['TicketHasInfo',['../classTicket__Info.html#a361217eb1d85e13aa534dabfbbd64a86',1,'Ticket_Info']]], + ['time_5felapsed_5fstring',['time_elapsed_string',['../classGui__Elements.html#a04d9bc70e65231a470426f0a94b7583d',1,'Gui_Elements']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_75.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_75.html new file mode 100644 index 000000000..2d61754d1 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_75.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_75.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_75.js new file mode 100644 index 000000000..08d9856d5 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_75.js @@ -0,0 +1,9 @@ +var searchData= +[ + ['unassignticket',['unAssignTicket',['../classAssigned.html#a8263a9c223957bb558a2c16d4431ca29',1,'Assigned\unAssignTicket()'],['../classTicket.html#a8263a9c223957bb558a2c16d4431ca29',1,'Ticket\unAssignTicket()']]], + ['update',['update',['../classQuerycache.html#a842e4774e3b3601a005b995c02f7e883',1,'Querycache\update()'],['../classSupport__Group.html#a842e4774e3b3601a005b995c02f7e883',1,'Support_Group\update()'],['../classTicket.html#a842e4774e3b3601a005b995c02f7e883',1,'Ticket\update()'],['../classTicket__Category.html#a842e4774e3b3601a005b995c02f7e883',1,'Ticket_Category\update()'],['../classTicket__Content.html#a842e4774e3b3601a005b995c02f7e883',1,'Ticket_Content\update()'],['../classTicket__Log.html#a842e4774e3b3601a005b995c02f7e883',1,'Ticket_Log\update()'],['../classTicket__Reply.html#a842e4774e3b3601a005b995c02f7e883',1,'Ticket_Reply\update()'],['../classTicket__User.html#a842e4774e3b3601a005b995c02f7e883',1,'Ticket_User\update()']]], + ['updateticketstatus',['updateTicketStatus',['../classTicket.html#a6da2625040e9f06c583e9303082c556f',1,'Ticket']]], + ['updateticketstatusandpriority',['updateTicketStatusAndPriority',['../classTicket.html#a64f08c8987c9eb00d4bfc9ef94e45326',1,'Ticket']]], + ['userexistsinsgroup',['userExistsInSGroup',['../classIn__Support__Group.html#a1a25afa24efc6c01ffd236f735281543',1,'In_Support_Group']]], + ['userlist',['userlist',['../userlist_8php.html#a55709a05f18e09358e2b02531eb859ad',1,'userlist.php']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_76.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_76.html new file mode 100644 index 000000000..2ec05695c --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_76.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_76.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_76.js new file mode 100644 index 000000000..1566125d3 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_76.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['validemail',['validEmail',['../classUsers.html#a73637e760498c5cea55074896ec982ac',1,'Users']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_77.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_77.html new file mode 100644 index 000000000..8fe97554f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_77.html @@ -0,0 +1,25 @@ + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_77.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_77.js new file mode 100644 index 000000000..ed7a85370 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/functions_77.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['write_5fuser',['write_user',['../add__user_8php.html#a09df49f177966f5b08af71ec43760e0c',1,'add_user.php']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/mag_sel.png b/code/ryzom/tools/server/ryzom_ams_docs/html/search/mag_sel.png new file mode 100644 index 000000000..81f6040a2 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams_docs/html/search/mag_sel.png differ diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/nomatches.html b/code/ryzom/tools/server/ryzom_ams_docs/html/search/nomatches.html new file mode 100644 index 000000000..b1ded27e9 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/nomatches.html @@ -0,0 +1,12 @@ + + + + + + + +
    +
    No Matches
    +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/search.css b/code/ryzom/tools/server/ryzom_ams_docs/html/search/search.css new file mode 100644 index 000000000..d18c1da8c --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/search.css @@ -0,0 +1,238 @@ +/*---------------- Search Box */ + +#FSearchBox { + float: left; +} + +#MSearchBox { + white-space : nowrap; + position: absolute; + float: none; + display: inline; + margin-top: 8px; + right: 0px; + width: 170px; + z-index: 102; + background-color: white; +} + +#MSearchBox .left +{ + display:block; + position:absolute; + left:10px; + width:20px; + height:19px; + background:url('search_l.png') no-repeat; + background-position:right; +} + +#MSearchSelect { + display:block; + position:absolute; + width:20px; + height:19px; +} + +.left #MSearchSelect { + left:4px; +} + +.right #MSearchSelect { + right:5px; +} + +#MSearchField { + display:block; + position:absolute; + height:19px; + background:url('search_m.png') repeat-x; + border:none; + width:116px; + margin-left:20px; + padding-left:4px; + color: #909090; + outline: none; + font: 9pt Arial, Verdana, sans-serif; +} + +#FSearchBox #MSearchField { + margin-left:15px; +} + +#MSearchBox .right { + display:block; + position:absolute; + right:10px; + top:0px; + width:20px; + height:19px; + background:url('search_r.png') no-repeat; + background-position:left; +} + +#MSearchClose { + display: none; + position: absolute; + top: 4px; + background : none; + border: none; + margin: 0px 4px 0px 0px; + padding: 0px 0px; + outline: none; +} + +.left #MSearchClose { + left: 6px; +} + +.right #MSearchClose { + right: 2px; +} + +.MSearchBoxActive #MSearchField { + color: #000000; +} + +/*---------------- Search filter selection */ + +#MSearchSelectWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #90A5CE; + background-color: #F9FAFC; + z-index: 1; + padding-top: 4px; + padding-bottom: 4px; + -moz-border-radius: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +.SelectItem { + font: 8pt Arial, Verdana, sans-serif; + padding-left: 2px; + padding-right: 12px; + border: 0px; +} + +span.SelectionMark { + margin-right: 4px; + font-family: monospace; + outline-style: none; + text-decoration: none; +} + +a.SelectItem { + display: block; + outline-style: none; + color: #000000; + text-decoration: none; + padding-left: 6px; + padding-right: 12px; +} + +a.SelectItem:focus, +a.SelectItem:active { + color: #000000; + outline-style: none; + text-decoration: none; +} + +a.SelectItem:hover { + color: #FFFFFF; + background-color: #3D578C; + outline-style: none; + text-decoration: none; + cursor: pointer; + display: block; +} + +/*---------------- Search results window */ + +iframe#MSearchResults { + width: 60ex; + height: 15em; +} + +#MSearchResultsWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #000; + background-color: #EEF1F7; +} + +/* ----------------------------------- */ + + +#SRIndex { + clear:both; + padding-bottom: 15px; +} + +.SREntry { + font-size: 10pt; + padding-left: 1ex; +} + +.SRPage .SREntry { + font-size: 8pt; + padding: 1px 5px; +} + +body.SRPage { + margin: 5px 2px; +} + +.SRChildren { + padding-left: 3ex; padding-bottom: .5em +} + +.SRPage .SRChildren { + display: none; +} + +.SRSymbol { + font-weight: bold; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRScope { + display: block; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRSymbol:focus, a.SRSymbol:active, +a.SRScope:focus, a.SRScope:active { + text-decoration: underline; +} + +span.SRScope { + padding-left: 4px; +} + +.SRPage .SRStatus { + padding: 2px 5px; + font-size: 8pt; + font-style: italic; +} + +.SRResult { + display: none; +} + +DIV.searchresults { + margin-left: 10px; + margin-right: 10px; +} diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/search.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/search.js new file mode 100644 index 000000000..9746f607f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/search.js @@ -0,0 +1,803 @@ +// Search script generated by doxygen +// Copyright (C) 2009 by Dimitri van Heesch. + +// The code in this file is loosly based on main.js, part of Natural Docs, +// which is Copyright (C) 2003-2008 Greg Valure +// Natural Docs is licensed under the GPL. + +var indexSectionsWithContent = +{ + 0: "0000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000010101111111001111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100101111000100110111010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101111111001100111111010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010101111111001111001111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 4: "0000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" +}; + +var indexSectionNames = +{ + 0: "all", + 1: "classes", + 2: "files", + 3: "functions", + 4: "variables" +}; + +function convertToId(search) +{ + var result = ''; + for (i=0;i do a search + { + this.Search(); + } + } + + this.OnSearchSelectKey = function(evt) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==40 && this.searchIndex0) // Up + { + this.searchIndex--; + this.OnSelectItem(this.searchIndex); + } + else if (e.keyCode==13 || e.keyCode==27) + { + this.OnSelectItem(this.searchIndex); + this.CloseSelectionWindow(); + this.DOMSearchField().focus(); + } + return false; + } + + // --------- Actions + + // Closes the results window. + this.CloseResultsWindow = function() + { + this.DOMPopupSearchResultsWindow().style.display = 'none'; + this.DOMSearchClose().style.display = 'none'; + this.Activate(false); + } + + this.CloseSelectionWindow = function() + { + this.DOMSearchSelectWindow().style.display = 'none'; + } + + // Performs a search. + this.Search = function() + { + this.keyTimeout = 0; + + // strip leading whitespace + var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + + var code = searchValue.toLowerCase().charCodeAt(0); + var hexCode; + if (code<16) + { + hexCode="0"+code.toString(16); + } + else + { + hexCode=code.toString(16); + } + + var resultsPage; + var resultsPageWithSearch; + var hasResultsPage; + + if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1') + { + resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; + resultsPageWithSearch = resultsPage+'?'+escape(searchValue); + hasResultsPage = true; + } + else // nothing available for this search term + { + resultsPage = this.resultsPath + '/nomatches.html'; + resultsPageWithSearch = resultsPage; + hasResultsPage = false; + } + + window.frames.MSearchResults.location = resultsPageWithSearch; + var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + + if (domPopupSearchResultsWindow.style.display!='block') + { + var domSearchBox = this.DOMSearchBox(); + this.DOMSearchClose().style.display = 'inline'; + if (this.insideFrame) + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + domPopupSearchResultsWindow.style.position = 'relative'; + domPopupSearchResultsWindow.style.display = 'block'; + var width = document.body.clientWidth - 8; // the -8 is for IE :-( + domPopupSearchResultsWindow.style.width = width + 'px'; + domPopupSearchResults.style.width = width + 'px'; + } + else + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; + var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; + domPopupSearchResultsWindow.style.display = 'block'; + left -= domPopupSearchResults.offsetWidth; + domPopupSearchResultsWindow.style.top = top + 'px'; + domPopupSearchResultsWindow.style.left = left + 'px'; + } + } + + this.lastSearchValue = searchValue; + this.lastResultsPage = resultsPage; + } + + // -------- Activation Functions + + // Activates or deactivates the search panel, resetting things to + // their default values if necessary. + this.Activate = function(isActive) + { + if (isActive || // open it + this.DOMPopupSearchResultsWindow().style.display == 'block' + ) + { + this.DOMSearchBox().className = 'MSearchBoxActive'; + + var searchField = this.DOMSearchField(); + + if (searchField.value == this.searchLabel) // clear "Search" term upon entry + { + searchField.value = ''; + this.searchActive = true; + } + } + else if (!isActive) // directly remove the panel + { + this.DOMSearchBox().className = 'MSearchBoxInactive'; + this.DOMSearchField().value = this.searchLabel; + this.searchActive = false; + this.lastSearchValue = '' + this.lastResultsPage = ''; + } + } +} + +// ----------------------------------------------------------------------- + +// The class that handles everything on the search results page. +function SearchResults(name) +{ + // The number of matches from the last run of . + this.lastMatchCount = 0; + this.lastKey = 0; + this.repeatOn = false; + + // Toggles the visibility of the passed element ID. + this.FindChildElement = function(id) + { + var parentElement = document.getElementById(id); + var element = parentElement.firstChild; + + while (element && element!=parentElement) + { + if (element.nodeName == 'DIV' && element.className == 'SRChildren') + { + return element; + } + + if (element.nodeName == 'DIV' && element.hasChildNodes()) + { + element = element.firstChild; + } + else if (element.nextSibling) + { + element = element.nextSibling; + } + else + { + do + { + element = element.parentNode; + } + while (element && element!=parentElement && !element.nextSibling); + + if (element && element!=parentElement) + { + element = element.nextSibling; + } + } + } + } + + this.Toggle = function(id) + { + var element = this.FindChildElement(id); + if (element) + { + if (element.style.display == 'block') + { + element.style.display = 'none'; + } + else + { + element.style.display = 'block'; + } + } + } + + // Searches for the passed string. If there is no parameter, + // it takes it from the URL query. + // + // Always returns true, since other documents may try to call it + // and that may or may not be possible. + this.Search = function(search) + { + if (!search) // get search word from URL + { + search = window.location.search; + search = search.substring(1); // Remove the leading '?' + search = unescape(search); + } + + search = search.replace(/^ +/, ""); // strip leading spaces + search = search.replace(/ +$/, ""); // strip trailing spaces + search = search.toLowerCase(); + search = convertToId(search); + + var resultRows = document.getElementsByTagName("div"); + var matches = 0; + + var i = 0; + while (i < resultRows.length) + { + var row = resultRows.item(i); + if (row.className == "SRResult") + { + var rowMatchName = row.id.toLowerCase(); + rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' + + if (search.length<=rowMatchName.length && + rowMatchName.substr(0, search.length)==search) + { + row.style.display = 'block'; + matches++; + } + else + { + row.style.display = 'none'; + } + } + i++; + } + document.getElementById("Searching").style.display='none'; + if (matches == 0) // no results + { + document.getElementById("NoMatches").style.display='block'; + } + else // at least one result + { + document.getElementById("NoMatches").style.display='none'; + } + this.lastMatchCount = matches; + return true; + } + + // return the first item with index index or higher that is visible + this.NavNext = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index++; + } + return focusItem; + } + + this.NavPrev = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index--; + } + return focusItem; + } + + this.ProcessKeys = function(e) + { + if (e.type == "keydown") + { + this.repeatOn = false; + this.lastKey = e.keyCode; + } + else if (e.type == "keypress") + { + if (!this.repeatOn) + { + if (this.lastKey) this.repeatOn = true; + return false; // ignore first keypress after keydown + } + } + else if (e.type == "keyup") + { + this.lastKey = 0; + this.repeatOn = false; + } + return this.lastKey!=0; + } + + this.Nav = function(evt,itemIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + var newIndex = itemIndex-1; + var focusItem = this.NavPrev(newIndex); + if (focusItem) + { + var child = this.FindChildElement(focusItem.parentNode.parentNode.id); + if (child && child.style.display == 'block') // children visible + { + var n=0; + var tmpElem; + while (1) // search for last child + { + tmpElem = document.getElementById('Item'+newIndex+'_c'+n); + if (tmpElem) + { + focusItem = tmpElem; + } + else // found it! + { + break; + } + n++; + } + } + } + if (focusItem) + { + focusItem.focus(); + } + else // return focus to search field + { + parent.document.getElementById("MSearchField").focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = itemIndex+1; + var focusItem; + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem && elem.style.display == 'block') // children visible + { + focusItem = document.getElementById('Item'+itemIndex+'_c0'); + } + if (!focusItem) focusItem = this.NavNext(newIndex); + if (focusItem) focusItem.focus(); + } + else if (this.lastKey==39) // Right + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'block'; + } + else if (this.lastKey==37) // Left + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'none'; + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } + + this.NavChild = function(evt,itemIndex,childIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + if (childIndex>0) + { + var newIndex = childIndex-1; + document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); + } + else // already at first child, jump to parent + { + document.getElementById('Item'+itemIndex).focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = childIndex+1; + var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); + if (!elem) // last child, jump to parent next parent + { + elem = this.NavNext(itemIndex+1); + } + if (elem) + { + elem.focus(); + } + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } +} + +function setKeyActions(elem,action) +{ + elem.setAttribute('onkeydown',action); + elem.setAttribute('onkeypress',action); + elem.setAttribute('onkeyup',action); +} + +function setClassAttr(elem,attr) +{ + elem.setAttribute('class',attr); + elem.setAttribute('className',attr); +} + +function createResults() +{ + var results = document.getElementById("SRResults"); + for (var e=0; e + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/search/variables_24.js b/code/ryzom/tools/server/ryzom_ams_docs/html/search/variables_24.js new file mode 100644 index 000000000..8e8a493e9 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/search/variables_24.js @@ -0,0 +1,91 @@ +var searchData= +[ + ['_24allow_5funknown',['$ALLOW_UNKNOWN',['../drupal__module_2ryzommanage_2config_8php.html#a384355265e4331097d55252f901eddff',1,'$ALLOW_UNKNOWN(): config.php'],['../www_2config_8php.html#a384355265e4331097d55252f901eddff',1,'$ALLOW_UNKNOWN(): config.php']]], + ['_24amountofrows',['$amountOfRows',['../classPagination.html#a6b5c716eec440d8dc5b9754c53c545ec',1,'Pagination']]], + ['_24ams_5fcachedir',['$AMS_CACHEDIR',['../drupal__module_2ryzommanage_2config_8php.html#a92879a931e7a7d0ae6919e70a1529747',1,'$AMS_CACHEDIR(): config.php'],['../www_2config_8php.html#a92879a931e7a7d0ae6919e70a1529747',1,'$AMS_CACHEDIR(): config.php']]], + ['_24ams_5flib',['$AMS_LIB',['../drupal__module_2ryzommanage_2config_8php.html#a75086b9c8602bf3417773bae7ef0cdc8',1,'$AMS_LIB(): config.php'],['../www_2config_8php.html#a75086b9c8602bf3417773bae7ef0cdc8',1,'$AMS_LIB(): config.php']]], + ['_24ams_5ftrans',['$AMS_TRANS',['../drupal__module_2ryzommanage_2config_8php.html#acc96a0076127356b4f9f00f4bdfa9b65',1,'$AMS_TRANS(): config.php'],['../www_2config_8php.html#acc96a0076127356b4f9f00f4bdfa9b65',1,'$AMS_TRANS(): config.php']]], + ['_24author',['$author',['../classTicket.html#ac35b828f7d4064a7c9f849c255468ee3',1,'Ticket\$author()'],['../classTicket__Log.html#ac35b828f7d4064a7c9f849c255468ee3',1,'Ticket_Log\$author()'],['../classTicket__Reply.html#ac35b828f7d4064a7c9f849c255468ee3',1,'Ticket_Reply\$author()']]], + ['_24base_5fwebpath',['$BASE_WEBPATH',['../drupal__module_2ryzommanage_2config_8php.html#a2e954ee09fb5f52b9d05caf9dfc3d5ad',1,'$BASE_WEBPATH(): config.php'],['../www_2config_8php.html#a2e954ee09fb5f52b9d05caf9dfc3d5ad',1,'$BASE_WEBPATH(): config.php']]], + ['_24cfg',['$cfg',['../drupal__module_2ryzommanage_2config_8php.html#a32f90fc68bcb40de0bae38354fd0a5fe',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a6b776651fa7defe140c03ed3bd86aa96',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a68f172c430a17022c9f74ae1acd24a00',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a1805c74760836f682459a12a17d50589',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a94213b6df61b8a6b62abbe7c956493a4',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a4b555022064138fee1d7edea873c5e9e',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a1b49c1f0de42e603443bea2c93276c13',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a7c5f3fd8aea7ae8363c6cdc9addd9b62',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a7b5bbf5b3c541b46d06deaffeeb76424',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a1dca44c652dd54f6879957cf8d4a039c',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a56e7e53dac48b99f62d41d387c8624e6',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#adc2648938b5135f1f2aab1d92d33418e',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a1324eeda6b288c0a26d7071db555090c',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a63d97fffb2ff86525bb6cacb74113a73',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a7147f422b8150cd3f3c8a68325208607',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a53f42728714b4e86b885c12f7846cd06',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#aa68c438d0b6b38d756d8724bac554f1b',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#ae4ae1095a3543d5607464a88e6330a07',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a7cf20f61de759c233272150b12e866d8',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#aed7bed5da2b934c742cb60d23c06f752',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a1606e0620d5a628b865e0df5c217ce7e',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a41e3a386ec52e0f05bdcad04acecf619',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#ac2c263a1e16ebd69dbf247e8d82c9f63',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a9996bf49f150442cf9d564725d0dea24',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#aa7eb09eb019c344553a61b54606cb650',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a79b711e7ee81b7435a8dba7cb132b34a',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a8578ffa00c2dbcf5d34a97bcff79058b',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a50d80d35dbd37739f844a93a36fce557',1,'$cfg(): config.php'],['../drupal__module_2ryzommanage_2config_8php.html#a55031a1c3c2b9d87e37558811b311ff8',1,'$cfg(): config.php'],['../www_2config_8php.html#a32f90fc68bcb40de0bae38354fd0a5fe',1,'$cfg(): config.php'],['../www_2config_8php.html#a6b776651fa7defe140c03ed3bd86aa96',1,'$cfg(): config.php'],['../www_2config_8php.html#a68f172c430a17022c9f74ae1acd24a00',1,'$cfg(): config.php'],['../www_2config_8php.html#a1805c74760836f682459a12a17d50589',1,'$cfg(): config.php'],['../www_2config_8php.html#a94213b6df61b8a6b62abbe7c956493a4',1,'$cfg(): config.php'],['../www_2config_8php.html#a4b555022064138fee1d7edea873c5e9e',1,'$cfg(): config.php'],['../www_2config_8php.html#a1b49c1f0de42e603443bea2c93276c13',1,'$cfg(): config.php'],['../www_2config_8php.html#a7c5f3fd8aea7ae8363c6cdc9addd9b62',1,'$cfg(): config.php'],['../www_2config_8php.html#a7b5bbf5b3c541b46d06deaffeeb76424',1,'$cfg(): config.php'],['../www_2config_8php.html#a1dca44c652dd54f6879957cf8d4a039c',1,'$cfg(): config.php'],['../www_2config_8php.html#a56e7e53dac48b99f62d41d387c8624e6',1,'$cfg(): config.php'],['../www_2config_8php.html#adc2648938b5135f1f2aab1d92d33418e',1,'$cfg(): config.php'],['../www_2config_8php.html#a1324eeda6b288c0a26d7071db555090c',1,'$cfg(): config.php'],['../www_2config_8php.html#a63d97fffb2ff86525bb6cacb74113a73',1,'$cfg(): config.php'],['../www_2config_8php.html#a7147f422b8150cd3f3c8a68325208607',1,'$cfg(): config.php'],['../www_2config_8php.html#a53f42728714b4e86b885c12f7846cd06',1,'$cfg(): config.php'],['../www_2config_8php.html#aa68c438d0b6b38d756d8724bac554f1b',1,'$cfg(): config.php'],['../www_2config_8php.html#ae4ae1095a3543d5607464a88e6330a07',1,'$cfg(): config.php'],['../www_2config_8php.html#a7cf20f61de759c233272150b12e866d8',1,'$cfg(): config.php'],['../www_2config_8php.html#aed7bed5da2b934c742cb60d23c06f752',1,'$cfg(): config.php'],['../www_2config_8php.html#a1606e0620d5a628b865e0df5c217ce7e',1,'$cfg(): config.php'],['../www_2config_8php.html#a41e3a386ec52e0f05bdcad04acecf619',1,'$cfg(): config.php'],['../www_2config_8php.html#ac2c263a1e16ebd69dbf247e8d82c9f63',1,'$cfg(): config.php'],['../www_2config_8php.html#a9996bf49f150442cf9d564725d0dea24',1,'$cfg(): config.php'],['../www_2config_8php.html#aa7eb09eb019c344553a61b54606cb650',1,'$cfg(): config.php'],['../www_2config_8php.html#a79b711e7ee81b7435a8dba7cb132b34a',1,'$cfg(): config.php'],['../www_2config_8php.html#a8578ffa00c2dbcf5d34a97bcff79058b',1,'$cfg(): config.php'],['../www_2config_8php.html#a50d80d35dbd37739f844a93a36fce557',1,'$cfg(): config.php'],['../www_2config_8php.html#a55031a1c3c2b9d87e37558811b311ff8',1,'$cfg(): config.php'],['../install_8php.html#a449cc4bf6cfd310810993b3ef5251aa5',1,'$cfg(): install.php']]], + ['_24client_5fversion',['$client_version',['../classTicket__Info.html#ac43fbb88dcd0696ad49d5f805f369a61',1,'Ticket_Info']]], + ['_24config',['$config',['../classMyCrypt.html#a49c7011be9c979d9174c52a8b83e5d8e',1,'MyCrypt']]], + ['_24config_5fpath',['$CONFIG_PATH',['../drupal__module_2ryzommanage_2config_8php.html#ae15921e2ebd5885ecf37d31a2cf6ab7a',1,'$CONFIG_PATH(): config.php'],['../www_2config_8php.html#ae15921e2ebd5885ecf37d31a2cf6ab7a',1,'$CONFIG_PATH(): config.php']]], + ['_24connect_5fstate',['$connect_state',['../classTicket__Info.html#a33f4c9badf7f0c5c6728bba0ffacd66e',1,'Ticket_Info']]], + ['_24content',['$content',['../classTicket__Content.html#a57b284fe00866494b33afa80ba729bed',1,'Ticket_Content\$content()'],['../classTicket__Reply.html#a57b284fe00866494b33afa80ba729bed',1,'Ticket_Reply\$content()']]], + ['_24country',['$country',['../classWebUsers.html#a1437a5f6eb157f0eb267a26e0ad4f1ba',1,'WebUsers']]], + ['_24cpu_5fid',['$cpu_id',['../classTicket__Info.html#abea88d0d04f0d548115a0e85eef42e42',1,'Ticket_Info']]], + ['_24cpu_5fmask',['$cpu_mask',['../classTicket__Info.html#a9b0c63551b567630d1aa82f33c328ab0',1,'Ticket_Info']]], + ['_24create_5fring',['$CREATE_RING',['../drupal__module_2ryzommanage_2config_8php.html#a16031d9d4e5065229bc3b00dfd4202fa',1,'$CREATE_RING(): config.php'],['../www_2config_8php.html#a16031d9d4e5065229bc3b00dfd4202fa',1,'$CREATE_RING(): config.php']]], + ['_24current',['$current',['../classPagination.html#a2c4c58e377f6c66ca38c8ea97666fc5e',1,'Pagination']]], + ['_24db',['$db',['../classMail__Handler.html#a1fa3127fc82f96b1436d871ef02be319',1,'Mail_Handler\$db()'],['../classQuerycache.html#a1fa3127fc82f96b1436d871ef02be319',1,'Querycache\$db()']]], + ['_24default_5flanguage',['$DEFAULT_LANGUAGE',['../drupal__module_2ryzommanage_2config_8php.html#a7b56c2ed5a82ceb21fc73cef77beb150',1,'$DEFAULT_LANGUAGE(): config.php'],['../www_2config_8php.html#a7b56c2ed5a82ceb21fc73cef77beb150',1,'$DEFAULT_LANGUAGE(): config.php']]], + ['_24element_5farray',['$element_array',['../classPagination.html#a8fa0f6a15481ba69e7be913eaa15594c',1,'Pagination']]], + ['_24email',['$email',['../classWebUsers.html#ad634f418b20382e2802f80532d76d3cd',1,'WebUsers']]], + ['_24externid',['$externId',['../classTicket__User.html#af51400fe5820e964cb38fcc60b3afd84',1,'Ticket_User']]], + ['_24firstname',['$firstname',['../classWebUsers.html#a55793c72c535d153ffd3f0e43377898b',1,'WebUsers']]], + ['_24force_5fingame',['$FORCE_INGAME',['../drupal__module_2ryzommanage_2config_8php.html#aabd939b29ed900f5fc489f1a957fc6ce',1,'$FORCE_INGAME(): config.php'],['../www_2config_8php.html#aabd939b29ed900f5fc489f1a957fc6ce',1,'$FORCE_INGAME(): config.php']]], + ['_24gender',['$gender',['../classWebUsers.html#a0f1d7cfb9dc6f494b9014885205fc47e',1,'WebUsers']]], + ['_24group',['$group',['../classForwarded.html#ad530a85733b0ec1dc321859fd8faa0dc',1,'Forwarded\$group()'],['../classIn__Support__Group.html#ad530a85733b0ec1dc321859fd8faa0dc',1,'In_Support_Group\$group()']]], + ['_24groupemail',['$groupEmail',['../classSupport__Group.html#ab7ad611af238b28f1f65a32cb152acd1',1,'Support_Group']]], + ['_24hidden',['$hidden',['../classTicket__Reply.html#a4a374564d2858d8ae869a8fb890aad56',1,'Ticket_Reply']]], + ['_24ht',['$ht',['../classTicket__Info.html#a969583a6605ed731abf5849a5202db1e',1,'Ticket_Info']]], + ['_24imageloc_5fwebpath',['$IMAGELOC_WEBPATH',['../drupal__module_2ryzommanage_2config_8php.html#a16820074dcd11e4881ca6461377db000',1,'$IMAGELOC_WEBPATH(): config.php'],['../www_2config_8php.html#a16820074dcd11e4881ca6461377db000',1,'$IMAGELOC_WEBPATH(): config.php']]], + ['_24imap_5fmailserver',['$iMAP_MailServer',['../classSupport__Group.html#ad9f2ef2089fe446a9ac49a19a450d636',1,'Support_Group']]], + ['_24imap_5fpassword',['$iMAP_Password',['../classSupport__Group.html#a4166a2fc4b594ee425d7f40870e16455',1,'Support_Group']]], + ['_24imap_5fusername',['$iMAP_Username',['../classSupport__Group.html#a2b549eb4d5773efd741a2990817af0ea',1,'Support_Group']]], + ['_24ingame_5flayout',['$INGAME_LAYOUT',['../drupal__module_2ryzommanage_2config_8php.html#a0deedf69fea8c97030373e15a68c4cc5',1,'$INGAME_LAYOUT(): config.php'],['../www_2config_8php.html#a0deedf69fea8c97030373e15a68c4cc5',1,'$INGAME_LAYOUT(): config.php']]], + ['_24ingame_5fwebpath',['$INGAME_WEBPATH',['../drupal__module_2ryzommanage_2config_8php.html#ae9f6aa9c61501bca7b8851925c636d87',1,'$INGAME_WEBPATH(): config.php'],['../www_2config_8php.html#ae9f6aa9c61501bca7b8851925c636d87',1,'$INGAME_WEBPATH(): config.php']]], + ['_24language',['$language',['../classWebUsers.html#a83170d318260a5a2e2a79dccdd371b10',1,'WebUsers']]], + ['_24last',['$last',['../classPagination.html#acf48db609a946d13953d8060363fd1d3',1,'Pagination']]], + ['_24lastname',['$lastname',['../classWebUsers.html#a1d2ddb6354180329b59e8b90ed94dc7f',1,'WebUsers']]], + ['_24local_5faddress',['$local_address',['../classTicket__Info.html#a467dca5673d4c9f737dac972ab05720c',1,'Ticket_Info']]], + ['_24login',['$login',['../classWebUsers.html#afc31993e855f9631572adfedcfe6f34b',1,'WebUsers']]], + ['_24mail_5fdir',['$MAIL_DIR',['../drupal__module_2ryzommanage_2config_8php.html#a9f8fc644554910de5434f78a5f23044e',1,'$MAIL_DIR(): config.php'],['../www_2config_8php.html#a9f8fc644554910de5434f78a5f23044e',1,'$MAIL_DIR(): config.php']]], + ['_24mail_5fhandler',['$mail_handler',['../mail__cron_8php.html#a160a75d95407d877e9c2542e3ddd8c43',1,'mail_cron.php']]], + ['_24mail_5flog_5fpath',['$MAIL_LOG_PATH',['../drupal__module_2ryzommanage_2config_8php.html#afe6e9ed40480c14cb7a119fb84cb557a',1,'$MAIL_LOG_PATH(): config.php'],['../www_2config_8php.html#afe6e9ed40480c14cb7a119fb84cb557a',1,'$MAIL_LOG_PATH(): config.php']]], + ['_24memory',['$memory',['../classTicket__Info.html#a5e20a9a3e12271b3b8d685805590c9e0',1,'Ticket_Info']]], + ['_24name',['$name',['../classSupport__Group.html#ab2fc40d43824ea3e1ce5d86dee0d763b',1,'Support_Group\$name()'],['../classTicket__Category.html#ab2fc40d43824ea3e1ce5d86dee0d763b',1,'Ticket_Category\$name()']]], + ['_24nel3d',['$nel3d',['../classTicket__Info.html#a9b616e5fbafadc93aa4bdf3ccbf31498',1,'Ticket_Info']]], + ['_24os',['$os',['../classTicket__Info.html#a292791d5d8e3ded85cb2e8ec80dea0d9',1,'Ticket_Info']]], + ['_24pagination',['$pagination',['../classTicket__Queue__Handler.html#a388a4a950e936f746d3b9c1b56450ce7',1,'Ticket_Queue_Handler']]], + ['_24params',['$params',['../classTicket__Queue.html#afe68e6fbe7acfbffc0af0c84a1996466',1,'Ticket_Queue']]], + ['_24patch_5fversion',['$patch_version',['../classTicket__Info.html#a55fc0854f90ed36ab9774ba7bd2af53f',1,'Ticket_Info']]], + ['_24pdo',['$PDO',['../classDBLayer.html#acdb2149c05a21fe144fb05ec524a51f3',1,'DBLayer']]], + ['_24permission',['$permission',['../classTicket__User.html#aad04b6f3304fe6a13d5be37f7cd28938',1,'Ticket_User']]], + ['_24priority',['$priority',['../classTicket.html#a2677e505e860db863720ac4e216fd3f2',1,'Ticket']]], + ['_24processor',['$processor',['../classTicket__Info.html#a11fe8ad69d64b596f8b712b0b7e7e1e3',1,'Ticket_Info']]], + ['_24query',['$query',['../classQuerycache.html#af59a5f7cd609e592c41dc3643efd3c98',1,'Querycache\$query()'],['../classTicket__Log.html#af59a5f7cd609e592c41dc3643efd3c98',1,'Ticket_Log\$query()'],['../classTicket__Queue.html#af59a5f7cd609e592c41dc3643efd3c98',1,'Ticket_Queue\$query()']]], + ['_24queue',['$queue',['../classTicket.html#a4a0b48f6ae2fcb248a4f0288c7c344a6',1,'Ticket\$queue()'],['../classTicket__Queue__Handler.html#a4a0b48f6ae2fcb248a4f0288c7c344a6',1,'Ticket_Queue_Handler\$queue()']]], + ['_24receivemail',['$receiveMail',['../classWebUsers.html#a3c74ba660e348124f36d978b137f691d',1,'WebUsers']]], + ['_24server_5ftick',['$server_tick',['../classTicket__Info.html#aeac33ccad750e9ee81a22414db1224ab',1,'Ticket_Info']]], + ['_24sgroupid',['$sGroupId',['../classSupport__Group.html#a23265908fce0f131e03ba1ede7f42647',1,'Support_Group']]], + ['_24shardid',['$shardid',['../classTicket__Info.html#ac73283a0a8308fb7594543e4a049942c',1,'Ticket_Info']]], + ['_24sid',['$SID',['../classQuerycache.html#a69c31f890638fa4930097cf55ae27995',1,'Querycache']]], + ['_24sitebase',['$SITEBASE',['../drupal__module_2ryzommanage_2config_8php.html#a9eb41824afc2b8150c27648859f07357',1,'$SITEBASE(): config.php'],['../www_2config_8php.html#a9eb41824afc2b8150c27648859f07357',1,'$SITEBASE(): config.php']]], + ['_24status',['$status',['../classTicket.html#a58391ea75f2d29d5d708d7050b641c33',1,'Ticket']]], + ['_24support_5fgroup_5fimap_5fcryptkey',['$SUPPORT_GROUP_IMAP_CRYPTKEY',['../drupal__module_2ryzommanage_2config_8php.html#a3ed2ac4433023af3e95f8912f00125ea',1,'$SUPPORT_GROUP_IMAP_CRYPTKEY(): config.php'],['../www_2config_8php.html#a3ed2ac4433023af3e95f8912f00125ea',1,'$SUPPORT_GROUP_IMAP_CRYPTKEY(): config.php']]], + ['_24tag',['$tag',['../classSupport__Group.html#a81d5015d41ed8ec66e9db8cdc5db9555',1,'Support_Group']]], + ['_24tcategoryid',['$tCategoryId',['../classTicket__Category.html#a0111df4559c9f524272d94df0b7f9d6b',1,'Ticket_Category']]], + ['_24tcontentid',['$tContentId',['../classTicket__Content.html#a2249787a24edd706ae7a54609a601d6f',1,'Ticket_Content']]], + ['_24ticket',['$ticket',['../classAssigned.html#abf7832c7c53a3be2ca8a8fc305006bb0',1,'Assigned\$ticket()'],['../classForwarded.html#abf7832c7c53a3be2ca8a8fc305006bb0',1,'Forwarded\$ticket()'],['../classTicket__Info.html#abf7832c7c53a3be2ca8a8fc305006bb0',1,'Ticket_Info\$ticket()'],['../classTicket__Log.html#abf7832c7c53a3be2ca8a8fc305006bb0',1,'Ticket_Log\$ticket()'],['../classTicket__Reply.html#abf7832c7c53a3be2ca8a8fc305006bb0',1,'Ticket_Reply\$ticket()']]], + ['_24ticket_5fcategory',['$ticket_category',['../classTicket.html#a86e470072892575063c478122fb65184',1,'Ticket']]], + ['_24ticket_5flogging',['$TICKET_LOGGING',['../drupal__module_2ryzommanage_2config_8php.html#aa59491d29009336d89423cccd3adc5de',1,'$TICKET_LOGGING(): config.php'],['../www_2config_8php.html#aa59491d29009336d89423cccd3adc5de',1,'$TICKET_LOGGING(): config.php']]], + ['_24ticket_5fmailing_5fsupport',['$TICKET_MAILING_SUPPORT',['../drupal__module_2ryzommanage_2config_8php.html#a23c3d413e56a57bc04d69627a4ed2b14',1,'$TICKET_MAILING_SUPPORT(): config.php'],['../www_2config_8php.html#a23c3d413e56a57bc04d69627a4ed2b14',1,'$TICKET_MAILING_SUPPORT(): config.php']]], + ['_24tid',['$tId',['../classTicket.html#a3eda2fecc2433b6b6b3b957110e937ca',1,'Ticket']]], + ['_24time_5fformat',['$TIME_FORMAT',['../drupal__module_2ryzommanage_2config_8php.html#a613b2c043c06772e7119587b26eb9989',1,'$TIME_FORMAT(): config.php'],['../www_2config_8php.html#a613b2c043c06772e7119587b26eb9989',1,'$TIME_FORMAT(): config.php']]], + ['_24timestamp',['$timestamp',['../classTicket.html#a2b69de9676dd97c675cd4d9bcceb684c',1,'Ticket\$timestamp()'],['../classTicket__Log.html#a2b69de9676dd97c675cd4d9bcceb684c',1,'Ticket_Log\$timestamp()'],['../classTicket__Reply.html#a2b69de9676dd97c675cd4d9bcceb684c',1,'Ticket_Reply\$timestamp()']]], + ['_24tinfoid',['$tInfoId',['../classTicket__Info.html#a4c2ae13b7827d13b9629e3fc57335f8f',1,'Ticket_Info']]], + ['_24title',['$title',['../classTicket.html#ada57e7bb7c152edad18fe2f166188691',1,'Ticket']]], + ['_24tlogid',['$tLogId',['../classTicket__Log.html#a734657bd8aac85b5a33e03646c17eb65',1,'Ticket_Log']]], + ['_24tos_5furl',['$TOS_URL',['../drupal__module_2ryzommanage_2config_8php.html#aef688ce4c627fa2fbd8037fd2cceef78',1,'$TOS_URL(): config.php'],['../www_2config_8php.html#aef688ce4c627fa2fbd8037fd2cceef78',1,'$TOS_URL(): config.php']]], + ['_24treplyid',['$tReplyId',['../classTicket__Reply.html#a29f22c2783e510d4764a99a648a0cc36',1,'Ticket_Reply']]], + ['_24tuserid',['$tUserId',['../classTicket__User.html#a2f1828693b198682ae3e926e63a4c110',1,'Ticket_User']]], + ['_24type',['$type',['../classQuerycache.html#a9a4a6fba2208984cabb3afacadf33919',1,'Querycache']]], + ['_24uid',['$uId',['../classWebUsers.html#a8f11c60ae8f70a5059b97bc0ea9d0de5',1,'WebUsers']]], + ['_24user',['$user',['../classAssigned.html#a598ca4e71b15a1313ec95f0df1027ca5',1,'Assigned\$user()'],['../classIn__Support__Group.html#a598ca4e71b15a1313ec95f0df1027ca5',1,'In_Support_Group\$user()']]], + ['_24user_5fid',['$user_id',['../classTicket__Info.html#af0fcd925f00973e32f7214859dfb3c6b',1,'Ticket_Info']]], + ['_24user_5fposition',['$user_position',['../classTicket__Info.html#afc9fcd144a71e56898632daf43854aa7',1,'Ticket_Info']]], + ['_24view_5fposition',['$view_position',['../classTicket__Info.html#ae325cbe2a7e27757b90b12d595c4dfe9',1,'Ticket_Info']]], + ['_24webpath',['$WEBPATH',['../drupal__module_2ryzommanage_2config_8php.html#a562d30b98806af1e001a3ff855e8890a',1,'$WEBPATH(): config.php'],['../www_2config_8php.html#a562d30b98806af1e001a3ff855e8890a',1,'$WEBPATH(): config.php']]] +]; diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/sgroup__list_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/sgroup__list_8php.html new file mode 100644 index 000000000..ec06aedcf --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/sgroup__list_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/sgroup_list.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/sgroup_list.php File Reference
    +
    +
    + + + + +

    +Functions

     sgroup_list ()
     This function is beign used to load info that's needed for the sgroup_list page.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    sgroup_list ()
    +
    +
    + +

    This function is beign used to load info that's needed for the sgroup_list page.

    +

    check if the person who wants to view this page is a mod/admin, if this is not the case, he will be redirected to an error page. It will return all suppport groups information. Also if the $_GET['delete'] var is set and the user is an admin, he will delete a specific entry.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/show__queue_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/show__queue_8php.html new file mode 100644 index 000000000..0ee887073 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/show__queue_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_queue.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_queue.php File Reference
    +
    +
    + + + + +

    +Functions

     show_queue ()
     This function is beign used to load info that's needed for the show_queue page.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    show_queue ()
    +
    +
    + +

    This function is beign used to load info that's needed for the show_queue page.

    +

    check if the person who wants to view this page is a mod/admin, if this is not the case, he will be redirected to an error page. if an action is set (this is done by $_GET['action']) it will try to execute it first, actions are: assign a ticket, unassign a ticket an create a queue. There are a few predefined queues which is the 'all tickets' queue, 'archive' queue, 'todo' queue, .. these are passed by $_GET['get']. if $_GET['get'] = create; then it's a custom made queue, this will call the createQueue function which builds the query that we will later use to get the tickets. The tickets fetched will be returned and used in the template. Now why use POST and GET params here and have a createQueue function twice? Well the first time someone creates a queue the POST variables will be used, however after going to the next page it will use the GET params.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/show__reply_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/show__reply_8php.html new file mode 100644 index 000000000..0be3d45f5 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/show__reply_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_reply.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_reply.php File Reference
    +
    +
    + + + + +

    +Functions

     show_reply ()
     This function is beign used to load info that's needed for the show_reply page.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    show_reply ()
    +
    +
    + +

    This function is beign used to load info that's needed for the show_reply page.

    +

    check if the person is allowed to see the reply, if not he'll be redirected to an error page. data regarding to the reply will be returned by this function that will be used by the template.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/show__sgroup_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/show__sgroup_8php.html new file mode 100644 index 000000000..fdffe05d6 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/show__sgroup_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_sgroup.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_sgroup.php File Reference
    +
    +
    + + + + +

    +Functions

     show_sgroup ()
     This function is beign used to load info that's needed for the show_sgroup page.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    show_sgroup ()
    +
    +
    + +

    This function is beign used to load info that's needed for the show_sgroup page.

    +

    check if the person browsing this page is a mod/admin, if not he'll be redirected to an error page. if the $_GET['delete'] var is set and the user executing is an admin, an entry will be deleted out of the support group. A list of users that are member of the group will be returned, which can be used by the template.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/show__ticket_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/show__ticket_8php.html new file mode 100644 index 000000000..4d8746ec5 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/show__ticket_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket.php File Reference
    +
    +
    + + + + +

    +Functions

     show_ticket ()
     This function is beign used to load info that's needed for the show_ticket page.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    show_ticket ()
    +
    +
    + +

    This function is beign used to load info that's needed for the show_ticket page.

    +

    check if the person browsing this page is a mod/admin or the ticket creator himself, if not he'll be redirected to an error page. if the $_GET['action'] var is set and the user executing is a mod/admin, it will try to execute the action. The actions here are: forwarding of a ticket, assigning a ticket and unassigning a ticket. This function returns a lot of information that will be used by the template to show the ticket. Mods/admins will be able to also see hidden replies to a ticket.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/show__ticket__info_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/show__ticket__info_8php.html new file mode 100644 index 000000000..91ee2707a --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/show__ticket__info_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_info.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_info.php File Reference
    +
    +
    + + + + +

    +Functions

     show_ticket_info ()
     This function is beign used to load info that's needed for the show_ticket_info page.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    show_ticket_info ()
    +
    +
    + +

    This function is beign used to load info that's needed for the show_ticket_info page.

    +

    check if the person browsing this page is a mod/admin or the ticket creator himself, if not he'll be redirected to an error page. not all tickets have this page related to it, only tickets created ingame will have additional information. The returned info will be used by the template to show the show_ticket_info page.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/show__ticket__log_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/show__ticket__log_8php.html new file mode 100644 index 000000000..603f3dbdc --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/show__ticket__log_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_log.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_ticket_log.php File Reference
    +
    +
    + + + + +

    +Functions

     show_ticket_log ()
     This function is beign used to load info that's needed for the show_ticket_log page.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    show_ticket_log ()
    +
    +
    + +

    This function is beign used to load info that's needed for the show_ticket_log page.

    +

    This page shows the logs related to a ticket: who created the ticket, who replied on it, who viewed it, assigned or forwarded it. Only mods/admins are able to browse the log though. The found information is returned so it can be used by the template.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/support__group_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/support__group_8php.html new file mode 100644 index 000000000..d2692f073 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/support__group_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/support_group.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/support_group.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Support_Group
     groups moderators & admins together. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/sync_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/sync_8php.html new file mode 100644 index 000000000..b7b7907da --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/sync_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/sync.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/sync.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Sync
     handler for performing changes when shard is back online after being offline. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/sync__cron_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/sync__cron_8php.html new file mode 100644 index 000000000..ede9924a7 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/sync__cron_8php.html @@ -0,0 +1,109 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/cron/sync_cron.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/cron/sync_cron.php File Reference
    +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/syncing_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/syncing_8php.html new file mode 100644 index 000000000..5b4838a79 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/syncing_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/syncing.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/syncing.php File Reference
    +
    +
    + + + + +

    +Functions

     syncing ()
     This function is beign used to load info that's needed for the syncing page.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    syncing ()
    +
    +
    + +

    This function is beign used to load info that's needed for the syncing page.

    +

    this function is used for notifying admins that there are unsynced changes, a brief overview of the non syned changes will be shown. The entries are being loaded here so that they can be passed to the template itself. Only admins can browse this page, others will be redirected to an error page.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/tab_a.png b/code/ryzom/tools/server/ryzom_ams_docs/html/tab_a.png new file mode 100644 index 000000000..2d99ef23f Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams_docs/html/tab_a.png differ diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/tab_b.png b/code/ryzom/tools/server/ryzom_ams_docs/html/tab_b.png new file mode 100644 index 000000000..b2c3d2be3 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams_docs/html/tab_b.png differ diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/tab_h.png b/code/ryzom/tools/server/ryzom_ams_docs/html/tab_h.png new file mode 100644 index 000000000..c11f48f19 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams_docs/html/tab_h.png differ diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/tab_s.png b/code/ryzom/tools/server/ryzom_ams_docs/html/tab_s.png new file mode 100644 index 000000000..978943ac8 Binary files /dev/null and b/code/ryzom/tools/server/ryzom_ams_docs/html/tab_s.png differ diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/tabs.css b/code/ryzom/tools/server/ryzom_ams_docs/html/tabs.css new file mode 100644 index 000000000..21920562a --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/tabs.css @@ -0,0 +1,59 @@ +.tabs, .tabs2, .tabs3 { + background-image: url('tab_b.png'); + width: 100%; + z-index: 101; + font-size: 13px; +} + +.tabs2 { + font-size: 10px; +} +.tabs3 { + font-size: 9px; +} + +.tablist { + margin: 0; + padding: 0; + display: table; +} + +.tablist li { + float: left; + display: table-cell; + background-image: url('tab_b.png'); + line-height: 36px; + list-style: none; +} + +.tablist a { + display: block; + padding: 0 20px; + font-weight: bold; + background-image:url('tab_s.png'); + background-repeat:no-repeat; + background-position:right; + color: #283A5D; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; + outline: none; +} + +.tabs3 .tablist a { + padding: 0 10px; +} + +.tablist a:hover { + background-image: url('tab_h.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); + text-decoration: none; +} + +.tablist li.current a { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +} diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/ticket_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket_8php.html new file mode 100644 index 000000000..09e6d6329 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Ticket
     class that handles most ticket related functions. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__category_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__category_8php.html new file mode 100644 index 000000000..e84fafcf0 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__category_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_category.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_category.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Ticket_Category
     Class related to the ticket categories. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__content_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__content_8php.html new file mode 100644 index 000000000..69dbd3954 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__content_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_content.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_content.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Ticket_Content
     Class that handles the content of a reply. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__info_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__info_8php.html new file mode 100644 index 000000000..e8e1d079f --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__info_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_info.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_info.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Ticket_Info
     Class that handles additional info sent by ticket creation ingame. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__log_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__log_8php.html new file mode 100644 index 000000000..645bb27d3 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__log_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_log.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_log.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Ticket_Log
     Class that handles the logging. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__queue_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__queue_8php.html new file mode 100644 index 000000000..6b78f9c7a --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__queue_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Ticket_Queue
     Data class that holds a lot of queries that load specific tickets. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__queue__handler_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__queue__handler_8php.html new file mode 100644 index 000000000..fa7720f16 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__queue__handler_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue_handler.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_queue_handler.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Ticket_Queue_Handler
     returns tickets (queues) that are related in some way. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__reply_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__reply_8php.html new file mode 100644 index 000000000..9594115b5 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__reply_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_reply.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Ticket_Reply
     handles functions related to replies on tickets. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__user_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__user_8php.html new file mode 100644 index 000000000..e106212f4 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/ticket__user_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/ticket_user.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Ticket_User
     user entry point in the ticket system. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/todo.html b/code/ryzom/tools/server/ryzom_ams_docs/html/todo.html new file mode 100644 index 000000000..e630d4465 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/todo.html @@ -0,0 +1,115 @@ + + + + + +Ryzom Account Management System: Todo List + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + +
    +
    +
    +
    Todo List
    +
    +
    +
    +
    Global Helpers ()
    +
    for the drupal module it might be possible that drupal_mkdir needs to be used instead of mkdir, also this should be in the install.php instead.
    +
    Global Mail_Handler (&$structure)
    +
    take care of the HTML part of incoming emails.
    +
    Class Querycache
    +
    make sure that the querycache class is being used by the sync class and also for inserting the queries themselfs into it. Atm this class isn't used yet if I remember correctly
    +
    Global Ticket ($ticket_id, $newStatus, $newPriority, $author)
    +
    break this function up into a updateStatus (already exists) and updatePriority function and perhaps write a wrapper function for the combo.
    +
    Global Ticket_Log ($ticket_id)
    +
    only use one of the 2 comparable functions in the future and make the other depricated.
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/userlist_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/userlist_8php.html new file mode 100644 index 000000000..149a7973c --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/userlist_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/userlist.php File Reference
    +
    +
    + + + + +

    +Functions

     userlist ()
     This function is beign used to load info that's needed for the userlist page.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    userlist ()
    +
    +
    + +

    This function is beign used to load info that's needed for the userlist page.

    +

    this function will return all users by using he pagination class, so that it can be used in the template. Only Mods and Admins can browse this page though.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/users_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/users_8php.html new file mode 100644 index 000000000..baefc8a11 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/users_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/users.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  Users
     handles basic user registration & management functions (shard related). More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/www_2config_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/www_2config_8php.html new file mode 100644 index 000000000..2e598c248 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/www_2config_8php.html @@ -0,0 +1,820 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/config.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/config.php File Reference
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Variables

     $cfg ['db']['web']['host'] = 'localhost'
     This file contains all variables needed by other php scripts.
     $cfg ['db']['web']['port'] = '3306'
     $cfg ['db']['web']['name'] = 'ryzom_ams'
     $cfg ['db']['web']['user'] = 'shard'
     $cfg ['db']['web']['pass'] = ''
     $cfg ['db']['lib']['host'] = 'localhost'
     $cfg ['db']['lib']['port'] = '3306'
     $cfg ['db']['lib']['name'] = 'ryzom_ams_lib'
     $cfg ['db']['lib']['user'] = 'shard'
     $cfg ['db']['lib']['pass'] = ''
     $cfg ['db']['shard']['host'] = 'localhost'
     $cfg ['db']['shard']['port'] = '3306'
     $cfg ['db']['shard']['name'] = 'nel'
     $cfg ['db']['shard']['user'] = 'shard'
     $cfg ['db']['shard']['pass'] = ''
     $cfg ['db']['ring']['host'] = 'localhost'
     $cfg ['db']['ring']['port'] = '3306'
     $cfg ['db']['ring']['name'] = 'ring_open'
     $cfg ['db']['ring']['user'] = 'shard'
     $cfg ['db']['ring']['pass'] = ''
     $cfg ['mail']['default_mailserver'] = '{imap.gmail.com:993/imap/ssl}INBOX'
     $cfg ['mail']['default_groupemail'] = 'amsryzom@gmail.com'
     $cfg ['mail']['default_groupname'] = 'Ryzomcore Support'
     $cfg ['mail']['default_username'] = 'amsryzom@gmail.com'
     $cfg ['mail']['default_password'] = 'lol123bol'
     $cfg ['mail']['host'] = "ryzomcore.com"
     $SUPPORT_GROUP_IMAP_CRYPTKEY = "azerty"
     $TICKET_MAILING_SUPPORT = true
     $MAIL_DIR = "/tmp/mail"
     $MAIL_LOG_PATH = "/tmp/mail/cron_mail.log"
     $TOS_URL = "http://createyourtos.com"
     $cfg ['crypt']['key'] = 'Sup3rS3cr3tStuff'
     $cfg ['crypt']['enc_method'] = 'AES-256-CBC'
     $cfg ['crypt']['hash_method'] = "SHA512"
     $ALLOW_UNKNOWN = true
     $CREATE_RING = true
     $AMS_LIB = dirname( dirname( __FILE__ ) ) . '/ams_lib'
     $AMS_TRANS = $AMS_LIB . '/translations'
     $AMS_CACHEDIR = $AMS_LIB . '/cache'
     $SITEBASE = dirname( __FILE__ ) . '/html/'
     $BASE_WEBPATH = 'http://localhost:40917/www/html'
     $IMAGELOC_WEBPATH = 'http://localhost:40917/ams_lib/img'
     $WEBPATH = $BASE_WEBPATH . '/index.php'
     $INGAME_WEBPATH = $BASE_WEBPATH . '/index.php'
     $CONFIG_PATH = dirname( __FILE__ )
     $DEFAULT_LANGUAGE = 'en'
     $TICKET_LOGGING = true
     $TIME_FORMAT = "m-d-Y H:i:s"
     $INGAME_LAYOUT = "basic"
     $FORCE_INGAME = false
    +

    Variable Documentation

    + +
    +
    + + + + +
    $ALLOW_UNKNOWN = true
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $AMS_CACHEDIR = $AMS_LIB . '/cache'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $AMS_LIB = dirname( dirname( __FILE__ ) ) . '/ams_lib'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $AMS_TRANS = $AMS_LIB . '/translations'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $BASE_WEBPATH = 'http://localhost:40917/www/html'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['web']['host'] = 'localhost'
    +
    +
    + +

    This file contains all variables needed by other php scripts.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['web']['port'] = '3306'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['web']['name'] = 'ryzom_ams'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['web']['user'] = 'shard'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['web']['pass'] = ''
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['lib']['host'] = 'localhost'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['lib']['port'] = '3306'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['lib']['name'] = 'ryzom_ams_lib'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['lib']['user'] = 'shard'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['lib']['pass'] = ''
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['shard']['host'] = 'localhost'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['shard']['port'] = '3306'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['shard']['name'] = 'nel'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['shard']['user'] = 'shard'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['shard']['pass'] = ''
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['ring']['host'] = 'localhost'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['ring']['port'] = '3306'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['ring']['name'] = 'ring_open'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['ring']['user'] = 'shard'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['db']['ring']['pass'] = ''
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['mail']['default_mailserver'] = '{imap.gmail.com:993/imap/ssl}INBOX'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['mail']['default_groupemail'] = 'amsryzom@gmail.com'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['mail']['default_groupname'] = 'Ryzomcore Support'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['mail']['default_username'] = 'amsryzom@gmail.com'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['mail']['default_password'] = 'lol123bol'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['mail']['host'] = "ryzomcore.com"
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['crypt']['key'] = 'Sup3rS3cr3tStuff'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['crypt']['enc_method'] = 'AES-256-CBC'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $cfg['crypt']['hash_method'] = "SHA512"
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $CONFIG_PATH = dirname( __FILE__ )
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $CREATE_RING = true
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $DEFAULT_LANGUAGE = 'en'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $FORCE_INGAME = false
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $IMAGELOC_WEBPATH = 'http://localhost:40917/ams_lib/img'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $INGAME_LAYOUT = "basic"
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $INGAME_WEBPATH = $BASE_WEBPATH . '/index.php'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $MAIL_DIR = "/tmp/mail"
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $MAIL_LOG_PATH = "/tmp/mail/cron_mail.log"
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $SITEBASE = dirname( __FILE__ ) . '/html/'
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $SUPPORT_GROUP_IMAP_CRYPTKEY = "azerty"
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $TICKET_LOGGING = true
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $TICKET_MAILING_SUPPORT = true
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $TIME_FORMAT = "m-d-Y H:i:s"
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $TOS_URL = "http://createyourtos.com"
    +
    +
    + +
    +
    + +
    +
    + + + + +
    $WEBPATH = $BASE_WEBPATH . '/index.php'
    +
    +
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/www_2html_2autoload_2webusers_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/www_2html_2autoload_2webusers_8php.html new file mode 100644 index 000000000..9bf55da85 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/www_2html_2autoload_2webusers_8php.html @@ -0,0 +1,117 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/autoload/webusers.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/autoload/webusers.php File Reference
    +
    +
    + + + + +

    +Data Structures

    class  WebUsers
     handles CMS/WWW related functions regarding user management & registration. More...
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/www_2html_2inc_2logout_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/www_2html_2inc_2logout_8php.html new file mode 100644 index 000000000..d6c860de7 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/www_2html_2inc_2logout_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/logout.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/logout.php File Reference
    +
    +
    + + + + +

    +Functions

     logout ()
     This function is beign used to load info that's needed for the logout page.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    logout ()
    +
    +
    + +

    This function is beign used to load info that's needed for the logout page.

    +

    it will just unset & destroy the session

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/www_2html_2inc_2settings_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/www_2html_2inc_2settings_8php.html new file mode 100644 index 000000000..d49c641ac --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/www_2html_2inc_2settings_8php.html @@ -0,0 +1,155 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/settings.php File Reference
    +
    +
    + + + + + +

    +Functions

     settings ()
     This function is beign used to load info that's needed for the settings page.
     getCountryArray ()
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    getCountryArray ()
    +
    +
    + +
    +
    + +
    +
    + + + + + + + +
    settings ()
    +
    +
    + +

    This function is beign used to load info that's needed for the settings page.

    +

    check if the person who wants to view this page is a mod/admin or the user to whom te settings belong himself, if this is not the case, he will be redirected to an error page. it will return a lot of information of that user, that's being used for loading the template.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/ryzom_ams_docs/html/www_2html_2inc_2show__user_8php.html b/code/ryzom/tools/server/ryzom_ams_docs/html/www_2html_2inc_2show__user_8php.html new file mode 100644 index 000000000..48f54f06d --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams_docs/html/www_2html_2inc_2show__user_8php.html @@ -0,0 +1,138 @@ + + + + + +Ryzom Account Management System: /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php File Reference + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + +
    +
    Ryzom Account Management System +  1.0 +
    + +
    +
    + + + + + +
    +
    + +
    +
    /home/daan/ryzom/ryzomcore/code/ryzom/tools/server/ryzom_ams/www/html/inc/show_user.php File Reference
    +
    +
    + + + + +

    +Functions

     show_user ()
     This function is beign used to load info that's needed for the show_user page.
    +

    Function Documentation

    + +
    +
    + + + + + + + +
    show_user ()
    +
    +
    + +

    This function is beign used to load info that's needed for the show_user page.

    +

    Users can only browse their own user page, while mods/admins can browse all user pages. The current settings of the user being browsed will be loaded, as also their created tickets and this info will be returned so it can be used by the template.

    +
    Author:
    Daan Janssens, mentored by Matthew Lagoe
    + +
    +
    +
    + + + + +
    + +
    + + + + + + + diff --git a/code/ryzom/tools/server/www/login/config.php b/code/ryzom/tools/server/www/login/config.php index 80f89f32b..cd490530f 100644 --- a/code/ryzom/tools/server/www/login/config.php +++ b/code/ryzom/tools/server/www/login/config.php @@ -20,8 +20,8 @@ $RingDBPassword = ""; // If true, the server will add automatically unknown user in the database // (in nel.user, nel.permission, ring.ring_user and ring.characters -$AcceptUnknownUser = true; +$AcceptUnknownUser = false; // if true, the login service automaticaly create a ring user and a editor character if needed -$AutoCreateRingInfo = true; +$AutoCreateRingInfo = false; -?> \ No newline at end of file +?> diff --git a/code/ryzom/tools/server/www/webtt/app/controllers/languages_controller.php.bak b/code/ryzom/tools/server/www/webtt/app/controllers/languages_controller.php.bak deleted file mode 100644 index 46234b733..000000000 --- a/code/ryzom/tools/server/www/webtt/app/controllers/languages_controller.php.bak +++ /dev/null @@ -1,125 +0,0 @@ -Language->recursive = 0; - $this->set('languages', $this->paginate()); - } - - function view($id = null) { - if (!$id) { - $this->Session->setFlash(__('Invalid language', true)); - $this->redirect(array('action' => 'index')); - } - $this->set('language', $this->Language->read(null, $id)); -/* $options = array('Language.id' => $id, 'recursive' => 1, - "joins" => array( - array('table' => ' - ), - ); - var_dump($this); - $this->set('language', $bumz = $this->Language->find('first', $options)); -var_dump($bumz);*/ -// $this->set('identifier', $this->Language->TranslationFile->read(null, $id)); - } - - function add() { - if (!empty($this->data)) { - $this->Language->create(); - if ($this->Language->save($this->data)) { - $this->Session->setFlash(__('The language has been saved', true)); - $this->redirect(array('action' => 'index')); - } else { - $this->Session->setFlash(__('The language could not be saved. Please, try again.', true)); - } - } - } - - function edit($id = null) { - if (!$id && empty($this->data)) { - $this->Session->setFlash(__('Invalid language', true)); - $this->redirect(array('action' => 'index')); - } - if (!empty($this->data)) { - if ($this->Language->save($this->data)) { - $this->Session->setFlash(__('The language has been saved', true)); - $this->redirect(array('action' => 'index')); - } else { - $this->Session->setFlash(__('The language could not be saved. Please, try again.', true)); - } - } - if (empty($this->data)) { - $this->data = $this->Language->read(null, $id); - } - } - - function delete($id = null) { - if (!$id) { - $this->Session->setFlash(__('Invalid id for language', true)); - $this->redirect(array('action'=>'index')); - } - if ($this->Language->delete($id)) { - $this->Session->setFlash(__('Language deleted', true)); - $this->redirect(array('action'=>'index')); - } - $this->Session->setFlash(__('Language was not deleted', true)); - $this->redirect(array('action' => 'index')); - } - function admin_index() { - $this->Language->recursive = 0; - $this->set('languages', $this->paginate()); - } - - function admin_view($id = null) { - if (!$id) { - $this->Session->setFlash(__('Invalid language', true)); - $this->redirect(array('action' => 'index')); - } - $this->set('language', $this->Language->read(null, $id)); - } - - function admin_add() { - if (!empty($this->data)) { - $this->Language->create(); - if ($this->Language->save($this->data)) { - $this->Session->setFlash(__('The language has been saved', true)); - $this->redirect(array('action' => 'index')); - } else { - $this->Session->setFlash(__('The language could not be saved. Please, try again.', true)); - } - } - } - - function admin_edit($id = null) { - if (!$id && empty($this->data)) { - $this->Session->setFlash(__('Invalid language', true)); - $this->redirect(array('action' => 'index')); - } - if (!empty($this->data)) { - if ($this->Language->save($this->data)) { - $this->Session->setFlash(__('The language has been saved', true)); - $this->redirect(array('action' => 'index')); - } else { - $this->Session->setFlash(__('The language could not be saved. Please, try again.', true)); - } - } - if (empty($this->data)) { - $this->data = $this->Language->read(null, $id); - } - } - - function admin_delete($id = null) { - if (!$id) { - $this->Session->setFlash(__('Invalid id for language', true)); - $this->redirect(array('action'=>'index')); - } - if ($this->Language->delete($id)) { - $this->Session->setFlash(__('Language deleted', true)); - $this->redirect(array('action'=>'index')); - } - $this->Session->setFlash(__('Language was not deleted', true)); - $this->redirect(array('action' => 'index')); - } -} diff --git a/code/ryzom/tools/server/www/webtt/cake/libs/model/datasources/dbo_source.php.bak b/code/ryzom/tools/server/www/webtt/cake/libs/model/datasources/dbo_source.php.bak deleted file mode 100644 index a851123e9..000000000 --- a/code/ryzom/tools/server/www/webtt/cake/libs/model/datasources/dbo_source.php.bak +++ /dev/null @@ -1,2925 +0,0 @@ - 'primary', 'MUL' => 'index', 'UNI' => 'unique'); - -/** - * Database keyword used to assign aliases to identifiers. - * - * @var string - * @access public - */ - var $alias = 'AS '; - -/** - * Caches result from query parsing operations. Cached results for both DboSource::name() and - * DboSource::conditions() will be stored here. Method caching uses `crc32()` which is - * fast but can collisions more easily than other hashing algorithms. If you have problems - * with collisions, set DboSource::$cacheMethods to false. - * - * @var array - * @access public - */ - var $methodCache = array(); - -/** - * Whether or not to cache the results of DboSource::name() and DboSource::conditions() - * into the memory cache. Set to false to disable the use of the memory cache. - * - * @var boolean. - * @access public - */ - var $cacheMethods = true ; - -/** - * Bypass automatic adding of joined fields/associations. - * - * @var boolean - * @access private - */ - var $__bypass = false; - -/** - * The set of valid SQL operations usable in a WHERE statement - * - * @var array - * @access private - */ - var $__sqlOps = array('like', 'ilike', 'or', 'not', 'in', 'between', 'regexp', 'similar to'); - -/** - * Index of basic SQL commands - * - * @var array - * @access protected - */ - var $_commands = array( - 'begin' => 'BEGIN', - 'commit' => 'COMMIT', - 'rollback' => 'ROLLBACK' - ); - -/** - * Separator string for virtualField composition - * - * @var string - */ - var $virtualFieldSeparator = '__'; - -/** - * List of table engine specific parameters used on table creating - * - * @var array - * @access public - */ - var $tableParameters = array(); - -/** - * List of engine specific additional field parameters used on table creating - * - * @var array - * @access public - */ - var $fieldParameters = array(); - -/** - * Constructor - * - * @param array $config Array of configuration information for the Datasource. - * @param boolean $autoConnect Whether or not the datasource should automatically connect. - * @access public - */ - function __construct($config = null, $autoConnect = true) { - if (!isset($config['prefix'])) { - $config['prefix'] = ''; - } - parent::__construct($config); - $this->fullDebug = Configure::read() > 1; - if (!$this->enabled()) { - return false; - } - if ($autoConnect) { - return $this->connect(); - } else { - return true; - } - } - -/** - * Reconnects to database server with optional new settings - * - * @param array $config An array defining the new configuration settings - * @return boolean True on success, false on failure - * @access public - */ - function reconnect($config = array()) { - $this->disconnect(); - $this->setConfig($config); - $this->_sources = null; - - return $this->connect(); - } - -/** - * Prepares a value, or an array of values for database queries by quoting and escaping them. - * - * @param mixed $data A value or an array of values to prepare. - * @param string $column The column into which this data will be inserted - * @param boolean $read Value to be used in READ or WRITE context - * @return mixed Prepared value or array of values. - * @access public - */ - function value($data, $column = null, $read = true) { - if (is_array($data) && !empty($data)) { - return array_map( - array(&$this, 'value'), - $data, array_fill(0, count($data), $column), array_fill(0, count($data), $read) - ); - } elseif (is_object($data) && isset($data->type)) { - if ($data->type == 'identifier') { - return $this->name($data->value); - } elseif ($data->type == 'expression') { - return $data->value; - } - } elseif (in_array($data, array('{$__cakeID__$}', '{$__cakeForeignKey__$}'), true)) { - return $data; - } else { - return null; - } - } - -/** - * Returns an object to represent a database identifier in a query - * - * @param string $identifier - * @return object An object representing a database identifier to be used in a query - * @access public - */ - function identifier($identifier) { - $obj = new stdClass(); - $obj->type = 'identifier'; - $obj->value = $identifier; - return $obj; - } - -/** - * Returns an object to represent a database expression in a query - * - * @param string $expression - * @return object An object representing a database expression to be used in a query - * @access public - */ - function expression($expression) { - $obj = new stdClass(); - $obj->type = 'expression'; - $obj->value = $expression; - return $obj; - } - -/** - * Executes given SQL statement. - * - * @param string $sql SQL statement - * @return boolean - * @access public - */ - function rawQuery($sql) { - $this->took = $this->error = $this->numRows = false; - return $this->execute($sql); - } - -/** - * Queries the database with given SQL statement, and obtains some metadata about the result - * (rows affected, timing, any errors, number of rows in resultset). The query is also logged. - * If Configure::read('debug') is set, the log is shown all the time, else it is only shown on errors. - * - * ### Options - * - * - stats - Collect meta data stats for this query. Stats include time take, rows affected, - * any errors, and number of rows returned. Defaults to `true`. - * - log - Whether or not the query should be logged to the memory log. - * - * @param string $sql - * @param array $options - * @return mixed Resource or object representing the result set, or false on failure - * @access public - */ - function execute($sql, $options = array()) { - $defaults = array('stats' => true, 'log' => $this->fullDebug); - $options = array_merge($defaults, $options); - - $t = getMicrotime(); - $this->_result = $this->_execute($sql); - if ($options['stats']) { - $this->took = round((getMicrotime() - $t) * 1000, 0); - $this->affected = $this->lastAffected(); - $this->error = $this->lastError(); - $this->numRows = $this->lastNumRows(); - } - - if ($options['log']) { - $this->logQuery($sql); - } - - if ($this->error) { - $this->showQuery($sql); - return false; - } - return $this->_result; - } - -/** - * DataSource Query abstraction - * - * @return resource Result resource identifier. - * @access public - */ - function query() { - $args = func_get_args(); - $fields = null; - $order = null; - $limit = null; - $page = null; - $recursive = null; - - if (count($args) == 1) { - return $this->fetchAll($args[0]); - - } elseif (count($args) > 1 && (strpos(strtolower($args[0]), 'findby') === 0 || strpos(strtolower($args[0]), 'findallby') === 0)) { - $params = $args[1]; - - if (strpos(strtolower($args[0]), 'findby') === 0) { - $all = false; - $field = Inflector::underscore(preg_replace('/^findBy/i', '', $args[0])); - } else { - $all = true; - $field = Inflector::underscore(preg_replace('/^findAllBy/i', '', $args[0])); - } - - $or = (strpos($field, '_or_') !== false); - if ($or) { - $field = explode('_or_', $field); - } else { - $field = explode('_and_', $field); - } - $off = count($field) - 1; - - if (isset($params[1 + $off])) { - $fields = $params[1 + $off]; - } - - if (isset($params[2 + $off])) { - $order = $params[2 + $off]; - } - - if (!array_key_exists(0, $params)) { - return false; - } - - $c = 0; - $conditions = array(); - - foreach ($field as $f) { - $conditions[$args[2]->alias . '.' . $f] = $params[$c]; - $c++; - } - - if ($or) { - $conditions = array('OR' => $conditions); - } - - if ($all) { - if (isset($params[3 + $off])) { - $limit = $params[3 + $off]; - } - - if (isset($params[4 + $off])) { - $page = $params[4 + $off]; - } - - if (isset($params[5 + $off])) { - $recursive = $params[5 + $off]; - } - return $args[2]->find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive')); - } else { - if (isset($params[3 + $off])) { - $recursive = $params[3 + $off]; - } - return $args[2]->find('first', compact('conditions', 'fields', 'order', 'recursive')); - } - } else { - if (isset($args[1]) && $args[1] === true) { - return $this->fetchAll($args[0], true); - } else if (isset($args[1]) && !is_array($args[1]) ) { - return $this->fetchAll($args[0], false); - } else if (isset($args[1]) && is_array($args[1])) { - $offset = 0; - if (isset($args[2])) { - $cache = $args[2]; - } else { - $cache = true; - } - $args[1] = array_map(array(&$this, 'value'), $args[1]); - return $this->fetchAll(String::insert($args[0], $args[1]), $cache); - } - } - } - -/** - * Returns a row from current resultset as an array - * - * @return array The fetched row as an array - * @access public - */ - function fetchRow($sql = null) { - if (!empty($sql) && is_string($sql) && strlen($sql) > 5) { - if (!$this->execute($sql)) { - return null; - } - } - - if ($this->hasResult()) { - $this->resultSet($this->_result); - $resultRow = $this->fetchResult(); - if (!empty($resultRow)) { - $this->fetchVirtualField($resultRow); - } - return $resultRow; - } else { - return null; - } - } - -/** - * Returns an array of all result rows for a given SQL query. - * Returns false if no rows matched. - * - * @param string $sql SQL statement - * @param boolean $cache Enables returning/storing cached query results - * @return array Array of resultset rows, or false if no rows matched - * @access public - */ - function fetchAll($sql, $cache = true, $modelName = null) { - if ($cache && isset($this->_queryCache[$sql])) { - if (preg_match('/^\s*select/i', $sql)) { - return $this->_queryCache[$sql]; - } - } - - if ($this->execute($sql)) { - $out = array(); - - $first = $this->fetchRow(); - if ($first != null) { - $out[] = $first; - } - while ($this->hasResult() && $item = $this->fetchResult()) { - $this->fetchVirtualField($item); - $out[] = $item; - } - - if ($cache) { - if (strpos(trim(strtolower($sql)), 'select') !== false) { - $this->_queryCache[$sql] = $out; - } - } - if (empty($out) && is_bool($this->_result)) { - return $this->_result; - } - return $out; - } else { - return false; - } - } - -/** - * Modifies $result array to place virtual fields in model entry where they belongs to - * - * @param array $resut REference to the fetched row - * @return void - */ - function fetchVirtualField(&$result) { - if (isset($result[0]) && is_array($result[0])) { - foreach ($result[0] as $field => $value) { - if (strpos($field, $this->virtualFieldSeparator) === false) { - continue; - } - list($alias, $virtual) = explode($this->virtualFieldSeparator, $field); - - if (!ClassRegistry::isKeySet($alias)) { - return; - } - $model = ClassRegistry::getObject($alias); - if ($model->isVirtualField($virtual)) { - $result[$alias][$virtual] = $value; - unset($result[0][$field]); - } - } - if (empty($result[0])) { - unset($result[0]); - } - } - } - -/** - * Returns a single field of the first of query results for a given SQL query, or false if empty. - * - * @param string $name Name of the field - * @param string $sql SQL query - * @return mixed Value of field read. - * @access public - */ - function field($name, $sql) { - $data = $this->fetchRow($sql); - if (!isset($data[$name]) || empty($data[$name])) { - return false; - } else { - return $data[$name]; - } - } - -/** - * Empties the method caches. - * These caches are used by DboSource::name() and DboSource::conditions() - * - * @return void - */ - function flushMethodCache() { - $this->methodCache = array(); - } - -/** - * Cache a value into the methodCaches. Will respect the value of DboSource::$cacheMethods. - * Will retrieve a value from the cache if $value is null. - * - * If caching is disabled and a write is attempted, the $value will be returned. - * A read will either return the value or null. - * - * @param string $method Name of the method being cached. - * @param string $key The keyname for the cache operation. - * @param mixed $value The value to cache into memory. - * @return mixed Either null on failure, or the value if its set. - */ - function cacheMethod($method, $key, $value = null) { - if ($this->cacheMethods === false) { - return $value; - } - if ($value === null) { - return (isset($this->methodCache[$method][$key])) ? $this->methodCache[$method][$key] : null; - } - return $this->methodCache[$method][$key] = $value; - } - -/** - * Returns a quoted name of $data for use in an SQL statement. - * Strips fields out of SQL functions before quoting. - * - * Results of this method are stored in a memory cache. This improves performance, but - * because the method uses a simple hashing algorithm it can infrequently have collisions. - * Setting DboSource::$cacheMethods to false will disable the memory cache. - * - * @param mixed $data Either a string with a column to quote. An array of columns to quote or an - * object from DboSource::expression() or DboSource::identifier() - * @return string SQL field - * @access public - */ - function name($data) { - if (is_object($data) && isset($data->type)) { - return $data->value; - } - if ($data === '*') { - return '*'; - } - if (is_array($data)) { - foreach ($data as $i => $dataItem) { - $data[$i] = $this->name($dataItem); - } - return $data; - } - $cacheKey = crc32($this->startQuote.$data.$this->endQuote); - if ($return = $this->cacheMethod(__FUNCTION__, $cacheKey)) { - return $return; - } - $data = trim($data); - if (preg_match('/^[\w-]+(?:\.[^ \*]*)*$/', $data)) { // string, string.string - if (strpos($data, '.') === false) { // string - return $this->cacheMethod(__FUNCTION__, $cacheKey, $this->startQuote . $data . $this->endQuote); - } - $items = explode('.', $data); - return $this->cacheMethod(__FUNCTION__, $cacheKey, - $this->startQuote . implode($this->endQuote . '.' . $this->startQuote, $items) . $this->endQuote - ); - } - if (preg_match('/^[\w-]+\.\*$/', $data)) { // string.* - return $this->cacheMethod(__FUNCTION__, $cacheKey, - $this->startQuote . str_replace('.*', $this->endQuote . '.*', $data) - ); - } - if (preg_match('/^([\w-]+)\((.*)\)$/', $data, $matches)) { // Functions - return $this->cacheMethod(__FUNCTION__, $cacheKey, - $matches[1] . '(' . $this->name($matches[2]) . ')' - ); - } - if ( - preg_match('/^([\w-]+(\.[\w-]+|\(.*\))*)\s+' . preg_quote($this->alias) . '\s*([\w-]+)$/i', $data, $matches - )) { - return $this->cacheMethod( - __FUNCTION__, $cacheKey, - preg_replace( - '/\s{2,}/', ' ', $this->name($matches[1]) . ' ' . $this->alias . ' ' . $this->name($matches[3]) - ) - ); - } - if (preg_match('/^[\w-_\s]*[\w-_]+/', $data)) { - return $this->cacheMethod(__FUNCTION__, $cacheKey, $this->startQuote . $data . $this->endQuote); - } - return $this->cacheMethod(__FUNCTION__, $cacheKey, $data); - } - -/** - * Checks if the source is connected to the database. - * - * @return boolean True if the database is connected, else false - * @access public - */ - function isConnected() { - return $this->connected; - } - -/** - * Checks if the result is valid - * - * @return boolean True if the result is valid else false - * @access public - */ - function hasResult() { - return is_resource($this->_result); - } - -/** - * Get the query log as an array. - * - * @param boolean $sorted Get the queries sorted by time taken, defaults to false. - * @return array Array of queries run as an array - * @access public - */ - function getLog($sorted = false, $clear = true) { - if ($sorted) { - $log = sortByKey($this->_queriesLog, 'took', 'desc', SORT_NUMERIC); - } else { - $log = $this->_queriesLog; - } - if ($clear) { - $this->_queriesLog = array(); - } - return array('log' => $log, 'count' => $this->_queriesCnt, 'time' => $this->_queriesTime); - } - -/** - * Outputs the contents of the queries log. If in a non-CLI environment the sql_log element - * will be rendered and output. If in a CLI environment, a plain text log is generated. - * - * @param boolean $sorted Get the queries sorted by time taken, defaults to false. - * @return void - */ - function showLog($sorted = false) { - $log = $this->getLog($sorted, false); - if (empty($log['log'])) { - return; - } - if (PHP_SAPI != 'cli') { - App::import('Core', 'View'); - $controller = null; - $View =& new View($controller, false); - $View->set('logs', array($this->configKeyName => $log)); - echo $View->element('sql_dump', array('_forced_from_dbo_' => true)); - } else { - foreach ($log['log'] as $k => $i) { - print (($k + 1) . ". {$i['query']} {$i['error']}\n"); - } - } - } - -/** - * Log given SQL query. - * - * @param string $sql SQL statement - * @todo: Add hook to log errors instead of returning false - * @access public - */ - function logQuery($sql) { - $this->_queriesCnt++; - $this->_queriesTime += $this->took; - $this->_queriesLog[] = array( - 'query' => $sql, - 'error' => $this->error, - 'affected' => $this->affected, - 'numRows' => $this->numRows, - 'took' => $this->took - ); - if (count($this->_queriesLog) > $this->_queriesLogMax) { - array_pop($this->_queriesLog); - } - if ($this->error) { - return false; - } - } - -/** - * Output information about an SQL query. The SQL statement, number of rows in resultset, - * and execution time in microseconds. If the query fails, an error is output instead. - * - * @param string $sql Query to show information on. - * @access public - */ - function showQuery($sql) { - $error = $this->error; - if (strlen($sql) > 200 && !$this->fullDebug && Configure::read() > 1) { - $sql = substr($sql, 0, 200) . '[...]'; - } - if (Configure::read() > 0) { - $out = null; - if ($error) { - trigger_error('' . __('SQL Error:', true) . " {$this->error}", E_USER_WARNING); - } else { - $out = ('[' . sprintf(__('Aff:%s Num:%s Took:%sms', true), $this->affected, $this->numRows, $this->took) . ']'); - } - pr(sprintf('

    ' . __('Query:', true) . ' %s %s

    ', $sql, $out)); - } - } - -/** - * Gets full table name including prefix - * - * @param mixed $model Either a Model object or a string table name. - * @param boolean $quote Whether you want the table name quoted. - * @return string Full quoted table name - * @access public - */ - function fullTableName($model, $quote = true) { - if (is_object($model)) { - $table = $model->tablePrefix . $model->table; - } elseif (isset($this->config['prefix'])) { - $table = $this->config['prefix'] . strval($model); - } else { - $table = strval($model); - } - if ($quote) { - return $this->name($table); - } - return $table; - } - -/** - * The "C" in CRUD - * - * Creates new records in the database. - * - * @param Model $model Model object that the record is for. - * @param array $fields An array of field names to insert. If null, $model->data will be - * used to generate field names. - * @param array $values An array of values with keys matching the fields. If null, $model->data will - * be used to generate values. - * @return boolean Success - * @access public - */ - function create(&$model, $fields = null, $values = null) { - $id = null; - - if ($fields == null) { - unset($fields, $values); - $fields = array_keys($model->data); - $values = array_values($model->data); - } - $count = count($fields); - - for ($i = 0; $i < $count; $i++) { - $valueInsert[] = $this->value($values[$i], $model->getColumnType($fields[$i]), false); - } - for ($i = 0; $i < $count; $i++) { - $fieldInsert[] = $this->name($fields[$i]); - if ($fields[$i] == $model->primaryKey) { - $id = $values[$i]; - } - } - $query = array( - 'table' => $this->fullTableName($model), - 'fields' => implode(', ', $fieldInsert), - 'values' => implode(', ', $valueInsert) - ); - - if ($this->execute($this->renderStatement('create', $query))) { - if (empty($id)) { - $id = $this->lastInsertId($this->fullTableName($model, false), $model->primaryKey); - } - $model->setInsertID($id); - $model->id = $id; - return true; - } else { - $model->onError(); - return false; - } - } - -/** - * The "R" in CRUD - * - * Reads record(s) from the database. - * - * @param Model $model A Model object that the query is for. - * @param array $queryData An array of queryData information containing keys similar to Model::find() - * @param integer $recursive Number of levels of association - * @return mixed boolean false on error/failure. An array of results on success. - */ - function read(&$model, $queryData = array(), $recursive = null) { - $queryData = $this->__scrubQueryData($queryData); - - $null = null; - $array = array(); - $linkedModels = array(); - $this->__bypass = false; - $this->__booleans = array(); - - if ($recursive === null && isset($queryData['recursive'])) { - $recursive = $queryData['recursive']; - } - - if (!is_null($recursive)) { - $_recursive = $model->recursive; - $model->recursive = $recursive; - } - - if (!empty($queryData['fields'])) { - $this->__bypass = true; - $queryData['fields'] = $this->fields($model, null, $queryData['fields']); - } else { - $queryData['fields'] = $this->fields($model); - } - - $_associations = $model->__associations; - - if ($model->recursive == -1) { - $_associations = array(); - } else if ($model->recursive == 0) { - unset($_associations[2], $_associations[3]); - } - - foreach ($_associations as $type) { - foreach ($model->{$type} as $assoc => $assocData) { - $linkModel =& $model->{$assoc}; - $external = isset($assocData['external']); - - if ($model->useDbConfig == $linkModel->useDbConfig) { - if (true === $this->generateAssociationQuery($model, $linkModel, $type, $assoc, $assocData, $queryData, $external, $null)) { - $linkedModels[$type . '/' . $assoc] = true; - } - } - } - } - - $query = $this->generateAssociationQuery($model, $null, null, null, null, $queryData, false, $null); - - $resultSet = $this->fetchAll($query, $model->cacheQueries, $model->alias); - - if ($resultSet === false) { - $model->onError(); - return false; - } - - $filtered = $this->__filterResults($resultSet, $model); - - if ($model->recursive > -1) { - foreach ($_associations as $type) { - foreach ($model->{$type} as $assoc => $assocData) { - $linkModel =& $model->{$assoc}; - - if (empty($linkedModels[$type . '/' . $assoc])) { - if ($model->useDbConfig == $linkModel->useDbConfig) { - $db =& $this; - } else { - $db =& ConnectionManager::getDataSource($linkModel->useDbConfig); - } - } elseif ($model->recursive > 1 && ($type == 'belongsTo' || $type == 'hasOne')) { - $db =& $this; - } - - if (isset($db) && method_exists($db, 'queryAssociation')) { - $stack = array($assoc); - $db->queryAssociation($model, $linkModel, $type, $assoc, $assocData, $array, true, $resultSet, $model->recursive - 1, $stack); - unset($db); - - if ($type === 'hasMany') { - $filtered []= $assoc; - } - } - } - } - $this->__filterResults($resultSet, $model, $filtered); - } - - if (!is_null($recursive)) { - $model->recursive = $_recursive; - } - return $resultSet; - } - -/** - * Passes association results thru afterFind filters of corresponding model - * - * @param array $results Reference of resultset to be filtered - * @param object $model Instance of model to operate against - * @param array $filtered List of classes already filtered, to be skipped - * @return array Array of results that have been filtered through $model->afterFind - * @access private - */ - function __filterResults(&$results, &$model, $filtered = array()) { - $filtering = array(); - $count = count($results); - - for ($i = 0; $i < $count; $i++) { - if (is_array($results[$i])) { - $classNames = array_keys($results[$i]); - $count2 = count($classNames); - - for ($j = 0; $j < $count2; $j++) { - $className = $classNames[$j]; - if ($model->alias != $className && !in_array($className, $filtered)) { - if (!in_array($className, $filtering)) { - $filtering[] = $className; - } - - if (isset($model->{$className}) && is_object($model->{$className})) { - $data = $model->{$className}->afterFind(array(array($className => $results[$i][$className])), false); - } - if (isset($data[0][$className])) { - $results[$i][$className] = $data[0][$className]; - } - } - } - } - } - return $filtering; - } - -/** - * Queries associations. Used to fetch results on recursive models. - * - * @param Model $model Primary Model object - * @param Model $linkModel Linked model that - * @param string $type Association type, one of the model association types ie. hasMany - * @param unknown_type $association - * @param unknown_type $assocData - * @param array $queryData - * @param boolean $external Whether or not the association query is on an external datasource. - * @param array $resultSet Existing results - * @param integer $recursive Number of levels of association - * @param array $stack - */ - function queryAssociation(&$model, &$linkModel, $type, $association, $assocData, &$queryData, $external = false, &$resultSet, $recursive, $stack) { - if ($query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet)) { - if (!isset($resultSet) || !is_array($resultSet)) { - if (Configure::read() > 0) { - echo '
    ' . sprintf(__('SQL Error in model %s:', true), $model->alias) . ' '; - if (isset($this->error) && $this->error != null) { - echo $this->error; - } - echo '
    '; - } - return null; - } - $count = count($resultSet); - - if ($type === 'hasMany' && empty($assocData['limit']) && !empty($assocData['foreignKey'])) { - $ins = $fetch = array(); - for ($i = 0; $i < $count; $i++) { - if ($in = $this->insertQueryData('{$__cakeID__$}', $resultSet[$i], $association, $assocData, $model, $linkModel, $stack)) { - $ins[] = $in; - } - } - - if (!empty($ins)) { - $ins = array_unique($ins); - $fetch = $this->fetchAssociated($model, $query, $ins); - } - - if (!empty($fetch) && is_array($fetch)) { - if ($recursive > 0) { - foreach ($linkModel->__associations as $type1) { - foreach ($linkModel->{$type1} as $assoc1 => $assocData1) { - $deepModel =& $linkModel->{$assoc1}; - $tmpStack = $stack; - $tmpStack[] = $assoc1; - - if ($linkModel->useDbConfig === $deepModel->useDbConfig) { - $db =& $this; - } else { - $db =& ConnectionManager::getDataSource($deepModel->useDbConfig); - } - $db->queryAssociation($linkModel, $deepModel, $type1, $assoc1, $assocData1, $queryData, true, $fetch, $recursive - 1, $tmpStack); - } - } - } - } - $this->__filterResults($fetch, $model); - return $this->__mergeHasMany($resultSet, $fetch, $association, $model, $linkModel, $recursive); - } elseif ($type === 'hasAndBelongsToMany') { - $ins = $fetch = array(); - for ($i = 0; $i < $count; $i++) { - if ($in = $this->insertQueryData('{$__cakeID__$}', $resultSet[$i], $association, $assocData, $model, $linkModel, $stack)) { - $ins[] = $in; - } - } - if (!empty($ins)) { - $ins = array_unique($ins); - if (count($ins) > 1) { - $query = str_replace('{$__cakeID__$}', '(' .implode(', ', $ins) .')', $query); - $query = str_replace('= (', 'IN (', $query); - } else { - $query = str_replace('{$__cakeID__$}',$ins[0], $query); - } - - $query = str_replace(' WHERE 1 = 1', '', $query); - } - - $foreignKey = $model->hasAndBelongsToMany[$association]['foreignKey']; - $joinKeys = array($foreignKey, $model->hasAndBelongsToMany[$association]['associationForeignKey']); - list($with, $habtmFields) = $model->joinModel($model->hasAndBelongsToMany[$association]['with'], $joinKeys); - $habtmFieldsCount = count($habtmFields); - $q = $this->insertQueryData($query, null, $association, $assocData, $model, $linkModel, $stack); - - if ($q != false) { - $fetch = $this->fetchAll($q, $model->cacheQueries, $model->alias); - } else { - $fetch = null; - } - } - - for ($i = 0; $i < $count; $i++) { - $row =& $resultSet[$i]; - - if ($type !== 'hasAndBelongsToMany') { - $q = $this->insertQueryData($query, $resultSet[$i], $association, $assocData, $model, $linkModel, $stack); - if ($q != false) { - $fetch = $this->fetchAll($q, $model->cacheQueries, $model->alias); - } else { - $fetch = null; - } - } - $selfJoin = false; - - if ($linkModel->name === $model->name) { - $selfJoin = true; - } - - if (!empty($fetch) && is_array($fetch)) { - if ($recursive > 0) { - foreach ($linkModel->__associations as $type1) { - foreach ($linkModel->{$type1} as $assoc1 => $assocData1) { - $deepModel =& $linkModel->{$assoc1}; - - if (($type1 === 'belongsTo') || ($deepModel->alias === $model->alias && $type === 'belongsTo') || ($deepModel->alias != $model->alias)) { - $tmpStack = $stack; - $tmpStack[] = $assoc1; - if ($linkModel->useDbConfig == $deepModel->useDbConfig) { - $db =& $this; - } else { - $db =& ConnectionManager::getDataSource($deepModel->useDbConfig); - } - $db->queryAssociation($linkModel, $deepModel, $type1, $assoc1, $assocData1, $queryData, true, $fetch, $recursive - 1, $tmpStack); - } - } - } - } - if ($type == 'hasAndBelongsToMany') { - $uniqueIds = $merge = array(); - - foreach ($fetch as $j => $data) { - if ( - (isset($data[$with]) && $data[$with][$foreignKey] === $row[$model->alias][$model->primaryKey]) - ) { - if ($habtmFieldsCount <= 2) { - unset($data[$with]); - } - $merge[] = $data; - } - } - if (empty($merge) && !isset($row[$association])) { - $row[$association] = $merge; - } else { - $this->__mergeAssociation($resultSet[$i], $merge, $association, $type); - } - } else { - $this->__mergeAssociation($resultSet[$i], $fetch, $association, $type, $selfJoin); - } - if (isset($resultSet[$i][$association])) { - $resultSet[$i][$association] = $linkModel->afterFind($resultSet[$i][$association], false); - } - } else { - $tempArray[0][$association] = false; - $this->__mergeAssociation($resultSet[$i], $tempArray, $association, $type, $selfJoin); - } - } - } - } - -/** - * A more efficient way to fetch associations. Woohoo! - * - * @param model $model Primary model object - * @param string $query Association query - * @param array $ids Array of IDs of associated records - * @return array Association results - * @access public - */ - function fetchAssociated($model, $query, $ids) { - $query = str_replace('{$__cakeID__$}', implode(', ', $ids), $query); - if (count($ids) > 1) { - $query = str_replace('= (', 'IN (', $query); - } - return $this->fetchAll($query, $model->cacheQueries, $model->alias); - } - -/** - * mergeHasMany - Merge the results of hasMany relations. - * - * - * @param array $resultSet Data to merge into - * @param array $merge Data to merge - * @param string $association Name of Model being Merged - * @param object $model Model being merged onto - * @param object $linkModel Model being merged - * @return void - */ - function __mergeHasMany(&$resultSet, $merge, $association, &$model, &$linkModel) { - foreach ($resultSet as $i => $value) { - $count = 0; - $merged[$association] = array(); - foreach ($merge as $j => $data) { - if (isset($value[$model->alias]) && $value[$model->alias][$model->primaryKey] === $data[$association][$model->hasMany[$association]['foreignKey']]) { - if (count($data) > 1) { - $data = array_merge($data[$association], $data); - unset($data[$association]); - foreach ($data as $key => $name) { - if (is_numeric($key)) { - $data[$association][] = $name; - unset($data[$key]); - } - } - $merged[$association][] = $data; - } else { - $merged[$association][] = $data[$association]; - } - } - $count++; - } - if (isset($value[$model->alias])) { - $resultSet[$i] = Set::pushDiff($resultSet[$i], $merged); - unset($merged); - } - } - } - -/** - * Enter description here... - * - * @param unknown_type $data - * @param unknown_type $merge - * @param unknown_type $association - * @param unknown_type $type - * @param boolean $selfJoin - * @access private - */ - function __mergeAssociation(&$data, $merge, $association, $type, $selfJoin = false) { - if (isset($merge[0]) && !isset($merge[0][$association])) { - $association = Inflector::pluralize($association); - } - - if ($type == 'belongsTo' || $type == 'hasOne') { - if (isset($merge[$association])) { - $data[$association] = $merge[$association][0]; - } else { - if (count($merge[0][$association]) > 1) { - foreach ($merge[0] as $assoc => $data2) { - if ($assoc != $association) { - $merge[0][$association][$assoc] = $data2; - } - } - } - if (!isset($data[$association])) { - if ($merge[0][$association] != null) { - $data[$association] = $merge[0][$association]; - } else { - $data[$association] = array(); - } - } else { - if (is_array($merge[0][$association])) { - foreach ($data[$association] as $k => $v) { - if (!is_array($v)) { - $dataAssocTmp[$k] = $v; - } - } - - foreach ($merge[0][$association] as $k => $v) { - if (!is_array($v)) { - $mergeAssocTmp[$k] = $v; - } - } - $dataKeys = array_keys($data); - $mergeKeys = array_keys($merge[0]); - - if ($mergeKeys[0] === $dataKeys[0] || $mergeKeys === $dataKeys) { - $data[$association][$association] = $merge[0][$association]; - } else { - $diff = Set::diff($dataAssocTmp, $mergeAssocTmp); - $data[$association] = array_merge($merge[0][$association], $diff); - } - } elseif ($selfJoin && array_key_exists($association, $merge[0])) { - $data[$association] = array_merge($data[$association], array($association => array())); - } - } - } - } else { - if (isset($merge[0][$association]) && $merge[0][$association] === false) { - if (!isset($data[$association])) { - $data[$association] = array(); - } - } else { - foreach ($merge as $i => $row) { - if (count($row) == 1) { - if (empty($data[$association]) || (isset($data[$association]) && !in_array($row[$association], $data[$association]))) { - $data[$association][] = $row[$association]; - } - } else if (!empty($row)) { - $tmp = array_merge($row[$association], $row); - unset($tmp[$association]); - $data[$association][] = $tmp; - } - } - } - } - } - -/** - * Generates an array representing a query or part of a query from a single model or two associated models - * - * @param Model $model - * @param Model $linkModel - * @param string $type - * @param string $association - * @param array $assocData - * @param array $queryData - * @param boolean $external - * @param array $resultSet - * @return mixed - * @access public - */ - function generateAssociationQuery(&$model, &$linkModel, $type, $association = null, $assocData = array(), &$queryData, $external = false, &$resultSet) { - $queryData = $this->__scrubQueryData($queryData); - $assocData = $this->__scrubQueryData($assocData); - - if (empty($queryData['fields'])) { - $queryData['fields'] = $this->fields($model, $model->alias); - } elseif (!empty($model->hasMany) && $model->recursive > -1) { - $assocFields = $this->fields($model, $model->alias, array("{$model->alias}.{$model->primaryKey}")); - $passedFields = $this->fields($model, $model->alias, $queryData['fields']); - if (count($passedFields) === 1) { - $match = strpos($passedFields[0], $assocFields[0]); - $match1 = (bool)preg_match('/^[a-z]+\(/i', $passedFields[0]); - - if ($match === false && $match1 === false) { - $queryData['fields'] = array_merge($passedFields, $assocFields); - } else { - $queryData['fields'] = $passedFields; - } - } else { - $queryData['fields'] = array_merge($passedFields, $assocFields); - } - unset($assocFields, $passedFields); - } - - if ($linkModel == null) { - return $this->buildStatement( - array( - 'fields' => array_unique($queryData['fields']), - 'table' => $this->fullTableName($model), - 'alias' => $model->alias, - 'limit' => $queryData['limit'], - 'offset' => $queryData['offset'], - 'joins' => $queryData['joins'], - 'conditions' => $queryData['conditions'], - 'order' => $queryData['order'], - 'group' => $queryData['group'] - ), - $model - ); - } - if ($external && !empty($assocData['finderQuery'])) { - return $assocData['finderQuery']; - } - - $alias = $association; - $self = ($model->name == $linkModel->name); - $fields = array(); - - if ((!$external && in_array($type, array('hasOne', 'belongsTo')) && $this->__bypass === false) || $external) { - $fields = $this->fields($linkModel, $alias, $assocData['fields']); - } - if (empty($assocData['offset']) && !empty($assocData['page'])) { - $assocData['offset'] = ($assocData['page'] - 1) * $assocData['limit']; - } - $assocData['limit'] = $this->limit($assocData['limit'], $assocData['offset']); - - switch ($type) { - case 'hasOne': - case 'belongsTo': - $conditions = $this->__mergeConditions( - $assocData['conditions'], - $this->getConstraint($type, $model, $linkModel, $alias, array_merge($assocData, compact('external', 'self'))) - ); - - if (!$self && $external) { - foreach ($conditions as $key => $condition) { - if (is_numeric($key) && strpos($condition, $model->alias . '.') !== false) { - unset($conditions[$key]); - } - } - } - - if ($external) { - $query = array_merge($assocData, array( - 'conditions' => $conditions, - 'table' => $this->fullTableName($linkModel), - 'fields' => $fields, - 'alias' => $alias, - 'group' => null - )); - $query = array_merge(array('order' => $assocData['order'], 'limit' => $assocData['limit']), $query); - } else { - $join = array( - 'table' => $this->fullTableName($linkModel), - 'alias' => $alias, - 'type' => isset($assocData['type']) ? $assocData['type'] : 'LEFT', - 'conditions' => trim($this->conditions($conditions, true, false, $model)) - ); - $queryData['fields'] = array_merge($queryData['fields'], $fields); - - if (!empty($assocData['order'])) { - $queryData['order'][] = $assocData['order']; - } - if (!in_array($join, $queryData['joins'])) { - $queryData['joins'][] = $join; - } - return true; - } - break; - case 'hasMany': - $assocData['fields'] = $this->fields($linkModel, $alias, $assocData['fields']); - if (!empty($assocData['foreignKey'])) { - $assocData['fields'] = array_merge($assocData['fields'], $this->fields($linkModel, $alias, array("{$alias}.{$assocData['foreignKey']}"))); - } - $query = array( - 'conditions' => $this->__mergeConditions($this->getConstraint('hasMany', $model, $linkModel, $alias, $assocData), $assocData['conditions']), - 'fields' => array_unique($assocData['fields']), - 'table' => $this->fullTableName($linkModel), - 'alias' => $alias, - 'order' => $assocData['order'], - 'limit' => $assocData['limit'], - 'group' => null - ); - break; - case 'hasAndBelongsToMany': - $joinFields = array(); - $joinAssoc = null; - - if (isset($assocData['with']) && !empty($assocData['with'])) { - $joinKeys = array($assocData['foreignKey'], $assocData['associationForeignKey']); - list($with, $joinFields) = $model->joinModel($assocData['with'], $joinKeys); - - $joinTbl = $this->fullTableName($model->{$with}); - $joinAlias = $joinTbl; - - if (is_array($joinFields) && !empty($joinFields)) { - $joinFields = $this->fields($model->{$with}, $model->{$with}->alias, $joinFields); - $joinAssoc = $joinAlias = $model->{$with}->alias; - } else { - $joinFields = array(); - } - } else { - $joinTbl = $this->fullTableName($assocData['joinTable']); - $joinAlias = $joinTbl; - } - $query = array( - 'conditions' => $assocData['conditions'], - 'limit' => $assocData['limit'], - 'table' => $this->fullTableName($linkModel), - 'alias' => $alias, - 'fields' => array_merge($this->fields($linkModel, $alias, $assocData['fields']), $joinFields), - 'order' => $assocData['order'], - 'group' => null, - 'joins' => array(array( - 'table' => $joinTbl, - 'alias' => $joinAssoc, - 'conditions' => $this->getConstraint('hasAndBelongsToMany', $model, $linkModel, $joinAlias, $assocData, $alias) - )) - ); - break; - } - if (isset($query)) { - return $this->buildStatement($query, $model); - } - return null; - } - -/** - * Returns a conditions array for the constraint between two models - * - * @param string $type Association type - * @param object $model Model object - * @param array $association Association array - * @return array Conditions array defining the constraint between $model and $association - * @access public - */ - function getConstraint($type, $model, $linkModel, $alias, $assoc, $alias2 = null) { - $assoc = array_merge(array('external' => false, 'self' => false), $assoc); - - if (array_key_exists('foreignKey', $assoc) && empty($assoc['foreignKey'])) { - return array(); - } - - switch (true) { - case ($assoc['external'] && $type == 'hasOne'): - return array("{$alias}.{$assoc['foreignKey']}" => '{$__cakeID__$}'); - break; - case ($assoc['external'] && $type == 'belongsTo'): - return array("{$alias}.{$linkModel->primaryKey}" => '{$__cakeForeignKey__$}'); - break; - case (!$assoc['external'] && $type == 'hasOne'): - return array("{$alias}.{$assoc['foreignKey']}" => $this->identifier("{$model->alias}.{$model->primaryKey}")); - break; - case (!$assoc['external'] && $type == 'belongsTo'): - return array("{$model->alias}.{$assoc['foreignKey']}" => $this->identifier("{$alias}.{$linkModel->primaryKey}")); - break; - case ($type == 'hasMany'): - return array("{$alias}.{$assoc['foreignKey']}" => array('{$__cakeID__$}')); - break; - case ($type == 'hasAndBelongsToMany'): - return array( - array("{$alias}.{$assoc['foreignKey']}" => '{$__cakeID__$}'), - array("{$alias}.{$assoc['associationForeignKey']}" => $this->identifier("{$alias2}.{$linkModel->primaryKey}")) - ); - break; - } - return array(); - } - -/** - * Builds and generates a JOIN statement from an array. Handles final clean-up before conversion. - * - * @param array $join An array defining a JOIN statement in a query - * @return string An SQL JOIN statement to be used in a query - * @access public - * @see DboSource::renderJoinStatement() - * @see DboSource::buildStatement() - */ - function buildJoinStatement($join) { - $data = array_merge(array( - 'type' => null, - 'alias' => null, - 'table' => 'join_table', - 'conditions' => array() - ), $join); - - if (!empty($data['alias'])) { - $data['alias'] = $this->alias . $this->name($data['alias']); - } - if (!empty($data['conditions'])) { - $data['conditions'] = trim($this->conditions($data['conditions'], true, false)); - } - return $this->renderJoinStatement($data); - } - -/** - * Builds and generates an SQL statement from an array. Handles final clean-up before conversion. - * - * @param array $query An array defining an SQL query - * @param object $model The model object which initiated the query - * @return string An executable SQL statement - * @access public - * @see DboSource::renderStatement() - */ - function buildStatement($query, &$model) { - $query = array_merge(array('offset' => null, 'joins' => array()), $query); - if (!empty($query['joins'])) { - $count = count($query['joins']); - for ($i = 0; $i < $count; $i++) { - if (is_array($query['joins'][$i])) { - $query['joins'][$i] = $this->buildJoinStatement($query['joins'][$i]); - } - } - } - return $this->renderStatement('select', array( - 'conditions' => $this->conditions($query['conditions'], true, true, $model), - 'fields' => implode(', ', $query['fields']), - 'table' => $query['table'], - 'alias' => $this->alias . $this->name($query['alias']), - 'order' => $this->order($query['order'], 'ASC', $model), - 'limit' => $this->limit($query['limit'], $query['offset']), - 'joins' => implode(' ', $query['joins']), - 'group' => $this->group($query['group'], $model) - )); - } - -/** - * Renders a final SQL JOIN statement - * - * @param array $data - * @return string - * @access public - */ - function renderJoinStatement($data) { - extract($data); - return trim("{$type} JOIN {$table} {$alias} ON ({$conditions})"); - } - -/** - * Renders a final SQL statement by putting together the component parts in the correct order - * - * @param string $type type of query being run. e.g select, create, update, delete, schema, alter. - * @param array $data Array of data to insert into the query. - * @return string Rendered SQL expression to be run. - * @access public - */ - function renderStatement($type, $data) { - extract($data); - $aliases = null; - - switch (strtolower($type)) { - case 'select': - return "SELECT {$fields} FROM {$table} {$alias} {$joins} {$conditions} {$group} {$order} {$limit}"; - break; - case 'create': - return "INSERT INTO {$table} ({$fields}) VALUES ({$values})"; - break; - case 'update': - if (!empty($alias)) { - $aliases = "{$this->alias}{$alias} {$joins} "; - } - return "UPDATE {$table} {$aliases}SET {$fields} {$conditions}"; - break; - case 'delete': - if (!empty($alias)) { - $aliases = "{$this->alias}{$alias} {$joins} "; - } - return "DELETE {$alias} FROM {$table} {$aliases}{$conditions}"; - break; - case 'schema': - foreach (array('columns', 'indexes', 'tableParameters') as $var) { - if (is_array(${$var})) { - ${$var} = "\t" . join(",\n\t", array_filter(${$var})); - } else { - ${$var} = ''; - } - } - if (trim($indexes) != '') { - $columns .= ','; - } - return "CREATE TABLE {$table} (\n{$columns}{$indexes}){$tableParameters};"; - break; - case 'alter': - break; - } - } - -/** - * Merges a mixed set of string/array conditions - * - * @return array - * @access private - */ - function __mergeConditions($query, $assoc) { - if (empty($assoc)) { - return $query; - } - - if (is_array($query)) { - return array_merge((array)$assoc, $query); - } - - if (!empty($query)) { - $query = array($query); - if (is_array($assoc)) { - $query = array_merge($query, $assoc); - } else { - $query[] = $assoc; - } - return $query; - } - - return $assoc; - } - -/** - * Generates and executes an SQL UPDATE statement for given model, fields, and values. - * For databases that do not support aliases in UPDATE queries. - * - * @param Model $model - * @param array $fields - * @param array $values - * @param mixed $conditions - * @return boolean Success - * @access public - */ - function update(&$model, $fields = array(), $values = null, $conditions = null) { - if ($values == null) { - $combined = $fields; - } else { - $combined = array_combine($fields, $values); - } - - $fields = implode(', ', $this->_prepareUpdateFields($model, $combined, empty($conditions))); - - $alias = $joins = null; - $table = $this->fullTableName($model); - $conditions = $this->_matchRecords($model, $conditions); - - if ($conditions === false) { - return false; - } - $query = compact('table', 'alias', 'joins', 'fields', 'conditions'); - - if (!$this->execute($this->renderStatement('update', $query))) { - $model->onError(); - return false; - } - return true; - } - -/** - * Quotes and prepares fields and values for an SQL UPDATE statement - * - * @param Model $model - * @param array $fields - * @param boolean $quoteValues If values should be quoted, or treated as SQL snippets - * @param boolean $alias Include the model alias in the field name - * @return array Fields and values, quoted and preparted - * @access protected - */ - function _prepareUpdateFields(&$model, $fields, $quoteValues = true, $alias = false) { - $quotedAlias = $this->startQuote . $model->alias . $this->endQuote; - - $updates = array(); - foreach ($fields as $field => $value) { - if ($alias && strpos($field, '.') === false) { - $quoted = $model->escapeField($field); - } elseif (!$alias && strpos($field, '.') !== false) { - $quoted = $this->name(str_replace($quotedAlias . '.', '', str_replace( - $model->alias . '.', '', $field - ))); - } else { - $quoted = $this->name($field); - } - - if ($value === null) { - $updates[] = $quoted . ' = NULL'; - continue; - } - $update = $quoted . ' = '; - - if ($quoteValues) { - $update .= $this->value($value, $model->getColumnType($field), false); - } elseif (!$alias) { - $update .= str_replace($quotedAlias . '.', '', str_replace( - $model->alias . '.', '', $value - )); - } else { - $update .= $value; - } - $updates[] = $update; - } - return $updates; - } - -/** - * Generates and executes an SQL DELETE statement. - * For databases that do not support aliases in UPDATE queries. - * - * @param Model $model - * @param mixed $conditions - * @return boolean Success - * @access public - */ - function delete(&$model, $conditions = null) { - $alias = $joins = null; - $table = $this->fullTableName($model); - $conditions = $this->_matchRecords($model, $conditions); - - if ($conditions === false) { - return false; - } - - if ($this->execute($this->renderStatement('delete', compact('alias', 'table', 'joins', 'conditions'))) === false) { - $model->onError(); - return false; - } - return true; - } - -/** - * Gets a list of record IDs for the given conditions. Used for multi-record updates and deletes - * in databases that do not support aliases in UPDATE/DELETE queries. - * - * @param Model $model - * @param mixed $conditions - * @return array List of record IDs - * @access protected - */ - function _matchRecords(&$model, $conditions = null) { - if ($conditions === true) { - $conditions = $this->conditions(true); - } elseif ($conditions === null) { - $conditions = $this->conditions($this->defaultConditions($model, $conditions, false), true, true, $model); - } else { - $noJoin = true; - foreach ($conditions as $field => $value) { - $originalField = $field; - if (strpos($field, '.') !== false) { - list($alias, $field) = explode('.', $field); - $field = ltrim($field, $this->startQuote); - $field = rtrim($field, $this->endQuote); - } - if (!$model->hasField($field)) { - $noJoin = false; - break; - } - if ($field !== $originalField) { - $conditions[$field] = $value; - unset($conditions[$originalField]); - } - } - if ($noJoin === true) { - return $this->conditions($conditions); - } - $idList = $model->find('all', array( - 'fields' => "{$model->alias}.{$model->primaryKey}", - 'conditions' => $conditions - )); - - if (empty($idList)) { - return false; - } - $conditions = $this->conditions(array( - $model->primaryKey => Set::extract($idList, "{n}.{$model->alias}.{$model->primaryKey}") - )); - } - return $conditions; - } - -/** - * Returns an array of SQL JOIN fragments from a model's associations - * - * @param object $model - * @return array - * @access protected - */ - function _getJoins($model) { - $join = array(); - $joins = array_merge($model->getAssociated('hasOne'), $model->getAssociated('belongsTo')); - - foreach ($joins as $assoc) { - if (isset($model->{$assoc}) && $model->useDbConfig == $model->{$assoc}->useDbConfig) { - $assocData = $model->getAssociated($assoc); - $join[] = $this->buildJoinStatement(array( - 'table' => $this->fullTableName($model->{$assoc}), - 'alias' => $assoc, - 'type' => isset($assocData['type']) ? $assocData['type'] : 'LEFT', - 'conditions' => trim($this->conditions( - $this->__mergeConditions($assocData['conditions'], $this->getConstraint($assocData['association'], $model, $model->{$assoc}, $assoc, $assocData)), - true, false, $model - )) - )); - } - } - return $join; - } - -/** - * Returns an SQL calculation, i.e. COUNT() or MAX() - * - * @param model $model - * @param string $func Lowercase name of SQL function, i.e. 'count' or 'max' - * @param array $params Function parameters (any values must be quoted manually) - * @return string An SQL calculation function - * @access public - */ - function calculate(&$model, $func, $params = array()) { - $params = (array)$params; - - switch (strtolower($func)) { - case 'count': - if (!isset($params[0])) { - $params[0] = '*'; - } - if (!isset($params[1])) { - $params[1] = 'count'; - } - if (is_object($model) && $model->isVirtualField($params[0])){ - $arg = $this->__quoteFields($model->getVirtualField($params[0])); - } else { - $arg = $this->name($params[0]); - } - return 'COUNT(' . $arg . ') AS ' . $this->name($params[1]); - case 'max': - case 'min': - if (!isset($params[1])) { - $params[1] = $params[0]; - } - if (is_object($model) && $model->isVirtualField($params[0])) { - $arg = $this->__quoteFields($model->getVirtualField($params[0])); - } else { - $arg = $this->name($params[0]); - } - return strtoupper($func) . '(' . $arg . ') AS ' . $this->name($params[1]); - break; - } - } - -/** - * Deletes all the records in a table and resets the count of the auto-incrementing - * primary key, where applicable. - * - * @param mixed $table A string or model class representing the table to be truncated - * @return boolean SQL TRUNCATE TABLE statement, false if not applicable. - * @access public - */ - function truncate($table) { - return $this->execute('TRUNCATE TABLE ' . $this->fullTableName($table)); - } - -/** - * Begin a transaction - * - * @param model $model - * @return boolean True on success, false on fail - * (i.e. if the database/model does not support transactions, - * or a transaction has not started). - * @access public - */ - function begin(&$model) { - if (parent::begin($model) && $this->execute($this->_commands['begin'])) { - $this->_transactionStarted = true; - return true; - } - return false; - } - -/** - * Commit a transaction - * - * @param model $model - * @return boolean True on success, false on fail - * (i.e. if the database/model does not support transactions, - * or a transaction has not started). - * @access public - */ - function commit(&$model) { - if (parent::commit($model) && $this->execute($this->_commands['commit'])) { - $this->_transactionStarted = false; - return true; - } - return false; - } - -/** - * Rollback a transaction - * - * @param model $model - * @return boolean True on success, false on fail - * (i.e. if the database/model does not support transactions, - * or a transaction has not started). - * @access public - */ - function rollback(&$model) { - if (parent::rollback($model) && $this->execute($this->_commands['rollback'])) { - $this->_transactionStarted = false; - return true; - } - return false; - } - -/** - * Creates a default set of conditions from the model if $conditions is null/empty. - * If conditions are supplied then they will be returned. If a model doesn't exist and no conditions - * were provided either null or false will be returned based on what was input. - * - * @param object $model - * @param mixed $conditions Array of conditions, conditions string, null or false. If an array of conditions, - * or string conditions those conditions will be returned. With other values the model's existance will be checked. - * If the model doesn't exist a null or false will be returned depending on the input value. - * @param boolean $useAlias Use model aliases rather than table names when generating conditions - * @return mixed Either null, false, $conditions or an array of default conditions to use. - * @see DboSource::update() - * @see DboSource::conditions() - * @access public - */ - function defaultConditions(&$model, $conditions, $useAlias = true) { - if (!empty($conditions)) { - return $conditions; - } - $exists = $model->exists(); - if (!$exists && $conditions !== null) { - return false; - } elseif (!$exists) { - return null; - } - $alias = $model->alias; - - if (!$useAlias) { - $alias = $this->fullTableName($model, false); - } - return array("{$alias}.{$model->primaryKey}" => $model->getID()); - } - -/** - * Returns a key formatted like a string Model.fieldname(i.e. Post.title, or Country.name) - * - * @param unknown_type $model - * @param unknown_type $key - * @param unknown_type $assoc - * @return string - * @access public - */ - function resolveKey($model, $key, $assoc = null) { - if (empty($assoc)) { - $assoc = $model->alias; - } - if (!strpos('.', $key)) { - return $this->name($model->alias) . '.' . $this->name($key); - } - return $key; - } - -/** - * Private helper method to remove query metadata in given data array. - * - * @param array $data - * @return array - * @access public - */ - function __scrubQueryData($data) { - foreach (array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group') as $key) { - if (empty($data[$key])) { - $data[$key] = array(); - } - } - return $data; - } - -/** - * Converts model virtual fields into sql expressions to be fetched later - * - * @param Model $model - * @param string $alias Alias tablename - * @param mixed $fields virtual fields to be used on query - * @return array - */ - function _constructVirtualFields(&$model, $alias, $fields) { - $virtual = array(); - foreach ($fields as $field) { - $virtualField = $this->name($alias . $this->virtualFieldSeparator . $field); - $expression = $this->__quoteFields($model->getVirtualField($field)); - $virtual[] = '(' . $expression . ") {$this->alias} {$virtualField}"; - } - return $virtual; - } - -/** - * Generates the fields list of an SQL query. - * - * @param Model $model - * @param string $alias Alias tablename - * @param mixed $fields - * @param boolean $quote If false, returns fields array unquoted - * @return array - * @access public - */ - function fields(&$model, $alias = null, $fields = array(), $quote = true) { - if (empty($alias)) { - $alias = $model->alias; - } - $cacheKey = array( - $model->useDbConfig, - $model->table, - array_keys($model->schema()), - $model->name, - $model->getVirtualField(), - $alias, - $fields, - $quote - ); - $cacheKey = crc32(serialize($cacheKey)); - if ($return = $this->cacheMethod(__FUNCTION__, $cacheKey)) { - return $return; - } - $allFields = empty($fields); - if ($allFields) { - $fields = array_keys($model->schema()); - } elseif (!is_array($fields)) { - $fields = String::tokenize($fields); - } - $fields = array_values(array_filter($fields)); - $allFields = $allFields || in_array('*', $fields) || in_array($model->alias . '.*', $fields); - - $virtual = array(); - $virtualFields = $model->getVirtualField(); - if (!empty($virtualFields)) { - $virtualKeys = array_keys($virtualFields); - foreach ($virtualKeys as $field) { - $virtualKeys[] = $model->alias . '.' . $field; - } - $virtual = ($allFields) ? $virtualKeys : array_intersect($virtualKeys, $fields); - foreach ($virtual as $i => $field) { - if (strpos($field, '.') !== false) { - $virtual[$i] = str_replace($model->alias . '.', '', $field); - } - $fields = array_diff($fields, array($field)); - } - $fields = array_values($fields); - } - - if (!$quote) { - if (!empty($virtual)) { - $fields = array_merge($fields, $this->_constructVirtualFields($model, $alias, $virtual)); - } - return $fields; - } - $count = count($fields); - - if ($count >= 1 && !in_array($fields[0], array('*', 'COUNT(*)'))) { - for ($i = 0; $i < $count; $i++) { - if (is_string($fields[$i]) && in_array($fields[$i], $virtual)) { - unset($fields[$i]); - continue; - } - if (is_object($fields[$i]) && isset($fields[$i]->type) && $fields[$i]->type === 'expression') { - $fields[$i] = $fields[$i]->value; - } elseif (preg_match('/^\(.*\)\s' . $this->alias . '.*/i', $fields[$i])){ - continue; - } elseif (!preg_match('/^.+\\(.*\\)/', $fields[$i])) { - $prepend = ''; - - if (strpos($fields[$i], 'DISTINCT') !== false) { - $prepend = 'DISTINCT '; - $fields[$i] = trim(str_replace('DISTINCT', '', $fields[$i])); - } - $dot = strpos($fields[$i], '.'); - - if ($dot === false) { - $prefix = !( - strpos($fields[$i], ' ') !== false || - strpos($fields[$i], '(') !== false - ); - $fields[$i] = $this->name(($prefix ? $alias . '.' : '') . $fields[$i]); - } else { - $value = array(); - $comma = strpos($fields[$i], ','); - if ($comma === false) { - $build = explode('.', $fields[$i]); - if (!Set::numeric($build)) { - $fields[$i] = $this->name(implode('.', $build)); - } - } - } - $fields[$i] = $prepend . $fields[$i]; - } elseif (preg_match('/\(([\.\w]+)\)/', $fields[$i], $field)) { - if (isset($field[1])) { - if (strpos($field[1], '.') === false) { - $field[1] = $this->name($alias . '.' . $field[1]); - } else { - $field[0] = explode('.', $field[1]); - if (!Set::numeric($field[0])) { - $field[0] = implode('.', array_map(array(&$this, 'name'), $field[0])); - $fields[$i] = preg_replace('/\(' . $field[1] . '\)/', '(' . $field[0] . ')', $fields[$i], 1); - } - } - } - } - } - } - if (!empty($virtual)) { - $fields = array_merge($fields, $this->_constructVirtualFields($model, $alias, $virtual)); - } - return $this->cacheMethod(__FUNCTION__, $cacheKey, array_unique($fields)); - } - -/** - * Creates a WHERE clause by parsing given conditions data. If an array or string - * conditions are provided those conditions will be parsed and quoted. If a boolean - * is given it will be integer cast as condition. Null will return 1 = 1. - * - * Results of this method are stored in a memory cache. This improves performance, but - * because the method uses a simple hashing algorithm it can infrequently have collisions. - * Setting DboSource::$cacheMethods to false will disable the memory cache. - * - * @param mixed $conditions Array or string of conditions, or any value. - * @param boolean $quoteValues If true, values should be quoted - * @param boolean $where If true, "WHERE " will be prepended to the return value - * @param Model $model A reference to the Model instance making the query - * @return string SQL fragment - * @access public - */ - function conditions($conditions, $quoteValues = true, $where = true, $model = null) { - if (is_object($model)) { - $cacheKey = array( - $model->useDbConfig, - $model->table, - $model->schema(), - $model->name, - $model->getVirtualField(), - $conditions, - $quoteValues, - $where - ); - } else { - $cacheKey = array($conditions, $quoteValues, $where); - } - $cacheKey = crc32(serialize($cacheKey)); - if ($return = $this->cacheMethod(__FUNCTION__, $cacheKey)) { - return $return; - } - - $clause = $out = ''; - - if ($where) { - $clause = ' WHERE '; - } - - if (is_array($conditions) && !empty($conditions)) { - $out = $this->conditionKeysToString($conditions, $quoteValues, $model); - - if (empty($out)) { - return $this->cacheMethod(__FUNCTION__, $cacheKey, $clause . ' 1 = 1'); - } - return $this->cacheMethod(__FUNCTION__, $cacheKey, $clause . implode(' AND ', $out)); - } - if ($conditions === false || $conditions === true) { - return $this->cacheMethod(__FUNCTION__, $cacheKey, $clause . (int)$conditions . ' = 1'); - } - - if (empty($conditions) || trim($conditions) == '') { - return $this->cacheMethod(__FUNCTION__, $cacheKey, $clause . '1 = 1'); - } - $clauses = '/^WHERE\\x20|^GROUP\\x20BY\\x20|^HAVING\\x20|^ORDER\\x20BY\\x20/i'; - - if (preg_match($clauses, $conditions, $match)) { - $clause = ''; - } - if (trim($conditions) == '') { - $conditions = ' 1 = 1'; - } else { - $conditions = $this->__quoteFields($conditions); - } - return $this->cacheMethod(__FUNCTION__, $cacheKey, $clause . $conditions); - } - -/** - * Creates a WHERE clause by parsing given conditions array. Used by DboSource::conditions(). - * - * @param array $conditions Array or string of conditions - * @param boolean $quoteValues If true, values should be quoted - * @param Model $model A reference to the Model instance making the query - * @return string SQL fragment - * @access public - */ - function conditionKeysToString($conditions, $quoteValues = true, $model = null) { - $c = 0; - $out = array(); - $data = $columnType = null; - $bool = array('and', 'or', 'not', 'and not', 'or not', 'xor', '||', '&&'); - - foreach ($conditions as $key => $value) { - $join = ' AND '; - $not = null; - - if (is_array($value)) { - $valueInsert = ( - !empty($value) && - (substr_count($key, '?') == count($value) || substr_count($key, ':') == count($value)) - ); - } - - if (is_numeric($key) && empty($value)) { - continue; - } elseif (is_numeric($key) && is_string($value)) { - $out[] = $not . $this->__quoteFields($value); - } elseif ((is_numeric($key) && is_array($value)) || in_array(strtolower(trim($key)), $bool)) { - if (in_array(strtolower(trim($key)), $bool)) { - $join = ' ' . strtoupper($key) . ' '; - } else { - $key = $join; - } - $value = $this->conditionKeysToString($value, $quoteValues, $model); - - if (strpos($join, 'NOT') !== false) { - if (strtoupper(trim($key)) == 'NOT') { - $key = 'AND ' . trim($key); - } - $not = 'NOT '; - } - - if (empty($value[1])) { - if ($not) { - $out[] = $not . '(' . $value[0] . ')'; - } else { - $out[] = $value[0] ; - } - } else { - $out[] = '(' . $not . '(' . implode(') ' . strtoupper($key) . ' (', $value) . '))'; - } - - } else { - if (is_object($value) && isset($value->type)) { - if ($value->type == 'identifier') { - $data .= $this->name($key) . ' = ' . $this->name($value->value); - } elseif ($value->type == 'expression') { - if (is_numeric($key)) { - $data .= $value->value; - } else { - $data .= $this->name($key) . ' = ' . $value->value; - } - } - } elseif (is_array($value) && !empty($value) && !$valueInsert) { - $keys = array_keys($value); - if ($keys === array_values($keys)) { - $count = count($value); - if ($count === 1) { - $data = $this->__quoteFields($key) . ' = ('; - } else { - $data = $this->__quoteFields($key) . ' IN ('; - } - if ($quoteValues) { - if (is_object($model)) { - $columnType = $model->getColumnType($key); - } - $data .= implode(', ', $this->value($value, $columnType)); - } - $data .= ')'; - } else { - $ret = $this->conditionKeysToString($value, $quoteValues, $model); - if (count($ret) > 1) { - $data = '(' . implode(') AND (', $ret) . ')'; - } elseif (isset($ret[0])) { - $data = $ret[0]; - } - } - } elseif (is_numeric($key) && !empty($value)) { - $data = $this->__quoteFields($value); - } else { - $data = $this->__parseKey($model, trim($key), $value); - } - - if ($data != null) { - $out[] = $data; - $data = null; - } - } - $c++; - } - return $out; - } - -/** - * Extracts a Model.field identifier and an SQL condition operator from a string, formats - * and inserts values, and composes them into an SQL snippet. - * - * @param Model $model Model object initiating the query - * @param string $key An SQL key snippet containing a field and optional SQL operator - * @param mixed $value The value(s) to be inserted in the string - * @return string - * @access private - */ - function __parseKey(&$model, $key, $value) { - $operatorMatch = '/^((' . implode(')|(', $this->__sqlOps); - $operatorMatch .= '\\x20)|<[>=]?(?![^>]+>)\\x20?|[>=!]{1,3}(?!<)\\x20?)/is'; - $bound = (strpos($key, '?') !== false || (is_array($value) && strpos($key, ':') !== false)); - - if (!strpos($key, ' ')) { - $operator = '='; - } else { - list($key, $operator) = explode(' ', trim($key), 2); - - if (!preg_match($operatorMatch, trim($operator)) && strpos($operator, ' ') !== false) { - $key = $key . ' ' . $operator; - $split = strrpos($key, ' '); - $operator = substr($key, $split); - $key = substr($key, 0, $split); - } - } - - $virtual = false; - if (is_object($model) && $model->isVirtualField($key)) { - $key = $this->__quoteFields($model->getVirtualField($key)); - $virtual = true; - } - - $type = (is_object($model) ? $model->getColumnType($key) : null); - - $null = ($value === null || (is_array($value) && empty($value))); - - if (strtolower($operator) === 'not') { - $data = $this->conditionKeysToString( - array($operator => array($key => $value)), true, $model - ); - return $data[0]; - } - - $value = $this->value($value, $type); - - if (!$virtual && $key !== '?') { - $isKey = (strpos($key, '(') !== false || strpos($key, ')') !== false); - $key = $isKey ? $this->__quoteFields($key) : $this->name($key); - } - - if ($bound) { - return String::insert($key . ' ' . trim($operator), $value); - } - - if (!preg_match($operatorMatch, trim($operator))) { - $operator .= ' ='; - } - $operator = trim($operator); - - if (is_array($value)) { - $value = implode(', ', $value); - - switch ($operator) { - case '=': - $operator = 'IN'; - break; - case '!=': - case '<>': - $operator = 'NOT IN'; - break; - } - $value = "({$value})"; - } elseif ($null) { - switch ($operator) { - case '=': - $operator = 'IS'; - break; - case '!=': - case '<>': - $operator = 'IS NOT'; - break; - } - } - if ($virtual) { - return "({$key}) {$operator} {$value}"; - } - return "{$key} {$operator} {$value}"; - } - -/** - * Quotes Model.fields - * - * @param string $conditions - * @return string or false if no match - * @access private - */ - function __quoteFields($conditions) { - $start = $end = null; - $original = $conditions; - - if (!empty($this->startQuote)) { - $start = preg_quote($this->startQuote); - } - if (!empty($this->endQuote)) { - $end = preg_quote($this->endQuote); - } - $conditions = str_replace(array($start, $end), '', $conditions); - $conditions = preg_replace_callback('/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9_' . $start . $end . ']*\\.[a-z0-9_' . $start . $end . ']*)/i', array(&$this, '__quoteMatchedField'), $conditions); - - if ($conditions !== null) { - return $conditions; - } - return $original; - } - -/** - * Auxiliary function to quote matches `Model.fields` from a preg_replace_callback call - * - * @param string matched string - * @return string quoted strig - * @access private - */ - function __quoteMatchedField($match) { - if (is_numeric($match[0])) { - return $match[0]; - } - return $this->name($match[0]); - } - -/** - * Returns a limit statement in the correct format for the particular database. - * - * @param integer $limit Limit of results returned - * @param integer $offset Offset from which to start results - * @return string SQL limit/offset statement - * @access public - */ - function limit($limit, $offset = null) { - if ($limit) { - $rt = ''; - if (!strpos(strtolower($limit), 'limit') || strpos(strtolower($limit), 'limit') === 0) { - $rt = ' LIMIT'; - } - - if ($offset) { - $rt .= ' ' . $offset . ','; - } - - $rt .= ' ' . $limit; - return $rt; - } - return null; - } - -/** - * Returns an ORDER BY clause as a string. - * - * @param string $key Field reference, as a key (i.e. Post.title) - * @param string $direction Direction (ASC or DESC) - * @param object $model model reference (used to look for virtual field) - * @return string ORDER BY clause - * @access public - */ - function order($keys, $direction = 'ASC', $model = null) { - if (!is_array($keys)) { - $keys = array($keys); - } - $keys = array_filter($keys); - $result = array(); - while (!empty($keys)) { - list($key, $dir) = each($keys); - array_shift($keys); - - if (is_numeric($key)) { - $key = $dir; - $dir = $direction; - } - - if (is_string($key) && strpos($key, ',') && !preg_match('/\(.+\,.+\)/', $key)) { - $key = array_map('trim', explode(',', $key)); - } - if (is_array($key)) { - //Flatten the array - $key = array_reverse($key, true); - foreach ($key as $k => $v) { - if (is_numeric($k)) { - array_unshift($keys, $v); - } else { - $keys = array($k => $v) + $keys; - } - } - continue; - } elseif (is_object($key) && isset($key->type) && $key->type === 'expression') { - $result[] = $key->value; - continue; - } - - if (preg_match('/\\x20(ASC|DESC).*/i', $key, $_dir)) { - $dir = $_dir[0]; - $key = preg_replace('/\\x20(ASC|DESC).*/i', '', $key); - } - - $key = trim($key); - - if (is_object($model) && $model->isVirtualField($key)) { - $key = '(' . $this->__quoteFields($model->getVirtualField($key)) . ')'; - } - - if (strpos($key, '.')) { - $key = preg_replace_callback('/([a-zA-Z0-9_-]{1,})\\.([a-zA-Z0-9_-]{1,})/', array(&$this, '__quoteMatchedField'), $key); - } - if (!preg_match('/\s/', $key) && !strpos($key, '.')) { - $key = $this->name($key); - } - $key .= ' ' . trim($dir); - $result[] = $key; - } - if (!empty($result)) { - return ' ORDER BY ' . implode(', ', $result); - } - return ''; - } - -/** - * Create a GROUP BY SQL clause - * - * @param string $group Group By Condition - * @return mixed string condition or null - * @access public - */ - function group($group, $model = null) { - if ($group) { - if (!is_array($group)) { - $group = array($group); - } - foreach($group as $index => $key) { - if (is_object($model) && $model->isVirtualField($key)) { - $group[$index] = '(' . $model->getVirtualField($key) . ')'; - } - } - $group = implode(', ', $group); - return ' GROUP BY ' . $this->__quoteFields($group); - } - return null; - } - -/** - * Disconnects database, kills the connection and says the connection is closed. - * - * @return void - * @access public - */ - function close() { - $this->disconnect(); - } - -/** - * Checks if the specified table contains any record matching specified SQL - * - * @param Model $model Model to search - * @param string $sql SQL WHERE clause (condition only, not the "WHERE" part) - * @return boolean True if the table has a matching record, else false - * @access public - */ - function hasAny(&$Model, $sql) { - $sql = $this->conditions($sql); - $table = $this->fullTableName($Model); - $alias = $this->alias . $this->name($Model->alias); - $where = $sql ? "{$sql}" : ' WHERE 1 = 1'; - $id = $Model->escapeField(); - - $out = $this->fetchRow("SELECT COUNT({$id}) {$this->alias}count FROM {$table} {$alias}{$where}"); - - if (is_array($out)) { - return $out[0]['count']; - } - return false; - } - -/** - * Gets the length of a database-native column description, or null if no length - * - * @param string $real Real database-layer column type (i.e. "varchar(255)") - * @return mixed An integer or string representing the length of the column - * @access public - */ - function length($real) { - if (!preg_match_all('/([\w\s]+)(?:\((\d+)(?:,(\d+))?\))?(\sunsigned)?(\szerofill)?/', $real, $result)) { - trigger_error(__("FIXME: Can't parse field: " . $real, true), E_USER_WARNING); - $col = str_replace(array(')', 'unsigned'), '', $real); - $limit = null; - - if (strpos($col, '(') !== false) { - list($col, $limit) = explode('(', $col); - } - if ($limit != null) { - return intval($limit); - } - return null; - } - - $types = array( - 'int' => 1, 'tinyint' => 1, 'smallint' => 1, 'mediumint' => 1, 'integer' => 1, 'bigint' => 1 - ); - - list($real, $type, $length, $offset, $sign, $zerofill) = $result; - $typeArr = $type; - $type = $type[0]; - $length = $length[0]; - $offset = $offset[0]; - - $isFloat = in_array($type, array('dec', 'decimal', 'float', 'numeric', 'double')); - if ($isFloat && $offset) { - return $length.','.$offset; - } - - if (($real[0] == $type) && (count($real) == 1)) { - return null; - } - - if (isset($types[$type])) { - $length += $types[$type]; - if (!empty($sign)) { - $length--; - } - } elseif (in_array($type, array('enum', 'set'))) { - $length = 0; - foreach ($typeArr as $key => $enumValue) { - if ($key == 0) { - continue; - } - $tmpLength = strlen($enumValue); - if ($tmpLength > $length) { - $length = $tmpLength; - } - } - } - return intval($length); - } - -/** - * Translates between PHP boolean values and Database (faked) boolean values - * - * @param mixed $data Value to be translated - * @return mixed Converted boolean value - * @access public - */ - function boolean($data) { - if ($data === true || $data === false) { - if ($data === true) { - return 1; - } - return 0; - } else { - return !empty($data); - } - } - -/** - * Inserts multiple values into a table - * - * @param string $table - * @param string $fields - * @param array $values - * @access protected - */ - function insertMulti($table, $fields, $values) { - $table = $this->fullTableName($table); - if (is_array($fields)) { - $fields = implode(', ', array_map(array(&$this, 'name'), $fields)); - } - $count = count($values); - for ($x = 0; $x < $count; $x++) { - $this->query("INSERT INTO {$table} ({$fields}) VALUES {$values[$x]}"); - } - } - -/** - * Returns an array of the indexes in given datasource name. - * - * @param string $model Name of model to inspect - * @return array Fields in table. Keys are column and unique - * @access public - */ - function index($model) { - return false; - } - -/** - * Generate a database-native schema for the given Schema object - * - * @param object $schema An instance of a subclass of CakeSchema - * @param string $tableName Optional. If specified only the table name given will be generated. - * Otherwise, all tables defined in the schema are generated. - * @return string - * @access public - */ - function createSchema($schema, $tableName = null) { - if (!is_a($schema, 'CakeSchema')) { - trigger_error(__('Invalid schema object', true), E_USER_WARNING); - return null; - } - $out = ''; - - foreach ($schema->tables as $curTable => $columns) { - if (!$tableName || $tableName == $curTable) { - $cols = $colList = $indexes = $tableParameters = array(); - $primary = null; - $table = $this->fullTableName($curTable); - - foreach ($columns as $name => $col) { - if (is_string($col)) { - $col = array('type' => $col); - } - if (isset($col['key']) && $col['key'] == 'primary') { - $primary = $name; - } - if ($name !== 'indexes' && $name !== 'tableParameters') { - $col['name'] = $name; - if (!isset($col['type'])) { - $col['type'] = 'string'; - } - $cols[] = $this->buildColumn($col); - } elseif ($name == 'indexes') { - $indexes = array_merge($indexes, $this->buildIndex($col, $table)); - } elseif ($name == 'tableParameters') { - $tableParameters = array_merge($tableParameters, $this->buildTableParameters($col, $table)); - } - } - if (empty($indexes) && !empty($primary)) { - $col = array('PRIMARY' => array('column' => $primary, 'unique' => 1)); - $indexes = array_merge($indexes, $this->buildIndex($col, $table)); - } - $columns = $cols; - $out .= $this->renderStatement('schema', compact('table', 'columns', 'indexes', 'tableParameters')) . "\n\n"; - } - } - return $out; - } - -/** - * Generate a alter syntax from CakeSchema::compare() - * - * @param unknown_type $schema - * @return boolean - */ - function alterSchema($compare, $table = null) { - return false; - } - -/** - * Generate a "drop table" statement for the given Schema object - * - * @param object $schema An instance of a subclass of CakeSchema - * @param string $table Optional. If specified only the table name given will be generated. - * Otherwise, all tables defined in the schema are generated. - * @return string - * @access public - */ - function dropSchema($schema, $table = null) { - if (!is_a($schema, 'CakeSchema')) { - trigger_error(__('Invalid schema object', true), E_USER_WARNING); - return null; - } - $out = ''; - - foreach ($schema->tables as $curTable => $columns) { - if (!$table || $table == $curTable) { - $out .= 'DROP TABLE ' . $this->fullTableName($curTable) . ";\n"; - } - } - return $out; - } - -/** - * Generate a database-native column schema string - * - * @param array $column An array structured like the following: array('name'=>'value', 'type'=>'value'[, options]), - * where options can be 'default', 'length', or 'key'. - * @return string - * @access public - */ - function buildColumn($column) { - $name = $type = null; - extract(array_merge(array('null' => true), $column)); - - if (empty($name) || empty($type)) { - trigger_error(__('Column name or type not defined in schema', true), E_USER_WARNING); - return null; - } - - if (!isset($this->columns[$type])) { - trigger_error(sprintf(__('Column type %s does not exist', true), $type), E_USER_WARNING); - return null; - } - - $real = $this->columns[$type]; - $out = $this->name($name) . ' ' . $real['name']; - - if (isset($real['limit']) || isset($real['length']) || isset($column['limit']) || isset($column['length'])) { - if (isset($column['length'])) { - $length = $column['length']; - } elseif (isset($column['limit'])) { - $length = $column['limit']; - } elseif (isset($real['length'])) { - $length = $real['length']; - } else { - $length = $real['limit']; - } - $out .= '(' . $length . ')'; - } - - if (($column['type'] == 'integer' || $column['type'] == 'float' ) && isset($column['default']) && $column['default'] === '') { - $column['default'] = null; - } - $out = $this->_buildFieldParameters($out, $column, 'beforeDefault'); - - if (isset($column['key']) && $column['key'] == 'primary' && $type == 'integer') { - $out .= ' ' . $this->columns['primary_key']['name']; - } elseif (isset($column['key']) && $column['key'] == 'primary') { - $out .= ' NOT NULL'; - } elseif (isset($column['default']) && isset($column['null']) && $column['null'] == false) { - $out .= ' DEFAULT ' . $this->value($column['default'], $type) . ' NOT NULL'; - } elseif (isset($column['default'])) { - $out .= ' DEFAULT ' . $this->value($column['default'], $type); - } elseif ($type !== 'timestamp' && !empty($column['null'])) { - $out .= ' DEFAULT NULL'; - } elseif ($type === 'timestamp' && !empty($column['null'])) { - $out .= ' NULL'; - } elseif (isset($column['null']) && $column['null'] == false) { - $out .= ' NOT NULL'; - } - if ($type == 'timestamp' && isset($column['default']) && strtolower($column['default']) == 'current_timestamp') { - $out = str_replace(array("'CURRENT_TIMESTAMP'", "'current_timestamp'"), 'CURRENT_TIMESTAMP', $out); - } - $out = $this->_buildFieldParameters($out, $column, 'afterDefault'); - return $out; - } - -/** - * Build the field parameters, in a position - * - * @param string $columnString The partially built column string - * @param array $columnData The array of column data. - * @param string $position The position type to use. 'beforeDefault' or 'afterDefault' are common - * @return string a built column with the field parameters added. - * @access public - */ - function _buildFieldParameters($columnString, $columnData, $position) { - foreach ($this->fieldParameters as $paramName => $value) { - if (isset($columnData[$paramName]) && $value['position'] == $position) { - if (isset($value['options']) && !in_array($columnData[$paramName], $value['options'])) { - continue; - } - $val = $columnData[$paramName]; - if ($value['quote']) { - $val = $this->value($val); - } - $columnString .= ' ' . $value['value'] . $value['join'] . $val; - } - } - return $columnString; - } - -/** - * Format indexes for create table - * - * @param array $indexes - * @param string $table - * @return array - * @access public - */ - function buildIndex($indexes, $table = null) { - $join = array(); - foreach ($indexes as $name => $value) { - $out = ''; - if ($name == 'PRIMARY') { - $out .= 'PRIMARY '; - $name = null; - } else { - if (!empty($value['unique'])) { - $out .= 'UNIQUE '; - } - $name = $this->startQuote . $name . $this->endQuote; - } - if (is_array($value['column'])) { - $out .= 'KEY ' . $name . ' (' . implode(', ', array_map(array(&$this, 'name'), $value['column'])) . ')'; - } else { - $out .= 'KEY ' . $name . ' (' . $this->name($value['column']) . ')'; - } - $join[] = $out; - } - return $join; - } - -/** - * Read additional table parameters - * - * @param array $parameters - * @param string $table - * @return array - * @access public - */ - function readTableParameters($name) { - $parameters = array(); - if ($this->isInterfaceSupported('listDetailedSources')) { - $currentTableDetails = $this->listDetailedSources($name); - foreach ($this->tableParameters as $paramName => $parameter) { - if (!empty($parameter['column']) && !empty($currentTableDetails[$parameter['column']])) { - $parameters[$paramName] = $currentTableDetails[$parameter['column']]; - } - } - } - return $parameters; - } - -/** - * Format parameters for create table - * - * @param array $parameters - * @param string $table - * @return array - * @access public - */ - function buildTableParameters($parameters, $table = null) { - $result = array(); - foreach ($parameters as $name => $value) { - if (isset($this->tableParameters[$name])) { - if ($this->tableParameters[$name]['quote']) { - $value = $this->value($value); - } - $result[] = $this->tableParameters[$name]['value'] . $this->tableParameters[$name]['join'] . $value; - } - } - return $result; - } - -/** - * Guesses the data type of an array - * - * @param string $value - * @return void - * @access public - */ - function introspectType($value) { - if (!is_array($value)) { - if ($value === true || $value === false) { - return 'boolean'; - } - if (is_float($value) && floatval($value) === $value) { - return 'float'; - } - if (is_int($value) && intval($value) === $value) { - return 'integer'; - } - if (is_string($value) && strlen($value) > 255) { - return 'text'; - } - return 'string'; - } - - $isAllFloat = $isAllInt = true; - $containsFloat = $containsInt = $containsString = false; - foreach ($value as $key => $valElement) { - $valElement = trim($valElement); - if (!is_float($valElement) && !preg_match('/^[\d]+\.[\d]+$/', $valElement)) { - $isAllFloat = false; - } else { - $containsFloat = true; - continue; - } - if (!is_int($valElement) && !preg_match('/^[\d]+$/', $valElement)) { - $isAllInt = false; - } else { - $containsInt = true; - continue; - } - $containsString = true; - } - - if ($isAllFloat) { - return 'float'; - } - if ($isAllInt) { - return 'integer'; - } - - if ($containsInt && !$containsString) { - return 'integer'; - } - return 'string'; - } -} diff --git a/code/ryzom/tools/sheets_packer/stdpch.h b/code/ryzom/tools/sheets_packer/stdpch.h index 0ff801f72..df8f1370f 100644 --- a/code/ryzom/tools/sheets_packer/stdpch.h +++ b/code/ryzom/tools/sheets_packer/stdpch.h @@ -32,8 +32,6 @@ #include #include -//#include - #ifdef NL_OS_WINDOWS #define NOMINMAX #include diff --git a/code/snowballs2/bin/pp_oculus_vr.cg b/code/snowballs2/bin/pp_oculus_vr.cg new file mode 100644 index 000000000..c7de282ef --- /dev/null +++ b/code/snowballs2/bin/pp_oculus_vr.cg @@ -0,0 +1,54 @@ +/************************************************************************************ + +Filename : pp_oculus_vr.cg +Content : Barrel fragment program ported from Oculus SDK Samples to Cg +Created : July 01, 2013 +Modified by : Jan Boon (Kaetemi) + +Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +************************************************************************************/ + + +void pp_oculus_vr( + // Per fragment parameters + float2 texCoord : TEXCOORD0, + + // Fragment program constants + uniform float2 cLensCenter, + uniform float2 cScreenCenter, + uniform float2 cScale, + uniform float2 cScaleIn, + uniform float4 cHmdWarpParam, + uniform sampler2D nlTex0 : TEX0, + + // Output color + out float4 oCol : COLOR) +{ + float2 theta = (texCoord - cLensCenter) * cScaleIn; // Scales to [-1, 1] + float rSq = theta.x * theta.x + theta.y * theta.y; + float2 theta1 = theta * (cHmdWarpParam.x + cHmdWarpParam.y * rSq + + cHmdWarpParam.z * rSq * rSq + cHmdWarpParam.w * rSq * rSq * rSq); + float2 tc = cLensCenter + cScale * theta1; + + if (!all(equal(clamp(tc, cScreenCenter-float2(0.25,0.5), cScreenCenter+float2(0.25,0.5)), tc))) + { + oCol = float4(0, 0, 0, 0); + } + else + { + oCol = tex2D(nlTex0, tc); + } +} diff --git a/code/snowballs2/bin/pp_stereo_debug.cg b/code/snowballs2/bin/pp_stereo_debug.cg new file mode 100644 index 000000000..3af27864d --- /dev/null +++ b/code/snowballs2/bin/pp_stereo_debug.cg @@ -0,0 +1,25 @@ + +void pp_stereo_debug( + // Per fragment parameters + float2 texCoord : TEXCOORD0, + + // Fragment program constants + uniform sampler2D cTex0 : TEX0, + uniform sampler2D cTex1 : TEX1, + + // Output color + out float4 oCol : COLOR) +{ + float4 t1 = tex2D(cTex0, texCoord); + float4 t2 = tex2D(cTex1, texCoord); + if (!any(t1 - t2)) + { + oCol = (t1 * 0.5) + (t2 * 0.5); + oCol.g = 0.5 + (oCol.g * 0.5); + } + else + { + oCol = (t1 * 0.5) + (t2 * 0.5); + oCol.r = 0.5 + (oCol.r * 0.5); + } +} diff --git a/code/snowballs2/bin/pp_test.cg b/code/snowballs2/bin/pp_test.cg new file mode 100644 index 000000000..f44c2d424 --- /dev/null +++ b/code/snowballs2/bin/pp_test.cg @@ -0,0 +1,13 @@ +void pp_test( + // Per fragment parameters + float2 texCoord : TEXCOORD0, + + // Fragment program constants + uniform sampler2D cTex0 : TEX0, + + // Output color + out float4 oCol : COLOR) +{ + oCol.rba = float3(1.0, 0.0, 1.0); + oCol.g = tex2D(cTex0, texCoord).g; +} \ No newline at end of file diff --git a/code/snowballs2/bin/snowballs_client_default.cfg b/code/snowballs2/bin/snowballs_client_default.cfg old mode 100644 new mode 100755 index 37b958820..49ec9e4d5 --- a/code/snowballs2/bin/snowballs_client_default.cfg +++ b/code/snowballs2/bin/snowballs_client_default.cfg @@ -47,17 +47,26 @@ FpsSmoothing = 64; OpenGL = 1; // Resolution of the screen -ScreenWidth = 800; -ScreenHeight = 600; +ScreenWidth = 1280; +ScreenHeight = 800; ScreenDepth = 32; // If 1, run in fullscreen mode, 0 for windowed -ScreenFull = 0; +ScreenFull = 1; // Start position of the player (the z is always 0) StartPoint = { 1840.0, -970.0, 0.0 }; +////////////////////////////////////////////////////////////////////////////// +// HMD Variables ///////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +HMDEnable = 1; +HMDDeviceId = 0; +HMDDevice = "Auto"; + + ////////////////////////////////////////////////////////////////////////////// // Sound Variables /////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -256,6 +265,15 @@ RetrieverBankName = "snowballs.rbank"; GlobalRetrieverName = "snowballs.gr"; +////////////////////////////////////////////////////////////////////////////// +// Bloom Variables /////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// + +SquareBloom = 1; +DensityBloom = 128; +EnableBloom = 1; + + ////////////////////////////////////////////////////////////////////////////// // Compass interface Variables /////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// diff --git a/code/snowballs2/client/src/animation.cpp b/code/snowballs2/client/src/animation.cpp index ab873ffbc..dd2296e25 100644 --- a/code/snowballs2/client/src/animation.cpp +++ b/code/snowballs2/client/src/animation.cpp @@ -97,7 +97,7 @@ Anim AnimIdArray[][2] = void computeAnimation (CEntity &entity, EAnim anim) { // Get the current time - double currentTime = double (CTime::getLocalTime ())/1000.0f; + double currentTime = AnimationTime; // nlinfo ("%d playing animation", anim); // nlinfo ("%d playing animation %s ct%f st%f et%f", anim, AnimIdArray[anim][0].Name, currentTime, AnimIdArray[anim][0].Animation->getBeginTime (), AnimIdArray[anim][0].Animation->getEndTime ()); @@ -153,7 +153,7 @@ void playAnimation (CEntity &entity, EAnim anim, bool force) // nlinfo ("playAnimation() %d", anim); // Get the current time - CAnimationTime currentTime = CAnimationTime(CTime::getLocalTime ())/1000.0f; + CAnimationTime currentTime = AnimationTime; // Can't do animation without skeleton if (entity.Skeleton.empty()) @@ -224,7 +224,7 @@ void initAnimation() void updateAnimation() { // Get the current time - CAnimationTime currentTime = CAnimationTime(CTime::getLocalTime ())/1000.0f; + CAnimationTime currentTime = AnimationTime; for (EIT eit = Entities.begin (); eit != Entities.end (); eit++) { @@ -270,7 +270,7 @@ void updateAnimation() } // compute new animation position depending of the current time - PlayListManager->animate (double(CTime::getLocalTime ())/1000.0f); + PlayListManager->animate (AnimationTime); } void releaseAnimation() diff --git a/code/snowballs2/client/src/camera.cpp b/code/snowballs2/client/src/camera.cpp index b202fba63..28ce273bb 100644 --- a/code/snowballs2/client/src/camera.cpp +++ b/code/snowballs2/client/src/camera.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,8 @@ #include #include +#include + #include "snowballs_client.h" #include "entities.h" #include "mouse_listener.h" @@ -61,22 +64,75 @@ UVisualCollisionEntity *CamCollisionEntity = NULL; static UInstance Snow = NULL; // The sky 3D objects -static UScene *SkyScene = NULL; -static UCamera SkyCamera = NULL; +UScene *SkyScene = NULL; +UCamera SkyCamera = NULL; static UInstance Sky = NULL; static UCloudScape *Clouds = NULL; +IStereoDisplay *StereoDisplay = NULL; +IStereoHMD *StereoHMD = NULL; + // // Functions // void initCamera() { + if (ConfigFile->getVar("HMDEnable").asBool()) + { + std::vector devices; + IStereoDisplay::listDevices(devices); + for (std::vector::iterator it(devices.begin()), end(devices.end()); it != end; ++it) + { + std::stringstream name; + name << std::string("[") << it->Serial << "] [" << IStereoDisplay::getLibraryName(it->Library) << " - " << it->Manufacturer << " - " << it->ProductName << "]"; + nlinfo("Stereo Display: %s", name.str().c_str()); + } + CStereoDeviceInfo *deviceInfo = NULL; + std::string hmdDeviceCfg = ConfigFile->getVar("HMDDevice").asString(); + if (hmdDeviceCfg == std::string("Auto") + && devices.begin() != devices.end()) + { + deviceInfo = &devices[0]; + } + else + { + std::string hmdDeviceId = ConfigFile->getVar("HMDDeviceId").asString(); + for (std::vector::iterator it(devices.begin()), end(devices.end()); it != end; ++it) + { + std::stringstream name; + name << IStereoDisplay::getLibraryName(it->Library) << " - " << it->Manufacturer << " - " << it->ProductName; + if (name.str() == hmdDeviceCfg) + deviceInfo = &(*it); + if (hmdDeviceId == it->Serial) + break; + } + } + if (deviceInfo) + { + nlinfo("Create VR stereo display device"); + StereoDisplay = IStereoDisplay::createDevice(*deviceInfo); + if (StereoDisplay) + { + if (deviceInfo->Class == CStereoDeviceInfo::StereoHMD) + { + nlinfo("Stereo display device is a HMD"); + StereoHMD = static_cast(StereoDisplay); + StereoHMD->setScale(3.0f); // snowballs is about 4 units per meter + } + StereoDisplay->setDriver(Driver); // move after driver creation, move stereodisplay before driver creation + } + } + } + IStereoDisplay::releaseUnusedLibraries(); + // Set up directly the camera Camera = Scene->getCam(); Camera.setTransformMode (UTransformable::DirectMatrix); - Camera.setPerspective ((float)Pi/2.f, 1.33f, 0.1f, 1000); + Camera.setPerspective((float)Pi/2.f, + ConfigFile->getVar("ScreenWidth").asFloat() / ConfigFile->getVar("ScreenHeight").asFloat(), + 0.1f, 1000.f); Camera.lookAt (CVector(ConfigFile->getVar("StartPoint").asFloat(0), ConfigFile->getVar("StartPoint").asFloat(1), ConfigFile->getVar("StartPoint").asFloat(2)), @@ -114,10 +170,30 @@ void releaseCamera() Driver->deleteScene(SkyScene); Scene->deleteInstance(Snow); VisualCollisionManager->deleteEntity(CamCollisionEntity); + + if (StereoHMD) + { + delete StereoHMD; + StereoHMD = NULL; + StereoDisplay = NULL; + } + delete StereoDisplay; + StereoDisplay = NULL; + IStereoDisplay::releaseAllLibraries(); } void updateCamera() { + if (StereoHMD) + { + NLMISC::CQuat hmdOrient = StereoHMD->getOrientation(); + NLMISC::CMatrix camMatrix = Camera.getMatrix(); + NLMISC::CMatrix hmdMatrix; + hmdMatrix.setRot(hmdOrient); + NLMISC::CMatrix posMatrix; // minimal head modeling, will be changed in the future + posMatrix.translate(StereoHMD->getEyePosition()); + Camera.setMatrix((camMatrix * hmdMatrix) * posMatrix); + } // Set the new position of the snow emitter CMatrix mat = CMatrix::Identity; mat.setPos (Camera.getMatrix().getPos()/*+CVector (0.0f, 0.0f, -10.0f)*/); @@ -143,7 +219,8 @@ void releaseSky() // -- -- random note: update and render makes more sense than animate and update void animateSky(double dt) { - Clouds->anim(dt); + if (!StereoHMD) Clouds->anim(dt); + SkyScene->animate(AnimationTime); } // this is actually render @@ -156,12 +233,12 @@ void updateSky() skyCameraMatrix.setPos(CVector::Null); SkyCamera.setMatrix(skyCameraMatrix); - SkyScene->animate(AnimationTime); SkyScene->render(); // Must clear ZBuffer For incoming rendering. Driver->clearZBuffer(); - Clouds->render(); + if (!StereoHMD) // Cloudscape not supported (fix Viewport please) + Clouds->render(); } } /* namespace SBCLIENT */ diff --git a/code/snowballs2/client/src/camera.h b/code/snowballs2/client/src/camera.h index c7718c653..c2d61d866 100644 --- a/code/snowballs2/client/src/camera.h +++ b/code/snowballs2/client/src/camera.h @@ -30,6 +30,7 @@ namespace NL3D { class UVisualCollisionEntity; + class CStereoOVR; }; namespace SBCLIENT { @@ -39,7 +40,9 @@ namespace SBCLIENT { // extern NL3D::UCamera Camera; +extern NL3D::UCamera SkyCamera; extern NL3D::UVisualCollisionEntity *CamCollisionEntity; +extern NL3D::UScene *SkyScene; // // External functions diff --git a/code/snowballs2/client/src/commands.cpp b/code/snowballs2/client/src/commands.cpp index 70dd3b247..41faeab1e 100644 --- a/code/snowballs2/client/src/commands.cpp +++ b/code/snowballs2/client/src/commands.cpp @@ -35,11 +35,20 @@ #include #include #include +#include #include "network.h" #include "snowballs_client.h" #include "interface.h" +#if SBCLIENT_DEV_PIXEL_PROGRAM +#include +#include +#include +#include +#include +#endif + // // Namespaces // @@ -237,6 +246,13 @@ void cbUpdateCommands (CConfigFile::CVar &var) else nlwarning ("Unknown variable update %s", var.Name.c_str()); } +#if SBCLIENT_DEV_PIXEL_PROGRAM +namespace { +CPixelProgram *a_DevPixelProgram = NULL; +UTextureFile *a_NelLogo; +} +#endif + void initCommands() { // Add the keyboard listener in the event server @@ -278,6 +294,79 @@ void initCommands() CommandsMaterial.initUnlit(); CommandsMaterial.setBlendFunc(UMaterial::srcalpha, UMaterial::invsrcalpha); CommandsMaterial.setBlend(true); + +#if SBCLIENT_DEV_PIXEL_PROGRAM + CommandsMaterial.getObjectPtr()->setShader(NL3D::CMaterial::PostProcessing); + a_NelLogo = Driver->createTextureFile("nel128.tga"); + CommandsMaterial.setTexture(dynamic_cast(a_NelLogo)); + static const char *program_arbfp1 = + "!!ARBfp1.0\n" + "PARAM c[1] = { { 1, 0 } };\n" + "MOV result.color.xzw, c[0].xyyx;\n" + "TEX result.color.y, fragment.texcoord[0], texture[0], 2D;\n" + "END\n"; + static const char *program_fp40 = + "!!ARBfp1.0\n" + "OPTION NV_fragment_program2;\n" + "PARAM c[1] = { { 1, 0 } };\n" + "TEMP RC;\n" + "TEMP HC;\n" + "OUTPUT oCol = result.color;\n" + "MOVR oCol.xzw, c[0].xyyx;\n" + "TEX oCol.y, fragment.texcoord[0], texture[0], 2D;\n" + "END\n"; + static const char *program_ps_1_1 = + "ps.1.1\n" + "def c0, 0.000000, 0.000000, 1.000000, 0.000000\n" + "def c1, 1.000000, 0.000000, 0.000000, 0.000000\n" + "def c2, 0.000000, 1.000000, 0.000000, 0.000000\n" + "tex t0\n" + "mad r0.rgb, c2, t0, c1\n" + "mov r0.a, c0.b\n"; + static const char *program_ps_2_0 = + "ps_2_0\n" + "dcl_2d s0\n" + "def c0, 1.00000000, 0.00000000, 0, 0\n" + "dcl t0.xy\n" + "texld r0, t0, s0\n" + "mov r0.z, c0.y\n" + "mov r0.xw, c0.x\n" + "mov oC0, r0\n"; + static const char *program_ps_3_0 = + "ps_3_0\n" + "dcl_2d s0\n" + "def c0, 1.00000000, 0.00000000, 0, 0\n" + "dcl_texcoord0 v0.xy\n" + "mov oC0.xzw, c0.xyyx\n" + "texld oC0.y, v0, s0\n"; + NL3D::IDriver *d = dynamic_cast(Driver)->getDriver(); + if (d->supportPixelProgram(CPixelProgram::fp40)) + { + nldebug("fp40"); + a_DevPixelProgram = new CPixelProgram(program_fp40); + } + else if (d->supportPixelProgram(CPixelProgram::arbfp1)) + { + nldebug("arbfp1"); + a_DevPixelProgram = new CPixelProgram(program_arbfp1); + } + /*else if (d->supportPixelProgram(CPixelProgram::ps_3_0)) + { + nldebug("ps_3_0"); + a_DevPixelProgram = new CPixelProgram(program_ps_3_0); + // Textures do not seem to work with ps_3_0... + }*/ + else if (d->supportPixelProgram(CPixelProgram::ps_2_0)) + { + nldebug("ps_2_0"); + a_DevPixelProgram = new CPixelProgram(program_ps_2_0); + } + else if (d->supportPixelProgram(CPixelProgram::ps_1_1)) + { + nldebug("ps_1_1"); + a_DevPixelProgram = new CPixelProgram(program_ps_1_1); + } +#endif } void updateCommands() @@ -286,6 +375,9 @@ void updateCommands() uint32 _width, _height; Driver->getWindowSize(_width, _height); float width = (float)_width, height = (float)_height; + NL3D::CViewport vp = Driver->getViewport(); + width *= vp.getWidth(); + height *= vp.getHeight(); float CommandsLineHeight = CommandsFontSize / height; float CommandsBoxX = ((float)(sint32)(SBCLIENT::CommandsBoxX * width)) / width; float CommandsBoxWidth = ((float)(sint32)(SBCLIENT::CommandsBoxWidth * width)) / width; @@ -293,16 +385,57 @@ void updateCommands() float CommandsBoxHeight = ((float)(sint32)((CommandsNbLines + 1) * CommandsLineHeight * width)) / width; float CommandsBoxBorderX = ((float)(sint32)(SBCLIENT::CommandsBoxBorder * width)) / width; float CommandsBoxBorderY = ((float)(sint32)(SBCLIENT::CommandsBoxBorder * height)) / height; + if (StereoHMD) + { + float xshift, yshift; + StereoHMD->getInterface2DShift(0, xshift, yshift, 4.f); + // snap to pixels + xshift = ((float)(sint32)(xshift * width)) / width; + yshift = ((float)(sint32)(yshift * height)) / height; + // adjust + CommandsBoxX += xshift; + CommandsBoxY += yshift; + } // Display the background Driver->setMatrixMode2D11 (); +#if SBCLIENT_DEV_PIXEL_PROGRAM + CommandsMaterial.setColor(CRGBA::Blue); // Test to check which shader is displaying. +#else CommandsMaterial.setColor(CommandsBackColor); +#endif float x0 = CommandsBoxX - CommandsBoxBorderX; float y0 = CommandsBoxY - CommandsBoxBorderY; float x1 = CommandsBoxX + CommandsBoxWidth + CommandsBoxBorderX; float y1 = CommandsBoxY + CommandsBoxHeight + CommandsBoxBorderY; + +#if SBCLIENT_DEV_PIXEL_PROGRAM + NL3D::IDriver *d = dynamic_cast(Driver)->getDriver(); + d->activePixelProgram(a_DevPixelProgram); + bool fogEnabled = d->fogEnabled(); + d->enableFog(false); + + // Driver->drawQuad(CQuad(CVector(x0, y0, 0), CVector(x1, y0, 0), CVector(x1, y1, 0), CVector(x0, y1, 0)), CommandsMaterial); + CQuadUV quadUV; + quadUV.V0 = CVector(x0, y0, 0); + quadUV.V1 = CVector(x1, y0, 0); + quadUV.V2 = CVector(x1, y1, 0); + quadUV.V3 = CVector(x0, y1, 0); + quadUV.Uv0 = CUV(0, 1); + quadUV.Uv1 = CUV(1, 1); + quadUV.Uv2 = CUV(1, 0); + quadUV.Uv3 = CUV(0, 0); + Driver->drawQuad(quadUV, CommandsMaterial); + //Driver->drawBitmap(x0, y0, x1 - x0, y1 - y0, *a_NelLogo); + + d->enableFog(fogEnabled); + d->activePixelProgram(NULL); +#else + Driver->drawQuad(CQuad(CVector(x0, y0, 0), CVector(x1, y0, 0), CVector(x1, y1, 0), CVector(x0, y1, 0)), CommandsMaterial); +#endif + // Set the text context TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setColor (CommandsFrontColor); @@ -334,6 +467,10 @@ void clearCommands () void releaseCommands() { +#if SBCLIENT_DEV_PIXEL_PROGRAM + delete a_DevPixelProgram; + a_DevPixelProgram = NULL; +#endif // Remove the displayers CommandsLog.removeDisplayer(&CommandsDisplayer); #ifndef NL_RELEASE diff --git a/code/snowballs2/client/src/compass.cpp b/code/snowballs2/client/src/compass.cpp index 11d7ddefa..27e0e27f1 100644 --- a/code/snowballs2/client/src/compass.cpp +++ b/code/snowballs2/client/src/compass.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "mouse_listener.h" #include "camera.h" @@ -94,6 +95,13 @@ void updateCompass () { float x = CompassPosX; float y = CompassPosY; + if (StereoHMD) + { + float xshift, yshift; + StereoHMD->getInterface2DShift(0, xshift, yshift, 4.f); + x += xshift; + y += yshift; + } float radius = CompassRadius; // tri @@ -109,7 +117,8 @@ void updateCompass () quad.V2.set ( radius, radius, 0); quad.V3.set (-radius, radius, 0); - Driver->setMatrixMode2D43 (); + if (StereoHMD) Driver->setMatrixMode2D11(); + else Driver->setMatrixMode2D43(); CMatrix mtx; @@ -152,7 +161,7 @@ void updateCompass () Driver->setModelMatrix (mtx); Driver->drawQuad (quad, CompassMaterial); - x *= 3.0/4.0f; + if (!StereoHMD) x *= 3.0/4.0f; // Print position TextContext->setHotSpot(UTextContext::MiddleTop); diff --git a/code/snowballs2/client/src/entities.cpp b/code/snowballs2/client/src/entities.cpp index af879958c..2972aebf1 100644 --- a/code/snowballs2/client/src/entities.cpp +++ b/code/snowballs2/client/src/entities.cpp @@ -105,7 +105,7 @@ bool _TestCLS = false; void CEntity::setState (TState state) { State = state; - StateStartTime = CTime::getLocalTime (); + StateStartTime = LocalTime; } @@ -376,7 +376,7 @@ void deleteAllEntities() void stateAppear (CEntity &entity) { // after 1 second, show the instance - if (CTime::getLocalTime () > entity.StateStartTime + 1000) + if (LocalTime > entity.StateStartTime + 1.0) { if (entity.Instance.getVisibility () != UTransform::Show) entity.Instance.show (); @@ -384,7 +384,7 @@ void stateAppear (CEntity &entity) // after 5 seconds, delete the particle system (if any) // and pass the entity into the Normal state - if (CTime::getLocalTime () > entity.StateStartTime + 3000) + if (LocalTime > entity.StateStartTime + 3.0) { if (!entity.Particule.empty()) { @@ -403,7 +403,7 @@ void stateAppear (CEntity &entity) void stateDisappear (CEntity &entity) { // after 1 second, remove the mesh and all collision stuff - if (CTime::getLocalTime () > entity.StateStartTime + 1000) + if (LocalTime > entity.StateStartTime + 1.0) { if (entity.Instance.getVisibility () != UTransform::Hide) { @@ -419,7 +419,7 @@ void stateDisappear (CEntity &entity) } // after 5 seconds, remove the particle system and the entity entry - if (CTime::getLocalTime () > entity.StateStartTime + 3000) + if (LocalTime > entity.StateStartTime + 3.0) { deleteEntity (entity); } diff --git a/code/snowballs2/client/src/entities.h b/code/snowballs2/client/src/entities.h index 0ad7819ee..e85ffc569 100644 --- a/code/snowballs2/client/src/entities.h +++ b/code/snowballs2/client/src/entities.h @@ -108,7 +108,7 @@ public: // The state of this entity TState State; // The date of the beginning of this state - NLMISC::TTime StateStartTime; + NLMISC::TLocalTime StateStartTime; // The type enum of the entity enum TType { Self, Other, Snowball }; diff --git a/code/snowballs2/client/src/game_time.cpp b/code/snowballs2/client/src/game_time.cpp index 62bfc2b2b..c6b1ff62c 100644 --- a/code/snowballs2/client/src/game_time.cpp +++ b/code/snowballs2/client/src/game_time.cpp @@ -42,6 +42,14 @@ static bool _SkipAnimationOnce; static NLMISC::TTime _TimeMs; static CValueSmootherTemplate _FpsSmoother; +namespace +{ + +NLMISC::TLocalTime a_LocalTimeDelta; +NL3D::TGlobalAnimationTime a_AnimationTimeDelta; + +} /* anonymous namespace */ + static void cbFpsSmoothing(CConfigFile::CVar &var) { _FpsSmoother.init((uint)var.asInt()); @@ -53,8 +61,10 @@ void CGameTime::init() _TimeMs = NLMISC::CTime::getLocalTime(); LocalTime = ((TLocalTime)_TimeMs) / 1000.0; LocalTimeDelta = 0.0; + a_LocalTimeDelta = 0.0; AnimationTime = 0.0; AnimationTimeDelta = 0.f; + a_AnimationTimeDelta = 0.0; FramesPerSecond = 0.f; FramesPerSecondSmooth = 0.f; CConfiguration::setAndCallback("FpsSmoothing", cbFpsSmoothing); @@ -78,26 +88,24 @@ void CGameTime::updateTime() // average of previous fps and this fps should be ok FramesPerSecond *= 3; - LocalTimeDelta = 0.f; - AnimationTimeDelta = 0.f; + a_LocalTimeDelta = 0.f; + a_AnimationTimeDelta = 0.f; } else { FramesPerSecond = 1000.0f / (float)deltams; TLocalTime localTime = ((TLocalTime)timems) / 1000.0; - LocalTimeDelta = localTime - LocalTime; - LocalTime = localTime; + a_LocalTimeDelta = localTime - LocalTime; if (_SkipAnimationOnce) { - AnimationTimeDelta = 0.f; + a_AnimationTimeDelta = 0.f; _SkipAnimationOnce = false; } else { - AnimationTimeDelta = (TAnimationTime)LocalTimeDelta; - AnimationTime += (TGlobalAnimationTime)LocalTimeDelta; + a_AnimationTimeDelta = (TGlobalAnimationTime)a_LocalTimeDelta; } } @@ -105,6 +113,15 @@ void CGameTime::updateTime() FramesPerSecondSmooth = _FpsSmoother.getSmoothValue(); } +void CGameTime::advanceTime(double f) +{ + LocalTimeDelta = a_LocalTimeDelta * f; + LocalTime += LocalTimeDelta; + TGlobalAnimationTime atd = a_AnimationTimeDelta * f; + AnimationTimeDelta = (NL3D::TAnimationTime)atd; + AnimationTime += atd; +} + void CGameTime::skipAnimationOnce() { _SkipAnimationOnce = true; diff --git a/code/snowballs2/client/src/game_time.h b/code/snowballs2/client/src/game_time.h index 72a671d43..7cf4ec827 100644 --- a/code/snowballs2/client/src/game_time.h +++ b/code/snowballs2/client/src/game_time.h @@ -40,6 +40,9 @@ public: static void updateTime(); + /// Advance time to target time by factor f. + static void advanceTime(double f); + /// Used when loading, this will skip changing animation time on the next update /// (updates aren't called during loading) static void skipAnimationOnce(); diff --git a/code/snowballs2/client/src/graph.cpp b/code/snowballs2/client/src/graph.cpp index 73ac726f5..8fd3dd85c 100644 --- a/code/snowballs2/client/src/graph.cpp +++ b/code/snowballs2/client/src/graph.cpp @@ -115,7 +115,7 @@ void CGraph::addValue (float value) // CGraph FpsGraph ("fps", 10.0f, 10.0f, 100.0f, 100.0f, CRGBA(128,0,0,128), 1000, 40.0f); -CGraph SpfGraph ("spf", 10.0f, 110.0f, 100.0f, 100.0f, CRGBA(0,128,0,128), 0, 200.0f); +CGraph SpfGraph ("spf", 10.0f, 110.0f, 100.0f, 100.0f, CRGBA(0,128,0,128), 0, 0.1f); CGraph DownloadGraph ("download", 10.0f, 260.0f, 100.0f, 100.0f, CRGBA(0,0,128,128), 1000, 1000.0f); CGraph UploadGraph ("upload", 10.0f, 360.0f, 100.0f, 100.0f, CRGBA(0,128,128,128), 1000, 1000.0f); diff --git a/code/snowballs2/client/src/mouse_listener.cpp b/code/snowballs2/client/src/mouse_listener.cpp index c459f6bd2..67508e281 100644 --- a/code/snowballs2/client/src/mouse_listener.cpp +++ b/code/snowballs2/client/src/mouse_listener.cpp @@ -427,6 +427,11 @@ void C3dMouseListener::updateCamera() cpos = snapped+CVector(0.0f, 0.0f, GroundCamLimit); _ViewHeight = cpos.z - getPosition().z; } + if (StereoHMD) + { + // look at straight forward + tpos.z = cpos.z; + } _Camera.lookAt(cpos, tpos); } diff --git a/code/snowballs2/client/src/snowballs_client.cpp b/code/snowballs2/client/src/snowballs_client.cpp index c5cb73072..b401d80bc 100644 --- a/code/snowballs2/client/src/snowballs_client.cpp +++ b/code/snowballs2/client/src/snowballs_client.cpp @@ -51,6 +51,7 @@ #if SBCLIENT_DEV_STEREO # include #endif /* #if SBCLIENT_DEV_STEREO */ +#include // Project includes #include "pacs.h" @@ -151,6 +152,8 @@ LoadedOnline = false, LoadedOffline = false; // state static IStereoRender *_StereoRender = NULL; #endif /* #if SBCLIENT_DEV_STEREO */ +static bool s_EnableBloom = false; + // // Prototypes // @@ -179,6 +182,9 @@ void releaseIngame(); void releaseOnline(); void releaseOffline(); void cbGraphicsDriver(CConfigFile::CVar &var); +void cbSquareBloom(CConfigFile::CVar &var); +void cbDensityBloom(CConfigFile::CVar &var); +void cbEnableBloom(CConfigFile::CVar &var); // // Functions @@ -306,11 +312,16 @@ void initCore() Driver->setDisplay(UDriver::CMode(ConfigFile->getVar("ScreenWidth").asInt(), ConfigFile->getVar("ScreenHeight").asInt(), ConfigFile->getVar("ScreenDepth").asInt(), - ConfigFile->getVar("ScreenFull").asInt()==0)); + (ConfigFile->getVar("OpenGL").asInt() == 1 ? true : ConfigFile->getVar("ScreenFull").asInt()==0))); // Set the cache size for the font manager(in bytes) Driver->setFontManagerMaxMemory(2097152); // Create a Text context for later text rendering displayLoadingState("Initialize Text"); + if (ConfigFile->getVar("OpenGL").asInt() == 1) + Driver->setMode(UDriver::CMode(ConfigFile->getVar("ScreenWidth").asInt(), + ConfigFile->getVar("ScreenHeight").asInt(), + ConfigFile->getVar("ScreenDepth").asInt(), + ConfigFile->getVar("ScreenFull").asInt()==0)); TextContext = Driver->createTextContext(CPath::lookup(ConfigFile->getVar("FontName").asString())); TextContext->setShaded(true); TextContext->setKeep800x600Ratio(false); @@ -354,6 +365,7 @@ void initIngame() //#ifdef NL_OS_WINDOWS // playMusic(SBCLIENT_MUSIC_WAIT); //#endif + displayLoadingState("Initialize"); // Create a scene Scene = Driver->createScene(false); @@ -362,7 +374,9 @@ void initIngame() CBloomEffect::instance().setDriver(Driver); CBloomEffect::instance().setScene(Scene); CBloomEffect::instance().init(ConfigFile->getVar("OpenGL").asInt() == 1); - + CConfiguration::setAndCallback("SquareBloom", cbSquareBloom); + CConfiguration::setAndCallback("DensityBloom", cbDensityBloom); + CConfiguration::setAndCallback("EnableBloom", cbEnableBloom); // Init the landscape using the previously created UScene displayLoadingState("Initialize Landscape"); initLandscape(); @@ -562,6 +576,8 @@ void releaseIngame() MouseListener = NULL; // release bloom effect + CConfiguration::dropCallback("SquareBloom"); + CConfiguration::dropCallback("DensityBloom"); CBloomEffect::instance().releaseInstance(); Driver->deleteScene(Scene); @@ -673,15 +689,16 @@ void loopIngame() // 02. Update Time (deltas) CGameTime::updateTime(); + CGameTime::advanceTime(1.0); - // 03. Update Input (keyboard controls, etc) + // 03. Update Incoming (network, receive messages) + updateNetwork(); + + // 04. Update Input (keyboard controls, etc) Driver->EventServer.pump(); // Pump user input messages MouseListener->update(); MouseListener->updateCamera(); - // 04. Update Incoming (network, receive messages) - updateNetwork(); - // 05. Update Weather (sky, snow, wind, fog, sun) animateSky(LocalTimeDelta); @@ -689,7 +706,7 @@ void loopIngame() updateLandscape(); // Update the landscape // ... Update Animations (TEST) - // ... + updateAnimation(); // 07. Update Entities (collisions and actions) // - Move Other Entities (move//, animations, etc) @@ -702,6 +719,7 @@ void loopIngame() // 09. Update Camera (depends on entities) updateCamera(); + if (StereoHMD) StereoHMD->updateCamera(0, &Camera); // 10. Update Interface (login, ui, etc) // ... @@ -721,52 +739,98 @@ void loopIngame() if (Driver->isLost()) nlSleep(10); else { - // call all 3d render thingies - Driver->clearBuffers(CRGBA(127, 0, 0)); // if you see red, there's a problem with bloom or stereo render -#if SBCLIENT_DEV_STEREO - _StereoRender->calculateCameras(Camera.getObjectPtr()); // calculate modified matrices for the current camera - for (uint cameraId = 0; cameraId < _StereoRender->getCameraCount(); ++cameraId) + uint i = 0; + uint bloomStage = 0; + while ((!StereoDisplay && i == 0) || (StereoDisplay && StereoDisplay->nextPass())) { - _StereoRender->getCamera(cameraId, Camera.getObjectPtr()); // get the matrix details for this camera -#endif /* #if SBCLIENT_DEV_STEREO */ + ++i; + if (StereoDisplay) + { + const CViewport &vp = StereoDisplay->getCurrentViewport(); + Driver->setViewport(vp); + Scene->setViewport(vp); + SkyScene->setViewport(vp); + StereoDisplay->getCurrentFrustum(0, &Camera); + StereoDisplay->getCurrentFrustum(0, &SkyCamera); + StereoDisplay->getCurrentMatrix(0, &Camera); + } - // 01. Render Driver (background color) - CBloomEffect::instance().initBloom(); // start bloom effect (just before the first scene element render) - Driver->clearBuffers(CRGBA(0, 0, 127)); // clear all buffers, if you see this blue there's a problem with scene rendering + if (StereoDisplay) + { + StereoDisplay->beginRenderTarget(); + } + + if (!StereoDisplay || StereoDisplay->wantClear()) + { - // 02. Render Sky (sky scene) - updateSky(); // Render the sky scene before the main scene + if (s_EnableBloom) + { + nlassert(bloomStage == 0); + CBloomEffect::instance().initBloom(); // start bloom effect (just before the first scene element render) + bloomStage = 1; + } - // 04. Render Scene (entity scene) - Scene->render(); // Render + // 01. Render Driver (background color) + Driver->clearBuffers(CRGBA(0, 0, 127)); // clear all buffers, if you see this blue there's a problem with scene rendering + } - // 05. Render Effects (flare) - updateLensFlare(); // Render the lens flare - CBloomEffect::instance().endBloom(); // end the actual bloom effect visible in the scene + if (!StereoDisplay || StereoDisplay->wantScene()) + { + // 02. Render Sky (sky scene) + updateSky(); // Render the sky scene before the main scene - // 06. Render Interface 3D (player names) - CBloomEffect::instance().endInterfacesDisplayBloom(); // end bloom effect system after drawing the 3d interface (z buffer related) + // 04. Render Scene (entity scene) + Scene->render(); // Render -#if SBCLIENT_DEV_STEREO - _StereoRender->copyBufferToTexture(cameraId); // copy current buffer to the active stereorender texture + // 05. Render Effects (flare) + if (!StereoHMD) updateLensFlare(); // Render the lens flare (left eye stretched with stereo...) + } + + if (!StereoDisplay || StereoDisplay->wantInterface3D()) + { + if (s_EnableBloom && bloomStage == 1) + { + // End the actual bloom effect visible in the scene. + if (StereoDisplay) Driver->setViewport(NL3D::CViewport()); + CBloomEffect::instance().endBloom(); + if (StereoDisplay) Driver->setViewport(StereoDisplay->getCurrentViewport()); + bloomStage = 2; + } + + // 06. Render Interface 3D (player names) + // ... + } + + if (!StereoDisplay || StereoDisplay->wantInterface2D()) + { + if (s_EnableBloom && bloomStage == 2) + { + // End bloom effect system after drawing the 3d interface (z buffer related). + if (StereoDisplay) Driver->setViewport(NL3D::CViewport()); + CBloomEffect::instance().endInterfacesDisplayBloom(); + if (StereoDisplay) Driver->setViewport(StereoDisplay->getCurrentViewport()); + bloomStage = 0; + } + + // 07. Render Interface 2D (chatboxes etc, optionally does have 3d) + updateCompass(); // Update the compass + updateRadar(); // Update the radar + updateGraph(); // Update the radar + if (ShowCommands) updateCommands(); // Update the commands panel + renderEntitiesNames(); // Render the name on top of the other players + updateInterface(); // Update interface + renderInformation(); + if (!StereoDisplay) update3dLogo(); // broken with stereo + + // 08. Render Debug (stuff for dev) + // ... + } + + if (StereoDisplay) + { + StereoDisplay->endRenderTarget(); + } } - _StereoRender->restoreCamera(Camera.getObjectPtr()); // restore the camera - _StereoRender->render(); // render everything together in the current mode -#endif /* #if SBCLIENT_DEV_STEREO */ - - // 07. Render Interface 2D (chatboxes etc, optionally does have 3d) - updateCompass(); // Update the compass - updateRadar(); // Update the radar - updateGraph(); // Update the radar - if (ShowCommands) updateCommands(); // Update the commands panel - updateAnimation(); - renderEntitiesNames(); // Render the name on top of the other players - updateInterface(); // Update interface - renderInformation(); - update3dLogo(); - - // 08. Render Debug (stuff for dev) - // ... // 09. Render Buffer Driver->swapBuffers(); @@ -868,6 +932,8 @@ void renderInformation() TextContext->setColor(CRGBA(255, 255, 255, 255)); TextContext->setFontSize(14); TextContext->printfAt(0.01f, 0.99f, "%.2f(%.2f)fps %.3fs", FramesPerSecondSmooth, FramesPerSecond, (float)LocalTimeDelta); + CVector camPos = Camera.getMatrix().getPos(); + TextContext->printfAt(0.01f, 0.89f, "CAM POS: %.3f %.3f %.3f", camPos.x, camPos.y, camPos.z); // one more frame FpsGraph.addValue(1.0f); @@ -884,6 +950,21 @@ void cbGraphicsDriver(CConfigFile::CVar &var) NextGameState = GameStateReset; } +void cbSquareBloom(CConfigFile::CVar &var) +{ + CBloomEffect::instance().setSquareBloom(var.asBool()); +} + +void cbDensityBloom(CConfigFile::CVar &var) +{ + CBloomEffect::instance().setDensityBloom((uint8)(var.asInt() & 0xFF)); +} + +void cbEnableBloom(CConfigFile::CVar &var) +{ + s_EnableBloom = var.asBool(); +} + // // Loading state procedure // @@ -1124,21 +1205,29 @@ sint main(int argc, char **argv) FILE *f = _tfopen(_T(SBCLIENT_CONFIG_FILE_DEFAULT), _T("r")); if (!f) { - OutputDebugString(" ******************************** \n"); - OutputDebugString(" * CHANGING WORKING DIRECTORY * \n"); - OutputDebugString(" ******************************** \n\n"); - char cwd[256]; - _tgetcwd(cwd, 256); - tstring workdir(cwd); - workdir += "\\..\\bin\\"; - _tchdir(workdir.c_str()); - f = _tfopen(_T(SBCLIENT_CONFIG_FILE_DEFAULT), _T("r")); + f = _tfopen(_T(SBCLIENT_CONFIG_FILE), _T("r")); if (!f) { OutputDebugString(" ******************************** \n"); - OutputDebugString(" * DEFAULT CONFIG MISSING * \n"); + OutputDebugString(" * CHANGING WORKING DIRECTORY * \n"); OutputDebugString(" ******************************** \n\n"); - return EXIT_FAILURE; + char cwd[256]; + _tgetcwd(cwd, 256); + tstring workdir(cwd); + workdir = "R:\\build\\devw_x86\\bin\\Debug\\"; + _tchdir(workdir.c_str()); + f = _tfopen(_T(SBCLIENT_CONFIG_FILE_DEFAULT), _T("r")); + if (!f) + { + f = _tfopen(_T(SBCLIENT_CONFIG_FILE), _T("r")); + if (!f) + { + OutputDebugString(" ******************************** \n"); + OutputDebugString(" * DEFAULT CONFIG MISSING * \n"); + OutputDebugString(" ******************************** \n\n"); + return EXIT_FAILURE; + } + } } } fclose(f); diff --git a/code/snowballs2/client/src/snowballs_client.h b/code/snowballs2/client/src/snowballs_client.h index 67116f7e6..d21f925f7 100644 --- a/code/snowballs2/client/src/snowballs_client.h +++ b/code/snowballs2/client/src/snowballs_client.h @@ -42,6 +42,8 @@ namespace NL3D { class UScene; class UTextContext; class ULandscape; + class IStereoDisplay; + class IStereoHMD; } namespace SBCLIENT { @@ -58,6 +60,8 @@ public: }; extern NL3D::UDriver *Driver; +extern NL3D::IStereoDisplay *StereoDisplay; +extern NL3D::IStereoHMD *StereoHMD; extern NL3D::UScene *Scene; extern NL3D::UTextContext *TextContext; extern NLMISC::CConfigFile *ConfigFile; diff --git a/code/snowballs2/client/src/snowballs_config.h b/code/snowballs2/client/src/snowballs_config.h index edd282718..2e6b848fb 100644 --- a/code/snowballs2/client/src/snowballs_config.h +++ b/code/snowballs2/client/src/snowballs_config.h @@ -37,7 +37,11 @@ #define SBCLIENT_ERASE_LOG true // version number -#define SBCLIENT_VERSION "2.1.551" +// 2.1 +// - Bloom +// 2.2 +// - OculusVR support +#define SBCLIENT_VERSION "2.2" @@ -45,6 +49,7 @@ #define SBCLIENT_DEV_SOUND 0 #define SBCLIENT_DEV_STEREO 0 #define SBCLIENT_DEV_MEMLEAK 0 +#define SBCLIENT_DEV_PIXEL_PROGRAM 0 @@ -70,7 +75,7 @@ # ifndef SNOWBALLS_CONFIG # define SBCLIENT_CONFIG_FILE "snowballs_client.cfg" # else -# define SBCLIENT_CONFIG_FILE SNOWBALLS_CONFIG "client.cfg" +# define SBCLIENT_CONFIG_FILE SNOWBALLS_CONFIG "snowballs_client.cfg" # endif #endif