diff --git a/code/CMakeModules/FindCppTest.cmake b/code/CMakeModules/FindCppTest.cmake index 59bd292c7..f5f823f69 100644 --- a/code/CMakeModules/FindCppTest.cmake +++ b/code/CMakeModules/FindCppTest.cmake @@ -21,7 +21,7 @@ FIND_PATH(CPPTEST_INCLUDE_DIR /opt/local/include /opt/csw/include /opt/include - PATH_SUFFIXES cppunit + PATH_SUFFIXES cppunit cpptest ) SET(LIBRARY_NAME_RELEASE cpptest) diff --git a/code/CMakeModules/FindMySQL.cmake b/code/CMakeModules/FindMySQL.cmake index b9970f63c..1da6157fa 100644 --- a/code/CMakeModules/FindMySQL.cmake +++ b/code/CMakeModules/FindMySQL.cmake @@ -16,6 +16,7 @@ IF(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) FIND_PATH(MYSQL_INCLUDE_DIR mysql.h + PATH_SUFFIXES mysql /usr/include/mysql /usr/local/include/mysql /opt/local/include/mysql5/mysql @@ -54,10 +55,14 @@ ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES) IF(MYSQL_INCLUDE_DIR) IF(MYSQL_LIBRARY_RELEASE) - SET(MYSQL_LIBRARIES "optimized;${MYSQL_LIBRARY_RELEASE}") + SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE}) IF(MYSQL_LIBRARY_DEBUG) - SET(MYSQL_LIBRARIES "${MYSQL_LIBRARIES};debug;${MYSQL_LIBRARY_DEBUG}") + SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_DEBUG}) ENDIF(MYSQL_LIBRARY_DEBUG) + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} ${OPENSSL_LIBRARIES}) + ENDIF(OPENSSL_FOUND) ENDIF(MYSQL_LIBRARY_RELEASE) ENDIF(MYSQL_INCLUDE_DIR) diff --git a/code/CMakeModules/FindOpenGLES.cmake b/code/CMakeModules/FindOpenGLES.cmake new file mode 100644 index 000000000..35157b95b --- /dev/null +++ b/code/CMakeModules/FindOpenGLES.cmake @@ -0,0 +1,49 @@ +# - Try to find OpenGL ES +# Once done this will define +# +# OPENGLES_FOUND - system has OpenGL ES +# OPENGLES_EGL_FOUND - system has EGL +# OPENGLES_LIBRARIES - Link these to use OpenGL ES and EGL +# +# If you want to use just GL ES you can use these values +# OPENGLES_GLES_LIBRARY - Path to OpenGL ES Library +# OPENGLES_EGL_LIBRARY - Path to EGL Library + +FIND_LIBRARY(OPENGLES_GLES_LIBRARY + NAMES GLESv1_CM libGLESv1_CM gles_cm libgles_cm + PATHS + /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 +) + +FIND_LIBRARY(OPENGLES_EGL_LIBRARY + NAMES EGL libEGL + PATHS + /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(OPENGLES_GLES_LIBRARY) + SET(OPENGLES_FOUND "YES") + SET(OPENGLES_LIBRARIES ${OPENGLES_GLES_LIBRARY} ${OPENGLES_LIBRARIES}) + IF(OPENGLES_EGL_LIBRARY) + SET(OPENGLES_EGL_FOUND "YES") + SET(OPENGLES_LIBRARIES ${OPENGLES_EGL_LIBRARY} ${OPENGLES_LIBRARIES}) + ELSE(OPENGLES_EGL_LIBRARY) + SET(OPENGLES_EGL_FOUND "NO") + ENDIF(OPENGLES_EGL_LIBRARY) +ENDIF(OPENGLES_GLES_LIBRARY) diff --git a/code/CMakeModules/GetRevision.cmake b/code/CMakeModules/GetRevision.cmake index ee3fa2e90..52f443d5f 100644 --- a/code/CMakeModules/GetRevision.cmake +++ b/code/CMakeModules/GetRevision.cmake @@ -25,7 +25,8 @@ MACRO(NOW RESULT) STRING(REGEX REPLACE ".*\n([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9]).*" "\\1-\\2-\\3 \\4:\\5:\\6" ${RESULT} "${DATETIME}") ENDIF(NOT DATETIME MATCHES "ERROR") ELSEIF(UNIX) - EXECUTE_PROCESS(COMMAND "date" "+'%Y-%m-%d %H:%M:%S'" OUTPUT_VARIABLE ${RESULT}) + EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE DATETIME) + STRING(REGEX REPLACE "([0-9: -]+).*" "\\1" ${RESULT} "${DATETIME}") ELSE (WIN32) MESSAGE(SEND_ERROR "date not implemented") SET(${RESULT} "0000-00-00 00:00:00") @@ -47,13 +48,15 @@ IF(EXISTS "${ROOT_DIR}/.hg/") IF(MERCURIAL_FOUND) Mercurial_WC_INFO(${ROOT_DIR} ER) SET(REVISION ${ER_WC_REVISION}) + SET(CHANGESET ${ER_WC_CHANGESET}) + SET(BRANCH ${ER_WC_BRANCH}) ENDIF(MERCURIAL_FOUND) ENDIF(EXISTS "${ROOT_DIR}/.hg/") -IF(REVISION) +IF(DEFINED REVISION) IF(EXISTS ${SOURCE_DIR}/revision.h.in) NOW(BUILD_DATE) CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt) EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different ENDIF(EXISTS ${SOURCE_DIR}/revision.h.in) -ENDIF(REVISION) +ENDIF(DEFINED REVISION) diff --git a/code/CMakeModules/PCHSupport.cmake b/code/CMakeModules/PCHSupport.cmake index ae5b30ee2..7cd4c6c7d 100644 --- a/code/CMakeModules/PCHSupport.cmake +++ b/code/CMakeModules/PCHSupport.cmake @@ -62,9 +62,8 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags) LIST(APPEND ${_out_compile_flags} ${_directory_definitions}) LIST(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS}) - # Format definitions and remove duplicates + # Format definitions SEPARATE_ARGUMENTS(${_out_compile_flags}) - LIST(REMOVE_DUPLICATES ${_out_compile_flags}) ENDMACRO(_PCH_GET_COMPILE_FLAGS) MACRO(_PCH_GET_PDB_FILENAME out_filename _target) @@ -98,9 +97,13 @@ MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _inputcpp _output) IF(MSVC) _PCH_GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target}) - SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp\"${_output}\" ${_inputcpp} /c /Fd\"${PDB_FILE}\") + SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp\"${_output}\" ${_inputcpp} /c /Fd\"${PDB_FILE}\") ELSE(MSVC) - SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} -x c++-header -o ${_output} -c ${_input}) + SET(HEADER_FORMAT "c++-header") + IF(APPLE) + SET(HEADER_FORMAT "objective-${HEADER_FORMAT}") + ENDIF(APPLE) + SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} -x ${HEADER_FORMAT} -o ${_output} -c ${_input}) ENDIF(MSVC) ENDMACRO(_PCH_GET_COMPILE_COMMAND) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 24f5de7dc..b3db9ef7a 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -1,3 +1,11 @@ +# Force Release configuration for compiler checks +SET(CMAKE_TRY_COMPILE_CONFIGURATION "Release") + +# Force Release configuration by default +IF(NOT CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) +ENDIF(NOT CMAKE_BUILD_TYPE) + ### # Helper macro that generates .pc and installs it. # Argument: name - the name of the .pc package, e.g. "nel-pacs.pc" @@ -5,7 +13,11 @@ MACRO(NL_GEN_PC name) IF(NOT WIN32 AND WITH_INSTALL_LIBRARIES) CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}") - INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/pkgconfig) + IF(CMAKE_LIBRARY_ARCHITECTURE) + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig) + ELSE(CMAKE_LIBRARY_ARCHITECTURE) + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/pkgconfig) + ENDIF(CMAKE_LIBRARY_ARCHITECTURE) ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES) ENDMACRO(NL_GEN_PC) @@ -64,9 +76,10 @@ ENDMACRO(NL_TARGET_DRIVER) # Argument: ### MACRO(NL_DEFAULT_PROPS name label) - IF(NOT MSVC10) - SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label}) - ENDIF(NOT MSVC10) + # Note: This is just a workaround for a CMake bug generating VS10 files with a colon in the project name. + # CMake Bug ID: http://www.cmake.org/Bug/view.php?id=11819 + STRING(REGEX REPLACE "\\:" " -" proj_label ${label}) + SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${proj_label}) GET_TARGET_PROPERTY(type ${name} TYPE) IF(${type} STREQUAL SHARED_LIBRARY) # Set versions only if target is a shared library @@ -185,7 +198,7 @@ Remove the CMakeCache.txt file and try again from another folder, e.g.: rm CMakeCache.txt mkdir cmake cd cmake - cmake -G \"Unix Makefiles\" .. + cmake .. ") ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) @@ -230,6 +243,17 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) ### # Optional support ### + + # Check if CMake is launched from a Debian packaging script + SET(DEB_HOST_GNU_CPU $ENV{DEB_HOST_GNU_CPU}) + + # Don't strip if generating a .deb + IF(DEB_HOST_GNU_CPU) + OPTION(WITH_SYMBOLS "Keep debug symbols in binaries" ON ) + ELSE(DEB_HOST_GNU_CPU) + OPTION(WITH_SYMBOLS "Keep debug symbols in binaries" OFF) + ENDIF(DEB_HOST_GNU_CPU) + IF(WIN32) OPTION(WITH_STLPORT "With STLport support." ON ) ELSE(WIN32) @@ -332,8 +356,14 @@ MACRO(NL_SETUP_BUILD) ENDIF(CMAKE_BUILD_TYPE MATCHES "Release") ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug") - SET(HOST_CPU ${CMAKE_SYSTEM_PROCESSOR}) + SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR}) + IF(HOST_CPU MATCHES "amd64") + SET(HOST_CPU "x86_64") + ELSEIF(HOST_CPU MATCHES "i.86") + SET(HOST_CPU "x86") + ENDIF(HOST_CPU MATCHES "amd64") + # Determine target CPU IF(NOT TARGET_CPU) SET(TARGET_CPU $ENV{DEB_HOST_GNU_CPU}) @@ -353,6 +383,16 @@ MACRO(NL_SETUP_BUILD) # DEB_HOST_ARCH_ENDIAN is 'little' or 'big' # DEB_HOST_ARCH_BITS is '32' or '64' + IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") + SET(CLANG ON) + MESSAGE(STATUS "Using Clang compiler") + ENDIF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") + + IF(CMAKE_GENERATOR MATCHES "Xcode") + SET(XCODE ON) + MESSAGE(STATUS "Generating Xcode project") + ENDIF(CMAKE_GENERATOR MATCHES "Xcode") + # If target and host CPU are the same IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}") # x86-compatible CPU @@ -368,27 +408,43 @@ MACRO(NL_SETUP_BUILD) ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(TARGET_CPU "x86") ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) + ELSEIF(HOST_CPU MATCHES "arm") + SET(TARGET_CPU "arm") + ELSE(HOST_CPU MATCHES "x86") + SET(TARGET_CPU "unknown") + MESSAGE(STATUS "Unknown architecture: ${HOST_CPU}") ENDIF(HOST_CPU MATCHES "x86") - # TODO: add checks for ARM and PPC + # TODO: add checks for PPC ELSE("${HOST_CPU}" STREQUAL "${TARGET_CPU}") MESSAGE(STATUS "Compiling on ${HOST_CPU} for ${TARGET_CPU}") ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}") IF(TARGET_CPU STREQUAL "x86_64") SET(TARGET_X64 1) - SET(PLATFORM_CFLAGS "-DHAVE_X86_64") + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86_64") ELSEIF(TARGET_CPU STREQUAL "x86") SET(TARGET_X86 1) - SET(PLATFORM_CFLAGS "-DHAVE_X86") + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86") + ELSEIF(TARGET_CPU STREQUAL "arm") + SET(TARGET_ARM 1) + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_ARM") ENDIF(TARGET_CPU STREQUAL "x86_64") # Fix library paths suffixes for Debian MultiArch - IF(NOT CMAKE_LIBRARY_ARCHITECTURE) - SET(CMAKE_LIBRARY_ARCHITECTURE $ENV{DEB_HOST_MULTIARCH}) - ENDIF(NOT CMAKE_LIBRARY_ARCHITECTURE) + SET(DEBIAN_MULTIARCH $ENV{DEB_HOST_MULTIARCH}) + + IF(DEBIAN_MULTIARCH) + SET(CMAKE_LIBRARY_ARCHITECTURE ${DEBIAN_MULTIARCH}) + ENDIF(DEBIAN_MULTIARCH) IF(CMAKE_LIBRARY_ARCHITECTURE) - SET(CMAKE_LIBRARY_PATH "/lib/${CMAKE_LIBRARY_ARCHITECTURE};/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE};${CMAKE_LIBRARY_PATH}") + SET(CMAKE_LIBRARY_PATH /lib/${CMAKE_LIBRARY_ARCHITECTURE} /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_PATH}) + IF(TARGET_X64) + SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib64 /usr/lib64) + ENDIF(TARGET_X64) + IF(TARGET_X86) + SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib32 /usr/lib32) + ENDIF(TARGET_X86) ENDIF(CMAKE_LIBRARY_ARCHITECTURE) IF(MSVC) @@ -411,10 +467,10 @@ MACRO(NL_SETUP_BUILD) MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}") ENDIF(MSVC10) - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-") + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zm1000 /MP /Gy-") # Common link flags - SET(PLATFORM_LINKFLAGS "-DEBUG") + SET(PLATFORM_LINKFLAGS "") IF(TARGET_X64) # Fix a bug with Intellisense @@ -429,20 +485,45 @@ MACRO(NL_SETUP_BUILD) # Exceptions are only set for C++ SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa") - SET(NL_DEBUG_CFLAGS "/MDd /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS}") - SET(NL_RELEASE_CFLAGS "/MD /D NDEBUG ${SPEED_OPTIMIZATIONS}") - SET(NL_DEBUG_LINKFLAGS "/NODEFAULTLIB:msvcrt /INCREMENTAL:YES") - SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO") + IF(WITH_SYMBOLS) + SET(NL_RELEASE_CFLAGS "/Zi ${NL_RELEASE_CFLAGS}") + SET(NL_RELEASE_LINKFLAGS "/DEBUG ${NL_RELEASE_LINKFLAGS}") + ELSE(WITH_SYMBOLS) + SET(NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}") + ENDIF(WITH_SYMBOLS) + + SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS} ${NL_DEBUG_CFLAGS}") + SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${SPEED_OPTIMIZATIONS} ${NL_RELEASE_CFLAGS}") + SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt /INCREMENTAL:YES ${NL_DEBUG_LINKFLAGS}") + SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}") ELSE(MSVC) - IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m32 -march=i686") - ENDIF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") + IF(WIN32) + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DWIN32 -D_WIN32") + ENDIF(WIN32) + + IF(APPLE) + IF(TARGET_CPU STREQUAL "x86") + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch i386") + ENDIF(TARGET_CPU STREQUAL "x86") + + IF(TARGET_CPU STREQUAL "x86_64") + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch x86_64") + ENDIF(TARGET_CPU STREQUAL "x86_64") + ELSE(APPLE) + IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m32 -march=i686") + ENDIF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86") - IF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m64") - ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") + IF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m64") + ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64") + ENDIF(APPLE) - SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -g -D_REENTRANT -pipe -ftemplate-depth-48 -Wall -ansi -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing") + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -D_REENTRANT -pipe -ftemplate-depth-48 -Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing") + + IF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -ansi") + ENDIF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") IF(WITH_COVERAGE) SET(PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}") @@ -452,6 +533,41 @@ MACRO(NL_SETUP_BUILD) SET(PLATFORM_CFLAGS "-gdwarf-2 ${PLATFORM_CFLAGS}") ENDIF(APPLE) + IF(APPLE AND XCODE) + SET(CMAKE_OSX_SYSROOT "macosx" CACHE PATH "" FORCE) + ELSEIF(APPLE AND NOT XCODE) + IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET) + SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6") + ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET) + + FOREACH(_SDK ${_CMAKE_OSX_SDKS}) + IF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk") + SET(CMAKE_OSX_SYSROOT ${_SDK} CACHE PATH "" FORCE) + ENDIF(${_SDK} MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk") + ENDFOREACH(_SDK) + + IF(CMAKE_OSX_SYSROOT) + SET(PLATFORM_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${PLATFORM_CFLAGS}") + ELSE(CMAKE_OSX_SYSROOT) + MESSAGE(FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated") + ENDIF(CMAKE_OSX_SYSROOT) + + IF(CMAKE_OSX_ARCHITECTURES) + FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES}) + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch ${_ARCH}") + ENDFOREACH(_ARCH) + ENDIF(CMAKE_OSX_ARCHITECTURES) + IF(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG) + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") + ENDIF(CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG) + + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names") + + IF(HAVE_FLAG_SEARCH_PATHS_FIRST) + SET(PLATFORM_LINKFLAGS "-Wl,-search_paths_first ${PLATFORM_LINKFLAGS}") + ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST) + ENDIF(APPLE AND XCODE) + # Fix "relocation R_X86_64_32 against.." error on x64 platforms IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS) SET(PLATFORM_CFLAGS "-fPIC ${PLATFORM_CFLAGS}") @@ -463,8 +579,18 @@ MACRO(NL_SETUP_BUILD) SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--no-undefined -Wl,--as-needed") ENDIF(NOT APPLE) - SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -D_DEBUG") - SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O6") + IF(WITH_SYMBOLS) + SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g") + ELSE(WITH_SYMBOLS) + IF(APPLE) + SET(NL_RELEASE_LINKFLAGS "-Wl,-dead_strip -Wl,-x ${NL_RELEASE_LINKFLAGS}") + ELSE(APPLE) + SET(NL_RELEASE_LINKFLAGS "-Wl,-s ${NL_RELEASE_LINKFLAGS}") + ENDIF(APPLE) + ENDIF(WITH_SYMBOLS) + + SET(NL_DEBUG_CFLAGS "-g -DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}") + SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3 ${NL_RELEASE_CFLAGS}") ENDIF(MSVC) ENDMACRO(NL_SETUP_BUILD) @@ -615,35 +741,46 @@ MACRO(SETUP_EXTERNAL) ENDIF(WITH_EXTERNAL) IF(WIN32) - INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) + FIND_PACKAGE(External REQUIRED) + IF(MSVC10) 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) - GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0_Config;InstallDir]" ABSOLUTE) - # VC_ROOT_DIR is set to "registry" when a key is not found - IF(VC_ROOT_DIR MATCHES "registry") - GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE) - IF(VC_ROOT_DIR MATCHES "registry") - MESSAGE(FATAL_ERROR "Unable to find VC++ 2010 directory!") - ENDIF(VC_ROOT_DIR MATCHES "registry") - ENDIF(VC_ROOT_DIR MATCHES "registry") - # convert IDE fullpath to VC++ path - STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR}) - ELSE(MSVC10) - IF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") + + 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") + FILE(TO_CMAKE_PATH $ENV{VS100COMNTOOLS} VC_ROOT_DIR) + 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 ${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") + STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR}) + ENDIF(NOT VC_DIR) + ELSE(MSVC10) + 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(MSVC10) ELSE(WIN32) IF(APPLE) IF(WITH_STATIC_EXTERNAL) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib .so) + SET(CMAKE_FIND_LIBRARY_SUFFIXES .a) ELSE(WITH_STATIC_EXTERNAL) SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a) ENDIF(WITH_STATIC_EXTERNAL) @@ -659,12 +796,12 @@ MACRO(SETUP_EXTERNAL) IF(WITH_STLPORT) FIND_PACKAGE(STLport REQUIRED) INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR}) - IF(WIN32) + 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_DIR}) - ENDIF(WIN32) + ENDIF(MSVC) ENDIF(WITH_STLPORT) ENDMACRO(SETUP_EXTERNAL) diff --git a/code/README b/code/README index 4f1b1d51b..6a5d7ffad 100644 --- a/code/README +++ b/code/README @@ -19,7 +19,7 @@ environments. License ------- -Ryzom Core is a Free Software project under the GNU Affero General Public License, +Ryzom Core is a Free Software project under the GNU Affero General Public License v3, which means all its code is available for everyone to download, examine, use, modify, and distribute, subject to the usual restrictions attached to any GPL software. If you are not familiar with the AGPL, see the COPYING diff --git a/code/nel/CMakeLists.txt b/code/nel/CMakeLists.txt index c4e42ba19..d0687a7a5 100644 --- a/code/nel/CMakeLists.txt +++ b/code/nel/CMakeLists.txt @@ -18,19 +18,6 @@ ENDIF(WIN32) IF(WITH_3D) FIND_PACKAGE(FreeType) - IF(WITH_DRIVER_OPENGL) - FIND_PACKAGE(OpenGL) - IF(NOT WIN32) - IF(APPLE) - FIND_LIBRARY(CARBON NAMES Carbon) - FIND_LIBRARY(COCOA NAMES Cocoa) - ELSE(APPLE) - FIND_PACKAGE(X11) - FIND_PACKAGE(XF86VidMode) - ENDIF(APPLE) - ENDIF(NOT WIN32) - ENDIF(WITH_DRIVER_OPENGL) - IF(WITH_NEL_CEGUI) FIND_PACKAGE(CEGUI) ENDIF(WITH_NEL_CEGUI) diff --git a/code/nel/include/nel/3d/computed_string.h b/code/nel/include/nel/3d/computed_string.h index 16fe70fcb..914fa324e 100644 --- a/code/nel/include/nel/3d/computed_string.h +++ b/code/nel/include/nel/3d/computed_string.h @@ -27,12 +27,16 @@ #include #include +namespace NLMISC { + +class CMatrix; + +} namespace NL3D { class CTextureFont; -class CMatrix; struct CComputedString; // *************************************************************************** diff --git a/code/nel/include/nel/3d/cube_grid.h b/code/nel/include/nel/3d/cube_grid.h index 427aed624..483ea8000 100644 --- a/code/nel/include/nel/3d/cube_grid.h +++ b/code/nel/include/nel/3d/cube_grid.h @@ -227,7 +227,7 @@ void CCubeGrid::compile() // build the _StaticGrid _StaticGrids[i].build(_Grids[i]); // And reset the grid. contReset is necessary to clean the CBlockMemory. - contReset(_Grids[i]); + NLMISC::contReset(_Grids[i]); } // done diff --git a/code/nel/include/nel/3d/driver_user.h b/code/nel/include/nel/3d/driver_user.h index 81016186f..cc23ccf78 100644 --- a/code/nel/include/nel/3d/driver_user.h +++ b/code/nel/include/nel/3d/driver_user.h @@ -123,7 +123,7 @@ public: /// \name Object // @{ - CDriverUser (uint windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0); + CDriverUser (uint windowIcon, UDriver::TDriver driver, emptyProc exitFunc = 0); virtual ~CDriverUser(); // @} diff --git a/code/nel/include/nel/3d/dru.h b/code/nel/include/nel/3d/dru.h index d0012deaf..463d6b5db 100644 --- a/code/nel/include/nel/3d/dru.h +++ b/code/nel/include/nel/3d/dru.h @@ -27,9 +27,11 @@ #ifdef NL_OS_WINDOWS # define NL3D_GL_DLL_NAME "nel_drv_opengl_win" +# define NL3D_GLES_DLL_NAME "nel_drv_opengles_win" # define NL3D_D3D_DLL_NAME "nel_drv_direct3d_win" #elif defined (NL_OS_UNIX) # define NL3D_GL_DLL_NAME "nel_drv_opengl" +# define NL3D_GLES_DLL_NAME "nel_drv_opengles" #else # error "Unknown system" #endif @@ -43,6 +45,7 @@ struct EDru : public NLMISC::Exception EDru(const std::string &reason) : Exception(reason) {} }; +// OpenGL struct EDruOpenglDriverNotFound : public EDru { EDruOpenglDriverNotFound() : EDru( NL3D_GL_DLL_NAME " not found" ) {} @@ -68,7 +71,34 @@ struct EDruOpenglDriverCantCreateDriver : public EDru EDruOpenglDriverCantCreateDriver() : EDru( NL3D_GL_DLL_NAME " can't create driver" ) {} }; +// OpenGL ES +struct EDruOpenglEsDriverNotFound : public EDru +{ + EDruOpenglEsDriverNotFound() : EDru( NL3D_GLES_DLL_NAME " not found" ) {} +}; + +struct EDruOpenglEsDriverCorrupted : public EDru +{ + EDruOpenglEsDriverCorrupted() : EDru( "Can't get NL3D_createIDriverInstance from " NL3D_GLES_DLL_NAME " (Bad dll?)" ) {} +}; + +struct EDruOpenglEsDriverOldVersion : public EDru +{ + EDruOpenglEsDriverOldVersion() : EDru( NL3D_GLES_DLL_NAME " is a too old version. Ask for a more recent file" ) {} +}; + +struct EDruOpenglEsDriverUnknownVersion : public EDru +{ + EDruOpenglEsDriverUnknownVersion() : EDru( NL3D_GLES_DLL_NAME " is more recent than the application" ) {} +}; + +struct EDruOpenglEsDriverCantCreateDriver : public EDru +{ + EDruOpenglEsDriverCantCreateDriver() : EDru( NL3D_GLES_DLL_NAME " can't create driver" ) {} +}; + #ifdef NL_OS_WINDOWS +// Direct3D struct EDruDirect3dDriverNotFound : public EDru { EDruDirect3dDriverNotFound() : EDru( NL3D_D3D_DLL_NAME " not found" ) {} @@ -103,6 +133,9 @@ public: /// Portable Function which create a GL Driver (using gl dll...). static IDriver *createGlDriver() throw(EDru); + /// Portable Function which create a GL ES Driver (using gl dll...). + static IDriver *createGlEsDriver() throw(EDru); + #ifdef NL_OS_WINDOWS /// Windows Function which create a Direct3d Driver. static IDriver *createD3DDriver() throw(EDru); diff --git a/code/nel/include/nel/3d/index_buffer.h b/code/nel/include/nel/3d/index_buffer.h index 320a06020..7beaafe0b 100644 --- a/code/nel/include/nel/3d/index_buffer.h +++ b/code/nel/include/nel/3d/index_buffer.h @@ -782,7 +782,7 @@ inline void CIndexBuffer::lock (CIndexBufferRead &accessor, uint first, uint las // *************************************************************************** -inline void CIndexBuffer::unlock (uint first, uint end) +inline void CIndexBuffer::unlock (uint /* first */, uint /* end */) { nlassertex (_LockCounter!=0, ("Index buffer not locked")); nlassert (_LockedBuffer || (!isResident() && _NonResidentIndexes.empty())); diff --git a/code/nel/include/nel/3d/instance_lighter.h b/code/nel/include/nel/3d/instance_lighter.h index 7b1dbb6e7..8b1ccf80a 100644 --- a/code/nel/include/nel/3d/instance_lighter.h +++ b/code/nel/include/nel/3d/instance_lighter.h @@ -147,7 +147,7 @@ public: static void addTriangles (const IShape &shape, const NLMISC::CMatrix& modelMT, std::vector& triangleArray, sint instanceId); // Progress callback - virtual void progress (const char *message, float progress) {} + virtual void progress (const char * /* message */, float /* progress */) {} /// \name Static PointLights mgt. diff --git a/code/nel/include/nel/3d/ps_attrib.h b/code/nel/include/nel/3d/ps_attrib.h index fc17dc787..83549a7b0 100644 --- a/code/nel/include/nel/3d/ps_attrib.h +++ b/code/nel/include/nel/3d/ps_attrib.h @@ -96,7 +96,7 @@ public: try { newStart = new uint8[sizeof(T) * capacity + (1 << snapPower)]; - T *newTab = (T *) ( (uint) (newStart + (1 << snapPower)) & ~((1 << snapPower) - 1)); // snap to a page + T *newTab = (T *) ( (size_t) (newStart + (1 << snapPower)) & ~((1 << snapPower) - 1)); // snap to a page diff --git a/code/nel/include/nel/3d/ps_attrib_maker_bin_op.h b/code/nel/include/nel/3d/ps_attrib_maker_bin_op.h index 4370fdeaa..285fa9b26 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_bin_op.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_bin_op.h @@ -157,7 +157,7 @@ public: } /// return true if an operation is supported. The default support all ops - bool supportOp(CPSBinOp::BinOp op) { return true; } + bool supportOp(CPSBinOp::BinOp /* op */) { return true; } /// get the current operator CPSBinOp::BinOp getOp(void) const { return _Op; } diff --git a/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h b/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h index c25c051a5..8d98a1544 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_bin_op_inline.h @@ -57,13 +57,13 @@ inline CPlaneBasis PSBinOpModulate(CPlaneBasis p1, CPlaneBasis p2) } template <> -inline CPlaneBasis PSBinOpAdd(CPlaneBasis p1, CPlaneBasis p2) +inline CPlaneBasis PSBinOpAdd(CPlaneBasis /* p1 */, CPlaneBasis /* p2 */) { nlassert(0); // not allowed for now return CPlaneBasis(NLMISC::CVector::Null); } template <> -inline CPlaneBasis PSBinOpSubtract(CPlaneBasis p1, CPlaneBasis p2) +inline CPlaneBasis PSBinOpSubtract(CPlaneBasis /* p1 */, CPlaneBasis /* p2 */) { nlassert(0); // not allowed for now return CPlaneBasis(NLMISC::CVector::Null); diff --git a/code/nel/include/nel/3d/ps_attrib_maker_iterators.h b/code/nel/include/nel/3d/ps_attrib_maker_iterators.h index 8729ffb10..d9cfbcdd3 100644 --- a/code/nel/include/nel/3d/ps_attrib_maker_iterators.h +++ b/code/nel/include/nel/3d/ps_attrib_maker_iterators.h @@ -60,7 +60,7 @@ namespace NL3D { GET_INLINE float get() const { return float(rand() * (1 / double(RAND_MAX))); } // this may be optimized with a table... void advance() {} - void advance(uint quantity) {} + void advance(uint /* quantity */) {} }; /// this iterator just return the same value @@ -69,7 +69,7 @@ namespace NL3D float Value; GET_INLINE float get() const { return Value; } void advance() {} - void advance(uint quantity) {} + void advance(uint /* quantity */) {} }; /// iterator that use dist to compute the value diff --git a/code/nel/include/nel/3d/ps_direction.h b/code/nel/include/nel/3d/ps_direction.h index 609278a80..eb8bbd827 100644 --- a/code/nel/include/nel/3d/ps_direction.h +++ b/code/nel/include/nel/3d/ps_direction.h @@ -38,7 +38,7 @@ public : /** The direction is taken from a global vector defined in the particle system * NULL or an empty string as a name disable the use of a global value */ - virtual void enableGlobalVectorValue(const std::string &name) {} + virtual void enableGlobalVectorValue(const std::string &/* name */) {} virtual std::string getGlobalVectorValueName() const { return ""; } }; diff --git a/code/nel/include/nel/3d/ps_edit.h b/code/nel/include/nel/3d/ps_edit.h index d3e1a53de..8342868f8 100644 --- a/code/nel/include/nel/3d/ps_edit.h +++ b/code/nel/include/nel/3d/ps_edit.h @@ -65,13 +65,13 @@ struct IPSMover virtual bool supportNonUniformScaling(void) const { NL_PS_FUNC(supportNonUniformScaling); return false ; } // set the scale of the object (uniform scale). The default does nothing - virtual void setScale(uint32 index, float scale) {} ; + virtual void setScale(uint32 /* index */, float /* scale */) {} // set a non uniform scale (if supported) - virtual void setScale(uint32 index, const NLMISC::CVector &s) { NL_PS_FUNC(setScale); } + virtual void setScale(uint32 /* index */, const NLMISC::CVector &/* s */) { NL_PS_FUNC(setScale); } // get the scale of the object - virtual NLMISC::CVector getScale(uint32 index) const { NL_PS_FUNC(getScale); return NLMISC::CVector(1.f, 1.f, 1.f) ; } + virtual NLMISC::CVector getScale(uint32 /* index */) const { NL_PS_FUNC(getScale); return NLMISC::CVector(1.f, 1.f, 1.f) ; } /** some object may not store a whole matrix (e.g planes) * this return true if only a normal is needed to set the orientation of the object @@ -79,10 +79,10 @@ struct IPSMover virtual bool onlyStoreNormal(void) const { NL_PS_FUNC(onlyStoreNormal); return false ; } /// if the object only needs a normal, this return the normal. If not, is return (0, 0, 0) - virtual NLMISC::CVector getNormal(uint32 index) { NL_PS_FUNC(getNormal); return NLMISC::CVector::Null ; } + virtual NLMISC::CVector getNormal(uint32 /* index */) { NL_PS_FUNC(getNormal); return NLMISC::CVector::Null ; } /// if the object only stores a normal, this set the normal of the object. Otherwise it has no effect - virtual void setNormal(uint32 index, NLMISC::CVector n) { NL_PS_FUNC(setNormal); } + virtual void setNormal(uint32 /* index */, NLMISC::CVector /* n */) { NL_PS_FUNC(setNormal); } // set a new orthogonal matrix for the object virtual void setMatrix(uint32 index, const NLMISC::CMatrix &m) = 0 ; diff --git a/code/nel/include/nel/3d/ps_force.h b/code/nel/include/nel/3d/ps_force.h index 5e961dc43..15e28948a 100644 --- a/code/nel/include/nel/3d/ps_force.h +++ b/code/nel/include/nel/3d/ps_force.h @@ -87,9 +87,9 @@ public: * 'accumulate' set to false. * NB : works only with integrable forces */ - virtual void integrate(float date, CPSLocated *src, uint32 startIndex, uint32 numObjects, NLMISC::CVector *destPos = NULL, NLMISC::CVector *destSpeed = NULL, - bool accumulate = false, - uint posStride = sizeof(NLMISC::CVector), uint speedStride = sizeof(NLMISC::CVector) + virtual void integrate(float /* date */, CPSLocated * /* src */, uint32 /* startIndex */, uint32 /* numObjects */, NLMISC::CVector * /* destPos */ = NULL, NLMISC::CVector * /* destSpeed */ = NULL, + bool /* accumulate */ = false, + uint /* posStride */ = sizeof(NLMISC::CVector), uint /* speedStride */ = sizeof(NLMISC::CVector) ) const { nlassert(0); // not an integrable force @@ -100,11 +100,11 @@ public: * If the start date is lower than the creation date, the initial position is used * NB : works only with integrable forces */ - virtual void integrateSingle(float startDate, float deltaT, uint numStep, - const CPSLocated *src, uint32 indexInLocated, - NLMISC::CVector *destPos, - bool accumulate = false, - uint posStride = sizeof(NLMISC::CVector)) const + virtual void integrateSingle(float /* startDate */, float /* deltaT */, uint /* numStep */, + const CPSLocated * /* src */, uint32 /* indexInLocated */, + NLMISC::CVector * /* destPos */, + bool /* accumulate */ = false, + uint /* posStride */ = sizeof(NLMISC::CVector)) const { nlassert(0); // not an integrable force } @@ -170,7 +170,7 @@ public: virtual void setIntensityScheme(CPSAttribMaker *scheme); // deriver have here the opportunity to setup the functor object. The default does nothing - virtual void setupFunctor(uint32 indexInLocated) { } + virtual void setupFunctor(uint32 /* indexInLocated */) { } /// get the attribute maker for a non constant intensity CPSAttribMaker *getIntensityScheme(void) { return _IntensityScheme; } @@ -493,22 +493,22 @@ public: #ifdef NL_OS_WINDOWS __forceinline #endif - void operator() (const NLMISC::CVector &pos, NLMISC::CVector &speed, float invMass) - { + void operator() (const NLMISC::CVector &/* pos */, NLMISC::CVector &speed, float invMass) + { speed -= (CParticleSystem::EllapsedTime * _K * invMass * speed); - } + } - virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) - { - f.serialVersion(1); - // we don't save intensity info : it is saved by the owning object (and set before each use of this functor) - } + virtual void serial(NLMISC::IStream &f) throw(NLMISC::EStream) + { + f.serialVersion(1); + // we don't save intensity info : it is saved by the owning object (and set before each use of this functor) + } - // get the friction coefficient - float getK(void) const { return _K; } + // get the friction coefficient + float getK(void) const { return _K; } - // set the friction coefficient - void setK(float coeff) { _K = coeff; } + // set the friction coefficient + void setK(float coeff) { _K = coeff; } protected: // the friction coeff float _K; @@ -630,7 +630,7 @@ struct CPSTurbulForceFunc #ifdef NL_OS_WINDOWS __forceinline #endif - void operator() (const NLMISC::CVector &pos, NLMISC::CVector &speed, float invMass) + void operator() (const NLMISC::CVector &/* pos */, NLMISC::CVector &/* speed */, float /* invMass */) { nlassert(0); diff --git a/code/nel/include/nel/3d/static_quad_grid.h b/code/nel/include/nel/3d/static_quad_grid.h index 7890e12f4..5a0383c9e 100644 --- a/code/nel/include/nel/3d/static_quad_grid.h +++ b/code/nel/include/nel/3d/static_quad_grid.h @@ -172,7 +172,7 @@ template void CStaticQuadGrid::build(CQuadGrid &quadGrid) { clear(); - contReset(_Grid); + NLMISC::contReset(_Grid); // Copy from quadGrid, and init quads _Size= quadGrid.getSize(); diff --git a/code/nel/include/nel/3d/track_tcb.h b/code/nel/include/nel/3d/track_tcb.h index 8daf5cc2a..fc9c227e4 100644 --- a/code/nel/include/nel/3d/track_tcb.h +++ b/code/nel/include/nel/3d/track_tcb.h @@ -218,7 +218,7 @@ protected: date*= previous->OODeltaTime; NLMISC::clamp(date, 0,1); - date = ease(previous, date); + date = this->ease(previous, date); float hb[4]; this->computeHermiteBasis(date, hb); @@ -242,7 +242,7 @@ protected: ITrackKeyFramer::compile(); // Ease Precompute. - compileTCBEase(this->_MapKey, this->getLoopMode()); + this->compileTCBEase(this->_MapKey, this->getLoopMode()); // Tangents Precompute. @@ -314,7 +314,7 @@ private: float ksm,ksp,kdm,kdp; // compute tangents factors. - computeTCBFactors(key, timeBefore, time, timeAfter, rangeDelta, firstKey, endKey, isLoop, ksm,ksp,kdm,kdp); + this->computeTCBFactors(key, timeBefore, time, timeAfter, rangeDelta, firstKey, endKey, isLoop, ksm,ksp,kdm,kdp); // Delta. TKeyValueType delm, delp; @@ -413,7 +413,7 @@ public: ITrackKeyFramer::compile(); // Ease Precompute. - compileTCBEase(_MapKey, getLoopMode()); + this->compileTCBEase(_MapKey, getLoopMode()); TMapTimeCKey::iterator it; TMapTimeCKey::iterator itNext; diff --git a/code/nel/include/nel/3d/u_driver.h b/code/nel/include/nel/3d/u_driver.h index 3c120737d..025c134ed 100644 --- a/code/nel/include/nel/3d/u_driver.h +++ b/code/nel/include/nel/3d/u_driver.h @@ -139,6 +139,9 @@ public: enum TStencilOp { keep = 0, zero, replace, incr, decr, invert }; enum TStencilFunc { never = 0, less, lessequal, equal, notequal, greaterequal, greater, always}; + // Existing drivers + enum TDriver { Direct3d = 0, OpenGl, OpenGlEs }; + public: /// The EventServer of this driver. Init after setDisplay()!! NLMISC::CEventServer EventServer; @@ -844,6 +847,7 @@ public: * This is the static function which build a UDriver, the root for all 3D functions. */ static UDriver *createDriver(uint windowIcon = 0, bool direct3d = false, emptyProc exitFunc = 0); + static UDriver *createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc = 0); /** * Purge static memory diff --git a/code/nel/include/nel/3d/vertex_buffer.h b/code/nel/include/nel/3d/vertex_buffer.h index 83b2b90ea..a64ec0c2c 100644 --- a/code/nel/include/nel/3d/vertex_buffer.h +++ b/code/nel/include/nel/3d/vertex_buffer.h @@ -1223,7 +1223,7 @@ inline void CVertexBuffer::lock (CVertexBufferRead &accessor, uint first, uint l // -------------------------------------------------- -inline void CVertexBuffer::unlock (uint first, uint end) +inline void CVertexBuffer::unlock (uint /* first */, uint /* end */) { nlassertex (_LockCounter!=0, ("Vertex buffer not locked")); nlassert (_LockedBuffer || (!isResident() && _NonResidentVertices.empty())); diff --git a/code/nel/include/nel/misc/bit_mem_stream.h b/code/nel/include/nel/misc/bit_mem_stream.h index 8a1af34cc..b294d5454 100644 --- a/code/nel/include/nel/misc/bit_mem_stream.h +++ b/code/nel/include/nel/misc/bit_mem_stream.h @@ -209,6 +209,8 @@ public: { #ifdef NL_DEBUG std::swap(_DbgData, other._DbgData); +#else + nlunreferenced(other); #endif } @@ -225,6 +227,10 @@ public: TBMSSerialInfo serialItem( bitpos, size, type, _DbgData->NextSymbol ); _DbgData->List.push_back( serialItem ); _DbgData->NextSymbol = NULL; +#else + nlunreferenced(bitpos); + nlunreferenced(size); + nlunreferenced(type); #endif } @@ -258,6 +264,10 @@ public: nlwarning( "Missing reserve() corresponding to poke()" ); } _DbgData->NextSymbol = NULL; +#else + nlunreferenced(bitpos); + nlunreferenced(size); + nlunreferenced(type); #endif } @@ -266,6 +276,8 @@ public: { #ifdef NL_DEBUG _DbgData->NextSymbol = symbol; +#else + nlunreferenced(symbol); #endif } @@ -308,6 +320,8 @@ public: } //nlassert( bitpos < (*_List)[_CurrentBrowsedItem].BitPos ); // occurs if stream overflow } +#else + nlunreferenced(bitpos); #endif *eventId = -1; return std::string(); @@ -380,7 +394,7 @@ public: * If you are using the stream only in output mode, you can use this method as a faster version * of clear() *if you don't serialize pointers*. */ - void resetBufPos() + virtual void resetBufPos() { // This is ensured in CMemStream::CMemStream() and CMemStream::clear() //if ( (!isReading()) && _Buffer.empty() ) @@ -463,7 +477,7 @@ public: } /// See doc in CMemStream::bufferToFill() - uint8 *bufferToFill( uint32 msgsize ) + virtual uint8 *bufferToFill( uint32 msgsize ) { _FreeBits = 8; _DbgInfo.clear(); @@ -640,7 +654,7 @@ public: virtual void serial(ucstring &b); virtual void serial(CBitMemStream &b) { serialMemStream(b); } - virtual void serialMemStream(CBitMemStream &b); + virtual void serialMemStream(CMemStream &b); //@} @@ -787,11 +801,7 @@ void displayBitStream( const CBitMemStream& msg, sint beginbitpos, sint endbitpo inline std::string CBMSDbgInfo::getEventLegendAtBitPos( CBitMemStream& bms, sint32 eventId ) { #ifdef NL_DEBUG - if ( eventId == -1 ) - { - return std::string(); - } - else + if ( eventId != -1 ) { nlassert( eventId < (sint32)_DbgData->List.size() ); TBMSSerialInfo& serialItem = _DbgData->List[eventId]; // works only with a vector! @@ -800,8 +810,11 @@ inline std::string CBMSDbgInfo::getEventLegendAtBitPos( CBitMemStream& bms, sint bms.getSerialItem( serialItem ).c_str(), (serialItem.Symbol!=NULL)?serialItem.Symbol:"" ); } #else - return std::string(); + nlunreferenced(bms); + nlunreferenced(eventId); #endif + + return std::string(); } diff --git a/code/nel/include/nel/misc/diff_tool.h b/code/nel/include/nel/misc/diff_tool.h index 64989fcaf..2f291c6a0 100644 --- a/code/nel/include/nel/misc/diff_tool.h +++ b/code/nel/include/nel/misc/diff_tool.h @@ -501,8 +501,8 @@ namespace STRING_MANAGER // callback->onSwap(it - context.Reference.begin(), refCount, context); callback->onSwap(index, refCount, context); -// swap(*it, context.Reference[refCount]); - swap(context.Reference[index], context.Reference[refCount]); +// std::swap(*it, context.Reference[refCount]); + std::swap(context.Reference[index], context.Reference[refCount]); } } else if (getHashValue(context.Addition, addCount) != getHashValue(context.Reference, refCount)) diff --git a/code/nel/include/nel/misc/dynloadlib.h b/code/nel/include/nel/misc/dynloadlib.h index 6f74702b8..1cec2573a 100644 --- a/code/nel/include/nel/misc/dynloadlib.h +++ b/code/nel/include/nel/misc/dynloadlib.h @@ -22,8 +22,9 @@ #include #ifdef NL_OS_WINDOWS -# define NOMINMAX -# include +struct HINSTANCE__; +typedef struct HINSTANCE__ *HINSTANCE; +typedef HINSTANCE HMODULE; /* HMODULEs can be used in place of HINSTANCEs */ #else # include #endif diff --git a/code/nel/include/nel/misc/entity_id.h b/code/nel/include/nel/misc/entity_id.h index 4ca446941..96b8db223 100644 --- a/code/nel/include/nel/misc/entity_id.h +++ b/code/nel/include/nel/misc/entity_id.h @@ -470,12 +470,12 @@ public: /// return a string in form "(a:b:c:d)" where a,b,c,d are components of entity id. std::string toString() const { - std::string id; - id.reserve(25); - id+='('; - getDebugString (id); - id+=')'; - return id; + std::string ident; + ident.reserve(25); + ident+='('; + getDebugString (ident); + ident+=')'; + return ident; } /// Read from a debug string, use the same format as toString() (id:type:creator:dynamic) in hexadecimal diff --git a/code/nel/include/nel/misc/fast_floor.h b/code/nel/include/nel/misc/fast_floor.h index 421364ad1..203e8c9b0 100644 --- a/code/nel/include/nel/misc/fast_floor.h +++ b/code/nel/include/nel/misc/fast_floor.h @@ -29,7 +29,7 @@ extern int *OptFastFloorCWStackPtr; extern int *OptFastFloorCWStackEnd; // fastFloor function. -#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) +#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) && defined(NL_USE_FASTFLOOR) #include diff --git a/code/nel/include/nel/misc/fast_id_map.h b/code/nel/include/nel/misc/fast_id_map.h new file mode 100644 index 000000000..bccec051b --- /dev/null +++ b/code/nel/include/nel/misc/fast_id_map.h @@ -0,0 +1,151 @@ +/** + * \file fast_id_map.h + * \brief CFastIdMap + * \date 2012-04-10 19:28GMT + * \author Jan Boon (Kaetemi) + * CFastIdMap + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#ifndef NLMISC_FAST_ID_MAP_H +#define NLMISC_FAST_ID_MAP_H +#include + +// STL includes + +// NeL includes +#include + +// Project includes + +namespace NLMISC { + +/** + * \brief CFastIdMap + * \date 2012-04-10 19:28GMT + * \author Jan Boon (Kaetemi) + * This template allows for assigning unique uint32 identifiers to pointers. + * Useful when externally only exposing an identifier, when pointers may have been deleted. + * The identifier is made from two uint16's, one being the direct index in the identifier vector, + * and the other being a verification value that is increased when the identifier index is re-used. + * TId must be a typedef of uint32. + * TValue should be a pointer. + */ +template +class CFastIdMap +{ +protected: + struct CIdInfo + { + CIdInfo() { } + CIdInfo(uint16 verification, uint16 next, TValue value) : + Verification(verification), Next(next), Value(value) { } + uint16 Verification; + uint16 Next; + TValue Value; + }; + /// ID memory + std::vector m_Ids; + /// Nb of assigned IDs + uint m_Size; + /// Assigned IDs + uint16 m_Next; + +public: + CFastIdMap(TValue defaultValue) : m_Size(0), m_Next(0) + { + // Id 0 will contain the last available unused id, and be 0 if no more unused id's are available + // defaultValue will be returned when the ID is not found + m_Ids.push_back(CIdInfo(0, 0, defaultValue)); + } + + virtual ~CFastIdMap() { } + + void clear() + { + m_Ids.resize(1); + m_Ids[0].Next = 0; + } + + TId insert(TValue value) + { + // get next unused index + uint16 idx = m_Ids[0].Next; + if (idx == 0) + { + // size of used elements must be equal to the vector size minus one, when everything is allocated + nlassert((m_Ids.size() - 1) == m_Size); + + idx = (uint16)m_Ids.size(); + uint16 verification = rand(); + m_Ids.push_back(CIdInfo(verification, m_Next, value)); + m_Next = idx; + return (TId)(((uint32)verification) << 16) & idx; + } + else + { + m_Ids[0].Next = m_Ids[idx].Next; // restore the last unused id + m_Ids[idx].Value = value; + return (TId)(((uint32)m_Ids[idx].Verification) << 16) & idx; + } + } + + void erase(TId id) + { + uint32 idx = ((uint32)id) & 0xFFFF; + uint16 verification = (uint16)(((uint32)id) >> 16); + if (m_Ids[idx].Verification == verification) + { + m_Ids[idx].Value = m_Ids[0].Value; // clean value for safety + m_Ids[idx].Verification = (uint16)(((uint32)m_Ids[idx].Verification + 1) & 0xFFFF); // change verification value, allow overflow :) + m_Ids[idx].Next = m_Ids[0].Next; // store the last unused id + m_Ids[0].Next = (uint16)idx; // set this as last unused id + } + else + { + nlwarning("Invalid ID"); + } + } + + TValue get(TId id) + { + uint32 idx = ((uint32)id) & 0xFFFF; + uint16 verification = (uint16)(((uint32)id) >> 16); + if (m_Ids[idx].Verification == verification) + { + return m_Ids[idx].Value; + } + else + { + nldebug("Invalid ID"); + return m_Ids[0].Value; + } + } + + inline uint size() { return m_Size; } + +}; /* class CFastIdMap */ + +} /* namespace NLMISC */ + +#endif /* #ifndef NLMISC_FAST_ID_MAP_H */ + +/* end of file */ diff --git a/code/nel/include/nel/misc/mem_stream.h b/code/nel/include/nel/misc/mem_stream.h index 2102129dd..1da99a48d 100644 --- a/code/nel/include/nel/misc/mem_stream.h +++ b/code/nel/include/nel/misc/mem_stream.h @@ -301,7 +301,7 @@ public: * If you are using the stream only in output mode, you can use this method as a faster version * of clear() *if you don't serialize pointers*. */ - void resetBufPos() { _Buffer.Pos = 0; } + virtual void resetBufPos() { _Buffer.Pos = 0; } /** * Resize the message buffer and fill data at position 0. @@ -340,7 +340,7 @@ public: * fill it with raw data using any filling function (warning: don't fill more than 'msgsize' * bytes!), then you are ready to read, using serial(), the data you've just filled. */ - uint8 *bufferToFill( uint32 msgsize ) + virtual uint8 *bufferToFill( uint32 msgsize ) { #ifdef NL_DEBUG nlassert( isReading() ); diff --git a/code/nel/include/nel/misc/mutex.h b/code/nel/include/nel/misc/mutex.h index e2205d666..1c01a6134 100644 --- a/code/nel/include/nel/misc/mutex.h +++ b/code/nel/include/nel/misc/mutex.h @@ -717,11 +717,11 @@ class CAutoMutex TMutex &_Mutex; // forbeden copy or assignent - CAutoMutex(const CAutoMutex &other) + CAutoMutex(const CAutoMutex &/* other */) { } - CAutoMutex &operator = (const CAutoMutex &other) + CAutoMutex &operator = (const CAutoMutex &/* other */) { return *this; } diff --git a/code/nel/include/nel/misc/p_thread.h b/code/nel/include/nel/misc/p_thread.h index cd027aa37..7e6a4d5a5 100644 --- a/code/nel/include/nel/misc/p_thread.h +++ b/code/nel/include/nel/misc/p_thread.h @@ -36,6 +36,12 @@ namespace NLMISC { class CPThread : public IThread { public: + enum TThreadState + { + ThreadStateNone, + ThreadStateRunning, + ThreadStateFinished, + }; /// Constructor CPThread( IRunnable *runnable, uint32 stackSize); @@ -48,6 +54,7 @@ public: virtual void wait(); virtual bool setCPUMask(uint64 cpuMask); virtual uint64 getCPUMask(); + virtual void setPriority(TThreadPriority priority); virtual std::string getUserName(); virtual IRunnable *getRunnable() @@ -58,10 +65,11 @@ public: /// Internal use IRunnable *Runnable; + TThreadState _State; + pthread_t _ThreadHandle; + private: - uint8 _State; // 0=not created, 1=started, 2=finished uint32 _StackSize; - pthread_t _ThreadHandle; }; /** diff --git a/code/nel/include/nel/misc/speaker_listener.h b/code/nel/include/nel/misc/speaker_listener.h index 7481e12c8..5f9f86352 100644 --- a/code/nel/include/nel/misc/speaker_listener.h +++ b/code/nel/include/nel/misc/speaker_listener.h @@ -118,7 +118,7 @@ namespace NLMISC _Speaker->registerListener(this); } - void unregisterListener(ISpeaker *speaker) + void unregisterListener(ISpeaker * /* speaker */) { nlassert(_Speaker != NULL); _Speaker->unregisterListener(this); diff --git a/code/nel/include/nel/misc/sstring.h b/code/nel/include/nel/misc/sstring.h index 513c681c9..fc17d67f5 100644 --- a/code/nel/include/nel/misc/sstring.h +++ b/code/nel/include/nel/misc/sstring.h @@ -55,7 +55,7 @@ public: /// ctor CSString(int i,const char *fmt="%d"); /// ctor - CSString(unsigned u,const char *fmt="%u"); + CSString(uint32 u,const char *fmt="%u"); /// ctor CSString(double d,const char *fmt="%f"); /// ctor @@ -76,14 +76,14 @@ public: char back() const; /// Return the n left hand most characters of a string - CSString left(unsigned count) const; + CSString left(uint32 count) const; /// Return the n right hand most characters of a string - CSString right(unsigned count) const; + CSString right(uint32 count) const; /// Return the string minus the n left hand most characters of a string - CSString leftCrop(unsigned count) const; + CSString leftCrop(uint32 count) const; /// Return the string minus the n right hand most characters of a string - CSString rightCrop(unsigned count) const; + CSString rightCrop(uint32 count) const; /// Return sub string up to but not including first instance of given character, starting at 'iterator' /// on exit 'iterator' indexes first character after extracted string segment @@ -116,9 +116,9 @@ public: /// Return sub string remaining after the first word CSString tailFromFirstWord() const; /// Count the number of words in a string - unsigned countWords() const; + uint32 countWords() const; /// Extract the given word - CSString word(unsigned idx) const; + CSString word(uint32 idx) const; /// Return first word or quote-encompassed sub-string - can remove extracted sub-string from source string CSString firstWordOrWords(bool truncateThis=false,bool useSlashStringEscape=true,bool useRepeatQuoteStringEscape=true); @@ -127,9 +127,9 @@ public: /// Return sub string following first word (or quote-encompassed sub-string) CSString tailFromFirstWordOrWords(bool useSlashStringEscape=true,bool useRepeatQuoteStringEscape=true) const; /// Count the number of words (or quote delimited sub-strings) in a string - unsigned countWordOrWords(bool useSlashStringEscape=true,bool useRepeatQuoteStringEscape=true) const; + uint32 countWordOrWords(bool useSlashStringEscape=true,bool useRepeatQuoteStringEscape=true) const; /// Extract the given words (or quote delimited sub-strings) - CSString wordOrWords(unsigned idx,bool useSlashStringEscape=true,bool useRepeatQuoteStringEscape=true) const; + CSString wordOrWords(uint32 idx,bool useSlashStringEscape=true,bool useRepeatQuoteStringEscape=true) const; /// Return first line - can remove extracted line from source string CSString firstLine(bool truncateThis=false); @@ -138,9 +138,9 @@ public: /// Return sub string remaining after the first line CSString tailFromFirstLine() const; /// Count the number of lines in a string - unsigned countLines() const; + uint32 countLines() const; /// Extract the given line - CSString line(unsigned idx) const; + CSString line(uint32 idx) const; /// A handy utility routine for knowing if a character is a white space character or not (' ','\t','\n','\r',26) static bool isWhiteSpace(char c); @@ -377,7 +377,7 @@ public: /// assignment operator CSString& operator=(int i); /// assignment operator - CSString& operator=(unsigned u); + CSString& operator=(uint32 u); /// assignment operator CSString& operator=(double d); @@ -561,7 +561,7 @@ inline CSString::CSString(int i,const char *fmt) *this=buf; } -inline CSString::CSString(unsigned u,const char *fmt) +inline CSString::CSString(uint32 u,const char *fmt) { char buf[1024]; sprintf(buf,fmt,u); @@ -611,26 +611,26 @@ inline char CSString::back() const return (*this)[size()-1]; } -inline CSString CSString::right(unsigned count) const +inline CSString CSString::right(uint32 count) const { if (count>=size()) return *this; return substr(size()-count); } -inline CSString CSString::rightCrop(unsigned count) const +inline CSString CSString::rightCrop(uint32 count) const { if (count>=size()) return CSString(); return substr(0,size()-count); } -inline CSString CSString::left(unsigned count) const +inline CSString CSString::left(uint32 count) const { return substr(0,count); } -inline CSString CSString::leftCrop(unsigned count) const +inline CSString CSString::leftCrop(uint32 count) const { if (count>=size()) return CSString(); @@ -639,7 +639,7 @@ inline CSString CSString::leftCrop(unsigned count) const inline CSString CSString::splitToWithIterator(char c,uint32& iterator) const { - unsigned i; + uint32 i; CSString result; for (i=iterator;i !!! - CSTLBlockAllocator(CBlockMemory *bm) + CSTLBlockAllocator(CBlockMemory * /* bm */) { } /// copy ctor diff --git a/code/nel/include/nel/misc/thread.h b/code/nel/include/nel/misc/thread.h index 82ef78a13..983e6b12a 100644 --- a/code/nel/include/nel/misc/thread.h +++ b/code/nel/include/nel/misc/thread.h @@ -68,6 +68,16 @@ public: } }; +/// Thread priorities, numbering follows Win32 for now +enum TThreadPriority +{ + ThreadPriorityLowest = -2, + ThreadPriorityLow = -1, + ThreadPriorityNormal = 0, + ThreadPriorityHigh = 1, + ThreadPriorityHighest = 2, +}; + /** * Thread base interface, must be implemented for all OS * \author Vianney Lecroart @@ -119,6 +129,9 @@ public: */ virtual uint64 getCPUMask()=0; + /// Set the thread priority. Thread must have been started before. + virtual void setPriority(TThreadPriority priority) = 0; + /** * Get the thread user name. * Under Linux return thread owner, under windows return the name of the logon user. diff --git a/code/nel/include/nel/misc/win_thread.h b/code/nel/include/nel/misc/win_thread.h index a2e8b5389..628942dde 100644 --- a/code/nel/include/nel/misc/win_thread.h +++ b/code/nel/include/nel/misc/win_thread.h @@ -49,6 +49,7 @@ public: virtual void wait(); virtual bool setCPUMask(uint64 cpuMask); virtual uint64 getCPUMask(); + virtual void setPriority(TThreadPriority priority); virtual std::string getUserName(); virtual IRunnable *getRunnable() @@ -69,8 +70,7 @@ public: void suspend(); // Resume the thread. No-op if already resumed void resume(); - // set priority as defined by "SetThreadpriority" - void setPriority(int priority); + // Priority boost void enablePriorityBoost(bool enabled); /// private use diff --git a/code/nel/include/nel/net/module_builder_parts.h b/code/nel/include/nel/net/module_builder_parts.h index b080e521f..d2e653315 100644 --- a/code/nel/include/nel/net/module_builder_parts.h +++ b/code/nel/include/nel/net/module_builder_parts.h @@ -188,8 +188,8 @@ namespace NLNET // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} - bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message) {return false;} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy * /* moduleProxy */) {} + bool fwdOnProcessModuleMessage(NLNET::IModuleProxy * /* sender */, const NLNET::CMessage &/* message */) {return false;} // check module up void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) diff --git a/code/nel/include/nel/net/service.h b/code/nel/include/nel/net/service.h index 316a9ce0f..6097a535f 100644 --- a/code/nel/include/nel/net/service.h +++ b/code/nel/include/nel/net/service.h @@ -42,6 +42,20 @@ namespace NLMISC class CWindowDisplayer; } +#if defined(NL_OS_WINDOWS) && defined(_WINDOWS) +#ifndef WINAPI +#define WINAPI __stdcall +#endif +#ifndef APIENTRY +#define APIENTRY WINAPI +#endif + +struct HINSTANCE__; +typedef struct HINSTANCE__ *HINSTANCE; + +typedef char CHAR; +typedef CHAR *LPSTR; +#endif namespace NLNET { diff --git a/code/nel/include/nel/net/transport_class.h b/code/nel/include/nel/net/transport_class.h index 2517da64b..f1110e492 100644 --- a/code/nel/include/nel/net/transport_class.h +++ b/code/nel/include/nel/net/transport_class.h @@ -335,7 +335,7 @@ protected: T *Value; - virtual void serialDefaultValue (NLMISC::IStream &f) + virtual void serialDefaultValue (NLMISC::IStream &/* f */) { // nothing } diff --git a/code/nel/include/nel/sound/audio_decoder.h b/code/nel/include/nel/sound/audio_decoder.h new file mode 100644 index 000000000..3babc1de1 --- /dev/null +++ b/code/nel/include/nel/sound/audio_decoder.h @@ -0,0 +1,107 @@ +/** + * \file audio_decoder.h + * \brief IAudioDecoder + * \date 2012-04-11 09:34GMT + * \author Jan Boon (Kaetemi) + * IAudioDecoder + */ + +/* + * Copyright (C) 2008-2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#ifndef NLSOUND_AUDIO_DECODER_H +#define NLSOUND_AUDIO_DECODER_H +#include + +// STL includes + +// NeL includes + +// Project includes + +namespace NLSOUND { + +/** + * \brief IAudioDecoder + * \date 2008-08-30 11:38GMT + * \author Jan Boon (Kaetemi) + * IAudioDecoder is only used by the driver implementation to stream + * music files into a readable format (it's a simple decoder interface). + * You should not call these functions (getSongTitle) on nlsound or user level, + * as a driver might have additional music types implemented. + * TODO: Split IAudioDecoder into IAudioDecoder (actual decoding) and IMediaDemuxer (stream splitter), and change the interface to make more sense. + * TODO: Allow user application to register more decoders. + * TODO: Look into libavcodec for decoding audio? + */ +class IAudioDecoder +{ +private: + // pointers + /// Stream from file created by IAudioDecoder + NLMISC::IStream *_InternalStream; + +public: + IAudioDecoder(); + virtual ~IAudioDecoder(); + + /// Create a new music buffer, may return NULL if unknown type, destroy with delete. Filepath lookup done here. If async is true, it will stream from hd, else it will load in memory first. + static IAudioDecoder *createAudioDecoder(const std::string &filepath, bool async, bool loop); + + /// Create a new music buffer from a stream, type is file extension like "ogg" etc. + static IAudioDecoder *createAudioDecoder(const std::string &type, NLMISC::IStream *stream, bool loop); + + /// Get information on a music file (only artist and title at the moment). + static bool getInfo(const std::string &filepath, std::string &artist, std::string &title); + + /// Get audio/container extensions that are currently supported by the nel sound library. + static void getMusicExtensions(std::vector &extensions); + + /// Return if a music extension is supported by the nel sound library. + static bool isMusicExtensionSupported(const std::string &extension); + + /// Get how many bytes the music buffer requires for output minimum. + virtual uint32 getRequiredBytes() = 0; + + /// Get an amount of bytes between minimum and maximum (can be lower than minimum if at end). + virtual uint32 getNextBytes(uint8 *buffer, uint32 minimum, uint32 maximum) = 0; + + /// Get the amount of channels (2 is stereo) in output. + virtual uint8 getChannels() = 0; + + /// Get the samples per second (often 44100) in output. + virtual uint getSamplesPerSec() = 0; + + /// Get the bits per sample (often 16) in output. + virtual uint8 getBitsPerSample() = 0; + + /// Get if the music has ended playing (never true if loop). + virtual bool isMusicEnded() = 0; + + /// Get the total time in seconds. + virtual float getLength() = 0; + + /// Set looping + virtual void setLooping(bool loop) = 0; +}; /* class IAudioDecoder */ + +} /* namespace NLSOUND */ + +#endif /* #ifndef NLSOUND_AUDIO_DECODER_H */ + +/* end of file */ diff --git a/code/nel/include/nel/sound/driver/music_buffer_vorbis.h b/code/nel/include/nel/sound/audio_decoder_vorbis.h similarity index 50% rename from code/nel/include/nel/sound/driver/music_buffer_vorbis.h rename to code/nel/include/nel/sound/audio_decoder_vorbis.h index 978f393da..bd7e45019 100644 --- a/code/nel/include/nel/sound/driver/music_buffer_vorbis.h +++ b/code/nel/include/nel/sound/audio_decoder_vorbis.h @@ -1,21 +1,33 @@ -// 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 NLSOUND_MUSIC_BUFFER_VORBIS_H -#define NLSOUND_MUSIC_BUFFER_VORBIS_H +/** + * \file audio_decoder_vorbis.h + * \brief CAudioDecoderVorbis + * \date 2012-04-11 09:35GMT + * \author Jan Boon (Kaetemi) + * CAudioDecoderVorbis + */ + +/* + * Copyright (C) 2008-2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#ifndef NLSOUND_AUDIO_DECODER_VORBIS_H +#define NLSOUND_AUDIO_DECODER_VORBIS_H +#include // STL includes @@ -30,21 +42,20 @@ #endif // NeL includes +#include // Project includes -#include "music_buffer.h" -namespace NLSOUND -{ +namespace NLSOUND { /** - * \brief CMusicBufferVorbis + * \brief CAudioDecoderVorbis * \date 2008-08-30 11:38GMT * \author Jan Boon (Kaetemi) - * CMusicBufferVorbis - * Create trough IMusicBuffer, type "ogg" + * CAudioDecoderVorbis + * Create trough IAudioDecoder, type "ogg" */ -class CMusicBufferVorbis : public IMusicBuffer +class CAudioDecoderVorbis : public IAudioDecoder { protected: // outside pointers @@ -59,8 +70,8 @@ protected: sint32 _StreamOffset; sint32 _StreamSize; public: - CMusicBufferVorbis(NLMISC::IStream *stream, bool loop); - virtual ~CMusicBufferVorbis(); + CAudioDecoderVorbis(NLMISC::IStream *stream, bool loop); + virtual ~CAudioDecoderVorbis(); inline NLMISC::IStream *getStream() { return _Stream; } inline sint32 getStreamSize() { return _StreamSize; } inline sint32 getStreamOffset() { return _StreamOffset; } @@ -78,7 +89,7 @@ public: virtual uint8 getChannels(); /// Get the samples per second (often 44100) in output. - virtual uint32 getSamplesPerSec(); + virtual uint getSamplesPerSec(); /// Get the bits per sample (often 16) in output. virtual uint8 getBitsPerSample(); @@ -89,12 +100,12 @@ public: /// Get the total time in seconds. virtual float getLength(); - /// Get the size of uncompressed data in bytes. - virtual uint getUncompressedSize(); -}; /* class CMusicBufferVorbis */ + /// Set looping + virtual void setLooping(bool loop); +}; /* class CAudioDecoderVorbis */ } /* namespace NLSOUND */ -#endif /* #ifndef NLSOUND_MUSIC_BUFFER_VORBIS_H */ +#endif /* #ifndef NLSOUND_AUDIO_DECODER_VORBIS_H */ /* end of file */ diff --git a/code/nel/include/nel/sound/audio_mixer_user.h b/code/nel/include/nel/sound/audio_mixer_user.h index 7cd0de051..9c9fd5c86 100644 --- a/code/nel/include/nel/sound/audio_mixer_user.h +++ b/code/nel/include/nel/sound/audio_mixer_user.h @@ -34,6 +34,11 @@ #include "nel/sound/mixing_track.h" #include "nel/sound/sound.h" #include "nel/sound/music_channel_fader.h" +#include "nel/sound/group_controller_root.h" + +// Current version is 2, Ryzom Live uses 1 +// Provided to allow compatibility with old binary files +#define NLSOUND_SHEET_VERSION_BUILT 1 namespace NLLIGO { class CLigoConfig; @@ -51,26 +56,6 @@ namespace NLSOUND { class CMusicSoundManager; class IReverbEffect; -/// Hasher functor for hashed container with pointer key. -template -struct THashPtr : public std::unary_function -{ - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; - size_t operator () (const Pointer &ptr) const - { - //CHashSet::hasher h; - // transtype the pointer into int then hash it - //return h.operator()(uint(uintptr_t(ptr))); - return (size_t)(uintptr_t)ptr; - } - inline bool operator() (const Pointer &ptr1, const Pointer &ptr2) const - { - // delegate the work to someone else as well? - return (uintptr_t)ptr1 < (uintptr_t)ptr2; - } -}; - /** * Implementation of UAudioMixer * @@ -197,6 +182,9 @@ public: /// Get a TSoundId from a name (returns NULL if not found) virtual TSoundId getSoundId( const NLMISC::TStringId &name ); + /// Gets the group controller for the given group tree path with separator '/', if it doesn't exist yet it will be created. + /// Examples: "music", "effects", "dialog", "music/background", "music/loading", "music/player", etcetera + virtual UGroupController *getGroupController(const std::string &path); /** Add a logical sound source (returns NULL if name not found). * If spawn is true, the source will auto-delete after playing. If so, the return USource* pointer @@ -204,9 +192,9 @@ public: * pass a callback function that will be called (if not NULL) just before deleting the spawned * source. */ - virtual USource *createSource( const NLMISC::TStringId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *cbUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0 ); + virtual USource *createSource( const NLMISC::TStringId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *cbUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL); /// Add a logical sound source (by sound id). To remove a source, just delete it. See createSource(const char*) - virtual USource *createSource( TSoundId id, bool spawn=false, TSpawnEndCallback cb=NULL, void *cbUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0 ); + virtual USource *createSource( TSoundId id, bool spawn=false, TSpawnEndCallback cb=NULL, void *cbUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL); /// Add a source which was created by an EnvSound void addSource( CSourceCommon *source ); /** Delete a logical sound source. If you don't call it, the source will be auto-deleted @@ -242,6 +230,8 @@ public: virtual uint getSourcesInstanceCount() const { return (uint)_Sources.size(); } /// Return the number of playing sources (slow) virtual uint getPlayingSourcesCount() const; + uint countPlayingSimpleSources() const; // debug + uint countSimpleSources() const; // debug /// Return the number of available tracks virtual uint getAvailableTracksCount() const; /// Return the number of used tracks @@ -415,6 +405,7 @@ public: /// Add a source for play as possible (for non discadable sound) void addSourceWaitingForPlay(CSourceCommon *source); + void removeSourceWaitingForPlay(CSourceCommon *source); /// Read all user controled var sheets void initUserVar(); @@ -431,8 +422,6 @@ private: // utility function for automatic sample bank loading. bool tryToLoadSampleBank(const std::string &sampleName); - - typedef CHashSet > TSourceContainer; typedef CHashSet > TMixerUpdateContainer; typedef CHashMap, THashPtr > TBufferToSourceContainer; // typedef std::multimap TTimedEventContainer; @@ -565,6 +554,9 @@ private: // Instance of the background music manager CMusicSoundManager *_BackgroundMusicManager; + /// Group controller + CGroupControllerRoot _GroupController; + public: struct TSampleBankHeader { diff --git a/code/nel/include/nel/sound/background_source.h b/code/nel/include/nel/sound/background_source.h index cdf044776..14ea1cf53 100644 --- a/code/nel/include/nel/sound/background_source.h +++ b/code/nel/include/nel/sound/background_source.h @@ -36,7 +36,7 @@ class CBackgroundSource : public CSourceCommon , public CAudioMixerUser::IMixerU { public: /// Constructor - CBackgroundSource (CBackgroundSound *backgroundSound=NULL, bool spawn=false, TSpawnEndCallback cb=0, void *cbUserParam = 0, NL3D::CCluster *cluster = 0); + CBackgroundSource (CBackgroundSound *backgroundSound=NULL, bool spawn=false, TSpawnEndCallback cb=0, void *cbUserParam = 0, NL3D::CCluster *cluster = 0, CGroupController *groupController = NULL); /// Destructor ~CBackgroundSource (); diff --git a/code/nel/include/nel/sound/complex_source.h b/code/nel/include/nel/sound/complex_source.h index d27b5af5b..d1135b1ad 100644 --- a/code/nel/include/nel/sound/complex_source.h +++ b/code/nel/include/nel/sound/complex_source.h @@ -34,7 +34,7 @@ class CComplexSource : public CSourceCommon, public CAudioMixerUser::IMixerEvent { public: /// Constructor - CComplexSource (CComplexSound *soundPattern=NULL, bool spawn=false, TSpawnEndCallback cb=0, void *cbUserParam = 0, NL3D::CCluster *cluster = 0); + CComplexSource (CComplexSound *soundPattern=NULL, bool spawn=false, TSpawnEndCallback cb=0, void *cbUserParam = 0, NL3D::CCluster *cluster = 0, CGroupController *groupController = NULL); /// Destructor ~CComplexSource (); diff --git a/code/nel/include/nel/sound/containers.h b/code/nel/include/nel/sound/containers.h new file mode 100644 index 000000000..bd4fe7fb9 --- /dev/null +++ b/code/nel/include/nel/sound/containers.h @@ -0,0 +1,67 @@ +/** + * \file containers.h + * \brief CContainers + * \date 2012-04-10 13:57GMT + * \author Unknown (Unknown) + * CContainers + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#ifndef NLSOUND_CONTAINERS_H +#define NLSOUND_CONTAINERS_H +#include + +// STL includes + +// NeL includes + +// Project includes + +namespace NLSOUND { + class CSourceCommon; + +/// Hasher functor for hashed container with pointer key. +template +struct THashPtr : public std::unary_function +{ + static const size_t bucket_size = 4; + static const size_t min_buckets = 8; + size_t operator () (const Pointer &ptr) const + { + //CHashSet::hasher h; + // transtype the pointer into int then hash it + //return h.operator()(uint(uintptr_t(ptr))); + return (size_t)(uintptr_t)ptr; + } + inline bool operator() (const Pointer &ptr1, const Pointer &ptr2) const + { + // delegate the work to someone else as well? + return (uintptr_t)ptr1 < (uintptr_t)ptr2; + } +}; + +typedef CHashSet > TSourceContainer; + +} /* namespace NLSOUND */ + +#endif /* #ifndef NLSOUND_CONTAINERS_H */ + +/* end of file */ diff --git a/code/nel/include/nel/sound/driver/buffer.h b/code/nel/include/nel/sound/driver/buffer.h index 5d488f1c7..27a8d9f00 100644 --- a/code/nel/include/nel/sound/driver/buffer.h +++ b/code/nel/include/nel/sound/driver/buffer.h @@ -48,6 +48,8 @@ public: /// Intel/DVI ADPCM format, only available for 1 channel at 16 bits per sample, encoded at 4 bits per sample. /// This is only implemented in the DSound and XAudio2 driver. FormatDviAdpcm = 11, + /// No format set. Used when a TBufferFormat value has not been set to any value yet. + FormatNotSet = (~0), }; /// The storage mode of this buffer. Also controls the X-RAM extension of OpenAL. enum TStorageMode diff --git a/code/nel/include/nel/sound/driver/music_buffer.h b/code/nel/include/nel/sound/driver/music_buffer.h deleted file mode 100644 index 571e27a31..000000000 --- a/code/nel/include/nel/sound/driver/music_buffer.h +++ /dev/null @@ -1,119 +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 NLSOUND_MUSIC_BUFFER_H -#define NLSOUND_MUSIC_BUFFER_H - -namespace NLMISC -{ - class IStream; - class CIFile; -} - -namespace NLSOUND -{ - - /* - * TODO: Streaming - * Some kind of decent streaming functionality, to get rid of the current music implementation. Audio decoding should be done on nlsound level. IBuffer needs a writable implementation, it allocates and owns the data memory, which can be written to by nlsound. When buffer is written, a function needs to be called to 'finalize' the buffer (so it can be submitted to OpenAL for example). - * Required interface functions, IBuffer: - * /// Allocate a new writable buffer. If this buffer was already allocated, the previous data is released. - * /// May return NULL if the format or frequency is not supported by the driver. - * uint8 *IBuffer::openWritable(uint size, TBufferFormat bufferFormat, uint8 channels, uint8 bitsPerSample, uint32 frequency); - * /// Tell that you are done writing to this buffer, so it can be copied over to hardware if needed. - * /// If keepLocal is true, a local copy of the buffer will be kept (so allocation can be re-used later). - * /// keepLocal overrides the OptionLocalBufferCopy flag. The buffer can use this function internally. - * void IBuffer::lockWritable(bool keepLocal); - * Required interface functions, ISource: - * /// Enable or disable the streaming facilities. - * void ISource::setStreaming(bool streaming); - * /// Submits a new buffer to the stream. A buffer of 100ms length is optimal for streaming. - * /// Should be called by a thread which checks countStreamingBuffers every 100ms - * void ISource::submitStreamingBuffer(IBuffer *buffer); - * /// Returns the number of buffers that are queued (includes playing buffer). 3 buffers is optimal. - * uint ISource::countStreamingBuffers(); - * Other required interface functions, ISource: - * /// Enable or disable 3d calculations (to send directly to speakers). - * void ISource::set3DMode(bool enable); - * For compatibility with music trough fmod, ISoundDriver: - * /// Returns true if the sound driver has a native implementation of IMusicChannel (bad!). - * /// If this returns false, use the nlsound music channel, which goes trough Ctrack/ISource, - * /// The nlsound music channel requires support for IBuffer/ISource streaming. - * bool ISoundDriver::hasMusicChannel(); - */ - -/** - * \brief IMusicBuffer - * \date 2008-08-30 11:38GMT - * \author Jan Boon (Kaetemi) - * IMusicBuffer is only used by the driver implementation to stream - * music files into a readable format (it's a simple decoder interface). - * You should not call these functions (getSongTitle) on nlsound or user level, - * as a driver might have additional music types implemented. - * TODO: Change IMusicBuffer to IAudioDecoder, and change the interface to make more sense. - * TODO: Allow user application to register more decoders. - * TODO: Look into libavcodec for decoding audio. - */ -class IMusicBuffer -{ -private: - // pointers - /// Stream from file created by IMusicBuffer - NLMISC::IStream *_InternalStream; - -public: - IMusicBuffer(); - virtual ~IMusicBuffer(); - - /// Create a new music buffer, may return NULL if unknown type, destroy with delete. Filepath lookup done here. If async is true, it will stream from hd, else it will load in memory first. - static IMusicBuffer *createMusicBuffer(const std::string &filepath, bool async, bool loop); - - /// Create a new music buffer from a stream, type is file extension like "ogg" etc. - static IMusicBuffer *createMusicBuffer(const std::string &type, NLMISC::IStream *stream, bool loop); - - /// Get information on a music file (only artist and title at the moment). - static bool getInfo(const std::string &filepath, std::string &artist, std::string &title); - - /// Get how many bytes the music buffer requires for output minimum. - virtual uint32 getRequiredBytes() =0; - - /// Get an amount of bytes between minimum and maximum (can be lower than minimum if at end). - virtual uint32 getNextBytes(uint8 *buffer, uint32 minimum, uint32 maximum) =0; - - /// Get the amount of channels (2 is stereo) in output. - virtual uint8 getChannels() =0; - - /// Get the samples per second (often 44100) in output. - virtual uint32 getSamplesPerSec() =0; - - /// Get the bits per sample (often 16) in output. - virtual uint8 getBitsPerSample() =0; - - /// Get if the music has ended playing (never true if loop). - virtual bool isMusicEnded() =0; - - /// Get the total time in seconds. - virtual float getLength() =0; - - /// Get the size of uncompressed data in bytes. - virtual uint getUncompressedSize() =0; -}; /* class IMusicBuffer */ - -} /* namespace NLSOUND */ - -#endif /* #ifndef NLSOUND_MUSIC_BUFFER_H */ - -/* end of file */ diff --git a/code/nel/include/nel/sound/driver/music_channel.h b/code/nel/include/nel/sound/driver/music_channel.h index 9878744c5..116865628 100644 --- a/code/nel/include/nel/sound/driver/music_channel.h +++ b/code/nel/include/nel/sound/driver/music_channel.h @@ -45,6 +45,9 @@ public: /// Stop the music previously loaded and played (the Memory is also freed) virtual void stop() =0; + /// Makes sure any resources are freed, but keeps available for next play call + virtual void reset() =0; + /// Pause the music previously loaded and played (the Memory is not freed) virtual void pause() =0; diff --git a/code/nel/include/nel/sound/driver/sound_driver.h b/code/nel/include/nel/sound/driver/sound_driver.h index 193026a42..c9551f16b 100644 --- a/code/nel/include/nel/sound/driver/sound_driver.h +++ b/code/nel/include/nel/sound/driver/sound_driver.h @@ -39,9 +39,11 @@ namespace NLSOUND #endif /* - * Sound sample format + * Deprecated sound sample format. + * For compatibility with old code. + * Do not modify. */ -enum TSampleFormat { SampleFormatUnknown, Mono8, Mono16ADPCM, Mono16, Stereo8, Stereo16 }; +enum TSampleFormat { Mono8, Mono16ADPCM, Mono16, Stereo8, Stereo16, SampleFormatUnknown = (~0) }; /** * Abstract sound driver (implemented in sound driver dynamic library) diff --git a/code/nel/include/nel/sound/driver/source.h b/code/nel/include/nel/sound/driver/source.h index 1858e6f24..b43c83914 100644 --- a/code/nel/include/nel/sound/driver/source.h +++ b/code/nel/include/nel/sound/driver/source.h @@ -353,7 +353,7 @@ public: * In streaming mode, the time spent during buffer outruns is not * counted towards the playback time, and the playback time is * be the current time position in the entire submitted queue. - * When using static buffers, the result is the tot time that the + * When using static buffers, the result is the total time that the * attached buffer has been playing. If the source is looping, the * time will be the total of all playbacks of the buffer. * When the source is stopped, this will return the time where the @@ -397,7 +397,7 @@ public: virtual void setSourceRelativeMode(bool mode = true) = 0; /// Get the source relative mode virtual bool getSourceRelativeMode() const = 0; - /// Set the min and max distances (default: 1, MAX_FLOAT) (3D mode only) + /// Set the min and max distances (default: 1, sqrt(MAX_FLOAT)) (3D mode only) virtual void setMinMaxDistances(float mindist, float maxdist, bool deferred = true) = 0; /// Get the min and max distances virtual void getMinMaxDistances(float& mindist, float& maxdist) const = 0; diff --git a/code/nel/include/nel/sound/group_controller.h b/code/nel/include/nel/sound/group_controller.h new file mode 100644 index 000000000..25b7034b6 --- /dev/null +++ b/code/nel/include/nel/sound/group_controller.h @@ -0,0 +1,102 @@ +/** + * \file group_controller.h + * \brief CGroupController + * \date 2012-04-10 09:29GMT + * \author Jan Boon (Kaetemi) + * CGroupController + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#ifndef NLSOUND_GROUP_CONTROLLER_H +#define NLSOUND_GROUP_CONTROLLER_H +#include + +// STL includes +#include +#include + +// NeL includes +#include +#include +#include + +// Project includes + +namespace NLSOUND { + class CGroupControllerRoot; + +/** + * \brief CGroupController + * \date 2012-04-10 09:29GMT + * \author Jan Boon (Kaetemi) + * CGroupController + */ +class CGroupController : public UGroupController +{ +public: + friend class CGroupControllerRoot; + +private: + CGroupController *m_Parent; + std::map m_Children; + + /// Gain as set by the interface + float m_Gain; + + /// Gain including parent gain + float m_FinalGain; + + int m_NbSourcesInclChild; + TSourceContainer m_Sources; + +public: + CGroupController(CGroupController *parent); + + /// \name UGroupController + //@{ + virtual void setGain(float gain) { NLMISC::clamp(gain, 0.0f, 1.0f); if (m_Gain != gain) { m_Gain = gain; updateSourceGain(); } } + virtual float getGain() { return m_Gain; } + //@} + + inline float getFinalGain() const { return m_FinalGain; } + + void addSource(CSourceCommon *source); + void removeSource(CSourceCommon *source); + + virtual std::string getPath(); + +protected: + virtual ~CGroupController(); // subnodes can only be deleted by the root + +private: + inline float calculateTotalGain() { return m_Gain; } + virtual void calculateFinalGain(); + virtual void increaseSources(); + virtual void decreaseSources(); + void updateSourceGain(); + +}; /* class CGroupController */ + +} /* namespace NLSOUND */ + +#endif /* #ifndef NLSOUND_GROUP_CONTROLLER_H */ + +/* end of file */ diff --git a/code/nel/include/nel/sound/group_controller_root.h b/code/nel/include/nel/sound/group_controller_root.h new file mode 100644 index 000000000..2081fa28a --- /dev/null +++ b/code/nel/include/nel/sound/group_controller_root.h @@ -0,0 +1,70 @@ +/** + * \file group_controller_root.h + * \brief CGroupControllerRoot + * \date 2012-04-10 09:44GMT + * \author Jan Boon (Kaetemi) + * CGroupControllerRoot + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#ifndef NLSOUND_GROUP_CONTROLLER_ROOT_H +#define NLSOUND_GROUP_CONTROLLER_ROOT_H +#include + +// STL includes + +// NeL includes +#include + +// Project includes +#include + +namespace NLSOUND { + +/** + * \brief CGroupControllerRoot + * \date 2012-04-10 09:44GMT + * \author Jan Boon (Kaetemi) + * CGroupControllerRoot + */ +class CGroupControllerRoot : public CGroupController, public NLMISC::CManualSingleton +{ +public: + CGroupControllerRoot(); + virtual ~CGroupControllerRoot(); + + /// Gets the group controller in a certain path with separator '/', if it doesn't exist yet it will be created. + CGroupController *getGroupController(const std::string &path); + +protected: + virtual std::string getPath(); + virtual void calculateFinalGain(); + virtual void increaseSources(); + virtual void decreaseSources(); + static bool isReservedName(const std::string &nodeName); + +}; /* class CGroupControllerRoot */ + +} /* namespace NLSOUND */ + +#endif /* #ifndef NLSOUND_GROUP_CONTROLLER_ROOT_H */ + +/* end of file */ diff --git a/code/nel/include/nel/sound/music_channel_fader.h b/code/nel/include/nel/sound/music_channel_fader.h index 4e6d35de4..8513c21e5 100644 --- a/code/nel/include/nel/sound/music_channel_fader.h +++ b/code/nel/include/nel/sound/music_channel_fader.h @@ -87,6 +87,8 @@ public: void init(ISoundDriver *soundDriver); void release(); + void reset(); + void update(); // time in seconds inline bool isInitOk() { return _SoundDriver != NULL; } diff --git a/code/nel/include/nel/sound/music_source.h b/code/nel/include/nel/sound/music_source.h index a23547c6c..be09c1837 100644 --- a/code/nel/include/nel/sound/music_source.h +++ b/code/nel/include/nel/sound/music_source.h @@ -35,7 +35,7 @@ class CMusicSource : public CSourceCommon { public: /// Constructor - CMusicSource (class CMusicSound *sound=NULL, bool spawn=false, TSpawnEndCallback cb=0, void *cbUserParam = 0, NL3D::CCluster *cluster = 0); + CMusicSource (class CMusicSound *sound=NULL, bool spawn=false, TSpawnEndCallback cb=0, void *cbUserParam = 0, NL3D::CCluster *cluster = 0, CGroupController *groupController = NULL); /// Destructor ~CMusicSource (); diff --git a/code/nel/include/nel/sound/simple_source.h b/code/nel/include/nel/sound/simple_source.h index ac2af0099..c330fd7fa 100644 --- a/code/nel/include/nel/sound/simple_source.h +++ b/code/nel/include/nel/sound/simple_source.h @@ -40,7 +40,7 @@ class CSimpleSource : public CSourceCommon, public CAudioMixerUser::IMixerEvent { public: /// Constructor - CSimpleSource(CSimpleSound *simpleSound = NULL, bool spawn = false, TSpawnEndCallback cb = 0, void *cbUserParam = 0, NL3D::CCluster *cluster = 0); + CSimpleSource(CSimpleSound *simpleSound = NULL, bool spawn = false, TSpawnEndCallback cb = 0, void *cbUserParam = 0, NL3D::CCluster *cluster = 0, CGroupController *groupController = NULL); /// Destructor virtual ~CSimpleSource(); @@ -97,14 +97,7 @@ public: * 1.0 -> no attenuation * values > 1 (amplification) not supported by most drivers */ - virtual void setGain( float gain ); - /** Set the gain amount (value inside [0, 1]) to map between 0 and the nominal gain - * (which is getSource()->getGain()). Does nothing if getSource() is null. - */ - virtual void setRelativeGain( float gain ); - /** Shift the frequency. 1.0f equals identity, each reduction of 50% equals a pitch shift - * of one octave. 0 is not a legal value. - */ + virtual void updateFinalGain(); virtual void setPitch( float pitch ); /// Set the source relative mode. If true, positions are interpreted relative to the listener position (default: false) virtual void setSourceRelativeMode( bool mode ); @@ -149,6 +142,8 @@ private: /// True when the sound is played muted and until the mixer event notifying the end. bool _PlayMuted; + bool _WaitingForPlay; + }; diff --git a/code/nel/include/nel/sound/sound.h b/code/nel/include/nel/sound/sound.h index 2112a0e73..e9d4f755c 100644 --- a/code/nel/include/nel/sound/sound.h +++ b/code/nel/include/nel/sound/sound.h @@ -30,6 +30,7 @@ namespace NLSOUND { class ISoundDriver; class IBuffer; class CSound; +class CGroupController; /// Sound names hash map @@ -60,8 +61,9 @@ public: SOUND_COMPLEX, SOUND_BACKGROUND, SOUND_CONTEXT, - SOUND_MUSIC, - SOUND_STREAM + SOUND_MUSIC, // soon to be deprecated hopefully + SOUND_STREAM, + SOUND_STREAM_FILE }; @@ -104,6 +106,8 @@ public: /// Return the max distance (if detailed()) virtual float getMaxDistance() const { return _MaxDist; } + inline CGroupController *getGroupController() const { return _GroupController; } + /// Set looping void setLooping( bool looping ) { _Looping = looping; } @@ -142,6 +146,9 @@ protected: /// An optional user var controler. NLMISC::TStringId _UserVarControler; + /// The group controller, always exists, owned by the audio mixer + CGroupController *_GroupController; + }; diff --git a/code/nel/include/nel/sound/source_common.h b/code/nel/include/nel/sound/source_common.h index 7781cfb02..1180fd68e 100644 --- a/code/nel/include/nel/sound/source_common.h +++ b/code/nel/include/nel/sound/source_common.h @@ -22,7 +22,7 @@ #include "nel/sound/u_stream_source.h" #include "nel/3d/cluster.h" #include "nel/sound/sound.h" - +#include "nel/sound/group_controller.h" namespace NLSOUND { @@ -36,11 +36,13 @@ public: SOURCE_SIMPLE, SOURCE_COMPLEX, SOURCE_BACKGROUND, - SOURCE_MUSIC, - SOURCE_STREAM + SOURCE_MUSIC, // DEPRECATED + SOURCE_STREAM, + SOURCE_STREAM_FILE }; - CSourceCommon(TSoundId id, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster); + /// When groupController is NULL it will use the groupcontroller specified in the TSoundId. You should manually specify the groupController if this source is a child of another source, so that the parent source controller of the user-specified .sound file is the one that will be used. + CSourceCommon(TSoundId id, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController); ~CSourceCommon(); @@ -63,6 +65,8 @@ public: void setGain( float gain ); void setRelativeGain( float gain ); float getRelativeGain() const; + /// Called whenever the gain is changed trough setGain, setRelativeGain or the group controller's gain settings change. + virtual void updateFinalGain() { } void setSourceRelativeMode( bool mode ); /// return the user param for the user callback void *getCallbackUserParam(void) const { return _CbUserParam; } @@ -74,6 +78,8 @@ public: virtual void getDirection( NLMISC::CVector& dir ) const { dir = _Direction; } /// Get the gain virtual float getGain() const { return _Gain; } + /// Get the final gain, including group controller changes. Use this when setting the physical source output gain. + inline float getFinalGain() const { return _Gain * _GroupController->getFinalGain(); } /// Get the pitch virtual float getPitch() const { return _Pitch; } /// Get the source relative mode @@ -99,15 +105,15 @@ public: /// \name Streaming source controls //@{ /// Set the sample format. (channels = 1, 2, ...; bitsPerSample = 8, 16; frequency = samples per second, 44100, ...) - virtual void setFormat(uint8 channels, uint8 bitsPerSample, uint32 frequency) { nlassert(false); } + virtual void setFormat(uint8 /* channels */, uint8 /* bitsPerSample */, uint32 /* frequency */) { nlassert(false); } /// Return the sample format information. - virtual void getFormat(uint8 &channels, uint8 &bitsPerSample, uint32 &frequency) const { nlassert(false); } + virtual void getFormat(uint8 &/* channels */, uint8 &/* bitsPerSample */, uint32 &/* frequency */) const { nlassert(false); } /// Get a writable pointer to the buffer of specified size. Use capacity to specify the required bytes. Returns NULL when all the buffer space is already filled. Call setFormat() first. - virtual uint8 *lock(uint capacity) { nlassert(false); return NULL; } + virtual uint8 *lock(uint /* capacity */) { nlassert(false); return NULL; } /// Notify that you are done writing to the locked buffer, so it can be copied over to hardware if needed. Set size to the number of bytes actually written to the buffer. Returns true if ok. - virtual bool unlock(uint size) { nlassert(false); return false; } + virtual bool unlock(uint /* size */) { nlassert(false); return false; } /// Get the recommended buffer size to use with lock()/unlock() - virtual void getRecommendedBufferSize(uint &samples, uint &bytes) const { nlassert(false); } + virtual void getRecommendedBufferSize(uint &/* samples */, uint &/* bytes */) const { nlassert(false); } /// Get the recommended sleep time based on the size of the last submitted buffer and the available buffer space virtual uint32 getRecommendedSleepTime() const { nlassert(false); return 0; } /// Return if there are still buffers available for playback. @@ -145,6 +151,9 @@ protected: /// An optional user var controler. NLMISC::TStringId _UserVarControler; + /// Group controller for gain + CGroupController *_GroupController; + }; } // NLSOUND diff --git a/code/nel/include/nel/sound/source_music_channel.h b/code/nel/include/nel/sound/source_music_channel.h new file mode 100644 index 000000000..7ec71fb66 --- /dev/null +++ b/code/nel/include/nel/sound/source_music_channel.h @@ -0,0 +1,100 @@ +/** + * \file source_music_channel.h + * \brief CSourceMusicChannel + * \date 2012-04-11 16:08GMT + * \author Jan Boon (Kaetemi) + * CSourceMusicChannel + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#ifndef NLSOUND_SOURCE_MUSIC_CHANNEL_H +#define NLSOUND_SOURCE_MUSIC_CHANNEL_H +#include + +// STL includes + +// NeL includes +#include +#include + +// Project includes + +namespace NLSOUND { + class CStreamFileSource; + +/** + * \brief CSourceMusicChannel + * \date 2012-04-11 16:08GMT + * \author Jan Boon (Kaetemi) + * CSourceMusicChannel + */ +class CSourceMusicChannel : public IMusicChannel +{ +public: + CSourceMusicChannel(); + virtual ~CSourceMusicChannel(); + + /** Play some music (.ogg etc...) + * NB: if an old music was played, it is first stop with stopMusic() + * \param filepath file path, CPath::lookup is done here + * \param async stream music from hard disk, preload in memory if false + * \param loop must be true to play the music in loop. + */ + virtual bool play(const std::string &filepath, bool async, bool loop); + + /// Stop the music previously loaded and played (the Memory is also freed) + virtual void stop(); + + /// Makes sure any resources are freed, but keeps available for next play call + virtual void reset(); + + /// Pause the music previously loaded and played (the Memory is not freed) + virtual void pause(); + + /// Resume the music previously paused + virtual void resume(); + + /// Return true if a song is finished. + virtual bool isEnded(); + + /// Return true if the song is still loading asynchronously and hasn't started playing yet (false if not async), used to delay fading + virtual bool isLoadingAsync(); + + /// Return the total length (in second) of the music currently played + virtual float getLength(); + + /** Set the music volume (if any music played). (volume value inside [0 , 1]) (default: 1) + * NB: the volume of music is NOT affected by IListener::setGain() + */ + virtual void setVolume(float gain); + +private: + CStreamFileSound m_Sound; + CStreamFileSource *m_Source; + float m_Gain; + +}; /* class CSourceMusicChannel */ + +} /* namespace NLSOUND */ + +#endif /* #ifndef NLSOUND_SOURCE_MUSIC_CHANNEL_H */ + +/* end of file */ diff --git a/code/nel/include/nel/sound/stream_file_sound.h b/code/nel/include/nel/sound/stream_file_sound.h new file mode 100644 index 000000000..8c1cc1634 --- /dev/null +++ b/code/nel/include/nel/sound/stream_file_sound.h @@ -0,0 +1,94 @@ +/** + * \file stream_file_sound.h + * \brief CStreamFileSound + * \date 2012-04-11 09:57GMT + * \author Jan Boon (Kaetemi) + * CStreamFileSound + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#ifndef NLSOUND_STREAM_FILE_SOUND_H +#define NLSOUND_STREAM_FILE_SOUND_H +#include + +// STL includes + +// NeL includes + +// Project includes +#include + +namespace NLSOUND { + class CSourceMusicChannel; + +/** + * \brief CStreamFileSound + * \date 2012-04-11 09:57GMT + * \author Jan Boon (Kaetemi) + * CStreamFileSound + */ +class CStreamFileSound : public CStreamSound +{ +public: + friend class CSourceMusicChannel; + +public: + CStreamFileSound(); + virtual ~CStreamFileSound(); + + /// Get the type of the sound. + virtual TSOUND_TYPE getSoundType() { return SOUND_STREAM_FILE; } + + /// Load the sound parameters from georges' form + virtual void importForm(const std::string& filename, NLGEORGES::UFormElm& formRoot); + + /// Used by the george sound plugin to check sound recursion (ie sound 'toto' use sound 'titi' witch also use sound 'toto' ...). + virtual void getSubSoundList(std::vector > &/* subsounds */) const { } + + /// Serialize the sound data. + virtual void serial(NLMISC::IStream &s); + + /// Return the length of the sound in ms + virtual uint32 getDuration() { return 0; } + + inline bool getAsync() { return m_Async; } + + inline const std::string &getFilePath() { return m_FilePath; } + +private: + /// Used by CSourceMusicChannel to set the filePath and default settings on other parameters. + void setMusicFilePath(const std::string &filePath, bool async = true, bool loop = false); + +private: + CStreamFileSound(const CStreamFileSound &); + CStreamFileSound &operator=(const CStreamFileSound &); + +private: + bool m_Async; + std::string m_FilePath; + +}; /* class CStreamFileSound */ + +} /* namespace NLSOUND */ + +#endif /* #ifndef NLSOUND_STREAM_FILE_SOUND_H */ + +/* end of file */ diff --git a/code/nel/include/nel/sound/stream_file_source.h b/code/nel/include/nel/sound/stream_file_source.h new file mode 100644 index 000000000..0cfee14d1 --- /dev/null +++ b/code/nel/include/nel/sound/stream_file_source.h @@ -0,0 +1,110 @@ +/** + * \file stream_file_source.h + * \brief CStreamFileSource + * \date 2012-04-11 09:57GMT + * \author Jan Boon (Kaetemi) + * CStreamFileSource + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#ifndef NLSOUND_STREAM_FILE_SOURCE_H +#define NLSOUND_STREAM_FILE_SOURCE_H +#include + +// STL includes + +// NeL includes +#include + +// Project includes +#include +#include + +namespace NLSOUND { + class IAudioDecoder; + +/** + * \brief CStreamFileSource + * \date 2012-04-11 09:57GMT + * \author Jan Boon (Kaetemi) + * CStreamFileSource + */ +class CStreamFileSource : public CStreamSource, private NLMISC::IRunnable +{ +public: + CStreamFileSource(CStreamFileSound *streamFileSound = NULL, bool spawn = false, TSpawnEndCallback cb = 0, void *cbUserParam = 0, NL3D::CCluster *cluster = 0, CGroupController *groupController = NULL); + virtual ~CStreamFileSource(); + + /// Return the source type + TSOURCE_TYPE getType() const { return SOURCE_STREAM_FILE; } + + /// \name Playback control + //@{ + /// Play + virtual void play(); + /// Stop playing + virtual void stop(); + /// Get playing state. Return false even if the source has stopped on its own. + virtual bool isPlaying(); + /// Pause (following legacy music channel implementation) + void pause(); + /// Resume (following legacy music channel implementation) + void resume(); + /// check if song ended (following legacy music channel implementation) + bool isEnded(); + /// (following legacy music channel implementation) + float getLength(); + /// check if still loading (following legacy music channel implementation) + bool isLoadingAsync(); + //@} + + /// \name Decoding thread + //@{ + virtual void getName (std::string &result) const { result = "CStreamFileSource"; } + virtual void run(); + //@} + + // TODO: getTime + +private: + bool prepareDecoder(); + inline bool bufferMore(uint bytes); + +private: + CStreamFileSource(const CStreamFileSource &); + CStreamFileSource &operator=(const CStreamFileSource &); + +private: + inline CStreamFileSound *getStreamFileSound() { return static_cast(m_StreamSound); } + + NLMISC::IThread *m_Thread; + + IAudioDecoder *m_AudioDecoder; + + bool m_Paused; + +}; /* class CStreamFileSource */ + +} /* namespace NLSOUND */ + +#endif /* #ifndef NLSOUND_STREAM_FILE_SOURCE_H */ + +/* end of file */ diff --git a/code/nel/include/nel/sound/stream_sound.h b/code/nel/include/nel/sound/stream_sound.h index 39e6c733c..4b0debe0c 100644 --- a/code/nel/include/nel/sound/stream_sound.h +++ b/code/nel/include/nel/sound/stream_sound.h @@ -46,7 +46,7 @@ public: virtual void importForm(const std::string& filename, NLGEORGES::UFormElm& formRoot); /// Used by the george sound plugin to check sound recursion (ie sound 'toto' use sound 'titi' witch also use sound 'toto' ...). - virtual void getSubSoundList(std::vector > &subsounds) const { } + virtual void getSubSoundList(std::vector > &/* subsounds */) const { } /// Serialize the sound data. virtual void serial(NLMISC::IStream &s); diff --git a/code/nel/include/nel/sound/stream_source.h b/code/nel/include/nel/sound/stream_source.h index a5ac7c9f8..40ed82e11 100644 --- a/code/nel/include/nel/sound/stream_source.h +++ b/code/nel/include/nel/sound/stream_source.h @@ -41,7 +41,7 @@ namespace NLSOUND { class CStreamSource : public CSourceCommon { public: - CStreamSource(CStreamSound *streamSound = NULL, bool spawn = false, TSpawnEndCallback cb = 0, void *cbUserParam = 0, NL3D::CCluster *cluster = 0); + CStreamSource(CStreamSound *streamSound = NULL, bool spawn = false, TSpawnEndCallback cb = 0, void *cbUserParam = 0, NL3D::CCluster *cluster = 0, CGroupController *groupController = NULL); virtual ~CStreamSource(); /// Return the sound binded to the source (or NULL if there is no sound) @@ -55,6 +55,9 @@ public: virtual void setLooping(bool l); /// Play virtual void play(); +protected: + void stopInt(); +public: /// Stop playing virtual void stop(); /// Get playing state. Return false even if the source has stopped on its own. @@ -80,18 +83,7 @@ public: virtual void setVelocity(const NLMISC::CVector& vel); /// Set the direction vector (3D mode only, ignored in stereo mode) (default: (0,0,0) as non-directional) virtual void setDirection(const NLMISC::CVector& dir); - /** Set the gain (volume value inside [0 , 1]). (default: 1) - * 0.0 -> silence - * 0.5 -> -6dB - * 1.0 -> no attenuation - * values > 1 (amplification) not supported by most drivers - */ - virtual void setGain(float gain); - - /** Set the gain amount (value inside [0, 1]) to map between 0 and the nominal gain - * (which is getSource()->getGain()). Does nothing if getSource() is null. - */ - virtual void setRelativeGain(float gain); + virtual void updateFinalGain(); /** Shift the frequency. 1.0f equals identity, each reduction of 50% equals a pitch shift * of one octave. 0 is not a legal value. */ @@ -118,6 +110,9 @@ public: virtual bool hasFilledBuffersAvailable() const; //@} + /// Prepare the buffers in this stream for the given maximum capacity. (TODO: Move this into UStreamSource) + void preAllocate(uint capacity); + /// Return the track CTrack *getTrack() { return m_Track; } @@ -125,7 +120,7 @@ private: CStreamSource(const CStreamSource &); CStreamSource &operator=(const CStreamSource &); -private: +protected: /// Return the source type TSOURCE_TYPE getType() const { return SOURCE_STREAM; } @@ -173,7 +168,13 @@ private: /// The bytes per second according to the buffer format uint m_BytesPerSecond; - + + /// Waiting for play for high priority sources + bool m_WaitingForPlay; + + /// Inverse pitch + float m_PitchInv; + }; /* class CStreamSource */ } /* namespace NLSOUND */ diff --git a/code/nel/include/nel/sound/u_audio_mixer.h b/code/nel/include/nel/sound/u_audio_mixer.h index e1c2a274e..c4702c3f8 100644 --- a/code/nel/include/nel/sound/u_audio_mixer.h +++ b/code/nel/include/nel/sound/u_audio_mixer.h @@ -20,6 +20,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/string_mapper.h" #include "nel/sound/u_source.h" +#include "nel/sound/u_group_controller.h" #include "nel/ligo/primitive.h" #include @@ -285,15 +286,19 @@ public: /// Get a TSoundId from a name (returns NULL if not found) virtual TSoundId getSoundId( const NLMISC::TStringId &name ) = 0; + /// Gets the group controller for the given group tree path with separator '/', if it doesn't exist yet it will be created. + /// Examples: "music", "effects", "dialog", "music/background", "music/loading", "music/player", etcetera + virtual UGroupController *getGroupController(const std::string &path) = 0; + /** Add a logical sound source (returns NULL if name not found). * If spawn is true, the source will auto-delete after playing. If so, the return USource* pointer * is valid only before the time when calling play() plus the duration of the sound. You can * pass a callback function that will be called (if not NULL) just before deleting the spawned * source. */ - virtual USource *createSource( const NLMISC::TStringId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *callbackUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context=0) = 0; + virtual USource *createSource(const NLMISC::TStringId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *callbackUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL) = 0; /// Add a logical sound source (by sound id). To remove a source, just delete it. See createSource(const char*) - virtual USource *createSource( TSoundId id, bool spawn=false, TSpawnEndCallback cb=NULL, void *callbackUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context=0 ) = 0; + virtual USource *createSource(TSoundId id, bool spawn=false, TSpawnEndCallback cb=NULL, void *callbackUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL) = 0; /** Use this method to set the listener position instead of using getListener->setPos(); * It's because we have to update the background sounds in this case. diff --git a/code/nel/include/nel/sound/u_group_controller.h b/code/nel/include/nel/sound/u_group_controller.h new file mode 100644 index 000000000..5aadeb25c --- /dev/null +++ b/code/nel/include/nel/sound/u_group_controller.h @@ -0,0 +1,65 @@ +/** + * \file u_group_controller.h + * \brief UGroupController + * \date 2012-04-10 12:49GMT + * \author Jan Boon (Kaetemi) + * UGroupController + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#ifndef NLSOUND_U_GROUP_CONTROLLER_H +#define NLSOUND_U_GROUP_CONTROLLER_H +#include + +// STL includes + +// NeL includes + +// Project includes + +#define NLSOUND_SHEET_V1_DEFAULT_SOUND_GROUP_CONTROLLER "sound:effects:game" +#define NLSOUND_SHEET_V1_DEFAULT_SOUND_MUSIC_GROUP_CONTROLLER "sound:music:game" +#define NLSOUND_SHEET_V1_DEFAULT_SOUND_STREAM_GROUP_CONTROLLER "sound:dialog:game" + +namespace NLSOUND { + +/** + * \brief UGroupController + * \date 2012-04-10 12:49GMT + * \author Jan Boon (Kaetemi) + * UGroupController + */ +class UGroupController +{ +public: + virtual void setGain(float gain) = 0; + virtual float getGain() = 0; + +protected: + virtual ~UGroupController() { } + +}; /* class UGroupController */ + +} /* namespace NLSOUND */ + +#endif /* #ifndef NLSOUND_U_GROUP_CONTROLLER_H */ + +/* end of file */ diff --git a/code/nel/samples/CMakeLists.txt b/code/nel/samples/CMakeLists.txt index 4f38264a0..5abcd985a 100644 --- a/code/nel/samples/CMakeLists.txt +++ b/code/nel/samples/CMakeLists.txt @@ -17,5 +17,5 @@ IF(WITH_PACS) ENDIF(WITH_PACS) IF(WITH_SOUND) - ADD_SUBDIRECTORY(sound_sources) + ADD_SUBDIRECTORY(sound) ENDIF(WITH_SOUND) diff --git a/code/nel/samples/sound/CMakeLists.txt b/code/nel/samples/sound/CMakeLists.txt new file mode 100644 index 000000000..6a7696fa4 --- /dev/null +++ b/code/nel/samples/sound/CMakeLists.txt @@ -0,0 +1,5 @@ + +ADD_SUBDIRECTORY(sound_sources) +ADD_SUBDIRECTORY(stream_file) +ADD_SUBDIRECTORY(stream_ogg_vorbis) + diff --git a/code/nel/samples/sound_sources/CMakeLists.txt b/code/nel/samples/sound/sound_sources/CMakeLists.txt similarity index 85% rename from code/nel/samples/sound_sources/CMakeLists.txt rename to code/nel/samples/sound/sound_sources/CMakeLists.txt index 4cf1ea427..b0f481e7c 100644 --- a/code/nel/samples/sound_sources/CMakeLists.txt +++ b/code/nel/samples/sound/sound_sources/CMakeLists.txt @@ -7,7 +7,7 @@ ADD_DEFINITIONS(-DNL_SOUND_DATA="\\"${NL_SHARE_PREFIX}/nl_sample_sound/\\"" ${LI INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nl_sample_sound_sources nelmisc nelsound) -NL_DEFAULT_PROPS(nl_sample_sound_sources "NeL, Samples: Sound System") +NL_DEFAULT_PROPS(nl_sample_sound_sources "NeL, Samples: Sound: Sound Sources") NL_ADD_RUNTIME_FLAGS(nl_sample_sound_sources) INSTALL(TARGETS nl_sample_sound_sources RUNTIME DESTINATION bin COMPONENT samplessound) diff --git a/code/nel/samples/sound_sources/data/DFN/alpha.typ b/code/nel/samples/sound/sound_sources/data/DFN/alpha.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/alpha.typ rename to code/nel/samples/sound/sound_sources/data/DFN/alpha.typ diff --git a/code/nel/samples/sound_sources/data/DFN/angle.typ b/code/nel/samples/sound/sound_sources/data/DFN/angle.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/angle.typ rename to code/nel/samples/sound/sound_sources/data/DFN/angle.typ diff --git a/code/nel/samples/sound_sources/data/DFN/backgound_sound_item.dfn b/code/nel/samples/sound/sound_sources/data/DFN/backgound_sound_item.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/backgound_sound_item.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/backgound_sound_item.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/background_flag_config.dfn b/code/nel/samples/sound/sound_sources/data/DFN/background_flag_config.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/background_flag_config.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/background_flag_config.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/background_sound.dfn b/code/nel/samples/sound/sound_sources/data/DFN/background_sound.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/background_sound.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/background_sound.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/basics/_typ.dfn b/code/nel/samples/sound/sound_sources/data/DFN/basics/_typ.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/basics/_typ.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/basics/_typ.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/basics/_type.typ b/code/nel/samples/sound/sound_sources/data/DFN/basics/_type.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/basics/_type.typ rename to code/nel/samples/sound/sound_sources/data/DFN/basics/_type.typ diff --git a/code/nel/samples/sound_sources/data/DFN/basics/boolean.typ b/code/nel/samples/sound/sound_sources/data/DFN/basics/boolean.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/basics/boolean.typ rename to code/nel/samples/sound/sound_sources/data/DFN/basics/boolean.typ diff --git a/code/nel/samples/sound_sources/data/DFN/basics/filename.typ b/code/nel/samples/sound/sound_sources/data/DFN/basics/filename.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/basics/filename.typ rename to code/nel/samples/sound/sound_sources/data/DFN/basics/filename.typ diff --git a/code/nel/samples/sound_sources/data/DFN/basics/float.typ b/code/nel/samples/sound/sound_sources/data/DFN/basics/float.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/basics/float.typ rename to code/nel/samples/sound/sound_sources/data/DFN/basics/float.typ diff --git a/code/nel/samples/sound_sources/data/DFN/basics/iboolean.typ b/code/nel/samples/sound/sound_sources/data/DFN/basics/iboolean.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/basics/iboolean.typ rename to code/nel/samples/sound/sound_sources/data/DFN/basics/iboolean.typ diff --git a/code/nel/samples/sound_sources/data/DFN/basics/int.typ b/code/nel/samples/sound/sound_sources/data/DFN/basics/int.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/basics/int.typ rename to code/nel/samples/sound/sound_sources/data/DFN/basics/int.typ diff --git a/code/nel/samples/sound_sources/data/DFN/basics/string.typ b/code/nel/samples/sound/sound_sources/data/DFN/basics/string.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/basics/string.typ rename to code/nel/samples/sound/sound_sources/data/DFN/basics/string.typ diff --git a/code/nel/samples/sound_sources/data/DFN/basics/typ.dfn b/code/nel/samples/sound/sound_sources/data/DFN/basics/typ.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/basics/typ.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/basics/typ.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/complex_sound.dfn b/code/nel/samples/sound/sound_sources/data/DFN/complex_sound.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/complex_sound.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/complex_sound.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/context_sound.dfn b/code/nel/samples/sound/sound_sources/data/DFN/context_sound.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/context_sound.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/context_sound.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/direction.dfn b/code/nel/samples/sound/sound_sources/data/DFN/direction.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/direction.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/direction.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/distance.typ b/code/nel/samples/sound/sound_sources/data/DFN/distance.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/distance.typ rename to code/nel/samples/sound/sound_sources/data/DFN/distance.typ diff --git a/code/nel/samples/sound_sources/data/DFN/doppler.typ b/code/nel/samples/sound/sound_sources/data/DFN/doppler.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/doppler.typ rename to code/nel/samples/sound/sound_sources/data/DFN/doppler.typ diff --git a/code/nel/samples/sound_sources/data/DFN/gain.typ b/code/nel/samples/sound/sound_sources/data/DFN/gain.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/gain.typ rename to code/nel/samples/sound/sound_sources/data/DFN/gain.typ diff --git a/code/nel/samples/sound_sources/data/DFN/listener.dfn b/code/nel/samples/sound/sound_sources/data/DFN/listener.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/listener.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/listener.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/mixer_config.dfn b/code/nel/samples/sound/sound_sources/data/DFN/mixer_config.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/mixer_config.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/mixer_config.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/music_sound.dfn b/code/nel/samples/sound/sound_sources/data/DFN/music_sound.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/music_sound.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/music_sound.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/parameter_id.typ b/code/nel/samples/sound/sound_sources/data/DFN/parameter_id.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/parameter_id.typ rename to code/nel/samples/sound/sound_sources/data/DFN/parameter_id.typ diff --git a/code/nel/samples/sound_sources/data/DFN/pattern_mode.typ b/code/nel/samples/sound/sound_sources/data/DFN/pattern_mode.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/pattern_mode.typ rename to code/nel/samples/sound/sound_sources/data/DFN/pattern_mode.typ diff --git a/code/nel/samples/sound_sources/data/DFN/priority.typ b/code/nel/samples/sound/sound_sources/data/DFN/priority.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/priority.typ rename to code/nel/samples/sound/sound_sources/data/DFN/priority.typ diff --git a/code/nel/samples/sound_sources/data/DFN/rolloff.typ b/code/nel/samples/sound/sound_sources/data/DFN/rolloff.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/rolloff.typ rename to code/nel/samples/sound/sound_sources/data/DFN/rolloff.typ diff --git a/code/nel/samples/sound_sources/data/DFN/simple_sound.dfn b/code/nel/samples/sound/sound_sources/data/DFN/simple_sound.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/simple_sound.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/simple_sound.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/sound.dfn b/code/nel/samples/sound/sound_sources/data/DFN/sound.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/sound.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/sound.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/sound_group.dfn b/code/nel/samples/sound/sound_sources/data/DFN/sound_group.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/sound_group.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/sound_group.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/sound_group_item.dfn b/code/nel/samples/sound/sound_sources/data/DFN/sound_group_item.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/sound_group_item.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/sound_group_item.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/soundbank.dfn b/code/nel/samples/sound/sound_sources/data/DFN/soundbank.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/soundbank.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/soundbank.dfn diff --git a/code/nel/samples/sound_sources/data/DFN/transposition.typ b/code/nel/samples/sound/sound_sources/data/DFN/transposition.typ similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/transposition.typ rename to code/nel/samples/sound/sound_sources/data/DFN/transposition.typ diff --git a/code/nel/samples/sound_sources/data/DFN/user_var_binding.dfn b/code/nel/samples/sound/sound_sources/data/DFN/user_var_binding.dfn similarity index 100% rename from code/nel/samples/sound_sources/data/DFN/user_var_binding.dfn rename to code/nel/samples/sound/sound_sources/data/DFN/user_var_binding.dfn diff --git a/code/nel/samples/sound_sources/data/animations/readme.txt b/code/nel/samples/sound/sound_sources/data/animations/readme.txt similarity index 100% rename from code/nel/samples/sound_sources/data/animations/readme.txt rename to code/nel/samples/sound/sound_sources/data/animations/readme.txt diff --git a/code/nel/samples/sound_sources/data/animations/test_anim.sound_anim b/code/nel/samples/sound/sound_sources/data/animations/test_anim.sound_anim similarity index 100% rename from code/nel/samples/sound_sources/data/animations/test_anim.sound_anim rename to code/nel/samples/sound/sound_sources/data/animations/test_anim.sound_anim diff --git a/code/nel/samples/sound_sources/data/background_sounds/background_sound.primitive b/code/nel/samples/sound/sound_sources/data/background_sounds/background_sound.primitive similarity index 100% rename from code/nel/samples/sound_sources/data/background_sounds/background_sound.primitive rename to code/nel/samples/sound/sound_sources/data/background_sounds/background_sound.primitive diff --git a/code/nel/samples/sound_sources/data/background_sounds/readme.txt b/code/nel/samples/sound/sound_sources/data/background_sounds/readme.txt similarity index 100% rename from code/nel/samples/sound_sources/data/background_sounds/readme.txt rename to code/nel/samples/sound/sound_sources/data/background_sounds/readme.txt diff --git a/code/nel/samples/sound_sources/data/cluster_sound/readme.txt b/code/nel/samples/sound/sound_sources/data/cluster_sound/readme.txt similarity index 100% rename from code/nel/samples/sound_sources/data/cluster_sound/readme.txt rename to code/nel/samples/sound/sound_sources/data/cluster_sound/readme.txt diff --git a/code/nel/samples/sound_sources/data/cluster_sound/test_clusters.sound_group b/code/nel/samples/sound/sound_sources/data/cluster_sound/test_clusters.sound_group similarity index 100% rename from code/nel/samples/sound_sources/data/cluster_sound/test_clusters.sound_group rename to code/nel/samples/sound/sound_sources/data/cluster_sound/test_clusters.sound_group diff --git a/code/nel/samples/sound_sources/data/default.mixer_config b/code/nel/samples/sound/sound_sources/data/default.mixer_config similarity index 100% rename from code/nel/samples/sound_sources/data/default.mixer_config rename to code/nel/samples/sound/sound_sources/data/default.mixer_config diff --git a/code/nel/samples/sound_sources/data/samplebank/base_samples/beep.wav b/code/nel/samples/sound/sound_sources/data/samplebank/base_samples/beep.wav similarity index 100% rename from code/nel/samples/sound_sources/data/samplebank/base_samples/beep.wav rename to code/nel/samples/sound/sound_sources/data/samplebank/base_samples/beep.wav diff --git a/code/nel/samples/sound_sources/data/samplebank/base_samples/tuut.wav b/code/nel/samples/sound/sound_sources/data/samplebank/base_samples/tuut.wav similarity index 100% rename from code/nel/samples/sound_sources/data/samplebank/base_samples/tuut.wav rename to code/nel/samples/sound/sound_sources/data/samplebank/base_samples/tuut.wav diff --git a/code/nel/samples/sound_sources/data/soundbank/beep.sound b/code/nel/samples/sound/sound_sources/data/soundbank/beep.sound similarity index 100% rename from code/nel/samples/sound_sources/data/soundbank/beep.sound rename to code/nel/samples/sound/sound_sources/data/soundbank/beep.sound diff --git a/code/nel/samples/sound_sources/data/soundbank/tuut.sound b/code/nel/samples/sound/sound_sources/data/soundbank/tuut.sound similarity index 100% rename from code/nel/samples/sound_sources/data/soundbank/tuut.sound rename to code/nel/samples/sound/sound_sources/data/soundbank/tuut.sound diff --git a/code/nel/samples/sound_sources/data/world_editor_classes.xml b/code/nel/samples/sound/sound_sources/data/world_editor_classes.xml similarity index 100% rename from code/nel/samples/sound_sources/data/world_editor_classes.xml rename to code/nel/samples/sound/sound_sources/data/world_editor_classes.xml diff --git a/code/nel/samples/sound_sources/main.cpp b/code/nel/samples/sound/sound_sources/main.cpp similarity index 100% rename from code/nel/samples/sound_sources/main.cpp rename to code/nel/samples/sound/sound_sources/main.cpp diff --git a/code/nel/samples/sound/stream_file/CMakeLists.txt b/code/nel/samples/sound/stream_file/CMakeLists.txt new file mode 100644 index 000000000..0552387cb --- /dev/null +++ b/code/nel/samples/sound/stream_file/CMakeLists.txt @@ -0,0 +1,12 @@ +FILE(GLOB SRC *.cpp *.h) + +ADD_EXECUTABLE(nl_sample_stream_file ${SRC}) + +INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) + +TARGET_LINK_LIBRARIES(nl_sample_stream_file nelmisc nelsound) +NL_DEFAULT_PROPS(nl_sample_stream_file "NeL, Samples: Sound: Stream File") +NL_ADD_RUNTIME_FLAGS(nl_sample_stream_file) + +INSTALL(TARGETS nl_sample_stream_file RUNTIME DESTINATION bin COMPONENT samplessound) + diff --git a/code/nel/samples/sound/stream_file/base_samples.sample_bank b/code/nel/samples/sound/stream_file/base_samples.sample_bank new file mode 100644 index 000000000..8e9b5b898 Binary files /dev/null and b/code/nel/samples/sound/stream_file/base_samples.sample_bank differ diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/_typ.dfn b/code/nel/samples/sound/stream_file/data/DFN/basics/_typ.dfn new file mode 100644 index 000000000..2f8971932 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/_typ.dfn @@ -0,0 +1,6 @@ + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/_type.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/_type.typ new file mode 100644 index 000000000..233beca79 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/_type.typ @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/boolean.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/boolean.typ new file mode 100644 index 000000000..fb6821f08 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/boolean.typ @@ -0,0 +1,6 @@ + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/filename.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/filename.typ new file mode 100644 index 000000000..bdad39a48 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/filename.typ @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/float.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/float.typ new file mode 100644 index 000000000..250620f5e --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/float.typ @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/iboolean.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/iboolean.typ new file mode 100644 index 000000000..d29217bed --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/iboolean.typ @@ -0,0 +1,6 @@ + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/int.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/int.typ new file mode 100644 index 000000000..5b88c4fc4 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/int.typ @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/sint16.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/sint16.typ new file mode 100644 index 000000000..0adba3ad0 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/sint16.typ @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/sint32.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/sint32.typ new file mode 100644 index 000000000..ce470d5fe --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/sint32.typ @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/sint64.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/sint64.typ new file mode 100644 index 000000000..5b88c4fc4 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/sint64.typ @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/sint8.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/sint8.typ new file mode 100644 index 000000000..462eab92c --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/sint8.typ @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/string.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/string.typ new file mode 100644 index 000000000..89191b1eb --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/string.typ @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/typ.dfn b/code/nel/samples/sound/stream_file/data/DFN/basics/typ.dfn new file mode 100644 index 000000000..d3c9e1757 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/typ.dfn @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/uint16.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/uint16.typ new file mode 100644 index 000000000..d0e98aad1 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/uint16.typ @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/uint32.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/uint32.typ new file mode 100644 index 000000000..60dc00b3c --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/uint32.typ @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/uint64.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/uint64.typ new file mode 100644 index 000000000..936a619c8 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/uint64.typ @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/basics/uint8.typ b/code/nel/samples/sound/stream_file/data/DFN/basics/uint8.typ new file mode 100644 index 000000000..3dee1c5c8 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/basics/uint8.typ @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/alpha.typ b/code/nel/samples/sound/stream_file/data/DFN/sound/alpha.typ new file mode 100644 index 000000000..a6f7d3bff --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/alpha.typ @@ -0,0 +1,2 @@ + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/angle.typ b/code/nel/samples/sound/stream_file/data/DFN/sound/angle.typ new file mode 100644 index 000000000..db94698e0 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/angle.typ @@ -0,0 +1,2 @@ + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/backgound_sound_item.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/backgound_sound_item.dfn new file mode 100644 index 000000000..bbdfdf82a --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/backgound_sound_item.dfn @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tue Oct 08 14:39:12 2002 (boucher) Dfn Structure = +Tue Oct 08 15:03:40 2002 (boucher) Dfn Structure = +Mon Oct 14 16:09:48 2002 (boucher) Dfn Structure = +Wed Oct 16 18:22:30 2002 (boucher) Dfn Structure = +Thu Dec 19 16:26:49 2002 (boucher) Dfn Structure = +Wed Apr 09 19:38:51 2003 (AmazingSound) Dfn Structure = + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/background_flag_config.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/background_flag_config.dfn new file mode 100644 index 000000000..bce6d82a8 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/background_flag_config.dfn @@ -0,0 +1,9 @@ + + + + + + + + Thu Jan 02 14:38:32 2003 (boucher) Dfn Structure = + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/background_sound.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/background_sound.dfn new file mode 100644 index 000000000..41288d7b8 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/background_sound.dfn @@ -0,0 +1,5 @@ + + + + Tue Oct 08 14:55:03 2002 (boucher) Dfn Structure = + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/complex_sound.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/complex_sound.dfn new file mode 100644 index 000000000..8164b9d7a --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/complex_sound.dfn @@ -0,0 +1,19 @@ + + + + + + + + + + + Tue Oct 08 14:29:42 2002 (boucher) Dfn Structure = +Tue Oct 08 14:35:40 2002 (boucher) Dfn Structure = +Thu Oct 10 16:15:18 2002 (boucher) Dfn Structure = +Fri Oct 11 10:26:17 2002 (boucher) Dfn Structure = +Fri Oct 11 11:14:25 2002 (boucher) Dfn Structure = +Fri Oct 11 11:15:41 2002 (boucher) Dfn Structure = +Fri Oct 11 16:01:43 2002 (boucher) Dfn Structure = +Wed Oct 16 11:36:41 2002 (boucher) Dfn Structure = + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/context_sound.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/context_sound.dfn new file mode 100644 index 000000000..f8d05e697 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/context_sound.dfn @@ -0,0 +1,5 @@ + + + + Thu Nov 07 14:01:21 2002 (boucher) Dfn Structure = + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/direction.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/direction.dfn new file mode 100644 index 000000000..190223cc1 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/direction.dfn @@ -0,0 +1,6 @@ + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/distance.typ b/code/nel/samples/sound/stream_file/data/DFN/sound/distance.typ new file mode 100644 index 000000000..0981c09a0 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/distance.typ @@ -0,0 +1,2 @@ + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/doppler.typ b/code/nel/samples/sound/stream_file/data/DFN/sound/doppler.typ new file mode 100644 index 000000000..2419f2d6c --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/doppler.typ @@ -0,0 +1,2 @@ + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/gain.typ b/code/nel/samples/sound/stream_file/data/DFN/sound/gain.typ new file mode 100644 index 000000000..2000b2652 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/gain.typ @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/listener.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/listener.dfn new file mode 100644 index 000000000..ba52b5af0 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/listener.dfn @@ -0,0 +1,5 @@ + + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/mixer_config.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/mixer_config.dfn new file mode 100644 index 000000000..61daec64b --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/mixer_config.dfn @@ -0,0 +1,14 @@ + + + + + + + + + + + Thu Jan 02 14:33:42 2003 (boucher) Dfn Structure = +Thu Jan 02 14:40:05 2003 (boucher) Dfn Structure = +Thu Jan 02 14:41:32 2003 (boucher) Dfn Structure = + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/music_sound.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/music_sound.dfn new file mode 100644 index 000000000..1935511b2 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/music_sound.dfn @@ -0,0 +1,13 @@ + + + + + + + + Tue Nov 02 11:28:10 2004 (berenguier) Dfn Structure = +Tue Nov 02 11:30:14 2004 (berenguier) Dfn Structure = +Tue Nov 02 11:40:09 2004 (berenguier) Dfn Structure = +Tue Nov 02 11:40:29 2004 (berenguier) Dfn Structure = +Wed Nov 03 10:54:07 2004 (berenguier) Dfn Structure = + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/parameter_id.typ b/code/nel/samples/sound/stream_file/data/DFN/sound/parameter_id.typ new file mode 100644 index 000000000..bc284afb2 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/parameter_id.typ @@ -0,0 +1,8 @@ + + + + + Mon Feb 10 17:31:53 2003 (boucher) Type Predef = +Mon Feb 10 17:31:53 2003 (boucher) Type Type = String +Mon Feb 10 17:31:53 2003 (boucher) Type UI = NonEditableCombo + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/pattern_mode.typ b/code/nel/samples/sound/stream_file/data/DFN/sound/pattern_mode.typ new file mode 100644 index 000000000..b0ac96de5 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/pattern_mode.typ @@ -0,0 +1,10 @@ + + + + + + Tue Oct 08 14:27:39 2002 (boucher) Type Default = Chained +Tue Oct 08 14:27:39 2002 (boucher) Type Predef = +Tue Oct 08 14:27:39 2002 (boucher) Type Type = String +Tue Oct 08 14:27:39 2002 (boucher) Type UI = NonEditableCombo + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/priority.typ b/code/nel/samples/sound/stream_file/data/DFN/sound/priority.typ new file mode 100644 index 000000000..d9bdbbd07 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/priority.typ @@ -0,0 +1,7 @@ + + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/rolloff.typ b/code/nel/samples/sound/stream_file/data/DFN/sound/rolloff.typ new file mode 100644 index 000000000..a5818a1a6 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/rolloff.typ @@ -0,0 +1,2 @@ + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/simple_sound.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/simple_sound.dfn new file mode 100644 index 000000000..60e97cc35 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/simple_sound.dfn @@ -0,0 +1,12 @@ + + + + + + + Wed Apr 09 21:13:23 2003 (AmazingSound) Dfn Structure = +Thu Apr 10 15:38:18 2003 (AmazingSound) Dfn Structure = +Thu Apr 10 16:24:05 2003 (AmazingSound) Dfn Structure = +Wed Apr 30 12:44:51 2003 (AmazingSound) Dfn Structure = +Wed Apr 30 12:45:39 2003 (AmazingSound) Dfn Structure = + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/sound.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/sound.dfn new file mode 100644 index 000000000..a8c336b0b --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/sound.dfn @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + Tue Oct 08 12:33:33 2002 (boucher) Dfn Structure = +Tue Oct 08 14:35:19 2002 (boucher) Dfn Structure = + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/sound_group.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/sound_group.dfn new file mode 100644 index 000000000..b058b36ff --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/sound_group.dfn @@ -0,0 +1,8 @@ + + + + Thu Jan 09 11:48:30 2003 (boucher) Dfn Structure = +Thu Jan 09 11:51:28 2003 (boucher) Dfn Structure = +Thu Jan 09 11:52:03 2003 (boucher) Dfn Structure = +Thu Jan 09 11:52:08 2003 (boucher) Dfn Structure = + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/sound_group_item.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/sound_group_item.dfn new file mode 100644 index 000000000..00420dbb9 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/sound_group_item.dfn @@ -0,0 +1,7 @@ + + + + + Thu Jan 09 11:47:55 2003 (boucher) Dfn Structure = +Thu Jan 09 11:53:15 2003 (boucher) Dfn Structure = + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/soundbank.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/soundbank.dfn new file mode 100644 index 000000000..38a60a89a --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/soundbank.dfn @@ -0,0 +1,4 @@ + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/stream_file_sound.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/stream_file_sound.dfn new file mode 100644 index 000000000..7293fc854 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/stream_file_sound.dfn @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/stream_sound.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/stream_sound.dfn new file mode 100644 index 000000000..82eaa9a6d --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/stream_sound.dfn @@ -0,0 +1,7 @@ + + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/transposition.typ b/code/nel/samples/sound/stream_file/data/DFN/sound/transposition.typ new file mode 100644 index 000000000..2d05a4471 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/transposition.typ @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/DFN/sound/user_var_binding.dfn b/code/nel/samples/sound/stream_file/data/DFN/sound/user_var_binding.dfn new file mode 100644 index 000000000..d2740f489 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/DFN/sound/user_var_binding.dfn @@ -0,0 +1,9 @@ + + + + + + Mon Feb 10 17:32:55 2003 (boucher) Dfn Structure = +Mon Feb 10 17:34:17 2003 (boucher) Dfn Structure = +Tue Feb 11 09:49:09 2003 (boucher) Dfn Structure = + diff --git a/code/nel/samples/sound/stream_file/data/animations/readme.txt b/code/nel/samples/sound/stream_file/data/animations/readme.txt new file mode 100644 index 000000000..43c7f150a --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/animations/readme.txt @@ -0,0 +1,3 @@ +This folder contains the sound track for animation. + +Put here all the .sound_anim file generated with NeL Object Viewer. \ No newline at end of file diff --git a/code/nel/samples/sound/stream_file/data/animations/test_anim.sound_anim b/code/nel/samples/sound/stream_file/data/animations/test_anim.sound_anim new file mode 100644 index 000000000..4377e81b6 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/animations/test_anim.sound_anim @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/background_sounds/background_sound.primitive b/code/nel/samples/sound/stream_file/data/background_sounds/background_sound.primitive new file mode 100644 index 000000000..26ff875f1 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/background_sounds/background_sound.primitive @@ -0,0 +1,144 @@ + + + + + + + + + class + audio + + + name + test_audio + + + + + class + sounds + + + name + sounds + + + + + + + + + class + sound_zone + + + name + test_zone + + + sound + beep.sound + + + + + + + + + + + class + sound_path + + + name + test_path + + + sound + tuut.sound + + + + + + + class + sound_point + + + name + test_point + + + sound + tuut.sound + + + + + + + class + sample_banks + + + name + sample_banks + + + + + + + + + bank_names + base_samples + + + class + sample_bank_zone + + + name + base_sample_zone + + + + + + + class + env_fx + + + name + env_fx + + + + + + + + + class + env_fx_zone + + + fx_name + BATHROOM + + + name + test_fx + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/background_sounds/readme.txt b/code/nel/samples/sound/stream_file/data/background_sounds/readme.txt new file mode 100644 index 000000000..6103b141c --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/background_sounds/readme.txt @@ -0,0 +1 @@ +This folder contains the background sound primitive files. \ No newline at end of file diff --git a/code/nel/samples/sound/stream_file/data/cluster_sound/readme.txt b/code/nel/samples/sound/stream_file/data/cluster_sound/readme.txt new file mode 100644 index 000000000..2668e737a --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/cluster_sound/readme.txt @@ -0,0 +1,11 @@ +This folder contains Georges sheets that link sound group defined in +the cluster system (edited in 3DS Max) to a sound sheet. + +This allow to put sound inside the cluster systems. + +Each sheet can contains any number of association. +It is a good practice to merge into a single sheet all +the sound groups/sound sheets thet belong the the +same building. + + \ No newline at end of file diff --git a/code/nel/samples/sound/stream_file/data/cluster_sound/test_clusters.sound_group b/code/nel/samples/sound/stream_file/data/cluster_sound/test_clusters.sound_group new file mode 100644 index 000000000..0ee91ba18 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/cluster_sound/test_clusters.sound_group @@ -0,0 +1,19 @@ + +
+ + + + + + + + + + + + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/default.mixer_config b/code/nel/samples/sound/stream_file/data/default.mixer_config new file mode 100644 index 000000000..fd9ca5a59 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/default.mixer_config @@ -0,0 +1,54 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fri Oct 15 15:26:53 2004 (boucher) .SampleBanks[0] = base_samples + diff --git a/code/nel/samples/sound/stream_file/data/samplebank/base_samples/beep.wav b/code/nel/samples/sound/stream_file/data/samplebank/base_samples/beep.wav new file mode 100644 index 000000000..8b4108a4c Binary files /dev/null and b/code/nel/samples/sound/stream_file/data/samplebank/base_samples/beep.wav differ diff --git a/code/nel/samples/sound/stream_file/data/samplebank/base_samples/tuut.wav b/code/nel/samples/sound/stream_file/data/samplebank/base_samples/tuut.wav new file mode 100644 index 000000000..bae70bc0f Binary files /dev/null and b/code/nel/samples/sound/stream_file/data/samplebank/base_samples/tuut.wav differ diff --git a/code/nel/samples/sound/stream_file/data/soundbank/beep.sound b/code/nel/samples/sound/stream_file/data/soundbank/beep.sound new file mode 100644 index 000000000..dbda3735c --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/soundbank/beep.sound @@ -0,0 +1,19 @@ + +
+ + + + + + + + + + + + Fri Oct 15 15:23:46 2004 (boucher) .SoundType = simple_sound.dfn +Fri Oct 15 15:23:46 2004 (boucher) .SoundType.Filename = beep.wav +Fri Oct 15 15:23:46 2004 (boucher) .SoundType.MaxDistance = 1000 +Fri Oct 15 15:23:46 2004 (boucher) .SoundType.MinDistance = 1.2 +Fri Oct 15 15:27:24 2004 (boucher) .SoundType.Alpha = + diff --git a/code/nel/samples/sound/stream_file/data/soundbank/default_stream.sound b/code/nel/samples/sound/stream_file/data/soundbank/default_stream.sound new file mode 100644 index 000000000..c757128fc --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/soundbank/default_stream.sound @@ -0,0 +1,20 @@ + +
+ + + + + + + + + + + + + Thu Jan 28 23:30:44 2010 (Kaetemi) .AbsolutePosition = false +Thu Jan 28 23:30:44 2010 (Kaetemi) .Priority = Highest +Thu Jan 28 23:30:44 2010 (Kaetemi) .SoundType = stream_sound.dfn +Thu Jan 28 23:30:44 2010 (Kaetemi) .SoundType.MaxDistance = 100000 +Thu Jan 28 23:30:44 2010 (Kaetemi) .SoundType.MinDistance = 200000 + diff --git a/code/nel/samples/sound/stream_file/data/soundbank/stream_file.sound b/code/nel/samples/sound/stream_file/data/soundbank/stream_file.sound new file mode 100644 index 000000000..a98ae3a3c --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/soundbank/stream_file.sound @@ -0,0 +1,18 @@ + +
+ + + + + + + + + + + + + + + + diff --git a/code/nel/samples/sound/stream_file/data/soundbank/tuut.sound b/code/nel/samples/sound/stream_file/data/soundbank/tuut.sound new file mode 100644 index 000000000..c45cfba63 --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/soundbank/tuut.sound @@ -0,0 +1,20 @@ + +
+ + + + + + + + + + + + + Fri Oct 15 15:24:54 2004 (boucher) .SoundType = simple_sound.dfn +Fri Oct 15 15:24:54 2004 (boucher) .SoundType.Alpha = 0.5 +Fri Oct 15 15:24:54 2004 (boucher) .SoundType.Filename = tuut.wav +Fri Oct 15 15:24:54 2004 (boucher) .SoundType.MaxDistance = 50 +Fri Oct 15 15:24:54 2004 (boucher) .SoundType.MinDistance = 5 + diff --git a/code/nel/samples/sound/stream_file/data/world_editor_classes.xml b/code/nel/samples/sound/stream_file/data/world_editor_classes.xml new file mode 100644 index 000000000..68ba22ace --- /dev/null +++ b/code/nel/samples/sound/stream_file/data/world_editor_classes.xml @@ -0,0 +1,382 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/nel/samples/sound/stream_file/stream_file.cpp b/code/nel/samples/sound/stream_file/stream_file.cpp new file mode 100644 index 000000000..06e768625 --- /dev/null +++ b/code/nel/samples/sound/stream_file/stream_file.cpp @@ -0,0 +1,182 @@ +// 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 + +// STL includes +#include +#ifdef NL_OS_WINDOWS +# include +#endif + +// NeL includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// For direct play/pause control. +// You should never include this! +#include + +// Project includes + +#ifndef NL_SOUND_DATA +#define NL_SOUND_DATA "." +#endif // NL_SOUND_DATA + +#define RYZOM_DATA "P:/data" +#define SAMPLE_OGG "Pyr Entrance.ogg" + +using namespace std; +using namespace NLMISC; +using namespace NLSOUND; + +namespace NLSAMPLE { + +static UAudioMixer *s_AudioMixer = NULL; +static USource *s_Source = NULL; +static CStreamFileSource *s_StreamFileSource = NULL; +static UGroupController *s_GroupController = NULL; + +static void initSample() +{ + if (!INelContext::isContextInitialised()) + new CApplicationContext(); + CPath::addSearchPath(NL_SOUND_DATA"/data", true, false); + + printf("Sample demonstrating OGG playback using stream file .sound sheets."); + printf("\n\n"); + + s_AudioMixer = UAudioMixer::createAudioMixer(); + + // Set the sample path before init, this allow the mixer to build the sample banks + s_AudioMixer->setSamplePath(NL_SOUND_DATA"/data/samplebank"); + // Packed sheet option, this mean we want packed sheet generated in 'data' folder + s_AudioMixer->setPackedSheetOption(NL_SOUND_DATA"/data", true); + + printf("Select NLSOUND Driver:\n"); + printf(" [1] FMod\n"); + printf(" [2] OpenAl\n"); + printf(" [3] DSound\n"); + printf(" [4] XAudio2\n"); + printf("> "); + int selection = getchar(); getchar(); + printf("\n"); + + // init with 8 tracks, EAX enabled, no ADPCM, and automatic sample bank loading + s_AudioMixer->init(8, true, false, NULL, true, (UAudioMixer::TDriver)(selection - '0')); + s_AudioMixer->setLowWaterMark(1); + + CVector initpos(0.0f, 0.0f, 0.0f); + CVector frontvec(0.0f, 1.0f, 0.0f); + CVector upvec(0.0f, 0.0f, 1.0f); + s_AudioMixer->getListener()->setPos(initpos); + s_AudioMixer->getListener()->setOrientation(frontvec, upvec); + + CPath::addSearchPath(RYZOM_DATA, true, false); + + //NLMISC::CHTimer::startBench(); + + s_Source = s_AudioMixer->createSource(CStringMapper::map("stream_file")); + nlassert(s_Source); + s_StreamFileSource = dynamic_cast(s_Source); + nlassert(s_StreamFileSource); + // s_Source->setSourceRelativeMode(true); + // s_Source->setPitch(2.0f); + + s_GroupController = s_AudioMixer->getGroupController("sound:dialog"); +} + +static void runSample() +{ + s_Source->play(); + + printf("Change volume with - and +\n"); + printf("Press ANY other key to exit\n"); + for (; ; ) + { +#ifdef NL_OS_WINDOWS + if (_kbhit()) + { + switch (_getch()) +#else + char ch; + if (read(0, &ch, 1)) + { + switch (ch) +#endif + { + case '+': + s_GroupController->setGain(s_GroupController->getGain() + 0.1f); + break; + case '-': + s_GroupController->setGain(s_GroupController->getGain() - 0.1f); + break; + case 'x': + s_Source->stop(); + break; + case 's': + s_Source->play(); + break; + case 'p': + s_StreamFileSource->pause(); + break; + case 'r': + s_StreamFileSource->resume(); + break; + case 'e': + s_AudioMixer->playMusic(SAMPLE_OGG, 1000, true, false); + break; + default: + return; + } + } + + s_AudioMixer->update(); + + nlSleep(40); + } +} + +static void releaseSample() +{ + //NLMISC::CHTimer::clear(); + s_GroupController = NULL; + s_StreamFileSource = NULL; + delete s_Source; s_Source = NULL; + delete s_AudioMixer; s_AudioMixer = NULL; +} + + + +} /* namespace NLSAMPLE */ + +int main() +{ + NLSAMPLE::initSample(); + NLSAMPLE::runSample(); + NLSAMPLE::releaseSample(); + return 0; +} + +/* end of file */ diff --git a/code/nel/samples/sound/stream_ogg_vorbis/CMakeLists.txt b/code/nel/samples/sound/stream_ogg_vorbis/CMakeLists.txt new file mode 100644 index 000000000..db978fc88 --- /dev/null +++ b/code/nel/samples/sound/stream_ogg_vorbis/CMakeLists.txt @@ -0,0 +1,12 @@ +FILE(GLOB SRC *.cpp *.h) + +ADD_EXECUTABLE(nl_sample_stream_ogg_vorbis ${SRC}) + +INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) + +TARGET_LINK_LIBRARIES(nl_sample_stream_ogg_vorbis nelmisc nelsound) +NL_DEFAULT_PROPS(nl_sample_stream_ogg_vorbis "NeL, Samples: Sound: Stream OGG Vorbis") +NL_ADD_RUNTIME_FLAGS(nl_sample_stream_ogg_vorbis) + +INSTALL(TARGETS nl_sample_stream_ogg_vorbis RUNTIME DESTINATION bin COMPONENT samplessound) + diff --git a/code/nel/samples/sound/stream_ogg_vorbis/stream_ogg_vorbis.cpp b/code/nel/samples/sound/stream_ogg_vorbis/stream_ogg_vorbis.cpp index 441eee932..c145d6972 100644 --- a/code/nel/samples/sound/stream_ogg_vorbis/stream_ogg_vorbis.cpp +++ b/code/nel/samples/sound/stream_ogg_vorbis/stream_ogg_vorbis.cpp @@ -18,16 +18,8 @@ // STL includes #include -#include - -// 3rd Party includes -#ifdef NL_OS_WINDOWS -# pragma warning( push ) -# pragma warning( disable : 4244 ) -#endif -#include #ifdef NL_OS_WINDOWS -# pragma warning( pop ) +# include #endif // NeL includes @@ -40,6 +32,8 @@ #include #include #include +#include +#include #include // Project includes @@ -48,7 +42,7 @@ #define NL_SOUND_DATA "." #endif // NL_SOUND_DATA -#define SAMPLE_OGG "O:/src/samples/music_stream/data/aeon_1_10_mystic_river.ogg" +#define SAMPLE_OGG "D:/source/kaetemi/toverhex/src/samples/music_stream/data/aeon_1_10_mystic_river.ogg" using namespace std; using namespace NLMISC; @@ -56,275 +50,10 @@ using namespace NLSOUND; namespace NLSAMPLE { -/** - * \brief IAudioDecoder - * \date 2008-08-30 11:38GMT - * \author Jan Boon (Kaetemi) - * IAudioDecoder is only used by the driver implementation to stream - * music files into a readable format (it's a simple decoder interface). - * You should not call these functions (getSongTitle) on nlsound or user level, - * as a driver might have additional music types implemented. - * TODO: Split IAudioDecoder into IAudioDecoder (actual decoding) and IMediaDemuxer (stream splitter), and change the interface to make more sense. - * TODO: Allow user application to register more decoders. - * TODO: Look into libavcodec for decoding audio? - */ -class IAudioDecoder -{ -private: - // pointers - /// Stream from file created by IAudioDecoder - NLMISC::IStream *_InternalStream; - -public: - IAudioDecoder(); - virtual ~IAudioDecoder(); - - /// Create a new music buffer, may return NULL if unknown type, destroy with delete. Filepath lookup done here. If async is true, it will stream from hd, else it will load in memory first. - static IAudioDecoder *createAudioDecoder(const std::string &filepath, bool async, bool loop); - - /// Create a new music buffer from a stream, type is file extension like "ogg" etc. - static IAudioDecoder *createAudioDecoder(const std::string &type, NLMISC::IStream *stream, bool loop); - - /// Get information on a music file (only artist and title at the moment). - static bool getInfo(const std::string &filepath, std::string &artist, std::string &title); - - /// Get audio/container extensions that are currently supported by the nel sound library. - static void getMusicExtensions(std::vector &extensions); - - /// Return if a music extension is supported by the nel sound library. - static bool isMusicExtensionSupported(const std::string &extension); - - /// Get how many bytes the music buffer requires for output minimum. - virtual uint32 getRequiredBytes() = 0; - - /// Get an amount of bytes between minimum and maximum (can be lower than minimum if at end). - virtual uint32 getNextBytes(uint8 *buffer, uint32 minimum, uint32 maximum) = 0; - - /// Get the amount of channels (2 is stereo) in output. - virtual uint8 getChannels() = 0; - - /// Get the samples per second (often 44100) in output. - virtual uint getSamplesPerSec() = 0; - - /// Get the bits per sample (often 16) in output. - virtual uint8 getBitsPerSample() = 0; - - /// Get if the music has ended playing (never true if loop). - virtual bool isMusicEnded() = 0; - - /// Get the total time in seconds. - virtual float getLength() = 0; -}; /* class IAudioDecoder */ - -/** - * \brief CAudioDecoderVorbis - * \date 2008-08-30 11:38GMT - * \author Jan Boon (Kaetemi) - * CAudioDecoderVorbis - * Create trough IAudioDecoder, type "ogg" - */ -class CAudioDecoderVorbis : public IAudioDecoder -{ -protected: - // outside pointers - NLMISC::IStream *_Stream; - - // pointers - - // instances - OggVorbis_File _OggVorbisFile; - bool _Loop; - bool _IsMusicEnded; - sint32 _StreamOffset; - sint32 _StreamSize; -public: - CAudioDecoderVorbis(NLMISC::IStream *stream, bool loop); - virtual ~CAudioDecoderVorbis(); - inline NLMISC::IStream *getStream() { return _Stream; } - inline sint32 getStreamSize() { return _StreamSize; } - inline sint32 getStreamOffset() { return _StreamOffset; } - - /// Get information on a music file (only artist and title at the moment). - static bool getInfo(NLMISC::IStream *stream, std::string &artist, std::string &title); - - /// Get how many bytes the music buffer requires for output minimum. - virtual uint32 getRequiredBytes(); - - /// Get an amount of bytes between minimum and maximum (can be lower than minimum if at end). - virtual uint32 getNextBytes(uint8 *buffer, uint32 minimum, uint32 maximum); - - /// Get the amount of channels (2 is stereo) in output. - virtual uint8 getChannels(); - - /// Get the samples per second (often 44100) in output. - virtual uint getSamplesPerSec(); - - /// Get the bits per sample (often 16) in output. - virtual uint8 getBitsPerSample(); - - /// Get if the music has ended playing (never true if loop). - virtual bool isMusicEnded(); - - /// Get the total time in seconds. - virtual float getLength(); -}; /* class CAudioDecoderVorbis */ - -IAudioDecoder::IAudioDecoder() : _InternalStream(NULL) -{ - -} - -IAudioDecoder::~IAudioDecoder() -{ - if (_InternalStream) { delete _InternalStream; _InternalStream = NULL; } -} - -IAudioDecoder *IAudioDecoder::createAudioDecoder(const std::string &filepath, bool async, bool loop) -{ - string lookup = CPath::lookup(filepath, false); - if (lookup.empty()) - { - nlwarning("Music file %s does not exist!", filepath.c_str()); - return NULL; - } - string type = CFile::getExtension(filepath); - - CIFile *ifile = new CIFile(); - ifile->setCacheFileOnOpen(!async); - ifile->allowBNPCacheFileOnOpen(!async); - ifile->open(lookup); - - IAudioDecoder *mb = createAudioDecoder(type, ifile, loop); - - if (mb) mb->_InternalStream = ifile; - else delete ifile; - - return mb; -} - -IAudioDecoder *IAudioDecoder::createAudioDecoder(const std::string &type, NLMISC::IStream *stream, bool loop) -{ - if (!stream) - { - nlwarning("Stream is NULL"); - return NULL; - } - string type_lower = toLower(type); - if (type_lower == "ogg") - { - return new CAudioDecoderVorbis(stream, loop); - } - else - { - nlwarning("Music file type unknown: '%s'", type_lower.c_str()); - return NULL; - } -} - -bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, std::string &title) -{ - string lookup = CPath::lookup(filepath, false); - if (lookup.empty()) - { - nlwarning("Music file %s does not exist!", filepath.c_str()); - return false; - } - string type = CFile::getExtension(filepath); - string type_lower = toLower(type); - - if (type_lower == "ogg") - { - CIFile ifile; - ifile.setCacheFileOnOpen(false); - ifile.allowBNPCacheFileOnOpen(false); - ifile.open(lookup); - return CAudioDecoderVorbis::getInfo(&ifile, artist, title); - } - else - { - nlwarning("Music file type unknown: '%s'", type_lower.c_str()); - artist.clear(); title.clear(); - return false; - } -} - -/// Get audio/container extensions that are currently supported by the nel sound library. -void IAudioDecoder::getMusicExtensions(std::vector &extensions) -{ - extensions.push_back("ogg"); - // extensions.push_back("wav"); // TODO: Easy. -} - -/// Return if a music extension is supported by the nel sound library. -bool IAudioDecoder::isMusicExtensionSupported(const std::string &extension) -{ - return (extension == "ogg"); -} - -size_t vorbisReadFunc(void *ptr, size_t size, size_t nmemb, void *datasource) -{ - CAudioDecoderVorbis *audio_decoder_vorbis = (CAudioDecoderVorbis *)datasource; - NLMISC::IStream *stream = audio_decoder_vorbis->getStream(); - nlassert(stream->isReading()); - sint32 length = (sint32)(size * nmemb); - if (length > audio_decoder_vorbis->getStreamSize() - stream->getPos()) - length = audio_decoder_vorbis->getStreamSize() - stream->getPos(); - stream->serialBuffer((uint8 *)ptr, length); - return length; -} - -int vorbisSeekFunc(void *datasource, ogg_int64_t offset, int whence) -{ - if (whence == SEEK_CUR && offset == 0) - { - // nlwarning(NLSOUND_XAUDIO2_PREFIX "This seek call doesn't do a damn thing, wtf."); - return 0; // ooookkaaaaaayyy - } - - CAudioDecoderVorbis *audio_decoder_vorbis = (CAudioDecoderVorbis *)datasource; - - NLMISC::IStream::TSeekOrigin origin; - switch (whence) - { - case SEEK_SET: - origin = NLMISC::IStream::begin; - break; - case SEEK_CUR: - origin = NLMISC::IStream::current; - break; - case SEEK_END: - origin = NLMISC::IStream::end; - break; - default: - // nlwarning(NLSOUND_XAUDIO2_PREFIX "Seeking to fake origin."); - return -1; - } - - if (audio_decoder_vorbis->getStream()->seek(SEEK_SET ? audio_decoder_vorbis->getStreamOffset() + (sint32)offset : (sint32)offset, origin)) return 0; - else return -1; -} - -//int vorbisCloseFunc(void *datasource) -//{ -// //CAudioDecoderVorbis *audio_decoder_vorbis = (CAudioDecoderVorbis *)datasource; -//} - -long vorbisTellFunc(void *datasource) -{ - CAudioDecoderVorbis *audio_decoder_vorbis = (CAudioDecoderVorbis *)datasource; - return (long)(audio_decoder_vorbis->getStream()->getPos() - audio_decoder_vorbis->getStreamOffset()); -} - -static ov_callbacks OV_CALLBACKS_NLMISC_STREAM = { - (size_t (*)(void *, size_t, size_t, void *)) vorbisReadFunc, - (int (*)(void *, ogg_int64_t, int)) vorbisSeekFunc, - (int (*)(void *)) NULL, //vorbisCloseFunc, - (long (*)(void *)) vorbisTellFunc -}; - static UAudioMixer *s_AudioMixer = NULL; static UStreamSource *s_StreamSource = NULL; static IAudioDecoder *s_AudioDecoder = NULL; +static UGroupController *s_GroupController = NULL; static void initSample() { @@ -367,6 +96,9 @@ static void initSample() string sample = SAMPLE_OGG; s_AudioDecoder = IAudioDecoder::createAudioDecoder(sample, false, false); s_StreamSource->setFormat(s_AudioDecoder->getChannels(), s_AudioDecoder->getBitsPerSample(), (uint32)s_AudioDecoder->getSamplesPerSec()); + //s_StreamSource->setPitch(2.0f); + + s_GroupController = s_AudioMixer->getGroupController("sound:dialog"); } //CMutex *s_Mutex = NULL; @@ -404,15 +136,33 @@ static void runSample() s_StreamSource->play(); - printf("Press ANY key to exit\n"); + printf("Change volume with - and +\n"); + printf("Press ANY other key to exit\n"); while (!s_AudioDecoder->isMusicEnded()) { +#ifdef NL_OS_WINDOWS if (_kbhit()) { - _getch(); - return; + switch (_getch()) +#else + char ch; + if (read(0, &ch, 1)) + { + switch (ch) +#endif + { + case '+': + s_GroupController->setGain(s_GroupController->getGain() + 0.1f); + break; + case '-': + s_GroupController->setGain(s_GroupController->getGain() - 0.1f); + break; + default: + return; + } } bufferMore(bytes); + s_AudioMixer->update(); //if (!s_StreamSource->asUSource()->isst) //{ // printf("*!playing!*"); @@ -424,122 +174,32 @@ static void runSample() while (s_StreamSource->hasFilledBuffersAvailable()) { nlSleep(40); + s_AudioMixer->update(); } s_StreamSource->stop(); printf("End of song\n"); printf("Press ANY key to exit\n"); - while (!_kbhit()) { s_AudioMixer->update(); Sleep(10); } _getch(); +#ifdef NL_OS_WINDOWS + while (!_kbhit()) +#else + char ch; + while (!read(0, &ch, 1)) +#endif + { s_AudioMixer->update(); nlSleep(10); } return; } static void releaseSample() { //NLMISC::CHTimer::clear(); + s_GroupController = NULL; delete s_AudioDecoder; s_AudioDecoder = NULL; delete s_StreamSource; s_StreamSource = NULL; delete s_AudioMixer; s_AudioMixer = NULL; } -CAudioDecoderVorbis::CAudioDecoderVorbis(NLMISC::IStream *stream, bool loop) -: _Stream(stream), _Loop(loop), _StreamSize(0), _IsMusicEnded(false) -{ - _StreamOffset = stream->getPos(); - stream->seek(0, NLMISC::IStream::end); - _StreamSize = stream->getPos(); - stream->seek(_StreamOffset, NLMISC::IStream::begin); - ov_open_callbacks(this, &_OggVorbisFile, NULL, 0, OV_CALLBACKS_NLMISC_STREAM); -} - -CAudioDecoderVorbis::~CAudioDecoderVorbis() -{ - ov_clear(&_OggVorbisFile); -} - -/// Get information on a music file (only artist and title at the moment). -bool CAudioDecoderVorbis::getInfo(NLMISC::IStream *stream, std::string &artist, std::string &title) -{ - CAudioDecoderVorbis mbv(stream, false); // just opens and closes the oggvorbisfile thing :) - vorbis_comment *vc = ov_comment(&mbv._OggVorbisFile, -1); - char *title_c = vorbis_comment_query(vc, "title", 0); - if (title_c) title = title_c; else title.clear(); - char *artist_c = vorbis_comment_query(vc, "artist", 0); - if (artist_c) artist = artist_c; else artist.clear(); - return true; -} - -uint32 CAudioDecoderVorbis::getRequiredBytes() -{ - return 0; // no minimum requirement of bytes to buffer out -} - -uint32 CAudioDecoderVorbis::getNextBytes(uint8 *buffer, uint32 minimum, uint32 maximum) -{ - int current_section = 0; // ??? - if (_IsMusicEnded) return 0; - nlassert(minimum <= maximum); // can't have this.. - uint32 bytes_read = 0; - do - { - // signed 16-bit or unsigned 8-bit little-endian samples - int br = ov_read(&_OggVorbisFile, (char *)&buffer[bytes_read], maximum - bytes_read, - 0, // Specifies big or little endian byte packing. 0 for little endian, 1 for b ig endian. Typical value is 0. - getBitsPerSample() == 8 ? 1 : 2, - getBitsPerSample() == 8 ? 0 : 1, // Signed or unsigned data. 0 for unsigned, 1 for signed. Typically 1. - ¤t_section); - // nlinfo(NLSOUND_XAUDIO2_PREFIX "current_section: %i", current_section); - if (br <= 0) - { - if (br == 0) - { - if (_Loop) - { - ov_pcm_seek(&_OggVorbisFile, 0); - //_Stream->seek(0, NLMISC::IStream::begin); - } - else - { - _IsMusicEnded = true; - break; - } - } - else - { - nlwarning("ov_read: %i", br); - } - } - else bytes_read += (uint32)br; - } while (bytes_read < minimum); - return bytes_read; -} - -uint8 CAudioDecoderVorbis::getChannels() -{ - vorbis_info *vi = ov_info(&_OggVorbisFile, -1); - return (uint8)vi->channels; -} - -uint CAudioDecoderVorbis::getSamplesPerSec() -{ - vorbis_info *vi = ov_info(&_OggVorbisFile, -1); - return (uint)vi->rate; -} - -uint8 CAudioDecoderVorbis::getBitsPerSample() -{ - return 16; -} - -bool CAudioDecoderVorbis::isMusicEnded() -{ - return _IsMusicEnded; -} - -float CAudioDecoderVorbis::getLength() -{ - return (float)ov_time_total(&_OggVorbisFile, -1); -} } /* namespace NLSAMPLE */ diff --git a/code/nel/src/3d/driver/CMakeLists.txt b/code/nel/src/3d/driver/CMakeLists.txt index 19920b11d..3ec69bf44 100644 --- a/code/nel/src/3d/driver/CMakeLists.txt +++ b/code/nel/src/3d/driver/CMakeLists.txt @@ -2,6 +2,10 @@ IF(WITH_DRIVER_OPENGL) ADD_SUBDIRECTORY(opengl) ENDIF(WITH_DRIVER_OPENGL) +IF(WITH_DRIVER_OPENGLES) + ADD_SUBDIRECTORY(opengles) +ENDIF(WITH_DRIVER_OPENGLES) + IF(WIN32) IF(WITH_DRIVER_DIRECT3D) ADD_SUBDIRECTORY(direct3d) diff --git a/code/nel/src/3d/driver/opengl/CMakeLists.txt b/code/nel/src/3d/driver/opengl/CMakeLists.txt index d90c7e0b3..2d1f092b5 100644 --- a/code/nel/src/3d/driver/opengl/CMakeLists.txt +++ b/code/nel/src/3d/driver/opengl/CMakeLists.txt @@ -1,3 +1,15 @@ +FIND_PACKAGE(OpenGL REQUIRED) + +IF(NOT WIN32) + IF(APPLE) + FIND_LIBRARY(CARBON NAMES Carbon) + FIND_LIBRARY(COCOA NAMES Cocoa) + ELSE(APPLE) + FIND_PACKAGE(X11) + FIND_PACKAGE(XF86VidMode) + ENDIF(APPLE) +ENDIF(NOT WIN32) + FILE(GLOB SRC *.cpp *.h *.def) IF(APPLE) @@ -57,9 +69,9 @@ IF(UNIX AND NOT APPLE) ENDIF(X11_Xcursor_FOUND) ENDIF(UNIX AND NOT APPLE) -IF(NOT APPLE AND WITH_PCH) +IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp) -ENDIF(NOT APPLE AND WITH_PCH) +ENDIF(WITH_PCH) IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d) diff --git a/code/nel/src/3d/driver/opengl/EGL/egl.h b/code/nel/src/3d/driver/opengl/EGL/egl.h new file mode 100644 index 000000000..99ea342a4 --- /dev/null +++ b/code/nel/src/3d/driver/opengl/EGL/egl.h @@ -0,0 +1,329 @@ +/* -*- mode: c; tab-width: 8; -*- */ +/* vi: set sw=4 ts=8: */ +/* Reference version of egl.h for EGL 1.4. + * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $ + */ + +/* +** Copyright (c) 2007-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#ifndef __egl_h_ +#define __egl_h_ + +/* All platform-dependent types and macro boilerplate (such as EGLAPI + * and EGLAPIENTRY) should go in eglplatform.h. + */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* EGL Types */ +/* EGLint is defined in eglplatform.h */ +typedef unsigned int EGLBoolean; +typedef unsigned int EGLenum; +typedef void *EGLConfig; +typedef void *EGLContext; +typedef void *EGLDisplay; +typedef void *EGLSurface; +typedef void *EGLClientBuffer; + +/* EGL Versioning */ +#define EGL_VERSION_1_0 1 +#define EGL_VERSION_1_1 1 +#define EGL_VERSION_1_2 1 +#define EGL_VERSION_1_3 1 +#define EGL_VERSION_1_4 1 + +/* EGL Enumerants. Bitmasks and other exceptional cases aside, most + * enums are assigned unique values starting at 0x3000. + */ + +/* EGL aliases */ +#define EGL_FALSE 0 +#define EGL_TRUE 1 + +/* Out-of-band handle values */ +#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) +#define EGL_NO_CONTEXT ((EGLContext)0) +#define EGL_NO_DISPLAY ((EGLDisplay)0) +#define EGL_NO_SURFACE ((EGLSurface)0) + +/* Out-of-band attribute value */ +#define EGL_DONT_CARE ((EGLint)-1) + +/* Errors / GetError return values */ +#define EGL_SUCCESS 0x3000 +#define EGL_NOT_INITIALIZED 0x3001 +#define EGL_BAD_ACCESS 0x3002 +#define EGL_BAD_ALLOC 0x3003 +#define EGL_BAD_ATTRIBUTE 0x3004 +#define EGL_BAD_CONFIG 0x3005 +#define EGL_BAD_CONTEXT 0x3006 +#define EGL_BAD_CURRENT_SURFACE 0x3007 +#define EGL_BAD_DISPLAY 0x3008 +#define EGL_BAD_MATCH 0x3009 +#define EGL_BAD_NATIVE_PIXMAP 0x300A +#define EGL_BAD_NATIVE_WINDOW 0x300B +#define EGL_BAD_PARAMETER 0x300C +#define EGL_BAD_SURFACE 0x300D +#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */ + +/* Reserved 0x300F-0x301F for additional errors */ + +/* Config attributes */ +#define EGL_BUFFER_SIZE 0x3020 +#define EGL_ALPHA_SIZE 0x3021 +#define EGL_BLUE_SIZE 0x3022 +#define EGL_GREEN_SIZE 0x3023 +#define EGL_RED_SIZE 0x3024 +#define EGL_DEPTH_SIZE 0x3025 +#define EGL_STENCIL_SIZE 0x3026 +#define EGL_CONFIG_CAVEAT 0x3027 +#define EGL_CONFIG_ID 0x3028 +#define EGL_LEVEL 0x3029 +#define EGL_MAX_PBUFFER_HEIGHT 0x302A +#define EGL_MAX_PBUFFER_PIXELS 0x302B +#define EGL_MAX_PBUFFER_WIDTH 0x302C +#define EGL_NATIVE_RENDERABLE 0x302D +#define EGL_NATIVE_VISUAL_ID 0x302E +#define EGL_NATIVE_VISUAL_TYPE 0x302F +#define EGL_SAMPLES 0x3031 +#define EGL_SAMPLE_BUFFERS 0x3032 +#define EGL_SURFACE_TYPE 0x3033 +#define EGL_TRANSPARENT_TYPE 0x3034 +#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 +#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 +#define EGL_TRANSPARENT_RED_VALUE 0x3037 +#define EGL_NONE 0x3038 /* Attrib list terminator */ +#define EGL_BIND_TO_TEXTURE_RGB 0x3039 +#define EGL_BIND_TO_TEXTURE_RGBA 0x303A +#define EGL_MIN_SWAP_INTERVAL 0x303B +#define EGL_MAX_SWAP_INTERVAL 0x303C +#define EGL_LUMINANCE_SIZE 0x303D +#define EGL_ALPHA_MASK_SIZE 0x303E +#define EGL_COLOR_BUFFER_TYPE 0x303F +#define EGL_RENDERABLE_TYPE 0x3040 +#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */ +#define EGL_CONFORMANT 0x3042 + +/* Reserved 0x3041-0x304F for additional config attributes */ + +/* Config attribute values */ +#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */ +#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */ +#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */ +#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */ +#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */ + +/* More config attribute values, for EGL_TEXTURE_FORMAT */ +#define EGL_NO_TEXTURE 0x305C +#define EGL_TEXTURE_RGB 0x305D +#define EGL_TEXTURE_RGBA 0x305E +#define EGL_TEXTURE_2D 0x305F + +/* Config attribute mask bits */ +#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */ + +#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */ +#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */ +#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */ +#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */ + +/* QueryString targets */ +#define EGL_VENDOR 0x3053 +#define EGL_VERSION 0x3054 +#define EGL_EXTENSIONS 0x3055 +#define EGL_CLIENT_APIS 0x308D + +/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */ +#define EGL_HEIGHT 0x3056 +#define EGL_WIDTH 0x3057 +#define EGL_LARGEST_PBUFFER 0x3058 +#define EGL_TEXTURE_FORMAT 0x3080 +#define EGL_TEXTURE_TARGET 0x3081 +#define EGL_MIPMAP_TEXTURE 0x3082 +#define EGL_MIPMAP_LEVEL 0x3083 +#define EGL_RENDER_BUFFER 0x3086 +#define EGL_VG_COLORSPACE 0x3087 +#define EGL_VG_ALPHA_FORMAT 0x3088 +#define EGL_HORIZONTAL_RESOLUTION 0x3090 +#define EGL_VERTICAL_RESOLUTION 0x3091 +#define EGL_PIXEL_ASPECT_RATIO 0x3092 +#define EGL_SWAP_BEHAVIOR 0x3093 +#define EGL_MULTISAMPLE_RESOLVE 0x3099 + +/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */ +#define EGL_BACK_BUFFER 0x3084 +#define EGL_SINGLE_BUFFER 0x3085 + +/* OpenVG color spaces */ +#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */ +#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */ + +/* OpenVG alpha formats */ +#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */ +#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */ + +/* Constant scale factor by which fractional display resolutions & + * aspect ratio are scaled when queried as integer values. + */ +#define EGL_DISPLAY_SCALING 10000 + +/* Unknown display resolution/aspect ratio */ +#define EGL_UNKNOWN ((EGLint)-1) + +/* Back buffer swap behaviors */ +#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */ +#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */ + +/* CreatePbufferFromClientBuffer buffer types */ +#define EGL_OPENVG_IMAGE 0x3096 + +/* QueryContext targets */ +#define EGL_CONTEXT_CLIENT_TYPE 0x3097 + +/* CreateContext attributes */ +#define EGL_CONTEXT_CLIENT_VERSION 0x3098 + +/* Multisample resolution behaviors */ +#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */ +#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */ + +/* BindAPI/QueryAPI targets */ +#define EGL_OPENGL_ES_API 0x30A0 +#define EGL_OPENVG_API 0x30A1 +#define EGL_OPENGL_API 0x30A2 + +/* GetCurrentSurface targets */ +#define EGL_DRAW 0x3059 +#define EGL_READ 0x305A + +/* WaitNative engines */ +#define EGL_CORE_NATIVE_ENGINE 0x305B + +/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */ +#define EGL_COLORSPACE EGL_VG_COLORSPACE +#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT +#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB +#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR +#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE +#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE + +/* EGL extensions must request enum blocks from the Khronos + * API Registrar, who maintains the enumerant registry. Submit + * a bug in Khronos Bugzilla against task "Registry". + */ + + + +/* EGL Functions */ + +EGLAPI EGLint EGLAPIENTRY eglGetError(void); + +EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id); +EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor); +EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy); + +EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name); + +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, + EGLint config_size, EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, + EGLConfig *configs, EGLint config_size, + EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, + EGLint attribute, EGLint *value); + +EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, + EGLNativeWindowType win, + const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, + const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, + EGLNativePixmapType pixmap, + const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, + EGLint attribute, EGLint *value); + +EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api); +EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void); + +EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void); + +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void); + +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer( + EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, + EGLConfig config, const EGLint *attrib_list); + +EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, + EGLint attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); + + +EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval); + + +EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, + EGLContext share_context, + const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, + EGLSurface read, EGLContext ctx); + +EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void); +EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw); +EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, + EGLint attribute, EGLint *value); + +EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, + EGLNativePixmapType target); + +/* This is a generic function pointer type, whose name indicates it must + * be cast to the proper type *and calling convention* before use. + */ +typedef void (*__eglMustCastToProperFunctionPointerType)(void); + +/* Now, define eglGetProcAddress using the generic function ptr. type */ +EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY + eglGetProcAddress(const char *procname); + +#ifdef __cplusplus +} +#endif + +#endif /* __egl_h_ */ diff --git a/code/nel/src/3d/driver/opengl/EGL/eglext.h b/code/nel/src/3d/driver/opengl/EGL/eglext.h new file mode 100644 index 000000000..0d318b258 --- /dev/null +++ b/code/nel/src/3d/driver/opengl/EGL/eglext.h @@ -0,0 +1,428 @@ +#ifndef __eglext_h_ +#define __eglext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007-2012 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#include + +/*************************************************************/ + +/* Header file version number */ +/* Current version at http://www.khronos.org/registry/egl/ */ +/* $Revision: 17614 $ on $Date: 2012-04-26 06:56:02 -0700 (Thu, 26 Apr 2012) $ */ +#define EGL_EGLEXT_VERSION 12 + +#ifndef EGL_KHR_config_attribs +#define EGL_KHR_config_attribs 1 +#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */ +#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */ +#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */ +#endif + +#ifndef EGL_KHR_lock_surface +#define EGL_KHR_lock_surface 1 +#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */ +#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */ +#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */ +#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */ +#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */ +#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */ +#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */ +#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */ +#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */ +#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */ +#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */ +#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */ +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface); +#endif + +#ifndef EGL_KHR_image +#define EGL_KHR_image 1 +#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */ +typedef void *EGLImageKHR; +#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); +#endif + +#ifndef EGL_KHR_vg_parent_image +#define EGL_KHR_vg_parent_image 1 +#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */ +#endif + +#ifndef EGL_KHR_gl_texture_2D_image +#define EGL_KHR_gl_texture_2D_image 1 +#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */ +#endif + +#ifndef EGL_KHR_gl_texture_cubemap_image +#define EGL_KHR_gl_texture_cubemap_image 1 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */ +#endif + +#ifndef EGL_KHR_gl_texture_3D_image +#define EGL_KHR_gl_texture_3D_image 1 +#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */ +#endif + +#ifndef EGL_KHR_gl_renderbuffer_image +#define EGL_KHR_gl_renderbuffer_image 1 +#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */ +#endif + +#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */ +#ifndef EGL_KHR_reusable_sync +#define EGL_KHR_reusable_sync 1 + +typedef void* EGLSyncKHR; +typedef khronos_utime_nanoseconds_t EGLTimeKHR; + +#define EGL_SYNC_STATUS_KHR 0x30F1 +#define EGL_SIGNALED_KHR 0x30F2 +#define EGL_UNSIGNALED_KHR 0x30F3 +#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 +#define EGL_CONDITION_SATISFIED_KHR 0x30F6 +#define EGL_SYNC_TYPE_KHR 0x30F7 +#define EGL_SYNC_REUSABLE_KHR 0x30FA +#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR bitfield */ +#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull +#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0) +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#endif +#endif + +#ifndef EGL_KHR_image_base +#define EGL_KHR_image_base 1 +/* Most interfaces defined by EGL_KHR_image_pixmap above */ +#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */ +#endif + +#ifndef EGL_KHR_image_pixmap +#define EGL_KHR_image_pixmap 1 +/* Interfaces defined by EGL_KHR_image above */ +#endif + +#ifndef EGL_IMG_context_priority +#define EGL_IMG_context_priority 1 +#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 +#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 +#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 +#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 +#endif + +#ifndef EGL_KHR_lock_surface2 +#define EGL_KHR_lock_surface2 1 +#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110 +#endif + +#ifndef EGL_NV_coverage_sample +#define EGL_NV_coverage_sample 1 +#define EGL_COVERAGE_BUFFERS_NV 0x30E0 +#define EGL_COVERAGE_SAMPLES_NV 0x30E1 +#endif + +#ifndef EGL_NV_depth_nonlinear +#define EGL_NV_depth_nonlinear 1 +#define EGL_DEPTH_ENCODING_NV 0x30E2 +#define EGL_DEPTH_ENCODING_NONE_NV 0 +#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 +#endif + +#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */ +#ifndef EGL_NV_sync +#define EGL_NV_sync 1 +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 +#define EGL_SYNC_STATUS_NV 0x30E7 +#define EGL_SIGNALED_NV 0x30E8 +#define EGL_UNSIGNALED_NV 0x30E9 +#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 +#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull +#define EGL_ALREADY_SIGNALED_NV 0x30EA +#define EGL_TIMEOUT_EXPIRED_NV 0x30EB +#define EGL_CONDITION_SATISFIED_NV 0x30EC +#define EGL_SYNC_TYPE_NV 0x30ED +#define EGL_SYNC_CONDITION_NV 0x30EE +#define EGL_SYNC_FENCE_NV 0x30EF +#define EGL_NO_SYNC_NV ((EGLSyncNV)0) +typedef void* EGLSyncNV; +typedef khronos_utime_nanoseconds_t EGLTimeNV; +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync); +EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); +#endif +#endif + +#if KHRONOS_SUPPORT_INT64 /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */ +#ifndef EGL_KHR_fence_sync +#define EGL_KHR_fence_sync 1 +/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */ +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 +#define EGL_SYNC_CONDITION_KHR 0x30F8 +#define EGL_SYNC_FENCE_KHR 0x30F9 +#endif +#endif + +#ifndef EGL_HI_clientpixmap +#define EGL_HI_clientpixmap 1 + +/* Surface Attribute */ +#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74 +/* + * Structure representing a client pixmap + * (pixmap's data is in client-space memory). + */ +struct EGLClientPixmapHI +{ + void* pData; + EGLint iWidth; + EGLint iHeight; + EGLint iStride; +}; + +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap); +#endif /* EGL_HI_clientpixmap */ + +#ifndef EGL_HI_colorformats +#define EGL_HI_colorformats 1 +/* Config Attribute */ +#define EGL_COLOR_FORMAT_HI 0x8F70 +/* Color Formats */ +#define EGL_COLOR_RGB_HI 0x8F71 +#define EGL_COLOR_RGBA_HI 0x8F72 +#define EGL_COLOR_ARGB_HI 0x8F73 +#endif /* EGL_HI_colorformats */ + +#ifndef EGL_MESA_drm_image +#define EGL_MESA_drm_image 1 +#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */ +#define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */ +#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */ +#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */ +#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 +#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */ +#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 /* EGL_DRM_BUFFER_USE_MESA bits */ +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); +#endif + +#ifndef EGL_NV_post_sub_buffer +#define EGL_NV_post_sub_buffer 1 +#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); +#endif + +#ifndef EGL_ANGLE_query_surface_pointer +#define EGL_ANGLE_query_surface_pointer 1 +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); +#endif +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); +#endif + +#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle +#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1 +#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200 +#endif + +#ifndef EGL_NV_coverage_sample_resolve +#define EGL_NV_coverage_sample_resolve 1 +#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131 +#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132 +#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133 +#endif + +#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */ +#ifndef EGL_NV_system_time +#define EGL_NV_system_time 1 + +typedef khronos_utime_nanoseconds_t EGLuint64NV; + +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void); +EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void); +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void); +#endif +#endif + +#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */ +#ifndef EGL_KHR_stream +#define EGL_KHR_stream 1 +typedef void* EGLStreamKHR; +typedef khronos_uint64_t EGLuint64KHR; +#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0) +#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210 +#define EGL_PRODUCER_FRAME_KHR 0x3212 +#define EGL_CONSUMER_FRAME_KHR 0x3213 +#define EGL_STREAM_STATE_KHR 0x3214 +#define EGL_STREAM_STATE_CREATED_KHR 0x3215 +#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 +#define EGL_STREAM_STATE_EMPTY_KHR 0x3217 +#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218 +#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219 +#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A +#define EGL_BAD_STREAM_KHR 0x321B +#define EGL_BAD_STATE_KHR 0x321C +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStream64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAM64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +#endif +#endif + +#ifdef EGL_KHR_stream /* Requires KHR_stream extension */ +#ifndef EGL_KHR_stream_consumer_gltexture +#define EGL_KHR_stream_consumer_gltexture 1 +#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream); +#endif +#endif + +#ifdef EGL_KHR_stream /* Requires KHR_stream extension */ +#ifndef EGL_KHR_stream_producer_eglsurface +#define EGL_KHR_stream_producer_eglsurface 1 +#define EGL_STREAM_BIT_KHR 0x0800 +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); +#endif +#endif + +#ifdef EGL_KHR_stream /* Requires KHR_stream extension */ +#ifndef EGL_KHR_stream_producer_aldatalocator +#define EGL_KHR_stream_producer_aldatalocator 1 +#endif +#endif + +#ifdef EGL_KHR_stream /* Requires KHR_stream extension */ +#ifndef EGL_KHR_stream_fifo +#define EGL_KHR_stream_fifo 1 +/* reuse EGLTimeKHR */ +#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC +#define EGL_STREAM_TIME_NOW_KHR 0x31FD +#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE +#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); +#endif +#endif + +#ifndef EGL_EXT_create_context_robustness +#define EGL_EXT_create_context_robustness 1 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138 +#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF +#endif + +#ifndef EGL_ANGLE_d3d_share_handle_client_buffer +#define EGL_ANGLE_d3d_share_handle_client_buffer 1 +/* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/nel/src/3d/driver/opengl/EGL/eglplatform.h b/code/nel/src/3d/driver/opengl/EGL/eglplatform.h new file mode 100644 index 000000000..6d34ab55d --- /dev/null +++ b/code/nel/src/3d/driver/opengl/EGL/eglplatform.h @@ -0,0 +1,115 @@ +#ifndef __eglplatform_h_ +#define __eglplatform_h_ + +/* +** Copyright (c) 2007-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Platform-specific types and definitions for egl.h + * $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $ + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * You are encouraged to submit all modifications to the Khronos group so that + * they can be included in future versions of this file. Please submit changes + * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) + * by filing a bug against product "EGL" component "Registry". + */ + +#include + +/* Macros used in EGL function prototype declarations. + * + * EGL functions should be prototyped as: + * + * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); + * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); + * + * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h + */ + +#ifndef EGLAPI +#define EGLAPI KHRONOS_APICALL +#endif + +#ifndef EGLAPIENTRY +#define EGLAPIENTRY KHRONOS_APIENTRY +#endif +#define EGLAPIENTRYP EGLAPIENTRY* + +/* The types NativeDisplayType, NativeWindowType, and NativePixmapType + * are aliases of window-system-dependent types, such as X Display * or + * Windows Device Context. They must be defined in platform-specific + * code below. The EGL-prefixed versions of Native*Type are the same + * types, renamed in EGL 1.3 so all types in the API start with "EGL". + * + * Khronos STRONGLY RECOMMENDS that you use the default definitions + * provided below, since these changes affect both binary and source + * portability of applications using EGL running on different EGL + * implementations. + */ + +#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include + +typedef HDC EGLNativeDisplayType; +typedef HBITMAP EGLNativePixmapType; +typedef HWND EGLNativeWindowType; + +#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ + +typedef int EGLNativeDisplayType; +typedef void *EGLNativeWindowType; +typedef void *EGLNativePixmapType; + +#elif defined(__unix__) + +/* X11 (tentative) */ +#include +#include + +typedef Display *EGLNativeDisplayType; +typedef Pixmap EGLNativePixmapType; +typedef Window EGLNativeWindowType; + +#else +#error "Platform not recognized" +#endif + +/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ +typedef EGLNativeDisplayType NativeDisplayType; +typedef EGLNativePixmapType NativePixmapType; +typedef EGLNativeWindowType NativeWindowType; + + +/* Define EGLint. This must be a signed integral type large enough to contain + * all legal attribute names and values passed into and out of EGL, whether + * their type is boolean, bitmask, enumerant (symbolic constant), integer, + * handle, or other. While in general a 32-bit integer will suffice, if + * handles are 64 bit types, then EGLint should be defined as a signed 64-bit + * integer type. + */ +typedef khronos_int32_t EGLint; + +#endif /* __eglplatform_h */ diff --git a/code/nel/src/3d/driver/opengl/mac/glext.h b/code/nel/src/3d/driver/opengl/GL/glext.h similarity index 84% rename from code/nel/src/3d/driver/opengl/mac/glext.h rename to code/nel/src/3d/driver/opengl/GL/glext.h index 6bcd8c238..bd7b9b863 100644 --- a/code/nel/src/3d/driver/opengl/mac/glext.h +++ b/code/nel/src/3d/driver/opengl/GL/glext.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2007-2010 The Khronos Group Inc. +** Copyright (c) 2007-2012 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -29,9 +29,9 @@ extern "C" { */ /* Header file version number, required by OpenGL ABI for Linux */ -/* glext.h last updated $Date: 2010-05-17 09:47:20 -0700 (Mon, 17 May 2010) $ */ +/* glext.h last updated $Date: 2012-04-26 00:59:42 -0700 (Thu, 26 Apr 2012) $ */ /* Current version at http://www.opengl.org/registry/ */ -#define GL_GLEXT_VERSION 62 +#define GL_GLEXT_VERSION 81 /* Function declaration macros - to move into glplatform.h */ #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) @@ -516,8 +516,6 @@ extern "C" { #define GL_MINOR_VERSION 0x821C #define GL_NUM_EXTENSIONS 0x821D #define GL_CONTEXT_FLAGS 0x821E -#define GL_DEPTH_BUFFER 0x8223 -#define GL_STENCIL_BUFFER 0x8224 #define GL_COMPRESSED_RED 0x8225 #define GL_COMPRESSED_RG 0x8226 #define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 @@ -774,7 +772,7 @@ extern "C" { /* Reuse tokens from ARB_copy_buffer */ /* reuse GL_COPY_READ_BUFFER */ /* reuse GL_COPY_WRITE_BUFFER */ -/* Would reuse tokens from ARB_draw_instanced, but it has none */ +/* Reuse tokens from ARB_draw_instanced (none) */ /* Reuse tokens from ARB_uniform_buffer_object */ /* reuse GL_UNIFORM_BUFFER */ /* reuse GL_UNIFORM_BUFFER_BINDING */ @@ -835,8 +833,8 @@ extern "C" { /* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ /* Reuse tokens from ARB_depth_clamp */ /* reuse GL_DEPTH_CLAMP */ -/* Would reuse tokens from ARB_draw_elements_base_vertex, but it has none */ -/* Would reuse tokens from ARB_fragment_coord_conventions, but it has none */ +/* Reuse tokens from ARB_draw_elements_base_vertex (none) */ +/* Reuse tokens from ARB_fragment_coord_conventions (none) */ /* Reuse tokens from ARB_provoking_vertex */ /* reuse GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ /* reuse GL_FIRST_VERTEX_CONVENTION */ @@ -887,17 +885,18 @@ extern "C" { #endif #ifndef GL_VERSION_3_3 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE /* Reuse tokens from ARB_blend_func_extended */ /* reuse GL_SRC1_COLOR */ /* reuse GL_ONE_MINUS_SRC1_COLOR */ /* reuse GL_ONE_MINUS_SRC1_ALPHA */ /* reuse GL_MAX_DUAL_SOURCE_DRAW_BUFFERS */ -/* Would reuse tokens from ARB_explicit_attrib_location, but it has none */ +/* Reuse tokens from ARB_explicit_attrib_location (none) */ /* Reuse tokens from ARB_occlusion_query2 */ /* reuse GL_ANY_SAMPLES_PASSED */ /* Reuse tokens from ARB_sampler_objects */ /* reuse GL_SAMPLER_BINDING */ -/* Would reuse tokens from ARB_shader_bit_encoding, but it has none */ +/* Reuse tokens from ARB_shader_bit_encoding (none) */ /* Reuse tokens from ARB_texture_rgb10_a2ui */ /* reuse GL_RGB10_A2UI */ /* Reuse tokens from ARB_texture_swizzle */ @@ -914,6 +913,19 @@ extern "C" { #endif #ifndef GL_VERSION_4_0 +#define GL_SAMPLE_SHADING 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F +#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F +/* Reuse tokens from ARB_texture_query_lod (none) */ +/* Reuse tokens from ARB_draw_buffers_blend (none) */ /* Reuse tokens from ARB_draw_indirect */ /* reuse GL_DRAW_INDIRECT_BUFFER */ /* reuse GL_DRAW_INDIRECT_BUFFER_BINDING */ @@ -980,7 +992,7 @@ extern "C" { /* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER */ /* reuse GL_TESS_EVALUATION_SHADER */ /* reuse GL_TESS_CONTROL_SHADER */ -/* Would reuse tokens from ARB_texture_buffer_object_rgb32, but it has none */ +/* Reuse tokens from ARB_texture_buffer_object_rgb32 (none) */ /* Reuse tokens from ARB_transform_feedback2 */ /* reuse GL_TRANSFORM_FEEDBACK */ /* reuse GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */ @@ -991,6 +1003,167 @@ extern "C" { /* reuse GL_MAX_VERTEX_STREAMS */ #endif +#ifndef GL_VERSION_4_1 +/* Reuse tokens from ARB_ES2_compatibility */ +/* reuse GL_FIXED */ +/* reuse GL_IMPLEMENTATION_COLOR_READ_TYPE */ +/* reuse GL_IMPLEMENTATION_COLOR_READ_FORMAT */ +/* reuse GL_LOW_FLOAT */ +/* reuse GL_MEDIUM_FLOAT */ +/* reuse GL_HIGH_FLOAT */ +/* reuse GL_LOW_INT */ +/* reuse GL_MEDIUM_INT */ +/* reuse GL_HIGH_INT */ +/* reuse GL_SHADER_COMPILER */ +/* reuse GL_NUM_SHADER_BINARY_FORMATS */ +/* reuse GL_MAX_VERTEX_UNIFORM_VECTORS */ +/* reuse GL_MAX_VARYING_VECTORS */ +/* reuse GL_MAX_FRAGMENT_UNIFORM_VECTORS */ +/* reuse GL_RGB565 */ +/* Reuse tokens from ARB_get_program_binary */ +/* reuse GL_PROGRAM_BINARY_RETRIEVABLE_HINT */ +/* reuse GL_PROGRAM_BINARY_LENGTH */ +/* reuse GL_NUM_PROGRAM_BINARY_FORMATS */ +/* reuse GL_PROGRAM_BINARY_FORMATS */ +/* Reuse tokens from ARB_separate_shader_objects */ +/* reuse GL_VERTEX_SHADER_BIT */ +/* reuse GL_FRAGMENT_SHADER_BIT */ +/* reuse GL_GEOMETRY_SHADER_BIT */ +/* reuse GL_TESS_CONTROL_SHADER_BIT */ +/* reuse GL_TESS_EVALUATION_SHADER_BIT */ +/* reuse GL_ALL_SHADER_BITS */ +/* reuse GL_PROGRAM_SEPARABLE */ +/* reuse GL_ACTIVE_PROGRAM */ +/* reuse GL_PROGRAM_PIPELINE_BINDING */ +/* Reuse tokens from ARB_shader_precision (none) */ +/* Reuse tokens from ARB_vertex_attrib_64bit - all are in GL 3.0 and 4.0 already */ +/* Reuse tokens from ARB_viewport_array - some are in GL 1.1 and ARB_provoking_vertex already */ +/* reuse GL_MAX_VIEWPORTS */ +/* reuse GL_VIEWPORT_SUBPIXEL_BITS */ +/* reuse GL_VIEWPORT_BOUNDS_RANGE */ +/* reuse GL_LAYER_PROVOKING_VERTEX */ +/* reuse GL_VIEWPORT_INDEX_PROVOKING_VERTEX */ +/* reuse GL_UNDEFINED_VERTEX */ +#endif + +#ifndef GL_VERSION_4_2 +/* Reuse tokens from ARB_base_instance (none) */ +/* Reuse tokens from ARB_shading_language_420pack (none) */ +/* Reuse tokens from ARB_transform_feedback_instanced (none) */ +/* Reuse tokens from ARB_compressed_texture_pixel_storage */ +/* reuse GL_UNPACK_COMPRESSED_BLOCK_WIDTH */ +/* reuse GL_UNPACK_COMPRESSED_BLOCK_HEIGHT */ +/* reuse GL_UNPACK_COMPRESSED_BLOCK_DEPTH */ +/* reuse GL_UNPACK_COMPRESSED_BLOCK_SIZE */ +/* reuse GL_PACK_COMPRESSED_BLOCK_WIDTH */ +/* reuse GL_PACK_COMPRESSED_BLOCK_HEIGHT */ +/* reuse GL_PACK_COMPRESSED_BLOCK_DEPTH */ +/* reuse GL_PACK_COMPRESSED_BLOCK_SIZE */ +/* Reuse tokens from ARB_conservative_depth (none) */ +/* Reuse tokens from ARB_internalformat_query */ +/* reuse GL_NUM_SAMPLE_COUNTS */ +/* Reuse tokens from ARB_map_buffer_alignment */ +/* reuse GL_MIN_MAP_BUFFER_ALIGNMENT */ +/* Reuse tokens from ARB_shader_atomic_counters */ +/* reuse GL_ATOMIC_COUNTER_BUFFER */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_BINDING */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_START */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_SIZE */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER */ +/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER */ +/* reuse GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS */ +/* reuse GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS */ +/* reuse GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS */ +/* reuse GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS */ +/* reuse GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS */ +/* reuse GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS */ +/* reuse GL_MAX_VERTEX_ATOMIC_COUNTERS */ +/* reuse GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS */ +/* reuse GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS */ +/* reuse GL_MAX_GEOMETRY_ATOMIC_COUNTERS */ +/* reuse GL_MAX_FRAGMENT_ATOMIC_COUNTERS */ +/* reuse GL_MAX_COMBINED_ATOMIC_COUNTERS */ +/* reuse GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE */ +/* reuse GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS */ +/* reuse GL_ACTIVE_ATOMIC_COUNTER_BUFFERS */ +/* reuse GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX */ +/* reuse GL_UNSIGNED_INT_ATOMIC_COUNTER */ +/* Reuse tokens from ARB_shader_image_load_store */ +/* reuse GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT */ +/* reuse GL_ELEMENT_ARRAY_BARRIER_BIT */ +/* reuse GL_UNIFORM_BARRIER_BIT */ +/* reuse GL_TEXTURE_FETCH_BARRIER_BIT */ +/* reuse GL_SHADER_IMAGE_ACCESS_BARRIER_BIT */ +/* reuse GL_COMMAND_BARRIER_BIT */ +/* reuse GL_PIXEL_BUFFER_BARRIER_BIT */ +/* reuse GL_TEXTURE_UPDATE_BARRIER_BIT */ +/* reuse GL_BUFFER_UPDATE_BARRIER_BIT */ +/* reuse GL_FRAMEBUFFER_BARRIER_BIT */ +/* reuse GL_TRANSFORM_FEEDBACK_BARRIER_BIT */ +/* reuse GL_ATOMIC_COUNTER_BARRIER_BIT */ +/* reuse GL_ALL_BARRIER_BITS */ +/* reuse GL_MAX_IMAGE_UNITS */ +/* reuse GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS */ +/* reuse GL_IMAGE_BINDING_NAME */ +/* reuse GL_IMAGE_BINDING_LEVEL */ +/* reuse GL_IMAGE_BINDING_LAYERED */ +/* reuse GL_IMAGE_BINDING_LAYER */ +/* reuse GL_IMAGE_BINDING_ACCESS */ +/* reuse GL_IMAGE_1D */ +/* reuse GL_IMAGE_2D */ +/* reuse GL_IMAGE_3D */ +/* reuse GL_IMAGE_2D_RECT */ +/* reuse GL_IMAGE_CUBE */ +/* reuse GL_IMAGE_BUFFER */ +/* reuse GL_IMAGE_1D_ARRAY */ +/* reuse GL_IMAGE_2D_ARRAY */ +/* reuse GL_IMAGE_CUBE_MAP_ARRAY */ +/* reuse GL_IMAGE_2D_MULTISAMPLE */ +/* reuse GL_IMAGE_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_INT_IMAGE_1D */ +/* reuse GL_INT_IMAGE_2D */ +/* reuse GL_INT_IMAGE_3D */ +/* reuse GL_INT_IMAGE_2D_RECT */ +/* reuse GL_INT_IMAGE_CUBE */ +/* reuse GL_INT_IMAGE_BUFFER */ +/* reuse GL_INT_IMAGE_1D_ARRAY */ +/* reuse GL_INT_IMAGE_2D_ARRAY */ +/* reuse GL_INT_IMAGE_CUBE_MAP_ARRAY */ +/* reuse GL_INT_IMAGE_2D_MULTISAMPLE */ +/* reuse GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_UNSIGNED_INT_IMAGE_1D */ +/* reuse GL_UNSIGNED_INT_IMAGE_2D */ +/* reuse GL_UNSIGNED_INT_IMAGE_3D */ +/* reuse GL_UNSIGNED_INT_IMAGE_2D_RECT */ +/* reuse GL_UNSIGNED_INT_IMAGE_CUBE */ +/* reuse GL_UNSIGNED_INT_IMAGE_BUFFER */ +/* reuse GL_UNSIGNED_INT_IMAGE_1D_ARRAY */ +/* reuse GL_UNSIGNED_INT_IMAGE_2D_ARRAY */ +/* reuse GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY */ +/* reuse GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE */ +/* reuse GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_MAX_IMAGE_SAMPLES */ +/* reuse GL_IMAGE_BINDING_FORMAT */ +/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_TYPE */ +/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE */ +/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS */ +/* reuse GL_MAX_VERTEX_IMAGE_UNIFORMS */ +/* reuse GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS */ +/* reuse GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS */ +/* reuse GL_MAX_GEOMETRY_IMAGE_UNIFORMS */ +/* reuse GL_MAX_FRAGMENT_IMAGE_UNIFORMS */ +/* reuse GL_MAX_COMBINED_IMAGE_UNIFORMS */ +/* Reuse tokens from ARB_shading_language_packing (none) */ +/* Reuse tokens from ARB_texture_storage */ +/* reuse GL_TEXTURE_IMMUTABLE_FORMAT */ +#endif + #ifndef GL_ARB_multitexture #define GL_TEXTURE0_ARB 0x84C0 #define GL_TEXTURE1_ARB 0x84C1 @@ -1710,8 +1883,10 @@ extern "C" { #endif #ifndef GL_ARB_copy_buffer -#define GL_COPY_READ_BUFFER 0x8F36 -#define GL_COPY_WRITE_BUFFER 0x8F37 +#define GL_COPY_READ_BUFFER_BINDING 0x8F36 +#define GL_COPY_READ_BUFFER GL_COPY_READ_BUFFER_BINDING +#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 +#define GL_COPY_WRITE_BUFFER GL_COPY_WRITE_BUFFER_BINDING #endif #ifndef GL_ARB_shader_texture_lod @@ -1788,18 +1963,18 @@ extern "C" { #endif #ifndef GL_ARB_sample_shading -#define GL_SAMPLE_SHADING 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 +#define GL_SAMPLE_SHADING_ARB 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37 #endif #ifndef GL_ARB_texture_cube_map_array -#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B -#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F +#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F #endif #ifndef GL_ARB_texture_gather @@ -1959,8 +2134,10 @@ extern "C" { #ifndef GL_ARB_transform_feedback2 #define GL_TRANSFORM_FEEDBACK 0x8E22 -#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED GL_TRANSFORM_FEEDBACK_PAUSED +#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE GL_TRANSFORM_FEEDBACK_ACTIVE #define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 #endif @@ -1969,6 +2146,259 @@ extern "C" { #define GL_MAX_VERTEX_STREAMS 0x8E71 #endif +#ifndef GL_ARB_ES2_compatibility +#define GL_FIXED 0x140C +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_RGB565 0x8D62 +#endif + +#ifndef GL_ARB_get_program_binary +#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 +#define GL_PROGRAM_BINARY_LENGTH 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE +#define GL_PROGRAM_BINARY_FORMATS 0x87FF +#endif + +#ifndef GL_ARB_separate_shader_objects +#define GL_VERTEX_SHADER_BIT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT 0x00000002 +#define GL_GEOMETRY_SHADER_BIT 0x00000004 +#define GL_TESS_CONTROL_SHADER_BIT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010 +#define GL_ALL_SHADER_BITS 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE 0x8258 +#define GL_ACTIVE_PROGRAM 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING 0x825A +#endif + +#ifndef GL_ARB_shader_precision +#endif + +#ifndef GL_ARB_vertex_attrib_64bit +/* reuse GL_RGB32I */ +/* reuse GL_DOUBLE_VEC2 */ +/* reuse GL_DOUBLE_VEC3 */ +/* reuse GL_DOUBLE_VEC4 */ +/* reuse GL_DOUBLE_MAT2 */ +/* reuse GL_DOUBLE_MAT3 */ +/* reuse GL_DOUBLE_MAT4 */ +/* reuse GL_DOUBLE_MAT2x3 */ +/* reuse GL_DOUBLE_MAT2x4 */ +/* reuse GL_DOUBLE_MAT3x2 */ +/* reuse GL_DOUBLE_MAT3x4 */ +/* reuse GL_DOUBLE_MAT4x2 */ +/* reuse GL_DOUBLE_MAT4x3 */ +#endif + +#ifndef GL_ARB_viewport_array +/* reuse GL_SCISSOR_BOX */ +/* reuse GL_VIEWPORT */ +/* reuse GL_DEPTH_RANGE */ +/* reuse GL_SCISSOR_TEST */ +#define GL_MAX_VIEWPORTS 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE 0x825D +#define GL_LAYER_PROVOKING_VERTEX 0x825E +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F +#define GL_UNDEFINED_VERTEX 0x8260 +/* reuse GL_FIRST_VERTEX_CONVENTION */ +/* reuse GL_LAST_VERTEX_CONVENTION */ +/* reuse GL_PROVOKING_VERTEX */ +#endif + +#ifndef GL_ARB_cl_event +#define GL_SYNC_CL_EVENT_ARB 0x8240 +#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241 +#endif + +#ifndef GL_ARB_debug_output +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245 +#define GL_DEBUG_SOURCE_API_ARB 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A +#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B +#define GL_DEBUG_TYPE_ERROR_ARB 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250 +#define GL_DEBUG_TYPE_OTHER_ARB 0x8251 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 +#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 +#endif + +#ifndef GL_ARB_robustness +/* reuse GL_NO_ERROR */ +#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 +#endif + +#ifndef GL_ARB_shader_stencil_export +#endif + +#ifndef GL_ARB_base_instance +#endif + +#ifndef GL_ARB_shading_language_420pack +#endif + +#ifndef GL_ARB_transform_feedback_instanced +#endif + +#ifndef GL_ARB_compressed_texture_pixel_storage +#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127 +#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128 +#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129 +#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A +#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B +#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C +#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D +#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E +#endif + +#ifndef GL_ARB_conservative_depth +#endif + +#ifndef GL_ARB_internalformat_query +#define GL_NUM_SAMPLE_COUNTS 0x9380 +#endif + +#ifndef GL_ARB_map_buffer_alignment +#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC +#endif + +#ifndef GL_ARB_shader_atomic_counters +#define GL_ATOMIC_COUNTER_BUFFER 0x92C0 +#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 +#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 +#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 +#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5 +#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9 +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA +#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB +#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF +#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 +#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 +#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5 +#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 +#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 +#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC +#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 +#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA +#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB +#endif + +#ifndef GL_ARB_shader_image_load_store +#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 +#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 +#define GL_UNIFORM_BARRIER_BIT 0x00000004 +#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 +#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 +#define GL_COMMAND_BARRIER_BIT 0x00000040 +#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 +#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 +#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 +#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 +#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 +#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 +#define GL_ALL_BARRIER_BITS 0xFFFFFFFF +#define GL_MAX_IMAGE_UNITS 0x8F38 +#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39 +#define GL_IMAGE_BINDING_NAME 0x8F3A +#define GL_IMAGE_BINDING_LEVEL 0x8F3B +#define GL_IMAGE_BINDING_LAYERED 0x8F3C +#define GL_IMAGE_BINDING_LAYER 0x8F3D +#define GL_IMAGE_BINDING_ACCESS 0x8F3E +#define GL_IMAGE_1D 0x904C +#define GL_IMAGE_2D 0x904D +#define GL_IMAGE_3D 0x904E +#define GL_IMAGE_2D_RECT 0x904F +#define GL_IMAGE_CUBE 0x9050 +#define GL_IMAGE_BUFFER 0x9051 +#define GL_IMAGE_1D_ARRAY 0x9052 +#define GL_IMAGE_2D_ARRAY 0x9053 +#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054 +#define GL_IMAGE_2D_MULTISAMPLE 0x9055 +#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056 +#define GL_INT_IMAGE_1D 0x9057 +#define GL_INT_IMAGE_2D 0x9058 +#define GL_INT_IMAGE_3D 0x9059 +#define GL_INT_IMAGE_2D_RECT 0x905A +#define GL_INT_IMAGE_CUBE 0x905B +#define GL_INT_IMAGE_BUFFER 0x905C +#define GL_INT_IMAGE_1D_ARRAY 0x905D +#define GL_INT_IMAGE_2D_ARRAY 0x905E +#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F +#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060 +#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061 +#define GL_UNSIGNED_INT_IMAGE_1D 0x9062 +#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 +#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 +#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065 +#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 +#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067 +#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068 +#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B +#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C +#define GL_MAX_IMAGE_SAMPLES 0x906D +#define GL_IMAGE_BINDING_FORMAT 0x906E +#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 +#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 +#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD +#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE +#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF +#endif + +#ifndef GL_ARB_shading_language_packing +#endif + +#ifndef GL_ARB_texture_storage +#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F +#endif + #ifndef GL_EXT_abgr #define GL_ABGR_EXT 0x8000 #endif @@ -4314,6 +4744,12 @@ extern "C" { #define GL_SEPARATE_ATTRIBS_NV 0x8C8D #define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E #define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F +#define GL_LAYER_NV 0x8DAA +#define GL_NEXT_BUFFER_NV -2 +#define GL_SKIP_COMPONENTS4_NV -3 +#define GL_SKIP_COMPONENTS3_NV -4 +#define GL_SKIP_COMPONENTS2_NV -5 +#define GL_SKIP_COMPONENTS1_NV -6 #endif #ifndef GL_EXT_bindable_uniform @@ -4651,6 +5087,9 @@ extern "C" { #define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31 #define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32 #define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33 +#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40 +#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41 +#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42 #endif #ifndef GL_NV_texture_barrier @@ -4660,7 +5099,7 @@ extern "C" { #endif #ifndef GL_AMD_seamless_cubemap_per_texture -/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS_ARB */ +/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */ #endif #ifndef GL_AMD_conservative_depth @@ -4745,6 +5184,10 @@ extern "C" { #define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B #define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C #define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F +#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44 +#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45 #endif #ifndef GL_NV_gpu_shader5 @@ -4827,6 +5270,214 @@ extern "C" { #define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150 #endif +#ifndef GL_NV_vdpau_interop +#define GL_SURFACE_STATE_NV 0x86EB +#define GL_SURFACE_REGISTERED_NV 0x86FD +#define GL_SURFACE_MAPPED_NV 0x8700 +#define GL_WRITE_DISCARD_NV 0x88BE +#endif + +#ifndef GL_AMD_transform_feedback3_lines_triangles +#endif + +#ifndef GL_AMD_depth_clamp_separate +#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E +#define GL_DEPTH_CLAMP_FAR_AMD 0x901F +#endif + +#ifndef GL_EXT_texture_sRGB_decode +#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 +#define GL_DECODE_EXT 0x8A49 +#define GL_SKIP_DECODE_EXT 0x8A4A +#endif + +#ifndef GL_NV_texture_multisample +#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045 +#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046 +#endif + +#ifndef GL_AMD_blend_minmax_factor +#define GL_FACTOR_MIN_AMD 0x901C +#define GL_FACTOR_MAX_AMD 0x901D +#endif + +#ifndef GL_AMD_sample_positions +#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F +#endif + +#ifndef GL_EXT_x11_sync_object +#define GL_SYNC_X11_FENCE_EXT 0x90E1 +#endif + +#ifndef GL_AMD_multi_draw_indirect +#endif + +#ifndef GL_EXT_framebuffer_multisample_blit_scaled +#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA +#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB +#endif + +#ifndef GL_NV_path_rendering +#define GL_PATH_FORMAT_SVG_NV 0x9070 +#define GL_PATH_FORMAT_PS_NV 0x9071 +#define GL_STANDARD_FONT_NAME_NV 0x9072 +#define GL_SYSTEM_FONT_NAME_NV 0x9073 +#define GL_FILE_NAME_NV 0x9074 +#define GL_PATH_STROKE_WIDTH_NV 0x9075 +#define GL_PATH_END_CAPS_NV 0x9076 +#define GL_PATH_INITIAL_END_CAP_NV 0x9077 +#define GL_PATH_TERMINAL_END_CAP_NV 0x9078 +#define GL_PATH_JOIN_STYLE_NV 0x9079 +#define GL_PATH_MITER_LIMIT_NV 0x907A +#define GL_PATH_DASH_CAPS_NV 0x907B +#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C +#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D +#define GL_PATH_DASH_OFFSET_NV 0x907E +#define GL_PATH_CLIENT_LENGTH_NV 0x907F +#define GL_PATH_FILL_MODE_NV 0x9080 +#define GL_PATH_FILL_MASK_NV 0x9081 +#define GL_PATH_FILL_COVER_MODE_NV 0x9082 +#define GL_PATH_STROKE_COVER_MODE_NV 0x9083 +#define GL_PATH_STROKE_MASK_NV 0x9084 +#define GL_PATH_SAMPLE_QUALITY_NV 0x9085 +#define GL_PATH_STROKE_BOUND_NV 0x9086 +#define GL_PATH_STROKE_OVERSAMPLE_COUNT_NV 0x9087 +#define GL_COUNT_UP_NV 0x9088 +#define GL_COUNT_DOWN_NV 0x9089 +#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A +#define GL_CONVEX_HULL_NV 0x908B +#define GL_MULTI_HULLS_NV 0x908C +#define GL_BOUNDING_BOX_NV 0x908D +#define GL_TRANSLATE_X_NV 0x908E +#define GL_TRANSLATE_Y_NV 0x908F +#define GL_TRANSLATE_2D_NV 0x9090 +#define GL_TRANSLATE_3D_NV 0x9091 +#define GL_AFFINE_2D_NV 0x9092 +#define GL_PROJECTIVE_2D_NV 0x9093 +#define GL_AFFINE_3D_NV 0x9094 +#define GL_PROJECTIVE_3D_NV 0x9095 +#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096 +#define GL_TRANSPOSE_PROJECTIVE_2D_NV 0x9097 +#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098 +#define GL_TRANSPOSE_PROJECTIVE_3D_NV 0x9099 +#define GL_UTF8_NV 0x909A +#define GL_UTF16_NV 0x909B +#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C +#define GL_PATH_COMMAND_COUNT_NV 0x909D +#define GL_PATH_COORD_COUNT_NV 0x909E +#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F +#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0 +#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1 +#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2 +#define GL_SQUARE_NV 0x90A3 +#define GL_ROUND_NV 0x90A4 +#define GL_TRIANGULAR_NV 0x90A5 +#define GL_BEVEL_NV 0x90A6 +#define GL_MITER_REVERT_NV 0x90A7 +#define GL_MITER_TRUNCATE_NV 0x90A8 +#define GL_SKIP_MISSING_GLYPH_NV 0x90A9 +#define GL_USE_MISSING_GLYPH_NV 0x90AA +#define GL_PATH_ERROR_POSITION_NV 0x90AB +#define GL_PATH_FOG_GEN_MODE_NV 0x90AC +#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD +#define GL_ADJACENT_PAIRS_NV 0x90AE +#define GL_FIRST_TO_REST_NV 0x90AF +#define GL_PATH_GEN_MODE_NV 0x90B0 +#define GL_PATH_GEN_COEFF_NV 0x90B1 +#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2 +#define GL_PATH_GEN_COMPONENTS_NV 0x90B3 +#define GL_PATH_STENCIL_FUNC_NV 0x90B7 +#define GL_PATH_STENCIL_REF_NV 0x90B8 +#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9 +#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD +#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE +#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF +#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4 +#define GL_MOVE_TO_RESETS_NV 0x90B5 +#define GL_MOVE_TO_CONTINUES_NV 0x90B6 +#define GL_CLOSE_PATH_NV 0x00 +#define GL_MOVE_TO_NV 0x02 +#define GL_RELATIVE_MOVE_TO_NV 0x03 +#define GL_LINE_TO_NV 0x04 +#define GL_RELATIVE_LINE_TO_NV 0x05 +#define GL_HORIZONTAL_LINE_TO_NV 0x06 +#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07 +#define GL_VERTICAL_LINE_TO_NV 0x08 +#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09 +#define GL_QUADRATIC_CURVE_TO_NV 0x0A +#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B +#define GL_CUBIC_CURVE_TO_NV 0x0C +#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D +#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E +#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F +#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10 +#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11 +#define GL_SMALL_CCW_ARC_TO_NV 0x12 +#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13 +#define GL_SMALL_CW_ARC_TO_NV 0x14 +#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15 +#define GL_LARGE_CCW_ARC_TO_NV 0x16 +#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17 +#define GL_LARGE_CW_ARC_TO_NV 0x18 +#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19 +#define GL_RESTART_PATH_NV 0xF0 +#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2 +#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4 +#define GL_RECT_NV 0xF6 +#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8 +#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA +#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC +#define GL_ARC_TO_NV 0xFE +#define GL_RELATIVE_ARC_TO_NV 0xFF +#define GL_BOLD_BIT_NV 0x01 +#define GL_ITALIC_BIT_NV 0x02 +#define GL_GLYPH_WIDTH_BIT_NV 0x01 +#define GL_GLYPH_HEIGHT_BIT_NV 0x02 +#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04 +#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08 +#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10 +#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20 +#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40 +#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80 +#define GL_GLYPH_HAS_KERNING_NV 0x100 +#define GL_FONT_X_MIN_BOUNDS_NV 0x00010000 +#define GL_FONT_Y_MIN_BOUNDS_NV 0x00020000 +#define GL_FONT_X_MAX_BOUNDS_NV 0x00040000 +#define GL_FONT_Y_MAX_BOUNDS_NV 0x00080000 +#define GL_FONT_UNITS_PER_EM_NV 0x00100000 +#define GL_FONT_ASCENDER_NV 0x00200000 +#define GL_FONT_DESCENDER_NV 0x00400000 +#define GL_FONT_HEIGHT_NV 0x00800000 +#define GL_FONT_MAX_ADVANCE_WIDTH_NV 0x01000000 +#define GL_FONT_MAX_ADVANCE_HEIGHT_NV 0x02000000 +#define GL_FONT_UNDERLINE_POSITION_NV 0x04000000 +#define GL_FONT_UNDERLINE_THICKNESS_NV 0x08000000 +#define GL_FONT_HAS_KERNING_NV 0x10000000 +#endif + +#ifndef GL_AMD_pinned_memory +#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160 +#endif + +#ifndef GL_AMD_stencil_operation_extended +#define GL_SET_AMD 0x874A +#define GL_REPLACE_VALUE_AMD 0x874B +#define GL_STENCIL_OP_VALUE_AMD 0x874C +#define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D +#endif + +#ifndef GL_AMD_vertex_shader_viewport_index +#endif + +#ifndef GL_AMD_vertex_shader_layer +#endif + +#ifndef GL_NV_bindless_texture +#endif + +#ifndef GL_NV_shader_atomic_float +#endif + /*************************************************************/ @@ -4851,9 +5502,9 @@ typedef ptrdiff_t GLsizeiptrARB; #ifndef GL_ARB_shader_objects /* GL types for program/shader text and shader object handles */ typedef char GLcharARB; -#if !defined(MAC_OS_X_VERSION_10_7) +//#if !defined(MAC_OS_X_VERSION_10_7) typedef unsigned int GLhandleARB; -#endif +//#endif #endif /* GL type for "half" precision (s10e5) float data in host memory */ @@ -4908,23 +5559,41 @@ typedef int64_t GLint64EXT; typedef uint64_t GLuint64EXT; #endif -#ifndef ARB_sync +#ifndef GL_ARB_sync typedef int64_t GLint64; typedef uint64_t GLuint64; typedef struct __GLsync *GLsync; #endif +#ifndef GL_ARB_cl_event +/* These incomplete types let us declare types compatible with OpenCL's cl_context and cl_event */ +struct _cl_context; +struct _cl_event; +#endif + +#ifndef GL_ARB_debug_output +typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); +#endif + +#ifndef GL_AMD_debug_output +typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam); +#endif + +#ifndef GL_NV_vdpau_interop +typedef GLintptr GLvdpauSurfaceNV; +#endif + #ifndef GL_VERSION_1_2 #define GL_VERSION_1_2 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); GLAPI void APIENTRY glBlendEquation (GLenum mode); GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); @@ -5006,7 +5675,7 @@ typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); #define GL_VERSION_1_3 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glActiveTexture (GLenum texture); -GLAPI void APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); +GLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); @@ -5016,7 +5685,7 @@ GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); @@ -5110,16 +5779,16 @@ typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); #define GL_VERSION_1_4 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); -GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount); GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param); GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param); GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount); typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); @@ -5258,7 +5927,7 @@ typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -GLAPI void APIENTRY glStencilFuncSeparate (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader); GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); @@ -5289,7 +5958,7 @@ GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoi GLAPI GLboolean APIENTRY glIsProgram (GLuint program); GLAPI GLboolean APIENTRY glIsShader (GLuint shader); GLAPI void APIENTRY glLinkProgram (GLuint program); -GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); +GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length); GLAPI void APIENTRY glUseProgram (GLuint program); GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0); GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); @@ -5352,7 +6021,7 @@ GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); @@ -5383,7 +6052,7 @@ typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); -typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length); typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); @@ -5479,7 +6148,7 @@ GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode); GLAPI void APIENTRY glEndTransformFeedback (void); GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); -GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode); GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp); GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode); @@ -5538,7 +6207,7 @@ typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar* const *varyings, GLenum bufferMode); typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); @@ -5615,12 +6284,10 @@ typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); -GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); #endif @@ -5636,18 +6303,65 @@ typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum atta /* ARB_texture_swizzle (no entry points) */ /* ARB_timer_query */ /* ARB_vertex_type_2_10_10_10_rev */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); #endif #ifndef GL_VERSION_4_0 #define GL_VERSION_4_0 1 /* OpenGL 4.0 also reuses entry points from these extensions: */ +/* ARB_texture_query_lod (no entry points) */ +/* ARB_draw_indirect */ /* ARB_gpu_shader5 (no entry points) */ /* ARB_gpu_shader_fp64 */ /* ARB_shader_subroutine */ /* ARB_tessellation_shader */ /* ARB_texture_buffer_object_rgb32 (no entry points) */ +/* ARB_texture_cube_map_array (no entry points) */ +/* ARB_texture_gather (no entry points) */ /* ARB_transform_feedback2 */ /* ARB_transform_feedback3 */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMinSampleShading (GLfloat value); +GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value); +typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif + +#ifndef GL_VERSION_4_1 +#define GL_VERSION_4_1 1 +/* OpenGL 4.1 reuses entry points from these extensions: */ +/* ARB_ES2_compatibility */ +/* ARB_get_program_binary */ +/* ARB_separate_shader_objects */ +/* ARB_shader_precision (no entry points) */ +/* ARB_vertex_attrib_64bit */ +/* ARB_viewport_array */ +#endif + +#ifndef GL_VERSION_4_2 +#define GL_VERSION_4_2 1 +/* OpenGL 4.2 reuses entry points from these extensions: */ +/* ARB_base_instance */ +/* ARB_shading_language_420pack (no entry points) */ +/* ARB_transform_feedback_instanced */ +/* ARB_compressed_texture_pixel_storage (no entry points) */ +/* ARB_conservative_depth (no entry points) */ +/* ARB_internalformat_query */ +/* ARB_map_buffer_alignment (no entry points) */ +/* ARB_shader_atomic_counters */ +/* ARB_shader_image_load_store */ +/* ARB_shading_language_packing (no entry points) */ +/* ARB_texture_storage */ #endif #ifndef GL_ARB_multitexture @@ -5741,9 +6455,9 @@ typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); #ifndef GL_ARB_multisample #define GL_ARB_multisample 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glSampleCoverageARB (GLclampf value, GLboolean invert); +GLAPI void APIENTRY glSampleCoverageARB (GLfloat value, GLboolean invert); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLfloat value, GLboolean invert); #endif #ifndef GL_ARB_texture_env_add @@ -6362,7 +7076,7 @@ typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array); #ifndef GL_ARB_uniform_buffer_object #define GL_ARB_uniform_buffer_object 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices); +GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices); GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); @@ -6370,7 +7084,7 @@ GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlo GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices); +typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* const *uniformNames, GLuint *uniformIndices); typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); @@ -6405,12 +7119,12 @@ typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum w GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex); -GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex); +GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, const GLint *basevertex); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex); -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, const GLint *basevertex); #endif #ifndef GL_ARB_fragment_coord_conventions @@ -6470,23 +7184,23 @@ typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask); #ifndef GL_ARB_draw_buffers_blend #define GL_ARB_draw_buffers_blend 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode); -GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst); -GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode); +GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst); +GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); #endif #ifndef GL_ARB_sample_shading #define GL_ARB_sample_shading 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMinSampleShading (GLclampf value); +GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLclampf value); +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value); #endif #ifndef GL_ARB_texture_cube_map_array @@ -6519,6 +7233,10 @@ typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params); #endif +#ifndef GL_ARB_texture_compression_bptc +#define GL_ARB_texture_compression_bptc 1 +#endif + #ifndef GL_ARB_blend_func_extended #define GL_ARB_blend_func_extended 1 #ifdef GL_GLEXT_PROTOTYPES @@ -6529,13 +7247,21 @@ typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, G typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name); #endif +#ifndef GL_ARB_explicit_attrib_location +#define GL_ARB_explicit_attrib_location 1 +#endif + +#ifndef GL_ARB_occlusion_query2 +#define GL_ARB_occlusion_query2 1 +#endif + #ifndef GL_ARB_sampler_objects #define GL_ARB_sampler_objects 1 #ifdef GL_GLEXT_PROTOTYPES GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler); -GLAPI void APIENTRY glBindSampler (GLenum unit, GLuint sampler); +GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler); GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); @@ -6545,12 +7271,12 @@ GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params); GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); -GLAPI void APIENTRY glGetSamplerParameterIfv (GLuint sampler, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler); -typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLenum unit, GLuint sampler); +typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); @@ -6560,7 +7286,19 @@ typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum p typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params); +#endif + +#ifndef GL_ARB_shader_bit_encoding +#define GL_ARB_shader_bit_encoding 1 +#endif + +#ifndef GL_ARB_texture_rgb10_a2ui +#define GL_ARB_texture_rgb10_a2ui 1 +#endif + +#ifndef GL_ARB_texture_swizzle +#define GL_ARB_texture_swizzle 1 #endif #ifndef GL_ARB_timer_query @@ -6667,6 +7405,10 @@ typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const GLvoid typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const GLvoid *indirect); #endif +#ifndef GL_ARB_gpu_shader5 +#define GL_ARB_gpu_shader5 1 +#endif + #ifndef GL_ARB_gpu_shader_fp64 #define GL_ARB_gpu_shader_fp64 1 #ifdef GL_GLEXT_PROTOTYPES @@ -6688,23 +7430,6 @@ GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboole GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params); -GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x); -GLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y); -GLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); -GLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x); typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); @@ -6724,23 +7449,6 @@ typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei co typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); #endif #ifndef GL_ARB_shader_subroutine @@ -6775,6 +7483,10 @@ typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values); #endif +#ifndef GL_ARB_texture_buffer_object_rgb32 +#define GL_ARB_texture_buffer_object_rgb32 1 +#endif + #ifndef GL_ARB_transform_feedback2 #define GL_ARB_transform_feedback2 1 #ifdef GL_GLEXT_PROTOTYPES @@ -6809,6 +7521,370 @@ typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); #endif +#ifndef GL_ARB_ES2_compatibility +#define GL_ARB_ES2_compatibility 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReleaseShaderCompiler (void); +GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); +GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f); +GLAPI void APIENTRY glClearDepthf (GLfloat d); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); +typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length); +typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); +typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); +#endif + +#ifndef GL_ARB_get_program_binary +#define GL_ARB_get_program_binary 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); +GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); +#endif + +#ifndef GL_ARB_separate_shader_objects +#define GL_ARB_separate_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program); +GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program); +GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar* const *strings); +GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines); +GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines); +GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params); +GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0); +GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0); +GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0); +GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0); +GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1); +GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1); +GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1); +GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value); +GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); +GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline); +GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar* const *strings); +typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines); +typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif + +#ifndef GL_ARB_vertex_attrib_64bit +#define GL_ARB_vertex_attrib_64bit 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params); +#endif + +#ifndef GL_ARB_viewport_array +#define GL_ARB_viewport_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v); +GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v); +GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v); +GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v); +GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f); +GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data); +GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f); +typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); +#endif + +#ifndef GL_ARB_cl_event +#define GL_ARB_cl_event 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context * context, struct _cl_event * event, GLbitfield flags); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context * context, struct _cl_event * event, GLbitfield flags); +#endif + +#ifndef GL_ARB_debug_output +#define GL_ARB_debug_output 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const GLvoid *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const GLvoid *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +#endif + +#ifndef GL_ARB_robustness +#define GL_ARB_robustness 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void); +GLAPI void APIENTRY glGetnMapdvARB (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +GLAPI void APIENTRY glGetnMapfvARB (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +GLAPI void APIENTRY glGetnMapivARB (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +GLAPI void APIENTRY glGetnPixelMapfvARB (GLenum map, GLsizei bufSize, GLfloat *values); +GLAPI void APIENTRY glGetnPixelMapuivARB (GLenum map, GLsizei bufSize, GLuint *values); +GLAPI void APIENTRY glGetnPixelMapusvARB (GLenum map, GLsizei bufSize, GLushort *values); +GLAPI void APIENTRY glGetnPolygonStippleARB (GLsizei bufSize, GLubyte *pattern); +GLAPI void APIENTRY glGetnColorTableARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table); +GLAPI void APIENTRY glGetnConvolutionFilterARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image); +GLAPI void APIENTRY glGetnSeparableFilterARB (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span); +GLAPI void APIENTRY glGetnHistogramARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values); +GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values); +GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img); +GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); +GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img); +GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void); +typedef void (APIENTRYP PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +typedef void (APIENTRYP PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +typedef void (APIENTRYP PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +typedef void (APIENTRYP PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint *values); +typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort *values); +typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte *pattern); +typedef void (APIENTRYP PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table); +typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image); +typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values); +typedef void (APIENTRYP PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values); +typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img); +typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); +typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img); +typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +#endif + +#ifndef GL_ARB_shader_stencil_export +#define GL_ARB_shader_stencil_export 1 +#endif + +#ifndef GL_ARB_base_instance +#define GL_ARB_base_instance 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance); +#endif + +#ifndef GL_ARB_shading_language_420pack +#define GL_ARB_shading_language_420pack 1 +#endif + +#ifndef GL_ARB_transform_feedback_instanced +#define GL_ARB_transform_feedback_instanced 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei primcount); +GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei primcount); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei primcount); +#endif + +#ifndef GL_ARB_compressed_texture_pixel_storage +#define GL_ARB_compressed_texture_pixel_storage 1 +#endif + +#ifndef GL_ARB_conservative_depth +#define GL_ARB_conservative_depth 1 +#endif + +#ifndef GL_ARB_internalformat_query +#define GL_ARB_internalformat_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +#endif + +#ifndef GL_ARB_map_buffer_alignment +#define GL_ARB_map_buffer_alignment 1 +#endif + +#ifndef GL_ARB_shader_atomic_counters +#define GL_ARB_shader_atomic_counters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); +#endif + +#ifndef GL_ARB_shader_image_load_store +#define GL_ARB_shader_image_load_store 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers); +#endif + +#ifndef GL_ARB_shading_language_packing +#define GL_ARB_shading_language_packing 1 +#endif + +#ifndef GL_ARB_texture_storage +#define GL_ARB_texture_storage 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GLAPI void APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GLAPI void APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GLAPI void APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif + #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 #endif @@ -6816,9 +7892,9 @@ typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index #ifndef GL_EXT_blend_color #define GL_EXT_blend_color 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glBlendColorEXT (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GLAPI void APIENTRY glBlendColorEXT (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); #endif #ifndef GL_EXT_polygon_offset @@ -7620,10 +8696,10 @@ typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); #ifndef GL_EXT_multi_draw_arrays #define GL_EXT_multi_draw_arrays 1 #ifdef GL_GLEXT_PROTOTYPES -GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); #endif @@ -8256,8 +9332,8 @@ GLAPI void APIENTRY glProgramParameter4dNV (GLenum target, GLuint index, GLdoubl GLAPI void APIENTRY glProgramParameter4dvNV (GLenum target, GLuint index, const GLdouble *v); GLAPI void APIENTRY glProgramParameter4fNV (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); GLAPI void APIENTRY glProgramParameter4fvNV (GLenum target, GLuint index, const GLfloat *v); -GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLuint count, const GLdouble *v); -GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLuint count, const GLfloat *v); +GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLsizei count, const GLdouble *v); +GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLsizei count, const GLfloat *v); GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei n, const GLuint *programs); GLAPI void APIENTRY glTrackMatrixNV (GLenum target, GLuint address, GLenum matrix, GLenum transform); GLAPI void APIENTRY glVertexAttribPointerNV (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); @@ -8321,8 +9397,8 @@ typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint in typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v); typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); @@ -9446,11 +10522,12 @@ GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint count, const GLint *att GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset); GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer); -GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); GLAPI void APIENTRY glActiveVaryingNV (GLuint program, const GLchar *name); GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint program, const GLchar *name); GLAPI void APIENTRY glGetActiveVaryingNV (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint program, GLuint index, GLint *location); +GLAPI void APIENTRY glTransformFeedbackStreamAttribsNV (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); @@ -9458,11 +10535,12 @@ typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, cons typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode); typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name); typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name); typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode); #endif #ifndef GL_EXT_bindable_uniform @@ -9714,6 +10792,9 @@ GLAPI void APIENTRY glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data); GLAPI GLvoid* APIENTRY glMapNamedBufferEXT (GLuint buffer, GLenum access); GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint buffer); +GLAPI GLvoid* APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length); +GLAPI void APIENTRY glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint buffer, GLenum pname, GLint *params); GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint buffer, GLenum pname, GLvoid* *params); GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data); @@ -9740,6 +10821,23 @@ GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint framebuffer, GLenu GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint texture, GLenum target, GLuint renderbuffer); GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum texunit, GLenum target, GLuint renderbuffer); +GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x); +GLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y); +GLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +GLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); @@ -9901,6 +10999,9 @@ typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data); typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access); typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer); +typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params); typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, GLvoid* *params); typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data); @@ -9927,6 +11028,23 @@ typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint frameb typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer); typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); #endif #ifndef GL_EXT_vertex_array_bgra @@ -9980,7 +11098,7 @@ GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsS GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data); +GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data); GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); @@ -9992,7 +11110,7 @@ typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLs typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data); typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); @@ -10239,18 +11357,122 @@ typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void); #ifndef GL_EXT_shader_image_load_store #define GL_EXT_shader_image_load_store 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindImageTextureEXT (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); +GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format); +typedef void (APIENTRYP PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers); #endif #ifndef GL_EXT_vertex_attrib_64bit #define GL_EXT_vertex_attrib_64bit 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribL1dEXT (GLuint index, GLdouble x); +GLAPI void APIENTRY glVertexAttribL2dEXT (GLuint index, GLdouble x, GLdouble y); +GLAPI void APIENTRY glVertexAttribL3dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glVertexAttribL4dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +GLAPI void APIENTRY glVertexAttribL1dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL2dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL3dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribL4dvEXT (GLuint index, const GLdouble *v); +GLAPI void APIENTRY glVertexAttribLPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glGetVertexAttribLdvEXT (GLuint index, GLenum pname, GLdouble *params); +GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); #endif #ifndef GL_NV_gpu_program5 #define GL_NV_gpu_program5 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramSubroutineParametersuivNV (GLenum target, GLsizei count, const GLuint *params); +GLAPI void APIENTRY glGetProgramSubroutineParameteruivNV (GLenum target, GLuint index, GLuint *param); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC) (GLenum target, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC) (GLenum target, GLuint index, GLuint *param); #endif #ifndef GL_NV_gpu_shader5 #define GL_NV_gpu_shader5 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x); +GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x); +GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params); +GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x); +GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x); +GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); +typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); +typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); #endif #ifndef GL_NV_shader_buffer_store @@ -10263,6 +11485,46 @@ typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void); #ifndef GL_NV_vertex_attrib_integer_64bit #define GL_NV_vertex_attrib_integer_64bit 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribL1i64NV (GLuint index, GLint64EXT x); +GLAPI void APIENTRY glVertexAttribL2i64NV (GLuint index, GLint64EXT x, GLint64EXT y); +GLAPI void APIENTRY glVertexAttribL3i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GLAPI void APIENTRY glVertexAttribL4i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GLAPI void APIENTRY glVertexAttribL1i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL2i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL3i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL4i64vNV (GLuint index, const GLint64EXT *v); +GLAPI void APIENTRY glVertexAttribL1ui64NV (GLuint index, GLuint64EXT x); +GLAPI void APIENTRY glVertexAttribL2ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y); +GLAPI void APIENTRY glVertexAttribL3ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GLAPI void APIENTRY glVertexAttribL4ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GLAPI void APIENTRY glVertexAttribL1ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glVertexAttribL2ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glVertexAttribL3ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glVertexAttribL4ui64vNV (GLuint index, const GLuint64EXT *v); +GLAPI void APIENTRY glGetVertexAttribLi64vNV (GLuint index, GLenum pname, GLint64EXT *params); +GLAPI void APIENTRY glGetVertexAttribLui64vNV (GLuint index, GLenum pname, GLuint64EXT *params); +GLAPI void APIENTRY glVertexAttribLFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride); #endif #ifndef GL_NV_multisample_coverage @@ -10271,6 +11533,278 @@ typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void); #ifndef GL_AMD_name_gen_delete #define GL_AMD_name_gen_delete 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenNamesAMD (GLenum identifier, GLuint num, GLuint *names); +GLAPI void APIENTRY glDeleteNamesAMD (GLenum identifier, GLuint num, const GLuint *names); +GLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint *names); +typedef void (APIENTRYP PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint *names); +typedef GLboolean (APIENTRYP PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name); +#endif + +#ifndef GL_AMD_debug_output +#define GL_AMD_debug_output 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); +GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, GLvoid *userParam); +GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, GLvoid *userParam); +typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message); +#endif + +#ifndef GL_NV_vdpau_interop +#define GL_NV_vdpau_interop 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVDPAUInitNV (const GLvoid *vdpDevice, const GLvoid *getProcAddress); +GLAPI void APIENTRY glVDPAUFiniNV (void); +GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +GLAPI void APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface); +GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface); +GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access); +GLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); +GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const GLvoid *vdpDevice, const GLvoid *getProcAddress); +typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void); +typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames); +typedef void (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface); +typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface); +typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access); +typedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces); +typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces); +#endif + +#ifndef GL_AMD_transform_feedback3_lines_triangles +#define GL_AMD_transform_feedback3_lines_triangles 1 +#endif + +#ifndef GL_AMD_depth_clamp_separate +#define GL_AMD_depth_clamp_separate 1 +#endif + +#ifndef GL_EXT_texture_sRGB_decode +#define GL_EXT_texture_sRGB_decode 1 +#endif + +#ifndef GL_NV_texture_multisample +#define GL_NV_texture_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage2DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTexImage3DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTextureImage2DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTextureImage3DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTextureImage2DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations); +#endif + +#ifndef GL_AMD_blend_minmax_factor +#define GL_AMD_blend_minmax_factor 1 +#endif + +#ifndef GL_AMD_sample_positions +#define GL_AMD_sample_positions 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLfloat *val); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat *val); +#endif + +#ifndef GL_EXT_x11_sync_object +#define GL_EXT_x11_sync_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLsync APIENTRY glImportSyncEXT (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLsync (APIENTRYP PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags); +#endif + +#ifndef GL_AMD_multi_draw_indirect +#define GL_AMD_multi_draw_indirect 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysIndirectAMD (GLenum mode, const GLvoid *indirect, GLsizei primcount, GLsizei stride); +GLAPI void APIENTRY glMultiDrawElementsIndirectAMD (GLenum mode, GLenum type, const GLvoid *indirect, GLsizei primcount, GLsizei stride); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const GLvoid *indirect, GLsizei primcount, GLsizei stride); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const GLvoid *indirect, GLsizei primcount, GLsizei stride); +#endif + +#ifndef GL_EXT_framebuffer_multisample_blit_scaled +#define GL_EXT_framebuffer_multisample_blit_scaled 1 +#endif + +#ifndef GL_NV_path_rendering +#define GL_NV_path_rendering 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range); +GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range); +GLAPI GLboolean APIENTRY glIsPathNV (GLuint path); +GLAPI void APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const GLvoid *coords); +GLAPI void APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const GLvoid *coords); +GLAPI void APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const GLvoid *coords); +GLAPI void APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const GLvoid *coords); +GLAPI void APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const GLvoid *pathString); +GLAPI void APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const GLvoid *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const GLvoid *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI void APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const GLvoid *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GLAPI void APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +GLAPI void APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath); +GLAPI void APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +GLAPI void APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value); +GLAPI void APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value); +GLAPI void APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value); +GLAPI void APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value); +GLAPI void APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +GLAPI void APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units); +GLAPI void APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask); +GLAPI void APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask); +GLAPI void APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glPathCoverDepthFuncNV (GLenum func); +GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); +GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); +GLAPI void APIENTRY glPathFogGenNV (GLenum genMode); +GLAPI void APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode); +GLAPI void APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode); +GLAPI void APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GLAPI void APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value); +GLAPI void APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands); +GLAPI void APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords); +GLAPI void APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray); +GLAPI void APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +GLAPI void APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +GLAPI void APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value); +GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value); +GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value); +GLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y); +GLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y); +GLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments); +GLAPI GLboolean APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range); +typedef void (APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); +typedef GLboolean (APIENTRYP PFNGLISPATHNVPROC) (GLuint path); +typedef void (APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const GLvoid *coords); +typedef void (APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const GLvoid *coords); +typedef void (APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const GLvoid *coords); +typedef void (APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const GLvoid *coords); +typedef void (APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const GLvoid *pathString); +typedef void (APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const GLvoid *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const GLvoid *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const GLvoid *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +typedef void (APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath); +typedef void (APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +typedef void (APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value); +typedef void (APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value); +typedef void (APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value); +typedef void (APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +typedef void (APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units); +typedef void (APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func); +typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode); +typedef void (APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value); +typedef void (APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands); +typedef void (APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords); +typedef void (APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray); +typedef void (APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +typedef void (APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +typedef void (APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value); +typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value); +typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value); +typedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); +typedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); +typedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); +typedef GLboolean (APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +#endif + +#ifndef GL_AMD_pinned_memory +#define GL_AMD_pinned_memory 1 +#endif + +#ifndef GL_AMD_stencil_operation_extended +#define GL_AMD_stencil_operation_extended 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilOpValueAMD (GLenum face, GLuint value); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value); +#endif + +#ifndef GL_AMD_vertex_shader_viewport_index +#define GL_AMD_vertex_shader_viewport_index 1 +#endif + +#ifndef GL_AMD_vertex_shader_layer +#define GL_AMD_vertex_shader_layer 1 +#endif + +#ifndef GL_NV_bindless_texture +#define GL_NV_bindless_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint64 APIENTRY glGetTextureHandleNV (GLuint texture); +GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler); +GLAPI void APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle); +GLAPI void APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle); +GLAPI GLuint64 APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +GLAPI void APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access); +GLAPI void APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle); +GLAPI void APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value); +GLAPI void APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value); +GLAPI void APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value); +GLAPI void APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +GLAPI GLboolean APIENTRY glIsTextureHandleResidentNV (GLuint64 handle); +GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); +typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access); +typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle); +#endif + +#ifndef GL_NV_shader_atomic_float +#define GL_NV_shader_atomic_float 1 #endif diff --git a/code/nel/src/3d/driver/opengl/GL/glxext.h b/code/nel/src/3d/driver/opengl/GL/glxext.h new file mode 100644 index 000000000..e640ff7e3 --- /dev/null +++ b/code/nel/src/3d/driver/opengl/GL/glxext.h @@ -0,0 +1,1001 @@ +#ifndef __glxext_h_ +#define __glxext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007-2012 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Function declaration macros - to move into glplatform.h */ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +/* glxext.h last updated 2012/02/29 */ +/* Current version at http://www.opengl.org/registry/ */ +#define GLX_GLXEXT_VERSION 33 + +#ifndef GLX_VERSION_1_3 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_DONT_CARE 0xFFFFFFFF +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_VISUAL_ID 0x800B +#define GLX_SCREEN 0x800C +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_PBUFFER_HEIGHT 0x8040 +#define GLX_PBUFFER_WIDTH 0x8041 +#endif + +#ifndef GLX_VERSION_1_4 +#define GLX_SAMPLE_BUFFERS 100000 +#define GLX_SAMPLES 100001 +#endif + +#ifndef GLX_ARB_get_proc_address +#endif + +#ifndef GLX_ARB_multisample +#define GLX_SAMPLE_BUFFERS_ARB 100000 +#define GLX_SAMPLES_ARB 100001 +#endif + +#ifndef GLX_ARB_vertex_buffer_object +#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095 +#endif + +#ifndef GLX_ARB_fbconfig_float +#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9 +#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004 +#endif + +#ifndef GLX_ARB_framebuffer_sRGB +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2 +#endif + +#ifndef GLX_ARB_create_context +#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define GLX_CONTEXT_FLAGS_ARB 0x2094 +#endif + +#ifndef GLX_ARB_create_context_profile +#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 +#endif + +#ifndef GLX_ARB_create_context_robustness +#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261 +#endif + +#ifndef GLX_SGIS_multisample +#define GLX_SAMPLE_BUFFERS_SGIS 100000 +#define GLX_SAMPLES_SGIS 100001 +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_X_VISUAL_TYPE_EXT 0x22 +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 +#define GLX_NONE_EXT 0x8000 +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 +#endif + +#ifndef GLX_SGI_swap_control +#endif + +#ifndef GLX_SGI_video_sync +#endif + +#ifndef GLX_SGI_make_current_read +#endif + +#ifndef GLX_SGIX_video_source +#endif + +#ifndef GLX_EXT_visual_rating +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D +/* reuse GLX_NONE_EXT */ +#endif + +#ifndef GLX_EXT_import_context +#define GLX_SHARE_CONTEXT_EXT 0x800A +#define GLX_VISUAL_ID_EXT 0x800B +#define GLX_SCREEN_EXT 0x800C +#endif + +#ifndef GLX_SGIX_fbconfig +#define GLX_WINDOW_BIT_SGIX 0x00000001 +#define GLX_PIXMAP_BIT_SGIX 0x00000002 +#define GLX_RGBA_BIT_SGIX 0x00000001 +#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 +#define GLX_DRAWABLE_TYPE_SGIX 0x8010 +#define GLX_RENDER_TYPE_SGIX 0x8011 +#define GLX_X_RENDERABLE_SGIX 0x8012 +#define GLX_FBCONFIG_ID_SGIX 0x8013 +#define GLX_RGBA_TYPE_SGIX 0x8014 +#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 +/* reuse GLX_SCREEN_EXT */ +#endif + +#ifndef GLX_SGIX_pbuffer +#define GLX_PBUFFER_BIT_SGIX 0x00000004 +#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 +#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 +#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 +#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 +#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 +#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 +#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 +#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A +#define GLX_PRESERVED_CONTENTS_SGIX 0x801B +#define GLX_LARGEST_PBUFFER_SGIX 0x801C +#define GLX_WIDTH_SGIX 0x801D +#define GLX_HEIGHT_SGIX 0x801E +#define GLX_EVENT_MASK_SGIX 0x801F +#define GLX_DAMAGED_SGIX 0x8020 +#define GLX_SAVED_SGIX 0x8021 +#define GLX_WINDOW_SGIX 0x8022 +#define GLX_PBUFFER_SGIX 0x8023 +#endif + +#ifndef GLX_SGI_cushion +#endif + +#ifndef GLX_SGIX_video_resize +#define GLX_SYNC_FRAME_SGIX 0x00000000 +#define GLX_SYNC_SWAP_SGIX 0x00000001 +#endif + +#ifndef GLX_SGIX_dmbuffer +#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 +#endif + +#ifndef GLX_SGIX_swap_group +#endif + +#ifndef GLX_SGIX_swap_barrier +#endif + +#ifndef GLX_SGIS_blended_overlay +#define GLX_BLENDED_RGBA_SGIS 0x8025 +#endif + +#ifndef GLX_SGIS_shared_multisample +#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 +#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 +#endif + +#ifndef GLX_SUN_get_transparent_index +#endif + +#ifndef GLX_3DFX_multisample +#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 +#define GLX_SAMPLES_3DFX 0x8051 +#endif + +#ifndef GLX_MESA_copy_sub_buffer +#endif + +#ifndef GLX_MESA_pixmap_colormap +#endif + +#ifndef GLX_MESA_release_buffers +#endif + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_3DFX_WINDOW_MODE_MESA 0x1 +#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 +#endif + +#ifndef GLX_SGIX_visual_select_group +#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 +#endif + +#ifndef GLX_OML_swap_method +#define GLX_SWAP_METHOD_OML 0x8060 +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 +#endif + +#ifndef GLX_OML_sync_control +#endif + +#ifndef GLX_NV_float_buffer +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 +#endif + +#ifndef GLX_SGIX_hyperpipe +#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80 +#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91 +#define GLX_BAD_HYPERPIPE_SGIX 92 +#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001 +#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002 +#define GLX_PIPE_RECT_SGIX 0x00000001 +#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002 +#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003 +#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004 +#define GLX_HYPERPIPE_ID_SGIX 0x8030 +#endif + +#ifndef GLX_MESA_agp_offset +#endif + +#ifndef GLX_EXT_fbconfig_packed_float +#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 +#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 +#endif + +#ifndef GLX_EXT_framebuffer_sRGB +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2 +#endif + +#ifndef GLX_EXT_texture_from_pixmap +#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 +#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 +#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 +#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 +#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 +#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 +#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 +#define GLX_Y_INVERTED_EXT 0x20D4 +#define GLX_TEXTURE_FORMAT_EXT 0x20D5 +#define GLX_TEXTURE_TARGET_EXT 0x20D6 +#define GLX_MIPMAP_TEXTURE_EXT 0x20D7 +#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 +#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 +#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA +#define GLX_TEXTURE_1D_EXT 0x20DB +#define GLX_TEXTURE_2D_EXT 0x20DC +#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD +#define GLX_FRONT_LEFT_EXT 0x20DE +#define GLX_FRONT_RIGHT_EXT 0x20DF +#define GLX_BACK_LEFT_EXT 0x20E0 +#define GLX_BACK_RIGHT_EXT 0x20E1 +#define GLX_FRONT_EXT GLX_FRONT_LEFT_EXT +#define GLX_BACK_EXT GLX_BACK_LEFT_EXT +#define GLX_AUX0_EXT 0x20E2 +#define GLX_AUX1_EXT 0x20E3 +#define GLX_AUX2_EXT 0x20E4 +#define GLX_AUX3_EXT 0x20E5 +#define GLX_AUX4_EXT 0x20E6 +#define GLX_AUX5_EXT 0x20E7 +#define GLX_AUX6_EXT 0x20E8 +#define GLX_AUX7_EXT 0x20E9 +#define GLX_AUX8_EXT 0x20EA +#define GLX_AUX9_EXT 0x20EB +#endif + +#ifndef GLX_NV_present_video +#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0 +#endif + +#ifndef GLX_NV_video_out +#define GLX_VIDEO_OUT_COLOR_NV 0x20C3 +#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4 +#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5 +#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define GLX_VIDEO_OUT_FRAME_NV 0x20C8 +#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9 +#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA +#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB +#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC +#endif + +#ifndef GLX_NV_swap_group +#endif + +#ifndef GLX_NV_video_capture +#define GLX_DEVICE_ID_NV 0x20CD +#define GLX_UNIQUE_ID_NV 0x20CE +#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF +#endif + +#ifndef GLX_EXT_swap_control +#define GLX_SWAP_INTERVAL_EXT 0x20F1 +#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 +#endif + +#ifndef GLX_NV_copy_image +#endif + +#ifndef GLX_INTEL_swap_event +#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000 +#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180 +#define GLX_COPY_COMPLETE_INTEL 0x8181 +#define GLX_FLIP_COMPLETE_INTEL 0x8182 +#endif + +#ifndef GLX_NV_multisample_coverage +#define GLX_COVERAGE_SAMPLES_NV 100001 +#define GLX_COLOR_SAMPLES_NV 0x20B3 +#endif + +#ifndef GLX_AMD_gpu_association +#define GLX_GPU_VENDOR_AMD 0x1F00 +#define GLX_GPU_RENDERER_STRING_AMD 0x1F01 +#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 +#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 +#define GLX_GPU_RAM_AMD 0x21A3 +#define GLX_GPU_CLOCK_AMD 0x21A4 +#define GLX_GPU_NUM_PIPES_AMD 0x21A5 +#define GLX_GPU_NUM_SIMD_AMD 0x21A6 +#define GLX_GPU_NUM_RB_AMD 0x21A7 +#define GLX_GPU_NUM_SPI_AMD 0x21A8 +#endif + +#ifndef GLX_EXT_create_context_es2_profile +#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 +#endif + +#ifndef GLX_EXT_swap_control_tear +#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3 +#endif + + +/*************************************************************/ + +#ifndef GLX_ARB_get_proc_address +typedef void (*__GLXextFuncPtr)(void); +#endif + +#ifndef GLX_SGIX_video_source +typedef XID GLXVideoSourceSGIX; +#endif + +#ifndef GLX_SGIX_fbconfig +typedef XID GLXFBConfigIDSGIX; +typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; +#endif + +#ifndef GLX_SGIX_pbuffer +typedef XID GLXPbufferSGIX; +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* i.d. of Drawable */ + int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */ + int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */ + unsigned int mask; /* mask indicating which buffers are affected*/ + int x, y; + int width, height; + int count; /* if nonzero, at least this many more */ +} GLXBufferClobberEventSGIX; +#endif + +#ifndef GLX_NV_video_output +typedef unsigned int GLXVideoDeviceNV; +#endif + +#ifndef GLX_NV_video_capture +typedef XID GLXVideoCaptureDeviceNV; +#endif + +#ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glext.h, so must be protected */ +#define GLEXT_64_TYPES_DEFINED +/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ +/* (as used in the GLX_OML_sync_control extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +#include /* Fallback option */ +#endif +#endif + +#ifndef GLX_VERSION_1_3 +#define GLX_VERSION_1_3 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXFBConfig * glXGetFBConfigs (Display *dpy, int screen, int *nelements); +extern GLXFBConfig * glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements); +extern int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value); +extern XVisualInfo * glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config); +extern GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +extern void glXDestroyWindow (Display *dpy, GLXWindow win); +extern GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +extern void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap); +extern GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list); +extern void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf); +extern void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +extern GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +extern Bool glXMakeContextCurrent (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +extern GLXDrawable glXGetCurrentReadDrawable (void); +extern Display * glXGetCurrentDisplay (void); +extern int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value); +extern void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask); +extern void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); +typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); +typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); +typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); +typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); +typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); +typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void); +typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void); +typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); +typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); +typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); +#endif + +#ifndef GLX_VERSION_1_4 +#define GLX_VERSION_1_4 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *procName); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); +#endif + +#ifndef GLX_ARB_get_proc_address +#define GLX_ARB_get_proc_address 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); +#endif + +#ifndef GLX_ARB_multisample +#define GLX_ARB_multisample 1 +#endif + +#ifndef GLX_ARB_fbconfig_float +#define GLX_ARB_fbconfig_float 1 +#endif + +#ifndef GLX_ARB_framebuffer_sRGB +#define GLX_ARB_framebuffer_sRGB 1 +#endif + +#ifndef GLX_ARB_create_context +#define GLX_ARB_create_context 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); +#endif + +#ifndef GLX_ARB_create_context_profile +#define GLX_ARB_create_context_profile 1 +#endif + +#ifndef GLX_ARB_create_context_robustness +#define GLX_ARB_create_context_robustness 1 +#endif + +#ifndef GLX_SGIS_multisample +#define GLX_SGIS_multisample 1 +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_EXT_visual_info 1 +#endif + +#ifndef GLX_SGI_swap_control +#define GLX_SGI_swap_control 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXSwapIntervalSGI (int interval); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); +#endif + +#ifndef GLX_SGI_video_sync +#define GLX_SGI_video_sync 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetVideoSyncSGI (unsigned int *count); +extern int glXWaitVideoSyncSGI (int divisor, int remainder, unsigned int *count); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count); +typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count); +#endif + +#ifndef GLX_SGI_make_current_read +#define GLX_SGI_make_current_read 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXMakeCurrentReadSGI (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +extern GLXDrawable glXGetCurrentReadDrawableSGI (void); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); +#endif + +#ifndef GLX_SGIX_video_source +#define GLX_SGIX_video_source 1 +#ifdef _VL_H +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); +extern void glXDestroyGLXVideoSourceSGIX (Display *dpy, GLXVideoSourceSGIX glxvideosource); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); +typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource); +#endif /* _VL_H */ +#endif + +#ifndef GLX_EXT_visual_rating +#define GLX_EXT_visual_rating 1 +#endif + +#ifndef GLX_EXT_import_context +#define GLX_EXT_import_context 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Display * glXGetCurrentDisplayEXT (void); +extern int glXQueryContextInfoEXT (Display *dpy, GLXContext context, int attribute, int *value); +extern GLXContextID glXGetContextIDEXT (const GLXContext context); +extern GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID); +extern void glXFreeContextEXT (Display *dpy, GLXContext context); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void); +typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value); +typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); +typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID); +typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context); +#endif + +#ifndef GLX_SGIX_fbconfig +#define GLX_SGIX_fbconfig 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetFBConfigAttribSGIX (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); +extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *dpy, int screen, int *attrib_list, int *nelements); +extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); +extern GLXContext glXCreateContextWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); +extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *dpy, GLXFBConfigSGIX config); +extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *dpy, XVisualInfo *vis); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); +typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements); +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); +typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); +typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config); +typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis); +#endif + +#ifndef GLX_SGIX_pbuffer +#define GLX_SGIX_pbuffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); +extern void glXDestroyGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf); +extern int glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); +extern void glXSelectEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long mask); +extern void glXGetSelectedEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long *mask); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); +typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf); +typedef int ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); +typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask); +typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask); +#endif + +#ifndef GLX_SGI_cushion +#define GLX_SGI_cushion 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCushionSGI (Display *dpy, Window window, float cushion); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion); +#endif + +#ifndef GLX_SGIX_video_resize +#define GLX_SGIX_video_resize 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXBindChannelToWindowSGIX (Display *display, int screen, int channel, Window window); +extern int glXChannelRectSGIX (Display *display, int screen, int channel, int x, int y, int w, int h); +extern int glXQueryChannelRectSGIX (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); +extern int glXQueryChannelDeltasSGIX (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); +extern int glXChannelRectSyncSGIX (Display *display, int screen, int channel, GLenum synctype); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window); +typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h); +typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); +typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); +typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype); +#endif + +#ifndef GLX_SGIX_dmbuffer +#define GLX_SGIX_dmbuffer 1 +#ifdef _DM_BUFFER_H_ +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXAssociateDMPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); +#endif /* _DM_BUFFER_H_ */ +#endif + +#ifndef GLX_SGIX_swap_group +#define GLX_SGIX_swap_group 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXJoinSwapGroupSGIX (Display *dpy, GLXDrawable drawable, GLXDrawable member); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); +#endif + +#ifndef GLX_SGIX_swap_barrier +#define GLX_SGIX_swap_barrier 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXBindSwapBarrierSGIX (Display *dpy, GLXDrawable drawable, int barrier); +extern Bool glXQueryMaxSwapBarriersSGIX (Display *dpy, int screen, int *max); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); +typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); +#endif + +#ifndef GLX_SUN_get_transparent_index +#define GLX_SUN_get_transparent_index 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); +#endif + +#ifndef GLX_MESA_copy_sub_buffer +#define GLX_MESA_copy_sub_buffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCopySubBufferMESA (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); +#endif + +#ifndef GLX_MESA_pixmap_colormap +#define GLX_MESA_pixmap_colormap 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); +#endif + +#ifndef GLX_MESA_release_buffers +#define GLX_MESA_release_buffers 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXReleaseBuffersMESA (Display *dpy, GLXDrawable drawable); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable); +#endif + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_MESA_set_3dfx_mode 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXSet3DfxModeMESA (int mode); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode); +#endif + +#ifndef GLX_SGIX_visual_select_group +#define GLX_SGIX_visual_select_group 1 +#endif + +#ifndef GLX_OML_swap_method +#define GLX_OML_swap_method 1 +#endif + +#ifndef GLX_OML_sync_control +#define GLX_OML_sync_control 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXGetSyncValuesOML (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); +extern Bool glXGetMscRateOML (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); +extern int64_t glXSwapBuffersMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); +extern Bool glXWaitForMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); +extern Bool glXWaitForSbcOML (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); +typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); +typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); +#endif + +#ifndef GLX_NV_float_buffer +#define GLX_NV_float_buffer 1 +#endif + +#ifndef GLX_SGIX_hyperpipe +#define GLX_SGIX_hyperpipe 1 + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int networkId; +} GLXHyperpipeNetworkSGIX; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int channel; + unsigned int + participationType; + int timeSlice; +} GLXHyperpipeConfigSGIX; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int srcXOrigin, srcYOrigin, srcWidth, srcHeight; + int destXOrigin, destYOrigin, destWidth, destHeight; +} GLXPipeRect; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int XOrigin, YOrigin, maxHeight, maxWidth; +} GLXPipeRectLimits; + +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXHyperpipeNetworkSGIX * glXQueryHyperpipeNetworkSGIX (Display *dpy, int *npipes); +extern int glXHyperpipeConfigSGIX (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); +extern GLXHyperpipeConfigSGIX * glXQueryHyperpipeConfigSGIX (Display *dpy, int hpId, int *npipes); +extern int glXDestroyHyperpipeConfigSGIX (Display *dpy, int hpId); +extern int glXBindHyperpipeSGIX (Display *dpy, int hpId); +extern int glXQueryHyperpipeBestAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); +extern int glXHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList); +extern int glXQueryHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes); +typedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); +typedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes); +typedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId); +typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId); +typedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); +typedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList); +typedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); +#endif + +#ifndef GLX_MESA_agp_offset +#define GLX_MESA_agp_offset 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern unsigned int glXGetAGPOffsetMESA (const void *pointer); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer); +#endif + +#ifndef GLX_EXT_fbconfig_packed_float +#define GLX_EXT_fbconfig_packed_float 1 +#endif + +#ifndef GLX_EXT_framebuffer_sRGB +#define GLX_EXT_framebuffer_sRGB 1 +#endif + +#ifndef GLX_EXT_texture_from_pixmap +#define GLX_EXT_texture_from_pixmap 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXBindTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list); +extern void glXReleaseTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list); +typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer); +#endif + +#ifndef GLX_NV_present_video +#define GLX_NV_present_video 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern unsigned int * glXEnumerateVideoDevicesNV (Display *dpy, int screen, int *nelements); +extern int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef unsigned int * ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements); +typedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list); +#endif + +#ifndef GLX_NV_video_output +#define GLX_NV_video_output 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetVideoDeviceNV (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice); +extern int glXReleaseVideoDeviceNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice); +extern int glXBindVideoImageNV (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer); +extern int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf); +extern int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock); +extern int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice); +typedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice); +typedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer); +typedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display *dpy, GLXPbuffer pbuf); +typedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock); +typedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +#endif + +#ifndef GLX_NV_swap_group +#define GLX_NV_swap_group 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXJoinSwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint group); +extern Bool glXBindSwapBarrierNV (Display *dpy, GLuint group, GLuint barrier); +extern Bool glXQuerySwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier); +extern Bool glXQueryMaxSwapGroupsNV (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers); +extern Bool glXQueryFrameCountNV (Display *dpy, int screen, GLuint *count); +extern Bool glXResetFrameCountNV (Display *dpy, int screen); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group); +typedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint group, GLuint barrier); +typedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier); +typedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers); +typedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display *dpy, int screen, GLuint *count); +typedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen); +#endif + +#ifndef GLX_NV_video_capture +#define GLX_NV_video_capture 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXBindVideoCaptureDeviceNV (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device); +extern GLXVideoCaptureDeviceNV * glXEnumerateVideoCaptureDevicesNV (Display *dpy, int screen, int *nelements); +extern void glXLockVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device); +extern int glXQueryVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value); +extern void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device); +typedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display *dpy, int screen, int *nelements); +typedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device); +typedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value); +typedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device); +#endif + +#ifndef GLX_EXT_swap_control +#define GLX_EXT_swap_control 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXSwapIntervalEXT (Display *dpy, GLXDrawable drawable, int interval); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, int interval); +#endif + +#ifndef GLX_NV_copy_image +#define GLX_NV_copy_image 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#endif + +#ifndef GLX_INTEL_swap_event +#define GLX_INTEL_swap_event 1 +#endif + +#ifndef GLX_NV_multisample_coverage +#define GLX_NV_multisample_coverage 1 +#endif + +#ifndef GLX_EXT_swap_control_tear +#define GLX_EXT_swap_control_tear 1 +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/nel/src/3d/driver/opengl/GL/wglext.h b/code/nel/src/3d/driver/opengl/GL/wglext.h new file mode 100644 index 000000000..b5dc7bf7f --- /dev/null +++ b/code/nel/src/3d/driver/opengl/GL/wglext.h @@ -0,0 +1,943 @@ +#ifndef __wglext_h_ +#define __wglext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007-2012 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Function declaration macros - to move into glplatform.h */ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number */ +/* wglext.h last updated 2012/01/04 */ +/* Current version at http://www.opengl.org/registry/ */ +#define WGL_WGLEXT_VERSION 24 + +#ifndef WGL_ARB_buffer_region +#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 +#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 +#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 +#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 +#endif + +#ifndef WGL_ARB_multisample +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 +#endif + +#ifndef WGL_ARB_extensions_string +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_STENCIL_ARB 0x200D +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F +#define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 +#define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 +#define WGL_COLOR_BITS_ARB 0x2014 +#define WGL_RED_BITS_ARB 0x2015 +#define WGL_RED_SHIFT_ARB 0x2016 +#define WGL_GREEN_BITS_ARB 0x2017 +#define WGL_GREEN_SHIFT_ARB 0x2018 +#define WGL_BLUE_BITS_ARB 0x2019 +#define WGL_BLUE_SHIFT_ARB 0x201A +#define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ALPHA_SHIFT_ARB 0x201C +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_DEPTH_BITS_ARB 0x2022 +#define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_SWAP_UNDEFINED_ARB 0x202A +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C +#endif + +#ifndef WGL_ARB_make_current_read +#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 +#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 +#endif + +#ifndef WGL_ARB_pbuffer +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E +#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 +#define WGL_PBUFFER_LARGEST_ARB 0x2033 +#define WGL_PBUFFER_WIDTH_ARB 0x2034 +#define WGL_PBUFFER_HEIGHT_ARB 0x2035 +#define WGL_PBUFFER_LOST_ARB 0x2036 +#endif + +#ifndef WGL_ARB_render_texture +#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 +#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 +#define WGL_TEXTURE_FORMAT_ARB 0x2072 +#define WGL_TEXTURE_TARGET_ARB 0x2073 +#define WGL_MIPMAP_TEXTURE_ARB 0x2074 +#define WGL_TEXTURE_RGB_ARB 0x2075 +#define WGL_TEXTURE_RGBA_ARB 0x2076 +#define WGL_NO_TEXTURE_ARB 0x2077 +#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 +#define WGL_TEXTURE_1D_ARB 0x2079 +#define WGL_TEXTURE_2D_ARB 0x207A +#define WGL_MIPMAP_LEVEL_ARB 0x207B +#define WGL_CUBE_MAP_FACE_ARB 0x207C +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 +#define WGL_FRONT_LEFT_ARB 0x2083 +#define WGL_FRONT_RIGHT_ARB 0x2084 +#define WGL_BACK_LEFT_ARB 0x2085 +#define WGL_BACK_RIGHT_ARB 0x2086 +#define WGL_AUX0_ARB 0x2087 +#define WGL_AUX1_ARB 0x2088 +#define WGL_AUX2_ARB 0x2089 +#define WGL_AUX3_ARB 0x208A +#define WGL_AUX4_ARB 0x208B +#define WGL_AUX5_ARB 0x208C +#define WGL_AUX6_ARB 0x208D +#define WGL_AUX7_ARB 0x208E +#define WGL_AUX8_ARB 0x208F +#define WGL_AUX9_ARB 0x2090 +#endif + +#ifndef WGL_ARB_pixel_format_float +#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 +#endif + +#ifndef WGL_ARB_framebuffer_sRGB +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9 +#endif + +#ifndef WGL_ARB_create_context +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define ERROR_INVALID_VERSION_ARB 0x2095 +#endif + +#ifndef WGL_ARB_create_context_profile +#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define ERROR_INVALID_PROFILE_ARB 0x2096 +#endif + +#ifndef WGL_ARB_create_context_robustness +#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004 +#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 +#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 +#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261 +#endif + +#ifndef WGL_EXT_make_current_read +#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 +#endif + +#ifndef WGL_EXT_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 +#define WGL_DRAW_TO_WINDOW_EXT 0x2001 +#define WGL_DRAW_TO_BITMAP_EXT 0x2002 +#define WGL_ACCELERATION_EXT 0x2003 +#define WGL_NEED_PALETTE_EXT 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 +#define WGL_SWAP_METHOD_EXT 0x2007 +#define WGL_NUMBER_OVERLAYS_EXT 0x2008 +#define WGL_NUMBER_UNDERLAYS_EXT 0x2009 +#define WGL_TRANSPARENT_EXT 0x200A +#define WGL_TRANSPARENT_VALUE_EXT 0x200B +#define WGL_SHARE_DEPTH_EXT 0x200C +#define WGL_SHARE_STENCIL_EXT 0x200D +#define WGL_SHARE_ACCUM_EXT 0x200E +#define WGL_SUPPORT_GDI_EXT 0x200F +#define WGL_SUPPORT_OPENGL_EXT 0x2010 +#define WGL_DOUBLE_BUFFER_EXT 0x2011 +#define WGL_STEREO_EXT 0x2012 +#define WGL_PIXEL_TYPE_EXT 0x2013 +#define WGL_COLOR_BITS_EXT 0x2014 +#define WGL_RED_BITS_EXT 0x2015 +#define WGL_RED_SHIFT_EXT 0x2016 +#define WGL_GREEN_BITS_EXT 0x2017 +#define WGL_GREEN_SHIFT_EXT 0x2018 +#define WGL_BLUE_BITS_EXT 0x2019 +#define WGL_BLUE_SHIFT_EXT 0x201A +#define WGL_ALPHA_BITS_EXT 0x201B +#define WGL_ALPHA_SHIFT_EXT 0x201C +#define WGL_ACCUM_BITS_EXT 0x201D +#define WGL_ACCUM_RED_BITS_EXT 0x201E +#define WGL_ACCUM_GREEN_BITS_EXT 0x201F +#define WGL_ACCUM_BLUE_BITS_EXT 0x2020 +#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 +#define WGL_DEPTH_BITS_EXT 0x2022 +#define WGL_STENCIL_BITS_EXT 0x2023 +#define WGL_AUX_BUFFERS_EXT 0x2024 +#define WGL_NO_ACCELERATION_EXT 0x2025 +#define WGL_GENERIC_ACCELERATION_EXT 0x2026 +#define WGL_FULL_ACCELERATION_EXT 0x2027 +#define WGL_SWAP_EXCHANGE_EXT 0x2028 +#define WGL_SWAP_COPY_EXT 0x2029 +#define WGL_SWAP_UNDEFINED_EXT 0x202A +#define WGL_TYPE_RGBA_EXT 0x202B +#define WGL_TYPE_COLORINDEX_EXT 0x202C +#endif + +#ifndef WGL_EXT_pbuffer +#define WGL_DRAW_TO_PBUFFER_EXT 0x202D +#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E +#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 +#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 +#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 +#define WGL_PBUFFER_LARGEST_EXT 0x2033 +#define WGL_PBUFFER_WIDTH_EXT 0x2034 +#define WGL_PBUFFER_HEIGHT_EXT 0x2035 +#endif + +#ifndef WGL_EXT_depth_float +#define WGL_DEPTH_FLOAT_EXT 0x2040 +#endif + +#ifndef WGL_3DFX_multisample +#define WGL_SAMPLE_BUFFERS_3DFX 0x2060 +#define WGL_SAMPLES_3DFX 0x2061 +#endif + +#ifndef WGL_EXT_multisample +#define WGL_SAMPLE_BUFFERS_EXT 0x2041 +#define WGL_SAMPLES_EXT 0x2042 +#endif + +#ifndef WGL_I3D_digital_video_control +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 +#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 +#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 +#endif + +#ifndef WGL_I3D_gamma +#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E +#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F +#endif + +#ifndef WGL_I3D_genlock +#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 +#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045 +#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046 +#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047 +#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 +#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 +#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A +#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B +#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C +#endif + +#ifndef WGL_I3D_image_buffer +#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 +#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 +#endif + +#ifndef WGL_I3D_swap_frame_lock +#endif + +#ifndef WGL_NV_render_depth_texture +#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 +#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 +#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 +#define WGL_DEPTH_COMPONENT_NV 0x20A7 +#endif + +#ifndef WGL_NV_render_texture_rectangle +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 +#define WGL_TEXTURE_RECTANGLE_NV 0x20A2 +#endif + +#ifndef WGL_ATI_pixel_format_float +#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 +#endif + +#ifndef WGL_NV_float_buffer +#define WGL_FLOAT_COMPONENTS_NV 0x20B0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 +#define WGL_TEXTURE_FLOAT_R_NV 0x20B5 +#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 +#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 +#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 +#endif + +#ifndef WGL_3DL_stereo_control +#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 +#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 +#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 +#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 +#endif + +#ifndef WGL_EXT_pixel_format_packed_float +#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 +#endif + +#ifndef WGL_EXT_framebuffer_sRGB +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9 +#endif + +#ifndef WGL_NV_present_video +#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 +#endif + +#ifndef WGL_NV_video_out +#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0 +#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1 +#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2 +#define WGL_VIDEO_OUT_COLOR_NV 0x20C3 +#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4 +#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5 +#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define WGL_VIDEO_OUT_FRAME 0x20C8 +#define WGL_VIDEO_OUT_FIELD_1 0x20C9 +#define WGL_VIDEO_OUT_FIELD_2 0x20CA +#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB +#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC +#endif + +#ifndef WGL_NV_swap_group +#endif + +#ifndef WGL_NV_gpu_affinity +#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0 +#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1 +#endif + +#ifndef WGL_AMD_gpu_association +#define WGL_GPU_VENDOR_AMD 0x1F00 +#define WGL_GPU_RENDERER_STRING_AMD 0x1F01 +#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 +#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 +#define WGL_GPU_RAM_AMD 0x21A3 +#define WGL_GPU_CLOCK_AMD 0x21A4 +#define WGL_GPU_NUM_PIPES_AMD 0x21A5 +#define WGL_GPU_NUM_SIMD_AMD 0x21A6 +#define WGL_GPU_NUM_RB_AMD 0x21A7 +#define WGL_GPU_NUM_SPI_AMD 0x21A8 +#endif + +#ifndef WGL_NV_video_capture +#define WGL_UNIQUE_ID_NV 0x20CE +#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF +#endif + +#ifndef WGL_NV_copy_image +#endif + +#ifndef WGL_NV_multisample_coverage +#define WGL_COVERAGE_SAMPLES_NV 0x2042 +#define WGL_COLOR_SAMPLES_NV 0x20B9 +#endif + +#ifndef WGL_EXT_create_context_es2_profile +#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 +#endif + +#ifndef WGL_NV_DX_interop +#define WGL_ACCESS_READ_ONLY_NV 0x00000000 +#define WGL_ACCESS_READ_WRITE_NV 0x00000001 +#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002 +#endif + +#ifndef WGL_NV_DX_interop2 +#endif + +#ifndef WGL_EXT_swap_control_tear +#endif + + +/*************************************************************/ + +#ifndef WGL_ARB_pbuffer +DECLARE_HANDLE(HPBUFFERARB); +#endif +#ifndef WGL_EXT_pbuffer +DECLARE_HANDLE(HPBUFFEREXT); +#endif +#ifndef WGL_NV_present_video +DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); +#endif +#ifndef WGL_NV_video_output +DECLARE_HANDLE(HPVIDEODEV); +#endif +#ifndef WGL_NV_gpu_affinity +DECLARE_HANDLE(HPGPUNV); +DECLARE_HANDLE(HGPUNV); + +typedef struct _GPU_DEVICE { + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD Flags; + RECT rcVirtualScreen; +} GPU_DEVICE, *PGPU_DEVICE; +#endif +#ifndef WGL_NV_video_capture +DECLARE_HANDLE(HVIDEOINPUTDEVICENV); +#endif + +#ifndef WGL_ARB_buffer_region +#define WGL_ARB_buffer_region 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType); +extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion); +extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height); +extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); +typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); +typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); +typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +#endif + +#ifndef WGL_ARB_multisample +#define WGL_ARB_multisample 1 +#endif + +#ifndef WGL_ARB_extensions_string +#define WGL_ARB_extensions_string 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern const char * WINAPI wglGetExtensionsStringARB (HDC hdc); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_ARB_pixel_format 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); +extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); +extern BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif + +#ifndef WGL_ARB_make_current_read +#define WGL_ARB_make_current_read 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +extern HDC WINAPI wglGetCurrentReadDCARB (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void); +#endif + +#ifndef WGL_ARB_pbuffer +#define WGL_ARB_pbuffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer); +extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC); +extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer); +extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +#endif + +#ifndef WGL_ARB_render_texture +#define WGL_ARB_render_texture 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer); +extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer); +extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); +#endif + +#ifndef WGL_ARB_pixel_format_float +#define WGL_ARB_pixel_format_float 1 +#endif + +#ifndef WGL_ARB_framebuffer_sRGB +#define WGL_ARB_framebuffer_sRGB 1 +#endif + +#ifndef WGL_ARB_create_context +#define WGL_ARB_create_context 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList); +#endif + +#ifndef WGL_ARB_create_context_profile +#define WGL_ARB_create_context_profile 1 +#endif + +#ifndef WGL_ARB_create_context_robustness +#define WGL_ARB_create_context_robustness 1 +#endif + +#ifndef WGL_EXT_display_color_table +#define WGL_EXT_display_color_table 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id); +extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length); +extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id); +extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length); +typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); +#endif + +#ifndef WGL_EXT_extensions_string +#define WGL_EXT_extensions_string 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern const char * WINAPI wglGetExtensionsStringEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); +#endif + +#ifndef WGL_EXT_make_current_read +#define WGL_EXT_make_current_read 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +extern HDC WINAPI wglGetCurrentReadDCEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void); +#endif + +#ifndef WGL_EXT_pbuffer +#define WGL_EXT_pbuffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer); +extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC); +extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer); +extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); +#endif + +#ifndef WGL_EXT_pixel_format +#define WGL_EXT_pixel_format 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); +extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); +extern BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif + +#ifndef WGL_EXT_swap_control +#define WGL_EXT_swap_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglSwapIntervalEXT (int interval); +extern int WINAPI wglGetSwapIntervalEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); +typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); +#endif + +#ifndef WGL_EXT_depth_float +#define WGL_EXT_depth_float 1 +#endif + +#ifndef WGL_NV_vertex_array_range +#define WGL_NV_vertex_array_range 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern void* WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +extern void WINAPI wglFreeMemoryNV (void *pointer); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); +#endif + +#ifndef WGL_3DFX_multisample +#define WGL_3DFX_multisample 1 +#endif + +#ifndef WGL_EXT_multisample +#define WGL_EXT_multisample 1 +#endif + +#ifndef WGL_OML_sync_control +#define WGL_OML_sync_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); +extern BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator); +extern INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +extern BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); +extern BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator); +typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); +#endif + +#ifndef WGL_I3D_digital_video_control +#define WGL_I3D_digital_video_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue); +extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +#endif + +#ifndef WGL_I3D_gamma +#define WGL_I3D_gamma 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue); +extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue); +extern BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); +extern BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); +#endif + +#ifndef WGL_I3D_genlock +#define WGL_I3D_genlock 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnableGenlockI3D (HDC hDC); +extern BOOL WINAPI wglDisableGenlockI3D (HDC hDC); +extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag); +extern BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource); +extern BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource); +extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge); +extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge); +extern BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate); +extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate); +extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay); +extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay); +extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge); +typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay); +typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); +#endif + +#ifndef WGL_I3D_image_buffer +#define WGL_I3D_image_buffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags); +extern BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress); +extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); +extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); +typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); +typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); +typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count); +#endif + +#ifndef WGL_I3D_swap_frame_lock +#define WGL_I3D_swap_frame_lock 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnableFrameLockI3D (void); +extern BOOL WINAPI wglDisableFrameLockI3D (void); +extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag); +extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag); +#endif + +#ifndef WGL_I3D_swap_frame_usage +#define WGL_I3D_swap_frame_usage 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetFrameUsageI3D (float *pUsage); +extern BOOL WINAPI wglBeginFrameTrackingI3D (void); +extern BOOL WINAPI wglEndFrameTrackingI3D (void); +extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage); +typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +#endif + +#ifndef WGL_ATI_pixel_format_float +#define WGL_ATI_pixel_format_float 1 +#endif + +#ifndef WGL_NV_float_buffer +#define WGL_NV_float_buffer 1 +#endif + +#ifndef WGL_3DL_stereo_control +#define WGL_3DL_stereo_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState); +#endif + +#ifndef WGL_EXT_pixel_format_packed_float +#define WGL_EXT_pixel_format_packed_float 1 +#endif + +#ifndef WGL_EXT_framebuffer_sRGB +#define WGL_EXT_framebuffer_sRGB 1 +#endif + +#ifndef WGL_NV_present_video +#define WGL_NV_present_video 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList); +extern BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); +extern BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList); +typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); +typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue); +#endif + +#ifndef WGL_NV_video_output +#define WGL_NV_video_output 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice); +extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice); +extern BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); +extern BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer); +extern BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock); +extern BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice); +typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer); +typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock); +typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +#endif + +#ifndef WGL_NV_swap_group +#define WGL_NV_swap_group 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group); +extern BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier); +extern BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier); +extern BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers); +extern BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count); +extern BOOL WINAPI wglResetFrameCountNV (HDC hDC); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group); +typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier); +typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier); +typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count); +typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); +#endif + +#ifndef WGL_NV_gpu_affinity +#define WGL_NV_gpu_affinity 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu); +extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); +extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList); +extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); +extern BOOL WINAPI wglDeleteDCNV (HDC hdc); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu); +typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); +typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); +typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); +typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc); +#endif + +#ifndef WGL_AMD_gpu_association +#define WGL_AMD_gpu_association 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids); +extern INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data); +extern UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc); +extern HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id); +extern HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList); +extern BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc); +extern BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc); +extern HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void); +extern VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids); +typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data); +typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc); +typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id); +typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList); +typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc); +typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc); +typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); +typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif + +#ifndef WGL_NV_video_capture +#define WGL_NV_video_capture 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); +extern UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList); +extern BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +extern BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue); +extern BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice); +typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList); +typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice); +#endif + +#ifndef WGL_NV_copy_image +#define WGL_NV_copy_image 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); +#endif + +#ifndef WGL_NV_multisample_coverage +#define WGL_NV_multisample_coverage 1 +#endif + +#ifndef WGL_NV_DX_interop +#define WGL_NV_DX_interop 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle); +extern HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice); +extern BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice); +extern HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access); +extern BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject); +extern BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access); +extern BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects); +extern BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle); +typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice); +typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice); +typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access); +typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject); +typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access); +typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects); +typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects); +#endif + +#ifndef WGL_NV_DX_interop2 +#define WGL_NV_DX_interop2 1 +#endif + +#ifndef WGL_EXT_swap_control_tear +#define WGL_EXT_swap_control_tear 1 +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/nel/src/3d/driver/opengl/GLES/egl.h b/code/nel/src/3d/driver/opengl/GLES/egl.h new file mode 100644 index 000000000..5778e0050 --- /dev/null +++ b/code/nel/src/3d/driver/opengl/GLES/egl.h @@ -0,0 +1,15 @@ +/* + * Skeleton egl.h to provide compatibility for early GLES 1.0 + * applications. Several early implementations included gl.h + * in egl.h leading applications to include only egl.h + * + * $Revision: 6252 $ on $Date:: 2008-08-06 16:35:08 -0700 #$ + */ + +#ifndef __legacy_egl_h_ +#define __legacy_egl_h_ + +#include +#include + +#endif /* __legacy_egl_h_ */ diff --git a/code/nel/src/3d/driver/opengl/GLES/gl.h b/code/nel/src/3d/driver/opengl/GLES/gl.h new file mode 100644 index 000000000..5b8d85a92 --- /dev/null +++ b/code/nel/src/3d/driver/opengl/GLES/gl.h @@ -0,0 +1,770 @@ +#ifndef __gl_h_ +#define __gl_h_ + +/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +typedef void GLvoid; +typedef char GLchar; +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef khronos_int8_t GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef khronos_float_t GLfloat; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; +typedef khronos_int32_t GLclampx; + +typedef khronos_intptr_t GLintptr; +typedef khronos_ssize_t GLsizeiptr; + + +/*************************************************************/ + +/* OpenGL ES core versions */ +#define GL_VERSION_ES_CM_1_0 1 +#define GL_VERSION_ES_CL_1_0 1 +#define GL_VERSION_ES_CM_1_1 1 +#define GL_VERSION_ES_CL_1_1 1 + +/* ClearBufferMask */ +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 + +/* Boolean */ +#define GL_FALSE 0 +#define GL_TRUE 1 + +/* BeginMode */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 + +/* AlphaFunction */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +/* BlendingFactorDest */ +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 + +/* BlendingFactorSrc */ +/* GL_ZERO */ +/* GL_ONE */ +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ + +/* ClipPlaneName */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* ColorMaterialFace */ +/* GL_FRONT_AND_BACK */ + +/* ColorMaterialParameter */ +/* GL_AMBIENT_AND_DIFFUSE */ + +/* ColorPointerType */ +/* GL_UNSIGNED_BYTE */ +/* GL_FLOAT */ +/* GL_FIXED */ + +/* CullFaceMode */ +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 + +/* DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* EnableCap */ +#define GL_FOG 0x0B60 +#define GL_LIGHTING 0x0B50 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_BLEND 0x0BE2 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +/* GL_LIGHT0 */ +/* GL_LIGHT1 */ +/* GL_LIGHT2 */ +/* GL_LIGHT3 */ +/* GL_LIGHT4 */ +/* GL_LIGHT5 */ +/* GL_LIGHT6 */ +/* GL_LIGHT7 */ +#define GL_POINT_SMOOTH 0x0B10 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_NORMALIZE 0x0BA1 +#define GL_RESCALE_NORMAL 0x803A +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 + +/* ErrorCode */ +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + +/* FogMode */ +/* GL_LINEAR */ +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* FogParameter */ +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_COLOR 0x0B66 + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +/* GetPName */ +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_LINE_WIDTH 0x0B21 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_SHADE_MODEL 0x0B54 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_VIEWPORT 0x0BA2 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_SRC 0x0BE1 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB + +/* GetTextureParameter */ +/* GL_TEXTURE_MAG_FILTER */ +/* GL_TEXTURE_MIN_FILTER */ +/* GL_TEXTURE_WRAP_S */ +/* GL_TEXTURE_WRAP_T */ + +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 + +/* HintMode */ +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* HintTarget */ +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_FOG_HINT 0x0C54 +#define GL_GENERATE_MIPMAP_HINT 0x8192 + +/* LightModelParameter */ +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 + +/* LightParameter */ +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 + +/* DataType */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C + +/* LogicOp */ +#define GL_CLEAR 0x1500 +#define GL_AND 0x1501 +#define GL_AND_REVERSE 0x1502 +#define GL_COPY 0x1503 +#define GL_AND_INVERTED 0x1504 +#define GL_NOOP 0x1505 +#define GL_XOR 0x1506 +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_EQUIV 0x1509 +#define GL_INVERT 0x150A +#define GL_OR_REVERSE 0x150B +#define GL_COPY_INVERTED 0x150C +#define GL_OR_INVERTED 0x150D +#define GL_NAND 0x150E +#define GL_SET 0x150F + +/* MaterialFace */ +/* GL_FRONT_AND_BACK */ + +/* MaterialParameter */ +#define GL_EMISSION 0x1600 +#define GL_SHININESS 0x1601 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +/* GL_AMBIENT */ +/* GL_DIFFUSE */ +/* GL_SPECULAR */ + +/* MatrixMode */ +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* NormalPointerType */ +/* GL_BYTE */ +/* GL_SHORT */ +/* GL_FLOAT */ +/* GL_FIXED */ + +/* PixelFormat */ +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A + +/* PixelStoreParameter */ +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 + +/* PixelType */ +/* GL_UNSIGNED_BYTE */ +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 + +/* ShadingModel */ +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 + +/* StencilFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* StencilOp */ +/* GL_ZERO */ +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +/* GL_INVERT */ + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* TexCoordPointerType */ +/* GL_SHORT */ +/* GL_FLOAT */ +/* GL_FIXED */ +/* GL_BYTE */ + +/* TextureEnvMode */ +#define GL_MODULATE 0x2100 +#define GL_DECAL 0x2101 +/* GL_BLEND */ +#define GL_ADD 0x0104 +/* GL_REPLACE */ + +/* TextureEnvParameter */ +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_ENV_COLOR 0x2201 + +/* TextureEnvTarget */ +#define GL_TEXTURE_ENV 0x2300 + +/* TextureMagFilter */ +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 + +/* TextureMinFilter */ +/* GL_NEAREST */ +/* GL_LINEAR */ +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 + +/* TextureParameterName */ +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_GENERATE_MIPMAP 0x8191 + +/* TextureTarget */ +/* GL_TEXTURE_2D */ + +/* TextureUnit */ +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 + +/* TextureWrapMode */ +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F + +/* VertexPointerType */ +/* GL_SHORT */ +/* GL_FLOAT */ +/* GL_FIXED */ +/* GL_BYTE */ + +/* LightName */ +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 + +/* Buffer Objects */ +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 + +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A + +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 + +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 + +/* Texture combine + dot3 */ +#define GL_SUBTRACT 0x84E7 +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A + +#define GL_ALPHA_SCALE 0x0D1C + +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_RGB 0x8582 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC1_ALPHA 0x8589 +#define GL_SRC2_ALPHA 0x858A + +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF + +/*------------------------------------------------------------------------* + * required OES extension tokens + *------------------------------------------------------------------------*/ + +/* OES_read_format */ +#ifndef GL_OES_read_format +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif + +/* OES_point_size_array */ +#ifndef GL_OES_point_size_array +#define GL_POINT_SIZE_ARRAY_OES 0x8B9C +#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A +#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B +#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C +#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F +#endif + +/* GL_OES_point_sprite */ +#ifndef GL_OES_point_sprite +#define GL_POINT_SPRITE_OES 0x8861 +#define GL_COORD_REPLACE_OES 0x8862 +#endif + +/*************************************************************/ + +/* Available only in Common profile */ +GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref); +GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_API void GL_APIENTRY glClearDepthf (GLclampf depth); +GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation); +GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_API void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); +GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]); +GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glLineWidth (GLfloat width); +GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m); +GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m); +GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); +GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glPointSize (GLfloat size); +GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z); +GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z); + +/* Available in both Common and Common-Lite profiles */ +GL_API void GL_APIENTRY glActiveTexture (GLenum texture); +GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref); +GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +GL_API void GL_APIENTRY glClear (GLbitfield mask); +GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +GL_API void GL_APIENTRY glClearDepthx (GLclampx depth); +GL_API void GL_APIENTRY glClearStencil (GLint s); +GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture); +GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation); +GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glCullFace (GLenum mode); +GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GL_API void GL_APIENTRY glDepthFunc (GLenum func); +GL_API void GL_APIENTRY glDepthMask (GLboolean flag); +GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar); +GL_API void GL_APIENTRY glDisable (GLenum cap); +GL_API void GL_APIENTRY glDisableClientState (GLenum array); +GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); +GL_API void GL_APIENTRY glEnable (GLenum cap); +GL_API void GL_APIENTRY glEnableClientState (GLenum array); +GL_API void GL_APIENTRY glFinish (void); +GL_API void GL_APIENTRY glFlush (void); +GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glFrontFace (GLenum mode); +GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *params); +GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]); +GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures); +GL_API GLenum GL_APIENTRY glGetError (void); +GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetPointerv (GLenum pname, GLvoid **params); +GL_API const GLubyte * GL_APIENTRY glGetString (GLenum name); +GL_API void GL_APIENTRY glGetTexEnviv (GLenum env, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glLineWidthx (GLfixed width); +GL_API void GL_APIENTRY glLoadIdentity (void); +GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m); +GL_API void GL_APIENTRY glLogicOp (GLenum opcode); +GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glMatrixMode (GLenum mode); +GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m); +GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz); +GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glPointSizex (GLfixed size); +GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units); +GL_API void GL_APIENTRY glPopMatrix (void); +GL_API void GL_APIENTRY glPushMatrix (void); +GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); +GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert); +GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glShadeModel (GLenum mode); +GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_API void GL_APIENTRY glStencilMask (GLuint mask); +GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param); +GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params); +GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +/*------------------------------------------------------------------------* + * Required OES extension functions + *------------------------------------------------------------------------*/ + +/* GL_OES_read_format */ +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#endif + +/* GL_OES_point_size_array */ +#ifndef GL_OES_point_size_array +#define GL_OES_point_size_array 1 +GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +/* GL_OES_point_sprite */ +#ifndef GL_OES_point_sprite +#define GL_OES_point_sprite 1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __gl_h_ */ + diff --git a/code/nel/src/3d/driver/opengl/GLES/glext.h b/code/nel/src/3d/driver/opengl/GLES/glext.h new file mode 100644 index 000000000..d591832bf --- /dev/null +++ b/code/nel/src/3d/driver/opengl/GLES/glext.h @@ -0,0 +1,1183 @@ +#ifndef __glext_h_ +#define __glext_h_ + +/* $Revision: 16481 $ on $Date:: 2012-01-04 10:43:56 -0800 #$ */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +#ifndef GL_APIENTRYP +# define GL_APIENTRYP GL_APIENTRY* +#endif + +/*------------------------------------------------------------------------* + * OES extension tokens + *------------------------------------------------------------------------*/ + +/* GL_OES_blend_equation_separate */ +#ifndef GL_OES_blend_equation_separate +/* BLEND_EQUATION_RGB_OES same as BLEND_EQUATION_OES */ +#define GL_BLEND_EQUATION_RGB_OES 0x8009 +#define GL_BLEND_EQUATION_ALPHA_OES 0x883D +#endif + +/* GL_OES_blend_func_separate */ +#ifndef GL_OES_blend_func_separate +#define GL_BLEND_DST_RGB_OES 0x80C8 +#define GL_BLEND_SRC_RGB_OES 0x80C9 +#define GL_BLEND_DST_ALPHA_OES 0x80CA +#define GL_BLEND_SRC_ALPHA_OES 0x80CB +#endif + +/* GL_OES_blend_subtract */ +#ifndef GL_OES_blend_subtract +#define GL_BLEND_EQUATION_OES 0x8009 +#define GL_FUNC_ADD_OES 0x8006 +#define GL_FUNC_SUBTRACT_OES 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B +#endif + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_ETC1_RGB8_OES 0x8D64 +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#endif + +/* GL_OES_draw_texture */ +#ifndef GL_OES_draw_texture +#define GL_TEXTURE_CROP_RECT_OES 0x8B9D +#endif + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +typedef void* GLeglImageOES; +#endif + +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external +/* GLeglImageOES defined in GL_OES_EGL_image already. */ +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_UNSIGNED_INT 0x1405 +#endif + +/* GL_OES_fixed_point */ +#ifndef GL_OES_fixed_point +#define GL_FIXED_OES 0x140C +#endif + +/* GL_OES_framebuffer_object */ +#ifndef GL_OES_framebuffer_object +#define GL_NONE_OES 0 +#define GL_FRAMEBUFFER_OES 0x8D40 +#define GL_RENDERBUFFER_OES 0x8D41 +#define GL_RGBA4_OES 0x8056 +#define GL_RGB5_A1_OES 0x8057 +#define GL_RGB565_OES 0x8D62 +#define GL_DEPTH_COMPONENT16_OES 0x81A5 +#define GL_RENDERBUFFER_WIDTH_OES 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3 +#define GL_COLOR_ATTACHMENT0_OES 0x8CE0 +#define GL_DEPTH_ATTACHMENT_OES 0x8D00 +#define GL_STENCIL_ATTACHMENT_OES 0x8D20 +#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA +#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD +#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6 +#define GL_RENDERBUFFER_BINDING_OES 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8 +#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506 +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +#endif + +/* GL_OES_matrix_get */ +#ifndef GL_OES_matrix_get +#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D +#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E +#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F +#endif + +/* GL_OES_matrix_palette */ +#ifndef GL_OES_matrix_palette +#define GL_MAX_VERTEX_UNITS_OES 0x86A4 +#define GL_MAX_PALETTE_MATRICES_OES 0x8842 +#define GL_MATRIX_PALETTE_OES 0x8840 +#define GL_MATRIX_INDEX_ARRAY_OES 0x8844 +#define GL_WEIGHT_ARRAY_OES 0x86AD +#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843 +#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849 +#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E +#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB +#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA +#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#endif + +/* GL_OES_stencil8 */ +#ifndef GL_OES_stencil8 +#define GL_STENCIL_INDEX8_OES 0x8D48 +#endif + +/* GL_OES_stencil_wrap */ +#ifndef GL_OES_stencil_wrap +#define GL_INCR_WRAP_OES 0x8507 +#define GL_DECR_WRAP_OES 0x8508 +#endif + +/* GL_OES_texture_cube_map */ +#ifndef GL_OES_texture_cube_map +#define GL_NORMAL_MAP_OES 0x8511 +#define GL_REFLECTION_MAP_OES 0x8512 +#define GL_TEXTURE_CUBE_MAP_OES 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C +#define GL_TEXTURE_GEN_MODE_OES 0x2500 +#define GL_TEXTURE_GEN_STR_OES 0x8D60 +#endif + +/* GL_OES_texture_mirrored_repeat */ +#ifndef GL_OES_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_OES 0x8370 +#endif + +/* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 +#endif + +/*------------------------------------------------------------------------* + * AMD extension tokens + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_3DC_X_AMD 0x87F9 +#define GL_3DC_XY_AMD 0x87FA +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif + +/*------------------------------------------------------------------------* + * APPLE extension tokens + *------------------------------------------------------------------------*/ + +/* GL_APPLE_texture_2D_limited_npot */ +/* No new tokens introduced by this extension. */ + +/* GL_APPLE_framebuffer_multisample */ +#ifndef GL_APPLE_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 +#define GL_MAX_SAMPLES_APPLE 0x8D57 +#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA +#endif + +/* GL_APPLE_texture_format_BGRA8888 */ +#ifndef GL_APPLE_texture_format_BGRA8888 +#define GL_BGRA_EXT 0x80E1 +#endif + +/* GL_APPLE_texture_max_level */ +#ifndef GL_APPLE_texture_max_level +#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D +#endif + +/*------------------------------------------------------------------------* + * ARM extension tokens + *------------------------------------------------------------------------*/ + +/* GL_ARM_rgba8 */ +/* No new tokens introduced by this extension. */ + +/*------------------------------------------------------------------------* + * EXT extension tokens + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#endif + +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_COLOR_EXT 0x1800 +#define GL_DEPTH_EXT 0x1801 +#define GL_STENCIL_EXT 0x1802 +#endif + +/* GL_EXT_multisampled_render_to_texture */ +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C +#define GL_RENDERBUFFER_SAMPLES_EXT 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x9134 +#define GL_MAX_SAMPLES_EXT 0x9135 +#endif + +/* GL_EXT_multi_draw_arrays */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_BGRA_EXT 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 +#endif + +/* GL_EXT_robustness */ +#ifndef GL_EXT_robustness +/* reuse GL_NO_ERROR */ +#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 +#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 +#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 +#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 +#endif + +/* GL_EXT_sRGB */ +#ifndef GL_EXT_sRGB +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +/* GL_EXT_texture_format_BGRA8888 */ +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_BGRA_EXT 0x80E1 +#endif + +/* GL_EXT_texture_lod_bias */ +#ifndef GL_EXT_texture_lod_bias +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif + +/* GL_EXT_texture_storage */ +#ifndef GL_EXT_texture_storage +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_ALPHA8_EXT 0x803C +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +/* reuse GL_RGBA16F_EXT */ +#define GL_RGB16F_EXT 0x881B +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGB10_EXT 0x8052 +#define GL_BGRA8_EXT 0x93A1 +#endif + +/*------------------------------------------------------------------------* + * IMG extension tokens + *------------------------------------------------------------------------*/ + +/* GL_IMG_read_format */ +#ifndef GL_IMG_read_format +#define GL_BGRA_IMG 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 +#endif + +/* GL_IMG_texture_env_enhanced_fixed_function */ +#ifndef GL_IMG_texture_env_enhanced_fixed_function +#define GL_MODULATE_COLOR_IMG 0x8C04 +#define GL_RECIP_ADD_SIGNED_ALPHA_IMG 0x8C05 +#define GL_TEXTURE_ALPHA_MODULATE_IMG 0x8C06 +#define GL_FACTOR_ALPHA_MODULATE_IMG 0x8C07 +#define GL_FRAGMENT_ALPHA_MODULATE_IMG 0x8C08 +#define GL_ADD_BLEND_IMG 0x8C09 +#define GL_DOT3_RGBA_IMG 0x86AF +#endif + +/* GL_IMG_user_clip_plane */ +#ifndef GL_IMG_user_clip_plane +#define GL_CLIP_PLANE0_IMG 0x3000 +#define GL_CLIP_PLANE1_IMG 0x3001 +#define GL_CLIP_PLANE2_IMG 0x3002 +#define GL_CLIP_PLANE3_IMG 0x3003 +#define GL_CLIP_PLANE4_IMG 0x3004 +#define GL_CLIP_PLANE5_IMG 0x3005 +#define GL_MAX_CLIP_PLANES_IMG 0x0D32 +#endif + +/* GL_IMG_multisampled_render_to_texture */ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 +#define GL_MAX_SAMPLES_IMG 0x9135 +#define GL_TEXTURE_SAMPLES_IMG 0x9136 +#endif + +/*------------------------------------------------------------------------* + * NV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_NV_fence */ +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +/*------------------------------------------------------------------------* + * QCOM extension tokens + *------------------------------------------------------------------------*/ + +/* GL_QCOM_driver_control */ +/* No new tokens introduced by this extension. */ + +/* GL_QCOM_extended_get */ +#ifndef GL_QCOM_extended_get +#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 +#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 +#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 +#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 +#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 +#define GL_TEXTURE_TYPE_QCOM 0x8BD7 +#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 +#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 +#define GL_TEXTURE_TARGET_QCOM 0x8BDA +#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB +#define GL_STATE_RESTORE 0x8BDC +#endif + +/* GL_QCOM_extended_get2 */ +/* No new tokens introduced by this extension. */ + +/* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_perfmon_global_mode +#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 +#endif + +/* GL_QCOM_writeonly_rendering */ +#ifndef GL_QCOM_writeonly_rendering +#define GL_WRITEONLY_RENDERING_QCOM 0x8823 +#endif + +/* GL_QCOM_tiled_rendering */ +#ifndef GL_QCOM_tiled_rendering +#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 +#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 +#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 +#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 +#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 +#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 +#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 +#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 +#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 +#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 +#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 +#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 +#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 +#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 +#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 +#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 +#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 +#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 +#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 +#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 +#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 +#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 +#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 +#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 +#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 +#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 +#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 +#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 +#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 +#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 +#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 +#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 +#endif + +/*------------------------------------------------------------------------* + * End of extension tokens, start of corresponding extension functions + *------------------------------------------------------------------------*/ + +/*------------------------------------------------------------------------* + * OES extension functions + *------------------------------------------------------------------------*/ + +/* GL_OES_blend_equation_separate */ +#ifndef GL_OES_blend_equation_separate +#define GL_OES_blend_equation_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha); +#endif +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEOESPROC) (GLenum modeRGB, GLenum modeAlpha); +#endif + +/* GL_OES_blend_func_separate */ +#ifndef GL_OES_blend_func_separate +#define GL_OES_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glBlendFuncSeparateOES (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEOESPROC) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif + +/* GL_OES_blend_subtract */ +#ifndef GL_OES_blend_subtract +#define GL_OES_blend_subtract 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glBlendEquationOES (GLenum mode); +#endif +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONOESPROC) (GLenum mode); +#endif + +/* GL_OES_byte_coordinates */ +#ifndef GL_OES_byte_coordinates +#define GL_OES_byte_coordinates 1 +#endif + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_OES_compressed_ETC1_RGB8_texture 1 +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_OES_depth24 1 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_OES_depth32 1 +#endif + +/* GL_OES_draw_texture */ +#ifndef GL_OES_draw_texture +#define GL_OES_draw_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); +GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height); +GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); +GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords); +GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords); +GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords); +GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); +GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords); +#endif +typedef void (GL_APIENTRYP PFNGLDRAWTEXSOESPROC) (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); +typedef void (GL_APIENTRYP PFNGLDRAWTEXIOESPROC) (GLint x, GLint y, GLint z, GLint width, GLint height); +typedef void (GL_APIENTRYP PFNGLDRAWTEXXOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); +typedef void (GL_APIENTRYP PFNGLDRAWTEXSVOESPROC) (const GLshort *coords); +typedef void (GL_APIENTRYP PFNGLDRAWTEXIVOESPROC) (const GLint *coords); +typedef void (GL_APIENTRYP PFNGLDRAWTEXXVOESPROC) (const GLfixed *coords); +typedef void (GL_APIENTRYP PFNGLDRAWTEXFOESPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); +typedef void (GL_APIENTRYP PFNGLDRAWTEXFVOESPROC) (const GLfloat *coords); +#endif + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +#endif +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#endif + +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external +#define GL_OES_EGL_image_external 1 +/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */ +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_OES_element_index_uint 1 +#endif + +/* GL_OES_extended_matrix_palette */ +#ifndef GL_OES_extended_matrix_palette +#define GL_OES_extended_matrix_palette 1 +#endif + +/* GL_OES_fbo_render_mipmap */ +#ifndef GL_OES_fbo_render_mipmap +#define GL_OES_fbo_render_mipmap 1 +#endif + +/* GL_OES_fixed_point */ +#ifndef GL_OES_fixed_point +#define GL_OES_fixed_point 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glAlphaFuncxOES (GLenum func, GLclampx ref); +GL_API void GL_APIENTRY glClearColorxOES (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +GL_API void GL_APIENTRY glClearDepthxOES (GLclampx depth); +GL_API void GL_APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation); +GL_API void GL_APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GL_API void GL_APIENTRY glDepthRangexOES (GLclampx zNear, GLclampx zFar); +GL_API void GL_APIENTRY glFogxOES (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glFogxvOES (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glFrustumxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GL_API void GL_APIENTRY glGetClipPlanexOES (GLenum pname, GLfixed eqn[4]); +GL_API void GL_APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetLightxvOES (GLenum light, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetMaterialxvOES (GLenum face, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetTexEnvxvOES (GLenum env, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glLightModelxOES (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glLineWidthxOES (GLfixed width); +GL_API void GL_APIENTRY glLoadMatrixxOES (const GLfixed *m); +GL_API void GL_APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glMultMatrixxOES (const GLfixed *m); +GL_API void GL_APIENTRY glMultiTexCoord4xOES (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +GL_API void GL_APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz); +GL_API void GL_APIENTRY glOrthoxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GL_API void GL_APIENTRY glPointParameterxOES (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glPointSizexOES (GLfixed size); +GL_API void GL_APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units); +GL_API void GL_APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glSampleCoveragexOES (GLclampx value, GLboolean invert); +GL_API void GL_APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z); +#endif +typedef void (GL_APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLclampx ref); +typedef void (GL_APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLclampx depth); +typedef void (GL_APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation); +typedef void (GL_APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLclampx zNear, GLclampx zFar); +typedef void (GL_APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum pname, GLfixed eqn[4]); +typedef void (GL_APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETLIGHTXVOESPROC) (GLenum light, GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETMATERIALXVOESPROC) (GLenum face, GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum env, GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width); +typedef void (GL_APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m); +typedef void (GL_APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m); +typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +typedef void (GL_APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz); +typedef void (GL_APIENTRYP PFNGLORTHOXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXOESPROC) (GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size); +typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units); +typedef void (GL_APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXOESPROC) (GLclampx value, GLboolean invert); +typedef void (GL_APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (GL_APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); +#endif + +/* GL_OES_framebuffer_object */ +#ifndef GL_OES_framebuffer_object +#define GL_OES_framebuffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API GLboolean GL_APIENTRY glIsRenderbufferOES (GLuint renderbuffer); +GL_API void GL_APIENTRY glBindRenderbufferOES (GLenum target, GLuint renderbuffer); +GL_API void GL_APIENTRY glDeleteRenderbuffersOES (GLsizei n, const GLuint* renderbuffers); +GL_API void GL_APIENTRY glGenRenderbuffersOES (GLsizei n, GLuint* renderbuffers); +GL_API void GL_APIENTRY glRenderbufferStorageOES (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glGetRenderbufferParameterivOES (GLenum target, GLenum pname, GLint* params); +GL_API GLboolean GL_APIENTRY glIsFramebufferOES (GLuint framebuffer); +GL_API void GL_APIENTRY glBindFramebufferOES (GLenum target, GLuint framebuffer); +GL_API void GL_APIENTRY glDeleteFramebuffersOES (GLsizei n, const GLuint* framebuffers); +GL_API void GL_APIENTRY glGenFramebuffersOES (GLsizei n, GLuint* framebuffers); +GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOES (GLenum target); +GL_API void GL_APIENTRY glFramebufferRenderbufferOES (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_API void GL_APIENTRY glFramebufferTexture2DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOES (GLenum target, GLenum attachment, GLenum pname, GLint* params); +GL_API void GL_APIENTRY glGenerateMipmapOES (GLenum target); +#endif +typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers); +typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers); +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer); +typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer); +typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers); +typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers); +typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params); +typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPOESPROC) (GLenum target); +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_OES_mapbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_API GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); +GL_API void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid ** params); +#endif +typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid ** params); +#endif + +/* GL_OES_matrix_get */ +#ifndef GL_OES_matrix_get +#define GL_OES_matrix_get 1 +#endif + +/* GL_OES_matrix_palette */ +#ifndef GL_OES_matrix_palette +#define GL_OES_matrix_palette 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex); +GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES (void); +GL_API void GL_APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif +typedef void (GL_APIENTRYP PFNGLCURRENTPALETTEMATRIXOESPROC) (GLuint matrixpaletteindex); +typedef void (GL_APIENTRYP PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC) (void); +typedef void (GL_APIENTRYP PFNGLMATRIXINDEXPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (GL_APIENTRYP PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_OES_packed_depth_stencil 1 +#endif + +/* GL_OES_query_matrix */ +#ifndef GL_OES_query_matrix +#define GL_OES_query_matrix 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed mantissa[16], GLint exponent[16]); +#endif +typedef GLbitfield (GL_APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed mantissa[16], GLint exponent[16]); +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_OES_rgb8_rgba8 1 +#endif + +/* GL_OES_single_precision */ +#ifndef GL_OES_single_precision +#define GL_OES_single_precision 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glDepthRangefOES (GLclampf zNear, GLclampf zFar); +GL_API void GL_APIENTRY glFrustumfOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GL_API void GL_APIENTRY glOrthofOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation); +GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum pname, GLfloat eqn[4]); +GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth); +#endif +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf zNear, GLclampf zFar); +typedef void (GL_APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +typedef void (GL_APIENTRYP PFNGLORTHOFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +typedef void (GL_APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation); +typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum pname, GLfloat eqn[4]); +typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth); +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_OES_stencil1 1 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_OES_stencil4 1 +#endif + +/* GL_OES_stencil8 */ +#ifndef GL_OES_stencil8 +#define GL_OES_stencil8 1 +#endif + +/* GL_OES_stencil_wrap */ +#ifndef GL_OES_stencil_wrap +#define GL_OES_stencil_wrap 1 +#endif + +/* GL_OES_texture_cube_map */ +#ifndef GL_OES_texture_cube_map +#define GL_OES_texture_cube_map 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param); +GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params); +GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params); +#endif +typedef void (GL_APIENTRYP PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param); +typedef void (GL_APIENTRYP PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params); +typedef void (GL_APIENTRYP PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params); +#endif + +/* GL_OES_texture_env_crossbar */ +#ifndef GL_OES_texture_env_crossbar +#define GL_OES_texture_env_crossbar 1 +#endif + +/* GL_OES_texture_mirrored_repeat */ +#ifndef GL_OES_texture_mirrored_repeat +#define GL_OES_texture_mirrored_repeat 1 +#endif + +/* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_array_object +#define GL_OES_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glBindVertexArrayOES (GLuint array); +GL_API void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); +GL_API void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); +GL_API GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); +#endif +typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); +typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); +typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); +#endif + +/*------------------------------------------------------------------------* + * AMD extension functions + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_AMD_compressed_3DC_texture 1 +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_AMD_compressed_ATC_texture 1 +#endif + +/*------------------------------------------------------------------------* + * APPLE extension functions + *------------------------------------------------------------------------*/ + +/* GL_APPLE_texture_2D_limited_npot */ +#ifndef GL_APPLE_texture_2D_limited_npot +#define GL_APPLE_texture_2D_limited_npot 1 +#endif + +/* GL_APPLE_framebuffer_multisample */ +#ifndef GL_APPLE_framebuffer_multisample +#define GL_APPLE_framebuffer_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GL_API void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); +#endif + +/* GL_APPLE_texture_format_BGRA8888 */ +#ifndef GL_APPLE_texture_format_BGRA8888 +#define GL_APPLE_texture_format_BGRA8888 1 +#endif + +/* GL_APPLE_texture_max_level */ +#ifndef GL_APPLE_texture_max_level +#define GL_APPLE_texture_max_level 1 +#endif + +/*------------------------------------------------------------------------* + * ARM extension functions + *------------------------------------------------------------------------*/ + +/* GL_ARM_rgba8 */ +#ifndef GL_ARM_rgba8 +#define GL_ARM_rgba8 1 +#endif + +/*------------------------------------------------------------------------* + * EXT extension functions + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#endif + +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_EXT_discard_framebuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif +typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif + +/* GL_EXT_multisampled_render_to_texture */ +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_EXT_multisampled_render_to_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif + +/* GL_EXT_multi_draw_arrays */ +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GL_API void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +/* GL_EXT_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_EXT_read_format_bgra 1 +#endif + +/* GL_EXT_robustness */ +#ifndef GL_EXT_robustness +#define GL_EXT_robustness 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); +GL_API void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GL_API void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params); +GL_API void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif + +/* GL_EXT_sRGB */ +#ifndef GL_EXT_sRGB +#define GL_EXT_sRGB 1 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_EXT_texture_compression_dxt1 1 +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +/* GL_EXT_texture_format_BGRA8888 */ +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_EXT_texture_format_BGRA8888 1 +#endif + +/* GL_EXT_texture_lod_bias */ +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#endif + +/* GL_EXT_texture_storage */ +#ifndef GL_EXT_texture_storage +#define GL_EXT_texture_storage 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_API void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GL_API void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_API void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif + +/*------------------------------------------------------------------------* + * IMG extension functions + *------------------------------------------------------------------------*/ + +/* GL_IMG_read_format */ +#ifndef GL_IMG_read_format +#define GL_IMG_read_format 1 +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_IMG_texture_compression_pvrtc 1 +#endif + +/* GL_IMG_texture_env_enhanced_fixed_function */ +#ifndef GL_IMG_texture_env_enhanced_fixed_function +#define GL_IMG_texture_env_enhanced_fixed_function 1 +#endif + +/* GL_IMG_user_clip_plane */ +#ifndef GL_IMG_user_clip_plane +#define GL_IMG_user_clip_plane 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glClipPlanefIMG (GLenum, const GLfloat *); +GL_API void GL_APIENTRY glClipPlanexIMG (GLenum, const GLfixed *); +#endif +typedef void (GL_APIENTRYP PFNGLCLIPPLANEFIMGPROC) (GLenum p, const GLfloat *eqn); +typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMGPROC) (GLenum p, const GLfixed *eqn); +#endif + +/* GL_IMG_multisampled_render_to_texture */ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_IMG_multisampled_render_to_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif + +/*------------------------------------------------------------------------* + * NV extension functions + *------------------------------------------------------------------------*/ + +/* NV_fence */ +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); +GL_API void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *); +GL_API GLboolean GL_APIENTRY glIsFenceNV (GLuint); +GL_API GLboolean GL_APIENTRY glTestFenceNV (GLuint); +GL_API void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); +GL_API void GL_APIENTRY glFinishFenceNV (GLuint); +GL_API void GL_APIENTRY glSetFenceNV (GLuint, GLenum); +#endif +typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif + +/*------------------------------------------------------------------------* + * QCOM extension functions + *------------------------------------------------------------------------*/ + +/* GL_QCOM_driver_control */ +#ifndef GL_QCOM_driver_control +#define GL_QCOM_driver_control 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); +GL_API void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +GL_API void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); +GL_API void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); +#endif +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +#endif + +/* GL_QCOM_extended_get */ +#ifndef GL_QCOM_extended_get +#define GL_QCOM_extended_get 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); +GL_API void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +GL_API void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +GL_API void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +GL_API void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); +GL_API void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +GL_API void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params); +#endif +typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params); +#endif + +/* GL_QCOM_extended_get2 */ +#ifndef GL_QCOM_extended_get2 +#define GL_QCOM_extended_get2 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); +GL_API void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +GL_API GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); +GL_API void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif +typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif + +/* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_perfmon_global_mode +#define GL_QCOM_perfmon_global_mode 1 +#endif + +/* GL_QCOM_writeonly_rendering */ +#ifndef GL_QCOM_writeonly_rendering +#define GL_QCOM_writeonly_rendering 1 +#endif + +/* GL_QCOM_tiled_rendering */ +#ifndef GL_QCOM_tiled_rendering +#define GL_QCOM_tiled_rendering 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +GL_API void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); +#endif +typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __glext_h_ */ + diff --git a/code/nel/src/3d/driver/opengl/GLES/glplatform.h b/code/nel/src/3d/driver/opengl/GLES/glplatform.h new file mode 100644 index 000000000..2db6ee2ca --- /dev/null +++ b/code/nel/src/3d/driver/opengl/GLES/glplatform.h @@ -0,0 +1,30 @@ +#ifndef __glplatform_h_ +#define __glplatform_h_ + +/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */ + +/* + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ + +/* Platform-specific types and definitions for OpenGL ES 1.X gl.h + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * You are encouraged to submit all modifications to the Khronos group so that + * they can be included in future versions of this file. Please submit changes + * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) + * by filing a bug against product "OpenGL-ES" component "Registry". + */ + +#include + +#ifndef GL_API +#define GL_API KHRONOS_APICALL +#endif + +#ifndef GL_APIENTRY +#define GL_APIENTRY KHRONOS_APIENTRY +#endif + +#endif /* __glplatform_h_ */ diff --git a/code/nel/src/3d/driver/opengl/KHR/khrplatform.h b/code/nel/src/3d/driver/opengl/KHR/khrplatform.h new file mode 100644 index 000000000..ee2ab4fd7 --- /dev/null +++ b/code/nel/src/3d/driver/opengl/KHR/khrplatform.h @@ -0,0 +1,302 @@ +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Khronos platform-specific types and definitions. + * + * $Revision: 1.5 $ on $Date: 2010/06/03 16:51:55 $ + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific modifications to the Khronos + * group so that they can be included in future versions of this file. + * Please submit changes by sending them to the public Khronos Bugzilla + * (http://khronos.org/bugzilla) by filing a bug against product + * "Khronos (general)" component "Registry". + * + * A predefined template which fills in some of the bug fields can be + * reached using http://tinyurl.com/khrplatform-h-bugreport, but you + * must create a Bugzilla login first. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_APIENTRY + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ + +#if (defined(_WIN32) || defined(__VC32__)) && !defined(__SCITECH_SNAP__) && !defined(__WINSCW__) +# if defined (_DLL_EXPORTS) +# define KHRONOS_APICALL __declspec(dllexport) +# else +# define KHRONOS_APICALL __declspec(dllimport) +# endif +#elif defined (__SYMBIAN32__) +# if defined (__GCC32__) +# define KHRONOS_APICALL __declspec(dllexport) +# else +# define KHRONOS_APICALL IMPORT_C +# endif +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIENTRY + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) && !defined(__WINSCW__) + /* Win32 but not WinCE */ +# define KHRONOS_APIENTRY __stdcall +#else +# define KHRONOS_APIENTRY +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if defined(__SYMBIAN32__) + +#include + +typedef TInt32 khronos_int32_t; +typedef TUint32 khronos_uint32_t; +typedef TInt64 khronos_int64_t; +typedef TUint64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_UITRON_) + +/* + * uITRON + */ +typedef signed int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +typedef long long khronos_int64_t; +typedef unsigned long long khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.cpp b/code/nel/src/3d/driver/opengl/driver_opengl.cpp index f222dc5a7..a4c9e012d 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl.cpp @@ -21,21 +21,6 @@ // by default, we disable the windows menu keys (F10, ALT and ALT+SPACE key doesn't freeze or open the menu) #define NL_DISABLE_MENU -#ifdef NL_OS_WINDOWS -# define WIN32_LEAN_AND_MEAN -# define NOMINMAX -# include -# include -# include -# include -#elif defined(NL_OS_MAC) -#elif defined (NL_OS_UNIX) -# include -# include -#endif // NL_OS_UNIX - -#include - #include "nel/3d/viewport.h" #include "nel/3d/scissor.h" #include "nel/3d/u_driver.h" @@ -80,46 +65,50 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) #endif /* NL_OS_WINDOWS */ -class CDriverGLNelLibrary : public INelLibrary { +#ifdef USE_OPENGLES + +class CDriverGLEsNelLibrary : public INelLibrary { void onLibraryLoaded(bool firstTime) { } void onLibraryUnloaded(bool lastTime) { } }; -NLMISC_DECL_PURE_LIB(CDriverGLNelLibrary) - -#endif /* #ifndef NL_STATIC */ +NLMISC_DECL_PURE_LIB(CDriverGLEsNelLibrary) +#else -namespace NL3D -{ - -CMaterial::CTexEnv CDriverGL::_TexEnvReplace; +class CDriverGLNelLibrary : public INelLibrary { + void onLibraryLoaded(bool firstTime) { } + void onLibraryUnloaded(bool lastTime) { } +}; +NLMISC_DECL_PURE_LIB(CDriverGLNelLibrary) +#endif -#ifdef NL_OS_WINDOWS -uint CDriverGL::_Registered=0; -#endif // NL_OS_WINDOWS +#endif /* #ifndef NL_STATIC */ -// Version of the driver. Not the interface version!! Increment when implementation of the driver change. -const uint32 CDriverGL::ReleaseVersion = 0x11; +namespace NL3D { -// Number of register to allocate for the EXTVertexShader extension -const uint CDriverGL::_EVSNumConstant = 97; +#ifdef NL_STATIC -#ifdef NL_OS_WINDOWS +#ifdef USE_OPENGLES -#ifdef NL_STATIC +IDriver* createGlEsDriverInstance () +{ + return new NLDRIVERGLES::CDriverGL; +} -# pragma comment(lib, "opengl32") -# pragma comment(lib, "dinput8") -# pragma comment(lib, "dxguid") +#else IDriver* createGlDriverInstance () { - return new CDriverGL; + return new NLDRIVERGL::CDriverGL; } +#endif + #else +#ifdef NL_OS_WINDOWS + __declspec(dllexport) IDriver* NL3D_createIDriverInstance () { return new CDriverGL; @@ -130,19 +119,8 @@ __declspec(dllexport) uint32 NL3D_interfaceVersion () return IDriver::InterfaceVersion; } -#endif - #elif defined (NL_OS_UNIX) -#ifdef NL_STATIC - -IDriver* createGlDriverInstance () -{ - return new CDriverGL; -} - -#else - extern "C" { IDriver* NL3D_createIDriverInstance () @@ -156,18 +134,48 @@ extern "C" } } +#endif // NL_OS_WINDOWS + +#endif // NL_STATIC + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif #endif -#endif // NL_OS_UNIX +CMaterial::CTexEnv CDriverGL::_TexEnvReplace; + + +#ifdef NL_OS_WINDOWS +uint CDriverGL::_Registered=0; +#endif // NL_OS_WINDOWS + +// Version of the driver. Not the interface version!! Increment when implementation of the driver change. +const uint32 CDriverGL::ReleaseVersion = 0x11; + +// Number of register to allocate for the EXTVertexShader extension +const uint CDriverGL::_EVSNumConstant = 97; GLenum CDriverGL::NLCubeFaceToGLCubeFace[6] = { +#ifdef USE_OPENGLES + GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES, + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES, + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES, + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES +#else GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB +#endif }; // *************************************************************************** @@ -175,7 +183,13 @@ CDriverGL::CDriverGL() { H_AUTO_OGL(CDriverGL_CDriverGL) -#ifdef NL_OS_WINDOWS +#ifdef USE_OPENGLES + + _EglDisplay = 0; + _EglContext = 0; + _EglSurface = 0; + +#elif defined(NL_OS_WINDOWS) _PBuffer = NULL; _hRC = NULL; @@ -296,7 +310,11 @@ CDriverGL::CDriverGL() for(i=0; i < IDRV_MAT_MAXTEXTURES; i++) { _MaterialAllTextureTouchedFlag|= IDRV_TOUCHED_TEX[i]; +#ifdef GL_NONE _CurrentTexAddrMode[i] = GL_NONE; +#else + _CurrentTexAddrMode[i] = 0; +#endif } _UserTexMatEnabled = 0; @@ -381,7 +399,9 @@ bool CDriverGL::setupDisplay() for(uint i = 0; i < lines.size(); i++) nlinfo("3D: %s", lines[i].c_str()); -#ifdef NL_OS_WINDOWS +#ifdef USE_OPENGLES + registerEGlExtensions(_Extensions, _EglDisplay); +#elif defined(NL_OS_WINDOWS) registerWGlExtensions(_Extensions, _hDC); #elif defined(NL_OS_MAC) #elif defined(NL_OS_UNIX) @@ -421,18 +441,30 @@ bool CDriverGL::setupDisplay() glViewport(0,0,_CurrentMode.Width,_CurrentMode.Height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); +#ifdef USE_OPENGLES + glOrthof(0.f,_CurrentMode.Width,_CurrentMode.Height,0.f,-1.0f,1.0f); +#else glOrtho(0,_CurrentMode.Width,_CurrentMode.Height,0,-1.0f,1.0f); +#endif glMatrixMode(GL_MODELVIEW); glLoadIdentity(); +#ifndef USE_OPENGLES glDisable(GL_AUTO_NORMAL); +#endif glDisable(GL_COLOR_MATERIAL); +#ifndef USE_OPENGLES glEnable(GL_DITHER); +#endif glDisable(GL_FOG); glDisable(GL_LINE_SMOOTH); +#ifndef USE_OPENGLES glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); +#endif glEnable(GL_DEPTH_TEST); glDisable(GL_NORMALIZE); +#ifndef USE_OPENGLES glDisable(GL_COLOR_SUM_EXT); +#endif _CurrViewport.init(0.f, 0.f, 1.f, 1.f); _CurrScissor.initFullScreen(); @@ -451,7 +483,9 @@ bool CDriverGL::setupDisplay() // Be always in EXTSeparateSpecularColor. if(_Extensions.EXTSeparateSpecularColor) { +#ifndef USE_OPENGLES glLightModeli((GLenum)GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT); +#endif } _VertexProgramEnabled= false; @@ -470,6 +504,7 @@ bool CDriverGL::setupDisplay() _SupportVBHard= true; _MaxVerticesByVBHard = std::numeric_limits::max(); // cant' know the value.. } +#ifndef USE_OPENGLES // Next with NVidia ext else if(_Extensions.NVVertexArrayRange) { @@ -500,6 +535,7 @@ bool CDriverGL::setupDisplay() // tmp fix for ati _MaxVerticesByVBHard= 16777216; } +#endif // Reset VertexArrayRange. _CurrentVertexArrayRange= NULL; @@ -559,6 +595,7 @@ bool CDriverGL::setupDisplay() // set All TexGen by default to identity matrix (prefer use the textureMatrix scheme) _DriverGLStates.activeTextureARB(stage); +#ifndef USE_OPENGLES GLfloat params[4]; params[0]=1; params[1]=0; params[2]=0; params[3]=0; glTexGenfv(GL_S, GL_OBJECT_PLANE, params); @@ -572,6 +609,7 @@ bool CDriverGL::setupDisplay() params[0]=0; params[1]=0; params[2]=0; params[3]=1; glTexGenfv(GL_Q, GL_OBJECT_PLANE, params); glTexGenfv(GL_Q, GL_EYE_PLANE, params); +#endif } resetTextureShaders(); @@ -603,42 +641,44 @@ bool CDriverGL::setupDisplay() // check whether per pixel lighting shader is supported checkForPerPixelLightingSupport(); +#ifndef USE_OPENGLES // if EXTVertexShader is used, bind the standard GL arrays, and allocate constant if (!_Extensions.NVVertexProgram && !_Extensions.ARBVertexProgram && _Extensions.EXTVertexShader) { - _EVSPositionHandle = nglBindParameterEXT(GL_CURRENT_VERTEX_EXT); - _EVSNormalHandle = nglBindParameterEXT(GL_CURRENT_NORMAL); - _EVSColorHandle = nglBindParameterEXT(GL_CURRENT_COLOR); + _EVSPositionHandle = nglBindParameterEXT(GL_CURRENT_VERTEX_EXT); + _EVSNormalHandle = nglBindParameterEXT(GL_CURRENT_NORMAL); + _EVSColorHandle = nglBindParameterEXT(GL_CURRENT_COLOR); - if (!_EVSPositionHandle || !_EVSNormalHandle || !_EVSColorHandle) + if (!_EVSPositionHandle || !_EVSNormalHandle || !_EVSColorHandle) + { + nlwarning("Unable to bind input parameters for use with EXT_vertex_shader, vertex program support is disabled"); + _Extensions.EXTVertexShader = false; + } + else + { + // bind texture units + for(uint k = 0; k < 8; ++k) { - nlwarning("Unable to bind input parameters for use with EXT_vertex_shader, vertex program support is disabled"); - _Extensions.EXTVertexShader = false; + _EVSTexHandle[k] = nglBindTextureUnitParameterEXT(GL_TEXTURE0_ARB + k, GL_CURRENT_TEXTURE_COORDS); } - else - { - // bind texture units - for(uint k = 0; k < 8; ++k) - { - _EVSTexHandle[k] = nglBindTextureUnitParameterEXT(GL_TEXTURE0_ARB + k, GL_CURRENT_TEXTURE_COORDS); - } - // Other attributes are managed using variant pointers : - // Secondary color - // Fog Coords - // Skin Weight - // Skin palette - // This mean that they must have 4 components + // Other attributes are managed using variant pointers : + // Secondary color + // Fog Coords + // Skin Weight + // Skin palette + // This mean that they must have 4 components - // Allocate invariants. One assitionnal variant is needed for fog coordinate if fog bug is not fixed in driver version - _EVSConstantHandle = nglGenSymbolsEXT(GL_VECTOR_EXT, GL_INVARIANT_EXT, GL_FULL_RANGE_EXT, _EVSNumConstant + (_ATIFogRangeFixed ? 0 : 1)); + // Allocate invariants. One assitionnal variant is needed for fog coordinate if fog bug is not fixed in driver version + _EVSConstantHandle = nglGenSymbolsEXT(GL_VECTOR_EXT, GL_INVARIANT_EXT, GL_FULL_RANGE_EXT, _EVSNumConstant + (_ATIFogRangeFixed ? 0 : 1)); - if (_EVSConstantHandle == 0) - { - nlwarning("Unable to allocate constants for EXT_vertex_shader, vertex program support is disabled"); - _Extensions.EXTVertexShader = false; - } + if (_EVSConstantHandle == 0) + { + nlwarning("Unable to allocate constants for EXT_vertex_shader, vertex program support is disabled"); + _Extensions.EXTVertexShader = false; } + } } +#endif // Reset the vbl interval setSwapVBLInterval(_Interval); @@ -685,7 +725,11 @@ bool CDriverGL::activeFrameBufferObject(ITexture * tex) } else { +#ifdef USE_OPENGLES + nglBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); +#else nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); +#endif return true; } } @@ -717,7 +761,9 @@ void CDriverGL::disableHardwareTextureShader() // -------------------------------------------------- void CDriverGL::resetTextureShaders() { - H_AUTO_OGL(CDriverGL_resetTextureShaders) + H_AUTO_OGL(CDriverGL_resetTextureShaders); + +#ifndef USE_OPENGLES if (_Extensions.NVTextureShader) { glEnable(GL_TEXTURE_SHADER_NV); @@ -739,6 +785,7 @@ void CDriverGL::resetTextureShaders() _NVTextureShaderEnabled = false; } +#endif } // -------------------------------------------------- @@ -773,8 +820,13 @@ bool CDriverGL::clear2D(CRGBA rgba) // -------------------------------------------------- bool CDriverGL::clearZBuffer(float zval) { - H_AUTO_OGL(CDriverGL_clearZBuffer) + H_AUTO_OGL(CDriverGL_clearZBuffer); + +#ifdef USE_OPENGLES + glClearDepthf(zval); +#else glClearDepth(zval); +#endif _DriverGLStates.enableZWrite(true); glClear(GL_DEPTH_BUFFER_BIT); @@ -810,6 +862,7 @@ bool CDriverGL::swapBuffers() //resetTextureShaders(); activeVertexProgram(NULL); +#ifndef USE_OPENGLES /* Yoyo: must do this (GeForce bug ??) else weird results if end render with a VBHard. Setup a std vertex buffer to ensure NVidia synchronisation. */ @@ -872,6 +925,7 @@ bool CDriverGL::swapBuffers() itVBHard++; } } +#endif #ifdef NL_OS_WINDOWS if (_EventEmitter.getNumEmitters() > 1) // is direct input running ? @@ -887,7 +941,11 @@ bool CDriverGL::swapBuffers() if (_VRAMVertexArrayRange) _VRAMVertexArrayRange->updateLostBuffers(); } -#ifdef NL_OS_WINDOWS +#ifdef USE_OPENGLES + + eglSwapBuffers (_EglDisplay, _EglSurface); + +#elif defined(NL_OS_WINDOWS) SwapBuffers(_hDC); @@ -908,6 +966,7 @@ bool CDriverGL::swapBuffers() #endif // NL_OS_WINDOWS +#ifndef USE_OPENGLES // Activate the default texture environnments for all stages. //=========================================================== // This is not a requirement, but it ensure a more stable state each frame. @@ -935,6 +994,8 @@ bool CDriverGL::swapBuffers() glDisable(GL_TEXTURE_SHADER_NV); _NVTextureShaderEnabled = false; } +#endif + _CurrentMaterial= NULL; // Reset the profiling counter. @@ -1184,9 +1245,14 @@ void CDriverGL::getZBufferPart (std::vector &zbuffer, NLMISC::CRect &rec if(clipRect(rect)) { zbuffer.resize(rect.Width*rect.Height); + +#ifdef USE_OPENGLES + glReadPixels (rect.X, rect.Y, rect.Width, rect.Height, GL_DEPTH_COMPONENT16_OES, GL_FLOAT, &(zbuffer[0])); +#else glPixelTransferf(GL_DEPTH_SCALE, 1.0f) ; glPixelTransferf(GL_DEPTH_BIAS, 0.f) ; glReadPixels (rect.X, rect.Y, rect.Width, rect.Height, GL_DEPTH_COMPONENT , GL_FLOAT, &(zbuffer[0])); +#endif } } @@ -1215,8 +1281,23 @@ bool CDriverGL::fillBuffer (CBitmap &bitmap) if( rect.Width!=bitmap.getWidth() || rect.Height!=bitmap.getHeight() || bitmap.getPixelFormat()!=CBitmap::RGBA ) return false; +#ifdef USE_OPENGLES + GLuint textureId; + glGenTextures(1, &textureId); + glBindTexture(GL_TEXTURE_2D, textureId); + glPixelStorei(GL_UNPACK_ALIGNMENT,1); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rect.Width, rect.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &(bitmap.getPixels()[0])); +// glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, smBackgroundCrop,0); + nglDrawTexfOES(0.f, 0.f, 0.f, 1.f, 1.f); +#else glPixelStorei(GL_UNPACK_ALIGNMENT,1); glDrawPixels (rect.Width, rect.Height, GL_RGBA, GL_UNSIGNED_BYTE, &(bitmap.getPixels()[0]) ); +#endif return true; } @@ -1245,15 +1326,22 @@ void CDriverGL::copyFrameBufferToTexture(ITexture *tex, _DriverGLStates.activeTextureARB(0); // setup texture mode, after activeTextureARB() CDriverGLStates::TTextureMode textureMode= CDriverGLStates::Texture2D; + +#ifndef USE_OPENGLES if(gltext->TextureMode == GL_TEXTURE_RECTANGLE_NV) textureMode = CDriverGLStates::TextureRect; +#endif _DriverGLStates.setTextureMode(textureMode); if (tex->isTextureCube()) { if(_Extensions.ARBTextureCubeMap) { +#ifdef USE_OPENGLES + glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID); +#else glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID); +#endif glCopyTexSubImage2D(NLCubeFaceToGLCubeFace[cubeFace], level, offsetx, offsety, x, y, width, height); } } @@ -1276,6 +1364,7 @@ void CDriverGL::setPolygonMode (TPolygonMode mode) H_AUTO_OGL(CDriverGL_setPolygonMode ) IDriver::setPolygonMode (mode); +#ifndef USE_OPENGLES // Set the polygon mode switch (_PolygonMode) { @@ -1289,6 +1378,7 @@ void CDriverGL::setPolygonMode (TPolygonMode mode) glPolygonMode (GL_FRONT_AND_BACK, GL_POINT); break; } +#endif } // *************************************************************************** @@ -1488,7 +1578,10 @@ void CDriverGL::setMatrix2DForTextureOffsetAddrMode(const uint stage, const floa //nlassert(supportTextureShaders()); nlassert(stage < inlGetNumTextStages() ); _DriverGLStates.activeTextureARB(stage); + +#ifndef USE_OPENGLES glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat); +#endif } @@ -1499,7 +1592,7 @@ void CDriverGL::enableNVTextureShader(bool enabled) if (enabled != _NVTextureShaderEnabled) { - +#ifndef USE_OPENGLES if (enabled) { glEnable(GL_TEXTURE_SHADER_NV); @@ -1508,6 +1601,7 @@ void CDriverGL::enableNVTextureShader(bool enabled) { glDisable(GL_TEXTURE_SHADER_NV); } +#endif _NVTextureShaderEnabled = enabled; } } @@ -1568,8 +1662,11 @@ void CDriverGL::setBlendConstantColor(NLMISC::CRGBA col) // update GL if(!_Extensions.EXTBlendColor) return; + +#ifndef USE_OPENGLES static const float OO255= 1.0f/255; nglBlendColorEXT(col.R*OO255, col.G*OO255, col.B*OO255, col.A*OO255); +#endif } // *************************************************************************** @@ -1623,6 +1720,7 @@ void CDriverGL::setEMBMMatrix(const uint stage,const float mat[4]) { H_AUTO_OGL(CDriverGL_setEMBMMatrix) +#ifndef USE_OPENGLES nlassert(supportEMBM()); nlassert(stage < IDRV_MAT_MAXTEXTURES); // @@ -1631,13 +1729,15 @@ void CDriverGL::setEMBMMatrix(const uint stage,const float mat[4]) _DriverGLStates.activeTextureARB(stage); nglTexBumpParameterfvATI(GL_BUMP_ROT_MATRIX_ATI, const_cast(mat)); } +#endif } // *************************************************************************** void CDriverGL::initEMBM() { - H_AUTO_OGL(CDriverGL_initEMBM) + H_AUTO_OGL(CDriverGL_initEMBM); +#ifndef USE_OPENGLES if (supportEMBM()) { std::fill(_StageSupportEMBM, _StageSupportEMBM + IDRV_MAT_MAXTEXTURES, false); @@ -1687,6 +1787,7 @@ void CDriverGL::initEMBM() _DriverGLStates.activeTextureARB(0); } } +#endif } // *************************************************************************** @@ -1832,6 +1933,8 @@ uint loadARBFragmentProgramStringNative(const char *prog, bool forceNativeProgra nlwarning("The param 'prog' is null, cannot load"); return 0; } + +#ifndef USE_OPENGLES GLuint progID; nglGenProgramsARB(1, &progID); if (!progID) @@ -1859,6 +1962,8 @@ uint loadARBFragmentProgramStringNative(const char *prog, bool forceNativeProgra { nlwarning("init fragment program failed: errorPos: %d isNative: %d: %s", errorPos, isNative, (const char*)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); } +#endif + return 0; } @@ -1869,11 +1974,12 @@ uint loadARBFragmentProgramStringNative(const char *prog, bool forceNativeProgra */ static void fetchPerturbedEnvMapR200() { - H_AUTO_OGL(CDriverGL_fetchPerturbedEnvMapR200) + H_AUTO_OGL(CDriverGL_fetchPerturbedEnvMapR200); + +#ifndef USE_OPENGLES //////////// // PASS 1 // //////////// - nglSampleMapATI(GL_REG_0_ATI, GL_TEXTURE0_ARB, GL_SWIZZLE_STR_ATI); // sample bump map 0 nglSampleMapATI(GL_REG_1_ATI, GL_TEXTURE1_ARB, GL_SWIZZLE_STR_ATI); // sample bump map 1 nglPassTexCoordATI(GL_REG_2_ATI, GL_TEXTURE2_ARB, GL_SWIZZLE_STR_ATI); // get texcoord for envmap @@ -1885,6 +1991,7 @@ static void fetchPerturbedEnvMapR200() // PASS 2 // //////////// nglSampleMapATI(GL_REG_2_ATI, GL_REG_2_ATI, GL_SWIZZLE_STR_ATI); // fetch envmap at perturbed texcoords +#endif } // *************************************************************************** @@ -1896,8 +2003,9 @@ void CDriverGL::forceNativeFragmentPrograms(bool nativeOnly) // *************************************************************************** void CDriverGL::initFragmentShaders() { - H_AUTO_OGL(CDriverGL_initFragmentShaders) + H_AUTO_OGL(CDriverGL_initFragmentShaders); +#ifndef USE_OPENGLES /////////////////// // WATER SHADERS // /////////////////// @@ -2006,13 +2114,15 @@ void CDriverGL::initFragmentShaders() } // if none of the previous programs worked, fallback on NV_texture_shader, or (todo) simpler shader +#endif } // *************************************************************************** void CDriverGL::deleteARBFragmentPrograms() { - H_AUTO_OGL(CDriverGL_deleteARBFragmentPrograms) + H_AUTO_OGL(CDriverGL_deleteARBFragmentPrograms); +#ifndef USE_OPENGLES for(uint k = 0; k < 4; ++k) { if (ARBWaterShader[k]) @@ -2022,6 +2132,7 @@ void CDriverGL::deleteARBFragmentPrograms() ARBWaterShader[k] = 0; } } +#endif } // *************************************************************************** @@ -2029,6 +2140,7 @@ void CDriverGL::deleteFragmentShaders() { H_AUTO_OGL(CDriverGL_deleteFragmentShaders) +#ifndef USE_OPENGLES deleteARBFragmentPrograms(); if (ATIWaterShaderHandleNoDiffuseMap) @@ -2046,6 +2158,7 @@ void CDriverGL::deleteFragmentShaders() nglDeleteFragmentShaderATI((GLuint) ATICloudShaderHandle); ATICloudShaderHandle = 0; } +#endif } // *************************************************************************** @@ -2072,7 +2185,9 @@ void CDriverGL::setSwapVBLInterval(uint interval) bool res = true; -#ifdef NL_OS_WINDOWS +#ifdef USE_OPENGLES + res = eglSwapInterval(_EglDisplay, _Interval) == EGL_TRUE; +#elif defined(NL_OS_WINDOWS) if(_Extensions.WGLEXTSwapControl) { res = nwglSwapIntervalEXT(_Interval) == TRUE; @@ -2108,7 +2223,8 @@ uint CDriverGL::getSwapVBLInterval() { H_AUTO_OGL(CDriverGL_getSwapVBLInterval) -#ifdef NL_OS_WINDOWS +#ifdef USE_OPENGLES +#elif defined(NL_OS_WINDOWS) if(_Extensions.WGLEXTSwapControl) { return nwglGetSwapIntervalEXT(); @@ -2135,12 +2251,14 @@ uint CDriverGL::getSwapVBLInterval() // *************************************************************************** void CDriverGL::enablePolygonSmoothing(bool smooth) { - H_AUTO_OGL(CDriverGL_enablePolygonSmoothing) + H_AUTO_OGL(CDriverGL_enablePolygonSmoothing); +#ifndef USE_OPENGLES if(smooth) glEnable(GL_POLYGON_SMOOTH); else glDisable(GL_POLYGON_SMOOTH); +#endif _PolygonSmooth= smooth; } @@ -2576,6 +2694,8 @@ IOcclusionQuery *CDriverGL::createOcclusionQuery() { H_AUTO_OGL(CDriverGL_createOcclusionQuery) nlassert(_Extensions.NVOcclusionQuery); + +#ifndef USE_OPENGLES GLuint id; nglGenOcclusionQueriesNV(1, &id); if (id == 0) return NULL; @@ -2587,12 +2707,17 @@ IOcclusionQuery *CDriverGL::createOcclusionQuery() oqgl->Iterator = _OcclusionQueryList.begin(); oqgl->VisibleCount = 0; return oqgl; +#else + return NULL; +#endif } // *************************************************************************** void CDriverGL::deleteOcclusionQuery(IOcclusionQuery *oq) { - H_AUTO_OGL(CDriverGL_deleteOcclusionQuery) + H_AUTO_OGL(CDriverGL_deleteOcclusionQuery); + +#ifndef USE_OPENGLES if (!oq) return; COcclusionQueryGL *oqgl = NLMISC::safe_cast(oq); nlassert((CDriverGL *) oqgl->Driver == this); // should come from the same driver @@ -2606,12 +2731,15 @@ void CDriverGL::deleteOcclusionQuery(IOcclusionQuery *oq) _CurrentOcclusionQuery = NULL; } delete oqgl; +#endif } // *************************************************************************** void COcclusionQueryGL::begin() { - H_AUTO_OGL(COcclusionQueryGL_begin) + H_AUTO_OGL(COcclusionQueryGL_begin); + +#ifndef USE_OPENGLES nlassert(Driver); nlassert(Driver->_CurrentOcclusionQuery == NULL); // only one query at a time nlassert(ID); @@ -2619,23 +2747,29 @@ void COcclusionQueryGL::begin() Driver->_CurrentOcclusionQuery = this; OcclusionType = NotAvailable; VisibleCount = 0; +#endif } // *************************************************************************** void COcclusionQueryGL::end() { - H_AUTO_OGL(COcclusionQueryGL_end) + H_AUTO_OGL(COcclusionQueryGL_end); + +#ifndef USE_OPENGLES nlassert(Driver); nlassert(Driver->_CurrentOcclusionQuery == this); // only one query at a time nlassert(ID); nglEndOcclusionQueryNV(); Driver->_CurrentOcclusionQuery = NULL; +#endif } // *************************************************************************** IOcclusionQuery::TOcclusionType COcclusionQueryGL::getOcclusionType() { - H_AUTO_OGL(COcclusionQueryGL_getOcclusionType) + H_AUTO_OGL(COcclusionQueryGL_getOcclusionType); + +#ifndef USE_OPENGLES nlassert(Driver); nlassert(ID); nlassert(Driver->_CurrentOcclusionQuery != this); // can't query result between a begin/end pair! @@ -2652,6 +2786,7 @@ IOcclusionQuery::TOcclusionType COcclusionQueryGL::getOcclusionType() // Note : we could return the exact number of pixels that passed the z-test, but this value is not supported by all implementation (Direct3D ...) } } +#endif return OcclusionType; } @@ -2799,8 +2934,6 @@ void CDriverGL::endDialogMode() { } -} // NL3D - // *************************************************************************** void displayGLError(GLenum error) { @@ -2818,3 +2951,9 @@ void displayGLError(GLenum error) break; } } + +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + +} // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index cbe651e0b..660955083 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -26,21 +26,10 @@ # define H_AUTO_OGL(label) #endif -#ifdef NL_OS_WINDOWS -# define WIN32_LEAN_AND_MEAN -# define NOMINMAX -# include -# include -#elif defined(NL_OS_MAC) -# define GL_GLEXT_LEGACY +#ifdef NL_OS_MAC # import -# include -# include "mac/glext.h" # import "mac/cocoa_opengl_view.h" #elif defined (NL_OS_UNIX) -# define GLX_GLXEXT_PROTOTYPES -# include -# include # ifdef XF86VIDMODE # include # endif //XF86VIDMODE @@ -87,8 +76,6 @@ #define NL3D_DRV_MAX_LIGHTMAP 256 -void displayGLError(GLenum error); - /* #define CHECK_GL_ERROR { \ GLenum error = glGetError(); \ @@ -102,17 +89,26 @@ void displayGLError(GLenum error); #define UNSUPPORTED_INDEX_OFFSET_MSG "Unsupported by driver, check IDriver::supportIndexOffset." -namespace NL3D { - using NLMISC::CMatrix; using NLMISC::CVector; +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif class CDriverGL; class IVertexArrayRange; class IVertexBufferHardGL; class COcclusionQueryGL; +void displayGLError(GLenum error); + #ifdef NL_OS_WINDOWS bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); @@ -683,26 +679,28 @@ public: virtual void stencilOp(TStencilOp fail, TStencilOp zfail, TStencilOp zpass); virtual void stencilMask(uint mask); + GfxMode _CurrentMode; + sint32 _WindowX; + sint32 _WindowY; +#ifdef NL_OS_MAC + NLMISC::CCocoaEventEmitter _EventEmitter; +#endif private: virtual class IVertexBufferHardGL *createVertexBufferHard(uint size, uint numVertices, CVertexBuffer::TPreferredMemory vbType, CVertexBuffer *vb); friend class CTextureDrvInfosGL; friend class CVertexProgamDrvInfosGL; - private: // Version of the driver. Not the interface version!! Increment when implementation of the driver change. static const uint32 ReleaseVersion; // Windows nlWindow _win; - sint32 _WindowX; - sint32 _WindowY; bool _WindowVisible; bool _DestroyWindow; bool _Maximized; - GfxMode _CurrentMode; uint _Interval; bool _Resizable; @@ -764,31 +762,37 @@ private: TCursorMap _Cursors; +#ifdef USE_OPENGLES + EGLDisplay _EglDisplay; + EGLContext _EglContext; + EGLSurface _EglSurface; +#elif defined(NL_OS_WINDOWS) + HGLRC _hRC; + HDC _hDC; + PIXELFORMATDESCRIPTOR _pfd; + + // Off-screen rendering in Dib section + HPBUFFERARB _PBuffer; +#elif defined(NL_OS_MAC) + NSOpenGLContext* _ctx; +#elif defined(NL_OS_UNIX) + GLXContext _ctx; +#endif + #ifdef NL_OS_WINDOWS bool convertBitmapToIcon(const NLMISC::CBitmap &bitmap, HICON &icon, uint iconWidth, uint iconHeight, uint iconDepth, const NLMISC::CRGBA &col = NLMISC::CRGBA::White, sint hotSpotX = 0, sint hotSpotY = 0, bool cursor = false); friend bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - HDC _hDC; - PIXELFORMATDESCRIPTOR _pfd; - HGLRC _hRC; static uint _Registered; DEVMODE _OldScreenMode; NLMISC::CEventEmitterMulti _EventEmitter; // this can contains a win emitter and eventually a direct input emitter - // Off-screen rendering in Dib section - HPBUFFERARB _PBuffer; - #elif defined(NL_OS_MAC) friend bool GlWndProc(CDriverGL*, const void*); - friend void windowDidMove(NSWindow*, CDriverGL*); - friend void viewDidResize(NSView*, CDriverGL*); - friend NSApplicationTerminateReply applicationShouldTerminate(CDriverGL*); - NLMISC::CCocoaEventEmitter _EventEmitter; - NSOpenGLContext* _ctx; CocoaOpenGLView* _glView; NSAutoreleasePool* _autoreleasePool; uint16 _backBufferHeight; @@ -804,7 +808,6 @@ private: friend bool GlWndProc(CDriverGL *driver, XEvent &e); Display* _dpy; - GLXContext _ctx; NLMISC::CUnixEventEmitter _EventEmitter; XVisualInfo* _visual_info; uint32 _xrandr_version; @@ -963,6 +966,7 @@ private: bool _CurrentGlNormalize; private: + bool createContext(); bool setupDisplay(); bool unInit(); @@ -1511,6 +1515,10 @@ public: CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInfoPtrList it); }; +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + } // NL3D #endif // NL_DRIVER_OPENGL_H 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 a56f3670b..75f249b4c 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -16,18 +16,20 @@ #include "stdopengl.h" +#include "driver_opengl.h" +#include "driver_opengl_extension.h" #include "nel/misc/common.h" -#include "driver_opengl.h" -#include "driver_opengl_extension.h" #include "nel/3d/material.h" using namespace std; using namespace NLMISC; // *************************************************************************** -#ifdef NL_OS_WINDOWS +#ifdef USE_OPENGLES +#define nglGetProcAddress eglGetProcAddress +#elif defined(NL_OS_WINDOWS) #define nglGetProcAddress wglGetProcAddress #elif defined(NL_OS_MAC) // #include @@ -63,6 +65,47 @@ void (*nglGetProcAddress(const char *procName))() // *************************************************************************** // The exported function names +#ifdef USE_OPENGLES + +// GL_OES_mapbuffer +NEL_PFNGLMAPBUFFEROESPROC nglMapBufferOES; +NEL_PFNGLUNMAPBUFFEROESPROC nglUnmapBufferOES; +NEL_PFNGLGETBUFFERPOINTERVOESPROC nglGetBufferPointervOES; + +NEL_PFNGLBUFFERSUBDATAPROC nglBufferSubData; + +PFNGLDRAWTEXFOESPROC nglDrawTexfOES; + +// GL_OES_framebuffer_object +NEL_PFNGLISRENDERBUFFEROESPROC nglIsRenderbufferOES; +NEL_PFNGLBINDRENDERBUFFEROESPROC nglBindRenderbufferOES; +NEL_PFNGLDELETERENDERBUFFERSOESPROC nglDeleteRenderbuffersOES; +NEL_PFNGLGENRENDERBUFFERSOESPROC nglGenRenderbuffersOES; +NEL_PFNGLRENDERBUFFERSTORAGEOESPROC nglRenderbufferStorageOES; +NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC nglGetRenderbufferParameterivOES; +NEL_PFNGLISFRAMEBUFFEROESPROC nglIsFramebufferOES; +NEL_PFNGLBINDFRAMEBUFFEROESPROC nglBindFramebufferOES; +NEL_PFNGLDELETEFRAMEBUFFERSOESPROC nglDeleteFramebuffersOES; +NEL_PFNGLGENFRAMEBUFFERSOESPROC nglGenFramebuffersOES; +NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC nglCheckFramebufferStatusOES; +NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC nglFramebufferRenderbufferOES; +NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC nglFramebufferTexture2DOES; +NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC nglGetFramebufferAttachmentParameterivOES; +NEL_PFNGLGENERATEMIPMAPOESPROC nglGenerateMipmapOES; + +// GL_OES_texture_cube_map +NEL_PFNGLTEXGENFOESPROC nglTexGenfOES; +NEL_PFNGLTEXGENFVOESPROC nglTexGenfvOES; +NEL_PFNGLTEXGENIOESPROC nglTexGeniOES; +NEL_PFNGLTEXGENIVOESPROC nglTexGenivOES; +NEL_PFNGLTEXGENXOESPROC nglTexGenxOES; +NEL_PFNGLTEXGENXVOESPROC nglTexGenxvOES; +NEL_PFNGLGETTEXGENFVOESPROC nglGetTexGenfvOES; +NEL_PFNGLGETTEXGENIVOESPROC nglGetTexGenivOES; +NEL_PFNGLGETTEXGENXVOESPROC nglGetTexGenxvOES; + +#else + // ARB_multitexture NEL_PFNGLACTIVETEXTUREARBPROC nglActiveTextureARB; NEL_PFNGLCLIENTACTIVETEXTUREARBPROC nglClientActiveTextureARB; @@ -468,14 +511,23 @@ NEL_PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA; #endif +#endif // USE_OPENGLES + // *************************************************************************** // *************************************************************************** // *************************************************************************** // *************************************************************************** -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif #define CHECK_EXT(ext_str) \ if(strstr(glext, ext_str)==NULL) { nlwarning("3D: OpengGL extension '%s' was not found", ext_str); return false; } else { nldebug("3D: OpengGL Extension '%s' found", ext_str); } @@ -493,6 +545,8 @@ namespace NL3D static bool setupARBMultiTexture(const char *glext) { H_AUTO_OGL(setupARBMultiTexture); + +#ifndef USE_OPENGLES CHECK_EXT("GL_ARB_multitexture"); CHECK_ADDRESS(NEL_PFNGLACTIVETEXTUREARBPROC, glActiveTextureARB); @@ -531,16 +585,21 @@ static bool setupARBMultiTexture(const char *glext) CHECK_ADDRESS(NEL_PFNGLMULTITEXCOORD4IVARBPROC, glMultiTexCoord4ivARB); CHECK_ADDRESS(NEL_PFNGLMULTITEXCOORD4FVARBPROC, glMultiTexCoord4fvARB); CHECK_ADDRESS(NEL_PFNGLMULTITEXCOORD4DVARBPROC, glMultiTexCoord4dvARB); +#endif return true; } - // ********************************* static bool setupEXTTextureEnvCombine(const char *glext) { H_AUTO_OGL(setupEXTTextureEnvCombine); + +#ifdef USE_OPENGLES + return true; +#else return (strstr(glext, "GL_EXT_texture_env_combine")!=NULL || strstr(glext, "GL_ARB_texture_env_combine")!=NULL); +#endif } @@ -548,6 +607,8 @@ static bool setupEXTTextureEnvCombine(const char *glext) static bool setupARBTextureCompression(const char *glext) { H_AUTO_OGL(setupARBTextureCompression); + +#ifndef USE_OPENGLES CHECK_EXT("GL_ARB_texture_compression"); CHECK_ADDRESS(NEL_PFNGLCOMPRESSEDTEXIMAGE3DARBPROC, glCompressedTexImage3DARB); @@ -557,20 +618,52 @@ static bool setupARBTextureCompression(const char *glext) CHECK_ADDRESS(NEL_PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC, glCompressedTexSubImage2DARB); CHECK_ADDRESS(NEL_PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC, glCompressedTexSubImage1DARB); CHECK_ADDRESS(NEL_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC, glGetCompressedTexImageARB); +#endif return true; } - // ********************************* static bool setupARBTextureNonPowerOfTwo(const char *glext) { H_AUTO_OGL(setupARBTextureCompression); + +#ifndef USE_OPENGL_ES CHECK_EXT("GL_ARB_texture_non_power_of_two"); +#endif return true; } +// *************************************************************************** +static bool setupOESMapBuffer(const char *glext) +{ + H_AUTO_OGL(setupOESMapBuffer); + + CHECK_EXT("OES_mapbuffer"); + +#ifdef USE_OPENGLES + CHECK_ADDRESS(NEL_PFNGLMAPBUFFEROESPROC, glMapBufferOES); + CHECK_ADDRESS(NEL_PFNGLUNMAPBUFFEROESPROC, glUnmapBufferOES); + CHECK_ADDRESS(NEL_PFNGLGETBUFFERPOINTERVOESPROC, glGetBufferPointervOES); +#endif + + return true; +} + +// *************************************************************************** +static bool setupOESDrawTexture(const char *glext) +{ + H_AUTO_OGL(setupOESDrawTexture); + + CHECK_EXT("OES_draw_texture"); + +#ifdef USE_OPENGLES + CHECK_ADDRESS(PFNGLDRAWTEXFOESPROC, glDrawTexfOES); +#endif + + return true; +} // ********************************* static bool setupNVVertexArrayRange(const char *glext) @@ -583,6 +676,7 @@ static bool setupNVVertexArrayRange(const char *glext) // Tess Fence too. CHECK_EXT("GL_NV_fence"); +#ifndef USE_OPENGLES // Get VAR address. CHECK_ADDRESS(NEL_PFNGLFLUSHVERTEXARRAYRANGENVPROC, glFlushVertexArrayRangeNV); CHECK_ADDRESS(NEL_PFNGLVERTEXARRAYRANGENVPROC, glVertexArrayRangeNV); @@ -603,29 +697,38 @@ static bool setupNVVertexArrayRange(const char *glext) CHECK_ADDRESS(NEL_PFNGLGETFENCEIVNVPROC, glGetFenceivNV); CHECK_ADDRESS(NEL_PFNGLFINISHFENCENVPROC, glFinishFenceNV); CHECK_ADDRESS(NEL_PFNGLSETFENCENVPROC, glSetFenceNV); +#endif return true; } - // ********************************* static bool setupEXTTextureCompressionS3TC(const char *glext) { H_AUTO_OGL(setupEXTTextureCompressionS3TC); + +#ifdef USE_OPENGLES + CHECK_EXT("EXT_texture_compression_s3tc"); + // TODO: check also for EXT_texture_compression_dxt1 +#else CHECK_EXT("GL_EXT_texture_compression_s3tc"); + // TODO: check also for GL_S3_s3tc, GL_EXT_texture_compression_dxt1 +#endif + return true; } - // ********************************* static bool setupEXTVertexWeighting(const char *glext) { H_AUTO_OGL(setupEXTVertexWeighting); CHECK_EXT("GL_EXT_vertex_weighting"); +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLVERTEXWEIGHTFEXTPROC, glVertexWeightfEXT); CHECK_ADDRESS(NEL_PFNGLVERTEXWEIGHTFVEXTPROC, glVertexWeightfvEXT); CHECK_ADDRESS(NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC, glVertexWeightPointerEXT); +#endif return true; } @@ -679,6 +782,9 @@ static bool setupATIEnvMapBumpMap(const char *glext) H_AUTO_OGL(setupATIEnvMapBumpMap); CHECK_EXT("GL_ATI_envmap_bumpmap"); + GLint num = -1; + +#ifndef USE_OPENGLES CHECK_ADDRESS(PFNGLTEXBUMPPARAMETERIVATIPROC, glTexBumpParameterivATI); CHECK_ADDRESS(PFNGLTEXBUMPPARAMETERFVATIPROC, glTexBumpParameterfvATI); CHECK_ADDRESS(PFNGLGETTEXBUMPPARAMETERIVATIPROC, glGetTexBumpParameterivATI); @@ -686,8 +792,8 @@ static bool setupATIEnvMapBumpMap(const char *glext) // Check for broken ATI drivers and disable EMBM if we caught one. // Reminder: This code crashes with Catalyst 7.11 fglrx drivers! - GLint num = -1; nglGetTexBumpParameterivATI(GL_BUMP_NUM_TEX_UNITS_ATI, &num); +#endif return num > 0; } @@ -696,7 +802,23 @@ static bool setupATIEnvMapBumpMap(const char *glext) static bool setupARBTextureCubeMap(const char *glext) { H_AUTO_OGL(setupARBTextureCubeMap); + +#ifdef USE_OPENGLES + CHECK_EXT("OES_texture_cube_map"); +#else CHECK_EXT("GL_ARB_texture_cube_map"); +#endif + +// CHECK_ADDRESS(NEL_PFNGLTEXGENFOESPROC, glTexGenfOES); +// CHECK_ADDRESS(NEL_PFNGLTEXGENFVOESPROC, glTexGenfvOES); +// CHECK_ADDRESS(NEL_PFNGLTEXGENIOESPROC, glTexGeniOES); +// CHECK_ADDRESS(NEL_PFNGLTEXGENIVOESPROC, glTexGenivOES); +// CHECK_ADDRESS(NEL_PFNGLTEXGENXOESPROC, glTexGenxOES); +// CHECK_ADDRESS(NEL_PFNGLTEXGENXVOESPROC, glTexGenxvOES); +// CHECK_ADDRESS(NEL_PFNGLGETTEXGENFVOESPROC, glGetTexGenfvOES); +// CHECK_ADDRESS(NEL_PFNGLGETTEXGENIVOESPROC, glGetTexGenivOES); +// CHECK_ADDRESS(NEL_PFNGLGETTEXGENXVOESPROC, glGetTexGenxvOES); + return true; } @@ -714,6 +836,8 @@ static bool setupNVVertexProgram(const char *glext) // #endif CHECK_EXT("GL_NV_vertex_program"); + +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLAREPROGRAMSRESIDENTNVPROC, glAreProgramsResidentNV); CHECK_ADDRESS(NEL_PFNGLBINDPROGRAMNVPROC, glBindProgramNV); CHECK_ADDRESS(NEL_PFNGLDELETEPROGRAMSNVPROC, glDeleteProgramsNV); @@ -777,6 +901,7 @@ static bool setupNVVertexProgram(const char *glext) CHECK_ADDRESS(NEL_PFNGLVERTEXATTRIBS4FVNVPROC, glVertexAttribs4fvNV); CHECK_ADDRESS(NEL_PFNGLVERTEXATTRIBS4SVNVPROC, glVertexAttribs4svNV); CHECK_ADDRESS(NEL_PFNGLVERTEXATTRIBS4UBVNVPROC, glVertexAttribs4ubvNV); +#endif return true; } @@ -787,6 +912,7 @@ static bool setupEXTVertexShader(const char *glext) H_AUTO_OGL(setupEXTVertexShader); CHECK_EXT("GL_EXT_vertex_shader"); +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLBEGINVERTEXSHADEREXTPROC, glBeginVertexShaderEXT); CHECK_ADDRESS(NEL_PFNGLENDVERTEXSHADEREXTPROC, glEndVertexShaderEXT); CHECK_ADDRESS(NEL_PFNGLBINDVERTEXSHADEREXTPROC, glBindVertexShaderEXT); @@ -849,6 +975,7 @@ static bool setupEXTVertexShader(const char *glext) GLint numVSVariants; glGetIntegerv(GL_MAX_VERTEX_SHADER_VARIANTS_EXT, &numVSVariants); if (numVSInvariants < 4) return false; +#endif return true; @@ -861,6 +988,7 @@ static bool setupEXTSecondaryColor(const char *glext) H_AUTO_OGL(setupEXTSecondaryColor); CHECK_EXT("GL_EXT_secondary_color"); +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLSECONDARYCOLOR3BEXTPROC, glSecondaryColor3bEXT); CHECK_ADDRESS(NEL_PFNGLSECONDARYCOLOR3BVEXTPROC, glSecondaryColor3bvEXT); CHECK_ADDRESS(NEL_PFNGLSECONDARYCOLOR3DEXTPROC, glSecondaryColor3dEXT); @@ -878,6 +1006,7 @@ static bool setupEXTSecondaryColor(const char *glext) CHECK_ADDRESS(NEL_PFNGLSECONDARYCOLOR3USEXTPROC, glSecondaryColor3usEXT); CHECK_ADDRESS(NEL_PFNGLSECONDARYCOLOR3USVEXTPROC, glSecondaryColor3usvEXT); CHECK_ADDRESS(NEL_PFNGLSECONDARYCOLORPOINTEREXTPROC, glSecondaryColorPointerEXT); +#endif return true; } @@ -888,12 +1017,14 @@ static bool setupWGLARBPBuffer(const char *glext) H_AUTO_OGL(setupWGLARBPBuffer); CHECK_EXT("WGL_ARB_pbuffer"); +#ifndef USE_OPENGLES #ifdef NL_OS_WINDOWS CHECK_ADDRESS(PFNWGLCREATEPBUFFERARBPROC, wglCreatePbufferARB); CHECK_ADDRESS(PFNWGLGETPBUFFERDCARBPROC, wglGetPbufferDCARB); CHECK_ADDRESS(PFNWGLRELEASEPBUFFERDCARBPROC, wglReleasePbufferDCARB); CHECK_ADDRESS(PFNWGLDESTROYPBUFFERARBPROC, wglDestroyPbufferARB); CHECK_ADDRESS(PFNWGLQUERYPBUFFERARBPROC, wglQueryPbufferARB); +#endif #endif return true; @@ -905,7 +1036,9 @@ static bool setupARBMultisample(const char *glext) H_AUTO_OGL(setupARBMultisample); CHECK_EXT("GL_ARB_multisample"); +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLSAMPLECOVERAGEARBPROC, glSampleCoverageARB); +#endif return true; } @@ -917,9 +1050,11 @@ static bool setupWGLARBPixelFormat (const char *glext) H_AUTO_OGL(setupWGLARBPixelFormat); CHECK_EXT("WGL_ARB_pixel_format"); +#ifndef USE_OPENGLES CHECK_ADDRESS(PFNWGLGETPIXELFORMATATTRIBIVARBPROC, wglGetPixelFormatAttribivARB); CHECK_ADDRESS(PFNWGLGETPIXELFORMATATTRIBFVARBPROC, wglGetPixelFormatAttribfvARB); CHECK_ADDRESS(PFNWGLCHOOSEPIXELFORMATARBPROC, wglChoosePixelFormatARB); +#endif return true; } @@ -947,7 +1082,11 @@ static bool setupEXTBlendColor(const char *glext) { H_AUTO_OGL(setupEXTBlendColor); CHECK_EXT("GL_EXT_blend_color"); + +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLBLENDCOLOREXTPROC, glBlendColorEXT); +#endif + return true; } @@ -966,6 +1105,7 @@ static bool setupATIVertexArrayObject(const char *glext) H_AUTO_OGL(setupATIVertexArrayObject); CHECK_EXT("GL_ATI_vertex_array_object"); +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLNEWOBJECTBUFFERATIPROC, glNewObjectBufferATI); CHECK_ADDRESS(NEL_PFNGLISOBJECTBUFFERATIPROC, glIsObjectBufferATI); CHECK_ADDRESS(NEL_PFNGLUPDATEOBJECTBUFFERATIPROC, glUpdateObjectBufferATI); @@ -992,6 +1132,8 @@ static bool setupATIVertexArrayObject(const char *glext) CHECK_ADDRESS(NEL_PFNGLGETVARIANTARRAYOBJECTFVATIPROC, glGetVariantArrayObjectfvATI); CHECK_ADDRESS(NEL_PFNGLGETVARIANTARRAYOBJECTIVATIPROC, glGetVariantArrayObjectivATI); } +#endif + return true; } @@ -1000,8 +1142,12 @@ static bool setupATIMapObjectBuffer(const char *glext) { H_AUTO_OGL(setupATIMapObjectBuffer); CHECK_EXT("GL_ATI_map_object_buffer"); + +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLMAPOBJECTBUFFERATIPROC, glMapObjectBufferATI); CHECK_ADDRESS(NEL_PFNGLUNMAPOBJECTBUFFERATIPROC, glUnmapObjectBufferATI); +#endif + return true; } @@ -1013,6 +1159,7 @@ static bool setupATIFragmentShader(const char *glext) H_AUTO_OGL(setupATIFragmentShader); CHECK_EXT("GL_ATI_fragment_shader"); +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLGENFRAGMENTSHADERSATIPROC, glGenFragmentShadersATI); CHECK_ADDRESS(NEL_PFNGLBINDFRAGMENTSHADERATIPROC, glBindFragmentShaderATI); CHECK_ADDRESS(NEL_PFNGLDELETEFRAGMENTSHADERATIPROC, glDeleteFragmentShaderATI); @@ -1027,6 +1174,7 @@ static bool setupATIFragmentShader(const char *glext) CHECK_ADDRESS(NEL_PFNGLALPHAFRAGMENTOP2ATIPROC, glAlphaFragmentOp2ATI); CHECK_ADDRESS(NEL_PFNGLALPHAFRAGMENTOP3ATIPROC, glAlphaFragmentOp3ATI); CHECK_ADDRESS(NEL_PFNGLSETFRAGMENTSHADERCONSTANTATIPROC, glSetFragmentShaderConstantATI); +#endif return true; } @@ -1037,9 +1185,11 @@ static bool setupATIVertexAttribArrayObject(const char *glext) H_AUTO_OGL(setupATIVertexAttribArrayObject); CHECK_EXT("GL_ATI_vertex_attrib_array_object"); +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLVERTEXATTRIBARRAYOBJECTATIPROC, glVertexAttribArrayObjectATI); CHECK_ADDRESS(NEL_PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC, glGetVertexAttribArrayObjectfvATI); CHECK_ADDRESS(NEL_PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC, glGetVertexAttribArrayObjectivATI); +#endif return true; } @@ -1050,6 +1200,7 @@ static bool setupARBFragmentProgram(const char *glext) H_AUTO_OGL(setupARBFragmentProgram); CHECK_EXT("GL_ARB_fragment_program"); +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLPROGRAMSTRINGARBPROC, glProgramStringARB); CHECK_ADDRESS(NEL_PFNGLBINDPROGRAMARBPROC, glBindProgramARB); CHECK_ADDRESS(NEL_PFNGLDELETEPROGRAMSARBPROC, glDeleteProgramsARB); @@ -1069,6 +1220,7 @@ static bool setupARBFragmentProgram(const char *glext) CHECK_ADDRESS(NEL_PFNGLGETPROGRAMIVARBPROC, glGetProgramivARB); CHECK_ADDRESS(NEL_PFNGLGETPROGRAMSTRINGARBPROC, glGetProgramStringARB); CHECK_ADDRESS(NEL_PFNGLISPROGRAMARBPROC, glIsProgramARB); +#endif return true; } @@ -1077,6 +1229,8 @@ static bool setupARBFragmentProgram(const char *glext) static bool setupARBVertexBufferObject(const char *glext) { H_AUTO_OGL(setupARBVertexBufferObject); + +#ifndef USE_OPENGLES CHECK_EXT("GL_ARB_vertex_buffer_object"); CHECK_ADDRESS(PFNGLBINDBUFFERARBPROC, glBindBufferARB); @@ -1090,6 +1244,7 @@ static bool setupARBVertexBufferObject(const char *glext) CHECK_ADDRESS(PFNGLUNMAPBUFFERARBPROC, glUnmapBufferARB); CHECK_ADDRESS(PFNGLGETBUFFERPARAMETERIVARBPROC, glGetBufferParameterivARB); CHECK_ADDRESS(PFNGLGETBUFFERPOINTERVARBPROC, glGetBufferPointervARB); +#endif return true; } @@ -1100,6 +1255,7 @@ static bool setupARBVertexProgram(const char *glext) H_AUTO_OGL(setupARBVertexProgram); CHECK_EXT("GL_ARB_vertex_program"); +#ifndef USE_OPENGLES CHECK_ADDRESS(PFNGLVERTEXATTRIB1SARBPROC, glVertexAttrib1sARB); CHECK_ADDRESS(PFNGLVERTEXATTRIB1FARBPROC, glVertexAttrib1fARB); CHECK_ADDRESS(PFNGLVERTEXATTRIB1DARBPROC, glVertexAttrib1dARB); @@ -1162,6 +1318,7 @@ static bool setupARBVertexProgram(const char *glext) CHECK_ADDRESS(PFNGLGETVERTEXATTRIBIVARBPROC, glGetVertexAttribivARB); CHECK_ADDRESS(PFNGLGETVERTEXATTRIBPOINTERVARBPROC, glGetVertexAttribPointervARB); CHECK_ADDRESS(PFNGLISPROGRAMARBPROC, glIsProgramARB); +#endif return true; } @@ -1172,6 +1329,7 @@ static bool setupNVOcclusionQuery(const char *glext) H_AUTO_OGL(setupNVOcclusionQuery); CHECK_EXT("GL_NV_occlusion_query"); +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLGENOCCLUSIONQUERIESNVPROC, glGenOcclusionQueriesNV); CHECK_ADDRESS(NEL_PFNGLDELETEOCCLUSIONQUERIESNVPROC, glDeleteOcclusionQueriesNV); CHECK_ADDRESS(NEL_PFNGLISOCCLUSIONQUERYNVPROC, glIsOcclusionQueryNV); @@ -1179,6 +1337,7 @@ static bool setupNVOcclusionQuery(const char *glext) CHECK_ADDRESS(NEL_PFNGLENDOCCLUSIONQUERYNVPROC, glEndOcclusionQueryNV); CHECK_ADDRESS(NEL_PFNGLGETOCCLUSIONQUERYIVNVPROC, glGetOcclusionQueryivNV); CHECK_ADDRESS(NEL_PFNGLGETOCCLUSIONQUERYUIVNVPROC, glGetOcclusionQueryuivNV); +#endif return true; } @@ -1204,7 +1363,11 @@ static bool setupEXTTextureRectangle(const char *glext) static bool setupARBTextureRectangle(const char *glext) { H_AUTO_OGL(setupARBTextureRectangle); + +#ifndef USE_OPENGLES CHECK_EXT("GL_ARB_texture_rectangle"); +#endif + return true; } @@ -1220,6 +1383,26 @@ static bool setupEXTTextureFilterAnisotropic(const char *glext) static bool setupFrameBufferObject(const char *glext) { H_AUTO_OGL(setupFrameBufferObject); + +#ifdef USE_OPENGLES + CHECK_EXT("GL_OES_framebuffer_object"); + + CHECK_ADDRESS(NEL_PFNGLISRENDERBUFFEROESPROC, glIsRenderbufferOES); + CHECK_ADDRESS(NEL_PFNGLBINDRENDERBUFFEROESPROC, glBindRenderbufferOES); + CHECK_ADDRESS(NEL_PFNGLDELETERENDERBUFFERSOESPROC, glDeleteRenderbuffersOES); + CHECK_ADDRESS(NEL_PFNGLGENRENDERBUFFERSOESPROC, glGenRenderbuffersOES); + CHECK_ADDRESS(NEL_PFNGLRENDERBUFFERSTORAGEOESPROC, glRenderbufferStorageOES); + CHECK_ADDRESS(NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC, glGetRenderbufferParameterivOES); + CHECK_ADDRESS(NEL_PFNGLISFRAMEBUFFEROESPROC, glIsFramebufferOES); + CHECK_ADDRESS(NEL_PFNGLBINDFRAMEBUFFEROESPROC, glBindFramebufferOES); + CHECK_ADDRESS(NEL_PFNGLDELETEFRAMEBUFFERSOESPROC, glDeleteFramebuffersOES); + CHECK_ADDRESS(NEL_PFNGLGENFRAMEBUFFERSOESPROC, glGenFramebuffersOES); + CHECK_ADDRESS(NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC, glCheckFramebufferStatusOES); + CHECK_ADDRESS(NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC, glFramebufferRenderbufferOES); + CHECK_ADDRESS(NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC, glFramebufferTexture2DOES); + CHECK_ADDRESS(NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC, glGetFramebufferAttachmentParameterivOES); + CHECK_ADDRESS(NEL_PFNGLGENERATEMIPMAPOESPROC, glGenerateMipmapOES); +#else CHECK_EXT("GL_EXT_framebuffer_object"); CHECK_ADDRESS(NEL_PFNGLISRENDERBUFFEREXTPROC, glIsRenderbufferEXT); @@ -1236,6 +1419,7 @@ static bool setupFrameBufferObject(const char *glext) CHECK_ADDRESS(NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC, glDeleteFramebuffersEXT); CHECK_ADDRESS(NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC, glGetRenderbufferParameterivEXT); CHECK_ADDRESS(NEL_PFNGENERATEMIPMAPEXTPROC, glGenerateMipmapEXT); +#endif return true; } @@ -1246,7 +1430,9 @@ static bool setupFrameBufferBlit(const char *glext) H_AUTO_OGL(setupFrameBufferBlit); CHECK_EXT("GL_EXT_framebuffer_blit"); +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLBLITFRAMEBUFFEREXTPROC, glBlitFramebufferEXT); +#endif return true; } @@ -1257,7 +1443,9 @@ static bool setupFrameBufferMultisample(const char *glext) H_AUTO_OGL(setupFrameBufferMultisample); CHECK_EXT("GL_EXT_framebuffer_multisample"); +#ifndef USE_OPENGLES CHECK_ADDRESS(NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC, glRenderbufferStorageMultisampleEXT); +#endif return true; } @@ -1266,7 +1454,13 @@ static bool setupFrameBufferMultisample(const char *glext) static bool setupPackedDepthStencil(const char *glext) { H_AUTO_OGL(setupPackedDepthStencil); + +#ifdef USE_OPENGLES + CHECK_EXT("GL_OES_packed_depth_stencil"); +#else CHECK_EXT("GL_EXT_packed_depth_stencil"); +#endif + return true; } @@ -1305,7 +1499,11 @@ void registerGlExtensions(CGlExtensions &ext) ext.ARBMultiTexture= setupARBMultiTexture(glext); if(ext.ARBMultiTexture) { +#ifdef USE_OPENGLES + glGetIntegerv(GL_MAX_TEXTURE_UNITS, &ntext); +#else glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &ntext); +#endif // We could have more than IDRV_MAT_MAXTEXTURES but the interface only // support IDRV_MAT_MAXTEXTURES texture stages so take min ext.NbTextureStages= (ntext<((GLint)IDRV_MAT_MAXTEXTURES)?ntext:IDRV_MAT_MAXTEXTURES); @@ -1330,8 +1528,10 @@ void registerGlExtensions(CGlExtensions &ext) if(ext.NVVertexArrayRange) { - GLint nverts; + GLint nverts = 10; +#ifndef USE_OPENGLES glGetIntegerv((GLenum)GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV, &nverts); +#endif ext.NVVertexArrayRangeMaxVertex= nverts; } @@ -1365,6 +1565,9 @@ void registerGlExtensions(CGlExtensions &ext) ext.ARBVertexProgram = false; } + ext.OESDrawTexture = setupOESDrawTexture(glext); + ext.OESMapBuffer = setupOESMapBuffer(glext); + // Check texture shaders // Disable feature ??? if(!ext.DisableHardwareTextureShader) @@ -1395,6 +1598,7 @@ void registerGlExtensions(CGlExtensions &ext) // Check NVVertexArrayRange2 ext.NVVertexArrayRange2= setupNVVertexArrayRange2(glext); +#ifdef GL_NV_vertex_array_range2 // if supported if(ext.NVVertexArrayRange2) // VBHard swap without flush of the VAR. @@ -1402,6 +1606,7 @@ void registerGlExtensions(CGlExtensions &ext) else // VBHard with useless flush of the VAR. ext.NVStateVARWithoutFlush= GL_VERTEX_ARRAY_RANGE_NV; +#endif // Check NV_occlusion_query ext.NVOcclusionQuery = setupNVOcclusionQuery(glext); @@ -1476,9 +1681,11 @@ static bool setupWGLEXTSwapControl(const char *glext) H_AUTO_OGL(setupWGLEXTSwapControl); CHECK_EXT("WGL_EXT_swap_control"); +#ifndef USE_OPENGLES #ifdef NL_OS_WINDOWS CHECK_ADDRESS(PFNWGLSWAPINTERVALEXTPROC, wglSwapIntervalEXT); CHECK_ADDRESS(PFNWGLGETSWAPINTERVALEXTPROC, wglGetSwapIntervalEXT); +#endif #endif return true; @@ -1524,11 +1731,43 @@ static bool setupGLXMESASwapControl(const char *glext) return true; } -#ifdef NL_OS_WINDOWS +#ifdef USE_OPENGLES +// *************************************************************************** +bool registerEGlExtensions(CGlExtensions &ext, EGLDisplay dpy) +{ + H_AUTO_OGL(registerEGlExtensions); + + // Get extension string + const char *glext = eglQueryString(dpy, EGL_EXTENSIONS); + if (glext == NULL) + { + nlwarning ("neglGetExtensionsStringARB failed"); + return false; + } + + nldebug("3D: Available EGL Extensions:"); + + if (DebugLog) + { + vector exts; + explode(string(glext), string(" "), exts); + for(uint i = 0; i < exts.size(); i++) + { + if(i%5==0) DebugLog->displayRaw("3D: "); + DebugLog->displayRaw(string(exts[i]+" ").c_str()); + if(i%5==4) DebugLog->displayRaw("\n"); + } + DebugLog->displayRaw("\n"); + } + + return true; +} +#elif defined(NL_OS_WINDOWS) // *************************************************************************** -bool registerWGlExtensions(CGlExtensions &ext, HDC hDC) +bool registerWGlExtensions(CGlExtensions &ext, HDC hDC) { H_AUTO_OGL(registerWGlExtensions); + // Get proc address CHECK_ADDRESS(PFNWGLGETEXTENSIONSSTRINGARBPROC, wglGetExtensionsStringARB); @@ -1569,7 +1808,7 @@ bool registerWGlExtensions(CGlExtensions &ext, HDC hDC) #elif defined(NL_OS_MAC) #elif defined(NL_OS_UNIX) // *************************************************************************** -bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen) +bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen) { H_AUTO_OGL(registerGlXExtensions); @@ -1609,6 +1848,10 @@ bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen) return true; } -#endif // NL_OS_WINDOWS +#endif // USE_OPENGLES -} +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + +} // NL3D 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 465f6febd..253f702a6 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.h @@ -21,35 +21,17 @@ #include "nel/misc/types_nl.h" #include "nel/misc/string_common.h" -#ifdef NL_OS_WINDOWS -# define WIN32_LEAN_AND_MEAN -# define NOMINMAX -# include -# include -# include // Please download it from http://www.opengl.org/registry/ -#elif defined(NL_OS_MAC) -# define GL_GLEXT_LEGACY -# include -# include "mac/glext.h" -#elif defined (NL_OS_UNIX) -# include -# include // Please download it from http://www.opengl.org/registry/ -# include -# include -#endif // NL_OS_UNIX - -#ifndef GL_GLEXT_VERSION -# error "I need a newer . Please download it from http://www.opengl.org/registry/" -#endif // GL_nGLEXT_VERSION - -#if GL_GLEXT_VERSION < 7 -# error "I need a newer . Please download it from http://www.opengl.org/registry/" -#endif // GL_nGLEXT_VERSION < 7 - #include "driver_opengl_extension_def.h" -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** /// The extensions used by NL3D. @@ -121,6 +103,9 @@ struct CGlExtensions bool ARBTextureNonPowerOfTwo; bool ARBMultisample; + bool OESDrawTexture; + bool OESMapBuffer; + public: /// \name Disable Hardware feature. False by default. setuped by IDriver @@ -184,6 +169,9 @@ public: NVVertexArrayRange2 = false; NVStateVARWithoutFlush = 0; + OESDrawTexture = false; + OESMapBuffer = false; + /// \name Disable Hardware feature. False by default. setuped by IDriver DisableHardwareVertexProgram= false; DisableHardwareVertexArrayAGP= false; @@ -266,7 +254,10 @@ public: // *************************************************************************** -#ifdef NL_OS_WINDOWS +#ifdef USE_OPENGLES +/// This function will test and register EGL functions before than the gl context is created +bool registerEGlExtensions(CGlExtensions &ext, EGLDisplay dpy); +#elif defined(NL_OS_WINDOWS) /// This function will test and register WGL functions before than the gl context is created bool registerWGlExtensions(CGlExtensions &ext, HDC hDC); #elif defined(NL_OS_MAC) @@ -278,7 +269,11 @@ bool registerGlXExtensions(CGlExtensions &ext, Display *dpy, sint screen); /// This function test and register the extensions for the current GL context. void registerGlExtensions(CGlExtensions &ext); -} +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + +} // NL3D // *************************************************************************** // The exported function names @@ -289,6 +284,48 @@ void registerGlExtensions(CGlExtensions &ext); NB: we do it for all (EXT, NV, ARB extension) even it should be useful only for ARB ones. */ +#ifdef USE_OPENGLES + +// OES_mapbuffer. +//=============== +extern NEL_PFNGLMAPBUFFEROESPROC nglMapBufferOES; +extern NEL_PFNGLUNMAPBUFFEROESPROC nglUnmapBufferOES; +extern NEL_PFNGLGETBUFFERPOINTERVOESPROC nglGetBufferPointervOES; + +extern NEL_PFNGLBUFFERSUBDATAPROC nglBufferSubData; + +extern PFNGLDRAWTEXFOESPROC nglDrawTexfOES; + +// GL_OES_framebuffer_object +extern NEL_PFNGLISRENDERBUFFEROESPROC nglIsRenderbufferOES; +extern NEL_PFNGLBINDRENDERBUFFEROESPROC nglBindRenderbufferOES; +extern NEL_PFNGLDELETERENDERBUFFERSOESPROC nglDeleteRenderbuffersOES; +extern NEL_PFNGLGENRENDERBUFFERSOESPROC nglGenRenderbuffersOES; +extern NEL_PFNGLRENDERBUFFERSTORAGEOESPROC nglRenderbufferStorageOES; +extern NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC nglGetRenderbufferParameterivOES; +extern NEL_PFNGLISFRAMEBUFFEROESPROC nglIsFramebufferOES; +extern NEL_PFNGLBINDFRAMEBUFFEROESPROC nglBindFramebufferOES; +extern NEL_PFNGLDELETEFRAMEBUFFERSOESPROC nglDeleteFramebuffersOES; +extern NEL_PFNGLGENFRAMEBUFFERSOESPROC nglGenFramebuffersOES; +extern NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC nglCheckFramebufferStatusOES; +extern NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC nglFramebufferRenderbufferOES; +extern NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC nglFramebufferTexture2DOES; +extern NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC nglGetFramebufferAttachmentParameterivOES; +extern NEL_PFNGLGENERATEMIPMAPOESPROC nglGenerateMipmapOES; + +// GL_OES_texture_cube_map +extern NEL_PFNGLTEXGENFOESPROC nglTexGenfOES; +extern NEL_PFNGLTEXGENFVOESPROC nglTexGenfvOES; +extern NEL_PFNGLTEXGENIOESPROC nglTexGeniOES; +extern NEL_PFNGLTEXGENIVOESPROC nglTexGenivOES; +extern NEL_PFNGLTEXGENXOESPROC nglTexGenxOES; +extern NEL_PFNGLTEXGENXVOESPROC nglTexGenxvOES; +extern NEL_PFNGLGETTEXGENFVOESPROC nglGetTexGenfvOES; +extern NEL_PFNGLGETTEXGENIVOESPROC nglGetTexGenivOES; +extern NEL_PFNGLGETTEXGENXVOESPROC nglGetTexGenxvOES; + +#else + // ARB_multitexture //================= extern NEL_PFNGLACTIVETEXTUREARBPROC nglActiveTextureARB; @@ -741,4 +778,6 @@ extern NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC nglRenderbufferStorageMul // GL_ARB_multisample extern NEL_PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB; +#endif // USE_OPENGLES + #endif // NL_OPENGL_EXTENSION_H diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h b/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h index c1ecfe8c0..dfdc5da46 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension_def.h @@ -20,23 +20,6 @@ #include "nel/misc/types_nl.h" -#ifdef USE_OPENGLES -# include -# include -#else -# ifdef NL_OS_MAC -# define GL_GLEXT_LEGACY -# include -# include "mac/glext.h" -# else -# include -# include -# if defined(NL_OS_WINDOWS) -# include -# endif -# endif -#endif - #ifdef __cplusplus extern "C" { #endif @@ -79,7 +62,8 @@ typedef void (APIENTRY * NEL_PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, typedef void (APIENTRY * NEL_PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params); typedef void (APIENTRY * NEL_PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params); typedef void (APIENTRY * NEL_PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params); -#endif + +#else // *************************************************************************** // *************************************************************************** @@ -456,6 +440,8 @@ typedef void (APIENTRY * NEL_PFNGLXFREEMEMORYNVPROC) (void *pointer); #endif // NL_OS_MAC +#endif // USE_OPENGLES + #ifdef __cplusplus } #endif diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp index acfdac253..e3921d5d4 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp @@ -17,11 +17,7 @@ #include "stdopengl.h" #include "driver_opengl.h" -#ifdef NL_OS_WINDOWS -# include -#elif defined(NL_OS_MAC) -#elif defined (NL_OS_UNIX) -# include +#ifdef NL_OS_UNIX # include # ifdef HAVE_XRENDER # include @@ -39,8 +35,15 @@ using namespace std; using namespace NLMISC; -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // ************************************************************************************* CDriverGL::CCursor::CCursor() : ColorDepth(CDriverGL::ColorDepth32), @@ -1010,4 +1013,8 @@ bool CDriverGL::convertBitmapToCursor(const NLMISC::CBitmap &bitmap, nlCursor &c #endif } +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp index 2fc25f94a..3d3a6b273 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_light.cpp @@ -19,9 +19,15 @@ #include "driver_opengl.h" #include "nel/3d/light.h" -namespace NL3D -{ +namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** uint CDriverGL::getMaxLight () const @@ -357,5 +363,8 @@ void CDriverGL::setupLightMapDynamicLighting(bool enable) refreshRenderSetup(); } +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif } // NL3D 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 4fe6e8c71..6e3780444 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp @@ -23,6 +23,14 @@ namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif + static void convBlend(CMaterial::TBlend blend, GLenum& glenum) { H_AUTO_OGL(convBlend) @@ -35,12 +43,7 @@ static void convBlend(CMaterial::TBlend blend, GLenum& glenum) case CMaterial::srccolor: glenum=GL_SRC_COLOR; break; case CMaterial::invsrccolor:glenum=GL_ONE_MINUS_SRC_COLOR; break; // Extended Blend modes. -#ifdef USE_OPENGLES - case CMaterial::blendConstantColor: glenum=GL_CONSTANT_COLOR; break; - case CMaterial::blendConstantInvColor: glenum=GL_ONE_MINUS_CONSTANT_COLOR; break; - case CMaterial::blendConstantAlpha: glenum=GL_CONSTANT_ALPHA; break; - case CMaterial::blendConstantInvAlpha: glenum=GL_ONE_MINUS_CONSTANT_ALPHA; break; -#else +#ifndef USE_OPENGLES case CMaterial::blendConstantColor: glenum=GL_CONSTANT_COLOR_EXT; break; case CMaterial::blendConstantInvColor: glenum=GL_ONE_MINUS_CONSTANT_COLOR_EXT; break; case CMaterial::blendConstantAlpha: glenum=GL_CONSTANT_ALPHA_EXT; break; @@ -84,22 +87,30 @@ static inline void convTexAddr(ITexture *tex, CMaterial::TTexAddressingMode mode nlassert(mode < CMaterial::TexAddrCount); static const GLenum glTex2dAddrModesNV[] = { +#ifdef USE_OPENGLES + 0, GL_TEXTURE_2D +#else GL_NONE, GL_TEXTURE_2D, GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV, GL_OFFSET_TEXTURE_2D_NV, GL_OFFSET_TEXTURE_2D_SCALE_NV, GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV, GL_DOT_PRODUCT_NV, GL_DOT_PRODUCT_TEXTURE_2D_NV, GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV, GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV, GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV, GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV, GL_DOT_PRODUCT_DEPTH_REPLACE_NV +#endif }; static const GLenum glTexCubeAddrModesNV[] = { +#ifdef USE_OPENGLES + 0, GL_TEXTURE_CUBE_MAP_OES +#else GL_NONE, GL_TEXTURE_CUBE_MAP_ARB, GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV, GL_OFFSET_TEXTURE_2D_NV, GL_OFFSET_TEXTURE_2D_SCALE_NV, GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV, GL_DOT_PRODUCT_NV, GL_DOT_PRODUCT_TEXTURE_2D_NV, GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV, GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV, GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV, GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV, GL_DOT_PRODUCT_DEPTH_REPLACE_NV +#endif }; if (!tex || !tex->isTextureCube()) @@ -136,17 +147,33 @@ void CDriverGL::setTextureEnvFunction(uint stage, CMaterial& mat) { // Cubic or normal ? if (text->isTextureCube ()) +#ifdef USE_OPENGLES + _DriverGLStates.setTexGenMode (stage, GL_REFLECTION_MAP_OES); +#else _DriverGLStates.setTexGenMode (stage, GL_REFLECTION_MAP_ARB); +#endif else +#ifdef USE_OPENGLES + _DriverGLStates.setTexGenMode (stage, GL_TEXTURE_CUBE_MAP_OES); +#else _DriverGLStates.setTexGenMode (stage, GL_SPHERE_MAP); +#endif } else if(mode==CMaterial::TexCoordGenObjectSpace) { +#ifdef USE_OPENGLES + _DriverGLStates.setTexGenMode (stage, GL_NORMAL_MAP_OES); +#else _DriverGLStates.setTexGenMode (stage, GL_OBJECT_LINEAR); +#endif } else if(mode==CMaterial::TexCoordGenEyeSpace) { +#ifdef USE_OPENGLES + _DriverGLStates.setTexGenMode (stage, GL_NORMAL_MAP_OES); +#else _DriverGLStates.setTexGenMode (stage, GL_EYE_LINEAR); +#endif } } else @@ -850,6 +877,22 @@ void CDriverGL::setupLightMapPass(uint pass) // TexEnv is special. _CurrentTexEnvSpecial[stage] = TexEnvSpecialLightMap; +#ifdef USE_OPENGLES + // What we want to setup is Texture*Constant + Previous. + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); + // Operator. + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD); + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_ADD); + // Arg0. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); + // Arg1. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR); + // Arg2. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); +#else if (_Extensions.NVTextureEnvCombine4) { // What we want to setup is Texture*Constant + Previous*1. @@ -889,6 +932,7 @@ void CDriverGL::setupLightMapPass(uint pass) glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT ); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR); } +#endif } } @@ -1196,6 +1240,58 @@ void CDriverGL::setupSpecularPass(uint pass) return; } +#ifdef USE_OPENGLES +#if 0 + // Ok we can do it in a single pass + + // Set Stage 1 + // Special: not the same special env if there is or not texture in stage 0. + CTexEnvSpecial newEnvStage1; + if( mat.getTexture(0) == NULL ) + newEnvStage1= TexEnvSpecialSpecularStage1NoText; + else + newEnvStage1= TexEnvSpecialSpecularStage1; + // Test if same env as prec. + if(_CurrentTexEnvSpecial[1] != newEnvStage1) + { + // TexEnv is special. + _CurrentTexEnvSpecial[1] = newEnvStage1; + + _DriverGLStates.activeTextureARB(1); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); + // Operator Add (Arg0*Arg2+Arg1) + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_ADD); + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_ADD); + // Arg0. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); + // Arg2. + if( newEnvStage1 == TexEnvSpecialSpecularStage1NoText) + { + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_ZERO); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_ONE_MINUS_SRC_COLOR); + } + else + { + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_PREVIOUS); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); + } + // Arg1. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); + // Result : Texture*Previous.Alpha+Previous + // Setup Alpha Diffuse Copy + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PRIMARY_COLOR); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); + // Arg2. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, GL_ZERO); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + // Arg1. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_ZERO ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); + } +#endif +#else /// Support NVidia combine 4 extension to do specular map in a single pass if( _Extensions.NVTextureEnvCombine4 ) { // Ok we can do it in a single pass @@ -1258,7 +1354,7 @@ void CDriverGL::setupSpecularPass(uint pass) // Ok we can do it in a single pass // Set Stage 1 - // Special: not the same sepcial env if there is or not texture in stage 0. + // Special: not the same special env if there is or not texture in stage 0. CTexEnvSpecial newEnvStage1; if( mat.getTexture(0) == NULL ) newEnvStage1= TexEnvSpecialSpecularStage1NoText; @@ -1305,11 +1401,13 @@ void CDriverGL::setupSpecularPass(uint pass) } } else +#endif { // We have to do it in 2 passes // For Both Pass, setup correct Env. if( pass == 0 ) - { // Just display the texture + { + // Just display the texture _DriverGLStates.enableBlend(false); _DriverGLStates.activeTextureARB(1); _DriverGLStates.setTextureMode(CDriverGLStates::TextureDisabled); @@ -1542,6 +1640,20 @@ void CDriverGL::setupPPLPass(uint pass) _CurrentTexEnvSpecial[0] = TexEnvSpecialPPLStage0; _DriverGLStates.activeTextureARB(0); +#ifdef USE_OPENGLES + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); + + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); + // Arg0 = Diffuse read in cube map + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); + // Arg1 = Light color + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR); + // Arg2 = Primary color (other light diffuse and + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); +#else if (_Extensions.NVTextureEnvCombine4) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV); @@ -1575,6 +1687,7 @@ void CDriverGL::setupPPLPass(uint pass) glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR); } +#endif } activateTexEnvColor(0, _PPLightDiffuseColor); @@ -1592,6 +1705,32 @@ void CDriverGL::setupPPLPass(uint pass) _CurrentTexEnvSpecial[2] = TexEnvSpecialPPLStage2; _DriverGLStates.activeTextureARB(2); +#ifdef USE_OPENGLES + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); + //== colors == + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); + // Arg0 = Specular read in cube map + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); + // Arg2 = Light color + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR); + // Arg1 = Primary color ( + other light diffuse) + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); + + //== alpha == + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE); + // Arg0 = PREVIOUS ALPHA + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_PREVIOUS); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_COLOR); + // Arg2 = 1 + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, GL_ZERO); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_ONE_MINUS_SRC_COLOR); + // Arg1 = 0 + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_ZERO); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_COLOR); +#else if (_Extensions.NVTextureEnvCombine4) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV); @@ -1652,6 +1791,7 @@ void CDriverGL::setupPPLPass(uint pass) glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_EXT, GL_ZERO); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_EXT, GL_SRC_COLOR); } +#endif } activateTexEnvColor(2, _PPLightSpecularColor); @@ -1707,6 +1847,20 @@ void CDriverGL::setupPPLNoSpecPass(uint pass) _CurrentTexEnvSpecial[0] = TexEnvSpecialPPLStage0; _DriverGLStates.activeTextureARB(0); +#ifdef USE_OPENGLES + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); + + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); + // Arg0 = Diffuse read in cube map alpha + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); + // Arg2 = Light color + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_COLOR); + // Arg1 = Primary color (other light diffuse and + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); +#else if (_Extensions.NVTextureEnvCombine4) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV); @@ -1740,6 +1894,7 @@ void CDriverGL::setupPPLNoSpecPass(uint pass) glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PRIMARY_COLOR_EXT); glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR); } +#endif } activateTexEnvColor(0, _PPLightDiffuseColor); @@ -1852,6 +2007,7 @@ void CDriverGL::setupCloudPass (uint /* pass */) if (_CurrentTexEnvSpecial[0] != TexEnvSpecialCloudStage0) { +#ifndef USE_OPENGLES if (_Extensions.NVTextureEnvCombine4) { _CurrentTexEnvSpecial[0] = TexEnvSpecialCloudStage0; @@ -1969,6 +2125,7 @@ void CDriverGL::setupCloudPass (uint /* pass */) glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_EXT, GL_SRC_ALPHA); */ } +#endif } if (_Extensions.NVTextureEnvCombine4) activateTexEnvColor (1, mat.getColor()); @@ -2323,4 +2480,8 @@ void CDriverGL::endWaterMultiPass() #endif } +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp index 4106c38f2..7136e615e 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_matrix.cpp @@ -19,6 +19,14 @@ namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif + // *************************************************************************** void CDriverGL::setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective) { @@ -204,5 +212,8 @@ void CDriverGL::doRefreshRenderSetup() _RenderSetupDirty= false; } +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp index cf30758dc..d8c9ae106 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.cpp @@ -22,8 +22,15 @@ // define it For Debug purpose only. Normal use is to hide this line //#define NL3D_GLSTATE_DISABLE_CACHE -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** CDriverGLStates::CDriverGLStates() @@ -642,6 +649,8 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode) { _TexGenMode[stage] = mode; + if (!_TextureCubeMapSupported) return; + if(mode==0) { #ifdef USE_OPENGLES @@ -655,15 +664,31 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode) } else { +#ifdef USE_OPENGLES +// nglTexGeniOES(GL_TEXTURE_GEN_STR_OES, GL_TEXTURE_GEN_MODE_OES, mode); +#else glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, mode); glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, mode); glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, mode); +#endif + /* Object or Eye Space ? => enable W generation. VERY IMPORTANT because was a bug with VegetableRender and ShadowRender: - Vegetable use the TexCoord1.w in his VertexProgram - Shadow Render don't use any TexCoord in VB (since projected) => TexCoord1.w dirty!! */ +#ifdef USE_OPENGLES +// if(mode==GL_OBJECT_LINEAR || mode==GL_EYE_LINEAR) +// { + nglTexGeniOES(GL_TEXTURE_GEN_STR_OES, GL_TEXTURE_GEN_MODE_OES, mode); + glEnable(GL_TEXTURE_GEN_STR_OES); +// } +// else +// { +// glDisable(GL_TEXTURE_GEN_STR_OES); +// } +#else if(mode==GL_OBJECT_LINEAR || mode==GL_EYE_LINEAR) { glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, mode); @@ -673,6 +698,7 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode) { glDisable( GL_TEXTURE_GEN_Q ); } +#endif // Enable All. #ifdef USE_OPENGLES @@ -686,8 +712,6 @@ void CDriverGLStates::setTexGenMode (uint stage, GLint mode) } } - - // *************************************************************************** void CDriverGLStates::resetTextureMode() { @@ -994,6 +1018,7 @@ void CDriverGLStates::enableVertexAttribArrayARB(uint glIndex,bool enable) void CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bool enable, uint *variants) { H_AUTO_OGL(CDriverGLStates_enableVertexAttribArrayForEXTVertexShader) + if(_VertexAttribArrayEnabled[glIndex] != enable) { switch(glIndex) @@ -1002,10 +1027,12 @@ void CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bo enableVertexArray(enable); break; case 1: // skin weight +#ifndef USE_OPENGLES if(enable) nglEnableVariantClientStateEXT(variants[CDriverGL::EVSSkinWeightVariant]); else nglDisableVariantClientStateEXT(variants[CDriverGL::EVSSkinWeightVariant]); +#endif break; case 2: // normal enableNormalArray(enable); @@ -1014,22 +1041,28 @@ void CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bo enableColorArray(enable); break; case 4: // secondary color +#ifndef USE_OPENGLES if(enable) nglEnableVariantClientStateEXT(variants[CDriverGL::EVSSecondaryColorVariant]); else nglDisableVariantClientStateEXT(variants[CDriverGL::EVSSecondaryColorVariant]); +#endif break; case 5: // fog coordinate +#ifndef USE_OPENGLES if(enable) nglEnableVariantClientStateEXT(variants[CDriverGL::EVSFogCoordsVariant]); else nglDisableVariantClientStateEXT(variants[CDriverGL::EVSFogCoordsVariant]); +#endif break; case 6: // palette skin +#ifndef USE_OPENGLES if(enable) nglEnableVariantClientStateEXT(variants[CDriverGL::EVSPaletteSkinVariant]); else nglDisableVariantClientStateEXT(variants[CDriverGL::EVSPaletteSkinVariant]); +#endif break; case 7: // empty nlstop; @@ -1051,8 +1084,6 @@ void CDriverGLStates::enableVertexAttribArrayForEXTVertexShader(uint glIndex, bo } _VertexAttribArrayEnabled[glIndex]= enable; } - - } @@ -1123,6 +1154,8 @@ CDriverGLStates::TCullMode CDriverGLStates::getCullMode() const return _CullMode; } - +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_states.h b/code/nel/src/3d/driver/opengl/driver_opengl_states.h index e3820c4a8..6d92a8080 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_states.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_states.h @@ -20,20 +20,15 @@ #include "nel/misc/types_nl.h" #include "nel/3d/vertex_buffer.h" +namespace NL3D { + +#ifdef NL_STATIC #ifdef USE_OPENGLES -# include +namespace NLDRIVERGLES { #else -# ifdef NL_OS_MAC -# define GL_GLEXT_LEGACY -# include -# else -# include -# endif +namespace NLDRIVERGL { +#endif #endif - - -namespace NL3D -{ // *************************************************************************** /** @@ -255,6 +250,9 @@ private: bool _CurLight[MaxLight]; }; +#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 315c9ee2a..bb89f5ee0 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp @@ -41,9 +41,15 @@ using namespace std; #define NEL_MEASURE_UPLOAD_TIME_END #endif -namespace NL3D -{ +namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** CTextureDrvInfosGL::CTextureDrvInfosGL(IDriver *drv, ItTexDrvInfoPtrMap it, CDriverGL *drvGl, bool isRectangleTexture) : ITextureDrvInfos(drv, it) @@ -60,7 +66,11 @@ CTextureDrvInfosGL::CTextureDrvInfosGL(IDriver *drv, ItTexDrvInfoPtrMap it, CDri // Nb: at Driver dtor, all tex infos are deleted, so _Driver is always valid. _Driver= drvGl; +#ifdef USE_OPENGLES + TextureMode = GL_TEXTURE_2D; +#else TextureMode = isRectangleTexture?GL_TEXTURE_RECTANGLE_NV:GL_TEXTURE_2D; +#endif FBOId = 0; DepthFBOId = 0; @@ -85,6 +95,15 @@ CTextureDrvInfosGL::~CTextureDrvInfosGL() if(InitFBO) { +#ifdef USE_OPENGLES + nglDeleteFramebuffersOES(1, &FBOId); + if(AttachDepthStencil) + { + nglDeleteRenderbuffersOES(1, &DepthFBOId); + if(!UsePackedDepthStencil) + nglDeleteRenderbuffersOES(1, &StencilFBOId); + } +#else nglDeleteFramebuffersEXT(1, &FBOId); if(AttachDepthStencil) { @@ -92,6 +111,7 @@ CTextureDrvInfosGL::~CTextureDrvInfosGL() if(!UsePackedDepthStencil) nglDeleteRenderbuffersEXT(1, &StencilFBOId); } +#endif } } @@ -104,6 +124,54 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex) { AttachDepthStencil = !((CTextureBloom*)tex)->isMode2D(); } + +#ifdef USE_OPENGLES + // generate IDs + nglGenFramebuffersOES(1, &FBOId); + if(AttachDepthStencil) + { + nglGenRenderbuffersOES(1, &DepthFBOId); + if(UsePackedDepthStencil) + StencilFBOId = DepthFBOId; + else + nglGenRenderbuffersOES(1, &StencilFBOId); + } + + //nldebug("3D: using depth %d and stencil %d", DepthFBOId, StencilFBOId); + + // initialize FBO + nglBindFramebufferOES(GL_FRAMEBUFFER_OES, FBOId); + nglFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, TextureMode, ID, 0); + + // attach depth/stencil render to FBO + // note: for some still unkown reason it's impossible to add + // a stencil buffer as shown in the respective docs (see + // opengl.org extension registry). Until a safe approach to add + // them is found, there will be no attached stencil for the time + // being, aside of using packed depth+stencil buffers. + if(AttachDepthStencil) + { + if(UsePackedDepthStencil) + { + //nldebug("3D: using packed depth stencil"); + nglBindRenderbufferOES(GL_RENDERBUFFER_OES, StencilFBOId); + nglRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH24_STENCIL8_OES, tex->getWidth(), tex->getHeight()); + } + else + { + nglBindRenderbufferOES(GL_RENDERBUFFER_OES, DepthFBOId); + nglRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT24_OES, tex->getWidth(), tex->getHeight()); + /* + nglBindRenderbufferEXT(GL_RENDERBUFFER_OES, StencilFBOId); + nglRenderbufferStorageEXT(GL_RENDERBUFFER_OES, GL_STENCIL_INDEX8_EXT, tex->getWidth(), tex->getHeight()); + */ + } + nglFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, DepthFBOId); + nldebug("3D: glFramebufferRenderbufferExt(depth:24) = %X", nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES)); + nglFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_STENCIL_ATTACHMENT_OES, GL_RENDERBUFFER_OES, StencilFBOId); + nldebug("3D: glFramebufferRenderbufferExt(stencil:8) = %X", nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES)); + } +#else // generate IDs nglGenFramebuffersEXT(1, &FBOId); if(AttachDepthStencil) @@ -119,8 +187,7 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex) // initialize FBO nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBOId); - nglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - TextureMode, ID, 0); + nglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, TextureMode, ID, 0); // attach depth/stencil render to FBO // note: for some still unkown reason it's impossible to add @@ -152,6 +219,7 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex) GL_RENDERBUFFER_EXT, StencilFBOId); nldebug("3D: glFramebufferRenderbufferExt(stencil:8) = %X", nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT)); } +#endif // check status GLenum status; @@ -161,44 +229,95 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex) status = (GLenum) nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); #endif switch(status) { +#ifdef GL_FRAMEBUFFER_COMPLETE_EXT case GL_FRAMEBUFFER_COMPLETE_EXT: InitFBO = true; break; +#endif +#ifdef GL_FRAMEBUFFER_COMPLETE_OES + case GL_FRAMEBUFFER_COMPLETE_OES: + InitFBO = true; + break; +#endif +#ifdef GL_FRAMEBUFFER_UNSUPPORTED_EXT case GL_FRAMEBUFFER_UNSUPPORTED_EXT: nlwarning("Unsupported framebuffer format"); break; +#endif +#ifdef GL_FRAMEBUFFER_UNSUPPORTED_OES + case GL_FRAMEBUFFER_UNSUPPORTED_OES: + nlwarning("Unsupported framebuffer format"); + break; +#endif #ifdef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: nlwarning("Framebuffer incomplete attachment"); break; #endif +#ifdef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES: + nlwarning("Framebuffer incomplete attachment"); + break; +#endif +#ifdef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT: nlwarning("Framebuffer incomplete, missing attachment"); break; +#endif +#ifdef GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES: + nlwarning("Framebuffer incomplete, missing attachment"); + break; +#endif #ifdef GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT: nlwarning("Framebuffer incomplete, duplicate attachment"); break; #endif +#ifdef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: nlwarning("Framebuffer incomplete, attached images must have same dimensions"); break; +#endif +#ifdef GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES + case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES: + nlwarning("Framebuffer incomplete, attached images must have same dimensions"); + break; +#endif +#ifdef GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: nlwarning("Framebuffer incomplete, attached images must have same format"); break; +#endif +#ifdef GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES + case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES: + nlwarning("Framebuffer incomplete, attached images must have same format"); + break; +#endif +#ifdef GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: nlwarning("Framebuffer incomplete, missing draw buffer"); break; +#endif +#ifdef GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: nlwarning("Framebuffer incomplete, missing read buffer"); break; +#endif +#ifdef GL_FRAMEBUFFER_BINDING_EXT case GL_FRAMEBUFFER_BINDING_EXT: nlwarning("Framebuffer BINDING_EXT"); break; +#endif #ifdef GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: nlwarning("Framebuffer incomplete multisample"); break; +#endif +#ifdef GL_FRAMEBUFFER_BINDING_OES + case GL_FRAMEBUFFER_BINDING_OES: + nlwarning("Framebuffer BINDING_EXT"); + break; #endif default: nlwarning("Framebuffer incomplete status %d", (sint)status); @@ -265,7 +384,7 @@ bool CTextureDrvInfosGL::activeFrameBufferObject(ITexture * tex) // *************************************************************************** // Get the glText mirror of an existing setuped texture. -static inline CTextureDrvInfosGL* getTextureGl(ITexture& tex) +static inline CTextureDrvInfosGL* getTextureGl(ITexture& tex) { H_AUTO_OGL(getTextureGl) CTextureDrvInfosGL* gltex; @@ -310,10 +429,18 @@ GLint CDriverGL::getGlTextureFormat(ITexture& tex, bool &compressed) // Try Compressed ones. switch(texfmt) { +#ifdef GL_COMPRESSED_RGB_S3TC_DXT1_EXT case ITexture::DXTC1: return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; +#endif +#ifdef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT case ITexture::DXTC1Alpha: return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; +#endif +#ifdef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT case ITexture::DXTC3: return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; +#endif +#ifdef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT case ITexture::DXTC5: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; +#endif default: break; } } @@ -322,6 +449,16 @@ GLint CDriverGL::getGlTextureFormat(ITexture& tex, bool &compressed) compressed= false; switch(texfmt) { +#ifdef USE_OPENGLES + case ITexture::RGBA8888: return GL_RGBA; +// case ITexture::RGBA4444: return GL_RGBA4_OES; +// case ITexture::RGBA5551: return GL_RGB5_A1_OES; + case ITexture::RGB888: return GL_RGB; +// case ITexture::RGB565: return GL_RGB5_OES; + case ITexture::Luminance: return GL_LUMINANCE; + case ITexture::Alpha: return GL_ALPHA; + case ITexture::AlphaLuminance: return GL_LUMINANCE_ALPHA; +#else case ITexture::RGBA8888: return GL_RGBA8; case ITexture::RGBA4444: return GL_RGBA4; case ITexture::RGBA5551: return GL_RGB5_A1; @@ -342,8 +479,16 @@ GLint CDriverGL::getGlTextureFormat(ITexture& tex, bool &compressed) return 0; } break; - default: return GL_RGBA8; +#endif + default: + break; } + +#ifdef USE_OPENGLES + return GL_RGBA; +#else + return GL_RGBA8; +#endif } // *************************************************************************** @@ -352,7 +497,11 @@ static GLint getGlSrcTextureFormat(ITexture &tex, GLint glfmt) H_AUTO_OGL(getGlSrcTextureFormat) // Is destination format is alpha or lumiance ? +#ifdef USE_OPENGLES + if ((glfmt==GL_ALPHA)||(glfmt==GL_LUMINANCE_ALPHA)||(glfmt==GL_LUMINANCE)) +#else if ((glfmt==GL_ALPHA8)||(glfmt==GL_LUMINANCE8_ALPHA8)||(glfmt==GL_LUMINANCE8)) +#endif { switch(tex.getPixelFormat()) { @@ -363,6 +512,7 @@ static GLint getGlSrcTextureFormat(ITexture &tex, GLint glfmt) } } +#ifndef USE_OPENGLES if (glfmt == GL_DSDT_NV) { return GL_DSDT_NV; @@ -372,6 +522,7 @@ static GLint getGlSrcTextureFormat(ITexture &tex, GLint glfmt) { return GL_DUDV_ATI; } +#endif // Else, not a Src format for upload, or RGBA. return GL_RGBA; @@ -380,7 +531,9 @@ static GLint getGlSrcTextureFormat(ITexture &tex, GLint glfmt) // *************************************************************************** static GLenum getGlSrcTextureComponentType(GLint texSrcFormat) { - H_AUTO_OGL(getGlSrcTextureComponentType) + H_AUTO_OGL(getGlSrcTextureComponentType); + +#ifndef USE_OPENGLES switch (texSrcFormat) { case GL_DSDT_NV: @@ -388,10 +541,11 @@ static GLenum getGlSrcTextureComponentType(GLint texSrcFormat) return GL_BYTE; // these are signed format break; default: - return GL_UNSIGNED_BYTE; break; - } +#endif + + return GL_UNSIGNED_BYTE; } // *************************************************************************** @@ -400,22 +554,65 @@ uint CDriverGL::computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const H_AUTO_OGL(CDriverGL_computeMipMapMemoryUsage) switch(glfmt) { +#ifdef GL_RGBA8 case GL_RGBA8: return w*h* 4; +#endif +#ifdef GL_RGBA + case GL_RGBA: return w*h* 4; +#endif // Well this is ugly, but simple :). GeForce 888 is stored as 32 bits. +#ifdef GL_RGB8 case GL_RGB8: return w*h* 4; +#endif +#ifdef GL_RGB + case GL_RGB: return w*h* 4; +#endif +#ifdef GL_RGBA4 case GL_RGBA4: return w*h* 2; +#endif +#ifdef GL_RGB5_A1 case GL_RGB5_A1: return w*h* 2; +#endif +#ifdef GL_RGB5 case GL_RGB5: return w*h* 2; +#endif +#ifdef GL_LUMINANCE8 case GL_LUMINANCE8: return w*h* 1; +#endif +#ifdef GL_LUMINANCE + case GL_LUMINANCE: return w*h* 1; +#endif +#ifdef GL_ALPHA8 case GL_ALPHA8: return w*h* 1; +#endif +#ifdef GL_ALPHA + case GL_ALPHA: return w*h* 1; +#endif +#ifdef GL_LUMINANCE8_ALPHA8 case GL_LUMINANCE8_ALPHA8: return w*h* 2; +#endif +#ifdef GL_LUMINANCE_ALPHA + case GL_LUMINANCE_ALPHA: return w*h* 2; +#endif +#ifdef GL_COMPRESSED_RGB_S3TC_DXT1_EXT case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return w*h /2; +#endif +#ifdef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return w*h /2; +#endif +#ifdef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: return w*h* 1; +#endif +#ifdef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return w*h* 1; +#endif +#ifdef GL_DU8DV8_ATI case GL_DU8DV8_ATI: +#endif +#ifdef GL_DSDT_NV case GL_DSDT_NV: return w*h* 2; - }; +#endif + } // One format has not been coded. nlstop; @@ -431,13 +628,15 @@ static inline GLenum translateWrapToGl(ITexture::TWrapMode mode, const CGlExtens H_AUTO_OGL(translateWrapToGl) if(mode== ITexture::Repeat) return GL_REPEAT; - else - { - if(extensions.Version1_2) - return GL_CLAMP_TO_EDGE; - else - return GL_CLAMP; - } + +#ifdef USE_OPENGLES + return GL_CLAMP_TO_EDGE; +#else + if(extensions.Version1_2) + return GL_CLAMP_TO_EDGE; + + return GL_CLAMP; +#endif } // *************************************************************************** @@ -506,14 +705,26 @@ static inline GLenum translateMinFilterToGl(CTextureDrvInfosGL *glText) static inline bool sameDXTCFormat(ITexture &tex, GLint glfmt) { H_AUTO_OGL(sameDXTCFormat); + +#ifdef GL_COMPRESSED_RGB_S3TC_DXT1_EXT if(glfmt==GL_COMPRESSED_RGB_S3TC_DXT1_EXT && tex.PixelFormat==CBitmap::DXTC1) return true; +#endif + +#ifdef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT1_EXT && tex.PixelFormat==CBitmap::DXTC1Alpha) return true; +#endif + +#ifdef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT3_EXT && tex.PixelFormat==CBitmap::DXTC3) return true; +#endif + +#ifdef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT5_EXT && tex.PixelFormat==CBitmap::DXTC5) return true; +#endif return false; } @@ -522,14 +733,26 @@ static inline bool sameDXTCFormat(ITexture &tex, GLint glfmt) static inline bool isDXTCFormat(GLint glfmt) { H_AUTO_OGL(isDXTCFormat); + +#ifdef GL_COMPRESSED_RGB_S3TC_DXT1_EXT if(glfmt==GL_COMPRESSED_RGB_S3TC_DXT1_EXT) return true; +#endif + +#ifdef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) return true; +#endif + +#ifdef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT3_EXT) return true; +#endif + +#ifdef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT if(glfmt==GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) return true; +#endif return false; } @@ -558,14 +781,20 @@ void CDriverGL::bindTextureWithMode(ITexture &tex) { _DriverGLStates.setTextureMode(CDriverGLStates::TextureCubeMap); // Bind this texture +#ifdef USE_OPENGLES + glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID); +#else glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID); +#endif } } else { CDriverGLStates::TTextureMode textureMode= CDriverGLStates::Texture2D; +#ifndef USE_OPENGLES if(gltext->TextureMode == GL_TEXTURE_RECTANGLE_NV) textureMode = CDriverGLStates::TextureRect; +#endif _DriverGLStates.setTextureMode(textureMode); // Bind this texture @@ -591,11 +820,19 @@ void CDriverGL::setupTextureBasicParameters(ITexture &tex) { if (_Extensions.ARBTextureCubeMap) { +#ifdef USE_OPENGLES + glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions)); + glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions)); +// glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions)); + glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext)); + glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext)); +#else glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions)); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions)); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions)); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext)); glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext)); +#endif } } else @@ -1005,6 +1242,23 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded, clamp(x1, x0, w); clamp(y1, y0, h); +#ifdef USE_OPENGLES + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + if (!bUpload) + ptr = NULL; + + sint pixelSize = 4; + + if (glSrcFmt == GL_ALPHA) + pixelSize = 1; + + for(sint yy = 0; yy < (y1-y0); yy++) + { + char *row = (char*)ptr + ((yy + y0)*w + x0) * pixelSize; + glTexSubImage2D (GL_TEXTURE_2D, i, x0, y0+yy, x1-x0, 1, glSrcFmt, glSrcType, row ); + } +#else glPixelStorei(GL_UNPACK_ROW_LENGTH, w); glPixelStorei(GL_UNPACK_SKIP_ROWS, y0); glPixelStorei(GL_UNPACK_SKIP_PIXELS, x0); @@ -1012,6 +1266,7 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded, glTexSubImage2D (GL_TEXTURE_2D, i, x0, y0, x1-x0, y1-y0, glSrcFmt,glSrcType, ptr); else glTexSubImage2D (GL_TEXTURE_2D, i, x0, y0, x1-x0, y1-y0, glSrcFmt,glSrcType, NULL); +#endif // Next mipmap!! // floor . @@ -1024,9 +1279,13 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded, } // Reset the transfer mode... +#ifdef USE_OPENGLES + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); +#else glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); +#endif } } @@ -1081,8 +1340,11 @@ bool CDriverGL::uploadTexture (ITexture& tex, CRect& rect, uint8 nNumMipMap) // system of "backup the previous binded texture" seems to not work with some drivers.... _DriverGLStates.activeTextureARB (0); CDriverGLStates::TTextureMode textureMode= CDriverGLStates::Texture2D; + +#ifndef USE_OPENGLES if(gltext->TextureMode == GL_TEXTURE_RECTANGLE_NV) textureMode = CDriverGLStates::TextureRect; +#endif _DriverGLStates.setTextureMode (textureMode); // Bind this texture, for reload... @@ -1139,8 +1401,13 @@ bool CDriverGL::uploadTexture (ITexture& tex, CRect& rect, uint8 nNumMipMap) nlassert (((x0&3) == 0) && ((y0&3) == 0)); if ((w>=4) && (h>=4)) { - nglCompressedTexSubImage2DARB ( GL_TEXTURE_2D, nNumMipMap-decalMipMapResize, - x0, y0, (x1-x0), (y1-y0), glfmt, imageSize, ptr ); +#ifdef USE_OPENGLES + glCompressedTexSubImage2D ( +#else + nglCompressedTexSubImage2DARB ( +#endif + GL_TEXTURE_2D, nNumMipMap-decalMipMapResize, + x0, y0, (x1-x0), (y1-y0), glfmt, imageSize, ptr ); } else { @@ -1148,7 +1415,12 @@ bool CDriverGL::uploadTexture (ITexture& tex, CRect& rect, uint8 nNumMipMap) // of the mipmap is less than 4 pixel so we use the other form. (its not really time critical // to upload 16 bytes so we can do it twice if texture is cut) imageSize = tex.getPixels(nNumMipMap).size(); - nglCompressedTexImage2DARB (GL_TEXTURE_2D, nNumMipMap-decalMipMapResize, +#ifdef USE_OPENGLES + glCompressedTexImage2D ( +#else + nglCompressedTexImage2DARB ( +#endif + GL_TEXTURE_2D, nNumMipMap-decalMipMapResize, glfmt, w, h, 0, imageSize, ptr); } } @@ -1158,6 +1430,22 @@ bool CDriverGL::uploadTexture (ITexture& tex, CRect& rect, uint8 nNumMipMap) nlassert (glSrcFmt!=GL_RGBA || tex.getPixelFormat()==CBitmap::RGBA); void *ptr= tex.getPixels(nNumMipMap).getPtr(); + +#ifdef USE_OPENGLES + sint pixelSize = 4; + + if (glSrcFmt == GL_ALPHA) + pixelSize = 1; + + for(sint yy = 0; yy < (y1-y0); yy++) + { + char *row = (char*)ptr + ((yy + y0)*w + x0) * pixelSize; + glTexSubImage2D (GL_TEXTURE_2D, nNumMipMap, x0, y0+yy, x1-x0, 1, glSrcFmt, glSrcType, row ); + } + + // Reset the transfer mode... +// glPixelStorei (GL_UNPACK_ALIGNMENT, 0); +#else glPixelStorei (GL_UNPACK_ROW_LENGTH, w); glPixelStorei (GL_UNPACK_SKIP_ROWS, y0); glPixelStorei (GL_UNPACK_SKIP_PIXELS, x0); @@ -1167,6 +1455,7 @@ bool CDriverGL::uploadTexture (ITexture& tex, CRect& rect, uint8 nNumMipMap) glPixelStorei (GL_UNPACK_ROW_LENGTH, 0); glPixelStorei (GL_UNPACK_SKIP_ROWS, 0); glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0); +#endif } // Disable texture 0 @@ -1227,19 +1516,31 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex) _CurrentTextureInfoGL[stage]= gltext; // setup this texture +#ifdef USE_OPENGLES + glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID); +#else glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID); +#endif // Change parameters of texture, if necessary. //============================================ if(gltext->MagFilter!= tex->getMagFilter()) { gltext->MagFilter= tex->getMagFilter(); +#ifdef USE_OPENGLES + glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext)); +#else glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext)); +#endif } if(gltext->MinFilter!= tex->getMinFilter()) { gltext->MinFilter= tex->getMinFilter(); +#ifdef USE_OPENGLES + glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext)); +#else glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext)); +#endif } } } @@ -1248,8 +1549,10 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex) { // setup texture mode, after activeTextureARB() CDriverGLStates::TTextureMode textureMode= CDriverGLStates::Texture2D; +#ifndef USE_OPENGLES if(gltext->TextureMode == GL_TEXTURE_RECTANGLE_NV) textureMode = CDriverGLStates::TextureRect; +#endif _DriverGLStates.setTextureMode(/*CDriverGLStates::Texture2D*/textureMode); // Activate texture... @@ -1296,11 +1599,14 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex) _CurrentTextureInfoGL[stage]= NULL; // setup texture mode, after activeTextureARB() _DriverGLStates.setTextureMode(CDriverGLStates::TextureDisabled); + +#ifndef USE_OPENGLES if (_Extensions.ATITextureEnvCombine3) { // very strange bug with ATI cards : when a texture is set to NULL at a stage, the stage is still active sometimes... activateTexEnvMode(stage, _TexEnvReplace); // set the whole stage to replace fix the problem } +#endif } this->_CurrentTexture[stage]= tex; @@ -1311,24 +1617,43 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex) // This maps the CMaterial::TTexOperator -static const GLenum OperatorLUT[9]= { GL_REPLACE, GL_MODULATE, GL_ADD, GL_ADD_SIGNED_EXT, - GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_BUMP_ENVMAP_ATI }; +static const GLenum OperatorLUT[9]= { GL_REPLACE, GL_MODULATE, GL_ADD, +#ifdef USE_OPENGLES + GL_ADD_SIGNED, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE +#else + GL_ADD_SIGNED_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_BUMP_ENVMAP_ATI +#endif +}; // This maps the CMaterial::TTexSource -static const GLenum SourceLUT[4]= { GL_TEXTURE, GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT }; +static const GLenum SourceLUT[4]= { GL_TEXTURE, +#ifdef USE_OPENGLES + GL_PREVIOUS, GL_PRIMARY_COLOR, GL_CONSTANT +#else + GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT +#endif +}; // This maps the CMaterial::TTexOperand static const GLenum OperandLUT[4]= { GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA }; // This maps the CMaterial::TTexOperator, used for openGL Arg2 setup. -static const GLenum InterpolateSrcLUT[8]= { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, - GL_TEXTURE, GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT }; +static const GLenum InterpolateSrcLUT[8]= { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, +#ifdef USE_OPENGLES + GL_PREVIOUS, GL_PRIMARY_COLOR, GL_CONSTANT +#else + GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT +#endif +}; + +#ifndef USE_OPENGLES // *************************************************************************** // Set general tex env using ENV_COMBINE4 for the current setupped stage (used by forceActivateTexEnvMode) static void forceActivateTexEnvModeEnvCombine4(const CMaterial::CTexEnv &env) { - H_AUTO_OGL(forceActivateTexEnvModeEnvCombine4) + H_AUTO_OGL(forceActivateTexEnvModeEnvCombine4); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV); //== RGB == @@ -1613,6 +1938,7 @@ static void forceActivateTexEnvModeEnvCombine4(const CMaterial::CTexEnv &env) } } +#endif // *************************************************************************** void CDriverGL::forceActivateTexEnvMode(uint stage, const CMaterial::CTexEnv &env) @@ -1626,6 +1952,114 @@ void CDriverGL::forceActivateTexEnvMode(uint stage, const CMaterial::CTexEnv & // Setup the gl env mode. _DriverGLStates.activeTextureARB(stage); + +#ifdef USE_OPENGLES + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); + + // RGB. + //===== + if (env.Env.OpRGB == CMaterial::Mad) + { + // + if (false) + { + // GL_MODULATE_ADD_ATI + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB); + // Arg0. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, SourceLUT[env.Env.SrcArg0RGB] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, OperandLUT[env.Env.OpArg0RGB]); + // Arg1. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, SourceLUT[env.Env.SrcArg1RGB] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, OperandLUT[env.Env.OpArg1RGB]); + // Arg2. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, SourceLUT[env.Env.SrcArg2RGB] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, OperandLUT[env.Env.OpArg2RGB]); + } + else + { + // fallback to modulate .. + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); + // + // Arg0. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, SourceLUT[env.Env.SrcArg0RGB] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, OperandLUT[env.Env.OpArg0RGB]); + // Arg1. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, SourceLUT[env.Env.SrcArg1RGB] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, OperandLUT[env.Env.OpArg1RGB]); + } + } + else + { + // Operator. + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, OperatorLUT[env.Env.OpRGB] ); + // Arg0. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, SourceLUT[env.Env.SrcArg0RGB] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, OperandLUT[env.Env.OpArg0RGB]); + // Arg1. + if(env.Env.OpRGB > CMaterial::Replace) + { + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, SourceLUT[env.Env.SrcArg1RGB] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, OperandLUT[env.Env.OpArg1RGB]); + // Arg2. + if(env.Env.OpRGB >= CMaterial::InterpolateTexture ) + { + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_RGB, InterpolateSrcLUT[env.Env.OpRGB] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); + } + } + } + // Alpha. + //===== + if (env.Env.OpAlpha == CMaterial::Mad) + { + if (true) + { + // GL_MODULATE_ADD_ATI + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB); + // Arg0. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, SourceLUT[env.Env.SrcArg0Alpha] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, OperandLUT[env.Env.OpArg0Alpha]); + // Arg1. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, SourceLUT[env.Env.SrcArg1Alpha] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, OperandLUT[env.Env.OpArg1Alpha]); + // Arg2. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, SourceLUT[env.Env.SrcArg2Alpha] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, OperandLUT[env.Env.OpArg2Alpha]); + } + else + { + // fallback to modulate .. + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE); + // + // Arg0. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, SourceLUT[env.Env.SrcArg0RGB] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, OperandLUT[env.Env.OpArg0RGB]); + // Arg1. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, SourceLUT[env.Env.SrcArg1RGB] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, OperandLUT[env.Env.OpArg1RGB]); + } + } + else + { + // Operator. + glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, OperatorLUT[env.Env.OpAlpha] ); + // Arg0. + glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, SourceLUT[env.Env.SrcArg0Alpha] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, OperandLUT[env.Env.OpArg0Alpha]); + // Arg1. + if(env.Env.OpAlpha > CMaterial::Replace) + { + glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, SourceLUT[env.Env.SrcArg1Alpha] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, OperandLUT[env.Env.OpArg1Alpha]); + // Arg2. + if(env.Env.OpAlpha >= CMaterial::InterpolateTexture ) + { + glTexEnvi(GL_TEXTURE_ENV, GL_SRC2_ALPHA, InterpolateSrcLUT[env.Env.OpAlpha] ); + glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_SRC_ALPHA); + } + } + } +#else // if the Mad operator is used, then // "Normal drivers", setup EnvCombine. if(_Extensions.EXTTextureEnvCombine) @@ -1746,6 +2180,7 @@ void CDriverGL::forceActivateTexEnvMode(uint stage, const CMaterial::CTexEnv & { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); } +#endif } // *************************************************************************** @@ -1982,4 +2417,8 @@ bool CDriverGL::getRenderTargetSize (uint32 &width, uint32 &height) // *************************************************************************** +#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 7241d499b..06cfdf71f 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp @@ -46,13 +46,15 @@ using namespace NLMISC; -namespace NL3D -{ - - - - +namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** @@ -1313,6 +1315,7 @@ void CDriverGL::setupGlArraysForARBVertexProgram(CVertexBufferInfo &vb) _DriverGLStates.bindARBVertexBuffer(vb.VertexObjectId); } +#ifndef USE_OPENGLES // special case if the buffer is an ATI_vertex_array_object if (vb.VBMode == CVertexBufferInfo::HwATI) { @@ -1346,6 +1349,7 @@ void CDriverGL::setupGlArraysForARBVertexProgram(CVertexBufferInfo &vb) } } else +#endif { // For each value for (uint value=0; valueUsedVertexComponents) { _DriverGLStates.enableVertexAttribArrayForEXTVertexShader(glIndex, true, drvInfo->Variants); +#ifndef USE_OPENGLES // use variant or open gl standard array if (vb.VBMode == CVertexBufferInfo::HwATI) { @@ -1487,6 +1496,7 @@ void CDriverGL::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb) } } else +#endif { switch(value) { @@ -1499,7 +1509,9 @@ void CDriverGL::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb) case CVertexBuffer::Weight: // skin weight { nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported +#ifndef USE_OPENGLES nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSSkinWeightVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]); +#endif } break; case CVertexBuffer::Normal: // normal @@ -1518,21 +1530,27 @@ void CDriverGL::setupGlArraysForEXTVertexShader(CVertexBufferInfo &vb) { // implemented using a variant, as not available with EXTVertexShader nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported +#ifndef USE_OPENGLES nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSSecondaryColorVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]); +#endif } break; case CVertexBuffer::Fog: // fog coordinate { // implemented using a variant nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported +#ifndef USE_OPENGLES nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSFogCoordsVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]); +#endif } break; case CVertexBuffer::PaletteSkin: // palette skin { // implemented using a variant nlassert(NumCoordinatesType[type] == 4); // variant, only 4 component supported +#ifndef USE_OPENGLES nglVariantPointerEXT(drvInfo->Variants[CDriverGL::EVSPaletteSkinVariant], GLType[type], vb.VertexSize, vb.ValuePtr[value]); +#endif } break; case CVertexBuffer::Empty: // empty @@ -1789,6 +1807,7 @@ void CDriverGL::fenceOnCurVBHardIfNeeded(IVertexBufferHardGL *newVBHard) { H_AUTO_OGL(CDriverGL_fenceOnCurVBHardIfNeeded); +#ifndef USE_OPENGLES // If old is not a VBHard, or if not a NVidia VBHard, no-op. if( _CurrentVertexBufferHard==NULL || !_CurrentVertexBufferHard->VBType == IVertexBufferHardGL::NVidiaVB) return; @@ -1817,6 +1836,7 @@ void CDriverGL::fenceOnCurVBHardIfNeeded(IVertexBufferHardGL *newVBHard) vbHardNV->GPURenderingAfterFence= false; } } +#endif } // *************************************************************************** @@ -1840,4 +1860,8 @@ void CIndexBufferInfo::setupIndexBuffer(CIndexBuffer &ib) // *************************************************************************** +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp index ba471b8dd..706b0f0eb 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.cpp @@ -24,11 +24,15 @@ using namespace std; using namespace NLMISC; -namespace NL3D -{ - - +namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** // *************************************************************************** @@ -103,10 +107,10 @@ bool CVertexArrayRangeNVidia::allocate(uint32 size, CVertexBuffer::TPreferredM H_AUTO_OGL(CVertexArrayRangeNVidia_allocate) nlassert(_VertexArrayPtr==NULL); -#ifdef NL_OS_WINDOWS // try to allocate AGP or VRAM data. switch(vbType) { +#ifdef NL_OS_WINDOWS case CVertexBuffer::AGPPreferred: _VertexArrayPtr= nwglAllocateMemoryNV(size, 0, 0, 0.5f); break; @@ -116,12 +120,9 @@ bool CVertexArrayRangeNVidia::allocate(uint32 size, CVertexBuffer::TPreferredM else _VertexArrayPtr= nwglAllocateMemoryNV(size, 0, 0, 0.5f); break; - default: - break; - } -#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC) - switch(vbType) - { +#elif defined(NL_OS_MAC) + // TODO: implement for Mac OS X +#elif defined(NL_OS_UNIX) case CVertexBuffer::AGPPreferred: _VertexArrayPtr= nglXAllocateMemoryNV(size, 0, 0, 0.5f); break; @@ -131,11 +132,10 @@ bool CVertexArrayRangeNVidia::allocate(uint32 size, CVertexBuffer::TPreferredM else _VertexArrayPtr= nglXAllocateMemoryNV(size, 0, 0, 0.5f); break; +#endif // NL_OS_WINDOWS default: break; } -#endif // NL_OS_WINDOWS - // init the allocator. if(_VertexArrayPtr) @@ -175,7 +175,9 @@ void CVertexArrayRangeNVidia::free() #ifdef NL_OS_WINDOWS // Free special memory. nwglFreeMemoryNV(_VertexArrayPtr); -#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC) +#elif defined(NL_OS_MAC) + // TODO: implement for Mac OS X +#elif defined(NL_OS_UNIX) nglXFreeMemoryNV(_VertexArrayPtr); #endif // NL_OS_WINDOWS @@ -1217,7 +1219,7 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff nglGenBuffersARB(1, &vertexBufferID); #endif - if (glGetError() != GL_NO_ERROR) return false; + if (glGetError() != GL_NO_ERROR) return NULL; _Driver->_DriverGLStates.forceBindARBVertexBuffer(vertexBufferID); switch(_VBType) { @@ -1254,7 +1256,7 @@ IVertexBufferHardGL *CVertexArrayRangeARB::createVBHardGL(uint size, CVertexBuff nglDeleteBuffersARB(1, &vertexBufferID); #endif - return false; + return NULL; } CVertexBufferHardARB *newVbHard= new CVertexBufferHardARB(_Driver, vb); newVbHard->initGL(vertexBufferID, this, _VBType); @@ -1664,6 +1666,8 @@ void CVertexBufferHardARB::invalidate() } #endif +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif -} - +} // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h index da454c558..6821392b5 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_buffer_hard.h @@ -20,9 +20,15 @@ #include "nel/misc/types_nl.h" -namespace NL3D -{ +namespace NL3D { +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif class CDriverGL; class IVertexBufferHardGL; @@ -30,8 +36,6 @@ class CVertexBufferInfo; class CVertexBufferHardGLMapObjectATI; class CVertexBufferHardARB; - - // *************************************************************************** // *************************************************************************** // VBHard interface for both NVidia / ATI extension. @@ -573,6 +577,9 @@ public: #endif }; +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif } // NL3D @@ -580,24 +587,3 @@ public: #endif // NL_DRIVER_OPENGL_VERTEX_BUFFER_HARD_H /* End of driver_opengl_vertex_buffer_hard.h */ - - - - - - - - - - - - - - - - - - - - - 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 4915ed1d4..dbeede7e5 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 @@ -30,8 +30,15 @@ using namespace NLMISC; //#define DEBUG_SETUP_EXT_VERTEX_SHADER -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif // *************************************************************************** CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInfoPtrList it) : IVertexProgramDrvInfos (drv, it) @@ -43,6 +50,7 @@ CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInf || drv->_Extensions.ARBVertexProgram ); +#ifndef USE_OPENGLES if (drv->_Extensions.NVVertexProgram) // NVIDIA implemntation { // Generate a program @@ -56,6 +64,7 @@ CVertexProgamDrvInfosGL::CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInf { ID = nglGenVertexShadersEXT(1); // ATI implementation } +#endif } @@ -79,6 +88,8 @@ bool CDriverGL::isVertexProgramEmulated () const bool CDriverGL::activeNVVertexProgram (CVertexProgram *program) { H_AUTO_OGL(CVertexProgamDrvInfosGL_activeNVVertexProgram) + +#ifndef USE_OPENGLES // Setup or unsetup ? if (program) { @@ -188,6 +199,9 @@ bool CDriverGL::activeNVVertexProgram (CVertexProgram *program) // Ok return true; } +#endif + + return false; } @@ -200,10 +214,16 @@ inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate) { switch(comp) { +#ifdef USE_OPENGLES + case CVPSwizzle::X: return GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES; + case CVPSwizzle::Y: return GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES; + case CVPSwizzle::Z: return GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES; +#else case CVPSwizzle::X: return GL_X_EXT; case CVPSwizzle::Y: return GL_Y_EXT; case CVPSwizzle::Z: return GL_Z_EXT; case CVPSwizzle::W: return GL_W_EXT; +#endif default: nlstop; return 0; @@ -214,10 +234,16 @@ inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate) { switch(comp) { +#ifdef USE_OPENGLES + case CVPSwizzle::X: return GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES; + case CVPSwizzle::Y: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES; + case CVPSwizzle::Z: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES; +#else case CVPSwizzle::X: return GL_NEGATIVE_X_EXT; case CVPSwizzle::Y: return GL_NEGATIVE_Y_EXT; case CVPSwizzle::Z: return GL_NEGATIVE_Z_EXT; case CVPSwizzle::W: return GL_NEGATIVE_W_EXT; +#endif default: nlstop; return 0; @@ -231,7 +257,9 @@ inline GLenum convSwizzleToGLFormat(CVPSwizzle::EComp comp, bool negate) */ static GLuint convOutputRegisterToEXTVertexShader(CVPOperand::EOutputRegister r) { - H_AUTO_OGL(convOutputRegisterToEXTVertexShader) + H_AUTO_OGL(convOutputRegisterToEXTVertexShader); + +#ifndef USE_OPENGLES switch (r) { case CVPOperand::OHPosition: return GL_OUTPUT_VERTEX_EXT; @@ -259,6 +287,8 @@ static GLuint convOutputRegisterToEXTVertexShader(CVPOperand::EOutputRegister r) nlstop; break; } +#endif + return 0; } @@ -310,6 +340,8 @@ static uint convInputRegisterToVBFlag(uint index) static void doSwizzle(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW) { H_AUTO_OGL(doSwizzle); + +#ifndef USE_OPENGLES nglSwizzleEXT(res, in, outX, outY, outZ, outW); #ifdef DEBUG_SETUP_EXT_VERTEX_SHADER std::string swzStr = "Swizzle : "; @@ -353,13 +385,15 @@ static void doSwizzle(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum ou } EVS_INFO(swzStr.c_str()); #endif - +#endif } // Perform write mask and output de bug information static void doWriteMask(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW) { H_AUTO_OGL(doWriteMask); + +#ifndef USE_OPENGLES nglWriteMaskEXT(res, in, outX, outY, outZ, outW); #ifdef DEBUG_SETUP_EXT_VERTEX_SHADER nlinfo("3D: Write Mask : %c%c%c%c", @@ -369,6 +403,7 @@ static void doWriteMask(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outW ? 'w' : '-' ); #endif +#endif } // *************************************************************************** @@ -377,6 +412,8 @@ static void doWriteMask(GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum bool CDriverGL::setupEXTVertexShader(const CVPParser::TProgram &program, GLuint id, uint variants[EVSNumVariants], uint16 &usedInputRegisters) { H_AUTO_OGL(CDriverGL_setupEXTVertexShader); + +#ifndef USE_OPENGLES // counter to see what is generated uint numOp = 0; uint numOpIndex = 0; @@ -1157,7 +1194,9 @@ bool CDriverGL::setupEXTVertexShader(const CVPParser::TProgram &program, GLuint #endif return true; - +#else + return false; +#endif } //================================================================================================= @@ -1315,6 +1354,8 @@ static void ARBVertexProgramDumpInstr(const CVPInstruction &instr, std::string & bool CDriverGL::setupARBVertexProgram (const CVPParser::TProgram &inParsedProgram, GLuint id, bool &specularWritten) { H_AUTO_OGL(CDriverGL_setupARBVertexProgram) + +#ifndef USE_OPENGLES // tmp CVPParser::TProgram parsedProgram = inParsedProgram; // @@ -1449,6 +1490,9 @@ bool CDriverGL::setupARBVertexProgram (const CVPParser::TProgram &inParsedProgra #endif return true; +#else + return false; +#endif } @@ -1456,7 +1500,9 @@ bool CDriverGL::setupARBVertexProgram (const CVPParser::TProgram &inParsedProgra // *************************************************************************** bool CDriverGL::activeARBVertexProgram (CVertexProgram *program) { - H_AUTO_OGL(CDriverGL_activeARBVertexProgram) + H_AUTO_OGL(CDriverGL_activeARBVertexProgram); + +#ifndef USE_OPENGLES // Setup or unsetup ? if (program) { @@ -1520,13 +1566,18 @@ bool CDriverGL::activeARBVertexProgram (CVertexProgram *program) _VertexProgramEnabled = false; } return true; +#else + return false; +#endif } // *************************************************************************** bool CDriverGL::activeEXTVertexShader (CVertexProgram *program) { - H_AUTO_OGL(CDriverGL_activeEXTVertexShader) + H_AUTO_OGL(CDriverGL_activeEXTVertexShader); + +#ifndef USE_OPENGLES // Setup or unsetup ? if (program) { @@ -1594,6 +1645,9 @@ bool CDriverGL::activeEXTVertexShader (CVertexProgram *program) _VertexProgramEnabled = false; } return true; +#else + return false; +#endif } // *************************************************************************** @@ -1623,7 +1677,9 @@ bool CDriverGL::activeVertexProgram (CVertexProgram *program) void CDriverGL::setConstant (uint index, float f0, float f1, float f2, float f3) { - H_AUTO_OGL(CDriverGL_setConstant) + H_AUTO_OGL(CDriverGL_setConstant); + +#ifndef USE_OPENGLES // Vertex program exist ? if (_Extensions.NVVertexProgram) { @@ -1639,6 +1695,7 @@ void CDriverGL::setConstant (uint index, float f0, float f1, float f2, float f3) float datas[] = { f0, f1, f2, f3 }; nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, datas); } +#endif } @@ -1646,7 +1703,9 @@ void CDriverGL::setConstant (uint index, float f0, float f1, float f2, float f3) void CDriverGL::setConstant (uint index, double d0, double d1, double d2, double d3) { - H_AUTO_OGL(CDriverGL_setConstant) + H_AUTO_OGL(CDriverGL_setConstant); + +#ifndef USE_OPENGLES // Vertex program exist ? if (_Extensions.NVVertexProgram) { @@ -1662,6 +1721,7 @@ void CDriverGL::setConstant (uint index, double d0, double d1, double d2, double double datas[] = { d0, d1, d2, d3 }; nglSetInvariantEXT(_EVSConstantHandle + index, GL_DOUBLE, datas); } +#endif } @@ -1669,7 +1729,9 @@ void CDriverGL::setConstant (uint index, double d0, double d1, double d2, double void CDriverGL::setConstant (uint index, const NLMISC::CVector& value) { - H_AUTO_OGL(CDriverGL_setConstant) + H_AUTO_OGL(CDriverGL_setConstant); + +#ifndef USE_OPENGLES // Vertex program exist ? if (_Extensions.NVVertexProgram) { @@ -1685,6 +1747,7 @@ void CDriverGL::setConstant (uint index, const NLMISC::CVector& value) float datas[] = { value.x, value.y, value.z, 0 }; nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, datas); } +#endif } @@ -1692,7 +1755,9 @@ void CDriverGL::setConstant (uint index, const NLMISC::CVector& value) void CDriverGL::setConstant (uint index, const NLMISC::CVectorD& value) { - H_AUTO_OGL(CDriverGL_setConstant) + H_AUTO_OGL(CDriverGL_setConstant); + +#ifndef USE_OPENGLES // Vertex program exist ? if (_Extensions.NVVertexProgram) { @@ -1708,13 +1773,16 @@ void CDriverGL::setConstant (uint index, const NLMISC::CVectorD& value) 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) + H_AUTO_OGL(CDriverGL_setConstant); + +#ifndef USE_OPENGLES // Vertex program exist ? if (_Extensions.NVVertexProgram) { @@ -1734,12 +1802,15 @@ void CDriverGL::setConstant (uint index, uint num, const float *src) 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) + H_AUTO_OGL(CDriverGL_setConstant); + +#ifndef USE_OPENGLES // Vertex program exist ? if (_Extensions.NVVertexProgram) { @@ -1759,6 +1830,7 @@ void CDriverGL::setConstant (uint index, uint num, const double *src) nglSetInvariantEXT(_EVSConstantHandle + index + k, GL_DOUBLE, (void *) (src + 4 * k)); } } +#endif } // *************************************************************************** @@ -1767,7 +1839,11 @@ const uint CDriverGL::GLMatrix[IDriver::NumMatrix]= { GL_MODELVIEW, GL_PROJECTION, +#ifdef USE_OPENGLES + GL_MODELVIEW +#else GL_MODELVIEW_PROJECTION_NV +#endif }; @@ -1775,10 +1851,17 @@ const uint CDriverGL::GLMatrix[IDriver::NumMatrix]= 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 }; @@ -1786,7 +1869,9 @@ const uint CDriverGL::GLTransform[IDriver::NumTransform]= void CDriverGL::setConstantMatrix (uint index, IDriver::TMatrix matrix, IDriver::TTransform transform) { - H_AUTO_OGL(CDriverGL_setConstantMatrix) + H_AUTO_OGL(CDriverGL_setConstantMatrix); + +#ifndef USE_OPENGLES // Vertex program exist ? if (_Extensions.NVVertexProgram) { @@ -1856,6 +1941,7 @@ void CDriverGL::setConstantMatrix (uint index, IDriver::TMatrix matrix, IDriver: nglSetInvariantEXT(_EVSConstantHandle + index + 3, GL_FLOAT, matDatas + 12); } } +#endif } // *************************************************************************** @@ -1871,7 +1957,9 @@ void CDriverGL::setConstantFog (uint index) void CDriverGL::enableVertexProgramDoubleSidedColor(bool doubleSided) { - H_AUTO_OGL(CDriverGL_enableVertexProgramDoubleSidedColor) + H_AUTO_OGL(CDriverGL_enableVertexProgramDoubleSidedColor); + +#ifndef USE_OPENGLES // Vertex program exist ? if (_Extensions.NVVertexProgram) { @@ -1889,6 +1977,7 @@ void CDriverGL::enableVertexProgramDoubleSidedColor(bool doubleSided) else glDisable (GL_VERTEX_PROGRAM_TWO_SIDE_ARB); } +#endif } @@ -1900,5 +1989,8 @@ bool CDriverGL::supportVertexProgramDoubleSidedColor() const return _Extensions.NVVertexProgram || _Extensions.ARBVertexProgram; } +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif } // NL3D diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 6ebcff4c7..213959f61 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -22,24 +22,20 @@ // by default, we disable the windows menu keys (F10, ALT and ALT+SPACE key doesn't freeze or open the menu) #define NL_DISABLE_MENU -#ifdef NL_OS_WINDOWS -# include -#elif defined(NL_OS_MAC) +#ifdef NL_OS_MAC # import "mac/cocoa_window_delegate.h" # import "mac/cocoa_application_delegate.h" # import #elif defined (NL_OS_UNIX) -# include -# include -# ifdef HAVE_XRANDR -# include -# endif // HAVE_XRANDR -# ifdef HAVE_XRENDER -# include -# endif // HAVE_XRENDER -# include -# define _NET_WM_STATE_REMOVE 0 -# define _NET_WM_STATE_ADD 1 +# ifdef HAVE_XRANDR +# include +# endif // HAVE_XRANDR +# ifdef HAVE_XRENDER +# include +# endif // HAVE_XRENDER +# include +# define _NET_WM_STATE_REMOVE 0 +# define _NET_WM_STATE_ADD 1 #endif // NL_OS_UNIX #include "nel/misc/mouse_device.h" @@ -50,8 +46,15 @@ using namespace std; using namespace NLMISC; -namespace NL3D -{ +namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif #ifdef NL_OS_WINDOWS @@ -110,7 +113,8 @@ bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - H_AUTO_OGL(DriverGL_WndProc) + H_AUTO_OGL(DriverGL_WndProc); + // Get the driver pointer.. CDriverGL *pDriver=(CDriverGL*)GetWindowLongPtr (hWnd, GWLP_USERDATA); bool trapMessage = false; @@ -342,9 +346,12 @@ bool CDriverGL::init (uint windowIcon, emptyProc exitFunc) #elif defined(NL_OS_MAC) // nothing to do + nlunreferenced(windowIcon); #elif defined (NL_OS_UNIX) + nlunreferenced(windowIcon); + _dpy = XOpenDisplay(NULL); if (_dpy == NULL) @@ -444,6 +451,7 @@ bool CDriverGL::unInit() #ifdef NL_OS_WINDOWS +#ifndef USE_OPENGLES // Off-screen rendering ? if (_PBuffer) { @@ -451,6 +459,7 @@ bool CDriverGL::unInit() nwglDestroyPbufferARB(_PBuffer); _PBuffer = NULL; } +#endif if (_Registered && !UnregisterClassW(L"NLClass", GetModuleHandle(NULL))) { @@ -606,14 +615,15 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re #ifdef NL_OS_WINDOWS // Init pointers +#ifndef USE_OPENGLES _PBuffer = NULL; _hRC = NULL; _hDC = NULL; +#endif // Driver caps. //============= // Retrieve the WGL extensions before init the driver. - int pf; // Offscreen mode ? if (_CurrentMode.OffScreen) @@ -652,7 +662,7 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re _pfd.cAlphaBits = 8; } _pfd.iLayerType = PFD_MAIN_PLANE; - pf=ChoosePixelFormat(tempHDC,&_pfd); + int pf=ChoosePixelFormat(tempHDC,&_pfd); if (!pf) { nlwarning ("CDriverGL::setDisplay: ChoosePixelFormat failed"); @@ -695,7 +705,11 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re } // Register WGL functions +#ifdef USE_OPENGLES + registerEGlExtensions (_Extensions, tempHDC); +#else registerWGlExtensions (_Extensions, tempHDC); +#endif HDC hdc = wglGetCurrentDC (); @@ -854,11 +868,19 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re _CurrentMode.Depth = uint8(GetDeviceCaps (_hDC, BITSPIXEL)); // Destroy the temp gl context +#ifdef USE_OPENGLES + if (!eglDestroyContext(_EglDisplay, _EglContext);) + { + DWORD error = GetLastError (); + nlwarning ("CDriverGL::setDisplay: wglDeleteContext failed: 0x%x", error); + } +#else if (!wglDeleteContext (tempGLRC)) { DWORD error = GetLastError (); nlwarning ("CDriverGL::setDisplay: wglDeleteContext failed: 0x%x", error); } +#endif // Destroy the temp windows if (!DestroyWindow (tmpHWND)) @@ -871,9 +893,15 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re { DWORD error = GetLastError (); nlwarning ("CDriverGL::setDisplay: wglMakeCurrent failed: 0x%x", error); + +#ifdef USE_OPENGLES + eglDestroyContext(_EglDisplay, _EglContext); +#else wglDeleteContext (_hRC); nwglReleasePbufferDCARB( _PBuffer, _hDC ); nwglDestroyPbufferARB( _PBuffer ); +#endif + DestroyWindow (tmpHWND); _PBuffer = NULL; _win = EmptyWindow; @@ -898,43 +926,7 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re // associate OpenGL driver to window SetWindowLongPtr(_win, GWLP_USERDATA, (LONG_PTR)this); - - _hDC=GetDC(_win); - wglMakeCurrent(_hDC,NULL); - - _CurrentMode.Depth = uint8(GetDeviceCaps(_hDC,BITSPIXEL)); - // --- - memset(&_pfd,0,sizeof(_pfd)); - _pfd.nSize = sizeof(_pfd); - _pfd.nVersion = 1; - _pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; - _pfd.iPixelType = PFD_TYPE_RGBA; - _pfd.cColorBits = _CurrentMode.Depth; - // Choose best suited Depth Buffer. - if(_CurrentMode.Depth <= 16) - { - _pfd.cDepthBits = 16; - } - else - { - _pfd.cDepthBits = 24; - _pfd.cAlphaBits = 8; - _pfd.cStencilBits = 8; - } - _pfd.iLayerType = PFD_MAIN_PLANE; - pf=ChoosePixelFormat(_hDC,&_pfd); - if (!pf) - { - return false; - } - - if ( !SetPixelFormat(_hDC,pf,&_pfd) ) - { - return false; - } - _hRC=wglCreateContext(_hDC); - - wglMakeCurrent(_hDC,_hRC); + createContext(); } /// release old emitter @@ -1585,7 +1577,7 @@ bool CDriverGL::createWindow(const GfxMode &mode) { nlwarning("3D: Couldn't allocate XClassHint"); } - + #endif // NL_OS_UNIX _win = window; @@ -1615,7 +1607,19 @@ bool CDriverGL::destroyWindow() std::vector bitmaps; setWindowIcon(bitmaps); -#ifdef NL_OS_WINDOWS +#ifdef USE_OPENGLES + + if (_EglDisplay && _EglContext) + { + eglMakeCurrent(_EglDisplay, _EglSurface, _EglSurface, _EglContext); + + if (_DestroyWindow) + { + eglDestroyContext(_EglDisplay, _EglContext); + } + } + +#elif defined(NL_OS_WINDOWS) // Then delete. // wglMakeCurrent(NULL,NULL); @@ -1633,12 +1637,24 @@ bool CDriverGL::destroyWindow() { ReleaseDC(_win, _hDC); _hDC = NULL; - - // don't destroy window if it hasn't been created by our driver - if (_DestroyWindow) - DestroyWindow(_win); } +#elif defined(NL_OS_MAC) +#elif defined(NL_OS_UNIX) + + if (_DestroyWindow && _ctx) + glXDestroyContext(_dpy, _ctx); + + _ctx = NULL; + +#endif + +#ifdef NL_OS_WINDOWS + + // don't destroy window if it hasn't been created by our driver + if (_win && _DestroyWindow) + DestroyWindow(_win); + #elif defined(NL_OS_MAC) if (_DestroyWindow) @@ -1654,16 +1670,8 @@ bool CDriverGL::destroyWindow() _EventEmitter.closeIM(); - if (_DestroyWindow) - { - if (_ctx) - glXDestroyContext(_dpy, _ctx); - - if (_win) - XDestroyWindow(_dpy, _win); - } - - _ctx = NULL; + if (_DestroyWindow && _win) + XDestroyWindow(_dpy, _win); // Ungrab the keyboard (probably not necessary); // XUnmapWindow(_dpy, _win); @@ -2366,6 +2374,150 @@ emptyProc CDriverGL::getWindowProc() return (emptyProc)GlWndProc; } +// -------------------------------------------------- +bool CDriverGL::createContext() +{ +#ifdef USE_OPENGLES + uint samples = 0; + + if (_CurrentMode.AntiAlias > -1) + { + if (_CurrentMode.AntiAlias == 0) + { + samples = 4; + } + else + { + samples = _CurrentMode.AntiAlias; + } + } + + EGLint attribList[] = + { + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_DEPTH_SIZE, 16, + EGL_STENCIL_SIZE, 8, +// EGL_SAMPLE_BUFFERS, _CurrentMode.AntiAlias > -1 ? 1:0, +// EGL_SAMPLES, samples, + EGL_RENDERABLE_TYPE, + EGL_OPENGL_ES_BIT, + EGL_NONE + }; + + // Get Display + _EglDisplay = EGL_NO_DISPLAY; // eglGetDisplay(_hDC); + + if (_EglDisplay == EGL_NO_DISPLAY) + { + _EglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); + + if (_EglDisplay == EGL_NO_DISPLAY) + { + nlwarning("3D: failed to get display 0x%x", eglGetError()); + return false; + } + } + + // Initialize EGL + EGLint majorVersion; + EGLint minorVersion; + + if (!eglInitialize(_EglDisplay, &majorVersion, &minorVersion)) + { + return EGL_FALSE; + } + + const char *extensions = eglQueryString(_EglDisplay, EGL_EXTENSIONS); + + + // Get configs + EGLint numConfigs; + + if (!eglGetConfigs(_EglDisplay, NULL, 0, &numConfigs)) + { + return false; + } + + // Choose config + EGLConfig config = NULL; + + if (!eglChooseConfig(_EglDisplay, attribList, &config, 1, &numConfigs)) + { + return false; + } + + // Create a surface + _EglSurface = eglCreateWindowSurface(_EglDisplay, config, (EGLNativeWindowType)_win, NULL); + + if (_EglSurface == EGL_NO_SURFACE) + { + return false; + } + + // Create a GL context + EGLint contextAttribs[] = + { + EGL_CONTEXT_CLIENT_VERSION, 1, + EGL_NONE + }; + + _EglContext = eglCreateContext(_EglDisplay, config, EGL_NO_CONTEXT, contextAttribs); + + if (_EglContext == EGL_NO_CONTEXT) + { + return false; + } + + // Make the context current + if (!eglMakeCurrent(_EglDisplay, _EglSurface, _EglSurface, _EglContext)) + { + return false; + } +#elif defined(NL_OS_WINDOWS) + _hDC = GetDC(_win); + _CurrentMode.Depth = uint8(GetDeviceCaps(_hDC,BITSPIXEL)); + + wglMakeCurrent(_hDC,NULL); + // --- + memset(&_pfd,0,sizeof(_pfd)); + _pfd.nSize = sizeof(_pfd); + _pfd.nVersion = 1; + _pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; + _pfd.iPixelType = PFD_TYPE_RGBA; + _pfd.cColorBits = _CurrentMode.Depth; + // Choose best suited Depth Buffer. + if(_CurrentMode.Depth <= 16) + { + _pfd.cDepthBits = 16; + } + else + { + _pfd.cDepthBits = 24; + _pfd.cAlphaBits = 8; + _pfd.cStencilBits = 8; + } + _pfd.iLayerType = PFD_MAIN_PLANE; + int pf=ChoosePixelFormat(_hDC,&_pfd); + if (!pf) + { + return false; + } + + if ( !SetPixelFormat(_hDC,pf,&_pfd) ) + { + return false; + } + _hRC=wglCreateContext(_hDC); + + wglMakeCurrent(_hDC,_hRC); +#endif + + return true; +} + // -------------------------------------------------- bool CDriverGL::activate() { @@ -2374,7 +2526,20 @@ bool CDriverGL::activate() if (_win == EmptyWindow) return false; -#ifdef NL_OS_WINDOWS +#ifdef USE_OPENGLES + + EGLContext ctx = eglGetCurrentContext(); + + if (ctx != _EglContext) + { + // Make the context current + if (!eglMakeCurrent(_EglDisplay, _EglSurface, _EglSurface, _EglContext)) + { + return false; + } + } + +#elif defined(NL_OS_WINDOWS) HGLRC hglrc = wglGetCurrentContext(); @@ -2393,7 +2558,7 @@ bool CDriverGL::activate() if (nctx != NULL && nctx != _ctx) glXMakeCurrent(_dpy, _win, _ctx); -#endif // NL_OS_WINDOWS +#endif // USE_OPENGLES return true; } @@ -2860,4 +3025,8 @@ bool CDriverGL::convertBitmapToIcon(const NLMISC::CBitmap &bitmap, std::vector -namespace NL3D -{ - class CDriverGL; - NSApplicationTerminateReply applicationShouldTerminate(CDriverGL*); -} +#ifdef NL_STATIC +#ifdef USE_OPENGLES +using NL3D::NLDRIVERGLES::CDriverGL; +#else +using NL3D::NLDRIVERGL::CDriverGL; +#endif +#else +using NL3D::CDriverGL; +#endif @interface CocoaApplicationDelegate : NSObject #if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 #endif { - NL3D::CDriverGL* _driver; + CDriverGL* _driver; } --(id)initWithDriver:(NL3D::CDriverGL*)driver; +-(id)initWithDriver:(CDriverGL*)driver; -(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender; @end diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_application_delegate.mm b/code/nel/src/3d/driver/opengl/mac/cocoa_application_delegate.mm index 2a667d13b..8fe0045b6 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_application_delegate.mm +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_application_delegate.mm @@ -14,37 +14,35 @@ // 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" #include "cocoa_application_delegate.h" #include "cocoa_event_emitter.h" -namespace NL3D +static NSApplicationTerminateReply applicationShouldTerminate(CDriverGL* driver) { - NSApplicationTerminateReply applicationShouldTerminate(CDriverGL* driver) + // cancel if there is a driver and a custom exit handler set up + if(driver && driver->ExitFunc) { - // cancel if there is a driver and a custom exit handler set up - if(driver && driver->ExitFunc) - { - driver->ExitFunc(); - return NSTerminateCancel; - } - - NLMISC::CCocoaEventEmitter* eventEmitter = - NLMISC::safe_cast(&(driver->_EventEmitter)); - - // cancel if there is a driver and cocoa event emitter handles the quit - if(driver && eventEmitter && eventEmitter->handleQuitRequest()) - return NSTerminateCancel; - - // just let the app terminate if no custom quit handling worked - return NSTerminateNow; + driver->ExitFunc(); + return NSTerminateCancel; } + + NLMISC::CCocoaEventEmitter* eventEmitter = + NLMISC::safe_cast(&(driver->_EventEmitter)); + + // cancel if there is a driver and cocoa event emitter handles the quit + if(driver && eventEmitter && eventEmitter->handleQuitRequest()) + return NSTerminateCancel; + + // just let the app terminate if no custom quit handling worked + return NSTerminateNow; } @implementation CocoaApplicationDelegate --(id)initWithDriver:(NL3D::CDriverGL*)driver +-(id)initWithDriver:(CDriverGL*)driver { if((self = [super init])) { @@ -56,7 +54,7 @@ namespace NL3D -(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender { - return NL3D::applicationShouldTerminate(_driver); + return applicationShouldTerminate(_driver); } @end diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h index 8017433ec..e8acae926 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h @@ -18,21 +18,44 @@ namespace NL3D { + +#ifdef NL_STATIC +#ifdef USE_OPENGLES +namespace NLDRIVERGLES { +#else +namespace NLDRIVERGL { +#endif +#endif + class CDriverGL; - void viewDidResize(NSView*, CDriverGL*); + +#ifdef NL_STATIC +} // NLDRIVERGL/ES +#endif + } +#ifdef NL_STATIC +#ifdef USE_OPENGLES +using NL3D::NLDRIVERGLES::CDriverGL; +#else +using NL3D::NLDRIVERGL::CDriverGL; +#endif +#else +using NL3D::CDriverGL; +#endif + @interface CocoaOpenGLView : NSOpenGLView { NSMutableAttributedString* _characterStorage; NSRange _markedRange; - NL3D::CDriverGL* _driver; + CDriverGL* _driver; } -(id)initWithFrame:(NSRect)frame; -(void)dealloc; -(void)keyDown:(NSEvent*)event; --(void)setDriver:(NL3D::CDriverGL*)driver; +-(void)setDriver:(CDriverGL*)driver; -(void)resizeWithOldSuperviewSize:(NSSize)oldBoundsSize; @end diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m index 8ad1f91d4..17500389c 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m @@ -14,21 +14,18 @@ // 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" #import "cocoa_opengl_view.h" -namespace NL3D +static void viewDidResize(NSView* view, CDriverGL* driver) { - void viewDidResize(NSView* view, CDriverGL* driver) - { - NSRect rect = [[view superview] frame]; - driver->_CurrentMode.Height = rect.size.height; - driver->_CurrentMode.Width = rect.size.width; - } + NSRect rect = [[view superview] frame]; + driver->_CurrentMode.Height = rect.size.height; + driver->_CurrentMode.Width = rect.size.width; } - @implementation CocoaOpenGLView -(id)initWithFrame:(NSRect)frame @@ -55,7 +52,7 @@ namespace NL3D #endif } --(void)setDriver:(NL3D::CDriverGL*)driver +-(void)setDriver:(CDriverGL*)driver { _driver = driver; } @@ -67,7 +64,7 @@ namespace NL3D if(!_driver) return; - NL3D::viewDidResize(self, _driver); + viewDidResize(self, _driver); } /******************************************************************************/ diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.h b/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.h index 4d3710b34..53078e95a 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.h @@ -17,21 +17,25 @@ #import #include "AvailabilityMacros.h" -namespace NL3D -{ - class CDriverGL; - void windowDidMove(NSWindow*, NL3D::CDriverGL*); -} +#ifdef NL_STATIC +#ifdef USE_OPENGLES +using NL3D::NLDRIVERGLES::CDriverGL; +#else +using NL3D::NLDRIVERGL::CDriverGL; +#endif +#else +using NL3D::CDriverGL; +#endif @interface CocoaWindowDelegate : NSObject #if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 #endif { - NL3D::CDriverGL* _driver; + CDriverGL* _driver; } -- (id)initWithDriver:(NL3D::CDriverGL*)driver; +- (id)initWithDriver:(CDriverGL*)driver; - (void)windowDidMove:(NSNotification*)notification; @end diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.mm b/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.mm index c90c4f25d..a2eb54a6b 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.mm +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.mm @@ -14,32 +14,30 @@ // 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" #import "cocoa_window_delegate.h" -namespace NL3D +static void windowDidMove(NSWindow* window, CDriverGL* driver) { - void windowDidMove(NSWindow* window, NL3D::CDriverGL* driver) - { - // get the rect (position, size) of the screen with menu bar - NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame]; + // get the rect (position, size) of the screen with menu bar + NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame]; - // get the rect (position, size) of the window - NSRect windowRect = [window frame]; + // get the rect (position, size) of the window + NSRect windowRect = [window frame]; - // set x in driver - driver->_WindowX = windowRect.origin.x; + // set x in driver + driver->_WindowX = windowRect.origin.x; - // map y from cocoa to NeL coordinates before setting in driver - driver->_WindowY = - screenRect.size.height - windowRect.size.height - windowRect.origin.y; - } + // map y from cocoa to NeL coordinates before setting in driver + driver->_WindowY = + screenRect.size.height - windowRect.size.height - windowRect.origin.y; } @implementation CocoaWindowDelegate --(id)initWithDriver:(NL3D::CDriverGL*)driver +-(id)initWithDriver:(CDriverGL*)driver { if((self = [super init])) { @@ -55,7 +53,7 @@ namespace NL3D if(!_driver) return; - NL3D::windowDidMove([notification object], _driver); + windowDidMove([notification object], _driver); } @end diff --git a/code/nel/src/3d/driver/opengl/stdopengl.h b/code/nel/src/3d/driver/opengl/stdopengl.h index f336b77c4..9e8be1104 100644 --- a/code/nel/src/3d/driver/opengl/stdopengl.h +++ b/code/nel/src/3d/driver/opengl/stdopengl.h @@ -32,6 +32,34 @@ #include #include +#ifdef NL_OS_WINDOWS +# define WIN32_LEAN_AND_MEAN +# define NOMINMAX +# include +# include +#endif + +#ifdef USE_OPENGLES +# include "GLES/gl.h" +# include "GLES/glext.h" +# include "EGL/egl.h" +# include "EGL/eglext.h" +#else +# ifdef NL_OS_WINDOWS +# include +# include "GL/wglext.h" +# elif defined(NL_OS_MAC) +# define GL_GLEXT_LEGACY +# include +# elif defined (NL_OS_UNIX) +# define GLX_GLXEXT_PROTOTYPES +# include +# include +# include "GL/glxext.h" +# endif +# include "GL/glext.h" +#endif + #include "nel/misc/common.h" #include "nel/misc/debug.h" diff --git a/code/nel/src/3d/driver/opengles/CMakeLists.txt b/code/nel/src/3d/driver/opengles/CMakeLists.txt new file mode 100644 index 000000000..949d91a32 --- /dev/null +++ b/code/nel/src/3d/driver/opengles/CMakeLists.txt @@ -0,0 +1,84 @@ +FIND_PACKAGE(OpenGLES REQUIRED) + +IF(NOT WIN32) + IF(APPLE) + FIND_LIBRARY(CARBON NAMES Carbon) + FIND_LIBRARY(COCOA NAMES Cocoa) + ELSE(APPLE) + FIND_PACKAGE(X11) + FIND_PACKAGE(XF86VidMode) + ENDIF(APPLE) +ENDIF(NOT WIN32) + +SET(SOURCE_DIR ${CMAKE_SOURCE_DIR}/nel/src/3d/driver/opengl) + +FILE(GLOB SRC ${SOURCE_DIR}/*.cpp ${SOURCE_DIR}/*.h ${SOURCE_DIR}/*.def) + +IF(APPLE) + FILE(GLOB MAC_SRC ${SOURCE_DIR}/mac/*.h ${SOURCE_DIR}/mac/*.m ${SOURCE_DIR}/mac/*.mm ${SOURCE_DIR}/mac/*.cpp) + SET(SRC ${SRC} ${MAC_SRC}) + SET_SOURCE_FILES_PROPERTIES(${SRC} PROPERTIES COMPILE_FLAGS "-x objective-c++") +ENDIF(APPLE) + +INCLUDE_DIRECTORIES(${SOURCE_DIR} ${OPENGLES_INCLUDE_DIR}) + +ADD_DEFINITIONS(-DUSE_OPENGLES) + +IF(WIN32) + SET(NLDRV_OGLES_LIB "nel_drv_opengles_win") +ELSE(WIN32) + SET(NLDRV_OGLES_LIB "nel_drv_opengles") +ENDIF(WIN32) + +NL_TARGET_DRIVER(${NLDRV_OGLES_LIB} ${SRC}) + +TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} nel3d nelmisc ${OPENGLES_LIBRARIES}) +NL_DEFAULT_PROPS(${NLDRV_OGLES_LIB} "NeL, Driver, Video: OpenGL ES") +NL_ADD_LIB_SUFFIX(${NLDRV_OGLES_LIB}) +NL_ADD_RUNTIME_FLAGS(${NLDRV_OGLES_LIB}) + +IF(WIN32) + INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR}) + TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY}) + ADD_DEFINITIONS(/DDRIVER_OPENGLES_EXPORTS) +ENDIF(WIN32) + +IF(APPLE) + TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${CARBON}) + TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${COCOA}) +ENDIF(APPLE) + +IF(UNIX AND NOT APPLE) + TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${X11_X11_LIB}) + IF(XF86VidMode_FOUND) + INCLUDE_DIRECTORIES(${XF86VidMode_INCLUDE_DIR}) + ADD_DEFINITIONS(${XF86VidMode_DEFINITIONS}) + TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${XF86VidMode_LIBRARY}) + ENDIF(XF86VidMode_FOUND) + IF(X11_Xrandr_FOUND) + INCLUDE_DIRECTORIES(${X11_Xrandr_INCLUDE_PATH}) + ADD_DEFINITIONS(-DHAVE_XRANDR) + TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${X11_Xrandr_LIB}) + ENDIF(X11_Xrandr_FOUND) + IF(X11_Xrender_FOUND) + INCLUDE_DIRECTORIES(${X11_Xrender_INCLUDE_PATH}) + ADD_DEFINITIONS(-DHAVE_XRENDER) + TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${X11_Xrender_LIB}) + ENDIF(X11_Xrender_FOUND) + IF(X11_Xcursor_FOUND) + INCLUDE_DIRECTORIES(${X11_Xcursor_INCLUDE_PATH}) + ADD_DEFINITIONS(-DHAVE_XCURSOR) + TARGET_LINK_LIBRARIES(${NLDRV_OGLES_LIB} ${X11_Xcursor_LIB}) + ENDIF(X11_Xcursor_FOUND) +ENDIF(UNIX AND NOT APPLE) + +IF(WITH_PCH) + ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGLES_LIB} ${SOURCE_DIR}/stdopengl.h ${SOURCE_DIR}/stdopengl.cpp) +ENDIF(WITH_PCH) + +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) + INSTALL(TARGETS ${NLDRV_OGLES_LIB} LIBRARY DESTINATION ${NL_DRIVER_PREFIX} ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d) + IF(WITH_MAXPLUGIN) + INSTALL(TARGETS ${NLDRV_OGLES_LIB} RUNTIME DESTINATION maxplugin COMPONENT drivers3d) + ENDIF(WITH_MAXPLUGIN) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC_DRIVERS) OR NOT WITH_STATIC_DRIVERS) diff --git a/code/nel/src/3d/driver_user.cpp b/code/nel/src/3d/driver_user.cpp index 118e02141..102065bb1 100644 --- a/code/nel/src/3d/driver_user.cpp +++ b/code/nel/src/3d/driver_user.cpp @@ -69,25 +69,29 @@ UDriver::~UDriver() purgeMemory(); } - // *************************************************************************** void UDriver::setMatrixMode2D11() { setMatrixMode2D(CFrustum(0.0f,1.0f,0.0f,1.0f,-1.0f,1.0f,false)); } + // *************************************************************************** void UDriver::setMatrixMode2D43() { setMatrixMode2D(CFrustum(0.0f,4.0f/3.0f,0.0f,1.0f,-1.0f,1.0f,false)); } - // *************************************************************************** UDriver *UDriver::createDriver(uint windowIcon, bool direct3d, emptyProc exitFunc) { - return new CDriverUser (windowIcon, direct3d, exitFunc); + return new CDriverUser (windowIcon, direct3d ? CDriverUser::Direct3d:CDriverUser::OpenGl, exitFunc); } +// *************************************************************************** +UDriver *UDriver::createDriver(uint windowIcon, TDriver driver, emptyProc exitFunc) +{ + return new CDriverUser (windowIcon, (CDriverUser::TDriver)driver, exitFunc); +} // *************************************************************************** void UDriver::purgeMemory() @@ -110,9 +114,8 @@ bool CDriverUser::_StaticInit= false; // *************************************************************************** -CDriverUser::CDriverUser (uint windowIcon, bool direct3d, emptyProc exitFunc) +CDriverUser::CDriverUser (uint windowIcon, TDriver driver, emptyProc exitFunc) { - // The enum of IDriver and UDriver MUST be the same!!! nlassert((uint)IDriver::idCount == (uint)UDriver::idCount); nlassert((uint)IDriver::typeCount == (uint)UDriver::typeCount); @@ -134,13 +137,16 @@ CDriverUser::CDriverUser (uint windowIcon, bool direct3d, emptyProc exitFunc) // Create/Init Driver. #if defined(NL_OS_WINDOWS) - if (direct3d) + if (driver == Direct3d) _Driver= CDRU::createD3DDriver(); #endif - if (!_Driver) + if (!_Driver && driver == OpenGl) _Driver= CDRU::createGlDriver(); + if (!_Driver && driver == OpenGlEs) + _Driver= CDRU::createGlEsDriver(); + nlassert(_Driver); _Driver->init (windowIcon, exitFunc); diff --git a/code/nel/src/3d/dru.cpp b/code/nel/src/3d/dru.cpp index 6300dd698..4fd61d75d 100644 --- a/code/nel/src/3d/dru.cpp +++ b/code/nel/src/3d/dru.cpp @@ -64,6 +64,10 @@ extern IDriver* createGlDriverInstance (); extern IDriver* createD3DDriverInstance (); #endif +#ifdef NL_OPENGLES_AVAILABLE +extern IDriver* createGlEsDriverInstance (); +#endif + #endif // *************************************************************************** @@ -82,36 +86,25 @@ IDriver *CDRU::createGlDriver() throw (EDru) IDRV_CREATE_PROC createDriver = NULL; IDRV_VERSION_PROC versionDriver = NULL; -//#ifdef NL_OS_WINDOWS - - // WINDOWS code. -// HINSTANCE hInst; - -// hInst=LoadLibrary(NL3D_GL_DLL_NAME); CLibrary driverLib; #if defined(NL_OS_UNIX) && defined(NL_DRIVER_PREFIX) driverLib.addLibPath(NL_DRIVER_PREFIX); #endif -// if (!hInst) if (!driverLib.loadLibrary(NL3D_GL_DLL_NAME, true, true, false)) { throw EDruOpenglDriverNotFound(); } -// char buffer[1024], *ptr; -// SearchPath (NULL, NL3D_GL_DLL_NAME, NULL, 1023, buffer, &ptr); nlinfo ("Using the library '"NL3D_GL_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str()); -// createDriver = (IDRV_CREATE_PROC) GetProcAddress (hInst, IDRV_CREATE_PROC_NAME); createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME); if (createDriver == NULL) { throw EDruOpenglDriverCorrupted(); } -// versionDriver = (IDRV_VERSION_PROC) GetProcAddress (hInst, IDRV_VERSION_PROC_NAME); versionDriver = (IDRV_VERSION_PROC) driverLib.getSymbolAddress(IDRV_VERSION_PROC_NAME); if (versionDriver != NULL) { @@ -121,44 +114,67 @@ IDriver *CDRU::createGlDriver() throw (EDru) throw EDruOpenglDriverUnknownVersion(); } -//#elif defined (NL_OS_UNIX) -// -// void *handle = dlopen(NL3D_GL_DLL_NAME, RTLD_NOW); -// -// if (handle == NULL) -// { -// nlwarning ("when loading dynamic library '%s': %s", NL3D_GL_DLL_NAME, dlerror()); -// throw EDruOpenglDriverNotFound(); -// } -// -// /* Not ANSI. Might produce a warning */ -// createDriver = (IDRV_CREATE_PROC) dlsym (handle, IDRV_CREATE_PROC_NAME); -// if (createDriver == NULL) -// { -// nlwarning ("when getting function in dynamic library '%s': %s", NL3D_GL_DLL_NAME, dlerror()); -// throw EDruOpenglDriverCorrupted(); -// } -// -// versionDriver = (IDRV_VERSION_PROC) dlsym (handle, IDRV_VERSION_PROC_NAME); -// if (versionDriver != NULL) -// { -// if (versionDriver()IDriver::InterfaceVersion) -// throw EDruOpenglDriverUnknownVersion(); -// } -// -//#else // NL_OS_UNIX -//#error "Dynamic DLL loading not implemented!" -//#endif // NL_OS_UNIX - IDriver *ret= createDriver(); if (ret == NULL) { throw EDruOpenglDriverCantCreateDriver(); } + return ret; +#endif +} + +// *************************************************************************** +IDriver *CDRU::createGlEsDriver() throw (EDru) +{ +#ifdef NL_STATIC + +#ifdef NL_OPENGLES_AVAILABLE + return createGlEsDriverInstance (); +#else + return NULL; +#endif // NL_OPENGLES_AVAILABLE + +#else + + IDRV_CREATE_PROC createDriver = NULL; + IDRV_VERSION_PROC versionDriver = NULL; + + CLibrary driverLib; + +#if defined(NL_OS_UNIX) && defined(NL_DRIVER_PREFIX) + driverLib.addLibPath(NL_DRIVER_PREFIX); +#endif + + if (!driverLib.loadLibrary(NL3D_GLES_DLL_NAME, true, true, false)) + { + throw EDruOpenglEsDriverNotFound(); + } + + nlinfo ("Using the library '"NL3D_GLES_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str()); + + createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME); + if (createDriver == NULL) + { + throw EDruOpenglDriverCorrupted(); + } + + versionDriver = (IDRV_VERSION_PROC) driverLib.getSymbolAddress(IDRV_VERSION_PROC_NAME); + if (versionDriver != NULL) + { + if (versionDriver()IDriver::InterfaceVersion) + throw EDruOpenglDriverUnknownVersion(); + } + IDriver *ret= createDriver(); + if (ret == NULL) + { + throw EDruOpenglEsDriverCantCreateDriver(); + } + + return ret; #endif } @@ -181,31 +197,21 @@ IDriver *CDRU::createD3DDriver() throw (EDru) IDRV_CREATE_PROC createDriver = NULL; IDRV_VERSION_PROC versionDriver = NULL; - // WINDOWS code. -// HINSTANCE hInst; - -// hInst=LoadLibrary(NL3D_D3D_DLL_NAME); - CLibrary driverLib; -// if (!hInst) if (!driverLib.loadLibrary(NL3D_D3D_DLL_NAME, true, true, false)) { throw EDruDirect3dDriverNotFound(); } -// char buffer[1024], *ptr; -// SearchPath (NULL, NL3D_D3D_DLL_NAME, NULL, 1023, buffer, &ptr); nlinfo ("Using the library '"NL3D_D3D_DLL_NAME"' that is in the directory: '%s'", driverLib.getLibFileName().c_str()); -// createDriver = (IDRV_CREATE_PROC) GetProcAddress (hInst, IDRV_CREATE_PROC_NAME); createDriver = (IDRV_CREATE_PROC) driverLib.getSymbolAddress(IDRV_CREATE_PROC_NAME); if (createDriver == NULL) { throw EDruDirect3dDriverCorrupted(); } -// versionDriver = (IDRV_VERSION_PROC) GetProcAddress (hInst, IDRV_VERSION_PROC_NAME); versionDriver = (IDRV_VERSION_PROC) driverLib.getSymbolAddress(IDRV_VERSION_PROC_NAME); if (versionDriver != NULL) { @@ -220,8 +226,8 @@ IDriver *CDRU::createD3DDriver() throw (EDru) { throw EDruDirect3dDriverCantCreateDriver(); } - return ret; + return ret; #endif } #endif // NL_OS_WINDOWS diff --git a/code/nel/src/3d/patch_lightmap.cpp b/code/nel/src/3d/patch_lightmap.cpp index bd3886a71..8b91632d4 100644 --- a/code/nel/src/3d/patch_lightmap.cpp +++ b/code/nel/src/3d/patch_lightmap.cpp @@ -618,7 +618,7 @@ void CPatch::computeTileLightmapPixelAutomatic(uint ts, uint tt, uint s, uint t c= max(c, 0.f); sint ic; -#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) +#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) && defined(NL_USE_FASTFLOOR) // FastFloor using fistp. Don't care convention. float fc= c*256; _asm diff --git a/code/nel/src/3d/patch_noise.cpp b/code/nel/src/3d/patch_noise.cpp index 386fe98bd..6772c27b5 100644 --- a/code/nel/src/3d/patch_noise.cpp +++ b/code/nel/src/3d/patch_noise.cpp @@ -37,14 +37,14 @@ namespace NL3D // *************************************************************************** -#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) +#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) && defined(NL_USE_FASTFLOOR) /* This floor works only for floor with noise, because floor/ceil are only made on decimal coordinates: sTile =1.25 .... NB: because of difference of mapping (rare case), we may have sometimes values with precision < 1/4 (eg 1.125). Just use f*256 to compute the floor. NB: using a fastFloor() (fistp changing the controlfp() is not very a good idea here, because - computeNoise() are not "packed", so change on controlFp() would bee to frequent... + computeNoise() are not "packed", so change on controlFp() would bee too frequent... And also because we need either floor() or ceil() here. */ inline sint noiseFloor(float f) diff --git a/code/nel/src/misc/bit_mem_stream.cpp b/code/nel/src/misc/bit_mem_stream.cpp index c050d9c61..007b95cbc 100644 --- a/code/nel/src/misc/bit_mem_stream.cpp +++ b/code/nel/src/misc/bit_mem_stream.cpp @@ -599,7 +599,7 @@ void CBitMemStream::append( const CBitMemStream& newBits ) /* * Serial bitmemstream */ -void CBitMemStream::serialMemStream(CBitMemStream &b) +void CBitMemStream::serialMemStream(CMemStream &b) { #ifdef LOG_ALL_TRAFFIC sint32 bitpos = getPosInBit(); diff --git a/code/nel/src/misc/bitmap.cpp b/code/nel/src/misc/bitmap.cpp index 90afc460c..46076d413 100644 --- a/code/nel/src/misc/bitmap.cpp +++ b/code/nel/src/misc/bitmap.cpp @@ -3731,7 +3731,7 @@ void CBitmap::blend(CBitmap &Bm0, CBitmap &Bm1, uint16 factor, bool inputBitmapI { // On a P4 2GHz, with a 256x256 texture, I got the following results : // without mmx : 5.2 ms - // with mmx : 1.7 ms + // with mmx : 1.7 ms // I'm sure this can be further optimized.. uint numPixLeft = numPix & 1; // process 2 pixels at once, so special case for odd number diff --git a/code/nel/src/misc/bitmap_jpeg.cpp b/code/nel/src/misc/bitmap_jpeg.cpp index 835110d86..a4eaaa0b9 100644 --- a/code/nel/src/misc/bitmap_jpeg.cpp +++ b/code/nel/src/misc/bitmap_jpeg.cpp @@ -109,7 +109,7 @@ static void jpgDecompressSkip(j_decompress_ptr cinfo, long num_bytes) } } -static void jpgDecompressTerm(j_decompress_ptr cinfo) +static void jpgDecompressTerm(j_decompress_ptr /* cinfo */) { } diff --git a/code/nel/src/misc/co_task.cpp b/code/nel/src/misc/co_task.cpp index 1880be06c..c66941a40 100644 --- a/code/nel/src/misc/co_task.cpp +++ b/code/nel/src/misc/co_task.cpp @@ -237,12 +237,15 @@ namespace NLMISC _PImpl = new TCoTaskData(this); // _PImpl->_TaskThreadId = 0; // _PImpl->_ParentThreadId = 0; + nlunreferenced(stackSize); #else //NL_USE_THREAD_COTASK // allocate platform specific data storage _PImpl = new TCoTaskData; + nlunreferenced(stackSize); #if defined (NL_OS_WINDOWS) _PImpl->_Fiber = NULL; _PImpl->_ParentFiber = NULL; + nlunreferenced(stackSize); #elif defined(NL_OS_UNIX) // allocate the stack _PImpl->_Stack = new uint8[stackSize]; diff --git a/code/nel/src/misc/command.cpp b/code/nel/src/misc/command.cpp index 80d074386..f2b422d69 100644 --- a/code/nel/src/misc/command.cpp +++ b/code/nel/src/misc/command.cpp @@ -650,6 +650,9 @@ ICommand *CCommandRegistry::getCommand(const std::string &commandName) NLMISC_CATEGORISED_COMMAND(nel,help,"display help on a specific variable/commands or on all variables and commands", "[|]") { + nlunreferenced(rawCommandString); + nlunreferenced(quiet); + nlunreferenced(human); // nlassert (_Commands != NULL); // make sure we have a valid number of parameters diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 19be95367..d89708c4e 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -373,6 +373,10 @@ uint32 humanReadableToBytes (const string &str) NLMISC_CATEGORISED_COMMAND(nel,btohr, "Convert a bytes number into an human readable number", "") { + nlunreferenced(rawCommandString); + nlunreferenced(quiet); + nlunreferenced(human); + if (args.size() != 1) return false; @@ -384,6 +388,10 @@ NLMISC_CATEGORISED_COMMAND(nel,btohr, "Convert a bytes number into an human read NLMISC_CATEGORISED_COMMAND(nel,hrtob, "Convert a human readable number into a bytes number", "
") { + nlunreferenced(rawCommandString); + nlunreferenced(quiet); + nlunreferenced(human); + if (args.size() != 1) return false; @@ -446,6 +454,10 @@ uint32 fromHumanReadable (const std::string &str) NLMISC_CATEGORISED_COMMAND(nel,stohr, "Convert a second number into an human readable time", "") { + nlunreferenced(rawCommandString); + nlunreferenced(quiet); + nlunreferenced(human); + if (args.size() != 1) return false; @@ -529,8 +541,8 @@ void toUpper(char *str) std::string formatThousands(const std::string& s) { - int i, k; - int remaining = s.length() - 1; + sint i, k; + sint remaining = (sint)s.length() - 1; static std::string separator = NLMISC::CI18N::get("uiThousandsSeparator").toUtf8(); // Don't add separator if the number is < 10k @@ -540,7 +552,7 @@ std::string formatThousands(const std::string& s) do { - for (i = remaining, k = 0; i >= 0 && k < 3; --i, ++k ) + for (i = remaining, k = 0; i >= 0 && k < 3; --i, ++k ) { ns = s[i] + ns; // New char is added to front of ns if ( i > 0 && k == 2) ns = separator + ns; // j > 0 means still more digits @@ -829,6 +841,7 @@ int nlfseek64( FILE *stream, sint64 offset, int origin ) return fsetpos (stream, &pos64); #else // NL_OS_WINDOWS + // TODO: to fix for Linux and Mac OS X // This code doesn't work under windows : fseek() implementation uses a signed 32 bits offset. What ever we do, it can't seek more than 2 Go. // For the moment, i don't know if it works under linux for seek of more than 2 Go. @@ -871,6 +884,9 @@ sint64 nlftell64(FILE *stream) } else return -1; #else + nlunreferenced(stream); + + // TODO: implement for Linux and Mac OS X nlerror("Not implemented"); return -1; #endif @@ -885,9 +901,14 @@ sint64 nlftell64(FILE *stream) NLMISC_CATEGORISED_COMMAND(nel, sleep, "Freeze the service for N seconds (for debug purpose)", "") { + nlunreferenced(rawCommandString); + nlunreferenced(quiet); + nlunreferenced(human); + if(args.size() != 1) return false; - sint32 n = atoi (args[0].c_str()); + sint32 n; + fromString(args[0], n); log.displayNL ("Sleeping during %d seconds", n); @@ -897,6 +918,10 @@ NLMISC_CATEGORISED_COMMAND(nel, sleep, "Freeze the service for N seconds (for de NLMISC_CATEGORISED_COMMAND(nel, system, "Execute the command line using system() function call (wait until the end of the command)", "") { + nlunreferenced(rawCommandString); + nlunreferenced(quiet); + nlunreferenced(human); + if(args.size() != 1) return false; string cmd = args[0]; @@ -915,6 +940,10 @@ NLMISC_CATEGORISED_COMMAND(nel, system, "Execute the command line using system() NLMISC_CATEGORISED_COMMAND(nel, launchProgram, "Execute the command line using launcProgram() function call (launch in background task without waiting the end of the execution)", " ") { + nlunreferenced(rawCommandString); + nlunreferenced(quiet); + nlunreferenced(human); + if(args.size() != 2) return false; string cmd = args[0]; @@ -927,6 +956,10 @@ NLMISC_CATEGORISED_COMMAND(nel, launchProgram, "Execute the command line using l NLMISC_CATEGORISED_COMMAND(nel, killProgram, "kill a program given the pid", "") { + nlunreferenced(rawCommandString); + nlunreferenced(quiet); + nlunreferenced(human); + if(args.size() != 1) return false; uint32 pid; fromString(args[0], pid); @@ -1030,6 +1063,9 @@ bool openDoc (const char *document) } else return true; +#else + // TODO: implement for Linux and Mac OS X + nlunreferenced(document); #endif // NL_OS_WINDOWS return false; } diff --git a/code/nel/src/misc/fast_floor.cpp b/code/nel/src/misc/fast_floor.cpp index 0c0aa9e02..fbbb1adac 100644 --- a/code/nel/src/misc/fast_floor.cpp +++ b/code/nel/src/misc/fast_floor.cpp @@ -24,7 +24,7 @@ int OptFastFloorCWStack[OptFastFloorCWStackSize]; int *OptFastFloorCWStackEnd = OptFastFloorCWStack + OptFastFloorCWStackSize; int *OptFastFloorCWStackPtr = OptFastFloorCWStack; -#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) +#if defined(NL_OS_WINDOWS) && !defined(NL_NO_ASM) && defined(NL_USE_FASTFLOOR) double OptFastFloorMagicConst = pow(2.0,52) + pow(2.0,51); float OptFastFloorMagicConst24 = (float)pow(2.0,23); diff --git a/code/nel/src/misc/fast_id_map.cpp b/code/nel/src/misc/fast_id_map.cpp new file mode 100644 index 000000000..f32d6edd8 --- /dev/null +++ b/code/nel/src/misc/fast_id_map.cpp @@ -0,0 +1,44 @@ +/** + * \file fast_id_map.cpp + * \brief CFastIdMap + * \date 2012-04-10 19:28GMT + * \author Jan Boon (Kaetemi) + * CFastIdMap + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#include +#include + +// STL includes + +// NeL includes +// #include + +// Project includes + +namespace NLMISC { + +void dummytoavoidthecompilerwarningfastidmap() { } + +} /* namespace NLMISC */ + +/* end of file */ diff --git a/code/nel/src/misc/log.cpp b/code/nel/src/misc/log.cpp index 6f4fa2464..24fded0cb 100644 --- a/code/nel/src/misc/log.cpp +++ b/code/nel/src/misc/log.cpp @@ -90,7 +90,7 @@ void CLog::setPosition (sint line, const char *fileName, const char *funcName) _Mutex.enter(); _PosSet++; _FileName = fileName; - _Line = line; + _Line = line; _FuncName = funcName; } } diff --git a/code/nel/src/misc/noise_value.cpp b/code/nel/src/misc/noise_value.cpp index 4b7cade1f..89b9a8ad4 100644 --- a/code/nel/src/misc/noise_value.cpp +++ b/code/nel/src/misc/noise_value.cpp @@ -18,7 +18,7 @@ #include "nel/misc/noise_value.h" #include "nel/misc/fast_floor.h" -#include "nel/misc/random.h" + namespace NLMISC @@ -45,8 +45,7 @@ public: CRandomGrid3D() { //seed - CRandom Random; - Random.srand(0); + srand(0); // init the grid for(uint z=0; z> 5; + uint v= rand() >> 5; _Texture3d[id]= v&255; } } @@ -81,9 +80,9 @@ public: // init LevelPhases. for(i=0; iRunnable->run(); + { + pthread_t thread_self = pthread_self(); + // Make sure the parent still cares + // If this thread was replaced with a new thread (which should not happen), + // and the IThread object has been deleted, this will likely crash. + if (parent->_ThreadHandle == thread_self) + parent->_State = CPThread::ThreadStateFinished; + else + throw EThread("Thread ended after being detached, this should not happen"); + } + // Allow some clean // pthread_exit(0); return NULL; @@ -96,7 +107,7 @@ static void *ProxyFunc( void *arg ) */ CPThread::CPThread(IRunnable *runnable, uint32 stackSize) : Runnable(runnable), - _State(0), + _State(ThreadStateNone), _StackSize(stackSize) {} @@ -106,10 +117,9 @@ CPThread::CPThread(IRunnable *runnable, uint32 stackSize) */ CPThread::~CPThread() { - if(_State == 1) - terminate(); // force the end of the thread if not already ended + terminate(); // force the end of the thread if not already ended - if(_State > 0) + if (_State != ThreadStateNone) pthread_detach(_ThreadHandle); // free allocated resources only if it was created } @@ -119,26 +129,51 @@ CPThread::~CPThread() void CPThread::start() { pthread_attr_t tattr; - pthread_t tid; int ret; - /* initialized with default attributes */ - ret = pthread_attr_init(&tattr); + if (_StackSize != 0) + { + /* initialized with default attributes */ + ret = pthread_attr_init(&tattr); - /* setting the size of the stack also */ - ret = pthread_attr_setstacksize(&tattr, _StackSize); + /* setting the size of the stack also */ + ret = pthread_attr_setstacksize(&tattr, _StackSize); + } + + bool detach_old_thread = false; + pthread_t old_thread_handle; + if (_State != ThreadStateNone) + { + if (_State == ThreadStateRunning) + { + // I don't know if this behaviour is allowed, but neither thread implementations + // check the start function, and both simply let the existing running thread for what it is... + // From now on, this is not allowed. + throw EThread("Starting a thread that is already started, existing thread will continue running, this should not happen"); + } + detach_old_thread = true; + old_thread_handle = _ThreadHandle; + } - if(pthread_create(&_ThreadHandle, _StackSize != 0 ? &tattr : 0, ProxyFunc, this) != 0) + if (pthread_create(&_ThreadHandle, _StackSize != 0 ? &tattr : NULL, ProxyFunc, this) != 0) { throw EThread("Cannot start new thread"); } - _State = 1; + _State = ThreadStateRunning; + + if (detach_old_thread) + { + // Docs don't say anything about what happens when pthread_create is called with existing handle referenced. + if (old_thread_handle == _ThreadHandle) + throw EThread("Thread handle did not change, this should not happen"); + // Don't care about old thread, free resources when it terminates. + pthread_detach(old_thread_handle); + } } bool CPThread::isRunning() { - // TODO : need a real implementation here that check thread status - return _State == 1; + return _State == ThreadStateRunning; } /* @@ -146,11 +181,11 @@ bool CPThread::isRunning() */ void CPThread::terminate() { - if(_State == 1) + if (_State == ThreadStateRunning) { // cancel only if started pthread_cancel(_ThreadHandle); - _State = 2; // set to finished + _State = ThreadStateFinished; // set to finished } } @@ -159,13 +194,24 @@ void CPThread::terminate() */ void CPThread::wait () { - if(_State == 1) + if (_State == ThreadStateRunning) { - if(pthread_join(_ThreadHandle, 0) != 0) + int error = pthread_join(_ThreadHandle, 0); + switch (error) { - throw EThread( "Cannot join with thread" ); + case 0: + break; + case EINVAL: + throw EThread("Thread is not joinable"); + case ESRCH: + throw EThread("No thread found with this id"); + case EDEADLK: + throw EThread("Deadlock detected or calling thread waits for itself"); + default: + throw EThread("Unknown thread join error"); } - _State = 2; // set to finished + if(_State != ThreadStateFinished) + throw EThread("Thread did not finish, this should not happen"); } } @@ -207,6 +253,34 @@ uint64 CPThread::getCPUMask() return cpuMask; } +void CPThread::setPriority(TThreadPriority priority) +{ + // TODO: Test this + sched_param sp; + switch (priority) + { + case ThreadPriorityHigh: + { + int minPrio = sched_get_priority_min(SCHED_FIFO); + int maxPrio = sched_get_priority_max(SCHED_FIFO); + sp.sched_priority = ((maxPrio - minPrio) / 4) + minPrio; + pthread_setschedparam(_ThreadHandle, SCHED_FIFO, &sp); + break; + } + case ThreadPriorityHighest: + { + int minPrio = sched_get_priority_min(SCHED_FIFO); + int maxPrio = sched_get_priority_max(SCHED_FIFO); + sp.sched_priority = ((maxPrio - minPrio) / 2) + minPrio; + pthread_setschedparam(_ThreadHandle, SCHED_FIFO, &sp); + break; + } + default: + sp.sched_priority = 0; + pthread_setschedparam(_ThreadHandle, SCHED_OTHER, &sp); + } +} + /* * getUserName */ diff --git a/code/nel/src/misc/sheet_id.cpp b/code/nel/src/misc/sheet_id.cpp index 0eaad3a7a..617c994b7 100644 --- a/code/nel/src/misc/sheet_id.cpp +++ b/code/nel/src/misc/sheet_id.cpp @@ -592,7 +592,7 @@ uint32 CSheetId::typeFromFileExtension(const std::string &fileExtension) { if (!_Initialised) init(false); - unsigned i; + uint i; for (i=0;i<_FileExtensions.size();i++) if (toLower(fileExtension)==_FileExtensions[i]) return i; diff --git a/code/nel/src/misc/sstring.cpp b/code/nel/src/misc/sstring.cpp index 4c37b1f1a..ef1584361 100644 --- a/code/nel/src/misc/sstring.cpp +++ b/code/nel/src/misc/sstring.cpp @@ -37,14 +37,14 @@ namespace NLMISC return token; } - unsigned int i; + uint i; CSString result; // skip leading junk for (i=0;i #include #endif diff --git a/code/nel/src/misc/win_thread.cpp b/code/nel/src/misc/win_thread.cpp index 4192e927b..c9bfc90a1 100644 --- a/code/nel/src/misc/win_thread.cpp +++ b/code/nel/src/misc/win_thread.cpp @@ -73,6 +73,20 @@ CWinThread::CWinThread (IRunnable *runnable, uint32 stackSize) _MainThread = false; } +namespace { +class CWinCriticalSection +{ +private: + CRITICAL_SECTION cs; +public: + CWinCriticalSection() { InitializeCriticalSection(&cs); } + ~CWinCriticalSection() { DeleteCriticalSection(&cs); } + inline void enter() { EnterCriticalSection(&cs); } + inline void leave() { LeaveCriticalSection(&cs); } +}; +CWinCriticalSection s_CS; +}/* anonymous namespace */ + CWinThread::CWinThread (void* threadHandle, uint32 threadId) { // Main thread @@ -99,14 +113,11 @@ CWinThread::CWinThread (void* threadHandle, uint32 threadId) nlassert(0); // WARNING: following code has not tested! don't know if it work fo real ... // This is just a suggestion of a possible solution, should this situation one day occur ... // Ensure that this thread don't get deleted, or we could suspend the main thread - CRITICAL_SECTION cs; - InitializeCriticalSection(&cs); - EnterCriticalSection(&cs); + s_CS.enter(); // the 2 following statement must be executed atomicaly among the threads of the current process ! SuspendThread(threadHandle); _SuspendCount = ResumeThread(threadHandle); - LeaveCriticalSection(&cs); - DeleteCriticalSection(&cs); + s_CS.leave(); } } @@ -148,10 +159,10 @@ void CWinThread::resume() } } -void CWinThread::setPriority(int priority) +void CWinThread::setPriority(TThreadPriority priority) { nlassert(ThreadHandle); // 'start' was not called !! - BOOL result = SetThreadPriority(ThreadHandle, priority); + BOOL result = SetThreadPriority(ThreadHandle, (int)priority); nlassert(result); } @@ -179,6 +190,9 @@ CWinThread::~CWinThread () void CWinThread::start () { + if (isRunning()) + throw EThread("Starting a thread that is already started, existing thread will continue running, this should not happen"); + // ThreadHandle = (void *) ::CreateThread (NULL, _StackSize, ProxyFunc, this, 0, (DWORD *)&ThreadId); ThreadHandle = (void *) ::CreateThread (NULL, 0, ProxyFunc, this, 0, (DWORD *)&ThreadId); // nldebug("NLMISC: thread %x started for runnable '%x'", typeid( Runnable ).name()); diff --git a/code/nel/src/sound/CMakeLists.txt b/code/nel/src/sound/CMakeLists.txt index 21c1de1f8..e73d0828e 100644 --- a/code/nel/src/sound/CMakeLists.txt +++ b/code/nel/src/sound/CMakeLists.txt @@ -1,8 +1,101 @@ + FILE(GLOB SRC *.cpp *.h) FILE(GLOB HEADERS ../../include/nel/sound/*.h) + +FILE(GLOB ANIMATION + sound_anim_manager.cpp ../../include/nel/sound/sound_anim_manager.h + sound_anim_marker.cpp ../../include/nel/sound/sound_anim_marker.h + sound_animation.cpp ../../include/nel/sound/sound_animation.h +) + +FILE(GLOB BACKGROUND_SOUND + background_sound.cpp ../../include/nel/sound/background_sound.h + background_sound_manager.cpp ../../include/nel/sound/background_sound_manager.h + background_source.cpp ../../include/nel/sound/background_source.h + clustered_sound.cpp ../../include/nel/sound/clustered_sound.h + context_sound.cpp ../../include/nel/sound/context_sound.h +) + +FILE(GLOB BANKS + async_file_manager_sound.cpp ../../include/nel/sound/async_file_manager_sound.h + sample_bank.cpp ../../include/nel/sound/sample_bank.h + sample_bank_manager.cpp ../../include/nel/sound/sample_bank_manager.h + sound_bank.cpp ../../include/nel/sound/sound_bank.h +) + +FILE(GLOB MIXER + audio_mixer_user.cpp ../../include/nel/sound/audio_mixer_user.h + ../../include/nel/sound/containers.h + group_controller.cpp ../../include/nel/sound/group_controller.h + group_controller_root.cpp ../../include/nel/sound/group_controller_root.h + listener_user.cpp ../../include/nel/sound/listener_user.h + mixing_track.cpp ../../include/nel/sound/mixing_track.h +) + +FILE(GLOB MUSIC + music_channel_fader.cpp ../../include/nel/sound/music_channel_fader.h + music_sound.cpp ../../include/nel/sound/music_sound.h + music_sound_manager.cpp ../../include/nel/sound/music_sound_manager.h + music_source.cpp ../../include/nel/sound/music_source.h + source_music_channel.cpp ../../include/nel/sound/source_music_channel.h +) + +FILE(GLOB SOUND + complex_sound.cpp ../../include/nel/sound/complex_sound.h + complex_source.cpp ../../include/nel/sound/complex_source.h + simple_sound.cpp ../../include/nel/sound/simple_sound.h + simple_source.cpp ../../include/nel/sound/simple_source.h + sound.cpp ../../include/nel/sound/sound.h + ../../include/nel/sound/sound_pattern.h + source_common.cpp ../../include/nel/sound/source_common.h +) + +FILE(GLOB STREAM + stream_sound.cpp ../../include/nel/sound/stream_sound.h + stream_source.cpp ../../include/nel/sound/stream_source.h +) + +FILE(GLOB STREAM_FILE + audio_decoder.cpp ../../include/nel/sound/audio_decoder.h + audio_decoder_vorbis.cpp ../../include/nel/sound/audio_decoder_vorbis.h + stream_file_sound.cpp ../../include/nel/sound/stream_file_sound.h + stream_file_source.cpp ../../include/nel/sound/stream_file_source.h +) + +FILE(GLOB USER_CLASSES + ../../include/nel/sound/u_audio_mixer.h + ../../include/nel/sound/u_group_controller.h + ../../include/nel/sound/u_listener.h + ../../include/nel/sound/u_source.h + ../../include/nel/sound/u_stream_source.h +) + +SOURCE_GROUP("" FILES ${SRC} ${HEADERS}) +SOURCE_GROUP("animation" FILES ${ANIMATION}) +SOURCE_GROUP("background_sound" FILES ${BACKGROUND_SOUND}) +SOURCE_GROUP("banks" FILES ${BANKS}) +SOURCE_GROUP("mixer" FILES ${MIXER}) +SOURCE_GROUP("music_deprecated" FILES ${MUSIC}) +SOURCE_GROUP("sound" FILES ${SOUND}) +SOURCE_GROUP("stream" FILES ${STREAM}) +SOURCE_GROUP("stream_file" FILES ${STREAM_FILE}) +SOURCE_GROUP("user_classes" FILES ${USER_CLASSES}) + + NL_TARGET_LIB(nelsound ${HEADERS} ${SRC}) + +INCLUDE_DIRECTORIES(${VORBIS_INCLUDE_DIR}) + +TARGET_LINK_LIBRARIES(nelsound ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY}) + +IF(WITH_STATIC) + # Add libogg dependency only if target is static because to libvorbisfile + TARGET_LINK_LIBRARIES(nelsound ${OGG_LIBRARY}) +ENDIF(WITH_STATIC) + + INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nelsound ${LIBXML2_LIBRARIES} nelmisc nelligo nelgeorges nel3d nelsnd_lowlevel) diff --git a/code/nel/src/sound/audio_decoder.cpp b/code/nel/src/sound/audio_decoder.cpp new file mode 100644 index 000000000..eef031417 --- /dev/null +++ b/code/nel/src/sound/audio_decoder.cpp @@ -0,0 +1,139 @@ +/** + * \file audio_decoder.cpp + * \brief IAudioDecoder + * \date 2012-04-11 09:34GMT + * \author Jan Boon (Kaetemi) + * IAudioDecoder + */ + +/* + * Copyright (C) 2008-2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#include "stdsound.h" +#include + +// STL includes + +// NeL includes +#include +#include + +// Project includes +#include + +using namespace std; +using namespace NLMISC; + +namespace NLSOUND { + +IAudioDecoder::IAudioDecoder() : _InternalStream(NULL) +{ + +} + +IAudioDecoder::~IAudioDecoder() +{ + if (_InternalStream) { delete _InternalStream; _InternalStream = NULL; } +} + +IAudioDecoder *IAudioDecoder::createAudioDecoder(const std::string &filepath, bool async, bool loop) +{ + std::string lookup = CPath::lookup(filepath, false); + if (lookup.empty()) + { + nlwarning("Music file %s does not exist!", filepath.c_str()); + return NULL; + } + std::string type = CFile::getExtension(filepath); + + CIFile *ifile = new CIFile(); + ifile->setCacheFileOnOpen(!async); + ifile->allowBNPCacheFileOnOpen(!async); + ifile->open(lookup); + + IAudioDecoder *mb = createAudioDecoder(type, ifile, loop); + + if (mb) mb->_InternalStream = ifile; + else delete ifile; + + return mb; +} + +IAudioDecoder *IAudioDecoder::createAudioDecoder(const std::string &type, NLMISC::IStream *stream, bool loop) +{ + if (!stream) + { + nlwarning("Stream is NULL"); + return NULL; + } + std::string type_lower = toLower(type); + if (type_lower == "ogg") + { + return new CAudioDecoderVorbis(stream, loop); + } + else + { + nlwarning("Music file type unknown: '%s'", type_lower.c_str()); + return NULL; + } +} + +bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, std::string &title) +{ + std::string lookup = CPath::lookup(filepath, false); + if (lookup.empty()) + { + nlwarning("Music file %s does not exist!", filepath.c_str()); + return false; + } + std::string type = CFile::getExtension(filepath); + std::string type_lower = NLMISC::toLower(type); + + if (type_lower == "ogg") + { + CIFile ifile; + ifile.setCacheFileOnOpen(false); + ifile.allowBNPCacheFileOnOpen(false); + ifile.open(lookup); + return CAudioDecoderVorbis::getInfo(&ifile, artist, title); + } + else + { + nlwarning("Music file type unknown: '%s'", type_lower.c_str()); + artist.clear(); title.clear(); + return false; + } +} + +/// Get audio/container extensions that are currently supported by the nel sound library. +void IAudioDecoder::getMusicExtensions(std::vector &extensions) +{ + extensions.push_back("ogg"); + // extensions.push_back("wav"); // TODO: Easy. +} + +/// Return if a music extension is supported by the nel sound library. +bool IAudioDecoder::isMusicExtensionSupported(const std::string &extension) +{ + return (extension == "ogg"); +} + +} /* namespace NLSOUND */ + +/* end of file */ diff --git a/code/nel/src/sound/driver/music_buffer_vorbis.cpp b/code/nel/src/sound/audio_decoder_vorbis.cpp similarity index 53% rename from code/nel/src/sound/driver/music_buffer_vorbis.cpp rename to code/nel/src/sound/audio_decoder_vorbis.cpp index 9d5543c62..e0b950fc4 100644 --- a/code/nel/src/sound/driver/music_buffer_vorbis.cpp +++ b/code/nel/src/sound/audio_decoder_vorbis.cpp @@ -1,38 +1,53 @@ -// 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 "stdsound_lowlevel.h" +/** + * \file audio_decoder_vorbis.cpp + * \brief CAudioDecoderVorbis + * \date 2012-04-11 09:35GMT + * \author Jan Boon (Kaetemi) + * CAudioDecoderVorbis + */ + +/* + * Copyright (C) 2008-2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#include "stdsound.h" +#include + +// STL includes + +// NeL includes +#include // Project includes -#include "nel/sound/driver/music_buffer_vorbis.h" using namespace std; using namespace NLMISC; -namespace NLSOUND -{ +namespace NLSOUND { size_t vorbisReadFunc(void *ptr, size_t size, size_t nmemb, void *datasource) { - CMusicBufferVorbis *music_buffer_vorbis = (CMusicBufferVorbis *)datasource; - NLMISC::IStream *stream = music_buffer_vorbis->getStream(); + CAudioDecoderVorbis *audio_decoder_vorbis = (CAudioDecoderVorbis *)datasource; + NLMISC::IStream *stream = audio_decoder_vorbis->getStream(); nlassert(stream->isReading()); sint32 length = (sint32)(size * nmemb); - if (length > music_buffer_vorbis->getStreamSize() - stream->getPos()) - length = music_buffer_vorbis->getStreamSize() - stream->getPos(); + if (length > audio_decoder_vorbis->getStreamSize() - stream->getPos()) + length = audio_decoder_vorbis->getStreamSize() - stream->getPos(); stream->serialBuffer((uint8 *)ptr, length); return length; } @@ -45,7 +60,7 @@ int vorbisSeekFunc(void *datasource, ogg_int64_t offset, int whence) return 0; // ooookkaaaaaayyy } - CMusicBufferVorbis *music_buffer_vorbis = (CMusicBufferVorbis *)datasource; + CAudioDecoderVorbis *audio_decoder_vorbis = (CAudioDecoderVorbis *)datasource; NLMISC::IStream::TSeekOrigin origin; switch (whence) @@ -64,19 +79,19 @@ int vorbisSeekFunc(void *datasource, ogg_int64_t offset, int whence) return -1; } - if (music_buffer_vorbis->getStream()->seek(SEEK_SET ? music_buffer_vorbis->getStreamOffset() + (sint32)offset : (sint32)offset, origin)) return 0; + if (audio_decoder_vorbis->getStream()->seek(SEEK_SET ? audio_decoder_vorbis->getStreamOffset() + (sint32)offset : (sint32)offset, origin)) return 0; else return -1; } //int vorbisCloseFunc(void *datasource) //{ -// //CMusicBufferVorbis *music_buffer_vorbis = (CMusicBufferVorbis *)datasource; +// //CAudioDecoderVorbis *audio_decoder_vorbis = (CAudioDecoderVorbis *)datasource; //} long vorbisTellFunc(void *datasource) { - CMusicBufferVorbis *music_buffer_vorbis = (CMusicBufferVorbis *)datasource; - return (long)(music_buffer_vorbis->getStream()->getPos() - music_buffer_vorbis->getStreamOffset()); + CAudioDecoderVorbis *audio_decoder_vorbis = (CAudioDecoderVorbis *)datasource; + return (long)(audio_decoder_vorbis->getStream()->getPos() - audio_decoder_vorbis->getStreamOffset()); } static ov_callbacks OV_CALLBACKS_NLMISC_STREAM = { @@ -86,8 +101,8 @@ static ov_callbacks OV_CALLBACKS_NLMISC_STREAM = { (long (*)(void *)) vorbisTellFunc }; -CMusicBufferVorbis::CMusicBufferVorbis(NLMISC::IStream *stream, bool loop) -: _Stream(stream), _Loop(loop), _IsMusicEnded(false) +CAudioDecoderVorbis::CAudioDecoderVorbis(NLMISC::IStream *stream, bool loop) +: _Stream(stream), _Loop(loop), _IsMusicEnded(false), _StreamSize(0) { _StreamOffset = stream->getPos(); stream->seek(0, NLMISC::IStream::end); @@ -96,15 +111,15 @@ CMusicBufferVorbis::CMusicBufferVorbis(NLMISC::IStream *stream, bool loop) ov_open_callbacks(this, &_OggVorbisFile, NULL, 0, OV_CALLBACKS_NLMISC_STREAM); } -CMusicBufferVorbis::~CMusicBufferVorbis() +CAudioDecoderVorbis::~CAudioDecoderVorbis() { ov_clear(&_OggVorbisFile); } /// Get information on a music file (only artist and title at the moment). -bool CMusicBufferVorbis::getInfo(NLMISC::IStream *stream, std::string &artist, std::string &title) +bool CAudioDecoderVorbis::getInfo(NLMISC::IStream *stream, std::string &artist, std::string &title) { - CMusicBufferVorbis mbv(stream, false); // just opens and closes the oggvorbisfile thing :) + CAudioDecoderVorbis mbv(stream, false); // just opens and closes the oggvorbisfile thing :) vorbis_comment *vc = ov_comment(&mbv._OggVorbisFile, -1); char *title_c = vorbis_comment_query(vc, "title", 0); if (title_c) title = title_c; else title.clear(); @@ -113,29 +128,27 @@ bool CMusicBufferVorbis::getInfo(NLMISC::IStream *stream, std::string &artist, s return true; } -uint32 CMusicBufferVorbis::getRequiredBytes() +uint32 CAudioDecoderVorbis::getRequiredBytes() { return 0; // no minimum requirement of bytes to buffer out } -uint32 CMusicBufferVorbis::getNextBytes(uint8 *buffer, uint32 minimum, uint32 maximum) +uint32 CAudioDecoderVorbis::getNextBytes(uint8 *buffer, uint32 minimum, uint32 maximum) { sint current_section = 0; // ??? if (_IsMusicEnded) return 0; nlassert(minimum <= maximum); // can't have this.. uint32 bytes_read = 0; - #ifdef NL_BIG_ENDIAN sint endianness = 1; #else sint endianness = 0; #endif - do { // signed 16-bit or unsigned 8-bit little-endian samples sint br = ov_read(&_OggVorbisFile, (char *)&buffer[bytes_read], maximum - bytes_read, - endianness, // Specifies big or little endian byte packing. 0 for little endian, 1 for big endian. Typical value is 0. + endianness, // Specifies big or little endian byte packing. 0 for little endian, 1 for b ig endian. Typical value is 0. getBitsPerSample() == 8 ? 1 : 2, getBitsPerSample() == 8 ? 0 : 1, // Signed or unsigned data. 0 for unsigned, 1 for signed. Typically 1. ¤t_section); @@ -162,58 +175,53 @@ uint32 CMusicBufferVorbis::getNextBytes(uint8 *buffer, uint32 minimum, uint32 ma // error switch(br) { - case OV_HOLE: + case OV_HOLE: nlwarning("ov_read returned OV_HOLE"); break; - - case OV_EINVAL: + case OV_EINVAL: nlwarning("ov_read returned OV_EINVAL"); break; - - case OV_EBADLINK: + case OV_EBADLINK: nlwarning("ov_read returned OV_EBADLINK"); break; - - default: + default: nlwarning("ov_read returned %d", br); } - - return 0; } } while (bytes_read < minimum); return bytes_read; } -uint8 CMusicBufferVorbis::getChannels() +uint8 CAudioDecoderVorbis::getChannels() { vorbis_info *vi = ov_info(&_OggVorbisFile, -1); return (uint8)vi->channels; } -uint32 CMusicBufferVorbis::getSamplesPerSec() +uint CAudioDecoderVorbis::getSamplesPerSec() { vorbis_info *vi = ov_info(&_OggVorbisFile, -1); - return vi->rate; + return (uint)vi->rate; } -uint8 CMusicBufferVorbis::getBitsPerSample() +uint8 CAudioDecoderVorbis::getBitsPerSample() { return 16; } -bool CMusicBufferVorbis::isMusicEnded() +bool CAudioDecoderVorbis::isMusicEnded() { return _IsMusicEnded; } -float CMusicBufferVorbis::getLength() +float CAudioDecoderVorbis::getLength() { return (float)ov_time_total(&_OggVorbisFile, -1); } -uint CMusicBufferVorbis::getUncompressedSize() +void CAudioDecoderVorbis::setLooping(bool loop) { - return (uint)ov_pcm_total(&_OggVorbisFile, -1) * (getBitsPerSample() / 2) * getChannels(); + _Loop = loop; } } /* namespace NLSOUND */ diff --git a/code/nel/src/sound/audio_mixer_user.cpp b/code/nel/src/sound/audio_mixer_user.cpp index 367abd0e1..1a6c2d322 100644 --- a/code/nel/src/sound/audio_mixer_user.cpp +++ b/code/nel/src/sound/audio_mixer_user.cpp @@ -45,12 +45,15 @@ #include "nel/sound/context_sound.h" #include "nel/sound/music_source.h" #include "nel/sound/stream_source.h" +#include "nel/sound/stream_file_source.h" #include "nel/sound/simple_sound.h" #include "nel/sound/music_sound.h" #include "nel/sound/stream_sound.h" #include "nel/sound/sample_bank_manager.h" #include "nel/sound/sample_bank.h" #include "nel/sound/sound_bank.h" +#include "nel/sound/group_controller.h" +#include "nel/sound/containers.h" using namespace std; using namespace NLMISC; @@ -218,6 +221,7 @@ void CAudioMixerUser::writeProfile(std::string& out) */ out += "Sound mixer: \n"; out += "\tPlaying sources: " + toString (getPlayingSourcesCount()) + " \n"; + out += "\tPlaying simple sources: " + toString(countPlayingSimpleSources()) + " / " + toString(countSimpleSources()) + " \n"; out += "\tAvailable tracks: " + toString (getAvailableTracksCount()) + " \n"; out += "\tUsed tracks: " + toString (getUsedTracksCount()) + " \n"; // out << "\tMuted sources: " << nb << " \n"; @@ -248,6 +252,16 @@ void CAudioMixerUser::addSourceWaitingForPlay(CSourceCommon *source) _SourceWaitingForPlay.push_back(source); } +// ****************************************************************** + +void CAudioMixerUser::removeSourceWaitingForPlay(CSourceCommon *source) +{ + std::list::iterator it = find(_SourceWaitingForPlay.begin(), _SourceWaitingForPlay.end(), source); + if (it != _SourceWaitingForPlay.end()) + { + _SourceWaitingForPlay.erase(it); + } +} // ****************************************************************** @@ -256,8 +270,9 @@ void CAudioMixerUser::reset() _Leaving = true; _SourceWaitingForPlay.clear(); - - /* TODO: Stop music channels */ + + for (uint i = 0; i < _NbMusicChannelFaders; ++i) + _MusicChannelFaders[i].reset(); // Stop tracks uint i; @@ -1638,6 +1653,7 @@ void CAudioMixerUser::update() _MusicChannelFaders[i].update(); // Check all playing track and stop any terminated buffer. + std::list::size_type nbWaitingSources = _Sources.size(); for (i=0; i<_Tracks.size(); ++i) { if (!_Tracks[i]->isPlaying()) @@ -1649,13 +1665,14 @@ void CAudioMixerUser::update() } // try to play any waiting source. - if (!_SourceWaitingForPlay.empty()) + if (!_SourceWaitingForPlay.empty() && nbWaitingSources) { // check if the source still exist before trying to play it if (_Sources.find(_SourceWaitingForPlay.front()) != _Sources.end()) _SourceWaitingForPlay.front()->play(); // nldebug("Before POP Sources waiting : %u", _SourceWaitingForPlay.size()); _SourceWaitingForPlay.pop_front(); + --nbWaitingSources; // nldebug("After POP Sources waiting : %u", _SourceWaitingForPlay.size()); } } @@ -1689,7 +1706,7 @@ void CAudioMixerUser::update() // _Tracks[i]->DrvSource->setPos(source->getPos() * (1-css->PosAlpha) + css->Position*(css->PosAlpha)); _Tracks[i]->getPhysicalSource()->setPos(source->getPos() * (1-css->PosAlpha) + vpos*(css->PosAlpha)); // update the relative gain - _Tracks[i]->getPhysicalSource()->setGain(source->getRelativeGain()*source->getGain()*css->Gain); + _Tracks[i]->getPhysicalSource()->setGain(source->getFinalGain() * css->Gain); #if EAX_AVAILABLE == 1 if (_UseEax) { @@ -1826,10 +1843,14 @@ bool CAudioMixerUser::tryToLoadSampleBank(const std::string &sampleName) } } +UGroupController *CAudioMixerUser::getGroupController(const std::string &path) +{ + return static_cast(_GroupController.getGroupController(path)); +} // ****************************************************************** -USource *CAudioMixerUser::createSource( TSoundId id, bool spawn, TSpawnEndCallback cb, void *userParam, NL3D::CCluster *cluster, CSoundContext *context ) +USource *CAudioMixerUser::createSource( TSoundId id, bool spawn, TSpawnEndCallback cb, void *userParam, NL3D::CCluster *cluster, CSoundContext *context, UGroupController *groupController ) { #if NL_PROFILE_MIXER TTicks start = CTime::getPerformanceTime(); @@ -1915,7 +1936,7 @@ retrySound: } // Create source - CSimpleSource *source = new CSimpleSource( simpleSound, spawn, cb, userParam, cluster); + CSimpleSource *source = new CSimpleSource( simpleSound, spawn, cb, userParam, cluster, static_cast(groupController)); // nldebug("Mixer : source %p created", source); @@ -1939,28 +1960,35 @@ retrySound: { CStreamSound *streamSound = static_cast(id); // This is a stream thingy. - ret = new CStreamSource(streamSound, spawn, cb, userParam, cluster); + ret = new CStreamSource(streamSound, spawn, cb, userParam, cluster, static_cast(groupController)); + } + break; + case CSound::SOUND_STREAM_FILE: + { + CStreamFileSound *streamFileSound = static_cast(id); + // This is a stream file thingy. + ret = new CStreamFileSource(streamFileSound, spawn, cb, userParam, cluster, static_cast(groupController)); } break; case CSound::SOUND_COMPLEX: { CComplexSound *complexSound = static_cast(id); // This is a pattern sound. - ret = new CComplexSource(complexSound, spawn, cb, userParam, cluster); + ret = new CComplexSource(complexSound, spawn, cb, userParam, cluster, static_cast(groupController)); } break; case CSound::SOUND_BACKGROUND: { // This is a background sound. CBackgroundSound *bgSound = static_cast(id); - ret = new CBackgroundSource(bgSound, spawn, cb, userParam, cluster); + ret = new CBackgroundSource(bgSound, spawn, cb, userParam, cluster, static_cast(groupController)); } break; case CSound::SOUND_MUSIC: { // This is a background music sound CMusicSound *music_sound= static_cast(id); - ret = new CMusicSource(music_sound, spawn, cb, userParam, cluster); + ret = new CMusicSource(music_sound, spawn, cb, userParam, cluster, static_cast(groupController)); } break; case CSound::SOUND_CONTEXT: @@ -1974,7 +2002,7 @@ retrySound: CSound *sound = ctxSound->getContextSound(*context); if (sound != 0) { - ret = createSource(sound, spawn, cb, userParam, cluster); + ret = createSource(sound, spawn, cb, userParam, cluster, NULL, static_cast(groupController)); // Set the volume of the source according to the context volume if (ret != 0) { @@ -2007,9 +2035,9 @@ retrySound: // ****************************************************************** -USource *CAudioMixerUser::createSource( const NLMISC::TStringId &name, bool spawn, TSpawnEndCallback cb, void *userParam, NL3D::CCluster *cluster, CSoundContext *context) +USource *CAudioMixerUser::createSource( const NLMISC::TStringId &name, bool spawn, TSpawnEndCallback cb, void *userParam, NL3D::CCluster *cluster, CSoundContext *context, UGroupController *groupController) { - return createSource( getSoundId( name ), spawn, cb, userParam, cluster, context); + return createSource( getSoundId( name ), spawn, cb, userParam, cluster, context, groupController); } @@ -2147,6 +2175,32 @@ uint CAudioMixerUser::getPlayingSourcesCount() const return _PlayingSources; } + +// ****************************************************************** + +uint CAudioMixerUser::countPlayingSimpleSources() const +{ + uint count = 0; + for (TSourceContainer::const_iterator it(_Sources.begin()), end(_Sources.end()); it != end; ++it) + { + if ((*it)->getType() == CSourceCommon::SOURCE_SIMPLE && (*it)->isPlaying()) + ++count; + } + return count; +} + +uint CAudioMixerUser::countSimpleSources() const +{ + uint count = 0; + for (TSourceContainer::const_iterator it(_Sources.begin()), end(_Sources.end()); it != end; ++it) + { + if ((*it)->getType() == CSourceCommon::SOURCE_SIMPLE) + ++count; + } + return count; +} + + // ****************************************************************** uint CAudioMixerUser::getAvailableTracksCount() const diff --git a/code/nel/src/sound/background_source.cpp b/code/nel/src/sound/background_source.cpp index c2cb5206a..dbb14242a 100644 --- a/code/nel/src/sound/background_source.cpp +++ b/code/nel/src/sound/background_source.cpp @@ -26,8 +26,8 @@ namespace NLSOUND { -CBackgroundSource::CBackgroundSource(CBackgroundSound *backgroundSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster) -: CSourceCommon(backgroundSound, spawn, cb, cbUserParam, cluster) +CBackgroundSource::CBackgroundSource(CBackgroundSound *backgroundSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController) +: CSourceCommon(backgroundSound, spawn, cb, cbUserParam, cluster, groupController) { _BackgroundSound = backgroundSound; } @@ -119,7 +119,7 @@ void CBackgroundSource::play() for (; first != last; ++first) { TSubSource subSource; - subSource.Source = mixer->createSource(first->SoundName, false, 0, 0, _Cluster, 0); + subSource.Source = mixer->createSource(first->SoundName, false, 0, 0, _Cluster, NULL, _GroupController); if (subSource.Source != NULL) subSource.Source->setPriority(_Priority); subSource.Filter = first->Filter; diff --git a/code/nel/src/sound/complex_source.cpp b/code/nel/src/sound/complex_source.cpp index cd3d2925d..8fad61a53 100644 --- a/code/nel/src/sound/complex_source.cpp +++ b/code/nel/src/sound/complex_source.cpp @@ -25,8 +25,8 @@ using namespace NLMISC; namespace NLSOUND { -CComplexSource::CComplexSource (CComplexSound *soundPattern, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster) -: CSourceCommon(soundPattern, spawn, cb, cbUserParam, cluster), +CComplexSource::CComplexSource (CComplexSound *soundPattern, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController) +: CSourceCommon(soundPattern, spawn, cb, cbUserParam, cluster, groupController), _Source1(NULL), _Source2(NULL) { @@ -117,7 +117,7 @@ void CComplexSource::playStuf() else _FadeLength = 0; - _Source2 = mixer->createSource(sound, false, 0, 0, _Cluster); + _Source2 = mixer->createSource(sound, false, 0, 0, _Cluster, NULL, _GroupController); if (_Source2 == NULL) return; _Source2->setPriority(_Priority); @@ -155,7 +155,7 @@ void CComplexSource::playStuf() { CSound *sound = mixer->getSoundId(_PatternSound->getSound(soundSeq[_SoundSeqIndex++])); - _Source1 = mixer->createSource(sound, false, 0, 0, _Cluster); + _Source1 = mixer->createSource(sound, false, 0, 0, _Cluster, NULL, _GroupController); if (_Source1 == NULL) return; _Source1->setPriority(_Priority); @@ -202,7 +202,7 @@ void CComplexSource::playStuf() CSound *sound = mixer->getSoundId(*first); if (sound != NULL) { - USource *source = mixer->createSource(sound, false, 0, 0, _Cluster); + USource *source = mixer->createSource(sound, false, 0, 0, _Cluster, NULL, _GroupController); if (source != NULL) { source->setPriority(_Priority); @@ -512,7 +512,7 @@ void CComplexSource::onUpdate() // determine the XFade length (if next sound is too short. _FadeLength = minof(uint32(_PatternSound->getFadeLength()/_TickPerSecond), (sound2->getDuration()) / 2, (_Source1->getSound()->getDuration())/2); - _Source2 = mixer->createSource(sound2, false, 0, 0, _Cluster); + _Source2 = mixer->createSource(sound2, false, 0, 0, _Cluster, NULL, _GroupController); if (_Source2) { _Source2->setPriority(_Priority); @@ -641,7 +641,7 @@ void CComplexSource::onEvent() CSound *sound = mixer->getSoundId(_PatternSound->getSound(soundSeq[_SoundSeqIndex++])); - _Source1 = mixer->createSource(sound, false, 0, 0, _Cluster); + _Source1 = mixer->createSource(sound, false, 0, 0, _Cluster, NULL, _GroupController); if (_Source1 == NULL) { stop(); diff --git a/code/nel/src/sound/driver/CMakeLists.txt b/code/nel/src/sound/driver/CMakeLists.txt index 1a8391c41..90fbbb562 100644 --- a/code/nel/src/sound/driver/CMakeLists.txt +++ b/code/nel/src/sound/driver/CMakeLists.txt @@ -3,14 +3,7 @@ FILE(GLOB HEADERS ../../../include/nel/sound/driver/*.h) NL_TARGET_LIB(nelsnd_lowlevel ${HEADERS} ${SRC}) -INCLUDE_DIRECTORIES(${VORBIS_INCLUDE_DIR}) - -TARGET_LINK_LIBRARIES(nelsnd_lowlevel nelmisc ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY}) - -IF(WITH_STATIC) - # Add libogg dependency only if target is static because to libvorbisfile - TARGET_LINK_LIBRARIES(nelsnd_lowlevel ${OGG_LIBRARY}) -ENDIF(WITH_STATIC) +TARGET_LINK_LIBRARIES(nelsnd_lowlevel nelmisc) SET_TARGET_PROPERTIES(nelsnd_lowlevel PROPERTIES LINK_INTERFACE_LIBRARIES "") NL_DEFAULT_PROPS(nelsnd_lowlevel "NeL, Library: Sound Lowlevel") diff --git a/code/nel/src/sound/driver/fmod/music_channel_fmod.cpp b/code/nel/src/sound/driver/fmod/music_channel_fmod.cpp index 9c502ea1a..a64dddcfe 100644 --- a/code/nel/src/sound/driver/fmod/music_channel_fmod.cpp +++ b/code/nel/src/sound/driver/fmod/music_channel_fmod.cpp @@ -249,6 +249,12 @@ void CMusicChannelFMod::stop() _CallBackEnded = false; } +void CMusicChannelFMod::reset() +{ + // don't care + stop(); +} + /** Pause the music previously loaded and played (the Memory is not freed) */ void CMusicChannelFMod::pause() diff --git a/code/nel/src/sound/driver/fmod/music_channel_fmod.h b/code/nel/src/sound/driver/fmod/music_channel_fmod.h index d9a17fd99..e91e38a8b 100644 --- a/code/nel/src/sound/driver/fmod/music_channel_fmod.h +++ b/code/nel/src/sound/driver/fmod/music_channel_fmod.h @@ -87,6 +87,9 @@ public: /// Stop the music previously loaded and played (the Memory is also freed) virtual void stop(); + /// Makes sure any resources are freed, but keeps available for next play call + virtual void reset(); + /// Pause the music previously loaded and played (the Memory is not freed) virtual void pause(); diff --git a/code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp b/code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp index caad324be..617ed3473 100644 --- a/code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp +++ b/code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp @@ -22,6 +22,10 @@ #include "source_fmod.h" #include "buffer_fmod.h" +#ifdef NL_OS_WINDOWS +#include +#endif + using namespace std; using namespace NLMISC; diff --git a/code/nel/src/sound/driver/fmod/source_fmod.cpp b/code/nel/src/sound/driver/fmod/source_fmod.cpp index 2ae9a0ea1..4ef2f89d5 100644 --- a/code/nel/src/sound/driver/fmod/source_fmod.cpp +++ b/code/nel/src/sound/driver/fmod/source_fmod.cpp @@ -413,6 +413,13 @@ bool CSourceFMod::getSourceRelativeMode() const // ****************************************************************** void CSourceFMod::setMinMaxDistances( float mindist, float maxdist, bool /* deferred */ ) { + static float maxSqrt = sqrt(std::numeric_limits::max()); + if (maxdist >= maxSqrt) + { + nlwarning("SOUND_DEV (FMod): Ridiculously high max distance set on source"); + maxdist = maxSqrt; + } + _MinDist= mindist; _MaxDist= maxdist; if(_FModChannel!=-1) diff --git a/code/nel/src/sound/driver/music_buffer.cpp b/code/nel/src/sound/driver/music_buffer.cpp deleted file mode 100644 index 40088d49e..000000000 --- a/code/nel/src/sound/driver/music_buffer.cpp +++ /dev/null @@ -1,108 +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 "stdsound_lowlevel.h" - -#include "nel/sound/driver/music_buffer_vorbis.h" -#include "nel/sound/driver/music_buffer.h" - -using namespace std; -using namespace NLMISC; - -namespace NLSOUND -{ - -IMusicBuffer::IMusicBuffer() : _InternalStream(NULL) -{ - -} - -IMusicBuffer::~IMusicBuffer() -{ - if (_InternalStream) { delete _InternalStream; _InternalStream = NULL; } -} - -IMusicBuffer *IMusicBuffer::createMusicBuffer(const std::string &filepath, bool async, bool loop) -{ - string lookup = CPath::lookup(filepath, false); - if (lookup.empty()) - { - nlwarning("Music file %s does not exist!", filepath.c_str()); - return NULL; - } - string type = CFile::getExtension(filepath); - - CIFile *ifile = new CIFile(); - ifile->setAsyncLoading(async); - ifile->open(lookup); - - IMusicBuffer *mb = createMusicBuffer(type, ifile, loop); - - if (mb) mb->_InternalStream = ifile; - else delete ifile; - - return mb; -} - -IMusicBuffer *IMusicBuffer::createMusicBuffer(const std::string &type, NLMISC::IStream *stream, bool loop) -{ - if (!stream) - { - nlwarning("Stream is NULL"); - return NULL; - } - string type_lower = toLower(type); - if (type_lower == "ogg") - { - return new CMusicBufferVorbis(stream, loop); - } - else - { - nlwarning("Music file type unknown: '%s'", type_lower.c_str()); - return NULL; - } -} - -bool IMusicBuffer::getInfo(const std::string &filepath, std::string &artist, std::string &title) -{ - string lookup = CPath::lookup(filepath, false); - if (lookup.empty()) - { - nlwarning("Music file %s does not exist!", filepath.c_str()); - return false; - } - string type = CFile::getExtension(filepath); - string type_lower = toLower(type); - - if (type_lower == "ogg") - { - CIFile ifile; - ifile.setCacheFileOnOpen(false); - ifile.allowBNPCacheFileOnOpen(false); - ifile.open(lookup); - return CMusicBufferVorbis::getInfo(&ifile, artist, title); - } - else - { - nlwarning("Music file type unknown: '%s'", type_lower.c_str()); - artist.clear(); title.clear(); - return false; - } -} - -} /* namespace NLSOUND */ - -/* end of file */ diff --git a/code/nel/src/sound/driver/openal/listener_al.cpp b/code/nel/src/sound/driver/openal/listener_al.cpp index 67eaf2478..da7e6bc31 100644 --- a/code/nel/src/sound/driver/openal/listener_al.cpp +++ b/code/nel/src/sound/driver/openal/listener_al.cpp @@ -145,9 +145,8 @@ void CListenerAL::getOrientation( NLMISC::CVector& front, NLMISC::CVector& u */ void CListenerAL::setGain( float gain ) { - CSoundDriverAL::getInstance()->setGain(gain); -// alListenerf( AL_GAIN, gain ); -// alTestError(); + alListenerf( AL_GAIN, gain ); + alTestError(); } @@ -156,15 +155,14 @@ void CListenerAL::setGain( float gain ) */ float CListenerAL::getGain() const { - return CSoundDriverAL::getInstance()->getGain(); -// ALfloat gain; -//#ifdef NL_OS_WINDOWS -// alGetListenerf( AL_GAIN, &gain ); -//#else -// alGetListenerfv( AL_GAIN, &gain ); -//#endif -// alTestError(); -// return gain; + ALfloat gain; +#ifdef NL_OS_WINDOWS + alGetListenerf( AL_GAIN, &gain ); +#else + alGetListenerfv( AL_GAIN, &gain ); +#endif + alTestError(); + return gain; } diff --git a/code/nel/src/sound/driver/openal/music_channel_al.cpp b/code/nel/src/sound/driver/openal/music_channel_al.cpp deleted file mode 100644 index b1849b33e..000000000 --- a/code/nel/src/sound/driver/openal/music_channel_al.cpp +++ /dev/null @@ -1,328 +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 "stdopenal.h" - -// Project includes -#include "sound_driver_al.h" -#include "source_al.h" -#include "buffer_al.h" -#include "music_channel_al.h" - -using namespace std; -using namespace NLMISC; - -namespace NLSOUND -{ - -CMusicChannelAL::CMusicChannelAL(CSoundDriverAL *soundDriver) -: _SoundDriver(soundDriver), _MusicBuffer(NULL), _Thread(NULL), _Buffer(NULL), _Source(NULL), _Playing(false), _Async(false), _Gain(1.0) -{ - // create a default source for music streaming - _Source = static_cast(_SoundDriver->createSource()); - _Source->setType(SourceMusic); - _Source->setStreamingBufferSize(32768); -} - -CMusicChannelAL::~CMusicChannelAL() -{ - release(); - if (_SoundDriver) { _SoundDriver->removeMusicChannel(this); _SoundDriver = NULL; } -} - -void CMusicChannelAL::release() -{ - // stop thread before deleting it - stop(); - - // delete thread - if (_Thread) - { - delete _Thread; - _Thread = NULL; - } - - // delete source - if (_Source) - { - delete _Source; - _Source = NULL; - } -} - -/// Fill IBuffer with data from IMusicBuffer -bool CMusicChannelAL::fillBuffer(IBuffer *buffer, uint length) -{ - if (!buffer || !length) - { - nlwarning("AL: No data to stream"); - return false; - } - - // fill buffer with music data - uint8 *tmp = buffer->lock(length); - if (tmp == NULL) - { - nlwarning("AL: Can't allocate %u bytes for buffer", length); - return false; - } - - uint32 size = _MusicBuffer->getNextBytes(tmp, length, length); - buffer->unlock(size); - - return size > 0; -} - -/// Use buffer format from IMusicBuffer -void CMusicChannelAL::setBufferFormat(IBuffer *buffer) -{ - if (!buffer) - { - nlwarning("AL: No buffer specified"); - return; - } - - // use the same format as music for buffers - buffer->setFormat(IBuffer::FormatPcm, _MusicBuffer->getChannels(), - _MusicBuffer->getBitsPerSample(), _MusicBuffer->getSamplesPerSec()); -} - -void CMusicChannelAL::run() -{ - bool first = true; - - // use queued buffers - do - { - // buffers to update - std::vector buffers; - - if (first) - { - // get all buffers to queue - _Source->getStreamingBuffers(buffers); - - // set format for each buffer - for(uint i = 0; i < buffers.size(); ++i) - setBufferFormat(buffers[i]); - } - else - { - // get unqueued buffers - _Source->getProcessedStreamingBuffers(buffers); - } - - // fill buffers - for(uint i = 0; i < buffers.size(); ++i) - { - if (!fillBuffer(buffers[i], _Source->getStreamingBufferSize())) - break; - - // add buffer to streaming buffers queue - _Source->submitStreamingBuffer(buffers[i]); - } - - // play the source - if (first) - { - _Source->play(); - first = false; - } - - // wait 100ms before rechecking buffers - nlSleep(100); - } - while(!_MusicBuffer->isMusicEnded() && _Playing); - - - // music finished without interruption - if (_Playing) - { - // wait until source is not playing - while(_Source->isPlaying() && _Playing) nlSleep(1000); - - _Source->stop(); - - _Playing = false; - } -} - -/// Play sync music -bool CMusicChannelAL::playSync() -{ - // use an unique buffer managed by CMusicChannelAL - _Buffer = _SoundDriver->createBuffer(); - - // set format - setBufferFormat(_Buffer); - - // fill data - fillBuffer(_Buffer, _MusicBuffer->getUncompressedSize()); - - // we don't need _MusicBuffer anymore because all is loaded into memory - if (_MusicBuffer) - { - delete _MusicBuffer; - _MusicBuffer = NULL; - } - - // delete previous queued buffers - _Source->setStreamingBuffersMax(0); - - // use this buffer as source - _Source->setStaticBuffer(_Buffer); - - // play the source - return _Source->play(); -} - -/** Play some music (.ogg etc...) - * NB: if an old music was played, it is first stop with stopMusic() - * \param filepath file path, CPath::lookup is done here - * \param async stream music from hard disk, preload in memory if false - * \param loop must be true to play the music in loop. - */ -bool CMusicChannelAL::play(const std::string &filepath, bool async, bool loop) -{ - // stop a previous music - stop(); - - // when not using async, we must load the whole file once - _MusicBuffer = IMusicBuffer::createMusicBuffer(filepath, async, async ? loop:false); - - if (_MusicBuffer) - { - _Async = async; - _Playing = true; - - _Source->setSourceRelativeMode(true); - - if (_Async) - { - // create the thread if it's not yet created - if (!_Thread) _Thread = IThread::create(this); - - if (!_Thread) - { - nlwarning("AL: Can't create a new thread"); - return false; - } - - // use 4 queued buffers - _Source->setStreamingBuffersMax(4); - - // we need to loop the source only if not async - _Source->setLooping(false); - - // start the thread - _Thread->start(); - } - else - { - // we need to loop the source only if not async - _Source->setLooping(loop); - - return playSync(); - } - } - else - { - nlwarning("AL: Can't stream file %s", filepath.c_str()); - return false; - } - - return true; -} - -/// Stop the music previously loaded and played (the Memory is also freed) -void CMusicChannelAL::stop() -{ - _Playing = false; - - _Source->stop(); - - // if not using async streaming, we manage static buffer ourself - if (!_Async && _Buffer) - { - _Source->setStaticBuffer(NULL); - delete _Buffer; - _Buffer = NULL; - } - - // wait until thread is finished - if (_Thread) - _Thread->wait(); - - if (_MusicBuffer) - { - delete _MusicBuffer; - _MusicBuffer = NULL; - } -} - -/// Pause the music previously loaded and played (the Memory is not freed) -void CMusicChannelAL::pause() -{ - _Source->pause(); -} - -/// Resume the music previously paused -void CMusicChannelAL::resume() -{ - _Source->play(); -} - -/// Return true if a song is finished. -bool CMusicChannelAL::isEnded() -{ - return !_Playing; -} - -/// Return true if the song is still loading asynchronously and hasn't started playing yet (false if not async), used to delay fading -bool CMusicChannelAL::isLoadingAsync() -{ - return _Async && _Playing && !_Source->isPlaying(); -} - -/// Return the total length (in second) of the music currently played -float CMusicChannelAL::getLength() -{ - if (_MusicBuffer) return _MusicBuffer->getLength(); - else return .0f; -} - -/** Set the music volume (if any music played). (volume value inside [0 , 1]) (default: 1) - * NB: in OpenAL driver, the volume of music IS affected by IListener::setGain() - */ -void CMusicChannelAL::setVolume(float gain) -{ - _Gain = gain; - _Source->setGain(gain); -} - -/// Update music -void CMusicChannelAL::update() -{ - // stop sync music once finished playing - if (_Playing && !_Async && !_Source->isPlaying()) - { - stop(); - } -} - -} /* namespace NLSOUND */ - -/* end of file */ diff --git a/code/nel/src/sound/driver/openal/music_channel_al.h b/code/nel/src/sound/driver/openal/music_channel_al.h deleted file mode 100644 index 157c18810..000000000 --- a/code/nel/src/sound/driver/openal/music_channel_al.h +++ /dev/null @@ -1,106 +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 NLSOUND_MUSIC_CHANNEL_AL_H -#define NLSOUND_MUSIC_CHANNEL_AL_H - -#include "nel/sound/driver/music_channel.h" - -namespace NLSOUND -{ - class CSoundDriverAL; - class IMusicBuffer; - -/** - * \brief CMusicChannelAL - * \date 2010-07-27 16:56GMT - * \author Kervala - * CMusicChannelAL is an implementation of the IMusicChannel interface to run on OpenAL. - */ -class CMusicChannelAL : public IMusicChannel, public NLMISC::IRunnable -{ -protected: - // outside pointers - CSoundDriverAL* _SoundDriver; - - // pointers - IMusicBuffer* _MusicBuffer; - NLMISC::IThread* _Thread; - - IBuffer* _Buffer; - CSourceAL* _Source; - bool _Playing; - bool _Async; - - float _Gain; - - /// Fill IBuffer with data from IMusicBuffer - bool fillBuffer(IBuffer *buffer, uint length); - - /// Use buffer format from IMusicBuffer - void setBufferFormat(IBuffer *buffer); - - /// Declared in NLMISC::IRunnable interface - virtual void run(); - -public: - CMusicChannelAL(CSoundDriverAL *soundDriver); - virtual ~CMusicChannelAL(); - void release(); - - /** Play some music (.ogg etc...) - * NB: if an old music was played, it is first stop with stopMusic() - * \param filepath file path, CPath::lookup is done here - * \param async stream music from hard disk, preload in memory if false - * \param loop must be true to play the music in loop. - */ - virtual bool play(const std::string &filepath, bool async, bool loop); - - /// Stop the music previously loaded and played (the Memory is also freed) - virtual void stop(); - - /// Pause the music previously loaded and played (the Memory is not freed) - virtual void pause(); - - /// Resume the music previously paused - virtual void resume(); - - /// Return true if a song is finished. - virtual bool isEnded(); - - /// Return true if the song is still loading asynchronously and hasn't started playing yet (false if not async), used to delay fading - virtual bool isLoadingAsync(); - - /// Return the total length (in second) of the music currently played - virtual float getLength(); - - /** Set the music volume (if any music played). (volume value inside [0 , 1]) (default: 1) - * NB: in OpenAL driver, the volume of music IS affected by IListener::setGain() - */ - virtual void setVolume(float gain); - - /// Play sync music - bool playSync(); - - /// Update music - void update(); -}; /* class CMusicChannelAL */ - -} /* namespace NLSOUND */ - -#endif /* #ifndef NLSOUND_MUSIC_CHANNEL_AL_H */ - -/* end of file */ diff --git a/code/nel/src/sound/driver/openal/sound_driver_al.cpp b/code/nel/src/sound/driver/openal/sound_driver_al.cpp index e94755c63..e7eaca3f6 100644 --- a/code/nel/src/sound/driver/openal/sound_driver_al.cpp +++ b/code/nel/src/sound/driver/openal/sound_driver_al.cpp @@ -16,7 +16,6 @@ #include "stdopenal.h" #include "sound_driver_al.h" -#include "music_channel_al.h" #include "buffer_al.h" #include "listener_al.h" #include "source_al.h" @@ -174,7 +173,7 @@ uint32 NLSOUND_interfaceVersion () */ CSoundDriverAL::CSoundDriverAL(ISoundDriver::IStringMapperProvider *stringMapper) : _StringMapper(stringMapper), _AlDevice(NULL), _AlContext(NULL), -_NbExpBuffers(0), _NbExpSources(0), _RolloffFactor(1.f), _MasterGain(1.f) +_NbExpBuffers(0), _NbExpSources(0), _RolloffFactor(1.f) { alExtInit(); } @@ -184,21 +183,16 @@ _NbExpBuffers(0), _NbExpSources(0), _RolloffFactor(1.f), _MasterGain(1.f) */ CSoundDriverAL::~CSoundDriverAL() { - // Release internal resources of all remaining IMusicChannel instances - if (_MusicChannels.size()) - { - nlwarning("AL: _MusicChannels.size(): '%u'", (uint32)_MusicChannels.size()); - set::iterator it(_MusicChannels.begin()), end(_MusicChannels.end()); - for (; it != end; ++it) delete *it; - _MusicChannels.clear(); - } + // WARNING: Only internal resources are released here, + // the created instances must still be released by the user! + // Remove the allocated (but not exported) source and buffer names- // Release internal resources of all remaining ISource instances if (_Sources.size()) { nlwarning("AL: _Sources.size(): '%u'", (uint32)_Sources.size()); set::iterator it(_Sources.begin()), end(_Sources.end()); - for (; it != end; ++it) delete *it; + for (; it != end; ++it) (*it)->release(); // CSourceAL will be deleted by user _Sources.clear(); } if (!_Buffers.empty()) alDeleteBuffers(compactAliveNames(_Buffers, alIsBuffer), &*_Buffers.begin()); @@ -207,7 +201,7 @@ CSoundDriverAL::~CSoundDriverAL() { nlwarning("AL: _Effects.size(): '%u'", (uint32)_Effects.size()); set::iterator it(_Effects.begin()), end(_Effects.end()); - for (; it != end; ++it) delete *it; + for (; it != end; ++it) (*it)->release(); // CEffectAL will be deleted by user _Effects.clear(); } @@ -619,16 +613,9 @@ void CSoundDriverAL::commit3DChanges() // Sync up sources & listener 3d position. if (getOption(OptionManualRolloff)) { - set::iterator it = _Sources.begin(), iend = _Sources.end(); - while(it != iend) - { + for (std::set::iterator it(_Sources.begin()), end(_Sources.end()); it != end; ++it) (*it)->updateManualRolloff(); - ++it; - } } - - // update the music (XFade etc...) - updateMusic(); } /// Write information about the driver to the output stream. @@ -656,23 +643,6 @@ void CSoundDriverAL::displayBench(NLMISC::CLog *log) NLMISC::CHTimer::display(log, CHTimer::TotalTime); } -/** Get music info. Returns false if the song is not found or the function is not implemented. - * \param filepath path to file, CPath::lookup done by driver - * \param artist returns the song artist (empty if not available) - * \param title returns the title (empty if not available) - */ -bool CSoundDriverAL::getMusicInfo(const std::string &filepath, std::string &artist, std::string &title) -{ - // add support for additional non-standard music file types info here - return IMusicBuffer::getInfo(filepath, artist, title); -} - -void CSoundDriverAL::updateMusic() -{ - set::iterator it(_MusicChannels.begin()), end(_MusicChannels.end()); - for (; it != end; ++it) (*it)->update(); -} - /// Remove a buffer void CSoundDriverAL::removeBuffer(CBufferAL *buffer) { @@ -695,35 +665,6 @@ void CSoundDriverAL::removeEffect(CEffectAL *effect) else nlwarning("AL: removeEffect already called"); } -/// Create a music channel -IMusicChannel *CSoundDriverAL::createMusicChannel() -{ - CMusicChannelAL *music_channel = new CMusicChannelAL(this); - _MusicChannels.insert(music_channel); - return static_cast(music_channel); -} - -/// (Internal) Remove a music channel (should be called by the destructor of the music channel class). -void CSoundDriverAL::removeMusicChannel(CMusicChannelAL *musicChannel) -{ - if (_MusicChannels.find(musicChannel) != _MusicChannels.end()) _MusicChannels.erase(musicChannel); - else nlwarning("AL: removeMusicChannel already called"); -} - -/// Set the gain -void CSoundDriverAL::setGain( float gain ) -{ - clamp(gain, 0.f, 1.f); - _MasterGain= gain; - // TODO: update all sources in not using manual rollof ? -} - -/// Get the gain -float CSoundDriverAL::getGain() -{ - return _MasterGain; -} - /// Delete a buffer or a source bool CSoundDriverAL::deleteItem( ALuint name, TDeleteFunctionAL aldeletefunc, vector& names ) { diff --git a/code/nel/src/sound/driver/openal/sound_driver_al.h b/code/nel/src/sound/driver/openal/sound_driver_al.h index 50bffa379..154bc6d78 100644 --- a/code/nel/src/sound/driver/openal/sound_driver_al.h +++ b/code/nel/src/sound/driver/openal/sound_driver_al.h @@ -19,13 +19,11 @@ #include -namespace NLSOUND -{ +namespace NLSOUND { class CBufferAL; class CListenerAL; class CSourceAL; class CEffectAL; - class CMusicChannelAL; // alGenBuffers, alGenSources //typedef ALAPI ALvoid ALAPIENTRY (*TGenFunctionAL) ( ALsizei, ALuint* ); @@ -82,8 +80,6 @@ private: std::set _Sources; // Allocated effects std::set _Effects; - /// Array with the allocated music channels created by client code. - std::set _MusicChannels; // Number of exported buffers (including any deleted buffers) uint _NbExpBuffers; // Number of exported sources (including any deleted sources) @@ -101,6 +97,10 @@ public: /// Destructor virtual ~CSoundDriverAL(); + inline ALCdevice *getAlDevice() { return _AlDevice; } + inline ALCcontext *getAlContext() { return _AlContext; } + inline float getRolloffFactor() { return _RolloffFactor; } + /// Return a list of available devices for the user. The value at index 0 is empty, and is used for automatic device selection. virtual void getDevices(std::vector &devices); /// Initialize the driver with a user selected device. If device.empty(), the default or most appropriate device is used. @@ -111,73 +111,46 @@ public: /// Return if an option is enabled (including those that cannot be disabled on this driver). virtual bool getOption(TSoundOptions option); - /// Commit all the changes made to 3D settings of listener and sources - virtual void commit3DChanges(); - + /// Create a sound buffer + virtual IBuffer *createBuffer(); /// Create the listener instance virtual IListener *createListener(); - /// Create a source, destroy with delete + /// Create a source virtual ISource *createSource(); - /// Create a sound buffer, destroy with delete - virtual IBuffer *createBuffer(); /// Create a reverb effect virtual IReverbEffect *createReverbEffect(); /// Return the maximum number of sources that can created virtual uint countMaxSources(); /// Return the maximum number of effects that can be created virtual uint countMaxEffects(); - - /// Write information about the driver to the output stream. - virtual void writeProfile(std::string& /* out */); - + virtual void startBench(); virtual void endBench(); virtual void displayBench(NLMISC::CLog * /* log */); - /// Create a music channel, destroy with destroyMusicChannel. - virtual IMusicChannel *createMusicChannel(); - - /** Get music info. Returns false if the song is not found or the function is not implemented. - * \param filepath path to file, CPath::lookup done by driver - * \param artist returns the song artist (empty if not available) - * \param title returns the title (empty if not available) - */ - virtual bool getMusicInfo(const std::string &filepath, std::string &artist, std::string &title); - - /// Get audio/container extensions that are supported natively by the driver implementation. - virtual void getMusicExtensions(std::vector & /* extensions */) const { } - /// Return if a music extension is supported by the driver's music channel. - virtual bool isMusicExtensionSupported(const std::string & /* extension */) const { return false; } - - ALCdevice *getAlDevice() { return _AlDevice; } - ALCcontext *getAlContext() { return _AlContext; } - float getRolloffFactor() { return _RolloffFactor; } /// Change the rolloff factor and apply to all sources void applyRolloffFactor(float f); + /// Commit all the changes made to 3D settings of listener and sources + virtual void commit3DChanges(); + + /// Write information about the driver to the output stream. + virtual void writeProfile(std::string& /* out */); + /// Remove a buffer void removeBuffer(CBufferAL *buffer); /// Remove a source void removeSource(CSourceAL *source); /// Remove an effect void removeEffect(CEffectAL *effect); - /// (Internal) Remove music channel (should be called by the destructor of the music channel class). - void removeMusicChannel(CMusicChannelAL *musicChannel); - - /** Set the gain (volume value inside [0 , 1]). (default: 1) - * 0.0 -> silence - * 0.5 -> -6dB - * 1.0 -> no attenuation - * values > 1 (amplification) not supported by most drivers - */ - void setGain( float gain ); - /// Get the gain - float getGain(); + /// Get audio/container extensions that are supported natively by the driver implementation. + virtual void getMusicExtensions(std::vector & /* extensions */) const { } + /// Return if a music extension is supported by the driver's music channel. + virtual bool isMusicExtensionSupported(const std::string & /* extension */) const { return false; } protected: - void updateMusic(); /// Allocate nb new buffers or sources void allocateNewItems( TGenFunctionAL algenfunc, TTestFunctionAL altestfunc, @@ -195,9 +168,6 @@ protected: /// Delete a buffer or a source bool deleteItem( ALuint name, TDeleteFunctionAL aldeletefunc, std::vector& names ); - - /// Master Volume [0,1] - float _MasterGain; }; diff --git a/code/nel/src/sound/driver/openal/source_al.cpp b/code/nel/src/sound/driver/openal/source_al.cpp index fe2dcb086..dab3123b1 100644 --- a/code/nel/src/sound/driver/openal/source_al.cpp +++ b/code/nel/src/sound/driver/openal/source_al.cpp @@ -15,55 +15,38 @@ // along with this program. If not, see . #include "stdopenal.h" -#include "source_al.h" #include "sound_driver_al.h" #include "listener_al.h" #include "effect_al.h" #include "buffer_al.h" +#include "source_al.h" #include "ext_al.h" +// #define NLSOUND_DEBUG_GAIN + using namespace std; using namespace NLMISC; -namespace NLSOUND -{ +namespace NLSOUND { -CSourceAL::CSourceAL(CSoundDriverAL *soundDriver):ISource(), _SoundDriver(NULL), _Source(AL_NONE), - _DirectFilter(AL_FILTER_NULL), _EffectFilter(AL_FILTER_NULL) +CSourceAL::CSourceAL(CSoundDriverAL *soundDriver) : +_SoundDriver(NULL), _Buffer(NULL), _Source(AL_NONE), +_DirectFilter(AL_FILTER_NULL), _EffectFilter(AL_FILTER_NULL), +_IsPlaying(false), _IsPaused(false), _StartTime(0), _IsStreaming(false), _RelativeMode(false), +_Pos(0.0f, 0.0f, 0.0f), _Gain(NLSOUND_DEFAULT_GAIN), _Alpha(1.0), +_MinDistance(1.0f), _MaxDistance(sqrt(numeric_limits::max())), +_Effect(NULL), _Direct(true), +_DirectGain(NLSOUND_DEFAULT_DIRECT_GAIN), _EffectGain(NLSOUND_DEFAULT_EFFECT_GAIN), +_DirectFilterType(ISource::FilterLowPass), _EffectFilterType(ISource::FilterLowPass), +_DirectFilterEnabled(false), _EffectFilterEnabled(false), +_DirectFilterPassGain(NLSOUND_DEFAULT_FILTER_PASS_GAIN), _EffectFilterPassGain(NLSOUND_DEFAULT_FILTER_PASS_GAIN) { - _IsPlaying = false; - _IsPaused = false; - _StartTime = 0; - - _Type = SourceSound; - _Buffer = NULL; - _BuffersMax = 0; - _BufferSize = 32768; - - _PosRelative = false; - _Gain = NLSOUND_DEFAULT_GAIN; - _Alpha = 0.0; - _Pos = CVector::Null; - _MinDistance = 1.0f; - _MaxDistance = numeric_limits::max(); - - _Effect = NULL; - _Direct = true; - _DirectGain = NLSOUND_DEFAULT_DIRECT_GAIN; - _EffectGain = NLSOUND_DEFAULT_EFFECT_GAIN; - _DirectFilterType = ISource::FilterLowPass; - _EffectFilterType = ISource::FilterLowPass; - _DirectFilterEnabled = false; - _EffectFilterEnabled = false; - _DirectFilterPassGain = NLSOUND_DEFAULT_FILTER_PASS_GAIN; - _EffectFilterPassGain = NLSOUND_DEFAULT_FILTER_PASS_GAIN; - // create the al source alGenSources(1, &_Source); alTestError(); - + // configure rolloff - if (!soundDriver || soundDriver->getOption(ISoundDriver::OptionManualRolloff)) + if (soundDriver->getOption(ISoundDriver::OptionManualRolloff)) { alSourcef(_Source, AL_ROLLOFF_FACTOR, 0); alTestError(); @@ -73,16 +56,15 @@ CSourceAL::CSourceAL(CSoundDriverAL *soundDriver):ISource(), _SoundDriver(NULL), alSourcef(_Source, AL_ROLLOFF_FACTOR, soundDriver->getRolloffFactor()); alTestError(); } - + // create filters - if (soundDriver && soundDriver->getOption(ISoundDriver::OptionEnvironmentEffects)) + if (soundDriver->getOption(ISoundDriver::OptionEnvironmentEffects)) { alGenFilters(1, &_DirectFilter); alFilteri(_DirectFilter, AL_FILTER_TYPE, AL_FILTER_LOWPASS); alFilterf(_DirectFilter, AL_LOWPASS_GAIN, NLSOUND_DEFAULT_DIRECT_GAIN); alFilterf(_DirectFilter, AL_LOWPASS_GAINHF, NLSOUND_DEFAULT_FILTER_PASS_GAIN); alTestError(); - alGenFilters(1, &_EffectFilter); alFilteri(_EffectFilter, AL_FILTER_TYPE, AL_FILTER_LOWPASS); alFilterf(_EffectFilter, AL_LOWPASS_GAIN, NLSOUND_DEFAULT_EFFECT_GAIN); @@ -103,8 +85,6 @@ CSourceAL::~CSourceAL() void CSourceAL::release() { - unqueueBuffers(); - removeBuffers(); if (_Source != AL_NONE) { alDeleteSources(1, &_Source); _Source = AL_NONE; } if (_DirectFilter != AL_FILTER_NULL) { alDeleteFilters(1, &_DirectFilter); _DirectFilter = AL_FILTER_NULL; } if (_EffectFilter != AL_FILTER_NULL) { alDeleteFilters(1, &_EffectFilter); _EffectFilter = AL_FILTER_NULL; } @@ -114,39 +94,21 @@ void CSourceAL::release() /// (Internal) Update the 3d changes. void CSourceAL::updateManualRolloff() { - CVector pos = getPos(); - - // make relative to listener (if not already!) - if (!_PosRelative) - pos -= CListenerAL::getInstance()->getPos(); - - float sqrdist = pos.sqrnorm(); - float rolloff = ISource::computeManualRolloff(_Alpha, sqrdist, _MinDistance, _MaxDistance); - float volume = _Gain * rolloff; - - // apply SFX volume - if (_SoundDriver && _Type == SourceSound) - volume *= _SoundDriver->getGain(); - - // set the attenuated volume - alSourcef(_Source, AL_GAIN, volume); + CVector distanceVector = _RelativeMode ? _Pos : (_Pos - CListenerAL::getInstance()->getPos()); + float distanceSquare = distanceVector.sqrnorm(); + float rolloff = ISource::computeManualRolloff(_Alpha, distanceSquare, _MinDistance, _MaxDistance); + alSourcef(_Source, AL_GAIN, _Gain * rolloff); alTestError(); -} - -/// Set type of the source -void CSourceAL::setType(TSourceType type) -{ - _Type = type; -} - -/// Get type of the source -TSourceType CSourceAL::getType() const -{ - return _Type; +#ifdef NLSOUND_DEBUG_GAIN + ALfloat gain; + alGetSourcef(_Source, AL_GAIN, &gain); + nlwarning("Called updateManualRolloff(), physical gain is %f, configured gain is %f, distanceSquare is %f, rolloff is %f", gain, _Gain, distanceSquare, rolloff); + alTestError(); +#endif } /// Enable or disable streaming mode. Source must be stopped to call this. -void CSourceAL::setStreaming(bool /* streaming */) +void CSourceAL::setStreaming(bool streaming) { nlassert(isStopped()); @@ -154,6 +116,7 @@ void CSourceAL::setStreaming(bool /* streaming */) alSourcei(_Source, AL_BUFFER, AL_NONE); alTestError(); _Buffer = NULL; + _IsStreaming = streaming; } /* Set the buffer that will be played (no streaming) @@ -199,11 +162,10 @@ void CSourceAL::submitStreamingBuffer(IBuffer *buffer) CBufferAL *bufferAL = static_cast(buffer); ALuint bufferName = bufferAL->bufferName(); nlassert(bufferName); - - // queue the buffer alSourceQueueBuffers(_Source, 1, &bufferName); alTestError(); - + _QueuedBuffers.push(bufferAL); + // Resume playback if the internal OpenAL source stopped due to buffer underrun. ALint srcstate; alGetSourcei(_Source, AL_SOURCE_STATE, &srcstate); @@ -218,11 +180,23 @@ void CSourceAL::submitStreamingBuffer(IBuffer *buffer) /// Return the amount of buffers in the queue (playing and waiting). 3 buffers is optimal. uint CSourceAL::countStreamingBuffers() const { + // a bit ugly here, but makes a much easier/simpler implementation on both drivers + ALint buffersProcessed; + alGetSourcei(_Source, AL_BUFFERS_PROCESSED, &buffersProcessed); + while (buffersProcessed) + { + ALuint bufferName = _QueuedBuffers.front()->bufferName(); + alSourceUnqueueBuffers(_Source, 1, &bufferName); + alTestError(); + const_cast &>(_QueuedBuffers).pop(); + --buffersProcessed; + } // return how many are left in the queue - ALint buffersQueued; - alGetSourcei(_Source, AL_BUFFERS_QUEUED, &buffersQueued); - alTestError(); - return (uint)buffersQueued; + //ALint buffersQueued; + //alGetSourcei(_SourceName, AL_BUFFERS_QUEUED, &buffersQueued); + //alTestError(); + //return (uint)buffersQueued; + return (uint)_QueuedBuffers.size(); } /// Set looping on/off for future playbacks (default: off) @@ -244,28 +218,44 @@ bool CSourceAL::getLooping() const /// Play the static buffer (or stream in and play) bool CSourceAL::play() { - if ( _Buffer != NULL ) +#ifdef NLSOUND_DEBUG_GAIN + if (_IsStreaming) + { + nlwarning("Called play on a streaming source"); + } +#endif + + // Commit 3D changes before starting play + if (_SoundDriver->getOption(ISoundDriver::OptionManualRolloff)) + updateManualRolloff(); + + if (_Buffer) { // Static playing mode _IsPaused = false; alSourcePlay(_Source); - _IsPlaying = alGetError() == AL_NO_ERROR; + _IsPlaying = (alGetError() == AL_NO_ERROR); if (_IsPlaying) _StartTime = CTime::getLocalTime(); return _IsPlaying; } - else + else if (_IsStreaming) { - // TODO: Verify streaming mode? _IsPaused = false; alSourcePlay(_Source); - _IsPlaying = true; - _StartTime = CTime::getLocalTime(); - return true; + _IsPlaying = (alGetError() == AL_NO_ERROR); + if (_IsPlaying) + _StartTime = CTime::getLocalTime(); // TODO: Played time should freeze when buffering fails, and be calculated based on the number of buffers played plus passed time. This is necessary for synchronizing animation with sound. + return _IsPlaying; // Streaming mode //nlwarning("AL: Cannot play null buffer; streaming not implemented" ); //nlstop; } + else + { + nlwarning("Invalid play call, not streaming and no static buffer assigned"); + return false; + } } /// Stop playing @@ -288,8 +278,14 @@ void CSourceAL::stop() _IsPaused = false; alSourceStop(_Source); alTestError(); - - unqueueBuffers(); + // unqueue buffers + while (_QueuedBuffers.size()) + { + ALuint bufferName = _QueuedBuffers.front()->bufferName(); + alSourceUnqueueBuffers(_Source, 1, &bufferName); + _QueuedBuffers.pop(); + alTestError(); + } // Streaming mode //nlwarning("AL: Cannot stop null buffer; streaming not implemented" ); //nlstop; @@ -379,8 +375,7 @@ bool CSourceAL::isPaused() const uint32 CSourceAL::getTime() { if (!_StartTime) return 0; - - return (uint32)(CTime::getLocalTime() - _StartTime); + return (uint32)(CTime::getLocalTime() - _StartTime); } /// Set the position vector. @@ -438,27 +433,28 @@ void CSourceAL::getDirection( NLMISC::CVector& dir ) const void CSourceAL::setGain(float gain) { _Gain = std::min(std::max(gain, NLSOUND_MIN_GAIN), NLSOUND_MAX_GAIN); - - if ((_SoundDriver == NULL) || !_SoundDriver->getOption(ISoundDriver::OptionManualRolloff)) + if (!_SoundDriver->getOption(ISoundDriver::OptionManualRolloff)) { - float gain = _Gain; - - // apply SFX volume - if (_SoundDriver && _Type == SourceSound) - gain *= _SoundDriver->getGain(); - - alSourcef(_Source, AL_GAIN, gain); + alSourcef(_Source, AL_GAIN, _Gain); alTestError(); } +#ifdef NLSOUND_DEBUG_GAIN + else + { + nlwarning("Called setGain(), manual rolloff, commit deferred to play or update, physical gain is %f, configured gain is %f", gain, _Gain); + } +#endif } /// Get the gain float CSourceAL::getGain() const { - //ALfloat gain; - //alGetSourcef(_Source, AL_GAIN, &gain); - //alTestError(); - //return gain; +#ifdef NLSOUND_DEBUG_GAIN + ALfloat gain; + alGetSourcef(_Source, AL_GAIN, &gain); + nlwarning("Called getGain(), physical gain is %f, configured gain is %f", gain, _Gain); + alTestError(); +#endif return _Gain; } @@ -481,7 +477,7 @@ float CSourceAL::getPitch() const /// Set the source relative mode. If true, positions are interpreted relative to the listener position. void CSourceAL::setSourceRelativeMode( bool mode ) { - _PosRelative = mode; + _RelativeMode = mode; alSourcei(_Source, AL_SOURCE_RELATIVE, mode?AL_TRUE:AL_FALSE ); alTestError(); } @@ -489,21 +485,28 @@ void CSourceAL::setSourceRelativeMode( bool mode ) /// Get the source relative mode (3D mode only) bool CSourceAL::getSourceRelativeMode() const { - return _PosRelative; -// ALint b; -// alGetSourcei(_Source, AL_SOURCE_RELATIVE, &b ); -// alTestError(); -// return (b==AL_TRUE); + //ALint b; + //alGetSourcei(_Source, AL_SOURCE_RELATIVE, &b ); + //alTestError(); + //return (b==AL_TRUE); + return _RelativeMode; } /// Set the min and max distances (3D mode only) void CSourceAL::setMinMaxDistances( float mindist, float maxdist, bool /* deferred */) { nlassert( (mindist >= 0.0f) && (maxdist >= 0.0f) ); + + static float maxSqrt = sqrt(std::numeric_limits::max()); + if (maxdist >= maxSqrt) + { + nlwarning("SOUND_DEV (OpenAL): Ridiculously high max distance set on source"); + maxdist = maxSqrt; + } + _MinDistance = mindist; _MaxDistance = maxdist; - - if (!_SoundDriver || !_SoundDriver->getOption(ISoundDriver::OptionManualRolloff)) + if (!_SoundDriver->getOption(ISoundDriver::OptionManualRolloff)) { alSourcef(_Source, AL_REFERENCE_DISTANCE, mindist); alSourcef(_Source, AL_MAX_DISTANCE, maxdist); @@ -805,122 +808,4 @@ float CSourceAL::getEffectFilterPassGain() const return _EffectFilterPassGain; } -/// Get already processed buffers and unqueue them -void CSourceAL::getProcessedStreamingBuffers(std::vector &buffers) -{ - // get the number of processed buffers - ALint buffersProcessed; - alGetSourcei(_Source, AL_BUFFERS_PROCESSED, &buffersProcessed); - alTestError(); - - // exit if more processed buffer than allocated ones - if ((uint)buffersProcessed > _BuffersMax) return; - - // unqueue all previously processed buffers and get their name - alSourceUnqueueBuffers(_Source, buffersProcessed, &(_BuffersName[0])); - alTestError(); - - // add each processed buffer to the array - for(uint i = 0; i < (uint)buffersProcessed; ++i) - { - // if buffer is found, return it - std::map::const_iterator it = _Buffers.find(_BuffersName[i]); - if (it != _Buffers.end()) - buffers.push_back(it->second); - } -} - -/// Get all existing buffers -void CSourceAL::getStreamingBuffers(std::vector &buffers) -{ - std::map::const_iterator it = _Buffers.begin(), iend = _Buffers.end(); - while(it != iend) - { - buffers.push_back(it->second); - ++it; - } -} - -/// Unqueue all buffers -void CSourceAL::unqueueBuffers() -{ - // get count of buffers in queue - uint count = countStreamingBuffers(); - - if (count > 0) - { - // unqueue all of them - alSourceUnqueueBuffers(_Source, count, &(_BuffersName[0])); - alTestError(); - } -} - -/// Delete all allocated buffers -void CSourceAL::removeBuffers() -{ - // delete each buffer - std::map::const_iterator it = _Buffers.begin(), iend = _Buffers.end(); - while(it != iend) - { - delete it->second; - ++it; - } - - _Buffers.clear(); -} - -/// Get available streaming buffers count -uint CSourceAL::getStreamingBuffersMax() const -{ - return _BuffersMax; -} - -/// Set available streaming buffers count and allocate them -void CSourceAL::setStreamingBuffersMax(uint buffers) -{ - // remember previous value - uint oldBuffersMax = _BuffersMax; - - _BuffersMax = buffers; - - // resize the temporary buffer names array - _BuffersName.resize(buffers); - - // remove all buffers - unqueueBuffers(); - removeBuffers(); - - for(uint i = 0; i < _BuffersMax; ++i) - { - try - { - // create a new buffer - CBufferAL *buffer = static_cast(_SoundDriver->createBuffer()); - // use StorageSoftware because buffers will be reused - // deleting and recreating them is a waste of time - buffer->setStorageMode(IBuffer::StorageSoftware); - _Buffers[buffer->bufferName()] = buffer; - } - catch(const ESoundDriverGenBuf &e) - { - nlwarning("Cannot create %d buffers. openal fails after %d buffers", buffers, i); - _BuffersMax = i; - _BuffersName.resize(i); - break; - } - } -} - -/// Set the default size for streaming buffers -void CSourceAL::setStreamingBufferSize(uint size) -{ - _BufferSize = size; -} - -/// Get the default size for streaming buffers -uint CSourceAL::getStreamingBufferSize() const -{ - return _BufferSize; -} - } // NLSOUND diff --git a/code/nel/src/sound/driver/openal/source_al.h b/code/nel/src/sound/driver/openal/source_al.h index b5611b997..53c77cb7f 100644 --- a/code/nel/src/sound/driver/openal/source_al.h +++ b/code/nel/src/sound/driver/openal/source_al.h @@ -17,17 +17,14 @@ #ifndef NL_SOURCE_AL_H #define NL_SOURCE_AL_H -#include "nel/sound/driver/source.h" +#include -namespace NLSOUND -{ +namespace NLSOUND { class IBuffer; class CBufferAL; class CSoundDriverAL; class CEffectAL; - enum TSourceType { SourceSound, SourceMusic }; - /** * OpenAL sound source * @@ -50,29 +47,22 @@ private: /// Sound driver CSoundDriverAL *_SoundDriver; + /// Assigned buffer object + CBufferAL *_Buffer; + std::queue _QueuedBuffers; + /// AL Handles ALuint _Source; ALuint _DirectFilter, _EffectFilter; - - /// Assigned buffer object - CBufferAL *_Buffer; - /// Queued buffers map (uint is buffer name) - std::map _Buffers; - - /// Temporary queued buffers array - std::vector _BuffersName; - /// Max count of queued buffers allowed - uint _BuffersMax; - /// Default size of a buffer - uint _BufferSize; - - /// Position is relative to listener - bool _PosRelative; - + /// Playing status bool _IsPlaying; bool _IsPaused; - NLMISC::TTime _StartTime; + NLMISC::TTime _StartTime; + + bool _IsStreaming; + bool _RelativeMode; + NLMISC::CVector _Pos; float _Gain; double _Alpha; @@ -90,9 +80,6 @@ private: TFilter _DirectFilterType, _EffectFilterType; bool _DirectFilterEnabled, _EffectFilterEnabled; float _DirectFilterPassGain, _EffectFilterPassGain; - - /// Source type can be SourceSound or SourceMusic - TSourceType _Type; public: /// Constructor @@ -104,13 +91,8 @@ public: void release(); /// Return the OpenAL source name - ALuint getSource() const { return _Source; } - - /// Set type of the source - void setType(TSourceType type); - /// Get type of the source - TSourceType getType() const; - + inline ALuint getSource() const { return _Source; } + /// (Internal) Set the effect send for this source, NULL to disable. void setEffect(CEffectAL *effect); /// (Internal) Setup the direct send filter. @@ -275,22 +257,6 @@ public: virtual float getEffectFilterPassGain() const; //@} - /// Get already processed buffers and unqueue them - void getProcessedStreamingBuffers(std::vector &buffers); - /// Get all existing buffers - void getStreamingBuffers(std::vector &buffers); - /// Unqueue all buffers - void unqueueBuffers(); - /// Delete all allocated buffers - void removeBuffers(); - /// Get available streaming buffers count - uint getStreamingBuffersMax() const; - /// Set available streaming buffers count and allocate them - void setStreamingBuffersMax(uint max); - /// Set the default size for streaming buffers - void setStreamingBufferSize(uint size); - /// Get the default size for streaming buffers - uint getStreamingBufferSize() const; }; } // NLSOUND diff --git a/code/nel/src/sound/driver/openal/stdopenal.h b/code/nel/src/sound/driver/openal/stdopenal.h index 12960d57f..1661ef6fe 100644 --- a/code/nel/src/sound/driver/openal/stdopenal.h +++ b/code/nel/src/sound/driver/openal/stdopenal.h @@ -58,6 +58,5 @@ #include "nel/sound/driver/source.h" #include "nel/sound/driver/listener.h" #include "nel/sound/driver/effect.h" -#include "nel/sound/driver/music_buffer.h" /* end of file */ diff --git a/code/nel/src/sound/driver/source.cpp b/code/nel/src/sound/driver/source.cpp index ace98ff81..2f96d74d8 100644 --- a/code/nel/src/sound/driver/source.cpp +++ b/code/nel/src/sound/driver/source.cpp @@ -26,15 +26,12 @@ namespace NLSOUND // common method used only with OptionManualRolloff. return the volume in 1/100th DB ( = mB) modified sint32 ISource::computeManualRollOff(sint32 volumeMB, sint32 mbMin, sint32 mbMax, double alpha, float sqrdist, float distMin, float distMax) { - // root square of max float value - static float maxSqrt = sqrt(std::numeric_limits::max()); - if (sqrdist < distMin * distMin) { // no attenuation return volumeMB; } - else if ((distMax < maxSqrt) && (sqrdist > distMax * distMax)) + else if (sqrdist > distMax * distMax) { // full attenuation return mbMin; diff --git a/code/nel/src/sound/driver/xaudio2/music_channel_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/music_channel_xaudio2.cpp deleted file mode 100644 index 4110ecf41..000000000 --- a/code/nel/src/sound/driver/xaudio2/music_channel_xaudio2.cpp +++ /dev/null @@ -1,248 +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 "stdxaudio2.h" - -// Project includes -#include "sound_driver_xaudio2.h" -#include "music_channel_xaudio2.h" - -using namespace std; -using namespace NLMISC; - -namespace NLSOUND { - -CMusicChannelXAudio2::CMusicChannelXAudio2(CSoundDriverXAudio2 *soundDriver) -: _MusicBuffer(NULL), _SourceVoice(NULL), _BufferPos(0), _SoundDriver(soundDriver), _Gain(1.0) -{ - nlwarning(NLSOUND_XAUDIO2_PREFIX "Initializing CMusicChannelXAudio2"); - - stop(); -} - -CMusicChannelXAudio2::~CMusicChannelXAudio2() -{ - release(); - if (_SoundDriver) { _SoundDriver->removeMusicChannel(this); _SoundDriver = NULL; } - - nlwarning(NLSOUND_XAUDIO2_PREFIX "Destroying CMusicChannelXAudio2"); -} - -void CMusicChannelXAudio2::release() -{ - nlwarning(NLSOUND_XAUDIO2_PREFIX "Releasing CMusicChannelXAudio2"); - - stop(); -} - -/** Play some music (.ogg etc...) - * NB: if an old music was played, it is first stop with stopMusic() - * \param filepath file path, CPath::lookup is done here - * \param async stream music from hard disk, preload in memory if false - * \param loop must be true to play the music in loop. - */ -bool CMusicChannelXAudio2::play(const std::string &filepath, bool async, bool loop) -{ - // nlinfo(NLSOUND_XAUDIO2_PREFIX "play %s %u", filepath.c_str(), (uint32)loop); - - _SoundDriver->performanceIncreaseMusicPlayCounter(); - - HRESULT hr; - - stop(); - - _MusicBuffer = IMusicBuffer::createMusicBuffer(filepath, async, loop); - - if (_MusicBuffer) - { - WAVEFORMATEX wfe; - wfe.cbSize = 0; - wfe.wFormatTag = WAVE_FORMAT_PCM; // todo: getFormat(); - wfe.nChannels = _MusicBuffer->getChannels(); - wfe.wBitsPerSample = _MusicBuffer->getBitsPerSample(); - wfe.nSamplesPerSec = _MusicBuffer->getSamplesPerSec(); - wfe.nBlockAlign = wfe.nChannels * wfe.wBitsPerSample / 8; - wfe.nAvgBytesPerSec = wfe.nSamplesPerSec * wfe.nBlockAlign; - - XAUDIO2_VOICE_DETAILS voice_details; - _SoundDriver->getMasteringVoice()->GetVoiceDetails(&voice_details); - - // nlinfo(NLSOUND_XAUDIO2_PREFIX "Creating music voice with %u channels, %u bits per sample, %u samples per sec, " - // "on mastering voice with %u channels, %u samples per sec", - // (uint32)wfe.nChannels, (uint32)wfe.wBitsPerSample, (uint32)wfe.nSamplesPerSec, - // (uint32)voice_details.InputChannels, (uint32)voice_details.InputSampleRate); - - if (FAILED(hr = _SoundDriver->getXAudio2()->CreateSourceVoice(&_SourceVoice, &wfe, XAUDIO2_VOICE_NOPITCH, 1.0f, this, NULL, NULL))) - { - nlwarning(NLSOUND_XAUDIO2_PREFIX "FAILED CreateSourceVoice"); - stop(); return false; - } - - _SourceVoice->SetVolume(_Gain); - _SourceVoice->Start(0); - } - else - { - nlwarning(NLSOUND_XAUDIO2_PREFIX "no _MusicBuffer"); - return false; - } - - return true; -} - -/// Stop the music previously loaded and played (the Memory is also freed) -void CMusicChannelXAudio2::stop() -{ - if (_SourceVoice) { _SourceVoice->DestroyVoice(); _SourceVoice = NULL; } - if (_MusicBuffer) { delete _MusicBuffer; _MusicBuffer = NULL; } - // memset(_Buffer, 0, sizeof(_Buffer)); - _BufferPos = 0; -} - -/** Pause the music previously loaded and played (the Memory is not freed) - */ -void CMusicChannelXAudio2::pause() -{ - if (_SourceVoice) _SourceVoice->Stop(0); -} - -/// Resume the music previously paused -void CMusicChannelXAudio2::resume() -{ - if (_SourceVoice) _SourceVoice->Start(0); -} - -/// Return true if a song is finished. -bool CMusicChannelXAudio2::isEnded() -{ - if (_MusicBuffer) - { - if (!_MusicBuffer->isMusicEnded()) - return false; - } - if (_SourceVoice) - { - XAUDIO2_VOICE_STATE voice_state; - _SourceVoice->GetState(&voice_state); - if (voice_state.BuffersQueued) - { - // nldebug(NLSOUND_XAUDIO2_PREFIX "isEnded() -> voice_state.BuffersQueued, wait ..."); - return false; - } - } - // nldebug(NLSOUND_XAUDIO2_PREFIX "isEnded() -> stop()"); - stop(); - return true; -} - -/// Return true if the song is still loading asynchronously and hasn't started playing yet (false if not async), used to delay fading -bool CMusicChannelXAudio2::isLoadingAsync() -{ - return false; -} - -/// Return the total length (in second) of the music currently played -float CMusicChannelXAudio2::getLength() -{ - if (_MusicBuffer) return _MusicBuffer->getLength(); - else return .0f; -} - -/** Set the music volume (if any music played). (volume value inside [0 , 1]) (default: 1) - * NB: the volume of music is NOT affected by IListener::setGain() - */ -void CMusicChannelXAudio2::setVolume(float gain) -{ - _Gain = gain; - if (_SourceVoice) _SourceVoice->SetVolume(gain); -} - -void CMusicChannelXAudio2::OnVoiceProcessingPassStart(UINT32 BytesRequired) -{ - if (BytesRequired > 0) - { - // nlwarning(NLSOUND_XAUDIO2_PREFIX "Bytes Required: %u", BytesRequired); // byte req to not have disruption - - if (_MusicBuffer) - { - uint32 minimum = BytesRequired * 2; // give some more than required :p - if (_MusicBuffer->getRequiredBytes() > minimum) minimum = _MusicBuffer->getRequiredBytes(); - if (minimum > sizeof(_Buffer) - _BufferPos) _BufferPos = 0; - uint32 maximum = sizeof(_Buffer) - _BufferPos; - uint8 *buffer = &_Buffer[_BufferPos]; - uint32 length = _MusicBuffer->getNextBytes(buffer, minimum, maximum); - _BufferPos += length; - - if (length) - { - XAUDIO2_BUFFER xbuffer; - xbuffer.AudioBytes = length; - xbuffer.Flags = 0; - xbuffer.LoopBegin = 0; - xbuffer.LoopCount = 0; - xbuffer.LoopLength = 0; - xbuffer.pAudioData = buffer; - xbuffer.pContext = NULL; // nothing here for now - xbuffer.PlayBegin = 0; - xbuffer.PlayLength = 0; - - _SourceVoice->SubmitSourceBuffer(&xbuffer); - } - else - { - // nldebug(NLSOUND_XAUDIO2_PREFIX "!length -> delete _MusicBuffer"); - // set member var to null before deleting it to avoid crashing main thread - IMusicBuffer *music_buffer = _MusicBuffer; - _MusicBuffer = NULL; delete music_buffer; - _SourceVoice->Discontinuity(); - } - } - } -} - -void CMusicChannelXAudio2::OnVoiceProcessingPassEnd() -{ - -} - -void CMusicChannelXAudio2::OnStreamEnd() -{ - -} - -void CMusicChannelXAudio2::OnBufferStart(void * /* pBufferContext */) -{ - -} - -void CMusicChannelXAudio2::OnBufferEnd(void * /* pBufferContext */) -{ - -} - -void CMusicChannelXAudio2::OnLoopEnd(void * /* pBufferContext */) -{ - -} - -void CMusicChannelXAudio2::OnVoiceError(void * /* pBufferContext */, HRESULT /* Error */) -{ - -} - -} /* namespace NLSOUND */ - -/* end of file */ diff --git a/code/nel/src/sound/driver/xaudio2/music_channel_xaudio2.h b/code/nel/src/sound/driver/xaudio2/music_channel_xaudio2.h deleted file mode 100644 index ade13e25f..000000000 --- a/code/nel/src/sound/driver/xaudio2/music_channel_xaudio2.h +++ /dev/null @@ -1,117 +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 NLSOUND_MUSIC_CHANNEL_XAUDIO2_H -#define NLSOUND_MUSIC_CHANNEL_XAUDIO2_H - -#include - -namespace NLSOUND { - class CSoundDriverXAudio2; - class IMusicBuffer; - -/** - * \brief CMusicChannelXAudio2 - * \date 2008-08-30 13:31GMT - * \author Jan Boon (Kaetemi) - * CMusicChannelXAudio2 is an implementation of the IMusicChannel interface to run on XAudio2. - * TODO: Properly decode the audio on a seperate thread. - * TODO: Change IMusicChannel to IAudioStream, and fix the interface to make more sense. - */ -class CMusicChannelXAudio2 : public IMusicChannel, IXAudio2VoiceCallback -{ -protected: - // outside pointers - CSoundDriverXAudio2 *_SoundDriver; - - // pointers - IMusicBuffer *_MusicBuffer; - IXAudio2SourceVoice *_SourceVoice; - // todo: thread for async loading of music buffer and source voice - // isasyncloading checks if thread exists - // isended checks if not async loading too - - // instances - uint8 _Buffer[64 * 1024]; // no specific reason, lol - uint32 _BufferPos; // 0 - float _Gain; - -public: - CMusicChannelXAudio2(CSoundDriverXAudio2 *soundDriver); - virtual ~CMusicChannelXAudio2(); - void release(); - -private: - // XAudio2 Callbacks - // Called just before this voice's processing pass begins. - STDMETHOD_(void, OnVoiceProcessingPassStart) (THIS_ UINT32 BytesRequired); - // Called just after this voice's processing pass ends. - STDMETHOD_(void, OnVoiceProcessingPassEnd) (THIS); - // Called when this voice has just finished playing a buffer stream - // (as marked with the XAUDIO2_END_OF_STREAM flag on the last buffer). - STDMETHOD_(void, OnStreamEnd) (THIS); - // Called when this voice is about to start processing a new buffer. - STDMETHOD_(void, OnBufferStart) (THIS_ void* pBufferContext); - // Called when this voice has just finished processing a buffer. - // The buffer can now be reused or destroyed. - STDMETHOD_(void, OnBufferEnd) (THIS_ void* pBufferContext); - // Called when this voice has just reached the end position of a loop. - STDMETHOD_(void, OnLoopEnd) (THIS_ void* pBufferContext); - // Called in the event of a critical error during voice processing, - // such as a failing XAPO or an error from the hardware XMA decoder. - // The voice may have to be destroyed and re-created to recover from - // the error. The callback arguments report which buffer was being - // processed when the error occurred, and its HRESULT code. - STDMETHOD_(void, OnVoiceError) (THIS_ void* pBufferContext, HRESULT Error); - -public: - /** Play some music (.ogg etc...) - * NB: if an old music was played, it is first stop with stopMusic() - * \param filepath file path, CPath::lookup is done here - * \param async stream music from hard disk, preload in memory if false - * \param loop must be true to play the music in loop. - */ - virtual bool play(const std::string &filepath, bool async, bool loop); - - /// Stop the music previously loaded and played (the Memory is also freed) - virtual void stop(); - - /// Pause the music previously loaded and played (the Memory is not freed) - virtual void pause(); - - /// Resume the music previously paused - virtual void resume(); - - /// Return true if a song is finished. - virtual bool isEnded(); - - /// Return true if the song is still loading asynchronously and hasn't started playing yet (false if not async), used to delay fading - virtual bool isLoadingAsync(); - - /// Return the total length (in second) of the music currently played - virtual float getLength(); - - /** Set the music volume (if any music played). (volume value inside [0 , 1]) (default: 1) - * NB: the volume of music is NOT affected by IListener::setGain() - */ - virtual void setVolume(float gain); -}; /* class CMusicChannelXAudio2 */ - -} /* namespace NLSOUND */ - -#endif /* #ifndef NLSOUND_MUSIC_CHANNEL_XAUDIO2_H */ - -/* end of file */ diff --git a/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp index 826f9973b..7c4ea9bbf 100644 --- a/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp +++ b/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.cpp @@ -19,7 +19,6 @@ // Project includes #include "listener_xaudio2.h" #include "source_xaudio2.h" -#include "music_channel_xaudio2.h" #include "effect_xaudio2.h" #include "sound_driver_xaudio2.h" @@ -132,8 +131,7 @@ CSoundDriverXAudio2::CSoundDriverXAudio2(ISoundDriver::IStringMapperProvider * / : _XAudio2(NULL), _MasteringVoice(NULL), _Listener(NULL), _SoundDriverOk(false), _CoInitOk(false), _OperationSetCounter(65536), _PerformanceCommit3DCounter(0), _PerformanceADPCMBufferSize(0), - _PerformancePCMBufferSize(0), _PerformanceMusicPlayCounter(0), - _PerformanceSourcePlayCounter(0) + _PerformancePCMBufferSize(0), _PerformanceSourcePlayCounter(0) { nlwarning(NLSOUND_XAUDIO2_PREFIX "Creating CSoundDriverXAudio2"); @@ -200,14 +198,6 @@ void CSoundDriverXAudio2::release() // WARNING: Only internal resources are released here, // the created instances must still be released by the user! - // Release internal resources of all remaining IMusicChannel instances - if (_MusicChannels.size()) - { - nlwarning(NLSOUND_XAUDIO2_PREFIX "_MusicChannels.size(): '%u'", (uint32)_MusicChannels.size()); - set::iterator it(_MusicChannels.begin()), end(_MusicChannels.end()); - for (; it != end; ++it) (*it)->release(); - _MusicChannels.clear(); - } // Release internal resources of all remaining ISource instances if (_Sources.size()) { @@ -396,14 +386,6 @@ void CSoundDriverXAudio2::destroySourceVoice(IXAudio2SourceVoice *sourceVoice) if (sourceVoice) sourceVoice->DestroyVoice(); } -/// Create a music channel -IMusicChannel *CSoundDriverXAudio2::createMusicChannel() -{ - CMusicChannelXAudio2 *music_channel = new CMusicChannelXAudio2(this); - _MusicChannels.insert(music_channel); - return static_cast(music_channel); -} - /// Create the listener instance IListener *CSoundDriverXAudio2::createListener() { @@ -481,7 +463,6 @@ void CSoundDriverXAudio2::writeProfile(std::string& out) + "\n\tPCMBufferSize: " + toString(_PerformancePCMBufferSize) + "\n\tADPCMBufferSize: " + toString(_PerformanceADPCMBufferSize) + "\n\tSourcePlayCounter: " + toString(_PerformanceSourcePlayCounter) - + "\n\tMusicPlayCounter: " + toString(_PerformanceMusicPlayCounter) + "\n\tCommit3DCounter: " + toString(_PerformanceCommit3DCounter) + "\nXAUDIO2_PERFORMANCE_DATA" + "\n\tAudioCyclesSinceLastQuery: " + toString(performance.AudioCyclesSinceLastQuery) @@ -519,17 +500,6 @@ void CSoundDriverXAudio2::displayBench(NLMISC::CLog *log) NLMISC::CHTimer::display(log, CHTimer::TotalTime); } -/** Get music info. Returns false if the song is not found or the function is not implemented. - * \param filepath path to file, CPath::lookup done by driver - * \param artist returns the song artist (empty if not available) - * \param title returns the title (empty if not available) - */ -bool CSoundDriverXAudio2::getMusicInfo(const std::string &filepath, std::string &artist, std::string &title) -{ - // add support for additional non-standard music file types info here - return IMusicBuffer::getInfo(filepath, artist, title); -} - /// Remove a buffer (should be called by the friend destructor of the buffer class) void CSoundDriverXAudio2::removeBuffer(CBufferXAudio2 *buffer) { @@ -543,13 +513,6 @@ void CSoundDriverXAudio2::removeSource(CSourceXAudio2 *source) if (_Sources.find(source) != _Sources.end()) _Sources.erase(source); else nlwarning("removeSource already called"); } - -/// (Internal) Remove a source (should be called by the destructor of the source class). -void CSoundDriverXAudio2::removeMusicChannel(CMusicChannelXAudio2 *musicChannel) -{ - if (_MusicChannels.find(musicChannel) != _MusicChannels.end()) _MusicChannels.erase(musicChannel); - else nlwarning("removeMusicChannel already called"); -} /// (Internal) Remove an effect (should be called by the destructor of the effect class) void CSoundDriverXAudio2::removeEffect(CEffectXAudio2 *effect) diff --git a/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.h b/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.h index 681d36254..bcf847a5f 100644 --- a/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.h +++ b/code/nel/src/sound/driver/xaudio2/sound_driver_xaudio2.h @@ -62,8 +62,6 @@ protected: std::set _Sources; /// Array with the allocated effects created by client code. std::set _Effects; - /// Array with the allocated music channels created by client code. - std::set _MusicChannels; /// Initialization Handle of X3DAudio. X3DAUDIO_HANDLE _X3DAudioHandle; //I /// Operation set counter @@ -73,7 +71,6 @@ protected: uint _PerformancePCMBufferSize; uint _PerformanceADPCMBufferSize; uint _PerformanceSourcePlayCounter; - uint _PerformanceMusicPlayCounter; uint _PerformanceCommit3DCounter; // user init vars @@ -108,8 +105,6 @@ public: } /// (Internal) Increase the source play counter by one. inline void performanceIncreaseSourcePlayCounter() { ++_PerformanceSourcePlayCounter; } - /// (Internal) Increase the music play counter by one. - inline void performanceIncreaseMusicPlayCounter() { ++_PerformanceMusicPlayCounter; } /// (Internal) Increase the commit 3d counter by one. inline void performanceIncreaseCommit3DCounter() { ++_PerformanceCommit3DCounter; } @@ -172,16 +167,6 @@ public: virtual void startBench(); virtual void endBench(); virtual void displayBench(NLMISC::CLog *log); - - /// Create a music channel, destroy with destroyMusicChannel. - virtual IMusicChannel *createMusicChannel(); - - /** Get music info. Returns false if the song is not found or the function is not implemented. - * \param filepath path to file, CPath::lookup done by driver - * \param artist returns the song artist (empty if not available) - * \param title returns the title (empty if not available) - */ - virtual bool getMusicInfo(const std::string &filepath, std::string &artist, std::string &title); /// Get audio/container extensions that are supported natively by the driver implementation. virtual void getMusicExtensions(std::vector & /* extensions */) const { } @@ -192,8 +177,6 @@ public: void removeBuffer(CBufferXAudio2 *buffer); /// (Internal) Remove a source (should be called by the destructor of the source class). void removeSource(CSourceXAudio2 *source); - /// (Internal) Remove a source (should be called by the destructor of the music channel class). - void removeMusicChannel(CMusicChannelXAudio2 *musicChannel); /// (Internal) Remove the listener (should be called by the destructor of the listener class) inline void removeListener(CListenerXAudio2 *listener) { nlassert(_Listener == listener); _Listener = NULL; } /// (Internal) Remove an effect (should be called by the destructor of the effect class) diff --git a/code/nel/src/sound/driver/xaudio2/source_xaudio2.cpp b/code/nel/src/sound/driver/xaudio2/source_xaudio2.cpp index 9c34beaf8..318a65a1a 100644 --- a/code/nel/src/sound/driver/xaudio2/source_xaudio2.cpp +++ b/code/nel/src/sound/driver/xaudio2/source_xaudio2.cpp @@ -42,7 +42,7 @@ _DirectFilterPassGain(NLSOUND_DEFAULT_FILTER_PASS_GAIN), _EffectFilterPassGain(N _DirectFilterLowFrequency(NLSOUND_DEFAULT_FILTER_PASS_LF), _DirectFilterHighFrequency(NLSOUND_DEFAULT_FILTER_PASS_HF), _EffectFilterLowFrequency(NLSOUND_DEFAULT_FILTER_PASS_LF), _EffectFilterHighFrequency(NLSOUND_DEFAULT_FILTER_PASS_HF), _IsPlaying(false), _IsPaused(false), _IsLooping(false), _Pitch(1.0f), -_Gain(1.0f), _MinDistance(1.0f), _MaxDistance(numeric_limits::max()), +_Gain(1.0f), _MinDistance(1.0f), _MaxDistance(sqrt(numeric_limits::max())), _AdpcmUtility(NULL), _Channels(0), _BitsPerSample(0), _BufferStreaming(false) { // nlwarning(NLSOUND_XAUDIO2_PREFIX "Inititializing CSourceXAudio2"); @@ -121,8 +121,7 @@ void CSourceXAudio2::commit3DChanges() { nlassert(_SourceVoice); - // Only mono buffers get 3d sound, multi-channel buffers go directly to the speakers (calculate rolloff too!!). - // Todo: stereo buffers calculate distance ? + // Only mono buffers get 3d sound, multi-channel buffers go directly to the speakers without any distance rolloff. if (_Channels > 1) { // _SoundDriver->getDSPSettings()->DstChannelCount = 1; @@ -494,8 +493,10 @@ bool CSourceXAudio2::initFormat(IBuffer::TBufferFormat bufferFormat, uint8 chann _SourceVoice->SetVolume(_Gain, _OperationSet); setupVoiceSends(); _SoundDriver->getXAudio2()->CommitChanges(_OperationSet); - - + + // Also commit any 3D settings that were already done + commit3DChanges(); + // test //XAUDIO2_VOICE_DETAILS voice_details; //_SourceVoice->GetVoiceDetails(&voice_details); @@ -535,7 +536,7 @@ bool CSourceXAudio2::preparePlay(IBuffer::TBufferFormat bufferFormat, uint8 chan // destroy adpcm utility (if it exists) delete _AdpcmUtility; _AdpcmUtility = NULL; // reset current stuff - _Format = (IBuffer::TBufferFormat)~0; + _Format = IBuffer::FormatNotSet; _Channels = 0; _BitsPerSample = 0; } @@ -582,6 +583,11 @@ bool CSourceXAudio2::play() { // nldebug(NLSOUND_XAUDIO2_PREFIX "play"); + // Commit 3D changes before starting play + if (_SourceVoice) + commit3DChanges(); + // else it is commit by the preparePlay > initFormat function + if (_IsPaused) { if (SUCCEEDED(_SourceVoice->Start(0))) _IsPaused = false; @@ -793,7 +799,14 @@ bool CSourceXAudio2::getSourceRelativeMode() const void CSourceXAudio2::setMinMaxDistances(float mindist, float maxdist, bool /* deferred */) { // nldebug(NLSOUND_XAUDIO2_PREFIX "setMinMaxDistances %f, %f", mindist, maxdist); - + + static float maxSqrt = sqrt(std::numeric_limits::max()); + if (maxdist >= maxSqrt) + { + nlwarning("SOUND_DEV (XAudio2): Ridiculously high max distance set on source"); + maxdist = maxSqrt; + } + _Emitter.InnerRadius = mindist; _MinDistance = mindist; _MaxDistance = maxdist; diff --git a/code/nel/src/sound/driver/xaudio2/stdxaudio2.h b/code/nel/src/sound/driver/xaudio2/stdxaudio2.h index c043f3949..1a1d766e7 100644 --- a/code/nel/src/sound/driver/xaudio2/stdxaudio2.h +++ b/code/nel/src/sound/driver/xaudio2/stdxaudio2.h @@ -57,7 +57,6 @@ #include "nel/sound/driver/listener.h" #include "nel/sound/driver/sound_driver.h" #include "nel/sound/driver/source.h" -#include "nel/sound/driver/music_buffer.h" // Defines #define NLSOUND_XAUDIO2_NAME "NeLSound XAudio2 Driver" diff --git a/code/nel/src/sound/group_controller.cpp b/code/nel/src/sound/group_controller.cpp new file mode 100644 index 000000000..d01e29252 --- /dev/null +++ b/code/nel/src/sound/group_controller.cpp @@ -0,0 +1,129 @@ +/** + * \file group_controller.cpp + * \brief CGroupController + * \date 2012-04-10 09:29GMT + * \author Jan Boon (Kaetemi) + * CGroupController + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#include "stdsound.h" +#include + +// STL includes + +// NeL includes +// #include +#include + +// Project includes + +using namespace std; +// using namespace NLMISC; + +namespace NLSOUND { + +CGroupController::CGroupController(CGroupController *parent) : + m_Parent(parent), m_Gain(1.0f), m_NbSourcesInclChild(0) +{ + +} + +CGroupController::~CGroupController() +{ + // If m_Sources is not empty, a crash is very likely. + nlassert(m_Sources.empty()); + + for (std::map::iterator it(m_Children.begin()), end(m_Children.end()); it != end; ++it) + { + delete it->second; + it->second = NULL; + } + m_Parent = NULL; +} + +void CGroupController::addSource(CSourceCommon *source) +{ + nlassert(this); + + m_Sources.insert(source); + increaseSources(); +} + +void CGroupController::removeSource(CSourceCommon *source) +{ + decreaseSources(); + m_Sources.erase(source); +} + +std::string CGroupController::getPath() // overridden by root +{ + for (std::map::iterator it(m_Parent->m_Children.begin()), end(m_Parent->m_Children.end()); it != end; ++it) + { + if (it->second == this) + { + const std::string &name = it->first; + std::string returnPath = m_Parent->getPath() + ":" + name; + return returnPath; + } + } + nlerror("Group Controller not child of parent"); + return ""; +} + +void CGroupController::calculateFinalGain() // overridden by root +{ + m_FinalGain = calculateTotalGain() * m_Parent->getFinalGain(); +} + +void CGroupController::updateSourceGain() +{ + // Dont update source gain when this controller is inactive. + if (m_NbSourcesInclChild) + { + calculateFinalGain(); + for (TSourceContainer::iterator it(m_Sources.begin()), end(m_Sources.end()); it != end; ++it) + (*it)->updateFinalGain(); + for (std::map::iterator it(m_Children.begin()), end(m_Children.end()); it != end; ++it) + (*it).second->updateSourceGain(); + } +} + +void CGroupController::increaseSources() // overridden by root +{ + ++m_NbSourcesInclChild; + m_Parent->increaseSources(); + + // Update source gain when this controller was inactive before but the parent was active before. + // Thus, when this controller was the root of inactive controllers. + if (m_NbSourcesInclChild == 1 && m_Parent->m_NbSourcesInclChild > 1) + updateSourceGain(); +} + +void CGroupController::decreaseSources() // overridden by root +{ + --m_NbSourcesInclChild; + m_Parent->decreaseSources(); +} + +} /* namespace NLSOUND */ + +/* end of file */ diff --git a/code/nel/src/sound/group_controller_root.cpp b/code/nel/src/sound/group_controller_root.cpp new file mode 100644 index 000000000..0f1c58e63 --- /dev/null +++ b/code/nel/src/sound/group_controller_root.cpp @@ -0,0 +1,127 @@ +/** + * \file group_controller_root.cpp + * \brief CGroupControllerRoot + * \date 2012-04-10 09:44GMT + * \author Jan Boon (Kaetemi) + * CGroupControllerRoot + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#include "stdsound.h" +#include + +// STL includes + +// NeL includes +// #include +#include + +// Project includes + +using namespace std; +// using namespace NLMISC; + +#define NLSOUND_GROUP_CONTROLLER_ROOT_PATH "sound" + +namespace NLSOUND { + +CGroupControllerRoot::CGroupControllerRoot() : CGroupController(NULL) +{ + +} + +CGroupControllerRoot::~CGroupControllerRoot() +{ + +} + +std::string CGroupControllerRoot::getPath() +{ + // The root node is always called sound + return NLSOUND_GROUP_CONTROLLER_ROOT_PATH; +} + +void CGroupControllerRoot::calculateFinalGain() +{ + m_FinalGain = calculateTotalGain(); +} + +void CGroupControllerRoot::increaseSources() +{ + ++m_NbSourcesInclChild; + + // Update source gain when this controller was inactive before. + if (m_NbSourcesInclChild == 1) + updateSourceGain(); +} + +void CGroupControllerRoot::decreaseSources() +{ + --m_NbSourcesInclChild; +} + +bool CGroupControllerRoot::isReservedName(const std::string &nodeName) +{ + // These node names are reserved, in case these category controllers can be integrated with CDB. + // I do not forsee any functionality for changing environment effect settings for entire categories. + // The nodeName parameter is already lowercase, see CGroupControllerRoot::getGroupController. + if (nodeName == NLSOUND_GROUP_CONTROLLER_ROOT_PATH) return true; // Root node name can only used by root. + if (nodeName == "gain") return true; + if (nodeName == "pitch") return true; + if (nodeName == "enable" || nodeName == "enabled") return true; + return false; +} + +CGroupController *CGroupControllerRoot::getGroupController(const std::string &path) +{ + std::vector pathNodes; + NLMISC::splitString(NLMISC::toLower(path), ":", pathNodes); + CGroupController *active = this; + if (pathNodes[0] != NLSOUND_GROUP_CONTROLLER_ROOT_PATH) + { + nlerror("Root node for group controller must always be 'sound', invalid group '%s' requested", path.c_str()); + } + for (std::vector::iterator it(pathNodes.begin() + 1), end(pathNodes.end()); it != end; ++it) + { + if (!(*it).empty()) + { + if (isReservedName(*it)) + { + nlerror("Attempt to use reserved node name '%s' in group controller path '%s'", (*it).c_str(), path.c_str()); + } + std::map::iterator found = active->m_Children.find(*it); + if (found == active->m_Children.end()) + { + active = new CGroupController(active); + active->m_Parent->m_Children[*it] = active; + } + else + { + active = (*found).second; + } + } + } + return active; +} + +} /* namespace NLSOUND */ + +/* end of file */ diff --git a/code/nel/src/sound/music_channel_fader.cpp b/code/nel/src/sound/music_channel_fader.cpp index ced739093..2fe9fb13c 100644 --- a/code/nel/src/sound/music_channel_fader.cpp +++ b/code/nel/src/sound/music_channel_fader.cpp @@ -20,6 +20,7 @@ // Project includes #include "nel/sound/driver/sound_driver.h" #include "nel/sound/driver/music_channel.h" +#include "nel/sound/source_music_channel.h" using namespace std; using namespace NLMISC; @@ -49,9 +50,16 @@ void CMusicChannelFader::init(ISoundDriver *soundDriver) _MusicFader[i].MusicChannel = _SoundDriver->createMusicChannel(); if (!_MusicFader[i].MusicChannel) { - release(); - nlwarning("No music channel available!"); - return; + if (_SoundDriver->getOption(ISoundDriver::OptionHasBufferStreaming)) + { + _MusicFader[i].MusicChannel = new CSourceMusicChannel(); + } + else + { + release(); + nlwarning("No music channel available!"); + return; + } } } } @@ -69,6 +77,15 @@ void CMusicChannelFader::release() } } +void CMusicChannelFader::reset() +{ + for (uint i = 0; i < _MaxMusicFader; ++i) if (_MusicFader[i].MusicChannel) + { + if (_MusicFader[i].MusicChannel) + _MusicFader[i].MusicChannel->reset(); + } +} + void CMusicChannelFader::update() { TTime current_time = CTime::getLocalTime(); diff --git a/code/nel/src/sound/music_sound.cpp b/code/nel/src/sound/music_sound.cpp index 2b192c3c6..803103dd9 100644 --- a/code/nel/src/sound/music_sound.cpp +++ b/code/nel/src/sound/music_sound.cpp @@ -20,6 +20,9 @@ #include "nel/misc/path.h" #include "nel/georges/u_form_elm.h" +#if NLSOUND_SHEET_VERSION_BUILT < 2 +# include "nel/sound/group_controller_root.h" +#endif using namespace std; using namespace NLMISC; @@ -72,6 +75,10 @@ void CMusicSound::importForm(const std::string& filename, NLGEORGES::UFormElm& root.getValueByName(_MinimumPlayTime, ".SoundType.MinimumPlayTime"); root.getValueByName(_TimeBeforeCanReplay, ".SoundType.TimeBeforeCanReplay"); +#if NLSOUND_SHEET_VERSION_BUILT < 2 + _GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_MUSIC_GROUP_CONTROLLER); +#endif + } // *************************************************************************** @@ -97,6 +104,11 @@ void CMusicSound::serial(NLMISC::IStream &s) CStringMapper::serialString(s, _FileName); s.serial(_FadeInLength, _FadeOutLength); s.serial(_MinimumPlayTime, _TimeBeforeCanReplay); + +#if NLSOUND_SHEET_VERSION_BUILT < 2 + if (s.isReading()) _GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_MUSIC_GROUP_CONTROLLER); +#endif + } // *************************************************************************** diff --git a/code/nel/src/sound/music_source.cpp b/code/nel/src/sound/music_source.cpp index a47914dde..e5595d9f4 100644 --- a/code/nel/src/sound/music_source.cpp +++ b/code/nel/src/sound/music_source.cpp @@ -26,8 +26,8 @@ namespace NLSOUND { // *************************************************************************** -CMusicSource::CMusicSource(CMusicSound *musicSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster) - : CSourceCommon(musicSound, spawn, cb, cbUserParam, cluster) +CMusicSource::CMusicSource(CMusicSound *musicSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController) + : CSourceCommon(musicSound, spawn, cb, cbUserParam, cluster, groupController) { _MusicSound= musicSound; } diff --git a/code/nel/src/sound/simple_source.cpp b/code/nel/src/sound/simple_source.cpp index fb0b7bc85..cce62cffd 100644 --- a/code/nel/src/sound/simple_source.cpp +++ b/code/nel/src/sound/simple_source.cpp @@ -28,11 +28,12 @@ using namespace NLMISC; namespace NLSOUND { -CSimpleSource::CSimpleSource(CSimpleSound *simpleSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster) - : CSourceCommon(simpleSound, spawn, cb, cbUserParam, cluster), +CSimpleSource::CSimpleSource(CSimpleSound *simpleSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController) + : CSourceCommon(simpleSound, spawn, cb, cbUserParam, cluster, groupController), _SimpleSound(simpleSound), _Track(NULL), - _PlayMuted(false) + _PlayMuted(false), + _WaitingForPlay(false) { nlassert(_SimpleSound != 0); @@ -133,6 +134,7 @@ void CSimpleSource::play() || (_RelativeMode ? getPos().sqrnorm() : (mixer->getListenPosVector() - getPos()).sqrnorm()) > _SimpleSound->getMaxDistance() * _SimpleSound->getMaxDistance()) { // The sample buffer is not available, don't play (we don't know the length) + _WaitingForPlay = false; if (_Spawn) { if (_SpawnEndCb != 0) @@ -166,7 +168,7 @@ void CSimpleSource::play() setDirection(_Direction); // because there is a workaround inside pSource->setVelocity(_Velocity); } - pSource->setGain(_Gain); + pSource->setGain(getFinalGain()); pSource->setSourceRelativeMode(_RelativeMode); pSource->setLooping(_Looping); pSource->setPitch(_Pitch); @@ -174,7 +176,14 @@ void CSimpleSource::play() // and play the sound bool play = pSource->play(); + +#ifdef NL_DEBUG nlassert(play); +#else + if (!play) + nlwarning("Failed to play physical sound source. This is a serious error"); +#endif + // nldebug("CSimpleSource %p : REAL play done", (CAudioMixerUser::IMixerEvent*)this); } else @@ -183,6 +192,7 @@ void CSimpleSource::play() { // This sound is not discardable, add it in waiting playlist mixer->addSourceWaitingForPlay(this); + _WaitingForPlay = true; return; } // there is no available track, just do a 'muted' play @@ -193,6 +203,7 @@ void CSimpleSource::play() } CSourceCommon::play(); + _WaitingForPlay = false; } /// Mixer event call when doing muted play @@ -219,6 +230,13 @@ void CSimpleSource::stop() // nldebug("CSimpleSource %p : stop", (CAudioMixerUser::IMixerEvent*)this); // nlassert(_Playing); + if (_WaitingForPlay) + { + nlassert(!_Playing); // cannot already be playing if waiting for play + CAudioMixerUser *mixer = CAudioMixerUser::instance(); + mixer->removeSourceWaitingForPlay(this); + } + if (!_Playing) return; @@ -312,36 +330,13 @@ void CSimpleSource::setDirection(const NLMISC::CVector& dir) } } - -/* Set the gain (volume value inside [0 , 1]). (default: 1) - * 0.0 -> silence - * 0.5 -> -6dB - * 1.0 -> no attenuation - * values > 1 (amplification) not supported by most drivers - */ -void CSimpleSource::setGain(float gain) -{ - CSourceCommon::setGain(gain); - - // Set the gain - if (hasPhysicalSource()) - { - getPhysicalSource()->setGain(gain); - } -} - -void CSimpleSource::setRelativeGain(float gain) +void CSimpleSource::updateFinalGain() { - CSourceCommon::setRelativeGain(gain); - // Set the gain if (hasPhysicalSource()) - { - getPhysicalSource()->setGain(_Gain); - } + getPhysicalSource()->setGain(getFinalGain()); } - /* Shift the frequency. 1.0f equals identity, each reduction of 50% equals a pitch shift * of one octave. 0 is not a legal value. */ diff --git a/code/nel/src/sound/sound.cpp b/code/nel/src/sound/sound.cpp index eed318cca..b1b644ed2 100644 --- a/code/nel/src/sound/sound.cpp +++ b/code/nel/src/sound/sound.cpp @@ -26,6 +26,10 @@ #include "nel/sound/context_sound.h" #include "nel/sound/music_sound.h" #include "nel/sound/stream_sound.h" +#include "nel/sound/stream_file_sound.h" + +#include "nel/sound/group_controller.h" +#include "nel/sound/group_controller_root.h" using namespace std; using namespace NLMISC; @@ -81,6 +85,11 @@ CSound *CSound::createSound(const std::string &filename, NLGEORGES::UFormElm& fo ret = new CStreamSound(); ret->importForm(filename, formRoot); } + else if (dfnName == "stream_file_sound.dfn") + { + ret = new CStreamFileSound(); + ret->importForm(filename, formRoot); + } else { nlassertex(false, ("SoundType unsuported : %s", dfnName.c_str())); @@ -106,7 +115,8 @@ CSound::CSound() : _Looping(false), _MinDist(1.0f), _MaxDist(1000000.0f), - _UserVarControler(CStringMapper::emptyId()) + _UserVarControler(CStringMapper::emptyId()), + _GroupController(NULL) { } @@ -134,6 +144,23 @@ void CSound::serial(NLMISC::IStream &s) std::string name = CStringMapper::unmap(_Name); s.serial(name); } + + nlassert(CGroupControllerRoot::getInstance()); // not sure +#if NLSOUND_SHEET_VERSION_BUILT < 2 + if (s.isReading()) _GroupController = static_cast(CAudioMixerUser::instance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_GROUP_CONTROLLER)); +#else + if (s.isReading()) + { + std::string groupControllerPath; + s.serial(groupControllerPath); + _GroupController = static_cast(CAudioMixerUser::instance()->getGroupController(groupControllerPath)); + } + else + { + std::string groupControllerPath = _GroupController->getPath(); + s.serial(groupControllerPath); + } +#endif } @@ -225,6 +252,16 @@ void CSound::importForm(const std::string& filename, NLGEORGES::UFormElm& roo default: _Priority = MidPri; } + + nlassert(CGroupControllerRoot::getInstance()); // not sure +#if NLSOUND_SHEET_VERSION_BUILT < 2 + _GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_GROUP_CONTROLLER); +#else + std::string groupControllerPath; + root.getValueByName(groupControllerPath, ".GroupControllerPath"); + _GroupController = CGroupControllerRoot::getInstance()->getGroupController(groupControllerPath); +#endif + } diff --git a/code/nel/src/sound/sound_bank.cpp b/code/nel/src/sound/sound_bank.cpp index b4031b571..dd2076a72 100644 --- a/code/nel/src/sound/sound_bank.cpp +++ b/code/nel/src/sound/sound_bank.cpp @@ -23,6 +23,7 @@ #include "nel/sound/background_sound.h" #include "nel/sound/music_sound.h" #include "nel/sound/stream_sound.h" +#include "nel/sound/stream_file_sound.h" #include "nel/georges/u_form_loader.h" #include "nel/georges/u_form_elm.h" @@ -194,6 +195,9 @@ public: case CSound::SOUND_STREAM: Sound = new CStreamSound(); break; + case CSound::SOUND_STREAM_FILE: + Sound = new CStreamFileSound(); + break; default: Sound = 0; } diff --git a/code/nel/src/sound/source_common.cpp b/code/nel/src/sound/source_common.cpp index ce2b7e210..7b27deb03 100644 --- a/code/nel/src/sound/source_common.cpp +++ b/code/nel/src/sound/source_common.cpp @@ -25,7 +25,7 @@ using namespace NLMISC; namespace NLSOUND { -CSourceCommon::CSourceCommon(TSoundId id, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster) +CSourceCommon::CSourceCommon(TSoundId id, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController) : _Priority(MidPri), _Playing(false), _Looping(false), @@ -41,9 +41,11 @@ CSourceCommon::CSourceCommon(TSoundId id, bool spawn, TSpawnEndCallback cb, void _SpawnEndCb(cb), _CbUserParam(cbUserParam), _Cluster(cluster), - _UserVarControler(id->getUserVarControler()) + _UserVarControler(id->getUserVarControler()), + _GroupController(groupController ? groupController : id->getGroupController()) { CAudioMixerUser::instance()->addSource(this); + _GroupController->addSource(this); // get a local copy of the sound parameter _InitialGain = _Gain = id->getGain(); @@ -51,11 +53,11 @@ CSourceCommon::CSourceCommon(TSoundId id, bool spawn, TSpawnEndCallback cb, void _Looping = id->getLooping(); _Priority = id->getPriority(); _Direction = id->getDirectionVector(); - } CSourceCommon::~CSourceCommon() { + _GroupController->removeSource(this); CAudioMixerUser::instance()->removeSource(this); } @@ -177,6 +179,7 @@ void CSourceCommon::setGain( float gain ) { clamp(gain, 0.0f, 1.0f); _InitialGain = _Gain = gain; + updateFinalGain(); } /* Set the gain amount (value inside [0, 1]) to map between 0 and the nominal gain @@ -185,8 +188,8 @@ void CSourceCommon::setGain( float gain ) void CSourceCommon::setRelativeGain( float gain ) { clamp(gain, 0.0f, 1.0f); - _Gain = _InitialGain * gain; + updateFinalGain(); } /* diff --git a/code/nel/src/sound/source_music_channel.cpp b/code/nel/src/sound/source_music_channel.cpp new file mode 100644 index 000000000..34735f113 --- /dev/null +++ b/code/nel/src/sound/source_music_channel.cpp @@ -0,0 +1,140 @@ +/** + * \file source_music_channel.cpp + * \brief CSourceMusicChannel + * \date 2012-04-11 16:08GMT + * \author Jan Boon (Kaetemi) + * CSourceMusicChannel + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#include "stdsound.h" +#include + +// STL includes + +// NeL includes +// #include +#include + +// Project includes + +using namespace std; +// using namespace NLMISC; + +namespace NLSOUND { + +CSourceMusicChannel::CSourceMusicChannel() : m_Source(NULL), m_Gain(1.0f) +{ + +} + +CSourceMusicChannel::~CSourceMusicChannel() +{ + nlassert(!m_Source); + delete m_Source; + m_Source = NULL; +} + +bool CSourceMusicChannel::play(const std::string &filepath, bool async, bool loop) +{ + // delete previous source if any + // note that this waits for the source's thread to finish if the source was still playing + if (m_Source) + delete m_Source; + + m_Sound.setMusicFilePath(filepath, async, loop); + + m_Source = new CStreamFileSource(&m_Sound, false, NULL, NULL, NULL, NULL); + m_Source->setSourceRelativeMode(true); + m_Source->setPos(NLMISC::CVector::Null); + m_Source->setRelativeGain(m_Gain); + + m_Source->play(); + + return m_Source->isPlaying(); +} + +void CSourceMusicChannel::stop() +{ + // stop but don't delete the source, deleting source may cause waiting for thread + if (m_Source) + m_Source->stop(); +} + +void CSourceMusicChannel::reset() +{ + // forces the source to be deleted, happens when audio mixer is reset + delete m_Source; + m_Source = NULL; +} + +void CSourceMusicChannel::pause() +{ + if (m_Source) + m_Source->pause(); +} + +void CSourceMusicChannel::resume() +{ + if (m_Source) + m_Source->resume(); +} + +bool CSourceMusicChannel::isEnded() +{ + if (m_Source) + { + if (m_Source->isEnded()) + { + // we can delete the source now without worrying about thread wait + delete m_Source; + m_Source = NULL; + return true; + } + return false; + } + return true; +} + +bool CSourceMusicChannel::isLoadingAsync() +{ + if (m_Source) + return m_Source->isLoadingAsync(); + return false; +} + +float CSourceMusicChannel::getLength() +{ + if (m_Source) + return m_Source->getLength(); + return 0.0f; +} + +void CSourceMusicChannel::setVolume(float gain) +{ + m_Gain = gain; + if (m_Source) + m_Source->setRelativeGain(gain); +} + +} /* namespace NLSOUND */ + +/* end of file */ diff --git a/code/nel/src/sound/stream_file_sound.cpp b/code/nel/src/sound/stream_file_sound.cpp new file mode 100644 index 000000000..44da5a31d --- /dev/null +++ b/code/nel/src/sound/stream_file_sound.cpp @@ -0,0 +1,98 @@ +/** + * \file stream_file_sound.cpp + * \brief CStreamFileSound + * \date 2012-04-11 09:57GMT + * \author Jan Boon (Kaetemi) + * CStreamFileSound + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#include "stdsound.h" +#include + +// STL includes + +// NeL includes +// #include +#include + +// Project includes + +using namespace std; +// using namespace NLMISC; + +namespace NLSOUND { + +CStreamFileSound::CStreamFileSound() +{ + +} + +CStreamFileSound::~CStreamFileSound() +{ + +} + +void CStreamFileSound::importForm(const std::string &filename, NLGEORGES::UFormElm &root) +{ + // Call the base class + CStreamSound::importForm(filename, root); + + // Async + root.getValueByName(m_Async, ".SoundType.Async"); + + // FilePath + root.getValueByName(m_FilePath, ".SoundType.FilePath"); +} + +void CStreamFileSound::serial(NLMISC::IStream &s) +{ + CStreamSound::serial(s); + + s.serial(m_Async); + s.serial(m_FilePath); +} + +void CStreamFileSound::setMusicFilePath(const std::string &filePath, bool async, bool loop) +{ +#if !FINAL_VERSION + _Name = NLMISC::CStringMapper::map(std::string(""); +#else + _Name = NLMISC::CStringMapper::map(""); +#endif + _ConeInnerAngle = NLMISC::Pi * 2; + _ConeOuterAngle = NLMISC::Pi * 2; + _Looping = loop; + _Gain = 1.0f; + _ConeOuterGain = 1.0f; + _Direction = NLMISC::CVector(0.f, 0.f, 0.f); + _Pitch = 1.0f; + _Priority = HighestPri; + _MaxDist = 9000.0f; + _MinDist = 1000.0f; + m_Async = async; + m_FilePath = filePath; + _GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_MUSIC_GROUP_CONTROLLER); +} + +} /* namespace NLSOUND */ + +/* end of file */ diff --git a/code/nel/src/sound/stream_file_source.cpp b/code/nel/src/sound/stream_file_source.cpp new file mode 100644 index 000000000..87164a9cd --- /dev/null +++ b/code/nel/src/sound/stream_file_source.cpp @@ -0,0 +1,384 @@ +/** + * \file stream_file_source.cpp + * \brief CStreamFileSource + * \date 2012-04-11 09:57GMT + * \author Jan Boon (Kaetemi) + * CStreamFileSource + */ + +/* + * Copyright (C) 2012 by authors + * + * This file is part of RYZOM CORE. + * RYZOM CORE 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. + * + * RYZOM CORE 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 RYZOM CORE. If not, see + * . + */ + +#include "stdsound.h" +#include + +// STL includes + +// NeL includes +// #include + +// Project includes +#include +#include + +using namespace std; +// using namespace NLMISC; + +// #define NLSOUND_STREAM_FILE_DEBUG + +namespace NLSOUND { + +CStreamFileSource::CStreamFileSource(CStreamFileSound *streamFileSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController) +: CStreamSource(streamFileSound, spawn, cb, cbUserParam, cluster, groupController), m_AudioDecoder(NULL), m_Paused(false) +{ + m_Thread = NLMISC::IThread::create(this); +} + +CStreamFileSource::~CStreamFileSource() +{ + stop(); + m_Thread->wait(); // thread must have stopped for delete! + delete m_Thread; + m_Thread = NULL; + delete m_AudioDecoder; + m_AudioDecoder = NULL; +} + +void CStreamFileSource::play() +{ + // note: CStreamSource will assert crash if already physically playing! + + + if (m_WaitingForPlay) + { + if (m_Thread->isRunning()) + { + if (m_NextBuffer || !m_FreeBuffers) + { +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("play waiting, play stream %s", getStreamFileSound()->getFilePath().c_str()); +#endif + CStreamSource::play(); + if (!_Playing && !m_WaitingForPlay) + { + nldebug("Stream file source playback not possible or necessary for some reason"); + } + } + else + { +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("play waiting, hop onto waiting list %s", getStreamFileSound()->getFilePath().c_str()); +#endif + m_WaitingForPlay = true; + CAudioMixerUser *mixer = CAudioMixerUser::instance(); + mixer->addSourceWaitingForPlay(this); + } + } + else + { + // thread went kaboom while not started playing yet, probably the audiodecoder cannot be started + // don't play + m_WaitingForPlay = false; + } + } + else if (!_Playing) + { +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("play go %s", getStreamFileSound()->getFilePath().c_str()); +#endif + //if (!m_WaitingForPlay) + //{ + // thread may be stopping from stop call + m_Thread->wait(); + //} + //else + //{ + // nlwarning("Already waiting for play"); + //} + if (!getStreamFileSound()->getAsync()) + { + if (!prepareDecoder()) + { + return; + } + } + // else load audiodecoder in thread + m_WaitingForPlay = true; + m_Thread->start(); + m_Thread->setPriority(NLMISC::ThreadPriorityHighest); + if (!getStreamFileSound()->getAsync()) + { + // wait until at least one buffer is ready + while (!(m_NextBuffer || !m_FreeBuffers) && m_WaitingForPlay && m_Thread->isRunning()) + { +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("wait buffer"); +#endif + NLMISC::nlSleep(100); + } + if (m_WaitingForPlay && m_Thread->isRunning()) + { + CStreamSource::play(); + if (!_Playing) + { + nlwarning("Failed to synchronously start playing a file stream source. This happens when all physical tracks are in use. Use a Highest Priority sound"); + } + } + } + else + { + CAudioMixerUser *mixer = CAudioMixerUser::instance(); + mixer->addSourceWaitingForPlay(this); + } + } + else + { + nlwarning("Already playing"); + } + + + /*if (!m_WaitingForPlay) + { + m_WaitingForPlay = true; + + m_Thread->wait(); // thread must have stopped to restart it! + + m_Thread->start(); + m_Thread->setPriority(NLMISC::ThreadPriorityHighest); + } + + CStreamSource::play();*/ +} + +void CStreamFileSource::stop() +{ +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("stop %s", getStreamFileSound()->getFilePath().c_str()); +#endif + + CStreamSource::stopInt(); + +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("stopInt ok"); +#endif + + if (_Spawn) + { + if (_SpawnEndCb != NULL) + _SpawnEndCb(this, _CbUserParam); + m_Thread->wait(); + delete this; + } + +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("stop ok"); +#endif + + // thread will check _Playing to stop +} + +bool CStreamFileSource::isPlaying() +{ +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("isPlaying"); +#endif + + return m_Thread->isRunning(); +} + +void CStreamFileSource::pause() +{ +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("pause"); +#endif + + if (!m_Paused) + { + // thread checks for this to not delete the audio decoder + m_Paused = true; + + // stop the underlying system + CStreamSource::stop(); + + // thread will check _Playing to stop + } + else + { + nlwarning("Already paused"); + } +} + +void CStreamFileSource::resume() +{ +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("resume"); +#endif + + if (m_Paused) + { + m_Thread->wait(); // thread must have stopped to restart it! + + play(); + } + else + { + nlwarning("Not paused"); + } +} + +bool CStreamFileSource::isEnded() +{ + return (!m_Thread->isRunning() && !_Playing && !m_WaitingForPlay && !m_Paused); +} + +float CStreamFileSource::getLength() +{ + return m_AudioDecoder->getLength(); +} + +bool CStreamFileSource::isLoadingAsync() +{ + return m_WaitingForPlay; +} + +bool CStreamFileSource::prepareDecoder() +{ + // creates a new decoder or keeps going with the current decoder if the stream was paused + + if (m_Paused) + { + // handle paused! + m_Paused = false; + } + else if (m_AudioDecoder) // audio decoder should normally not exist when not paused and starting the thread + { + nlwarning("CAudioDecoder already exists, possible thread race bug with pause"); + delete m_AudioDecoder; + m_AudioDecoder = NULL; + } + if (!m_AudioDecoder) + { + // load the file + m_AudioDecoder = IAudioDecoder::createAudioDecoder(getStreamFileSound()->getFilePath(), getStreamFileSound()->getAsync(), getStreamFileSound()->getLooping()); + if (!m_AudioDecoder) + { + nlwarning("Failed to create IAudioDecoder, likely invalid format"); + return false; + } + this->setFormat(m_AudioDecoder->getChannels(), m_AudioDecoder->getBitsPerSample(), (uint32)m_AudioDecoder->getSamplesPerSec()); + } + uint samples, bytes; + this->getRecommendedBufferSize(samples, bytes); + this->preAllocate(bytes * 2); + + return true; +} + +inline bool CStreamFileSource::bufferMore(uint bytes) // buffer from bytes (minimum) to bytes * 2 (maximum) +{ + uint8 *buffer = this->lock(bytes * 2); + if (buffer) + { + uint32 result = m_AudioDecoder->getNextBytes(buffer, bytes, bytes * 2); + this->unlock(result); + return true; + } + return false; +} + +void CStreamFileSource::run() +{ +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("run %s", getStreamFileSound()->getFilePath().c_str()); + uint dumpI = 0; +#endif + + bool looping = _Looping; + if (getStreamFileSound()->getAsync()) + { + if (!prepareDecoder()) + return; + } + uint samples, bytes; + this->getRecommendedBufferSize(samples, bytes); + uint32 recSleep = 40; + uint32 doSleep = 10; + while (_Playing || m_WaitingForPlay) + { + if (!m_AudioDecoder->isMusicEnded()) + { +#ifdef NLSOUND_STREAM_FILE_DEBUG + ++dumpI; + if (!(dumpI % 100)) + { + nldebug("buffer %s %s %s", _Playing ? "PLAYING" : "NP", m_WaitingForPlay ? "WAITING" : "NW", getStreamFileSound()->getFilePath().c_str()); + nldebug("gain %f", hasPhysicalSource() ? getPhysicalSource()->getGain() : -1.0f); + } +#endif + + bool newLooping = _Looping; + if (looping != newLooping) + { + m_AudioDecoder->setLooping(looping); + looping = newLooping; + } + + // reduce sleeping time if nothing was buffered + if (bufferMore(bytes)) recSleep = doSleep = this->getRecommendedSleepTime(); + else doSleep = recSleep >> 2; // /4 + NLMISC::nlSleep(doSleep); + } + else + { + // wait until done playing buffers + while (this->hasFilledBuffersAvailable() && (_Playing || m_WaitingForPlay)) + { +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("music ended, wait until done %s", getStreamFileSound()->getFilePath().c_str()); +#endif + NLMISC::nlSleep(40); + } + // stop the physical source + // if (hasPhysicalSource()) + // getPhysicalSource()->stop(); + // the audio mixer will call stop on the logical source + break; + } + } + if (m_Paused) + { + // don't delete anything + } + else + { + delete m_AudioDecoder; + m_AudioDecoder = NULL; + } + // drop buffers + m_FreeBuffers = 3; + m_NextBuffer = 0; + +#ifdef NLSOUND_STREAM_FILE_DEBUG + nldebug("run end %s", getStreamFileSound()->getFilePath().c_str()); +#endif +} + +} /* namespace NLSOUND */ + +/* end of file */ diff --git a/code/nel/src/sound/stream_sound.cpp b/code/nel/src/sound/stream_sound.cpp index 347fae987..e16158d4d 100644 --- a/code/nel/src/sound/stream_sound.cpp +++ b/code/nel/src/sound/stream_sound.cpp @@ -17,6 +17,10 @@ #include "stdsound.h" #include "nel/sound/stream_sound.h" +#if NLSOUND_SHEET_VERSION_BUILT < 2 +# include "nel/sound/group_controller_root.h" +#endif + namespace NLSOUND { CStreamSound::CStreamSound() @@ -31,14 +35,15 @@ CStreamSound::~CStreamSound() void CStreamSound::importForm(const std::string &filename, NLGEORGES::UFormElm &root) { - NLGEORGES::UFormElm *psoundType; + // cannot do this debug check because used also by CStreamFileSound + /*NLGEORGES::UFormElm *psoundType; std::string dfnName; // some basic checking. root.getNodeByName(&psoundType, ".SoundType"); nlassert(psoundType != NULL); psoundType->getDfnName(dfnName); - nlassert(dfnName == "stream_sound.dfn"); + nlassert(dfnName == "stream_sound.dfn");*/ // Call the base class CSound::importForm(filename, root); @@ -51,6 +56,11 @@ void CStreamSound::importForm(const std::string &filename, NLGEORGES::UFormElm & // Alpha root.getValueByName(m_Alpha, ".SoundType.Alpha"); + +#if NLSOUND_SHEET_VERSION_BUILT < 2 + _GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_STREAM_GROUP_CONTROLLER); +#endif + } void CStreamSound::serial(NLMISC::IStream &s) @@ -59,6 +69,11 @@ void CStreamSound::serial(NLMISC::IStream &s) s.serial(_MinDist); s.serial(m_Alpha); + +#if NLSOUND_SHEET_VERSION_BUILT < 2 + if (s.isReading()) _GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_STREAM_GROUP_CONTROLLER); +#endif + } } /* namespace NLSOUND */ diff --git a/code/nel/src/sound/stream_source.cpp b/code/nel/src/sound/stream_source.cpp index a5b167c8f..221b0529e 100644 --- a/code/nel/src/sound/stream_source.cpp +++ b/code/nel/src/sound/stream_source.cpp @@ -26,29 +26,37 @@ // using namespace std; using namespace NLMISC; +// #define NLSOUND_DEBUG_STREAM + namespace NLSOUND { -CStreamSource::CStreamSource(CStreamSound *streamSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster) - : CSourceCommon(streamSound, spawn, cb, cbUserParam, cluster), +CStreamSource::CStreamSource(CStreamSound *streamSound, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster, CGroupController *groupController) + : CSourceCommon(streamSound, spawn, cb, cbUserParam, cluster, groupController), m_StreamSound(streamSound), m_Alpha(0.0f), m_Track(NULL), m_FreeBuffers(3), m_NextBuffer(0), m_LastSize(0), - m_BytesPerSecond(0) + m_BytesPerSecond(0), + m_WaitingForPlay(false), + m_PitchInv(1.0f) { nlassert(m_StreamSound != 0); // get a local copy of the stream sound parameter m_Alpha = m_StreamSound->getAlpha();//m_Buffers + m_PitchInv = 1.0f / _Pitch; // create the three buffer objects CAudioMixerUser *mixer = CAudioMixerUser::instance(); ISoundDriver *driver = mixer->getSoundDriver(); m_Buffers[0] = driver->createBuffer(); + m_Buffers[0]->setStorageMode(IBuffer::StorageSoftware); m_Buffers[1] = driver->createBuffer(); + m_Buffers[1]->setStorageMode(IBuffer::StorageSoftware); m_Buffers[2] = driver->createBuffer(); + m_Buffers[2]->setStorageMode(IBuffer::StorageSoftware); } CStreamSource::~CStreamSource() @@ -107,6 +115,8 @@ bool CStreamSource::isPlaying() /// Set looping on/off for future playbacks (default: off) void CStreamSource::setLooping(bool l) { + CSourceCommon::setLooping(l); + //CAutoMutex autoMutex(m_BufferMutex); // //CSourceCommon::setLooping(l); @@ -146,13 +156,16 @@ void CStreamSource::play() if ((_RelativeMode ? getPos().sqrnorm() : (mixer->getListenPosVector() - getPos()).sqrnorm()) > m_StreamSound->getMaxDistance() * m_StreamSound->getMaxDistance()) { // Source is too far to play + m_WaitingForPlay = false; if (_Spawn) { if (_SpawnEndCb != NULL) _SpawnEndCb(this, _CbUserParam); delete this; } - // nldebug("CStreamSource %p : play FAILED !", (CAudioMixerUser::IMixerEvent*)this); +#ifdef NLSOUND_DEBUG_STREAM + nldebug("CStreamSource %p : play FAILED, source is too far away !", (CAudioMixerUser::IMixerEvent*)this); +#endif return; } @@ -166,24 +179,33 @@ void CStreamSource::play() ISource *pSource = getPhysicalSource(); nlassert(pSource != NULL); - for (uint i = 0; i < m_NextBuffer; ++i) + uint nbS = m_NextBuffer; + if (!m_NextBuffer && !m_FreeBuffers) nbS = 3; + for (uint i = 0; i < nbS; ++i) pSource->submitStreamingBuffer(m_Buffers[i]); // pSource->setPos( _Position, false); pSource->setPos(getVirtualPos(), false); + pSource->setMinMaxDistances(m_StreamSound->getMinDistance(), m_StreamSound->getMaxDistance(), false); if (!m_Buffers[0]->isStereo()) { - pSource->setMinMaxDistances(m_StreamSound->getMinDistance(), m_StreamSound->getMaxDistance(), false); setDirection(_Direction); // because there is a workaround inside pSource->setVelocity(_Velocity); } - pSource->setGain(_Gain); + else + { + pSource->setDirection(NLMISC::CVector::I); + pSource->setCone(float(Pi * 2), float(Pi * 2), 1.0f); + pSource->setVelocity(NLMISC::CVector::Null); + } + pSource->setGain(getFinalGain()); pSource->setSourceRelativeMode(_RelativeMode); // pSource->setLooping(_Looping); pSource->setPitch(_Pitch); pSource->setAlpha(m_Alpha); // and play the sound + nlassert(nbS); // must have buffered already! play = pSource->play(); // nldebug("CStreamSource %p : REAL play done", (CAudioMixerUser::IMixerEvent*)this); } @@ -193,11 +215,13 @@ void CStreamSource::play() { // This sound is not discardable, add it in waiting playlist mixer->addSourceWaitingForPlay(this); + m_WaitingForPlay = true; return; } else { // No source available, kill. + m_WaitingForPlay = false; if (_Spawn) { if (_SpawnEndCb != NULL) @@ -209,22 +233,67 @@ void CStreamSource::play() } if (play) + { CSourceCommon::play(); + m_WaitingForPlay = false; +#ifdef NLSOUND_DEBUG_STREAM + // Dump source info + nlwarning("--- DUMP SOURCE INFO ---"); + nlwarning(" * getLooping: %s", getPhysicalSource()->getLooping() ? "YES" : "NO"); + nlwarning(" * isPlaying: %s", getPhysicalSource()->isPlaying() ? "YES" : "NO"); + nlwarning(" * isStopped: %s", getPhysicalSource()->isStopped() ? "YES" : "NO"); + nlwarning(" * isPaused: %s", getPhysicalSource()->isPaused() ? "YES" : "NO"); + nlwarning(" * getPos: %f, %f, %f", getPhysicalSource()->getPos().x, getPhysicalSource()->getPos().y, getPhysicalSource()->getPos().z); + NLMISC::CVector v; + getPhysicalSource()->getVelocity(v); + nlwarning(" * getVelocity: %f, %f, %f", v.x, v.y, v.z); + getPhysicalSource()->getDirection(v); + nlwarning(" * getDirection: %f, %f, %f", v.x, v.y, v.z); + nlwarning(" * getGain: %f", getPhysicalSource()->getGain()); + nlwarning(" * getPitch: %f", getPhysicalSource()->getPitch()); + nlwarning(" * getSourceRelativeMode: %s", getPhysicalSource()->getSourceRelativeMode() ? "YES" : "NO"); + float a, b, c; + getPhysicalSource()->getMinMaxDistances(a, b); + nlwarning(" * getMinMaxDistances: %f, %f", a, b); + getPhysicalSource()->getCone(a, b, c); + nlwarning(" * getCone: %f, %f", a, b, c); + nlwarning(" * getDirect: %s", getPhysicalSource()->getDirect() ? "YES" : "NO"); + nlwarning(" * getDirectGain: %f", getPhysicalSource()->getDirectGain()); + nlwarning(" * isDirectFilterEnabled: %s", getPhysicalSource()->isDirectFilterEnabled() ? "YES" : "NO"); + nlwarning(" * getEffect: %s", getPhysicalSource()->getEffect() ? "YES" : "NO"); + nlwarning(" * getEffectGain: %f", getPhysicalSource()->getEffectGain()); + nlwarning(" * isEffectFilterEnabled: %s", getPhysicalSource()->isEffectFilterEnabled() ? "YES" : "NO"); +#endif + } } +#ifdef NL_DEBUG nlassert(play); +#else + if (!play) + nlwarning("Failed to play physical sound source. This is a serious error"); +#endif } -/// Stop playing -void CStreamSource::stop() +void CStreamSource::stopInt() { CAutoMutex autoMutex(m_BufferMutex); // nldebug("CStreamSource %p : stop", (CAudioMixerUser::IMixerEvent*)this); // nlassert(_Playing); + + if (m_WaitingForPlay) + { + nlassert(!_Playing); // cannot already be playing if waiting for play + CAudioMixerUser *mixer = CAudioMixerUser::instance(); + mixer->removeSourceWaitingForPlay(this); + } if (!_Playing) + { + m_WaitingForPlay = false; return; + } if (hasPhysicalSource()) releasePhysicalSource(); @@ -234,6 +303,14 @@ void CStreamSource::stop() m_FreeBuffers = 3; m_NextBuffer = 0; + m_WaitingForPlay = false; +} + +/// Stop playing +void CStreamSource::stop() +{ + stopInt(); + if (_Spawn) { if (_SpawnEndCb != NULL) @@ -294,28 +371,18 @@ void CStreamSource::setDirection(const NLMISC::CVector& dir) } } -void CStreamSource::setGain(float gain) -{ - CAutoMutex autoMutex(m_BufferMutex); - - CSourceCommon::setGain(gain); - if (hasPhysicalSource()) - getPhysicalSource()->setGain(gain); -} - -void CStreamSource::setRelativeGain(float gain) +void CStreamSource::updateFinalGain() { CAutoMutex autoMutex(m_BufferMutex); - - CSourceCommon::setRelativeGain(gain); + if (hasPhysicalSource()) - getPhysicalSource()->setGain(_Gain); + getPhysicalSource()->setGain(getFinalGain()); } void CStreamSource::setPitch(float pitch) { CAutoMutex autoMutex(m_BufferMutex); - + m_PitchInv = 1.0f / pitch; CSourceCommon::setPitch(pitch); if (hasPhysicalSource()) getPhysicalSource()->setPitch(pitch); @@ -382,7 +449,9 @@ bool CStreamSource::unlock(uint size) ++m_NextBuffer; m_NextBuffer %= 3; --m_FreeBuffers; if (hasPhysicalSource()) + { getPhysicalSource()->submitStreamingBuffer(buffer); + } m_LastSize = size; } @@ -406,8 +475,8 @@ void CStreamSource::getRecommendedBufferSize(uint &samples, uint &bytes) const uint32 CStreamSource::getRecommendedSleepTime() const { if (m_FreeBuffers > 0) return 0; - uint32 sleepTime = (uint32)((1000.0f * ((float)m_LastSize) / (float)m_BytesPerSecond) / _Pitch); - clamp(sleepTime, (uint32)0, (uint32)1000); + uint32 sleepTime = (uint32)((1000.0f * ((float)m_LastSize) / (float)m_BytesPerSecond) * m_PitchInv); + clamp(sleepTime, (uint32)0, (uint32)80); return sleepTime; } @@ -418,6 +487,19 @@ bool CStreamSource::hasFilledBuffersAvailable() const return m_FreeBuffers < 3; } +void CStreamSource::preAllocate(uint capacity) +{ + uint8 *b0 = m_Buffers[0]->lock(capacity); + memset(b0, 0, capacity); + m_Buffers[0]->unlock(capacity); + uint8 *b1 = m_Buffers[1]->lock(capacity); + memset(b1, 0, capacity); + m_Buffers[1]->unlock(capacity); + uint8 *b2 = m_Buffers[2]->lock(capacity); + memset(b2, 0, capacity); + m_Buffers[2]->unlock(capacity); +} + } /* namespace NLSOUND */ /* end of file */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.h index 7527b5dbd..7695ebc2f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.h @@ -74,7 +74,7 @@ public: * Append the header to a created bnp file * \param filename (consisting the whole path) */ - void appendHeader (const std::string &filename) {}; + void appendHeader (const std::string &filename) {} /** * Create a vector of all packed files inside the bnp file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp index 7ae482824..2967be435 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp @@ -22,7 +22,7 @@ #include #include -namespace Plugin +namespace GeorgesQt { ExpandableHeaderView::ExpandableHeaderView(Qt::Orientation orientation, QWidget * parent) 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 596bf5ba1..f7f26eafc 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 @@ -20,7 +20,7 @@ // Qt includes #include -namespace Plugin +namespace GeorgesQt { class ExpandableHeaderView : public QHeaderView { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp index 4d04bc6b5..be358d065 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp @@ -37,7 +37,7 @@ #include "georgesform_proxy_model.h" #include "formitem.h" -namespace Plugin +namespace GeorgesQt { FormDelegate::FormDelegate(QObject *parent) @@ -275,4 +275,4 @@ namespace Plugin QRect r = option.rect; editor->setGeometry(r); } -} /* namespace Plugin */ +} /* namespace GeorgesQt */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.h index a309da1fc..486308536 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.h @@ -19,7 +19,7 @@ #include -namespace Plugin +namespace GeorgesQt { class FormDelegate : public QStyledItemDelegate diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp index 205e18a52..68f29064d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp @@ -23,7 +23,7 @@ #include #include -namespace Plugin +namespace GeorgesQt { CFormItem::CFormItem(NLGEORGES::UFormElm* elm, const QList &data, CFormItem *parent, diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.h index b85b12275..80efce5d5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.h @@ -24,7 +24,7 @@ #include #include -namespace Plugin +namespace GeorgesQt { class CFormItem diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp index b93f93ec4..50e007d90 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp @@ -28,7 +28,7 @@ using namespace NLGEORGES; -namespace Plugin +namespace GeorgesQt { CGeorges::CGeorges(): FormLoader(0) @@ -61,4 +61,4 @@ namespace Plugin return type; } -} /* namespace Plugin */ +} /* namespace GeorgesQt */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.h index eb9a6b7da..6d7455d3b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.h @@ -38,7 +38,7 @@ namespace NLGEORGES using namespace NLGEORGES; -namespace Plugin +namespace GeorgesQt { /** @@ -64,6 +64,6 @@ namespace Plugin };/* class CGeorges */ -} /* namespace Plugin */ +} /* namespace GeorgesQt */ #endif // GEORGES_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp index de7a105ab..163ec7877 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp @@ -23,7 +23,7 @@ // NeL includes -namespace Plugin +namespace GeorgesQt { CGeorgesDirTreeDialog::CGeorgesDirTreeDialog(QString ldPath, QWidget *parent) @@ -109,4 +109,4 @@ void CGeorgesDirTreeDialog::ldPathChanged(QString path) } } -} /* namespace NLQT */ \ No newline at end of file +} /* namespace GeorgesQt */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h index fa783bca0..dc717617e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h @@ -28,7 +28,7 @@ #include "ui_georges_dirtree_form.h" #include "georges_filesystem_model.h" -namespace Plugin +namespace GeorgesQt { class CGeorgesDirTreeDialog: public QDockWidget @@ -57,6 +57,6 @@ private Q_SLOTS: }; /* CGEorgesDirTreeDialog */ -} /* namespace NLQT */ +} /* namespace GeorgesQt */ #endif // GEORGES_DIRTREE_DIALOG_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui index 4a429af1f..e14857e89 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui @@ -44,6 +44,9 @@ 0 + + true + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_constants.h index bb9fe3306..cccede9fc 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_constants.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_constants.h @@ -17,7 +17,7 @@ #ifndef GEORGES_EDITOR_CONSTANTS_H #define GEORGES_EDITOR_CONSTANTS_H -namespace Plugin +namespace GeorgesQt { namespace Constants { @@ -26,6 +26,6 @@ const char * const GEORGES_EDITOR_SECTION = "GeorgesEditor"; } // namespace Constants -} // namespace Plugin +} // namespace GeorgesQt #endif // GEORGES_EDITOR_CONSTANTS_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp index 252d7fd7e..c54c41638 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp @@ -33,7 +33,7 @@ #include #include -namespace Plugin +namespace GeorgesQt { GeorgesEditorForm::GeorgesEditorForm(QWidget *parent) @@ -63,7 +63,7 @@ namespace Plugin m_undoStack = new QUndoStack(this); - Core::MenuManager *menuManager = Core::ICore::instance()->menuManager(); + Core::MenuManager *menuManager = Core::ICore::instance()->menuManager(); m_openAction = menuManager->action(Core::Constants::OPEN); m_newAction = new QAction(tr("&New..."), this); @@ -92,6 +92,13 @@ namespace Plugin addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog); restoreDockWidget(m_georgesDirTreeDialog); + // Set the default sheet dir dir to the level design path. + m_lastSheetDir = "."; + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup(Core::Constants::DATA_PATH_SECTION); + m_lastSheetDir = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString(); + settings->endGroup(); + connect(Core::ICore::instance(), SIGNAL(changeSettings()), this, SLOT(settingsChanged())); connect(m_georgesDirTreeDialog, SIGNAL(selectedForm(const QString)), @@ -112,33 +119,30 @@ namespace Plugin void GeorgesEditorForm::open() { - /*qDebug() << "GeorgesEditorForm::open()"; - if (!m_dockedWidgets.size()) - { - m_dockedWidgets.append(new CGeorgesTreeViewDialog(m_mainDock)); - m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last()); - } - else - { - m_dockedWidgets.append(new CGeorgesTreeViewDialog(m_mainDock)); - Q_ASSERT(m_dockedWidgets.size() > 1); - m_mainDock->tabifyDockWidget(m_dockedWidgets.at(m_dockedWidgets.size() - 2), m_dockedWidgets.last()); - }*/ - - // TODO: FileDialog & loadFile(); - //m_mainDock->addDockWidget(Qt::TopDockWidgetArea, new CGeorgesTreeViewDialog(m_mainDock, true)); - //m_mainDock->addDockWidget(Qt::LeftDockWidgetArea, new CGeorgesTreeViewDialog(m_mainDock, true)); - //QString fileName = QFileDialog::getOpenFileName(); - //loadFile(fileName); + QString fileName = QFileDialog::getOpenFileName(this, tr("Open Form")); + if(!fileName.isNull()) + loadFile(fileName); } - void GeorgesEditorForm::newFile() + void GeorgesEditorForm::newFile() { - + // Assume it is a form, for now. We'll have to retrieve the DFN we'll be using as a base. + QString fileName = QFileDialog::getOpenFileName(this, tr("Select Base Form Definition"), m_lastSheetDir, "Form Definition (*.dfn)"); + if(!fileName.isNull()) + { + // Use the file loader to create the new form. + loadFile(fileName, true); + + // Save the folder we just opened for future dialogs. + QFileInfo pathInfo( fileName ); + m_lastSheetDir = pathInfo.absolutePath(); + } } void GeorgesEditorForm::save() { + m_lastActiveDock->write(); + m_saveAction->setEnabled(false); } @@ -184,25 +188,18 @@ namespace Plugin } } - void GeorgesEditorForm::loadFile(const QString fileName) + void GeorgesEditorForm::loadFile(const QString fileName) + { + loadFile(fileName, false); + } + + void GeorgesEditorForm::loadFile(const QString fileName, bool loadFromDfn) { QFileInfo info(fileName); - if (!m_dockedWidgets.size()) + // Check to see if the form is already loaded, if it is just raise it. + if (m_dockedWidgets.size()) { - CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock); - m_lastActiveDock = dock; - m_dockedWidgets.append(dock); - - m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last()); - connect(m_dockedWidgets.last(), SIGNAL(closing()), - this, SLOT(closingTreeView())); - connect(m_dockedWidgets.last(), SIGNAL(visibilityChanged(bool)), - m_dockedWidgets.last(), SLOT(checkVisibility(bool))); - } - else - { - Q_FOREACH(CGeorgesTreeViewDialog *wgt, m_dockedWidgets) { if (info.fileName() == wgt->loadedForm) @@ -211,17 +208,38 @@ namespace Plugin return; } } - CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock); - m_dockedWidgets.append(dock); - - connect(m_dockedWidgets.last(), SIGNAL(closing()), - this, SLOT(closingTreeView())); - connect(m_dockedWidgets.last(), SIGNAL(visibilityChanged(bool)), - m_dockedWidgets.last(), SLOT(checkVisibility(bool))); - Q_ASSERT(m_dockedWidgets.size() > 1); + } + + CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock); + dock->setUndoStack(m_undoStack); + m_lastActiveDock = dock; + m_dockedWidgets.append(dock); + + connect(m_dockedWidgets.last(), SIGNAL(closing()), this, SLOT(closingTreeView())); + connect(m_dockedWidgets.last(), SIGNAL(visibilityChanged(bool)), m_dockedWidgets.last(), SLOT(checkVisibility(bool))); + + // If there is more than one form open - tabify the new form. If this is the first form open add it to the dock. + if(m_dockedWidgets.size() > 1) + { m_mainDock->tabifyDockWidget(m_dockedWidgets.at(m_dockedWidgets.size() - 2), m_dockedWidgets.last()); } - CForm *form = m_dockedWidgets.last()->getFormByName(info.fileName()); + else + { + m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last()); + } + + // Retrieve the form and load the form. + NLGEORGES::CForm *form; + if(loadFromDfn) + { + // Get the form by DFN name. + form = m_dockedWidgets.last()->getFormByDfnName(info.fileName()); + } + else + { + form = m_dockedWidgets.last()->getFormByName(info.fileName()); + } + if (form) { m_dockedWidgets.last()->setForm(form); @@ -235,6 +253,7 @@ namespace Plugin } else { + nlwarning("Failed to load form: %s", info.fileName().toStdString().c_str()); m_dockedWidgets.last()->close(); } } @@ -284,4 +303,4 @@ namespace Plugin } } } -} /* namespace Plugin */ +} /* namespace GeorgesQt */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h index 6b270ca3d..77fdd1ec8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h @@ -23,7 +23,7 @@ // Qt includes #include -namespace Plugin +namespace GeorgesQt { class CGeorgesDirTreeDialog; @@ -41,6 +41,7 @@ public: public Q_SLOTS: void open(); void loadFile(const QString fileName); + void loadFile(const QString fileName, bool loadFromDfn); void newFile(); void save(); void settingsChanged(); @@ -66,10 +67,17 @@ private: QMainWindow *m_mainDock; + /// Contains a list of all of the open forms. QList m_dockedWidgets; + + /// Contains a pointer to the last known focal change for active documents. CGeorgesTreeViewDialog *m_lastActiveDock; + + /// Contains a record of the last directory a sheet file dialog was opened for. + QString m_lastSheetDir; + }; /* class GeorgesEditorForm */ -} /* namespace Plugin */ +} /* namespace GeorgesQt */ #endif // GEORGES_EDITOR_FORM_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp index 199bc20ca..7dd0be5cd 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp @@ -27,7 +27,7 @@ // Qt includes #include -namespace Plugin +namespace GeorgesQt { GeorgesEditorPlugin::~GeorgesEditorPlugin() @@ -97,4 +97,4 @@ QWidget *GeorgesEditorContext::widget() } -Q_EXPORT_PLUGIN(Plugin::GeorgesEditorPlugin) \ No newline at end of file +Q_EXPORT_PLUGIN(GeorgesQt::GeorgesEditorPlugin) \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.h index fabdd600c..e21d8c57a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.h @@ -38,7 +38,7 @@ namespace ExtensionSystem class IPluginSpec; } -namespace Plugin +namespace GeorgesQt { class GeorgesEditorForm; class GeorgesEditorPlugin : public QObject, public ExtensionSystem::IPlugin @@ -93,6 +93,6 @@ public: GeorgesEditorForm *m_georgesEditorForm; }; -} // namespace Plugin +} // namespace GeorgesQt #endif // LANDSCAPE_EDITOR_PLUGIN_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp index 4e021f681..7f405fb75 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp @@ -19,7 +19,7 @@ #include #include -namespace Plugin +namespace GeorgesQt { CGeorgesFileSystemModel::CGeorgesFileSystemModel(QString ldPath, QObject *parent) @@ -159,6 +159,6 @@ void CGeorgesFileSystemModel::checkLDPath() // } // return QSortFilterProxyModel::data(index, role); //} -} /* namespace NLQT */ +} /* namespace GeorgesQt */ /* end of file */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h index 03eb5ecc2..6c7a26055 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h @@ -20,7 +20,7 @@ #include #include -namespace Plugin +namespace GeorgesQt { class CGeorgesFileSystemModel : public QFileSystemModel @@ -74,6 +74,6 @@ private Q_SLOTS: // bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; //}; -} /* namespace NLQT */ +} /* namespace GeorgesQt */ #endif // GEORGES_FILESYSTEM_MODEL_H \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp index 13b0dab03..5a38c4ecf 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp @@ -21,12 +21,20 @@ #include #include #include +#include // NeL includes #include #include #include +#include #include +#include +#include + +// OVQT Includes +#include "../core/icore.h" +#include "../core/core_constants.h" // Project includes #include "georges.h" @@ -39,7 +47,7 @@ using namespace NLMISC; using namespace NLGEORGES; -namespace Plugin +namespace GeorgesQt { CGeorgesTreeViewDialog::CGeorgesTreeViewDialog(QWidget *parent /*= 0*/) @@ -50,6 +58,12 @@ namespace Plugin m_georges = new CGeorges; loadedForm = ""; + // Set the default sheet dir dir to the level design path. + m_lastSheetDir = "."; + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup(Core::Constants::DATA_PATH_SECTION); + m_lastSheetDir = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString(); + settings->endGroup(); m_ui.setupUi(this); m_header = new ExpandableHeaderView(Qt::Horizontal, m_ui.treeView); @@ -65,6 +79,10 @@ namespace Plugin FormDelegate *formdelegate = new FormDelegate(this); m_ui.treeView->setItemDelegateForColumn(1, formdelegate); + // Set up custom context menu. + setContextMenuPolicy(Qt::CustomContextMenu); + connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint&))); + connect(m_ui.treeView, SIGNAL(doubleClicked (QModelIndex)), this, SLOT(doubleClicked (QModelIndex))); connect(m_ui.checkBoxParent, SIGNAL(toggled(bool)), @@ -84,10 +102,12 @@ namespace Plugin void CGeorgesTreeViewDialog::headerClicked(int section) { if (section == 0) + { if (*(m_header->expanded())) m_ui.treeView->expandAll(); else m_ui.treeView->collapseAll(); + } } void CGeorgesTreeViewDialog::setForm(const CForm *form) @@ -95,11 +115,12 @@ namespace Plugin m_form = (UForm*)form; } - CForm* CGeorgesTreeViewDialog::getFormByName(const QString formName) + NLGEORGES::CForm* CGeorgesTreeViewDialog::getFormByName(const QString formName) { if(NLMISC::CPath::exists(formName.toStdString())) { - return (CForm*)m_georges->loadForm(formName.toStdString()); + //NLGEORGES::CForm *form = dynamic_cast(m_georges->loadForm(formName.toStdString())); + return (NLGEORGES::CForm *)m_georges->loadForm(formName.toStdString()); } //else //{ @@ -135,9 +156,58 @@ namespace Plugin // } // return form; //} + nlinfo("File '%s' does not exist!", formName.toStdString().c_str()); return 0; } + NLGEORGES::CForm* CGeorgesTreeViewDialog::getFormByDfnName(const QString dfnName) + { + if(NLMISC::CPath::exists(dfnName.toStdString())) + { + // Create a new form object. + NLGEORGES::CForm *form = new NLGEORGES::CForm(); + m_form = form; + + // Retrieve a copy of the root definition. + NLGEORGES::CFormDfn *formDfn = dynamic_cast(m_georges->loadFormDfn(dfnName.toStdString())); + + // Next we'll use the root node to build a new form. + NLGEORGES::CFormElmStruct *fes = dynamic_cast(getRootNode(0)); + fes->build(formDfn); + + // And then initialize the held elements; + for(uint i = 0; i(getRootNode(i+1)); + fes->build(formDfn); + } + + return form; + } + nlinfo("File '%s' does not exist!", dfnName.toStdString().c_str()); + return NULL; + } + + NLGEORGES::CFormElm *CGeorgesTreeViewDialog::getRootNode(uint slot) + { + NLGEORGES::CForm *form = getFormPtr(); + + if(slot == 0) + { + const NLGEORGES::UFormElm &formElm = form->getRootNode(); + return (NLGEORGES::CFormElm *)&formElm; + } + + // Make sure the slot value is valid and then return the corresponding element. + nlassert(slot < NLGEORGES::CForm::HeldElementCount+1); + return getFormPtr()->HeldElements[slot-1]; + } + + NLGEORGES::CForm *CGeorgesTreeViewDialog::getFormPtr() + { + return dynamic_cast(m_form); + } + void CGeorgesTreeViewDialog::loadFormIntoDialog(CForm *form) { @@ -150,7 +220,8 @@ namespace Plugin root = &m_form->getRootNode(); QStringList parents; - for (uint i = 0; i < m_form->getNumParent(); i++) + uint cnt = form->getParentCount(); + for (uint i = 0; i < cnt /*form->getParentCount()*/; i++) { UForm *u = m_form->getParentForm(i); parents << u->getFilename().c_str(); @@ -203,9 +274,34 @@ namespace Plugin } } - void CGeorgesTreeViewDialog::addParentForm(CForm *form) + void CGeorgesTreeViewDialog::addParentForm(QString parentFormNm) { - //((CForm*)_form)->insertParent(((CForm*)_form)->getParentCount(), form->getFilename().c_str(), form); + // Try to load the form + NLGEORGES::UForm *uParentForm = m_georges->loadForm(parentFormNm.toStdString()); + NLGEORGES::CForm *parentForm = dynamic_cast(uParentForm); + NLGEORGES::CForm *mainForm = static_cast(m_form); + + CGeorgesFormProxyModel * proxyModel = dynamic_cast(m_ui.treeView->model()); + CGeorgesFormModel *model = dynamic_cast(proxyModel->sourceModel()); + + if(parentForm) + { + if (mainForm != parentForm) + { + // Check it is the same dfn + if (parentForm->Elements.FormDfn == mainForm->Elements.FormDfn) + { + // This is the parent form selector + if(!mainForm->insertParent(mainForm->getParentCount(),parentFormNm.toStdString().c_str(), parentForm)) + nlwarning("Failed to add parent form: %s", parentFormNm.toStdString().c_str()); + else + { + nlinfo("Successfullyadded parent form: %s", parentFormNm.toStdString().c_str()); + model->addParentForm(parentFormNm); + } + } + } + } } void CGeorgesTreeViewDialog::modifiedFile( ) @@ -221,12 +317,12 @@ namespace Plugin void CGeorgesTreeViewDialog::write( ) { - //COFile file; - //std::string s = CPath::lookup(loadedForm.toStdString(), false); - //if (file.open (s)) - //{ - // try - // { + NLMISC::COFile file; + std::string s = NLMISC::CPath::lookup(loadedForm.toStdString(), false); + if(file.open (s)) + { + try + { // if (loadedForm.contains(".typ")) // { // //nlassert (Type != NULL); @@ -239,7 +335,7 @@ namespace Plugin // // flushValueChange (); // //} // //Type->write (xmlStream.getDocument (), theApp.Georges4CVS); - // //modify (NULL, NULL, false); + // //modify (NULL, NULL, false); // //flushValueChange (); // //UpdateAllViews (NULL); // //return TRUE; @@ -261,17 +357,17 @@ namespace Plugin // } // else // { - // nlassert (_form != NULL); + nlassert (m_form != NULL); - // // Write the file + // Write the file // /*if (IsModified ()) // { // ((CForm*)(UForm*)Form)->Header.MinorVersion++; // }*/ // //((CForm*)(UForm*)Form)->write (xmlStream.getDocument (), lpszPathName, theApp.Georges4CVS); - // _form->write(file, false); - // setWindowTitle(windowTitle().remove("*")); - // _modified = false; + m_form->write(file, false); + setWindowTitle(windowTitle().remove("*")); + m_modified = false; // //if (strcmp (xmlStream.getErrorString (), "") != 0) // //{ // // char message[512]; @@ -285,16 +381,16 @@ namespace Plugin // // Get the left view // //CView* pView = getLeftView (); // } - // } - // catch (Exception &e) - // { - // nlerror("Error while loading file: %s", e.what()); - // } - //} - //else - //{ //if (!file.open()) - // nlerror("Can't open the file %s for writing.", s.c_str()); - //} + } + catch (Exception &e) + { + nlerror("Error while loading file: %s", e.what()); + } + } + else + { + nlerror("Can't open the file %s for writing.", s.c_str()); + } } void CGeorgesTreeViewDialog::doubleClicked ( const QModelIndex & index ) @@ -385,4 +481,121 @@ namespace Plugin } } -} /* namespace NLQT */ + void CGeorgesTreeViewDialog::showContextMenu(const QPoint &pos) + { + QMenu contextMenu; + QMenu *structContext = NULL; + QPoint globalPos = this->mapToGlobal(pos); + + // Fisrt we're going to see if we've right clicked on a new item and select it. + const QModelIndex &index = this->m_ui.treeView->currentIndex(); + + if(!index.isValid()) + return; + + CGeorgesFormProxyModel * mp = dynamic_cast(m_ui.treeView->model()); + CGeorgesFormModel *m = dynamic_cast(mp->sourceModel()); + QModelIndex sourceIndex = mp->mapToSource(index); + + if (m) + { + + CFormItem *item = m->getItem(sourceIndex); + + // Right click on the "parents" item + if (item->data(0) == "parents") + contextMenu.addAction("Add parent..."); + // Right click on a parent item + else if(item->parent() && item->parent()->data(0) == "parents") + { + contextMenu.addAction("Add parent..."); + contextMenu.addAction("Remove parent"); + } + else if(item->getFormElm()->isArray()) + contextMenu.addAction("Add array entry..."); + else if(item->getFormElm()->isStruct()) + { + QMenu *structContext = new QMenu("Add struct element...", this); + contextMenu.addMenu(structContext); + + NLGEORGES::UFormDfn *defn = item->getFormElm()->getStructDfn(); + if(defn) + { + for(uint defnNum=0; defnNum < defn->getNumEntry(); defnNum++) + { + std::string entryName; + std::string dummy; + UFormElm::TWhereIsValue *whereV = new UFormElm::TWhereIsValue; + bool result = defn->getEntryName(defnNum, entryName); + bool result2 = item->getFormElm()->getValueByName(dummy, entryName.c_str(), NLGEORGES::UFormElm::Eval, whereV); + + + if(result2 && *whereV != UFormElm::ValueForm) + { + structContext->addAction(entryName.c_str()); + } + delete whereV; + } + } + } + else if(item->getFormElm()->isAtom() && item->valueFrom() == NLGEORGES::UFormElm::ValueForm) + contextMenu.addAction("Revert to parent/default..."); + + QAction *selectedItem = contextMenu.exec(globalPos); + if(selectedItem) + { + if(selectedItem->text() == "Add parent...") + { + // Get the file extension of the form so we can build a dialog pattern. + QString file = m_form->getFilename().c_str(); + file = file.remove(0,file.indexOf(".")+1); + QString filePattern = "Parent Sheets (*."+file+")"; + + nlinfo("parent defn name '%s'", file.toStdString().c_str()); + QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select parent sheets..."), m_lastSheetDir, filePattern); + if(!fileNames.isEmpty()) + { + Q_FOREACH(QString fileToParent, fileNames) + { + // Get just the filename. Georges doesn't want the path. + QFileInfo pathInfo( fileToParent ); + QString tmpFileName( pathInfo.fileName() ); + + nlinfo("requesting to add parent form '%s'", tmpFileName.toStdString().c_str()); + + // Call to add the form and load it into the Georges form. + addParentForm(tmpFileName); + + // Save the file lookup path for future dialog boxes. + m_lastSheetDir = pathInfo.absolutePath(); + } + } + m_ui.treeView->expandAll(); + } + else if(selectedItem->text() == "Remove parent") + { + NLGEORGES::CForm *form = static_cast(m_form); + QString parentFileName = item->data(0).toString(); + + for(uint num = 0; num < form->getParentCount(); num++) + { + QString curParentName = form->getParent(num)->getFilename().c_str(); + if(parentFileName == curParentName) + { + form->removeParent(num); + m->removeParentForm(parentFileName); + break; + } + } + + m_ui.treeView->expandAll(); + } + + } // if selected context menu item is valid. + } // if 'm' model valid. + + if(structContext) + delete structContext; + } + +} /* namespace GeorgesQt */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.h index 4992c9b23..53e36ec22 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.h @@ -22,6 +22,9 @@ // Qt includes #include +#include +#include + // STL includes @@ -33,11 +36,12 @@ namespace NLGEORGES { class UForm; class CForm; + class CFormElm; } using namespace NLGEORGES; -namespace Plugin +namespace GeorgesQt { class CGeorges; @@ -53,13 +57,27 @@ namespace Plugin bool isModified() {return m_modified;} void setModified(bool m) {m_modified = m;} - CForm* getFormByName(const QString); - void addParentForm(CForm *form); + NLGEORGES::CForm* getFormByName(const QString formName); + NLGEORGES::CForm* getFormByDfnName(const QString dfnName); + + /// Retrieves the root element based on the slot (document or held elements.) + NLGEORGES::CFormElm *getRootNode(uint slot); + + /// Returns the form as a CForm pointer. + NLGEORGES::CForm *getFormPtr(); + + void addParentForm(QString parentFormNm); void write ( ); QTabWidget* tabWidget() { return m_ui.treeViewTabWidget; } + void setUndoStack(QUndoStack *stack) { + m_undoStack = stack; + } + + + QString loadedForm; protected: @@ -75,6 +93,7 @@ namespace Plugin void loadFormIntoDialog(CForm *form = 0); void modifiedFile( ); void checkVisibility(bool); + void showContextMenu(const QPoint &pos); private Q_SLOTS: void doubleClicked ( const QModelIndex & index ); @@ -87,10 +106,15 @@ namespace Plugin UForm *m_form; CGeorges *m_georges; + QUndoStack *m_undoStack; + + /// Contains a record of the last directory a sheet file dialog was opened for. + QString m_lastSheetDir; + bool m_modified; }; /* CGeorgesTreeViewDialog */ -} /* namespace NLQT */ +} /* namespace GeorgesQt */ #endif // GEORGES_TREEVIEWER_DIALOG_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_form.ui index 183b16118..8d53bfdd6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_form.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_form.ui @@ -63,6 +63,9 @@ 0 + + true + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp index f6b9c441b..ca016e052 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp @@ -40,16 +40,16 @@ using namespace NLGEORGES; -namespace Plugin +namespace GeorgesQt { CGeorgesFormModel::CGeorgesFormModel(UFormElm *rootElm, QMap< QString, QStringList> deps, QString comment, QStringList parents, bool *expanded, QObject *parent) : QAbstractItemModel(parent) { - QList rootData; - rootData << "Value" << "Data" << "Extra";// << "Type"; + + m_rootData << "Value" << "Data" << "Extra";// << "Type"; m_rootElm = rootElm; - m_rootItem = new CFormItem(m_rootElm, rootData); + m_rootItem = new CFormItem(m_rootElm, m_rootData); m_dependencies = deps; m_comments = comment; m_parents = parents; @@ -669,6 +669,27 @@ namespace Plugin Q_EMIT layoutAboutToBeChanged(); Q_EMIT layoutChanged(); } -} /* namespace Plugin */ + + void CGeorgesFormModel::addParentForm(QString parentForm) + { + beginResetModel(); + m_parents.push_back(parentForm); + delete m_rootItem; + m_rootItem = new CFormItem(m_rootElm, m_rootData); + setupModelData(); + endResetModel(); + } + + void CGeorgesFormModel::removeParentForm(QString parentForm) + { + beginResetModel(); + m_parents.removeOne(parentForm); + + delete m_rootItem; + m_rootItem = new CFormItem(m_rootElm, m_rootData); + setupModelData(); + endResetModel(); + } +} /* namespace GeorgesQt */ /* end of file */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.h index 0d8ce6e69..05fadc498 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.h @@ -29,7 +29,7 @@ namespace NLGEORGES { class UFormElm; } -namespace Plugin +namespace GeorgesQt { class CFormItem; @@ -56,6 +56,9 @@ namespace Plugin bool showDefaults() { return m_showDefaults;} void setShowParents( bool show ); void setShowDefaults( bool show ); + void addParentForm(QString parentForm); + void removeParentForm(QString parentForm); + NLGEORGES::UFormElm *getRootForm() { return m_rootElm; } private: void setupModelData(); @@ -64,6 +67,7 @@ namespace Plugin CFormItem* m_rootItem; NLGEORGES::UFormElm* m_rootElm; + QList m_rootData; QMap< QString, QStringList> m_dependencies; QString m_comments; QStringList m_parents; @@ -71,10 +75,10 @@ namespace Plugin bool m_showParents; bool m_showDefaults; - bool *m_expanded; + bool *m_expanded; };/* class CGeorgesFormModel */ -} /* namespace Plugin */ +} /* namespace GeorgesQt */ #endif // GEORGESFORM_MODEL_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp index ae3720a57..a99997925 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp @@ -23,7 +23,7 @@ #include "georgesform_proxy_model.h" #include "georgesform_model.h" -namespace Plugin +namespace GeorgesQt { bool CGeorgesFormProxyModel::filterAcceptsRow(int sourceRow, @@ -76,6 +76,6 @@ namespace Plugin { return QSortFilterProxyModel::filterAcceptsColumn(sourceRow, sourceParent); } -} /* namespace Plugin */ +} /* namespace GeorgesQt */ /* end of file */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.h index 570913dab..73c384a99 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.h @@ -20,7 +20,7 @@ // Qt includes #include -namespace Plugin +namespace GeorgesQt { class CGeorgesFormProxyModel : public QSortFilterProxyModel @@ -40,6 +40,6 @@ namespace Plugin };/* class CGeorgesFormProxyModel */ -} /* namespace NLQT */ +} /* namespace GeorgesQt */ #endif // GEORGESFORM_PROXY_MODEL_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp index 416a418f1..df909f31a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -81,7 +81,7 @@ MissionCompilerMainWindow::MissionCompilerMainWindow(QWidget *parent) : connect(Core::ICore::instance(), SIGNAL(changeSettings()), this, SLOT(handleChangedSettings())); // Set the default data dir to the primitives path. - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(Core::Constants::DATA_PATH_SECTION); m_lastDir = settings->value(Core::Constants::PRIMITIVES_PATH).toString(); ui->dataDirEdit->setText(m_lastDir); @@ -381,7 +381,7 @@ bool MissionCompilerMainWindow::parsePrimForMissions(NLLIGO::IPrimitive const *p { std::string value; // if the node is a mission parse it - if (prim->getPropertyByName("class",value) && !stricmp(value.c_str(),"mission") ) + if (prim->getPropertyByName("class",value) && !NLMISC::stricmp(value.c_str(),"mission") ) { std::string name; prim->getPropertyByName("name",name); @@ -460,20 +460,20 @@ void MissionCompilerMainWindow::loadConfig() { } void MissionCompilerMainWindow::saveConfig() { - QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(MISSION_COMPILER_SECTION); - + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup(MISSION_COMPILER_SECTION); + QStringList servers; for(int row = 0; row < ui->publishServersList->count(); row++) { QListWidgetItem *item = ui->publishServersList->item(row); if(item->checkState() == Qt::Checked) servers << item->text(); - } - - settings->setValue(SETTING_PUBLISH_SERVER_CHECKS, servers); - - settings->endGroup(); + } + + settings->setValue(SETTING_PUBLISH_SERVER_CHECKS, servers); + + settings->endGroup(); settings->sync(); } diff --git a/code/nel/tools/3d/tile_edit_qt/tile_listwidgetitem.h b/code/nel/tools/3d/tile_edit_qt/tile_listwidgetitem.h index b12be6437..4cf6ee1ae 100644 --- a/code/nel/tools/3d/tile_edit_qt/tile_listwidgetitem.h +++ b/code/nel/tools/3d/tile_edit_qt/tile_listwidgetitem.h @@ -21,17 +21,17 @@ #include "ui_tile_widget_qt.h" class CTile_ListWidgetItem : public QListWidgetItem - { - public: - CTile_ListWidgetItem ( QListWidget * parent, int type = Type ):QListWidgetItem(parent,type){}; +{ +public: + CTile_ListWidgetItem ( QListWidget * parent, int type = Type ):QListWidgetItem(parent,type){} CTile_ListWidgetItem(QWidget *parent = 0); void initWidget(const QPixmap&, const QString&); - private: - Ui::TileWidget ui; +private: + Ui::TileWidget ui; // Qpixmap tilePixmap; // QString tileLabel; - }; +}; #endif \ No newline at end of file diff --git a/code/nel/tools/georges/georges2csv/georges2csv.cpp b/code/nel/tools/georges/georges2csv/georges2csv.cpp index e10d06bf5..da89cc9bc 100644 --- a/code/nel/tools/georges/georges2csv/georges2csv.cpp +++ b/code/nel/tools/georges/georges2csv/georges2csv.cpp @@ -289,7 +289,7 @@ void addQuotesRoundString (std::string &valueString) std::string hold=valueString; valueString.erase(); valueString='\"'; - for (unsigned i=0;i::iterator itErase = itIF; ++itIF; @@ -156,7 +157,7 @@ void readFormId( string& outputFileName ) } else { - if( getFileType( (*itIF).second, fileType ) ) + if(fileTypeGet) { // insert the association (file type/file type id) map::iterator itFT = FileTypeToId.find(fileType); @@ -290,7 +291,8 @@ void makeId( list& dirs ) //----------------------------------------------- void addId( string fileName ) { - if(fileName.empty() || fileName=="." || fileName==".." || fileName[0]=='_' || fileName.find(".#")==0) + string extStr = CFile::getExtension( fileName ); + if(fileName.empty() || fileName=="." || fileName==".." || (fileName[0]=='_' && extStr != "sound") || fileName.find(".#")==0) { //nlinfo("Discarding file '%s'", fileName.c_str()); NbFilesDiscarded++; @@ -300,7 +302,6 @@ void addId( string fileName ) { if( !ExtensionsAllowed.empty() ) { - string extStr = CFile::getExtension( fileName ); if( ExtensionsAllowed.find(extStr) == ExtensionsAllowed.end() ) { NbFilesDiscarded++; diff --git a/code/nel/tools/nel_unit_test/nel_unit_test.cpp b/code/nel/tools/nel_unit_test/nel_unit_test.cpp index ba9b8851c..45e579b13 100644 --- a/code/nel/tools/nel_unit_test/nel_unit_test.cpp +++ b/code/nel/tools/nel_unit_test/nel_unit_test.cpp @@ -34,6 +34,8 @@ using namespace std; #ifdef _MSC_VER +#include + /** A special stream buffer that output in the 'output debug string' feature of windows. */ class CDebugOutput : public streambuf diff --git a/code/nelns/login_service/mysql_helper.h b/code/nelns/login_service/mysql_helper.h index cc81f4647..7f6893b4a 100644 --- a/code/nelns/login_service/mysql_helper.h +++ b/code/nelns/login_service/mysql_helper.h @@ -70,7 +70,7 @@ public: private: //we don't want user to do a copy - CMysqlResult(const CMysqlResult &mysqlResult){}; + CMysqlResult(const CMysqlResult &mysqlResult){} MYSQL_RES *Result; }; diff --git a/code/nelns/login_system/nel_launcher_windows_ext/BarTabsWnd.h b/code/nelns/login_system/nel_launcher_windows_ext/BarTabsWnd.h index eefb93653..2437ae854 100644 --- a/code/nelns/login_system/nel_launcher_windows_ext/BarTabsWnd.h +++ b/code/nelns/login_system/nel_launcher_windows_ext/BarTabsWnd.h @@ -14,9 +14,9 @@ class CTabsObserver { public: - CTabsObserver() {}; + CTabsObserver() {} - virtual void OnTab(int iTab) {}; + virtual void OnTab(int iTab) {} }; class CBarTabsWnd : public CWnd diff --git a/code/ryzom/CMakeLists.txt b/code/ryzom/CMakeLists.txt index 4202738c1..933e305b5 100644 --- a/code/ryzom/CMakeLists.txt +++ b/code/ryzom/CMakeLists.txt @@ -1,35 +1,48 @@ #----------------------------------------------------------------------------- #Platform specifics -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) -FIND_PACKAGE(Libwww REQUIRED) FIND_PACKAGE(ZLIB) -IF(NOT WIN32 AND NOT APPLE) - FIND_PACKAGE(X11) -ENDIF(NOT WIN32 AND NOT APPLE) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common/src ) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common ) SET(RZ_SERVER_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/server/src) -IF(WITH_STATIC) - 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) - SET(CURL_DEFINITIONS -DCURL_STATICLIB) -ENDIF(WITH_STATIC) - ADD_SUBDIRECTORY(common) IF(WITH_RYZOM_CLIENT) + 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) + ADD_SUBDIRECTORY(client) ENDIF(WITH_RYZOM_CLIENT) diff --git a/code/ryzom/client/client_default.cfg b/code/ryzom/client/client_default.cfg index 997699ca8..311b7cddd 100644 --- a/code/ryzom/client/client_default.cfg +++ b/code/ryzom/client/client_default.cfg @@ -80,7 +80,7 @@ XMLOutGameInterfaceFiles = { "out_v2_keys.xml", }; -TexturesInterface = "texture_interfaces_v3"; +TexturesInterface = "texture_interfaces_v3"; TexturesInterfaceDXTC = "texture_interfaces_dxtc"; @@ -561,12 +561,9 @@ HelpPages = }; WebIgMainDomain = "atys.ryzom.com"; - -WebIgTrustedDomains = -{ +WebIgTrustedDomains = { "atys.ryzom.com" }; - PatchletUrl = "http://atys.ryzom.com/start/app_patchlet.php?patch=preload"; SelectedSlot = 0; diff --git a/code/ryzom/client/macosx/Info.plist b/code/ryzom/client/macosx/Info.plist new file mode 100644 index 000000000..8072a90c1 --- /dev/null +++ b/code/ryzom/client/macosx/Info.plist @@ -0,0 +1,40 @@ + + + + + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleGetInfoString + ${MACOSX_BUNDLE_INFO_STRING} + CFBundleIconFile + ${MACOSX_BUNDLE_ICON_FILE} + CFBundleIdentifier + ${MACOSX_BUNDLE_GUI_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + ${MACOSX_BUNDLE_LONG_VERSION_STRING} + CFBundleName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleSignature + ???? + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + NSHumanReadableCopyright + ${MACOSX_BUNDLE_COPYRIGHT} + LSMinimumSystemVersion + ${CMAKE_OSX_DEPLOYMENT_TARGET}.0 + LSFileQuarantineEnabled + + CSResourcesFileMapped + + LSRequiresCarbon + + LSApplicationCategoryType + public.app-category.role-playing-games + + diff --git a/code/ryzom/client/macosx/PkgInfo b/code/ryzom/client/macosx/PkgInfo new file mode 100644 index 000000000..bd04210fb --- /dev/null +++ b/code/ryzom/client/macosx/PkgInfo @@ -0,0 +1 @@ +APPL???? \ No newline at end of file diff --git a/code/ryzom/client/macosx/ryzom.icns b/code/ryzom/client/macosx/ryzom.icns new file mode 100644 index 000000000..6fb077d96 Binary files /dev/null and b/code/ryzom/client/macosx/ryzom.icns differ diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index 3971fb98f..26c8eb12a 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -42,30 +42,39 @@ SOURCE_GROUP("r2" FILES ${SRC_R2}) # on Mac, create a .App Bundle if(APPLE) + IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET) + SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6") + ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET) + SET(MACOSX_BUNDLE_INFO_STRING "Ryzom Core Client") - SET(MACOSX_BUNDLE_ICON_FILE "atys.icns") + SET(MACOSX_BUNDLE_ICON_FILE "ryzom.icns") SET(MACOSX_BUNDLE_GUI_IDENTIFIER "") SET(MACOSX_BUNDLE_LONG_VERSION_STRING ${NL_VERSION}) SET(MACOSX_BUNDLE_BUNDLE_NAME "Ryzom Core Client") SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "0.8") SET(MACOSX_BUNDLE_BUNDLE_VERSION "1.0") SET(MACOSX_BUNDLE_COPYRIGHT "Winchgate and The Ryzom Core Community") - - # TODO: in release mode, cmake could copy all the dylibs into the .app - # bundle for redistribution... should some part of cpack handle that? - # ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD - # # make frameworks directory in app bundle - # COMMAND ${CMAKE_COMMAND} -E make_directory - # ${CMAKE_CURRENT_BINARY_DIR}/ryzom_client.app/Contents/Frameworks - # # copy framework into app bundle - # COMMAND ${CMAKE_COMMAND} -E copy ${SOME_LIBRARY} - # ${CMAKE_CURRENT_BINARY_DIR}/ryzom_client.app/Contents/Frameworks - # # ... - # # install_name_tool the lib pathes + SET(RYZOM_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${MACOSX_BUNDLE_BUNDLE_NAME}.app) + SET(RYZOM_CONTENTS_DIR ${RYZOM_OUTPUT_DIR}/Contents) + SET(RYZOM_RESOURCES_DIR ${RYZOM_CONTENTS_DIR}/Resources) + SET(MAC_RESOURCES_DIR ${CMAKE_SOURCE_DIR}/ryzom/client/macosx) ENDIF(APPLE) ADD_EXECUTABLE(ryzom_client WIN32 MACOSX_BUNDLE ${SRC} ${SRC_INTERFACE} ${SRC_MODE} ${SRC_R2}) +IF(APPLE) + SET_TARGET_PROPERTIES(ryzom_client PROPERTIES OUTPUT_NAME ${MACOSX_BUNDLE_BUNDLE_NAME}) + SET_TARGET_PROPERTIES(ryzom_client PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${MAC_RESOURCES_DIR}/Info.plist) + ADD_CUSTOM_COMMAND(TARGET ryzom_client PRE_BUILD COMMAND mkdir -p ${RYZOM_RESOURCES_DIR}) + ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS ${MAC_RESOURCES_DIR}/PkgInfo ${RYZOM_CONTENTS_DIR}) + ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS ${MAC_RESOURCES_DIR}/ryzom.icns ${RYZOM_RESOURCES_DIR}) + ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS ${CMAKE_SOURCE_DIR}/ryzom/client/client_default.cfg ${RYZOM_RESOURCES_DIR}) + + IF(RYZOM_DATA_DIR) + ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp -R ARGS ${RYZOM_DATA_DIR} ${RYZOM_RESOURCES_DIR}) + ENDIF(RYZOM_DATA_DIR) +ENDIF(APPLE) + INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${LIBXML2_INCLUDE_DIR} diff --git a/code/ryzom/client/src/bg_downloader_access.cpp b/code/ryzom/client/src/bg_downloader_access.cpp index 699f01f3a..84fb0af5a 100644 --- a/code/ryzom/client/src/bg_downloader_access.cpp +++ b/code/ryzom/client/src/bg_downloader_access.cpp @@ -764,7 +764,7 @@ bool CBGDownloaderAccess::CDownloadCoTask::defaultMessageHandling(BGDownloader:: { case BGD_Priority: { - TThreadPriority tp; + BGDownloader::TThreadPriority tp; msg.serialEnum(tp); if (tp != Parent->_DownloadThreadPriority) { diff --git a/code/ryzom/client/src/cdb.h b/code/ryzom/client/src/cdb.h index 24c2dd5eb..f8ad3148a 100644 --- a/code/ryzom/client/src/cdb.h +++ b/code/ryzom/client/src/cdb.h @@ -302,10 +302,10 @@ public : virtual CCDBNodeLeaf *findLeafAtCount( uint& count ) = 0; /// Set the atomic branch flag (when all the modified nodes of a branch should be tranmitted at the same time) - void setAtomic( bool atomicBranch ) { _Atomic = atomicBranch; } + void setAtomic( bool atomicBranch ) { _AtomicFlag = atomicBranch; } /// Return true if the branch has the atomic flag - bool isAtomic() const { return _Atomic; } + bool isAtomic() const { return _AtomicFlag; } // test if the node is a leaf virtual bool isLeaf() const = 0; @@ -333,14 +333,14 @@ public : protected: /// Constructor - ICDBNode() : _Atomic(false) + ICDBNode() : _AtomicFlag(false) { if (_DBSM == NULL) _DBSM = NLMISC::CStringMapper::createLocalMapper(); _Name = NLMISC::CStringMapper::emptyId(); } /// Constructor - ICDBNode (const std::string &name) : _Atomic(false) + ICDBNode (const std::string &name) : _AtomicFlag(false) { if (_DBSM == NULL) _DBSM = NLMISC::CStringMapper::createLocalMapper(); _Name = _DBSM->localMap(name); @@ -351,7 +351,7 @@ protected: void _buildFullName(NLMISC::CSString &fullName); /// Atomic flag: is the branch an atomic group, or is the leaf a member of an atomic group - bool _Atomic : 1; + bool _AtomicFlag : 1; /// Name of the node NLMISC::TStringId _Name; diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index e0ed33abe..081bc3ad5 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -841,6 +841,7 @@ void CClientConfig::setValues() if (nlstricmp(varPtr->asString(), "Auto") == 0 || nlstricmp(varPtr->asString(), "0") == 0) ClientCfg.Driver3D = CClientConfig::DrvAuto; else if (nlstricmp(varPtr->asString(), "OpenGL") == 0 || nlstricmp(varPtr->asString(), "1") == 0) ClientCfg.Driver3D = CClientConfig::OpenGL; else if (nlstricmp(varPtr->asString(), "Direct3D") == 0 || nlstricmp(varPtr->asString(), "2") == 0) ClientCfg.Driver3D = CClientConfig::Direct3D; + else if (nlstricmp(varPtr->asString(), "OpenGLES") == 0 || nlstricmp(varPtr->asString(), "3") == 0) ClientCfg.Driver3D = CClientConfig::OpenGLES; } else cfgWarning ("Default value used for 'Driver3D' !!!"); diff --git a/code/ryzom/client/src/client_cfg.h b/code/ryzom/client/src/client_cfg.h index 3925aaf2d..9f4787062 100644 --- a/code/ryzom/client/src/client_cfg.h +++ b/code/ryzom/client/src/client_cfg.h @@ -53,7 +53,7 @@ using std::string; //--------------------------------------------------- struct CClientConfig { - enum TDriver3D { DrvAuto = 0, OpenGL, Direct3D }; + enum TDriver3D { DrvAuto = 0, OpenGL, Direct3D, OpenGLES }; enum TDriverSound { SoundDrvAuto = 0, SoundDrvFMod, SoundDrvOpenAL, SoundDrvDirectSound, SoundDrvXAudio2 }; enum TStageLCTUsage { StageUseNoLCT = 0, StageUseAllLCT, StageUsePosOnlyLCT }; diff --git a/code/ryzom/client/src/ground_fx_manager.cpp b/code/ryzom/client/src/ground_fx_manager.cpp index 92267dd2a..2d3ce3810 100644 --- a/code/ryzom/client/src/ground_fx_manager.cpp +++ b/code/ryzom/client/src/ground_fx_manager.cpp @@ -64,7 +64,7 @@ CGroundFXManager::CGroundFXManager() : _MinSpeed(1.5f), _MaxSpeed(6.f), _SpeedWaterWalkFast(3.f), - _SpeedWaterSwimFast(3.f), + _SpeedWaterSwimFast(2.f), _MaxDist(50.f), _MaxNumFX(10), _NumFX(0), @@ -495,7 +495,7 @@ void CGroundFXManager::update(const NLMISC::CVectorD &camPos) break; case CInstance::Swim: if (speed == 0.f) fxName = "StepSwimIdle.ps"; - else if (speed > _SpeedWaterWalkFast) + else if (speed > _SpeedWaterSwimFast) { fxName = "StepSwimSpeed.ps"; fxNameUnderWater = "StepSwimSpeedUnderWater.ps"; diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index a43dd97c0..ef48fe603 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -819,33 +819,43 @@ void prelogInit() nmsg = "Creating 3d driver..."; ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); - bool direct3D = false; + UDriver::TDriver driver = UDriver::OpenGl; #ifdef NL_OS_WINDOWS + uint icon = (uint)LoadIcon(HInstance, MAKEINTRESOURCE(IDI_MAIN_ICON)); +#else + uint icon = 0; +#endif // NL_OS_WINDOWS + switch(ClientCfg.Driver3D) { case CClientConfig::DrvAuto: +#ifdef NL_OS_WINDOWS { // Fallback to D3D for card other than nVidia std::string deviceName; uint64 drvVersion; - CSystemInfo::getVideoInfo( deviceName, drvVersion); + CSystemInfo::getVideoInfo(deviceName, drvVersion); strlwr(deviceName); - direct3D = strstr(deviceName.c_str(), NVIDIA_RECOMMANDED_DRIVERS_STRING_TEST) == NULL; + driver = strstr(deviceName.c_str(), NVIDIA_RECOMMANDED_DRIVERS_STRING_TEST) == NULL ? UDriver::Direct3d:UDriver::OpenGl; } break; + case CClientConfig::Direct3D: + driver = UDriver::Direct3d; + break; +#endif // NL_OS_WINDOWS case CClientConfig::OpenGL: - direct3D = false; + driver = UDriver::OpenGl; break; - case CClientConfig::Direct3D: - direct3D = true; + case CClientConfig::OpenGLES: + driver = UDriver::OpenGlEs; + break; + default: break; } - Driver = UDriver::createDriver ((uint)LoadIcon (HInstance, MAKEINTRESOURCE(IDI_MAIN_ICON)), direct3D); -#else // NL_OS_WINDOWS - Driver = UDriver::createDriver (); -#endif // NL_OS_WINDOWS + Driver = UDriver::createDriver(icon, driver); + if(Driver == NULL) { ExitClientError (CI18N::get ("Can_t_load_the_display_driver").toUtf8().c_str ()); @@ -1111,7 +1121,7 @@ void prelogInit() CBloomEffect::getInstance().setDriver(Driver); // init bloom effect - CBloomEffect::getInstance().init(!direct3D); + CBloomEffect::getInstance().init(driver != UDriver::Direct3d); nlinfo ("PROFILE: %d seconds for prelogInit", (uint32)(ryzomGetLocalTime ()-initStart)/1000); diff --git a/code/ryzom/client/src/interface_v3/chat_filter.h b/code/ryzom/client/src/interface_v3/chat_filter.h index 7524d6c7f..d717d9fb5 100644 --- a/code/ryzom/client/src/interface_v3/chat_filter.h +++ b/code/ryzom/client/src/interface_v3/chat_filter.h @@ -37,7 +37,7 @@ class CChatInputFilter : public NLMISC::CRefCount, public CChatWindow::IObserver { public: CChatInputFilter() {FilterType= CChatGroup::say; DynamicChatDbIndex= 0;} - ~CChatInputFilter(); + virtual ~CChatInputFilter(); /** Display a msg in the chat. The msg will be forwarded to all the listening windows * Listening windows will blick only if there isnt a single visible listening window, so that the player can know if there's a message * \param windowVisible is not NULL, points a bool that will be filled with true if one of the window on the which the msg was displayed is visible. diff --git a/code/ryzom/client/src/interface_v3/group_html.cpp b/code/ryzom/client/src/interface_v3/group_html.cpp index e17426a79..606c1f34b 100644 --- a/code/ryzom/client/src/interface_v3/group_html.cpp +++ b/code/ryzom/client/src/interface_v3/group_html.cpp @@ -580,7 +580,7 @@ void CGroupHTML::addLink (uint element_number, uint /* attribute_number */, HTCh // in ah: command we don't respect the uri standard so the HTAnchor_address doesn't work correctly _Link.push_back (suri); } - else if (_TrustedDomain && suri[0] == '#') + else if (_TrustedDomain && suri.find('#') == 0) { // Direct url (hack for lua beginElement) _Link.push_back (suri.substr(1)); diff --git a/code/ryzom/client/src/interface_v3/group_tree.h b/code/ryzom/client/src/interface_v3/group_tree.h index c2a299c01..556abab99 100644 --- a/code/ryzom/client/src/interface_v3/group_tree.h +++ b/code/ryzom/client/src/interface_v3/group_tree.h @@ -106,7 +106,7 @@ public: void setOpened(bool opened) { Opened = opened; } bool getOpened() const { return Opened; } void setText(const ucstring &text) { Text = text; } - const ucstring& getText() const { return Text; } + ucstring getText() const { return Text; } sint32 getFontSize() const { return FontSize; } void setFontSize(sint32 value) { FontSize = value; } sint32 getYDecal() const { return YDecal; } diff --git a/code/ryzom/client/src/interface_v3/interface_element.h b/code/ryzom/client/src/interface_v3/interface_element.h index 24982cad2..0202618ba 100644 --- a/code/ryzom/client/src/interface_v3/interface_element.h +++ b/code/ryzom/client/src/interface_v3/interface_element.h @@ -361,7 +361,7 @@ public: */ virtual void forceOpen() { setActive(true); } - virtual void enableBlink(int /* numBlinks */ = 0) {} + virtual void enableBlink(uint /* numBlinks */ = 0) {} virtual void disableBlink() {} virtual bool getBlink() const { return false; } diff --git a/code/ryzom/client/src/interfaces_manager/scroll_bar.h b/code/ryzom/client/src/interfaces_manager/scroll_bar.h index f9e42473a..5b2e248df 100644 --- a/code/ryzom/client/src/interfaces_manager/scroll_bar.h +++ b/code/ryzom/client/src/interfaces_manager/scroll_bar.h @@ -44,7 +44,7 @@ public: CScrollBar(uint id, float x, float y, float x_pixel, float y_pixel, float w, float h, float w_pixel, float h_pixel, bool vertical = true,CScrollableControl *ctrl = NULL); /// destructor - virtual ~CScrollBar() {}; + virtual ~CScrollBar() {} /// Display the control virtual void display(); diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index 157a97f8a..2d294dfd9 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -2528,7 +2528,6 @@ class CAHOnCreateAccountSubmit : public IActionHandler text->setMultiLineSpace(10); text->setColor(CRGBA(250, 30, 30, 255)); - std::vector< std::string > errors(5); errors[0] = "id=\"comment-Username\""; errors[1] = "id=\"comment-Password\""; diff --git a/code/ryzom/client/src/lua_ide_dll_nevrax/include/scintilla/Platform.h b/code/ryzom/client/src/lua_ide_dll_nevrax/include/scintilla/Platform.h index 5a07d109a..8a8d25ff0 100644 --- a/code/ryzom/client/src/lua_ide_dll_nevrax/include/scintilla/Platform.h +++ b/code/ryzom/client/src/lua_ide_dll_nevrax/include/scintilla/Platform.h @@ -277,8 +277,8 @@ private: Surface(const Surface &) {} Surface &operator=(const Surface &) { return *this; } public: - Surface() {}; - virtual ~Surface() {}; + Surface() {} + virtual ~Surface() {} static Surface *Allocate(); virtual void Init()=0; diff --git a/code/ryzom/client/src/r2/config_var.h b/code/ryzom/client/src/r2/config_var.h index 84c9f3891..674c38816 100644 --- a/code/ryzom/client/src/r2/config_var.h +++ b/code/ryzom/client/src/r2/config_var.h @@ -66,6 +66,22 @@ private: const T _Default; }; +// forward declarations for specialisations +std::string getConfigVarTypename(const float &dummy); +bool getConfigVarValue(CLuaObject &luaValue, float &dest); + +std::string getConfigVarTypename(const double &dummy); +bool getConfigVarValue(CLuaObject &luaValue, double &dest); + +std::string getConfigVarTypename(const sint32 &dummy); +bool getConfigVarValue(CLuaObject &luaValue, sint32 &dest); + +std::string getConfigVarTypename(const std::string &dummy); +bool getConfigVarValue(CLuaObject &luaValue, std::string &dest); + +std::string getConfigVarTypename(const NLMISC::CRGBA &dummy); +bool getConfigVarValue(CLuaObject &luaValue, NLMISC::CRGBA &dest); + template const T &CConfigVar::get() const { // Relies on R2 'getConfigVarValue' and 'getConfigVarTypename' functions specialization to retrieve the value (see below) diff --git a/code/ryzom/client/src/sound_manager.cpp b/code/ryzom/client/src/sound_manager.cpp index fb4b3708f..4d8827875 100644 --- a/code/ryzom/client/src/sound_manager.cpp +++ b/code/ryzom/client/src/sound_manager.cpp @@ -106,8 +106,11 @@ enum TFilterMapping // constructor //----------------------------------------------- CSoundManager::CSoundManager(IProgressCallback * /* progressCallBack */) -: _AudioMixer(NULL), - _EnvSoundRoot(NULL), +: _AudioMixer(NULL), + _GroupControllerEffects(NULL), + _GroupControllerEffectsGame(NULL), + _EnvSoundRoot(NULL), + _Sources(NULL), _UserEntitySoundLevel(1.0f) { _EnableBackgroundMusicAtTime= 0; @@ -137,9 +140,12 @@ CSoundManager::~CSoundManager() // detach the sound from the particule system NL3D::UParticleSystemSound::setPSSound(NULL); + _GroupControllerEffects = NULL; + _GroupControllerEffectsGame = NULL; + // free the audio mixer (and delete all sources) - if (_AudioMixer) - delete _AudioMixer; + delete _AudioMixer; + _AudioMixer = NULL; // release sound anim properly releaseSoundAnim(); @@ -403,6 +409,9 @@ void CSoundManager::reset () NL3D::UParticleSystemSound::setPSSound(NULL); + _GroupControllerEffects = NULL; + _GroupControllerEffectsGame = NULL; + delete _AudioMixer; _AudioMixer = NULL; @@ -421,7 +430,6 @@ void CSoundManager::reset () //--------------------------------------------------- void CSoundManager::init(IProgressCallback *progressCallBack) { - _NextId = 1; _EnvSoundRoot = NULL; _PlaySound = true; @@ -477,6 +485,10 @@ void CSoundManager::init(IProgressCallback *progressCallBack) */ new CSoundAnimManager(_AudioMixer); + // get the controller group for effects + _GroupControllerEffects = _AudioMixer->getGroupController("sound:effects"); + _GroupControllerEffectsGame = _AudioMixer->getGroupController("sound:effects:game"); + // restore the volume SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume); SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume); @@ -612,7 +624,7 @@ void CSoundManager::init(IProgressCallback *progressCallBack) // add a new source to the world, attached to the specified entity // return 0 if creation failed, sound id if creation was successful //----------------------------------------------- -uint32 CSoundManager::addSource( const NLMISC::TStringId &soundName, const NLMISC::CVector &position, bool play, bool loop, const CEntityId &id) +CSoundManager::TSourceId CSoundManager::addSource( const NLMISC::TStringId &soundName, const NLMISC::CVector &position, bool play, bool loop, const CEntityId &id) { uint32 retValue = 0; @@ -642,22 +654,16 @@ uint32 CSoundManager::addSource( const NLMISC::TStringId &soundName, const NLMIS pSource->play(); } + TSourceId sourceId = _Sources.insert(pSource); + // attach the source to the entity, if specified if (id != CEntityId::Unknown ) { - _AttachedSources.insert( TMultiMapEntityToSource::value_type( id, pSource ) ); + _AttachedSources.insert( TMultiMapEntityToSource::value_type( id, sourceId ) ); } - // set source id - retValue = _NextId; - - // add the new source - _Sources.insert( TMapIdToSource::value_type( _NextId, pSource ) ); - - ++_NextId; - // return the id of the source - return retValue; + return sourceId; } // addSource // @@ -726,26 +732,22 @@ bool CSoundManager::spawnSource(const NLMISC::TStringId &soundName, const NLMISC // removeSource: // remove a source //--------------------------------------------------- -void CSoundManager::removeSource( uint32 sourceId ) +void CSoundManager::removeSource(CSoundManager::TSourceId sourceId) { nldebug("remove the source : %d", sourceId); /// \todo Malkav : optimize speed nldebug("nb sources = %d", _Sources.size() ); - TMapIdToSource::iterator itS = _Sources.find( sourceId ); - if (itS != _Sources.end() ) + USource *pSource = _Sources.get(sourceId); + if (pSource) { - USource *pSource = (*itS).second; - if ( pSource == NULL ) - return; - TMultiMapEntityToSource::iterator it = _AttachedSources.begin();//, itOld; for ( ; it != _AttachedSources.end() ; ++it) { - if ( (*it).second == pSource ) + if ( (*it).second == sourceId ) { - (*it).second = NULL; + (*it).second = 0; // itOld = it; // ++it; @@ -759,8 +761,9 @@ nldebug("nb sources = %d", _Sources.size() ); } // delete the source -// _AudioMixer->removeSource (pSource); delete pSource; + // i think there was something going on here + _Sources.erase(sourceId); } } // removeSource // @@ -789,7 +792,7 @@ void CSoundManager::updateEntityPos( const CEntityId &id, const NLMISC::CVector for ( it = range.first; it != range.second ; ++it) { - (*it).second->setPos( pos ); + _Sources.get((*it).second)->setPos( pos ); } } // updateEntityPos // @@ -805,7 +808,7 @@ void CSoundManager::updateEntityVelocity( const CEntityId &id, const NLMISC::CVe for ( it = range.first; it != range.second ; ++it) { - (*it).second->setVelocity( velocity ); + _Sources.get((*it).second)->setVelocity( velocity ); } } // updateEntityVelocity // @@ -822,7 +825,7 @@ void CSoundManager::updateEntityDirection( const CEntityId &id, const NLMISC::CV for ( it = range.first; it != range.second ; ++it) { - (*it).second->setDirection( dir ); + _Sources.get((*it).second)->setDirection( dir ); } } // updateEntityOrientation // @@ -837,26 +840,15 @@ void CSoundManager::removeEntity( const CEntityId &id) TMultiMapEntityToSource::iterator it; const std::pair range = _AttachedSources.equal_range( id ); - - USource *pSource; + for ( it = range.first; it != range.second ; ++it) { - pSource = (*it).second; - if ( pSource != NULL) + TSourceId sourceId = (*it).second; + if (sourceId) { - TMapIdToSource::iterator itS = _Sources.begin();//, itOld; - - for ( ; itS != _Sources.end() ; ++itS) - { - if ( (*itS).second == pSource ) - { - (*itS).second = NULL; - _Sources.erase( itS ); - break; - } - } - // delete the source - delete (*it).second; + USource *pSource = _Sources.get(sourceId); + delete pSource; + _Sources.erase(sourceId); } } @@ -869,34 +861,24 @@ void CSoundManager::removeEntity( const CEntityId &id) //--------------------------------------------------- // setSoundPosition : //--------------------------------------------------- -void CSoundManager::setSoundPosition( uint32 soundId, const NLMISC::CVector &position) +void CSoundManager::setSoundPosition(TSourceId sourceId, const NLMISC::CVector &position) { if (!_PlaySound) return; - TMapIdToSource::iterator it = _Sources.find( soundId ); - if (it != _Sources.end() ) - { - nlassert( (*it).second ); - - (*it).second->setPos( position ); - } + USource *pSource = _Sources.get(sourceId); + if (pSource) pSource->setPos(position); } // setSoundPosition // //--------------------------------------------------- // loopSound : //--------------------------------------------------- -void CSoundManager::loopSound( uint32 soundId, bool loop) +void CSoundManager::loopSound(TSourceId sourceId, bool loop) { if (!_PlaySound) return; - TMapIdToSource::iterator it = _Sources.find( soundId ); - if (it != _Sources.end() ) - { - nlassert( (*it).second ); - - (*it).second->setLooping( loop ); - } + USource *pSource = _Sources.get(sourceId); + if (pSource) pSource->setLooping(loop); } // loopSound // @@ -904,19 +886,17 @@ void CSoundManager::loopSound( uint32 soundId, bool loop) // playSound : // start or stop playing sound //--------------------------------------------------- -void CSoundManager::playSound( uint32 soundId, bool play) +void CSoundManager::playSound(TSourceId sourceId, bool play) { if (!_PlaySound) return; - TMapIdToSource::iterator it = _Sources.find( soundId ); - if (it != _Sources.end() ) + USource *pSource = _Sources.get(sourceId); + if (pSource) { - nlassert( (*it).second ); - if (play) - (*it).second->play(); + pSource->play(); else - (*it).second->stop(); + pSource->stop(); } } // loopSound // @@ -926,16 +906,10 @@ void CSoundManager::playSound( uint32 soundId, bool play) // isPlaying : // return true if the source is playing //--------------------------------------------------- -bool CSoundManager::isPlaying( uint32 sourceId ) +bool CSoundManager::isPlaying(TSourceId sourceId) { - TMapIdToSource::iterator it = _Sources.find( sourceId ); - if (it != _Sources.end() ) - { - nlassert( (*it).second ); - - return ( (*it).second->isPlaying() ); - } - + USource *pSource = _Sources.get(sourceId); + if (pSource) return pSource->isPlaying(); return false; } // isPlaying // @@ -999,16 +973,10 @@ bool CSoundManager::setSoundForSource( uint32 sourceId, TSound sound, const CVec // setSourceGain : // set the gain of the specified source //--------------------------------------------------- -void CSoundManager::setSourceGain( uint32 sourceId, float gain) +void CSoundManager::setSourceGain(TSourceId sourceId, float gain) { - TMapIdToSource::const_iterator it = _Sources.find( sourceId ); - if (it != _Sources.end() ) - { - USource *pSource = (*it).second; - nlassert( pSource ); - - pSource->setGain( gain ); - } + USource *pSource = _Sources.get(sourceId); + if (pSource) pSource->setGain( gain ); } // setSourceGain // @@ -1016,17 +984,10 @@ void CSoundManager::setSourceGain( uint32 sourceId, float gain) // getSourceGain : // get the gain of the specified source (-1 if source not found) //--------------------------------------------------- -float CSoundManager::getSourceGain( uint32 sourceId ) +float CSoundManager::getSourceGain(TSourceId sourceId) { - TMapIdToSource::const_iterator it = _Sources.find( sourceId ); - if (it != _Sources.end() ) - { - USource *pSource = (*it).second; - nlassert( pSource ); - - return ( pSource->getGain() ); - } - + USource *pSource = _Sources.get(sourceId); + if (pSource) return pSource->getGain(); return -1; } // getSourceGain // @@ -1035,16 +996,10 @@ float CSoundManager::getSourceGain( uint32 sourceId ) // setSourcePitch : // set the Pitch of the specified source //--------------------------------------------------- -void CSoundManager::setSourcePitch( uint32 sourceId, float Pitch) +void CSoundManager::setSourcePitch(TSourceId sourceId, float Pitch) { - TMapIdToSource::const_iterator it = _Sources.find( sourceId ); - if (it != _Sources.end() ) - { - USource *pSource = (*it).second; - nlassert( pSource ); - - pSource->setPitch( Pitch ); - } + USource *pSource = _Sources.get(sourceId); + if (pSource) pSource->setPitch(Pitch); } // setSourcePitch // @@ -1052,17 +1007,10 @@ void CSoundManager::setSourcePitch( uint32 sourceId, float Pitch) // getSourcePitch : // get the Pitch of the specified source (-1 if source not found) //--------------------------------------------------- -float CSoundManager::getSourcePitch( uint32 sourceId ) +float CSoundManager::getSourcePitch(TSourceId sourceId) { - TMapIdToSource::const_iterator it = _Sources.find( sourceId ); - if (it != _Sources.end() ) - { - USource *pSource = (*it).second; - nlassert( pSource ); - - return ( pSource->getPitch() ); - } - + USource *pSource = _Sources.get(sourceId); + if (pSource) return pSource->getPitch(); return -1; } // getSourcePitch // @@ -1204,23 +1152,26 @@ void CSoundManager::playPositionedSounds( const CVector& /* pos */ ) list::iterator itPSnd; for( itPSnd = _PositionedSounds.begin(); itPSnd != _PositionedSounds.end(); ++itPSnd ) { - TMapIdToSource::const_iterator itSrc = _Sources.find( *itPSnd ); - if( itSrc == _Sources.end() ) + USource *pSource = _Sources.get(*itPSnd); + if (!pSource) { nlwarning(" : The source %d is unknown",*itPSnd); } - /* - if( (pos - (*itSrc).second.getPos()).norm() < ...) + else { - if( (*itSrc).second.pSource->isPlaying() == false ) + /* + if( (pos - (*itSrc).second.getPos()).norm() < ...) { - (*itSrc).second.pSource->play(); + if( (*itSrc).second.pSource->isPlaying() == false ) + { + (*itSrc).second.pSource->play(); + } + } + */ + if (!pSource->isPlaying()) + { + pSource->play(); } - } - */ - if( (*itSrc).second->isPlaying() == false ) - { - (*itSrc).second->play(); } } @@ -1597,7 +1548,8 @@ void CSoundManager::updateVolume() _AudioMixer->setEventMusicVolume(_GameMusicVolume); // update sfx volume - _AudioMixer->getListener()->setGain(_SFXVolume*_FadeSFXVolume); + _GroupControllerEffects->setGain(_SFXVolume); + _GroupControllerEffectsGame->setGain(_FadeSFXVolume); } } diff --git a/code/ryzom/client/src/sound_manager.h b/code/ryzom/client/src/sound_manager.h index 629d9a957..80401ea57 100644 --- a/code/ryzom/client/src/sound_manager.h +++ b/code/ryzom/client/src/sound_manager.h @@ -26,6 +26,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/vector.h" #include "nel/misc/config_file.h" +#include "nel/misc/fast_id_map.h" // game_share #include "nel/misc/entity_id.h" // sound @@ -45,8 +46,6 @@ namespace NLMISC class IProgressCallback; } - - /** * class managing all the sounds for the client * \author David Fleury @@ -55,9 +54,12 @@ namespace NLMISC */ class CSoundManager { +public: + typedef uint32 TSourceId; - typedef CHashMultiMap TMultiMapEntityToSource; - typedef std::map TMapIdToSource; +private: + typedef CHashMultiMap TMultiMapEntityToSource; + typedef NLMISC::CFastIdMap TMapIdToSource; /// Load the properties for this sound and aplly them. void loadProperties(const string &soundName, USource *source); @@ -86,7 +88,7 @@ public: /// Return the audio mixer instance pointer. NLSOUND::UAudioMixer *getMixer(); - uint32 addSource( const NLMISC::TStringId &soundName, const NLMISC::CVector &position, bool play = true , bool loop = false, const NLMISC::CEntityId &id = NLMISC::CEntityId::Unknown ); + TSourceId addSource( const NLMISC::TStringId &soundName, const NLMISC::CVector &position, bool play = true , bool loop = false, const NLMISC::CEntityId &id = NLMISC::CEntityId::Unknown ); /// spawn a new source to the world but sound manager don't keep any link and the sound will be automatically deleted when finnished bool spawnSource (const NLMISC::TStringId &soundName, NLSOUND::CSoundContext &context); @@ -98,7 +100,7 @@ public: * remove a source * \param uint32 source id */ - void removeSource( uint32 sourceId ); + void removeSource( TSourceId sourceId ); /** @@ -190,28 +192,28 @@ public: * \param uint32 source id * \param CVector& new position */ - void setSoundPosition( uint32 sourceId, const NLMISC::CVector &position); + void setSoundPosition( TSourceId sourceId, const NLMISC::CVector &position); /** * loop a sound (or stop looping) * \param uint32 source id * \param bool loop (true = loop) */ - void loopSound( uint32 sourceId, bool loop); + void loopSound( TSourceId sourceId, bool loop); /** * play or stop a sound * \param uint32 source id * \param bool play (true = play, false = stop) */ - void playSound( uint32 sourceId, bool play); + void playSound( TSourceId sourceId, bool play); /** * test whether the sepcified source is playing or not * \param uint32 source id * \return bool true if the source is playing */ - bool isPlaying( uint32 sourceId ); + bool isPlaying( TSourceId sourceId ); /** * select the env effect corresponding to tag @@ -236,14 +238,14 @@ public: * \param uint32 sourceId * \param float new gain (0-1) */ - void setSourceGain( uint32 sourceId, float gain); + void setSourceGain( TSourceId sourceId, float gain); /** * get source Gain * \param uint32 sourceId * \return float new gain (0-1) (-1 if source not found) */ - float getSourceGain( uint32 sourceId ); + float getSourceGain( TSourceId sourceId ); /** * set source Pitch @@ -251,14 +253,14 @@ public: * \param uint32 sourceId * \param float new Pitch (0-1) */ - void setSourcePitch( uint32 sourceId, float gain); + void setSourcePitch( TSourceId sourceId, float gain); /** * get source Pitch * \param uint32 sourceId * \return float new Pitch (0-1) (>0) (-1 if source not found) */ - float getSourcePitch( uint32 sourceId ); + float getSourcePitch( TSourceId sourceId ); /** * Play all the positioned sounds which are near the given position @@ -330,6 +332,12 @@ private: /// Pointer on the audio mixer object NLSOUND::UAudioMixer *_AudioMixer; + /// The root effects group controller for effects volume settings by the user + NLSOUND::UGroupController *_GroupControllerEffects; + + /// The root effects group controller for effects fading by the game + NLSOUND::UGroupController *_GroupControllerEffectsGame; + /// Pointer on the root of the environmental sounds tree (if any) NLSOUND::UEnvSound *_EnvSoundRoot; @@ -346,10 +354,7 @@ private: //CStepSounds _StepSounds; /// list of positioned sounds - std::list _PositionedSounds; - - /// the next value that will be used as id for the next sound to be created - uint32 _NextId; + std::list _PositionedSounds; /// Gain value for user entity sound. float _UserEntitySoundLevel; diff --git a/code/ryzom/client/src/stdpch.h b/code/ryzom/client/src/stdpch.h index 48c1a3c06..dd9f97b94 100644 --- a/code/ryzom/client/src/stdpch.h +++ b/code/ryzom/client/src/stdpch.h @@ -121,5 +121,6 @@ #ifdef NL_OS_WINDOWS #define NOMINMAX +#include #include #endif // NL_OS_WINDOWS diff --git a/code/ryzom/common/src/game_share/data_set_base.h b/code/ryzom/common/src/game_share/data_set_base.h index 0db688aa5..54bd790ab 100644 --- a/code/ryzom/common/src/game_share/data_set_base.h +++ b/code/ryzom/common/src/game_share/data_set_base.h @@ -437,7 +437,7 @@ public: // PUBLIC because template friend classes are not supported /// Return the pointer to the property value template - void getPropPointerForList( TSharedListRow **ppt, TPropertyIndex propIndex, const TDataSetRow& entityIndex, T* typeHint ) const + void getPropPointerForList( TSharedListRow **ppt, TPropertyIndex propIndex, const TDataSetRow& entityIndex, T* /* typeHint */ ) const { #ifndef FAST_MIRROR nlassert( (propIndex != INVALID_PROPERTY_INDEX) && (propIndex < (TPropertyIndex)_PropertyContainer.PropertyValueArrays.size()) ); // Wrong property diff --git a/code/ryzom/common/src/game_share/deployment_configuration.cpp b/code/ryzom/common/src/game_share/deployment_configuration.cpp index 86059fc7e..625600331 100644 --- a/code/ryzom/common/src/game_share/deployment_configuration.cpp +++ b/code/ryzom/common/src/game_share/deployment_configuration.cpp @@ -795,7 +795,7 @@ namespace DEPCFG else { // put the number of info blocks to the stream - uint32 count= _InfoBlocks.size(); + uint32 count= (uint32)_InfoBlocks.size(); stream.serial(count); // put the info blocks to the stream one by one for (TInfoBlocks::iterator it= _InfoBlocks.begin(); it!=_InfoBlocks.end(); ++it) @@ -1203,7 +1203,7 @@ namespace DEPCFG DROP_IF(exeRecord.CfgEntries.empty(), "No 'cfg' entriesfound in: "+exeRecord.FullName, ++errors ); // add a refference from the domains' shard map to the exe... - _DomainExes[exeRecord.DomainName][exeRecord.ShardName].push_back(_ExeRecords.size()); + _DomainExes[exeRecord.DomainName][exeRecord.ShardName].push_back((uint32)_ExeRecords.size()); // we may have hit errors but we go ahead anyway as in the case of errors the whole thing will be cleared out anyway _ExeRecords.push_back(exeRecord); @@ -1508,7 +1508,7 @@ NLMISC_CATEGORISED_COMMAND(depcfg,dumpDepCfgShards,"dump the shard set for the d DEPCFG::SAppDescription app; DEPCFG::CDeploymentConfiguration::getInstance().getApp(*dit,*ait,app); uint32 cfgFileLines=app.CfgFile.countLines(); - uint32 numDataPacks= app.DataPacks.size(); + uint32 numDataPacks= (uint32)app.DataPacks.size(); log.displayNL(" -- App: %-20s: %s (cfg file length: %d lines, data packs used: %d)",app.AppName.c_str(),app.CmdLine.c_str(),cfgFileLines,numDataPacks); } } diff --git a/code/ryzom/common/src/game_share/inventories.h b/code/ryzom/common/src/game_share/inventories.h index 1fd1cab48..2dfbb85bf 100644 --- a/code/ryzom/common/src/game_share/inventories.h +++ b/code/ryzom/common/src/game_share/inventories.h @@ -349,7 +349,7 @@ namespace INVENTORIES /// Serial from/to bit stream template - void serialAll( NLMISC::CBitMemStream& bms, const CInventoryCategoryTemplate *templ=0 ) + void serialAll( NLMISC::CBitMemStream& bms, const CInventoryCategoryTemplate * /* templ */ =0 ) { bms.serial( _SlotIndex, CInventoryCategoryTemplate::SlotBitSize ); @@ -385,7 +385,7 @@ namespace INVENTORIES /// Serial from/to bit stream template - void serialOneProp( NLMISC::CBitMemStream& bms, const CInventoryCategoryTemplate *templ=0 ) + void serialOneProp( NLMISC::CBitMemStream& bms, const CInventoryCategoryTemplate * /* templ */ =0 ) { bms.serial( _SlotIndex, CInventoryCategoryTemplate::SlotBitSize ); bms.serial( _OneProp ); diff --git a/code/ryzom/common/src/game_share/mirror_prop_value.h b/code/ryzom/common/src/game_share/mirror_prop_value.h index 08e96761d..1bb4c7571 100644 --- a/code/ryzom/common/src/game_share/mirror_prop_value.h +++ b/code/ryzom/common/src/game_share/mirror_prop_value.h @@ -22,7 +22,7 @@ #include "nel/misc/types_nl.h" #include "nel/misc/stream.h" #include "mirrored_data_set.h" - +#include /** * Read-only handler of a value of a property. @@ -1318,4 +1318,4 @@ protected: #endif // NL_MIRROR_PROP_VALUE_H -/* End of mirror_prop_value.h */ \ No newline at end of file +/* End of mirror_prop_value.h */ diff --git a/code/ryzom/common/src/game_share/mirror_prop_value_inline.h b/code/ryzom/common/src/game_share/mirror_prop_value_inline.h index cd4c71f4a..2824977f3 100644 --- a/code/ryzom/common/src/game_share/mirror_prop_value_inline.h +++ b/code/ryzom/common/src/game_share/mirror_prop_value_inline.h @@ -25,6 +25,7 @@ #include "nel/misc/common.h" //#endif +#include /* * Activate this define if you want to set a value into the mirror only if it is different from the previous value @@ -937,7 +938,7 @@ CMirrorPropValueAlice& CMirrorPropValueAlicetempReassign( srcValue ); } return *this; } @@ -1005,7 +1006,7 @@ NLNET::TServiceId8 CMirrorPropValueAlice::getWriterSer if ( _InMirror ) return CMirrorPropValue::getWriterServiceId(); else - return ~0; + return NLNET::TServiceId8(std::numeric_limits::max()); } #endif diff --git a/code/ryzom/common/src/game_share/persistent_data_inline.h b/code/ryzom/common/src/game_share/persistent_data_inline.h index 2500c524d..9a682afdb 100644 --- a/code/ryzom/common/src/game_share/persistent_data_inline.h +++ b/code/ryzom/common/src/game_share/persistent_data_inline.h @@ -420,7 +420,9 @@ inline const CPersistentDataRecord::CArg& CPersistentDataRecord::popNextArg(TTok inline void CPersistentDataRecord::popNextArg(TToken token,CPersistentDataRecord::CArg& result) { #ifdef NL_DEBUG - BOMB_IF(peekNextToken()!=token,"Error on read code - token requested doesn't match token found",return); + BOMB_IF(peekNextToken()!=token,"Error on read code - token requested doesn't match token found",return); + #else + nlunreferenced(token); #endif peekNextArg(result); @@ -445,7 +447,6 @@ inline void CPersistentDataRecord::popNextArg(TToken token,CPersistentDataRecord ++_ArgOffset; ++_TokenOffset; } - return; } //inline CPersistentDataRecord::CArg CPersistentDataRecord::popNextArg(TToken token) diff --git a/code/ryzom/common/src/game_share/scenario_entry_points.cpp b/code/ryzom/common/src/game_share/scenario_entry_points.cpp index 81dd3e6e2..36b3a6aea 100644 --- a/code/ryzom/common/src/game_share/scenario_entry_points.cpp +++ b/code/ryzom/common/src/game_share/scenario_entry_points.cpp @@ -19,6 +19,7 @@ //----------------------------------------------------------------------------- #include "stdpch.h" +#include "utils.h" #include "nel/misc/file.h" #include "nel/misc/command.h" diff --git a/code/ryzom/common/src/game_share/singleton_registry.h b/code/ryzom/common/src/game_share/singleton_registry.h index 516417c32..7a9cc0253 100644 --- a/code/ryzom/common/src/game_share/singleton_registry.h +++ b/code/ryzom/common/src/game_share/singleton_registry.h @@ -58,6 +58,7 @@ protected: // protect from untrolled instantiation // this method registers the singleton with the singleton registry IServiceSingleton(); + virtual ~IServiceSingleton() {} private: // prohibit copy diff --git a/code/ryzom/common/src/game_share/stdpch.h b/code/ryzom/common/src/game_share/stdpch.h index 18f6f00e0..f14a31608 100644 --- a/code/ryzom/common/src/game_share/stdpch.h +++ b/code/ryzom/common/src/game_share/stdpch.h @@ -66,4 +66,8 @@ #include -#include "utils.h" +#ifdef NL_OS_WINDOWS +# define NOMINMAX +# include +# include +#endif diff --git a/code/ryzom/common/src/game_share/txt_command.h b/code/ryzom/common/src/game_share/txt_command.h index f8d2ec39e..054f1bc93 100644 --- a/code/ryzom/common/src/game_share/txt_command.h +++ b/code/ryzom/common/src/game_share/txt_command.h @@ -50,21 +50,21 @@ static CTxtCommandSetPtr<__CTxtCommandSet_##setName> setName; //------------------------------------------------------------------------------------------------- #define TXT_COMMAND(cmdName,setName,CONTEXT_CLASS)\ -struct __CTxtCommand_##cmdName: public ITxtCommand\ +struct __CTxtCommand_##cmdName##CONTEXT_CLASS: public ITxtCommand\ {\ - static __CTxtCommand_##cmdName* getInstance()\ + static __CTxtCommand_##cmdName##CONTEXT_CLASS* getInstance()\ {\ - static __CTxtCommand_##cmdName *p=NULL;\ - if (p==NULL) p= new __CTxtCommand_##cmdName;\ + static __CTxtCommand_##cmdName##CONTEXT_CLASS *p=NULL;\ + if (p==NULL) p= new __CTxtCommand_##cmdName##CONTEXT_CLASS;\ return p;\ }\ virtual const char* getName() const {return #cmdName;}\ virtual CTxtCommandResult execute(CONTEXT_CLASS& context,const NLMISC::CVectorSString& args,const NLMISC::CSString& rawArgs,const NLMISC::CSString& fullCmdLine);\ private:\ - __CTxtCommand_##cmdName() {}\ + __CTxtCommand_##cmdName##CONTEXT_CLASS() {}\ };\ -static ITxtCommandRegisterer<__CTxtCommand_##cmdName,__CTxtCommandSet_##setName> __CTxtCommand_##cmdName##_Registerer;\ -CTxtCommandResult __CTxtCommand_##cmdName::execute(CONTEXT_CLASS& context,const NLMISC::CVectorSString& args,const NLMISC::CSString& rawArgs,const NLMISC::CSString& fullCmdLine) +static ITxtCommandRegisterer<__CTxtCommand_##cmdName##CONTEXT_CLASS,__CTxtCommandSet_##setName> __CTxtCommand_##cmdName##CONTEXT_CLASS##_Registerer;\ +CTxtCommandResult __CTxtCommand_##cmdName##CONTEXT_CLASS::execute(CONTEXT_CLASS& context,const NLMISC::CVectorSString& args,const NLMISC::CSString& rawArgs,const NLMISC::CSString& fullCmdLine) //------------------------------------------------------------------------------------------------- diff --git a/code/ryzom/server/src/admin_modules/admin_modules_itf.h b/code/ryzom/server/src/admin_modules/admin_modules_itf.h index 3f430ed43..5b6a4325a 100644 --- a/code/ryzom/server/src/admin_modules/admin_modules_itf.h +++ b/code/ryzom/server/src/admin_modules/admin_modules_itf.h @@ -33,10 +33,10 @@ #include "game_share/callback_adaptor.h" #include "nel/misc/time_nl.h" - + namespace ADMIN { - + class TGraphData; class TGraphDatas; @@ -50,12 +50,12 @@ namespace ADMIN // This is the interface used by PHP to call methods // on the Admin service module - class CAdminServiceWebItf + class CAdminServiceWebItf { protected: /// the callback server adaptor - std::auto_ptr _CallbackServer; + std::auto_ptr _CallbackServer; void getCallbakArray(NLNET::TCallbackItem *&arrayPtr, uint32 &arraySize) { @@ -94,7 +94,7 @@ namespace ADMIN public: /** Constructor, if you specify a replacement adaptor, then the object - * become owner of the adaptor (and it will be released with the + * become owner of the adaptor (and it will be released with the * interface). */ CAdminServiceWebItf(ICallbackServerAdaptor *replacementAdaptor = NULL) @@ -170,7 +170,7 @@ namespace ADMIN nldebug("CAdminServiceWeb::cb_globalCmd received from class '%s'", typeid(netbase).name()); #endif ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData()); - + CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass(); if (callback == NULL) @@ -195,7 +195,7 @@ namespace ADMIN nldebug("CAdminServiceWeb::cb_controlCmd received from class '%s'", typeid(netbase).name()); #endif ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData()); - + CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass(); if (callback == NULL) @@ -222,7 +222,7 @@ namespace ADMIN nldebug("CAdminServiceWeb::cb_serviceCmd received from class '%s'", typeid(netbase).name()); #endif ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData()); - + CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass(); if (callback == NULL) @@ -249,7 +249,7 @@ namespace ADMIN nldebug("CAdminServiceWeb::cb_getShardOrders received from class '%s'", typeid(netbase).name()); #endif ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData()); - + CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass(); if (callback == NULL) @@ -263,7 +263,7 @@ namespace ADMIN std::vector retValue; retValue = callback->on_getShardOrders(from); - + NLNET::CMessage retMsg("R_GSO"); nlWrite(retMsg, serialCont, retValue); @@ -280,7 +280,7 @@ namespace ADMIN nldebug("CAdminServiceWeb::cb_getStates received from class '%s'", typeid(netbase).name()); #endif ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData()); - + CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass(); if (callback == NULL) @@ -294,7 +294,7 @@ namespace ADMIN std::vector retValue; retValue = callback->on_getStates(from); - + NLNET::CMessage retMsg("R_GS"); nlWrite(retMsg, serialCont, retValue); @@ -311,7 +311,7 @@ namespace ADMIN nldebug("CAdminServiceWeb::cb_getHighRezGraphInfo received from class '%s'", typeid(netbase).name()); #endif ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData()); - + CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass(); if (callback == NULL) @@ -327,7 +327,7 @@ namespace ADMIN std::vector retValue; retValue = callback->on_getHighRezGraphInfo(from, varAddr); - + NLNET::CMessage retMsg("R_GHRGI"); nlWrite(retMsg, serialCont, retValue); @@ -344,7 +344,7 @@ namespace ADMIN nldebug("CAdminServiceWeb::cb_getHighRezGraph received from class '%s'", typeid(netbase).name()); #endif ICallbackServerAdaptor *adaptor = static_cast< ICallbackServerAdaptor *>(netbase.getUserData()); - + CAdminServiceWebItf *callback = (CAdminServiceWebItf *)adaptor->getContainerClass(); if (callback == NULL) @@ -366,7 +366,7 @@ namespace ADMIN std::vector retValue; retValue = callback->on_getHighRezGraph(from, varAddr, startDate, endDate, milliStep); - + NLNET::CMessage retMsg("R_GHRG"); nlWrite(retMsg, serialCont, retValue); @@ -389,7 +389,7 @@ namespace ADMIN // serviceCmdResult. virtual void on_globalCmd(NLNET::TSockId from, const std::string &command) =0; - // Send a service related command to the executor + // Send a service related command to the executor // (not to the controled service) // The result is returned by the return message // controlCmdResult. @@ -426,15 +426,15 @@ namespace ADMIN virtual std::vector on_getHighRezGraph(NLNET::TSockId from, const std::string &varAddr, uint32 startDate, uint32 endDate, uint32 milliStep) =0; }; - + // This is the interface used by PHP to call methods // on the Admin service module - /** This is the client side of the interface + /** This is the client side of the interface * Derive from this class to invoke method on the callback server - */ + */ - class CAdminServiceWebClientItf + class CAdminServiceWebClientItf { protected: @@ -476,18 +476,18 @@ namespace ADMIN initialized = true; } - + std::map < std::string, std::string>::const_iterator it(messageNames.find(methodName)); if (it != messageNames.end()) return it->second; - + static std::string emptyString; - + return emptyString; } - + CAdminServiceWebClientItf(ICallbackClientAdaptor *adaptorReplacement = NULL) { if (adaptorReplacement == NULL) @@ -553,7 +553,7 @@ namespace ADMIN _CallbackClient->send(message); } - // Send a service related command to the executor + // Send a service related command to the executor // (not to the controled service) // The result is returned by the return message // controlCmdResult. @@ -653,7 +653,7 @@ namespace ADMIN nldebug("CAdminServiceWebClient::cb_commandResult received from class '%s'", typeid(netbase).name()); #endif ICallbackClientAdaptor *adaptor = static_cast< ICallbackClientAdaptor *>(netbase.getUserData()); - + CAdminServiceWebClientItf *callback = (CAdminServiceWebClientItf *)adaptor->getContainerClass(); if (callback == NULL) @@ -685,16 +685,16 @@ namespace ADMIN class TGraphData { protected: - // + // std::string _ServiceAlias; - // + // std::string _VarName; - // + // uint32 _SamplePeriod; - // + // double _Value; public: - // + // const std::string &getServiceAlias() const { return _ServiceAlias; @@ -712,9 +712,9 @@ namespace ADMIN _ServiceAlias = value; - + } - // + // const std::string &getVarName() const { return _VarName; @@ -732,9 +732,9 @@ namespace ADMIN _VarName = value; - + } - // + // uint32 getSamplePeriod() const { return _SamplePeriod; @@ -746,7 +746,7 @@ namespace ADMIN _SamplePeriod = value; } - // + // double getValue() const { return _Value; @@ -758,7 +758,7 @@ namespace ADMIN _Value = value; } - + bool operator == (const TGraphData &other) const { return _ServiceAlias == other._ServiceAlias @@ -773,7 +773,7 @@ namespace ADMIN { } - + void serial(NLMISC::IStream &s) { s.serial(_ServiceAlias); @@ -782,10 +782,10 @@ namespace ADMIN s.serial(_Value); } - + private: - + }; @@ -796,12 +796,12 @@ namespace ADMIN class TGraphDatas { protected: - // + // uint32 _CurrentTime; - // + // std::vector < TGraphData > _Datas; public: - // + // uint32 getCurrentTime() const { return _CurrentTime; @@ -813,7 +813,7 @@ namespace ADMIN _CurrentTime = value; } - // + // const std::vector < TGraphData > &getDatas() const { return _Datas; @@ -831,9 +831,9 @@ namespace ADMIN _Datas = value; - + } - + bool operator == (const TGraphDatas &other) const { return _CurrentTime == other._CurrentTime @@ -846,17 +846,17 @@ namespace ADMIN { } - + void serial(NLMISC::IStream &s) { s.serial(_CurrentTime); s.serialCont(_Datas); } - + private: - + }; @@ -867,12 +867,12 @@ namespace ADMIN class THighRezData { protected: - // + // NLMISC::TTime _SampleTick; - // + // double _Value; public: - // + // NLMISC::TTime getSampleTick() const { return _SampleTick; @@ -884,7 +884,7 @@ namespace ADMIN _SampleTick = value; } - // + // double getValue() const { return _Value; @@ -896,7 +896,7 @@ namespace ADMIN _Value = value; } - + bool operator == (const THighRezData &other) const { return _SampleTick == other._SampleTick @@ -909,17 +909,17 @@ namespace ADMIN { } - + void serial(NLMISC::IStream &s) { s.serial(_SampleTick); s.serial(_Value); } - + private: - + }; @@ -930,16 +930,16 @@ namespace ADMIN class THighRezDatas { protected: - // + // std::string _ServiceAlias; - // + // std::string _VarName; - // + // uint32 _CurrentTime; - // + // std::vector < THighRezData > _Datas; public: - // + // const std::string &getServiceAlias() const { return _ServiceAlias; @@ -957,9 +957,9 @@ namespace ADMIN _ServiceAlias = value; - + } - // + // const std::string &getVarName() const { return _VarName; @@ -977,9 +977,9 @@ namespace ADMIN _VarName = value; - + } - // + // uint32 getCurrentTime() const { return _CurrentTime; @@ -991,7 +991,7 @@ namespace ADMIN _CurrentTime = value; } - // + // const std::vector < THighRezData > &getDatas() const { return _Datas; @@ -1009,9 +1009,9 @@ namespace ADMIN _Datas = value; - + } - + bool operator == (const THighRezDatas &other) const { return _ServiceAlias == other._ServiceAlias @@ -1026,7 +1026,7 @@ namespace ADMIN { } - + void serial(NLMISC::IStream &s) { s.serial(_ServiceAlias); @@ -1035,15 +1035,15 @@ namespace ADMIN s.serialCont(_Datas); } - + private: - + }; - + struct TShardOrders { @@ -1057,11 +1057,11 @@ namespace ADMIN end_of_enum, invalid_val, - + /// Number of enumerated values nb_enum_items = 2 }; - + /// Index table to convert enum value to linear index table const std::map &getIndexTable() const { @@ -1072,13 +1072,13 @@ namespace ADMIN // fill the index table indexTable.insert(std::make_pair(so_autostart_on, 0)); indexTable.insert(std::make_pair(so_autostart_off, 1)); - + init = true; } return indexTable; } - + static const NLMISC::CStringConversion &getConversionTable() { @@ -1086,9 +1086,9 @@ namespace ADMIN NL_STRING_CONVERSION_TABLE_ENTRY(so_autostart_on) NL_STRING_CONVERSION_TABLE_ENTRY(so_autostart_off) NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val) - }; - static NLMISC::CStringConversion - conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table) + }; + static NLMISC::CStringConversion + conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table) / sizeof(TValues_nl_string_conversion_table[0]), invalid_val); return conversionTable; @@ -1167,16 +1167,16 @@ namespace ADMIN return getConversionTable().isValid(_Value); } - + uint32 asIndex() { std::map::const_iterator it(getIndexTable().find(_Value)); nlassert(it != getIndexTable().end()); return it->second; } - + }; - + struct TRunningOrders { @@ -1190,11 +1190,11 @@ namespace ADMIN end_of_enum, invalid_val, - + /// Number of enumerated values nb_enum_items = 2 }; - + /// Index table to convert enum value to linear index table const std::map &getIndexTable() const { @@ -1205,13 +1205,13 @@ namespace ADMIN // fill the index table indexTable.insert(std::make_pair(ro_deactivated, 0)); indexTable.insert(std::make_pair(ro_activated, 1)); - + init = true; } return indexTable; } - + static const NLMISC::CStringConversion &getConversionTable() { @@ -1219,9 +1219,9 @@ namespace ADMIN NL_STRING_CONVERSION_TABLE_ENTRY(ro_deactivated) NL_STRING_CONVERSION_TABLE_ENTRY(ro_activated) NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val) - }; - static NLMISC::CStringConversion - conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table) + }; + static NLMISC::CStringConversion + conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table) / sizeof(TValues_nl_string_conversion_table[0]), invalid_val); return conversionTable; @@ -1300,16 +1300,16 @@ namespace ADMIN return getConversionTable().isValid(_Value); } - + uint32 asIndex() { std::map::const_iterator it(getIndexTable().find(_Value)); nlassert(it != getIndexTable().end()); return it->second; } - + }; - + struct TRunningState { @@ -1324,11 +1324,11 @@ namespace ADMIN end_of_enum, invalid_val, - + /// Number of enumerated values nb_enum_items = 3 }; - + /// Index table to convert enum value to linear index table const std::map &getIndexTable() const { @@ -1340,13 +1340,13 @@ namespace ADMIN indexTable.insert(std::make_pair(rs_stopped, 0)); indexTable.insert(std::make_pair(rs_running, 1)); indexTable.insert(std::make_pair(rs_online, 2)); - + init = true; } return indexTable; } - + static const NLMISC::CStringConversion &getConversionTable() { @@ -1355,9 +1355,9 @@ namespace ADMIN NL_STRING_CONVERSION_TABLE_ENTRY(rs_running) NL_STRING_CONVERSION_TABLE_ENTRY(rs_online) NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val) - }; - static NLMISC::CStringConversion - conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table) + }; + static NLMISC::CStringConversion + conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table) / sizeof(TValues_nl_string_conversion_table[0]), invalid_val); return conversionTable; @@ -1436,16 +1436,16 @@ namespace ADMIN return getConversionTable().isValid(_Value); } - + uint32 asIndex() { std::map::const_iterator it(getIndexTable().find(_Value)); nlassert(it != getIndexTable().end()); return it->second; } - + }; - + struct TRunningTag { @@ -1465,11 +1465,11 @@ namespace ADMIN end_of_enum, invalid_val, - + /// Number of enumerated values nb_enum_items = 8 }; - + /// Index table to convert enum value to linear index table const std::map &getIndexTable() const { @@ -1486,13 +1486,13 @@ namespace ADMIN indexTable.insert(std::make_pair(rt_externaly_started, 5)); indexTable.insert(std::make_pair(rt_slow_to_stop, 6)); indexTable.insert(std::make_pair(rt_slow_to_start, 7)); - + init = true; } return indexTable; } - + static const NLMISC::CStringConversion &getConversionTable() { @@ -1506,9 +1506,9 @@ namespace ADMIN NL_STRING_CONVERSION_TABLE_ENTRY(rt_slow_to_stop) NL_STRING_CONVERSION_TABLE_ENTRY(rt_slow_to_start) NL_STRING_CONVERSION_TABLE_ENTRY(invalid_val) - }; - static NLMISC::CStringConversion - conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table) + }; + static NLMISC::CStringConversion + conversionTable(TValues_nl_string_conversion_table, sizeof(TValues_nl_string_conversion_table) / sizeof(TValues_nl_string_conversion_table[0]), invalid_val); return conversionTable; @@ -1587,14 +1587,14 @@ namespace ADMIN return getConversionTable().isValid(_Value); } - + uint32 asIndex() { std::map::const_iterator it(getIndexTable().find(_Value)); nlassert(it != getIndexTable().end()); return it->second; } - + }; ///////////////////////////////////////////////////////////////// // WARNING : this is a generated file, don't change it ! @@ -1602,24 +1602,24 @@ namespace ADMIN class TServiceStatus { protected: - // + // std::string _ShardName; - // + // std::string _ServiceLongName; - // + // std::string _ServiceShortName; - // + // std::string _ServiceAliasName; - // + // TRunningState _RunningState; - // + // TRunningOrders _RunningOrders; - // + // std::set < TRunningTag > _RunningTags; - // + // std::string _Status; public: - // + // const std::string &getShardName() const { return _ShardName; @@ -1637,9 +1637,9 @@ namespace ADMIN _ShardName = value; - + } - // + // const std::string &getServiceLongName() const { return _ServiceLongName; @@ -1657,9 +1657,9 @@ namespace ADMIN _ServiceLongName = value; - + } - // + // const std::string &getServiceShortName() const { return _ServiceShortName; @@ -1677,9 +1677,9 @@ namespace ADMIN _ServiceShortName = value; - + } - // + // const std::string &getServiceAliasName() const { return _ServiceAliasName; @@ -1697,9 +1697,9 @@ namespace ADMIN _ServiceAliasName = value; - + } - // + // TRunningState getRunningState() const { return _RunningState; @@ -1711,7 +1711,7 @@ namespace ADMIN _RunningState = value; } - // + // TRunningOrders getRunningOrders() const { return _RunningOrders; @@ -1723,7 +1723,7 @@ namespace ADMIN _RunningOrders = value; } - // + // const std::set < TRunningTag > &getRunningTags() const { return _RunningTags; @@ -1741,9 +1741,9 @@ namespace ADMIN _RunningTags = value; - + } - // + // const std::string &getStatus() const { return _Status; @@ -1761,9 +1761,9 @@ namespace ADMIN _Status = value; - + } - + bool operator == (const TServiceStatus &other) const { return _ShardName == other._ShardName @@ -1782,7 +1782,7 @@ namespace ADMIN { } - + void serial(NLMISC::IStream &s) { s.serial(_ShardName); @@ -1795,15 +1795,15 @@ namespace ADMIN s.serial(_Status); } - + private: - + }; - + ///////////////////////////////////////////////////////////////// // WARNING : this is a generated file, don't change it ! ///////////////////////////////////////////////////////////////// @@ -1827,12 +1827,12 @@ namespace ADMIN _Interceptor.init(this, module); } - // unused interceptors + // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; - + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} + // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); private: @@ -1842,7 +1842,7 @@ namespace ADMIN const TMessageHandlerMap &getMessageHandlers() const; - + void upServiceUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); void graphUpdate_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); @@ -1929,16 +1929,16 @@ namespace ADMIN // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_upServiceUpdate(NLNET::CMessage &__message, const std::vector < TServiceStatus > &serviceStatus); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_graphUpdate(NLNET::CMessage &__message, const TGraphDatas &graphDatas); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_highRezGraphUpdate(NLNET::CMessage &__message, const THighRezDatas &graphDatas); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_commandResult(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &result); - + @@ -1967,12 +1967,12 @@ namespace ADMIN _Interceptor.init(this, module); } - // unused interceptors + // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; - + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} + // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); private: @@ -1982,7 +1982,7 @@ namespace ADMIN const TMessageHandlerMap &getMessageHandlers() const; - + void setShardOrders_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); void shutdownShard_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); @@ -2097,7 +2097,7 @@ namespace ADMIN static void broadcast_setShardOrders(ProxyIterator first, ProxyIterator last, NLNET::IModule *sender, const std::string &shardName, const TShardOrders &shardOrders) { NLNET::CMessage message; - + // create the message to send to multiple dest buildMessageFor_setShardOrders(message , shardName, shardOrders); @@ -2116,7 +2116,7 @@ namespace ADMIN static void broadcast_shutdownShard(ProxyIterator first, ProxyIterator last, NLNET::IModule *sender, const std::string &shardName, uint32 delay) { NLNET::CMessage message; - + // create the message to send to multiple dest buildMessageFor_shutdownShard(message , shardName, delay); @@ -2135,7 +2135,7 @@ namespace ADMIN static void broadcast_controlCmd(ProxyIterator first, ProxyIterator last, NLNET::IModule *sender, uint32 commandId, const std::string &serviceAlias, const std::string &command) { NLNET::CMessage message; - + // create the message to send to multiple dest buildMessageFor_controlCmd(message , commandId, serviceAlias, command); @@ -2150,28 +2150,28 @@ namespace ADMIN // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_setShardOrders(NLNET::CMessage &__message, const std::string &shardName, const TShardOrders &shardOrders); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_shutdownShard(NLNET::CMessage &__message, const std::string &shardName, uint32 delay); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_controlCmd(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &command); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_serviceCmd(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &command); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_commandResult(NLNET::CMessage &__message, uint32 commandId, const std::string &serviceAlias, const std::string &result); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_graphUpdate(NLNET::CMessage &__message, const TGraphDatas &graphDatas); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_highRezGraphUpdate(NLNET::CMessage &__message, const THighRezDatas &graphDatas); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_serviceStatusUpdate(NLNET::CMessage &__message, const std::string &status); - + @@ -2200,12 +2200,12 @@ namespace ADMIN _Interceptor.init(this, module); } - // unused interceptors + // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; - + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} + // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); private: @@ -2215,7 +2215,7 @@ namespace ADMIN const TMessageHandlerMap &getMessageHandlers() const; - + void serviceCmd_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); void serviceCmdNoReturn_skel(NLNET::IModuleProxy *sender, const NLNET::CMessage &__message); @@ -2290,15 +2290,15 @@ namespace ADMIN // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_serviceCmd(NLNET::CMessage &__message, uint32 commandId, const std::string &command); - + // Message serializer. Return the message received in reference for easier integration static const NLNET::CMessage &buildMessageFor_serviceCmdNoReturn(NLNET::CMessage &__message, const std::string &command); - + }; } - + #endif diff --git a/code/ryzom/server/src/ai_service/ai_logic_action.h b/code/ryzom/server/src/ai_service/ai_logic_action.h index 631f9f620..452087b18 100644 --- a/code/ryzom/server/src/ai_service/ai_logic_action.h +++ b/code/ryzom/server/src/ai_service/ai_logic_action.h @@ -46,7 +46,7 @@ public: // note that actions are NOT responsible for deleting child actions virtual ~IAILogicAction() - {}; + {} // this is the execute 'callback' for the action type. // NOTE: This code should be fast and compact as it may be called very large numbers of times diff --git a/code/ryzom/server/src/ai_service/ai_profile_npc.h b/code/ryzom/server/src/ai_service/ai_profile_npc.h index 9fed6e662..f8ec911f4 100644 --- a/code/ryzom/server/src/ai_service/ai_profile_npc.h +++ b/code/ryzom/server/src/ai_service/ai_profile_npc.h @@ -633,7 +633,7 @@ public CMoveProfile { public: CGrpProfileFollowPlayer(CProfileOwner* owner, TDataSetRow const& playerRow, uint32 dispersionRadius); - virtual ~CGrpProfileFollowPlayer() {}; + virtual ~CGrpProfileFollowPlayer() {} void setBotStandProfile(AITYPES::TProfiles botStandProfileType, IAIProfileFactory* botStandProfileFactory); @@ -641,16 +641,16 @@ public: //@{ virtual void beginProfile(); virtual void updateProfile(uint ticksSinceLastUpdate); - virtual void endProfile() {}; + virtual void endProfile() {} virtual AITYPES::TProfiles getAIProfileType() const { return AITYPES::BOT_FOLLOW_POS; } virtual std::string getOneLineInfoString() const { return std::string("follow_player group profile"); } //@} - void stateChangeProfile() {}; + void stateChangeProfile() {} bool destinationReach() const; - void addBot (CBot* bot) {}; - void removeBot (CBot* bot) {}; + void addBot (CBot* bot) {} + void removeBot (CBot* bot) {} CPathCont* getPathCont (CBot const* bot) { return NULL; }; diff --git a/code/ryzom/server/src/ai_service/child_container.h b/code/ryzom/server/src/ai_service/child_container.h index 79ffa832c..ce2eb1d27 100644 --- a/code/ryzom/server/src/ai_service/child_container.h +++ b/code/ryzom/server/src/ai_service/child_container.h @@ -546,13 +546,13 @@ CAliasTreeOwner* CAliasCont::getAliasChildByAlias(uint32 alias) const template CAliasTreeOwner* CAliasCont::addAliasChild(CAliasTreeOwner* child) { - return NLMISC::type_cast(addChild(static_cast(child))); + return NLMISC::type_cast(this->addChild(static_cast(child))); } template CAliasTreeOwner* CAliasCont::addAliasChild(CAliasTreeOwner* child, uint32 index) { - return NLMISC::type_cast(addChild(static_cast(child), index)); + return NLMISC::type_cast(this->addChild(static_cast(child), index)); } template diff --git a/code/ryzom/server/src/ai_service/commands.cpp b/code/ryzom/server/src/ai_service/commands.cpp index a85e8fe1c..98063d7e3 100644 --- a/code/ryzom/server/src/ai_service/commands.cpp +++ b/code/ryzom/server/src/ai_service/commands.cpp @@ -844,7 +844,7 @@ public: } protected: private: - size_t _index; + uint32 _index; float _value; bool _detailled; mutable CLogStringWriter _stringWriter; diff --git a/code/ryzom/server/src/ai_service/continent.h b/code/ryzom/server/src/ai_service/continent.h index a9a265e7d..8b92cf6b9 100644 --- a/code/ryzom/server/src/ai_service/continent.h +++ b/code/ryzom/server/src/ai_service/continent.h @@ -529,6 +529,7 @@ class CLazyProcess : public NLMISC::CRefCount { public: + virtual ~CLazyProcess() {} /// Used to update some dependencies for instance road connections when the first next update of CContinent is called. virtual void update() const = 0; /// Used to check if there's no need to add another lazyprocess. @@ -1052,6 +1053,7 @@ class IGroupDesc : public NLMISC::CRefCount { public: + virtual ~IGroupDesc() {} virtual uint32 groupEnergyValue() const = 0; virtual float groupEnergyCoef() const = 0; virtual bool getCountMultiplierFlag() const = 0; diff --git a/code/ryzom/server/src/ai_service/family_profile.cpp b/code/ryzom/server/src/ai_service/family_profile.cpp index c01faf37f..f95f142c9 100644 --- a/code/ryzom/server/src/ai_service/family_profile.cpp +++ b/code/ryzom/server/src/ai_service/family_profile.cpp @@ -172,6 +172,7 @@ IAiFactory *_ProfileNpc=&_singleProfileNpc; extern IAiFactory *_ProfileTribe; // in another cpp. +NL_ISO_TEMPLATE_SPEC CAiFactoryContainer *CAiFactoryContainer::_Instance = NULL; CFamilyProfileFactory::CFamilyProfileFactory() { @@ -217,10 +218,6 @@ IFamilyProfile* CFamilyProfileFactory::createFamilyProfile(const TStringId &keyW return NULL; } - -NL_ISO_TEMPLATE_SPEC CAiFactoryContainer *CAiFactoryContainer::_Instance = NULL; - - IFamilyProfile* IFamilyProfile::createFamilyProfile(const TStringId &profileName, const IFamilyProfile::CtorParam& ctorParam) { return CFamilyProfileFactory::createFamilyProfile(profileName, ctorParam); diff --git a/code/ryzom/server/src/ai_service/family_profile.h b/code/ryzom/server/src/ai_service/family_profile.h index a07acab8a..b4df92d92 100644 --- a/code/ryzom/server/src/ai_service/family_profile.h +++ b/code/ryzom/server/src/ai_service/family_profile.h @@ -87,15 +87,15 @@ public: virtual void update() =0; /// Fill a vector of outpost id name assigned to tribe - virtual void fillOutpostNames(std::vector outpostNames) {}; + virtual void fillOutpostNames(std::vector outpostNames) {} /// Add an outpost for the tribe (nb : the family must be a tribe) - virtual void outpostAdd(NLMISC::TStringId outpostName) {}; + virtual void outpostAdd(NLMISC::TStringId outpostName) {} /// Remove an from the tribe - virtual void outpostRemove(NLMISC::TStringId outpostName) {}; + virtual void outpostRemove(NLMISC::TStringId outpostName) {} - virtual void outpostEvent(NLMISC::TStringId outpostName, ZCSTATE::TZcState state) {}; + virtual void outpostEvent(NLMISC::TStringId outpostName, ZCSTATE::TZcState state) {} - virtual void spawnBoss(NLMISC::TStringId outpostName) {}; + virtual void spawnBoss(NLMISC::TStringId outpostName) {} CGroupNpc *createNpcGroup(const CNpcZone *const zone, const CGroupDesc *const groupDesc); diff --git a/code/ryzom/server/src/ai_service/fx_entity.h b/code/ryzom/server/src/ai_service/fx_entity.h index 3fbf66b92..78f4bb37b 100644 --- a/code/ryzom/server/src/ai_service/fx_entity.h +++ b/code/ryzom/server/src/ai_service/fx_entity.h @@ -28,7 +28,7 @@ class CFxEntity { public: CFxEntity(CAIPos const& pos, NLMISC::CSheetId const& sheet); - ~CFxEntity(); + virtual ~CFxEntity(); NLMISC::CEntityId const& id() const; bool spawn(); void despawn(); diff --git a/code/ryzom/server/src/ai_service/nf_grp.cpp b/code/ryzom/server/src/ai_service/nf_grp.cpp index eabe61fd4..db5ae053c 100644 --- a/code/ryzom/server/src/ai_service/nf_grp.cpp +++ b/code/ryzom/server/src/ai_service/nf_grp.cpp @@ -2022,7 +2022,7 @@ Arguments: s(parameterName) -> @param[in] parameterName is a the id of the parameter to remove @code -()removeProfileParameter("running"); // retire le paramtre "running" ou "running:<*>" du groupe +()removeProfileParameter("running"); // remove "running" or "running:<*>" parameter from group @endcode */ @@ -2048,7 +2048,7 @@ Arguments: s(parameterName) -> @param[in] parameterName is a the id of the parameter to add @code -()addProfileParameter("running"); // quivalent un parameter "running" dans la primitive du groupe +()addProfileParameter("running"); // equivalent to "running" parameter in group primitive @endcode */ @@ -2077,7 +2077,7 @@ Arguments: s(parameterName),s(parameterContent) -> @param[in] parameterContent is the value of the parameter @code -()addPersistentProfileParameter("foo", "bar"); // quivalent un parameter "foo:bar" dans la primitive du groupe +()addPersistentProfileParameter("foo", "bar"); // equivalent to "foo:bar" parameter in group primitive @endcode */ @@ -2108,7 +2108,7 @@ Arguments: s(parameterName),f(parameterContent) -> @param[in] parameterContent is the value of the parameter @code -()addPersistentProfileParameter("foo", 0.5); // quivalent un parameter "foo:0.5" dans la primitive du groupe +()addPersistentProfileParameter("foo", 0.5); // equivalent to "foo:0.5" parameter in group primitive @endcode */ @@ -2137,7 +2137,7 @@ Arguments: s(parameterName) -> @param[in] parameterName is a the id of the parameter to remove @code -()removeProfileParameter("running"); // retire le paramtre "running" ou "running:<*>" du groupe +()removeProfileParameter("running"); // remove "running" or "running:<*>" parameters from group @endcode */ diff --git a/code/ryzom/server/src/ai_service/script_compiler.cpp b/code/ryzom/server/src/ai_service/script_compiler.cpp index 03d0fe336..a9982ef48 100644 --- a/code/ryzom/server/src/ai_service/script_compiler.cpp +++ b/code/ryzom/server/src/ai_service/script_compiler.cpp @@ -1933,7 +1933,7 @@ void CSubRuleTracer::generateCode(CSmartPtr &cByteCode) const case CScriptVM::JUMP: byteCode.push_back(op); // + Jump offset. - size_t index; + uint32 index; NLMISC::fromString(param, index); jumpTable.add(CJumpRememberer(index)); byteCode.push_back(0); // Invalid @@ -1950,7 +1950,7 @@ void CSubRuleTracer::generateCode(CSmartPtr &cByteCode) const { if (str.find("Atof")!=string::npos) { - size_t index; + uint32 index; NLMISC::fromString(param, index); --index; string &strRef=_childTracers[index]->_TextValue; @@ -1962,7 +1962,7 @@ void CSubRuleTracer::generateCode(CSmartPtr &cByteCode) const if (str.find("String")!=string::npos) { - size_t index; + uint32 index; NLMISC::fromString(param, index); --index; string &strRef=_childTracers[index]->_TextValue; @@ -2021,7 +2021,7 @@ void CSubRuleTracer::generateCode(CSmartPtr &cByteCode) const if (str.find("Code")!=string::npos) { - size_t index; + uint32 index; NLMISC::fromString(param, index); --index; if (byteCode.size()==0) diff --git a/code/ryzom/server/src/ai_service/sheets.h b/code/ryzom/server/src/ai_service/sheets.h index 7526218c0..0473af4a9 100644 --- a/code/ryzom/server/src/ai_service/sheets.h +++ b/code/ryzom/server/src/ai_service/sheets.h @@ -644,6 +644,7 @@ class IRaceStats : public NLMISC::CRefCount { public: + virtual ~IRaceStats() {} virtual NLMISC::CSheetId SheetId() const = 0; virtual std::string Race() const = 0; }; diff --git a/code/ryzom/server/src/entities_game_service/building_manager/building_physical.h b/code/ryzom/server/src/entities_game_service/building_manager/building_physical.h index d37966aeb..d635ecd71 100644 --- a/code/ryzom/server/src/entities_game_service/building_manager/building_physical.h +++ b/code/ryzom/server/src/entities_game_service/building_manager/building_physical.h @@ -73,9 +73,9 @@ public: /// fill the icon param, send the description text to the user and store the resulting text id in the textId param. virtual void getClientDescription(uint16 roomIdx, uint16 ownerIndex, CCharacter * user, uint64 & icon, uint32 & textId )const = 0; /// callback called when all the appartments of a user must be removed - virtual void onPlayerDeletion( const NLMISC::CEntityId & userId ){}; + virtual void onPlayerDeletion( const NLMISC::CEntityId & userId ){} /// callback called when all the appartments of a guild must be removed - virtual void onGuildDeletion( uint32 guild ){}; + virtual void onGuildDeletion( uint32 guild ){} /// return true if the user is allowed to go in the building virtual bool isUserAllowed(CCharacter * user, uint16 ownerIdx, uint16 roomIdx) = 0; ///return the number of owner in this building ( return 1 for common buildings ) diff --git a/code/ryzom/server/src/entities_game_service/creature_manager/creature_manager.h b/code/ryzom/server/src/entities_game_service/creature_manager/creature_manager.h index 75b40c5c3..388c9f3b4 100644 --- a/code/ryzom/server/src/entities_game_service/creature_manager/creature_manager.h +++ b/code/ryzom/server/src/entities_game_service/creature_manager/creature_manager.h @@ -121,14 +121,14 @@ public: /// exception thrown when creature is unknown struct ECreature : public NLMISC::Exception { - ECreature( const NLMISC::CEntityId& id ) : Exception ("The creature "+id.toString()+" doesn't exist") {}; + ECreature( const NLMISC::CEntityId& id ) : Exception ("The creature "+id.toString()+" doesn't exist") {} }; /// structure describing an unaffected fauna group ( because the description is received before mirror update ) struct SUnaffectedFaunaGroup { SUnaffectedFaunaGroup(const TDataSetRow& entityIndex,TAIAlias groupAlias) - :EntityIndex( entityIndex ),GroupAlias( groupAlias ){}; + :EntityIndex( entityIndex ),GroupAlias( groupAlias ){} TDataSetRow EntityIndex; TAIAlias GroupAlias; }; diff --git a/code/ryzom/server/src/entities_game_service/egs_progress_callback.h b/code/ryzom/server/src/entities_game_service/egs_progress_callback.h index bb1fc9de6..78cbc356e 100644 --- a/code/ryzom/server/src/entities_game_service/egs_progress_callback.h +++ b/code/ryzom/server/src/entities_game_service/egs_progress_callback.h @@ -31,7 +31,7 @@ class CEGSProgressCallback : public NLMISC::IProgressCallback { public: CEGSProgressCallback():IProgressCallback() {} - virtual void progress (float progressValue) {}; + virtual void progress (float progressValue) {} virtual ~CEGSProgressCallback() {} }; diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.h b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.h index 41c1bcec4..a1619f5f4 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.h +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_sheets.h @@ -74,7 +74,7 @@ public : /// exception thrown when a sheet is unknown struct ESheet : public NLMISC::Exception { - ESheet( const NLMISC::CSheetId& sheetId ) : Exception ("The sheet "+sheetId.toString()+" is unknown") {}; + ESheet( const NLMISC::CSheetId& sheetId ) : Exception ("The sheet "+sheetId.toString()+" is unknown") {} }; public: diff --git a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h index 0ef0e0335..0840d01d1 100644 --- a/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h +++ b/code/ryzom/server/src/entities_game_service/egs_sheets/egs_static_game_item.h @@ -429,7 +429,7 @@ struct SShield : public SArmor NL_INSTANCE_COUNTER_DECL(SShield); public: - inline SShield() : SArmor(),ShieldType(SHIELDTYPE::NONE),Unbreakable(false){}; + inline SShield() : SArmor(),ShieldType(SHIELDTYPE::NONE),Unbreakable(false){} virtual void serial(class NLMISC::IStream &f) { diff --git a/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.h b/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.h index 81e5b6cd8..fc3cd5903 100644 --- a/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.h +++ b/code/ryzom/server/src/entities_game_service/entity_manager/entity_base.h @@ -140,7 +140,7 @@ public: _ExceptionString = std::string(" : Invalid stat name ") + var; return _ExceptionString.c_str(); } - virtual ~EInvalidStat() throw() {}; + virtual ~EInvalidStat() throw() {} private: mutable std::string _ExceptionString; }; @@ -820,7 +820,7 @@ public: /// Return the damage using current armor, done by an explosion (e.g. forage source explosion) virtual float getActualDamageFromExplosionWithArmor( float dmg ) const =0; - inline virtual void clearCurrentAction() {}; + inline virtual void clearCurrentAction() {} inline virtual void setCurrentAction(CLIENT_ACTION_TYPE::TClientActionType,NLMISC::TGameCycle) {} diff --git a/code/ryzom/server/src/entities_game_service/entity_manager/entity_manager.h b/code/ryzom/server/src/entities_game_service/entity_manager/entity_manager.h index 88f893c91..cf5422f1a 100644 --- a/code/ryzom/server/src/entities_game_service/entity_manager/entity_manager.h +++ b/code/ryzom/server/src/entities_game_service/entity_manager/entity_manager.h @@ -59,7 +59,7 @@ public: /// exception thrown when entity is unknown struct EEntity : public NLMISC::Exception { - EEntity( const NLMISC::CEntityId& id ) : Exception ("The entity "+id.toString()+" doesn't exist") {}; + EEntity( const NLMISC::CEntityId& id ) : Exception ("The entity "+id.toString()+" doesn't exist") {} }; /* // Success table for calculation of success probability and associate xp-gains diff --git a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.h b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.h index a0aee63fc..8bd4e6b90 100644 --- a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.h +++ b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.h @@ -61,7 +61,7 @@ public : /// exception thrown when a sheet is unknown struct ESheet : public NLMISC::Exception { - ESheet( const NLMISC::CSheetId& sheetId ) : Exception ("The sheet "+sheetId.toString()+" is unknown") {}; + ESheet( const NLMISC::CSheetId& sheetId ) : Exception ("The sheet "+sheetId.toString()+" is unknown") {} }; public: diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild_unifier_itf.h b/code/ryzom/server/src/entities_game_service/guild_manager/guild_unifier_itf.h index 1280fe6c2..98a4f9229 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild_unifier_itf.h +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild_unifier_itf.h @@ -490,9 +490,9 @@ namespace GU // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); diff --git a/code/ryzom/server/src/entities_game_service/guild_manager/guild_version_adapter.h b/code/ryzom/server/src/entities_game_service/guild_manager/guild_version_adapter.h index 2bb3464de..8b59b2a97 100644 --- a/code/ryzom/server/src/entities_game_service/guild_manager/guild_version_adapter.h +++ b/code/ryzom/server/src/entities_game_service/guild_manager/guild_version_adapter.h @@ -50,7 +50,7 @@ private: void adaptToVersion4(CGuild &guild) const; private: - CGuildVersionAdapter(){}; + CGuildVersionAdapter(){} /// unique instance static CGuildVersionAdapter* _Instance; }; 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 c655e2ebc..186615e45 100644 --- a/code/ryzom/server/src/entities_game_service/harvest_source.cpp +++ b/code/ryzom/server/src/entities_game_service/harvest_source.cpp @@ -90,6 +90,14 @@ sint8 ExplosionResetPeriod = 50; // 5 s CHarvestSource AutoSpawnSourceIniProperties; +/* + * Access to singleton + */ +CHarvestSourceManager *CHarvestSourceManager::getInstance() +{ + return (CHarvestSourceManager*)_Instance; +} + /* * Initialization of source manager */ @@ -103,7 +111,10 @@ void CHarvestSourceManager::init( TDataSetIndex baseRowIndex, TDataSetIndex size //AutoSpawnSourceIniProperties.setDistVis( 100 ); } - +void CHarvestSourceManager::release() +{ + delete (CHarvestSourceManager*)_Instance; +} /* * HarvestSource constructor diff --git a/code/ryzom/server/src/entities_game_service/harvest_source.h b/code/ryzom/server/src/entities_game_service/harvest_source.h index 59556115e..edd9c546a 100644 --- a/code/ryzom/server/src/entities_game_service/harvest_source.h +++ b/code/ryzom/server/src/entities_game_service/harvest_source.h @@ -391,13 +391,13 @@ class CHarvestSourceManager : public CSimpleEntityManager public: /// Singleton access - static CHarvestSourceManager *getInstance() { return (CHarvestSourceManager*)_Instance; } + static CHarvestSourceManager *getInstance(); /// Initialization void init( TDataSetIndex baseRowIndex, TDataSetIndex size ); /// Release - static void release() { delete (CHarvestSourceManager*)_Instance; } + static void release(); }; diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_event.h b/code/ryzom/server/src/entities_game_service/mission_manager/mission_event.h index 34ff36600..b5bb0fccd 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_event.h +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_event.h @@ -94,7 +94,7 @@ public: static bool simMissionEvent(const std::vector< std::string > & script, NLMISC::CLog & log ); protected: - CMissionEvent(){}; + CMissionEvent(){} /// build an event from a script virtual bool buildFromScript( const std::vector< std::string > & script,NLMISC::CLog& log ) = 0; @@ -114,7 +114,7 @@ public: uint32 Mission; protected: friend class CMissionEvent; - CMissionEventMissionDone(){}; + CMissionEventMissionDone(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -130,7 +130,7 @@ public: std::string ScenarioTag; protected: friend class CMissionEvent; - CMissionEventTaggedRingScenarioDone(){}; + CMissionEventTaggedRingScenarioDone(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -158,7 +158,7 @@ public: uint32 Amount; protected: friend class CMissionEvent; - CMissionEventGiveMoney(){}; + CMissionEventGiveMoney(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -171,7 +171,7 @@ public: uint32 PlaceId; protected: friend class CMissionEvent; - CMissionEventVisitPlace(){}; + CMissionEventVisitPlace(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -184,7 +184,7 @@ public: std::vector Bricks; protected: friend class CMissionEvent; - CMissionEventCast(){}; + CMissionEventCast(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -196,7 +196,7 @@ public: :CMissionEvent(Kill, targetEntity, restriction){} protected: friend class CMissionEvent; - CMissionEventKill(){}; + CMissionEventKill(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -209,7 +209,7 @@ public: :CMissionEvent(KillPlayer, victimId){} protected: friend class CMissionEvent; - CMissionEventKillPlayer(){}; + CMissionEventKillPlayer(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -225,7 +225,7 @@ public: uint16 Quality; protected: friend class CMissionEvent; - CMissionEventBuyItem(){}; + CMissionEventBuyItem(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -241,7 +241,7 @@ public: uint16 Quality; protected: friend class CMissionEvent; - CMissionEventSellItem(){}; + CMissionEventSellItem(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -257,7 +257,7 @@ public: uint16 Quality; protected: friend class CMissionEvent; - CMissionEventForage(){}; + CMissionEventForage(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -283,7 +283,7 @@ public: uint Level; protected: friend class CMissionEvent; - CMissionEventSkillProgress(){}; + CMissionEventSkillProgress(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -295,7 +295,7 @@ public: :CMissionEvent(Target,targetEntity ){} protected: friend class CMissionEvent; - CMissionEventTarget(){}; + CMissionEventTarget(){} bool buildFromScript( const std::vector< std::string > & script,NLMISC::CLog& log ); }; @@ -311,7 +311,7 @@ public: uint16 Quality; protected: friend class CMissionEvent; - CMissionEventCraft(){}; + CMissionEventCraft(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -351,7 +351,7 @@ public: uint16 Quality; protected: friend class CMissionEvent; - CMissionEventLootItem(){}; + CMissionEventLootItem(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -366,7 +366,7 @@ public: uint16 Quality; protected: friend class CMissionEvent; - CMissionEventLootRm(){}; + CMissionEventLootRm(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -379,7 +379,7 @@ public: TAIAlias Alias; protected: friend class CMissionEvent; - CMissionEventKillGroup(){}; + CMissionEventKillGroup(){} bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log); }; @@ -390,7 +390,7 @@ public: :CMissionEvent(EndDynChat,TDataSetRow()){} protected: friend class CMissionEvent; - bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log){return false;}; + bool buildFromScript( const std::vector< std::string > & /* script */, NLMISC::CLog& /* log */){return false;} }; class CMissionEventDebug : public CMissionEvent @@ -400,7 +400,7 @@ public: :CMissionEvent(Debug,TDataSetRow()){} protected: friend class CMissionEvent; - bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log){return false;}; + bool buildFromScript( const std::vector< std::string > & /* script */, NLMISC::CLog& /* log */){return false;} }; @@ -412,7 +412,7 @@ public: uint32 Points; protected: friend class CMissionEvent; - bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log){return false;}; + bool buildFromScript( const std::vector< std::string > & /* script */, NLMISC::CLog& /* log */){return false;} }; class CMissionEventOutpostGain : public CMissionEvent @@ -422,7 +422,7 @@ public: :CMissionEvent(OutpostGain,TDataSetRow()){} protected: friend class CMissionEvent; - bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log){return false;}; + bool buildFromScript( const std::vector< std::string > & /* script */, NLMISC::CLog& /* log */){return false;} }; @@ -437,7 +437,7 @@ public: bool Guild; protected: friend class CMissionEvent; - bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log){return false;} + bool buildFromScript( const std::vector< std::string > & /* script */, NLMISC::CLog& /* log */){return false;} }; class CMissionEventQueueEntryOk: public CMissionEvent @@ -447,7 +447,7 @@ public: :CMissionEvent(QueueEntryOk, TDataSetRow()) {} protected: friend class CMissionEvent; - bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log) { return false; } + bool buildFromScript( const std::vector< std::string > & /* script */, NLMISC::CLog& /* log */){return false;} }; @@ -458,7 +458,7 @@ public: :CMissionEvent(QueueExit, TDataSetRow()) {} protected: friend class CMissionEvent; - bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log) { return false; } + bool buildFromScript( const std::vector< std::string > & /* script */, NLMISC::CLog& /* log */){return false;} }; class CMissionEventGroupSpawned : public CMissionEvent @@ -470,8 +470,8 @@ public: TAIAlias Alias; protected: friend class CMissionEvent; - CMissionEventGroupSpawned(){}; - bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log) { return false; } + CMissionEventGroupSpawned(){} + bool buildFromScript( const std::vector< std::string > & /* script */, NLMISC::CLog& /* log */){return false;} }; class CMissionEventGroupDespawned : public CMissionEvent @@ -483,8 +483,8 @@ public: TAIAlias Alias; protected: friend class CMissionEvent; - CMissionEventGroupDespawned(){}; - bool buildFromScript( const std::vector< std::string > & script ,NLMISC::CLog& log) { return false; } + CMissionEventGroupDespawned(){} + bool buildFromScript( const std::vector< std::string > & /* script */, NLMISC::CLog& /* log */){return false;} }; #endif // RY_MISSION_EVENT_H diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_kill.cpp b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_kill.cpp index 8fa18d518..49a2955ca 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_kill.cpp +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_kill.cpp @@ -119,7 +119,6 @@ class CMissionStepKillFauna : public IMissionStepTemplate } uint processEvent( const TDataSetRow & userRow, const CMissionEvent & event,uint subStepIndex,const TDataSetRow & giverRow ) { - nlinfo("Process Event"); string webAppUrl; bool ret = true; _User = PlayerManager.getChar(getEntityIdFromRow(userRow)); @@ -1253,4 +1252,4 @@ class CMissionStepKillPlayer : public IMissionStepTemplate MISSION_STEP_GETNEWPTR(CMissionStepKillPlayer) }; -MISSION_REGISTER_STEP(CMissionStepKillPlayer, "kill_player"); \ No newline at end of file +MISSION_REGISTER_STEP(CMissionStepKillPlayer, "kill_player"); diff --git a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_template.h b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_template.h index 132463bec..6e92fb23f 100644 --- a/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_template.h +++ b/code/ryzom/server/src/entities_game_service/mission_manager/mission_step_template.h @@ -102,7 +102,7 @@ public: ///\name accessors //@{ /// return the step actions - inline const std::vector< IMissionAction* > & getActions(){ return _Actions; }; + inline const std::vector< IMissionAction* > & getActions(){ return _Actions; } /// set the out of order index of the step ( it is the index of the OOO/ANY bloc embedding the step ) 0xFF is invalid inline void setOOOStepIndex(uint32 idx){ _OOOStepIndex = idx; } ///\return the OOO index ( see previous line ) @@ -120,9 +120,9 @@ public: ///\set displayed value void setIconDisplayedOnStepNPC(bool displayed){ _IconDisplayedOnStepNPC = displayed;} /// return true if the step is in an OOO block which text wad overriden - bool isInOverridenOOO() { return _IsInOverridenOOO; }; + bool isInOverridenOOO() { return _IsInOverridenOOO; } /// set the isInOverridenOOO flag ( see previous method ) - void setAsInOverridenOOO() { _IsInOverridenOOO = true; }; + void setAsInOverridenOOO() { _IsInOverridenOOO = true; } /// return true if there is a roleplay text in this step bool isThereRoleplayText() { return !_RoleplayText.empty(); } /// check if the current player gift is ok @@ -130,7 +130,7 @@ public: /// retrieve the escort groups - virtual void getEscortGroups( std::vector< TAIAlias > & groups ){}; + virtual void getEscortGroups( std::vector< TAIAlias > & groups ){} virtual bool checkEscortFailure( bool groupWiped ){return false;} /// check the consistency of a text step diff --git a/code/ryzom/server/src/entities_game_service/modules/r2_give_item.h b/code/ryzom/server/src/entities_game_service/modules/r2_give_item.h index 9e56b8aea..a5d46c766 100644 --- a/code/ryzom/server/src/entities_game_service/modules/r2_give_item.h +++ b/code/ryzom/server/src/entities_game_service/modules/r2_give_item.h @@ -81,7 +81,7 @@ public: typedef std::map< TCreatureRowId, TCreatureItemRequest > TPendingRequest; // constructor - CR2GiveItem() {}; + CR2GiveItem() {} // destructor ~CR2GiveItem() {} diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.cpp b/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.cpp index 984003b20..fabb37350 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.cpp +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.cpp @@ -67,3 +67,15 @@ NLMISC_DYNVARIABLE( uint, NbEnvironmentalEffects, "Number of environmental effec if ( get ) *pointer = CEnvironmentalEffectManager::getInstance()->nbEntities(); } + +/// Singleton access +CEnvironmentalEffectManager *CEnvironmentalEffectManager::getInstance() +{ + return (CEnvironmentalEffectManager*)_Instance; +} + +/// Release +void CEnvironmentalEffectManager::release() +{ + delete (CEnvironmentalEffectManager*)_Instance; +} diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.h b/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.h index 0c81370a9..e53049cca 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.h +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/environmental_effect.h @@ -89,10 +89,10 @@ class CEnvironmentalEffectManager : public CSimpleEntityManager& bricks, TDataSetRow actorRowId ) { return true; } + static bool validateSabrinaGrammar( const std::vector< const CStaticBrick* >& /* bricks */, TDataSetRow /* actorRowId */ ) { return true; } - virtual void setBrickSheets( const std::vector & bricks){} + virtual void setBrickSheets( const std::vector & /* bricks */){} virtual void setEnchantMode(bool){} inline void cyclic(bool b) { _CyclicPhrase = b; } diff --git a/code/ryzom/server/src/entities_game_service/phrase_manager/toxic_cloud.h b/code/ryzom/server/src/entities_game_service/phrase_manager/toxic_cloud.h index f0bcb46c5..d1cd98246 100644 --- a/code/ryzom/server/src/entities_game_service/phrase_manager/toxic_cloud.h +++ b/code/ryzom/server/src/entities_game_service/phrase_manager/toxic_cloud.h @@ -36,7 +36,7 @@ class CToxicCloud : public CEnvironmentalEffect NL_INSTANCE_COUNTER_DECL(CToxicCloud); public: - CToxicCloud() {}; + CToxicCloud() {} /// Init inline void init( const NLMISC::CVector& pos, float radius, sint32 dmgPerHit, NLMISC::TGameCycle updateFrequency, NLMISC::TGameCycle lifetime=ToxicCloudDefaultLifetime) diff --git a/code/ryzom/server/src/entities_game_service/player_manager/cdb.h b/code/ryzom/server/src/entities_game_service/player_manager/cdb.h index fccaff859..a2af677f7 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/cdb.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/cdb.h @@ -216,7 +216,7 @@ public : /** * Inform a node of its parenthood */ - virtual void setParent(CCDBStructNodeBranch *parent) { nlassertex(0,("setParent() not overloaded for given node type!")); } + virtual void setParent(CCDBStructNodeBranch * /* parent */) { nlassertex(0,("setParent() not overloaded for given node type!")); } /** * get the parent of a node @@ -248,7 +248,7 @@ public : * Browse the tree, and for each atom branch encountered, call the callback passing the argument * provided and the index of the atom branch. */ - virtual void foreachAtomBranchCall( void (*callback)(void*,TCDBDataIndex), void *arg ) const {}; + virtual void foreachAtomBranchCall( void (*callback)(void*,TCDBDataIndex), void *arg ) const {} /** * Browse the tree, building the text id, and for each leaf encountered, call the callback @@ -288,10 +288,10 @@ public : TCDBDataIndex getDataIndex() const { return _DataIndex; } /// Set the atomic branch flag (when all the modified nodes of a branch should be tranmitted at the same time) - void setAtomic( bool atomicBranch ) { _Atomic = atomicBranch; } + void setAtomic( bool atomicBranch ) { _AtomicFlag = atomicBranch; } /// Return true if the branch has the atomic flag - bool isAtomic() const { return _Atomic; } + bool isAtomic() const { return _AtomicFlag; } /** Attach callback. Allow to attach a callback function that some code could call * when an instance of this node is changed. @@ -307,7 +307,7 @@ protected: ICDBStructNode() : _BankLabels(NULL), _DataIndex(CDB_INVALID_DATA_INDEX), - _Atomic(false), + _AtomicFlag(false), _ChangeCallback(NULL) {} @@ -325,7 +325,7 @@ protected: TCDBDataIndex _DataIndex; /// Atomic flag: is the branch an atomic group, or is the leaf a member of an atomic group - bool _Atomic; + bool _AtomicFlag; /// Optional callback pointer. TNodeChangeCallback _ChangeCallback; diff --git a/code/ryzom/server/src/entities_game_service/player_manager/cdb_branch.cpp b/code/ryzom/server/src/entities_game_service/player_manager/cdb_branch.cpp index f95777359..156f17f14 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/cdb_branch.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/cdb_branch.cpp @@ -186,7 +186,7 @@ void ICDBStructNode::setLabel( const std::string& bankName ) */ void CCDBStructNodeBranch::initDataIndex( TCDBDataIndex& index ) { - if ( _Atomic ) + if ( _AtomicFlag ) { _DataIndex = index; checkIfNotMaxIndex(); @@ -207,7 +207,7 @@ void CCDBStructNodeBranch::initDataIndex( TCDBDataIndex& index ) */ void CCDBStructNodeBranch::initIdAndCallForEachIndex( CBinId& id, void (*callback)(ICDBStructNode*, void*), void *arg ) { - if ( _Atomic ) + if ( _AtomicFlag ) { callback( this, arg ); } @@ -537,7 +537,7 @@ TCDBDataIndex CCDBStructNodeBranch::findDataIndex( ICDBStructNode::CTextId& id ) */ void CCDBStructNodeBranch::foreachAtomBranchCall( void (*callback)(void*,TCDBDataIndex), void *arg ) const { - if ( _Atomic ) + if ( _AtomicFlag ) { callback( arg, _DataIndex ); } diff --git a/code/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.h b/code/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.h index 3968515d2..8e09617ad 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/cdb_synchronised.h @@ -50,12 +50,12 @@ public: /// exception thrown when database is not initialized struct EDBNotInit : public NLMISC::Exception { - EDBNotInit() : Exception("CDB: Property Database not initialized") {}; + EDBNotInit() : Exception("CDB: Property Database not initialized") {} }; struct ECDBNotFound : public NLMISC::Exception { - ECDBNotFound() : Exception("CDB: Property not found") {}; + ECDBNotFound() : Exception("CDB: Property not found") {} }; /*struct CPropForClientOnly diff --git a/code/ryzom/server/src/entities_game_service/player_manager/known_and_memorized_phrases.h b/code/ryzom/server/src/entities_game_service/player_manager/known_and_memorized_phrases.h index 646913107..f7fd1d851 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/known_and_memorized_phrases.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/known_and_memorized_phrases.h @@ -126,7 +126,7 @@ private: private: // prevent copy constructor - CMemorizationSet(const CMemorizationSet &other) {}; + CMemorizationSet(const CMemorizationSet &other) {} // prevent copy operator CMemorizationSet &operator =(const CMemorizationSet&other) { return *this;} }; @@ -183,7 +183,7 @@ private: private: // prevent copy constructor - CPlayerPhraseMemory(const CMemorizationSet &other) {}; + CPlayerPhraseMemory(const CMemorizationSet &other) {} // prevent copy operator CPlayerPhraseMemory &operator =(const CMemorizationSet&other) { return *this;} }; diff --git a/code/ryzom/server/src/entities_game_service/player_manager/player_manager.h b/code/ryzom/server/src/entities_game_service/player_manager/player_manager.h index ecacee896..33e4a8ac9 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/player_manager.h +++ b/code/ryzom/server/src/entities_game_service/player_manager/player_manager.h @@ -166,13 +166,13 @@ public : /// exception thrown when player is unknown struct EPlayer : public NLMISC::Exception { - EPlayer( uint32 userId ) : Exception ("Player "+NLMISC::toString(userId)+" not found") {}; + EPlayer( uint32 userId ) : Exception ("Player "+NLMISC::toString(userId)+" not found") {} }; /// exception thrown when player's char is unknown struct EChar : public NLMISC::Exception { - EChar( const NLMISC::CEntityId& id ) : Exception ("The char "+id.toString()+" doesn't exist") {}; + EChar( const NLMISC::CEntityId& id ) : Exception ("The char "+id.toString()+" doesn't exist") {} }; ///init the manager diff --git a/code/ryzom/server/src/entities_game_service/progression/progression_pve.h b/code/ryzom/server/src/entities_game_service/progression/progression_pve.h index 4526c67f6..54cd5f0f2 100644 --- a/code/ryzom/server/src/entities_game_service/progression/progression_pve.h +++ b/code/ryzom/server/src/entities_game_service/progression/progression_pve.h @@ -64,7 +64,7 @@ public: }; /// ctor - CSkillProgress() {}; + CSkillProgress() {} /// dtor virtual ~CSkillProgress() { _SkillsProgress.clear(); } @@ -97,7 +97,7 @@ public: typedef std::map< TDataSetRow, CSkillProgress * > TSkillProgressPerOpponentContainer; /// ctor - CCharacterActions() {}; + CCharacterActions() {} /// dtor+ virtual ~CCharacterActions(); diff --git a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_base.h b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_base.h index c26b9f8bc..bdcb856dd 100644 --- a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_base.h +++ b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_base.h @@ -56,6 +56,8 @@ public: QuitTeam, }; + virtual ~IPVP() {} + /// get PVP mode to send to the client virtual PVP_MODE::TPVPMode getPVPMode() const = 0; diff --git a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_interface.h b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_interface.h index 8524320df..dd5c92b68 100644 --- a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_interface.h +++ b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_interface.h @@ -38,6 +38,7 @@ class CGameItemPtr; class IPVPInterface : public NLMISC::CRefCount { public: + virtual ~IPVPInterface() {} ///\name PVP MODE FEATURES DEPENDANTS //@{ /// return pvp relation between the two players @@ -61,8 +62,6 @@ public: /// killed character in PvP faction virtual void characterKilledInPvPFaction( CCharacter * character, PVP_CLAN::TPVPClan looserFaction, sint32 factionPoint ) const = 0; //@} - -private: }; #endif // RY_PVP_INTERFACE_H diff --git a/code/ryzom/server/src/entities_game_service/shop_type/item_for_sale.h b/code/ryzom/server/src/entities_game_service/shop_type/item_for_sale.h index fac7fa505..b01bfaa9b 100644 --- a/code/ryzom/server/src/entities_game_service/shop_type/item_for_sale.h +++ b/code/ryzom/server/src/entities_game_service/shop_type/item_for_sale.h @@ -33,7 +33,7 @@ class IItemTrade : public NLMISC::CRefCount public: // virtual destructor - virtual ~IItemTrade() {}; + virtual ~IItemTrade() {} // sheet id virtual NLMISC::CSheetId getSheetId() const = 0; diff --git a/code/ryzom/server/src/entities_game_service/world_instances.h b/code/ryzom/server/src/entities_game_service/world_instances.h index eb8c2728c..63a70204d 100644 --- a/code/ryzom/server/src/entities_game_service/world_instances.h +++ b/code/ryzom/server/src/entities_game_service/world_instances.h @@ -56,7 +56,7 @@ public: struct IAIInstanceReady { virtual void onAiInstanceReady(const CReportStaticAIInstanceMsg &msg) = 0; - virtual void onAiInstanceDown(const CReportStaticAIInstanceMsg &msg) {}; // not mandatory + virtual void onAiInstanceDown(const CReportStaticAIInstanceMsg &msg) {} // not mandatory }; /// Singleton access diff --git a/code/ryzom/server/src/entities_game_service/zone_manager.h b/code/ryzom/server/src/entities_game_service/zone_manager.h index 5aeb2a4a0..065e4548f 100644 --- a/code/ryzom/server/src/entities_game_service/zone_manager.h +++ b/code/ryzom/server/src/entities_game_service/zone_manager.h @@ -318,7 +318,7 @@ public: }; // default constructor - CZoneManager() : DepositSearchTime(50) {}; + CZoneManager() : DepositSearchTime(50) {} ~CZoneManager(); diff --git a/code/ryzom/server/src/frontend_service/selection_generator.h b/code/ryzom/server/src/frontend_service/selection_generator.h index 6f94e2e68..048e391a4 100644 --- a/code/ryzom/server/src/frontend_service/selection_generator.h +++ b/code/ryzom/server/src/frontend_service/selection_generator.h @@ -42,10 +42,10 @@ public: typedef TSelectionLevel result_type; /// Initialization of a selection cycle - virtual void init( TSelectionLevel nblevels ) {}; + virtual void init( TSelectionLevel nblevels ) {} /// Change the number of levels without restarting the cycle - virtual void changeNbLevels( TSelectionLevel nblevels ) {}; + virtual void changeNbLevels( TSelectionLevel nblevels ) {} /// Return the next level to select virtual TSelectionLevel getNext() = 0; diff --git a/code/ryzom/server/src/general_utilities_service/gus_chat.h b/code/ryzom/server/src/general_utilities_service/gus_chat.h index 077f24506..2c49c14f8 100644 --- a/code/ryzom/server/src/general_utilities_service/gus_chat.h +++ b/code/ryzom/server/src/general_utilities_service/gus_chat.h @@ -71,6 +71,7 @@ namespace GUS //----------------------------------------------------------------------------- // Public interface //----------------------------------------------------------------------------- + virtual ~CChatChannel() {} // open the chat channel on all clients and set its name // If historySize is set other than 0, the the chat channel is diff --git a/code/ryzom/server/src/general_utilities_service/gus_client_manager.h b/code/ryzom/server/src/general_utilities_service/gus_client_manager.h index c6f8b3f07..6714e4185 100644 --- a/code/ryzom/server/src/general_utilities_service/gus_client_manager.h +++ b/code/ryzom/server/src/general_utilities_service/gus_client_manager.h @@ -93,6 +93,7 @@ namespace GUS class IConnectionHandler: public NLMISC::CRefCount { public: + virtual ~IConnectionHandler() {} virtual void connect(TClientId)=0; virtual void disconnect(TClientId)=0; }; diff --git a/code/ryzom/server/src/general_utilities_service/gus_mirror.h b/code/ryzom/server/src/general_utilities_service/gus_mirror.h index 096685d50..97e8d97c6 100644 --- a/code/ryzom/server/src/general_utilities_service/gus_mirror.h +++ b/code/ryzom/server/src/general_utilities_service/gus_mirror.h @@ -40,15 +40,15 @@ namespace GUS { public: // General callback - virtual void mirrorIsReady(CGusMirror *gusMirror) {}; - virtual void serviceMirrorUp(CGusMirror *gusMirror, const std::string &serviceName, NLNET::TServiceId serviceId) {}; - virtual void serviceMirrorDown(CGusMirror *gusMirror, const std::string &serviceName, NLNET::TServiceId serviceId) {}; - virtual void mirrorTickUpdate(CGusMirror *gusMirror) {}; + virtual void mirrorIsReady(CGusMirror *gusMirror) {} + virtual void serviceMirrorUp(CGusMirror *gusMirror, const std::string &serviceName, NLNET::TServiceId serviceId) {} + virtual void serviceMirrorDown(CGusMirror *gusMirror, const std::string &serviceName, NLNET::TServiceId serviceId) {} + virtual void mirrorTickUpdate(CGusMirror *gusMirror) {} // mirror updates - virtual void entityAdded(CGusMirror *gusMirror, CMirroredDataSet *dataSet, const TDataSetRow &entityIndex) {}; - virtual void entityRemoved(CGusMirror *gusMirror, CMirroredDataSet *dataSet, const TDataSetRow &entityIndex, const NLMISC::CEntityId *entityId) {}; - virtual void propertyChanged(CGusMirror *gusMirror, CMirroredDataSet *dataSet, const TDataSetRow &entityIndex, TPropertyIndex propIndex) {}; + virtual void entityAdded(CGusMirror *gusMirror, CMirroredDataSet *dataSet, const TDataSetRow &entityIndex) {} + virtual void entityRemoved(CGusMirror *gusMirror, CMirroredDataSet *dataSet, const TDataSetRow &entityIndex, const NLMISC::CEntityId *entityId) {} + virtual void propertyChanged(CGusMirror *gusMirror, CMirroredDataSet *dataSet, const TDataSetRow &entityIndex, TPropertyIndex propIndex) {} IMirrorModuleCallback(); virtual ~IMirrorModuleCallback(); diff --git a/code/ryzom/server/src/general_utilities_service/gus_module_factory.h b/code/ryzom/server/src/general_utilities_service/gus_module_factory.h index 57c39bf06..fc9a62d38 100644 --- a/code/ryzom/server/src/general_utilities_service/gus_module_factory.h +++ b/code/ryzom/server/src/general_utilities_service/gus_module_factory.h @@ -41,7 +41,7 @@ namespace GUS class IModuleBuilder: public NLMISC::CRefCount { public: - virtual ~IModuleBuilder() {}; + virtual ~IModuleBuilder() {} virtual const NLMISC::CSString& getName() const=0; virtual const NLMISC::CSString& getArgs() const=0; virtual const NLMISC::CSString& getDescription() const=0; diff --git a/code/ryzom/server/src/general_utilities_service/rfr_ryzom_file_retriever.cpp b/code/ryzom/server/src/general_utilities_service/rfr_ryzom_file_retriever.cpp index 6e0f4940f..014f679e4 100644 --- a/code/ryzom/server/src/general_utilities_service/rfr_ryzom_file_retriever.cpp +++ b/code/ryzom/server/src/general_utilities_service/rfr_ryzom_file_retriever.cpp @@ -472,9 +472,11 @@ bool CRyzomFileRetrieverImplementation::downloadBackupFiles(const CSString& shar continue; // generate a local filename for the downloaded file - CSString localFileName= NLMISC::CPath::standardizePath(localDirectory)+(fileName+"_"+fdc[i].FileName); - localFileName = localFileName.replace("/","_"); - localFileName = localFileName.replace(".","_"); + CSString fdcFileNameUnderscore = fdc[i].FileName; + fdcFileNameUnderscore = fdcFileNameUnderscore.replace("/","_"); + CSString localFileNameWithoutPath = fileName + "_" + fdcFileNameUnderscore; + localFileNameWithoutPath = localFileNameWithoutPath.replace(".","_"); + CSString localFileName = NLMISC::CPath::standardizePath(localDirectory) + localFileNameWithoutPath; nlinfo("Requesting file download: REMOTE:%s => LOCAL:%s",fdc[i].FileName.c_str(),localFileName.c_str()); // put in a request for the file to be retrieved diff --git a/code/ryzom/server/src/general_utilities_service/rs_remote_saves.h b/code/ryzom/server/src/general_utilities_service/rs_remote_saves.h index 5ab25b8ac..1d91279bf 100644 --- a/code/ryzom/server/src/general_utilities_service/rs_remote_saves.h +++ b/code/ryzom/server/src/general_utilities_service/rs_remote_saves.h @@ -68,6 +68,8 @@ namespace SAVES class CRemoteSavesManager: public NLMISC::CRefCount { public: + virtual ~CRemoteSavesManager() {} + static CRemoteSavesManager* getInstance(); // interface used by CRemoteSavesInterface objects in their ctor to declare themselves diff --git a/code/ryzom/server/src/general_utilities_service/saves_unit.h b/code/ryzom/server/src/general_utilities_service/saves_unit.h index 3ea79287a..9685aa7bb 100644 --- a/code/ryzom/server/src/general_utilities_service/saves_unit.h +++ b/code/ryzom/server/src/general_utilities_service/saves_unit.h @@ -141,6 +141,9 @@ namespace SAVES // ctor ISavesUnitElement(); + // dtor + virtual ~ISavesUnitElement() {} + // perform the 'rescan' operation for this element - verify whether anything has changed // the parent parameter is used to supply addNew(), addChange() and addDeleted() methods // to signal any detected changes 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 f72db4bbd..4a3b98bcd 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 @@ -128,7 +128,7 @@ NLMISC_CATEGORISED_COMMAND(Stats,listCharNames,"display the names of the charact std::vector files; NLMISC::CPath::getPathContent(STAT_GLOBALS::getInputFilePath().c_str(),false,false,true,files); - for (uint32 i=files.size();i--;) + for (uint32 i=(uint32)files.size();i--;) { if (!NLMISC::testWildCard(NLMISC::CFile::getFilename(files[i]),wildcard)) { @@ -227,7 +227,8 @@ NLMISC_CATEGORISED_COMMAND(Stats,jobsPromote,"pause execution of jobs","" if (args.size()!=1) return false; - uint32 idx= atoi(args[0].c_str()); + uint32 idx; + NLMISC::fromString(args[0], idx); if ( (idx==0 && args[0]!="0") ) { nlwarning("Argument is not a valid job id - should be a number"); @@ -249,7 +250,8 @@ NLMISC_CATEGORISED_COMMAND(Stats,JobUpdatesPerUpdate,"set or display the number if (args.size()==1) { - uint32 count= atoi(args[0].c_str()); + uint32 count; + NLMISC::fromString(args[0], count); if ( (count==0 && args[0]!="0") ) { nlwarning("Argument is not a valid number"); @@ -311,7 +313,8 @@ NLMISC_CATEGORISED_COMMAND(Stats,jobsDisplayDetails,"display detailed info for t case 1: { - uint32 idx= atoi(args[0].c_str()); + uint32 idx; + NLMISC::fromString(args[0], idx); if ( (idx==0 && args[0]!="0") ) { nlwarning("Argument is not a valid job id - should be a number"); @@ -476,8 +479,11 @@ NLMISC_CATEGORISED_COMMAND(Stats,charScanScriptDeleteLine,"","") return false; } + uint32 line; + NLMISC::fromString(args[0], line); + // line numbering starts at 1 so an invalid number will be inored anyway - return TheCharScanScriptFile->deleteLine(atoi(args[0].c_str())); + return TheCharScanScriptFile->deleteLine(line); } NLMISC_CATEGORISED_COMMAND(Stats,charScanScriptAddInfoExtractor,""," []") @@ -761,7 +767,7 @@ NLMISC_CATEGORISED_COMMAND(Stats,charScanScriptTestFilteredFileList,"list the se return false; // generating a new file list - if (args[0]==CSString("generate").left(args[0].size())) + if (args[0]==CSString("generate").left((uint)args[0].size())) { if (TheCharScanScriptFile==NULL) { @@ -796,7 +802,7 @@ NLMISC_CATEGORISED_COMMAND(Stats,charScanScriptTestFilteredFileList,"list the se } // displaying the last generated file list - if (args[0]==CSString("display").left(args[0].size())) + if (args[0]==CSString("display").left((uint)args[0].size())) { nlinfo("Filtered file list for the current job"); fdc.display(&log); diff --git a/code/ryzom/server/src/general_utilities_service/stat_char_filter_factory.cpp b/code/ryzom/server/src/general_utilities_service/stat_char_filter_factory.cpp index 6902fe6ad..7c5f850fe 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_char_filter_factory.cpp +++ b/code/ryzom/server/src/general_utilities_service/stat_char_filter_factory.cpp @@ -63,7 +63,7 @@ void CCharFilterFactory::displayFilterList(NLMISC::CLog* log) { std::string s= _Filters[i]->getName(); if (s.size()>longestName) - longestName=s.size(); + longestName=(uint32)s.size(); } // iterate over the filters displaying names and description @@ -75,7 +75,7 @@ void CCharFilterFactory::displayFilterList(NLMISC::CLog* log) uint32 CCharFilterFactory::getFilterBuilderCount() { - return _Filters.size(); + return (uint32)_Filters.size(); } ICharFilterBuilder* CCharFilterFactory::getFilterBuilder(uint32 idx) diff --git a/code/ryzom/server/src/general_utilities_service/stat_char_filter_factory.h b/code/ryzom/server/src/general_utilities_service/stat_char_filter_factory.h index 656cc0cca..a96b7d6a5 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_char_filter_factory.h +++ b/code/ryzom/server/src/general_utilities_service/stat_char_filter_factory.h @@ -52,6 +52,7 @@ public: class ICharFilterBuilder: public NLMISC::CRefCount { public: + virtual ~ICharFilterBuilder() {} virtual const char* getName()=0; virtual const char* getDescription()=0; virtual ICharFilter* build(const std::string& rawArgs)=0; diff --git a/code/ryzom/server/src/general_utilities_service/stat_char_info_extractor_factory.cpp b/code/ryzom/server/src/general_utilities_service/stat_char_info_extractor_factory.cpp index 0ff961def..da481cf03 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_char_info_extractor_factory.cpp +++ b/code/ryzom/server/src/general_utilities_service/stat_char_info_extractor_factory.cpp @@ -63,7 +63,7 @@ void CCharInfoExtractorFactory::displayInfoExtractorList(NLMISC::CLog* log) { std::string s= _InfoExtractors[i]->getName(); if (s.size()>longestName) - longestName=s.size(); + longestName=(uint32)s.size(); } // iterate over the infoExtractors displaying names and description @@ -75,7 +75,7 @@ void CCharInfoExtractorFactory::displayInfoExtractorList(NLMISC::CLog* log) uint32 CCharInfoExtractorFactory::getInfoExtractorBuilderCount() { - return _InfoExtractors.size(); + return (uint32)_InfoExtractors.size(); } ICharInfoExtractorBuilder* CCharInfoExtractorFactory::getInfoExtractorBuilder(uint32 idx) diff --git a/code/ryzom/server/src/general_utilities_service/stat_char_info_extractor_factory.h b/code/ryzom/server/src/general_utilities_service/stat_char_info_extractor_factory.h index 868004c39..cd182c169 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_char_info_extractor_factory.h +++ b/code/ryzom/server/src/general_utilities_service/stat_char_info_extractor_factory.h @@ -56,6 +56,7 @@ public: class ICharInfoExtractorBuilder: public NLMISC::CRefCount { public: + virtual ~ICharInfoExtractorBuilder() {} virtual const char* getName() const=0; virtual const char* getDescription() const=0; virtual const char* getFields() const=0; diff --git a/code/ryzom/server/src/general_utilities_service/stat_char_scan_script.cpp b/code/ryzom/server/src/general_utilities_service/stat_char_scan_script.cpp index 48db0b447..030239d1e 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_char_scan_script.cpp +++ b/code/ryzom/server/src/general_utilities_service/stat_char_scan_script.cpp @@ -298,7 +298,7 @@ void CCharScanScriptCommandRegistry::displayScriptCommands(NLMISC::CLog* log) { std::string s= _ScriptCommands[i]->getName(); if (s.size()>longestName) - longestName=s.size(); + longestName=(uint32)s.size(); } // iterate over the script commands displaying names and description diff --git a/code/ryzom/server/src/general_utilities_service/stat_character_scan_job.cpp b/code/ryzom/server/src/general_utilities_service/stat_character_scan_job.cpp index 4b01b8574..9b85fb3b3 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_character_scan_job.cpp +++ b/code/ryzom/server/src/general_utilities_service/stat_character_scan_job.cpp @@ -293,7 +293,7 @@ bool CCharacterScanJob::runForFile(const std::string& fileName) c.apply(pdr); // iterate over the filters executing their core code - for (uint32 i=_Filters.size();i--;) + for (uint32 i=(uint32)_Filters.size();i--;) { if (!_Filters[i]->evaluate(&c)) return true; diff --git a/code/ryzom/server/src/general_utilities_service/stat_file_list_builder_factory.cpp b/code/ryzom/server/src/general_utilities_service/stat_file_list_builder_factory.cpp index e6e860966..c05576c22 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_file_list_builder_factory.cpp +++ b/code/ryzom/server/src/general_utilities_service/stat_file_list_builder_factory.cpp @@ -63,7 +63,7 @@ void CFileListBuilderFactory::displayFileListBuilderList(NLMISC::CLog* log) { std::string s= _FileLists[i]->getName(); if (s.size()>longestName) - longestName=s.size(); + longestName=(uint32)s.size(); } // iterate over the filters displaying names and description @@ -75,7 +75,7 @@ void CFileListBuilderFactory::displayFileListBuilderList(NLMISC::CLog* log) uint32 CFileListBuilderFactory::getFileListBuilderCount() { - return _FileLists.size(); + return (uint32)_FileLists.size(); } IFileListBuilderBuilder* CFileListBuilderFactory::getFileListBuilder(uint32 idx) diff --git a/code/ryzom/server/src/general_utilities_service/stat_file_list_builder_factory.h b/code/ryzom/server/src/general_utilities_service/stat_file_list_builder_factory.h index fbfb5dc61..367c0caa2 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_file_list_builder_factory.h +++ b/code/ryzom/server/src/general_utilities_service/stat_file_list_builder_factory.h @@ -54,6 +54,7 @@ public: class IFileListBuilderBuilder: public NLMISC::CRefCount { public: + virtual ~IFileListBuilderBuilder() {} virtual const char* getName()=0; virtual const char* getDescription()=0; virtual IFileListBuilder* build(const std::string& rawArgs)=0; diff --git a/code/ryzom/server/src/general_utilities_service/stat_globals.cpp b/code/ryzom/server/src/general_utilities_service/stat_globals.cpp index af1150b0f..a959fb751 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_globals.cpp +++ b/code/ryzom/server/src/general_utilities_service/stat_globals.cpp @@ -61,19 +61,19 @@ namespace STAT_GLOBALS NLMISC::CSString getInputFilePath(const NLMISC::CSString& path) { NLMISC::CSString pathRoot= NLMISC::CPath::standardizePath(InputFileDirectory.get()); - return (path.left(pathRoot.size())==pathRoot)? path: pathRoot+path; + return (path.left((uint)pathRoot.size())==pathRoot)? path: pathRoot+path; } NLMISC::CSString getScriptFilePath(const NLMISC::CSString& path) { NLMISC::CSString pathRoot= NLMISC::CPath::standardizePath(ScriptDirectory.get()); - return (path.left(pathRoot.size())==pathRoot)? path: pathRoot+path; + return (path.left((uint)pathRoot.size())==pathRoot)? path: pathRoot+path; } NLMISC::CSString getOutputFilePath(const NLMISC::CSString& path) { NLMISC::CSString pathRoot= NLMISC::CPath::standardizePath(OutputDirectory.get()); - return (path.left(pathRoot.size())==pathRoot)? path: pathRoot+path; + return (path.left((uint)pathRoot.size())==pathRoot)? path: pathRoot+path; } diff --git a/code/ryzom/server/src/general_utilities_service/stat_job_manager.cpp b/code/ryzom/server/src/general_utilities_service/stat_job_manager.cpp index 818c509d7..6c5a8c008 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_job_manager.cpp +++ b/code/ryzom/server/src/general_utilities_service/stat_job_manager.cpp @@ -131,7 +131,7 @@ void CJobManager::serviceUpdate() uint32 CJobManager::addJob(NLMISC::CSmartPtr job) { nlassert(job!=NULL); - uint32 id= _Jobs.size(); + uint32 id= (uint32)_Jobs.size(); _UnfinishedJobs.push_back(id); _Jobs.push_back(job); return id; diff --git a/code/ryzom/server/src/general_utilities_service/stat_user_file_list_builders.cpp b/code/ryzom/server/src/general_utilities_service/stat_user_file_list_builders.cpp index 3f3bbb8c7..c2a5658d5 100644 --- a/code/ryzom/server/src/general_utilities_service/stat_user_file_list_builders.cpp +++ b/code/ryzom/server/src/general_utilities_service/stat_user_file_list_builders.cpp @@ -73,7 +73,8 @@ FILE_LIST_BUILDER(MinFileSize,"") return false; } - for (uint32 i=fdc.size();i--;) + uint32 ttlNumFiles= fdc.size(); + for (uint32 i=ttlNumFiles;i--;) { if (fdc[i].FileSize") return false; } - for (uint32 i=fdc.size();i--;) + uint32 ttlNumFiles= fdc.size(); + for (uint32 i=ttlNumFiles;i--;) { if (fdc[i].FileSize>maxSize) fdc.removeFile(i); diff --git a/code/ryzom/server/src/general_utilities_service/stats_guild_scan_job.h b/code/ryzom/server/src/general_utilities_service/stats_guild_scan_job.h index e75564e49..ebcc43e7e 100644 --- a/code/ryzom/server/src/general_utilities_service/stats_guild_scan_job.h +++ b/code/ryzom/server/src/general_utilities_service/stats_guild_scan_job.h @@ -53,7 +53,7 @@ public: private: // private data - internal to job - typedef enum { INIT, WORK, CLOSED, ERROR } TState; + enum TState { INIT, WORK, CLOSED, ERROR }; TState _State; uint32 _NextFile; CFileDescriptionContainer _Files; diff --git a/code/ryzom/server/src/gpm_service/cell.h b/code/ryzom/server/src/gpm_service/cell.h index 054156dbc..a4846a7a6 100644 --- a/code/ryzom/server/src/gpm_service/cell.h +++ b/code/ryzom/server/src/gpm_service/cell.h @@ -34,7 +34,7 @@ class CCell { public: /// default constructor - CCell() : _LastVisionUpdate(0) {}; + CCell() : _LastVisionUpdate(0) {} /// initialisation void init( sint32 cellId ) diff --git a/code/ryzom/server/src/input_output_service/chat_manager.h b/code/ryzom/server/src/input_output_service/chat_manager.h index 8fbc34deb..811bdc710 100644 --- a/code/ryzom/server/src/input_output_service/chat_manager.h +++ b/code/ryzom/server/src/input_output_service/chat_manager.h @@ -58,13 +58,13 @@ public : /// exception thrown when client is unknown struct EChatClient : public NLMISC::Exception { - EChatClient( const NLMISC::CEntityId& id ) : Exception ("Don't have chat infos for the char "+id.toString()) {}; + EChatClient( const NLMISC::CEntityId& id ) : Exception ("Don't have chat infos for the char "+id.toString()) {} }; /// exception thrown when group is unknown struct EChatGroup : public NLMISC::Exception { - EChatGroup( const TGroupId& gId ) : Exception ("Can't find the group "+gId.toString()) {}; + EChatGroup( const TGroupId& gId ) : Exception ("Can't find the group "+gId.toString()) {} }; /** diff --git a/code/ryzom/server/src/input_output_service/stdpch.h b/code/ryzom/server/src/input_output_service/stdpch.h index c1a8fea5c..743601942 100644 --- a/code/ryzom/server/src/input_output_service/stdpch.h +++ b/code/ryzom/server/src/input_output_service/stdpch.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "nel/georges/load_form.h" diff --git a/code/ryzom/server/src/monitor_service/service_main.cpp b/code/ryzom/server/src/monitor_service/service_main.cpp index d4f3e8d56..5ca88641e 100644 --- a/code/ryzom/server/src/monitor_service/service_main.cpp +++ b/code/ryzom/server/src/monitor_service/service_main.cpp @@ -29,7 +29,9 @@ #ifdef NL_OS_WINDOWS # define NOMINMAX -# include +# include +# include +typedef unsigned long ulong; #endif // NL_OS_WINDOWS #include diff --git a/code/ryzom/server/src/patchman_service/cpr_client_patch_repository.cpp b/code/ryzom/server/src/patchman_service/cpr_client_patch_repository.cpp index 9f24857ba..43d5f7d63 100644 --- a/code/ryzom/server/src/patchman_service/cpr_client_patch_repository.cpp +++ b/code/ryzom/server/src/patchman_service/cpr_client_patch_repository.cpp @@ -97,7 +97,7 @@ protected: static uint32 getFileVersion(const NLMISC::CSString& fileName) { // start at the back of the file name and scan forwards until we find a '/' or '\\' or ':' or a digit - uint32 i= fileName.size(); + uint32 i= (uint32)fileName.size(); while (i--) { char c= fileName[i]; diff --git a/code/ryzom/server/src/patchman_service/file_manager.cpp b/code/ryzom/server/src/patchman_service/file_manager.cpp index 4bd619cd6..7c37903a9 100644 --- a/code/ryzom/server/src/patchman_service/file_manager.cpp +++ b/code/ryzom/server/src/patchman_service/file_manager.cpp @@ -459,9 +459,9 @@ namespace PATCHMAN NLMISC::CPath::getPathContent(_Root+directoryName,false,true,false,pathContents); // run through the directories we found... - for (uint32 i=pathContents.size();i--;) + for (uint32 i=(uint32)pathContents.size();i--;) { - NLMISC::CSString childDirectoryName= NLMISC::CSString(pathContents[i]).leftCrop(_Root.size()); + NLMISC::CSString childDirectoryName= NLMISC::CSString(pathContents[i]).leftCrop((uint32)_Root.size()); // make sure they exist in the '_DirectoryTree' map _DirectoryTree[childDirectoryName]; @@ -484,14 +484,14 @@ namespace PATCHMAN NLMISC::CPath::getPathContent(_Root+directoryName,false,false,true,pathContents); // run through the files adding them to ourself - for (uint32 i=pathContents.size();i--;) + for (uint32 i=(uint32)pathContents.size();i--;) { // if the file is system file then skip it if (pathContents[i].find("/.")!=std::string::npos) continue; // construct the file name - NLMISC::CSString fileName= NLMISC::CSString(pathContents[i]).leftCrop(_Root.size()); + NLMISC::CSString fileName= NLMISC::CSString(pathContents[i]).leftCrop((uint32)_Root.size()); // get hold of the directory entry for this file (or create a new one if not exist) and update it _IndexFileIsUpToDate&= _DirectoryTree[directoryName][fileName].updateFileInfo(fileName,pathContents[i],SFileInfo::RECALCULATE_IF_CHANGED,updateListener); } @@ -601,7 +601,7 @@ namespace PATCHMAN // read in the file FILE* inf= fopen(fileName.c_str(),"rb"); BOMB_IF(inf==NULL,"Failed to open input file for reading: "+fileName,return false); - uint32 bytesRead=fread(&_CacheBuffer[newFileEntry.StartOffset],1,fileSize,inf); + uint32 bytesRead=(uint32)fread(&_CacheBuffer[newFileEntry.StartOffset],1,fileSize,inf); fclose(inf); BOMB_IF(bytesRead!=fileSize,"Failed to read data from input file: "+fileName,return false); @@ -732,7 +732,7 @@ NLMISC_CATEGORISED_COMMAND(patchman,fileManagerSave,"Save a file via the file ma CSString fileName= args[0]; CMemStream data; - data.serialBuffer((uint8*)(&args[1][0]),args[1].size()); + data.serialBuffer((uint8*)(&args[1][0]),(uint32)args[1].size()); CFileManager::getInstance().save(fileName,data); return true; diff --git a/code/ryzom/server/src/patchman_service/file_receiver.cpp b/code/ryzom/server/src/patchman_service/file_receiver.cpp index a3ca87da0..278f24059 100644 --- a/code/ryzom/server/src/patchman_service/file_receiver.cpp +++ b/code/ryzom/server/src/patchman_service/file_receiver.cpp @@ -347,7 +347,7 @@ namespace PATCHMAN // add the data to the file CSString& theBuffer= theRequest->DataSoFar; - uint32 oldSize= theBuffer.size(); + uint32 oldSize= (uint32)theBuffer.size(); theBuffer.resize(oldSize+data.getBufferSize()); memcpy(&(theBuffer[oldSize]), data.getBuffer(), data.getBufferSize()); @@ -355,7 +355,7 @@ namespace PATCHMAN if (theRequest->DataSoFar.size()>=theRequest->ExpectedFileSize) { // we've reached the end of file - _dealWithReceivedFile(sender,theRequest,NLNET::TBinBuffer((const uint8 *)&theRequest->DataSoFar[0],theRequest->DataSoFar.size())); + _dealWithReceivedFile(sender,theRequest,NLNET::TBinBuffer((const uint8 *)&theRequest->DataSoFar[0],(uint32)theRequest->DataSoFar.size())); return; } @@ -374,7 +374,7 @@ namespace PATCHMAN } // log our progress - _downloadLog(fileName,theRequest->DataSoFar.size(),theRequest->ExpectedFileSize); + _downloadLog(fileName,(uint32)theRequest->DataSoFar.size(),theRequest->ExpectedFileSize); } void CFileReceiver::cbFileDataFailure(NLNET::IModuleProxy *sender, const std::string &fileName) diff --git a/code/ryzom/server/src/patchman_service/file_repository.cpp b/code/ryzom/server/src/patchman_service/file_repository.cpp index d1d2d4b54..72881f587 100644 --- a/code/ryzom/server/src/patchman_service/file_repository.cpp +++ b/code/ryzom/server/src/patchman_service/file_repository.cpp @@ -332,7 +332,7 @@ namespace PATCHMAN CFileReceiverProxy rr(sender); if (ok && !result.empty()) { - rr.cbFileData(_Parent,fileName,startOffset,NLNET::TBinBuffer((const uint8 *)&result[0],result.size())); + rr.cbFileData(_Parent,fileName,startOffset,NLNET::TBinBuffer((const uint8 *)&result[0],(uint32)result.size())); } else { diff --git a/code/ryzom/server/src/patchman_service/module_admin_itf.h b/code/ryzom/server/src/patchman_service/module_admin_itf.h index d9649f603..a0d4aa34e 100644 --- a/code/ryzom/server/src/patchman_service/module_admin_itf.h +++ b/code/ryzom/server/src/patchman_service/module_admin_itf.h @@ -71,9 +71,9 @@ namespace PATCHMAN // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); @@ -211,9 +211,9 @@ namespace PATCHMAN // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); @@ -371,9 +371,9 @@ namespace PATCHMAN // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); @@ -504,9 +504,9 @@ namespace PATCHMAN // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); @@ -711,9 +711,9 @@ namespace PATCHMAN // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); @@ -911,9 +911,9 @@ namespace PATCHMAN // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); diff --git a/code/ryzom/server/src/patchman_service/pam_patchman_admin_module.cpp b/code/ryzom/server/src/patchman_service/pam_patchman_admin_module.cpp index 0eaf4f946..60efeee33 100644 --- a/code/ryzom/server/src/patchman_service/pam_patchman_admin_module.cpp +++ b/code/ryzom/server/src/patchman_service/pam_patchman_admin_module.cpp @@ -436,7 +436,7 @@ NLMISC_CLASS_COMMAND_IMPL(CPatchmanAdminModule, download) } // iterate over matching files, adding them to the download list - for (uint32 i=fileInfo.size();i--;) + for (uint i=(uint)fileInfo.size();i--;) { _DownloadRequests[fileInfo[i].FileName]= NLMISC::CPath::standardizePath(destination); requestFile(fileInfo[i].FileName); diff --git a/code/ryzom/server/src/patchman_service/patchman_tester.h b/code/ryzom/server/src/patchman_service/patchman_tester.h index ccab3d800..16a620c1c 100644 --- a/code/ryzom/server/src/patchman_service/patchman_tester.h +++ b/code/ryzom/server/src/patchman_service/patchman_tester.h @@ -38,6 +38,8 @@ namespace PATCHMAN class CPatchmanTester { public: + virtual ~CPatchmanTester() {} + // this is a singleton so it has a getInstance() method to get to the singleton instance static CPatchmanTester& getInstance(); diff --git a/code/ryzom/server/src/patchman_service/repository.cpp b/code/ryzom/server/src/patchman_service/repository.cpp index b71c11ef2..a63a96bcd 100644 --- a/code/ryzom/server/src/patchman_service/repository.cpp +++ b/code/ryzom/server/src/patchman_service/repository.cpp @@ -52,7 +52,7 @@ NLMISC::CSString getRepositoryIndexFileName(const NLMISC::CSString& repositoryNa uint32 getFileVersion(const NLMISC::CSString& fileName) { // start at the back of the file name and scan forwards until we find a '/' or '\\' or ':' or a digit - uint32 i= fileName.size(); + uint32 i= (uint32)fileName.size(); while (i--) { char c= fileName[i]; @@ -184,9 +184,9 @@ void CRepository::updateFile(NLMISC::CSString fileName) nldebug(("GUSREP_Updating repository entry for file: '"+fileName+"'").c_str()); // if the name of the file that has changed contains the target directory name then crop it - if (fileName.left(_TargetDirectory.size())==_TargetDirectory) + if (fileName.left((uint32)_TargetDirectory.size())==_TargetDirectory) { - fileName=fileName.leftCrop(_TargetDirectory.size()); + fileName=fileName.leftCrop((uint32)_TargetDirectory.size()); } // lookup the file in the map @@ -219,9 +219,9 @@ void CRepository::addFileStub(NLMISC::CSString fileName) nldebug(("GUSREP_Adding repository stub for file: '"+fileName+"'").c_str()); // if the name of the file that has changed contains the target directory name then crop it - if (fileName.left(_TargetDirectory.size())==_TargetDirectory) + if (fileName.left((uint32)_TargetDirectory.size())==_TargetDirectory) { - fileName=fileName.leftCrop(_TargetDirectory.size()); + fileName=fileName.leftCrop((uint32)_TargetDirectory.size()); } // make sure the file didn't already exist in the map @@ -258,7 +258,7 @@ uint32 CRepository::update() // get hold of the file name for the next file // CSString fileName= NLMISC::CFile::getFilename(theFile.FileName); - CSString fileName= theFile.FileName.leftCrop(_TargetDirectory.size()); + CSString fileName= theFile.FileName.leftCrop((uint32)_TargetDirectory.size()); // extract the version number from the file name and skip the file if it's too recent or the version number was invalid uint32 fileVersion= getFileVersion(fileName); @@ -345,7 +345,7 @@ void CRepository::setVersion(uint32 version) uint32 CRepository::size() const { - return _Files.size(); + return (uint32)_Files.size(); } const CRepository::CFilesMapEntry& CRepository::operator[](const NLMISC::CSString& key) const diff --git a/code/ryzom/server/src/patchman_service/service_main.cpp b/code/ryzom/server/src/patchman_service/service_main.cpp index aa0cfbffb..7e61baba8 100644 --- a/code/ryzom/server/src/patchman_service/service_main.cpp +++ b/code/ryzom/server/src/patchman_service/service_main.cpp @@ -115,12 +115,12 @@ void CTaskScheduler::update() // check to see if we've broken our max sheduled tasks record... if (_MaxTasks < _Tasks.size()) { - _MaxTasks = _Tasks.size(); + _MaxTasks = (uint32)_Tasks.size(); nldebug("New scheduled task record: %u",_MaxTasks); } // iterate over all scheduled tasks (we go backwards to simplify deletion of executed tasks as we go) - for (uint32 i=_Tasks.size();i--;) + for (uint32 i=(uint32)_Tasks.size();i--;) { // get a refference to the next task STask& theTask= _Tasks[i]; diff --git a/code/ryzom/server/src/pd_lib/pds_common.h b/code/ryzom/server/src/pd_lib/pds_common.h index 040c0354b..18cb93c4a 100644 --- a/code/ryzom/server/src/pd_lib/pds_common.h +++ b/code/ryzom/server/src/pd_lib/pds_common.h @@ -144,7 +144,7 @@ bool getProperty(xmlNodePtr node, const char* propName, T &result, const T &defa if (!NLMISC::CIXml::getPropertyString(res, node, propName)) { if (!quiet) - nlwarning("Couldn't get property '%s' in xml node, use '%s' value instead", propName, toString(defaultValue).c_str()); + nlwarning("Couldn't get property '%s' in xml node, use '%s' value instead", propName, NLMISC::toString(defaultValue).c_str()); result = defaultValue; return false; } diff --git a/code/ryzom/server/src/pd_support_service/stat_char_filter_factory.h b/code/ryzom/server/src/pd_support_service/stat_char_filter_factory.h index 656cc0cca..a96b7d6a5 100644 --- a/code/ryzom/server/src/pd_support_service/stat_char_filter_factory.h +++ b/code/ryzom/server/src/pd_support_service/stat_char_filter_factory.h @@ -52,6 +52,7 @@ public: class ICharFilterBuilder: public NLMISC::CRefCount { public: + virtual ~ICharFilterBuilder() {} virtual const char* getName()=0; virtual const char* getDescription()=0; virtual ICharFilter* build(const std::string& rawArgs)=0; diff --git a/code/ryzom/server/src/pd_support_service/stat_char_info_extractor_factory.h b/code/ryzom/server/src/pd_support_service/stat_char_info_extractor_factory.h index 868004c39..cd182c169 100644 --- a/code/ryzom/server/src/pd_support_service/stat_char_info_extractor_factory.h +++ b/code/ryzom/server/src/pd_support_service/stat_char_info_extractor_factory.h @@ -56,6 +56,7 @@ public: class ICharInfoExtractorBuilder: public NLMISC::CRefCount { public: + virtual ~ICharInfoExtractorBuilder() {} virtual const char* getName() const=0; virtual const char* getDescription() const=0; virtual const char* getFields() const=0; diff --git a/code/ryzom/server/src/pd_support_service/stat_file_list_builder_factory.h b/code/ryzom/server/src/pd_support_service/stat_file_list_builder_factory.h index fbfb5dc61..367c0caa2 100644 --- a/code/ryzom/server/src/pd_support_service/stat_file_list_builder_factory.h +++ b/code/ryzom/server/src/pd_support_service/stat_file_list_builder_factory.h @@ -54,6 +54,7 @@ public: class IFileListBuilderBuilder: public NLMISC::CRefCount { public: + virtual ~IFileListBuilderBuilder() {} virtual const char* getName()=0; virtual const char* getDescription()=0; virtual IFileListBuilder* build(const std::string& rawArgs)=0; diff --git a/code/ryzom/server/src/sabrina/faber_phrase.h b/code/ryzom/server/src/sabrina/faber_phrase.h index 8069dc4f6..4d85e8b53 100644 --- a/code/ryzom/server/src/sabrina/faber_phrase.h +++ b/code/ryzom/server/src/sabrina/faber_phrase.h @@ -64,21 +64,21 @@ public: /** * set the actor */ - virtual void setActor( const TDataSetRow &entityRowId ){}; + virtual void setActor( const TDataSetRow &entityRowId ){} /** * called at the end of the latency time */ - virtual void end(){}; + virtual void end(){} //@} ///\unused basic methods from CSPhrase //@{ - virtual void setPrimaryItem( CGameItemPtr itemPtr ){}; - virtual void setSecondaryItem( CGameItemPtr itemPtr ){}; - virtual void addConsumableItem( CGameItemPtr itemPtr ){}; - virtual void setPrimaryTarget( const TDataSetRow& ) {}; - virtual void addTargetEntity( const TDataSetRow& ) {}; + virtual void setPrimaryItem( CGameItemPtr itemPtr ){} + virtual void setSecondaryItem( CGameItemPtr itemPtr ){} + virtual void addConsumableItem( CGameItemPtr itemPtr ){} + virtual void setPrimaryTarget( const TDataSetRow& ) {} + virtual void addTargetEntity( const TDataSetRow& ) {} //@} inline const TDataSetRow & getActor() { return _ActorRowId;} diff --git a/code/ryzom/server/src/sabrina/harvest_phrase.h b/code/ryzom/server/src/sabrina/harvest_phrase.h index b5f290019..c300b1abd 100644 --- a/code/ryzom/server/src/sabrina/harvest_phrase.h +++ b/code/ryzom/server/src/sabrina/harvest_phrase.h @@ -62,11 +62,11 @@ public: ///\unused basic methods from CSPhrase //@{ - virtual void setPrimaryItem( CGameItemPtr itemPtr ){}; - virtual void setSecondaryItem( CGameItemPtr itemPtr ){}; - virtual void addConsumableItem( CGameItemPtr itemPtr ){}; - virtual void setPrimaryTarget( const TDataSetRow& ) {}; - virtual void addTargetEntity( const TDataSetRow& ) {}; + virtual void setPrimaryItem( CGameItemPtr itemPtr ){} + virtual void setSecondaryItem( CGameItemPtr itemPtr ){} + virtual void addConsumableItem( CGameItemPtr itemPtr ){} + virtual void setPrimaryTarget( const TDataSetRow& ) {} + virtual void addTargetEntity( const TDataSetRow& ) {} //@} //@} @@ -74,7 +74,7 @@ public: /** * set the actor */ - virtual void setActor( const TDataSetRow &entityRowId ){}; + virtual void setActor( const TDataSetRow &entityRowId ){} /** * called at the end of the latency time diff --git a/code/ryzom/server/src/sabrina/magic_phrase.h b/code/ryzom/server/src/sabrina/magic_phrase.h index fbfe5dee2..45ee645cd 100644 --- a/code/ryzom/server/src/sabrina/magic_phrase.h +++ b/code/ryzom/server/src/sabrina/magic_phrase.h @@ -78,17 +78,17 @@ public: virtual void execute(); virtual void apply(); virtual void stop(); - virtual void setPrimaryTarget( const TDataSetRow &entityRowId ){ _Targets[0] = entityRowId; }; - virtual void addTargetEntity( const TDataSetRow &entityRowId ){ _Targets.push_back(entityRowId);}; + virtual void setPrimaryTarget( const TDataSetRow &entityRowId ){ _Targets[0] = entityRowId; } + virtual void addTargetEntity( const TDataSetRow &entityRowId ){ _Targets.push_back(entityRowId);} //@} /// \name Unused virtual methods from CSPhrase //@{ virtual void setActor( const TDataSetRow & actorRowId ){ } - virtual void end(){}; - virtual void setPrimaryItem( CGameItemPtr itemPtr ){ }; - virtual void setSecondaryItem( CGameItemPtr itemPtr ){ }; - virtual void addConsumableItem( CGameItemPtr itemPtr ){ }; + virtual void end(){} + virtual void setPrimaryItem( CGameItemPtr itemPtr ){ } + virtual void setSecondaryItem( CGameItemPtr itemPtr ){ } + virtual void addConsumableItem( CGameItemPtr itemPtr ){ } //@} private: diff --git a/code/ryzom/server/src/sabrina/s_effect.h b/code/ryzom/server/src/sabrina/s_effect.h index ca34245ee..c706756eb 100644 --- a/code/ryzom/server/src/sabrina/s_effect.h +++ b/code/ryzom/server/src/sabrina/s_effect.h @@ -55,7 +55,7 @@ public: virtual bool update( uint32 & updateFlag ) = 0; /// callback called when the effect is actually removed. Does nothing by default - virtual void removed(){}; + virtual void removed(){} ///\name accessors //@{ diff --git a/code/ryzom/server/src/server_share/backup_service_itf.h b/code/ryzom/server/src/server_share/backup_service_itf.h index ed6aadc0d..5b1ffe352 100644 --- a/code/ryzom/server/src/server_share/backup_service_itf.h +++ b/code/ryzom/server/src/server_share/backup_service_itf.h @@ -63,9 +63,9 @@ namespace BS // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); @@ -185,9 +185,9 @@ namespace BS // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); diff --git a/code/ryzom/server/src/server_share/char_name_mapper_itf.h b/code/ryzom/server/src/server_share/char_name_mapper_itf.h index b7133fe9a..456bcc0c7 100644 --- a/code/ryzom/server/src/server_share/char_name_mapper_itf.h +++ b/code/ryzom/server/src/server_share/char_name_mapper_itf.h @@ -217,9 +217,9 @@ namespace CNM // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); @@ -330,9 +330,9 @@ namespace CNM // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); diff --git a/code/ryzom/server/src/server_share/chat_unifier_itf.h b/code/ryzom/server/src/server_share/chat_unifier_itf.h index 8b736a082..f284c8fbb 100644 --- a/code/ryzom/server/src/server_share/chat_unifier_itf.h +++ b/code/ryzom/server/src/server_share/chat_unifier_itf.h @@ -214,9 +214,9 @@ namespace CHATUNI // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); @@ -331,9 +331,9 @@ namespace CHATUNI // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); diff --git a/code/ryzom/server/src/server_share/command_executor_itf.h b/code/ryzom/server/src/server_share/command_executor_itf.h index dce7dce44..58a7f1c51 100644 --- a/code/ryzom/server/src/server_share/command_executor_itf.h +++ b/code/ryzom/server/src/server_share/command_executor_itf.h @@ -63,9 +63,9 @@ namespace CMDEXE // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); diff --git a/code/ryzom/server/src/server_share/entity_locator_itf.h b/code/ryzom/server/src/server_share/entity_locator_itf.h index 59459a82d..317ad5199 100644 --- a/code/ryzom/server/src/server_share/entity_locator_itf.h +++ b/code/ryzom/server/src/server_share/entity_locator_itf.h @@ -139,9 +139,9 @@ namespace ENTITYLOC // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); @@ -384,9 +384,9 @@ namespace ENTITYLOC // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); diff --git a/code/ryzom/server/src/server_share/logger_service_itf.h b/code/ryzom/server/src/server_share/logger_service_itf.h index 8996c1369..051cc85cb 100644 --- a/code/ryzom/server/src/server_share/logger_service_itf.h +++ b/code/ryzom/server/src/server_share/logger_service_itf.h @@ -983,9 +983,9 @@ namespace LGS // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); diff --git a/code/ryzom/server/src/server_share/mail_forum_itf.h b/code/ryzom/server/src/server_share/mail_forum_itf.h index aeaf0709b..b16cd7d24 100644 --- a/code/ryzom/server/src/server_share/mail_forum_itf.h +++ b/code/ryzom/server/src/server_share/mail_forum_itf.h @@ -63,9 +63,9 @@ namespace MFS // unused interceptors std::string fwdBuildModuleManifest() const { return std::string(); } - void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {}; - void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {}; + void fwdOnModuleUp(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleDown(NLNET::IModuleProxy *moduleProxy) {} + void fwdOnModuleSecurityChange(NLNET::IModuleProxy *moduleProxy) {} // process module message interceptor bool fwdOnProcessModuleMessage(NLNET::IModuleProxy *sender, const NLNET::CMessage &message); diff --git a/code/ryzom/server/src/server_share/mission_messages.h b/code/ryzom/server/src/server_share/mission_messages.h index d779b709d..9c03f1f91 100644 --- a/code/ryzom/server/src/server_share/mission_messages.h +++ b/code/ryzom/server/src/server_share/mission_messages.h @@ -56,7 +56,7 @@ public: property ("Length", PropUInt8, (uint8)0,Length); } - virtual void callback (const std::string &name, uint8 id) {}; + virtual void callback (const std::string &name, uint8 id) {} }; */ @@ -115,7 +115,7 @@ public: property ("RewardType", PropUInt8, (uint8)MISSION_DESC::NbReward, RewardType); } - virtual void callback (const std::string &name, uint8 id) {}; + virtual void callback (const std::string &name, uint8 id) {} }; */ diff --git a/code/ryzom/server/src/server_share/msg_ai_service.h b/code/ryzom/server/src/server_share/msg_ai_service.h index c62ca0283..132e56e1c 100644 --- a/code/ryzom/server/src/server_share/msg_ai_service.h +++ b/code/ryzom/server/src/server_share/msg_ai_service.h @@ -49,7 +49,7 @@ public: propertyCont ("Character", PropDataSetRow, Character); propertyCont ("Creature", PropDataSetRow, Creature); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -68,7 +68,7 @@ public: propertyCont ("Content", PropString, Content); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -94,7 +94,7 @@ public: propertyCont ("Params", PropString, Params); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -115,7 +115,7 @@ public: propertyCont ("GrpAlias", PropUInt32, GrpAlias); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -138,7 +138,7 @@ public: property ("TeamId", PropUInt16, CTEAM::InvalidTeamId, TeamId); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -160,7 +160,7 @@ public: // propertyCont ("OutpostNames", PropString, OutpostNames); // } // -// virtual void callback (const std::string &name, NLNET::TServiceId id) {}; +// virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} //}; //---------------------------------------------------------------------------- @@ -198,7 +198,7 @@ public: //// propertyCont ("Fames", PropString, DutyNames); // } // -// virtual void callback (const std::string &name, NLNET::TServiceId id) {}; +// virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} //}; //---------------------------------------------------------------------------- @@ -227,7 +227,7 @@ public: propertyCont ("Parameters", PropString, Parameters); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -253,7 +253,7 @@ public: // property ("GuildIndex", PropDataSetRow, TDataSetRow() ,GuildIndex); // } // -// virtual void callback (const std::string &name, NLNET::TServiceId id) {}; +// virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} //}; @@ -280,7 +280,7 @@ public: // property ("GuildId", PropDataSetRow, TDataSetRow() ,GuildId); // } // -// virtual void callback (const std::string &name, NLNET::TServiceId id) {}; +// virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} //}; //---------------------------------------------------------------------------- @@ -299,7 +299,7 @@ public: property ("BotRowId", PropDataSetRow, TDataSetRow() , BotRowId); property ("Heading", PropFloat,0.0f,Heading); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -317,7 +317,7 @@ public: property ("PlayerRowId", PropDataSetRow, TDataSetRow(), PlayerRowId); property ("TargetRowId", PropDataSetRow, TDataSetRow(), TargetRowId); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -336,7 +336,7 @@ public: property ("PlayerRowId", PropDataSetRow, TDataSetRow(), PlayerRowId); property ("CreatureRowId", PropDataSetRow, TDataSetRow(), CreatureRowId); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -365,7 +365,7 @@ public: property ("PlayerRowId", PropDataSetRow, TDataSetRow(), PlayerRowId); property ("TargetRowId", PropDataSetRow, TDataSetRow(), TargetRowId); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -394,7 +394,7 @@ public: property ("PlayerRowId", PropDataSetRow, TDataSetRow(), PlayerRowId); property ("TargetRowId", PropDataSetRow, TDataSetRow(), TargetRowId); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -410,7 +410,7 @@ public: className ("CAIPlayerRespawnMsg"); property ("PlayerRowId", PropDataSetRow, TDataSetRow(), PlayerRowId); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -428,7 +428,7 @@ public: property ("EntityRowId", PropDataSetRow, TDataSetRow(), EntityRowId); property ("AskerRowID", PropDataSetRow, TDataSetRow(), AskerRowID); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -448,7 +448,7 @@ public: property ("AskerRowID", PropDataSetRow, TDataSetRow(), AskerRowID); propertyCont ("Infos", PropString, Infos); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -466,7 +466,7 @@ public: property ("EntityRowId", PropDataSetRow, TDataSetRow(), EntityRowId); property ("EnableAggro", PropBool, true, EnableAggro); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -482,7 +482,7 @@ public: className ("CReportAICollisionAvailableMsg"); propertyCont ("ContinentsCollision", PropString, ContinentsCollision); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -500,7 +500,7 @@ public: property ("InstanceNumber", PropUInt32, uint32(0), InstanceNumber); property ("InstanceContinent", PropString, std::string(), InstanceContinent); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -520,7 +520,7 @@ public: property ("ActionName", PropString, std::string(), ActionName); property ("Url", PropString, std::string(), Url); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -536,7 +536,7 @@ public: className ("CReportAIInstanceDespawnMsg"); propertyCont ("InstanceNumbers", PropUInt32, InstanceNumbers); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; @@ -555,7 +555,7 @@ public: className ("CWarnBadInstanceMsg"); property ("InstanceNumber", PropUInt32, uint32(0), InstanceNumber); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -575,7 +575,7 @@ public: propertyCont ("ActionFlags", PropUInt8, ActionFlags); propertyVector ("Values", PropBool, Values); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} inline void push(TDataSetRow entity, uint8 flag, bool value) { @@ -599,7 +599,7 @@ public: propertyCont ("Entities", PropDataSetRow, Entities); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -620,7 +620,7 @@ public: propertyCont ("SetFull", PropUInt8, SetFull); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -639,7 +639,7 @@ public: propertyCont ("DeltaHp", PropSInt32, DeltaHp); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -657,7 +657,7 @@ public: property ("CreatureId", PropDataSetRow, TDataSetRow(), CreatureId); property ("NewMode", PropUInt8, (uint8)0, NewMode); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -673,7 +673,7 @@ public: className ("CCreatureDespawnMsg"); propertyCont ("Entities", PropDataSetRow, Entities); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; ///////////////////////////////////////////////////////////////////////////// @@ -934,7 +934,7 @@ public: property ("MissionAlias", PropUInt32, uint32(0xffffffff), MissionAlias); property ("DespawnTimeInTick", PropUInt32, uint32(0), DespawnTimeInTick); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -954,7 +954,7 @@ public: property ("GroupAlias", PropUInt32, uint32(0xffffffff), GroupAlias); property ("MissionAlias", PropUInt32, uint32(0xffffffff), MissionAlias); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -974,7 +974,7 @@ public: property ("GroupAlias", PropUInt32, uint32(0xffffffff), GroupAlias); property ("MissionAlias", PropUInt32, uint32(0xffffffff), MissionAlias); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -994,7 +994,7 @@ public: property ("GroupAlias", PropUInt32, uint32(0xffffffff), GroupAlias); property ("MissionAlias", PropUInt32, uint32(0xffffffff), MissionAlias); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; @@ -1046,7 +1046,7 @@ public: propertyCont ("Quantities", PropUInt32, Quantities); property ("MissionText", PropString, std::string(), MissionText); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------------------- @@ -1082,7 +1082,7 @@ public: propertyCont ("Quantities", PropUInt32, Quantities); property ("MissionText", PropString, std::string(), MissionText); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {} + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; @@ -1130,7 +1130,7 @@ public: propertyCont ("Params", PropString, Params); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} TFunEnum getFunEnum(const std::string& funName) const; diff --git a/code/ryzom/server/src/server_share/msg_gpm_service.h b/code/ryzom/server/src/server_share/msg_gpm_service.h index c4039be97..d985c8781 100644 --- a/code/ryzom/server/src/server_share/msg_gpm_service.h +++ b/code/ryzom/server/src/server_share/msg_gpm_service.h @@ -73,7 +73,7 @@ public: property("Type", PropUInt32, (uint32)Player, Type); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &name, NLNET::TServiceId id) {} }; diff --git a/code/ryzom/server/src/server_share/mysql_wrapper.h b/code/ryzom/server/src/server_share/mysql_wrapper.h index d2fbc09d6..2bc2489cf 100644 --- a/code/ryzom/server/src/server_share/mysql_wrapper.h +++ b/code/ryzom/server/src/server_share/mysql_wrapper.h @@ -26,8 +26,11 @@ #include "nel/net/module_common.h" #include "game_share/utils.h" #ifdef NL_OS_WINDOWS -# include +# include +# include +typedef unsigned long ulong; #endif + #include #include diff --git a/code/ryzom/server/src/server_share/npc_description_messages.h b/code/ryzom/server/src/server_share/npc_description_messages.h index 051cbeb44..1c838ad80 100644 --- a/code/ryzom/server/src/server_share/npc_description_messages.h +++ b/code/ryzom/server/src/server_share/npc_description_messages.h @@ -47,8 +47,9 @@ std::string buildChatDebugString(const std::vector &ShopCategories, class CNpcChatProfile { public: - CNpcChatProfile() : /*_guildCreator(false),*/ /*_dynamicMissionGiver(false),*/ _Organization(0), _FilterExplicitActionTradeByPlayerRace(false), - _ExplicitActionSPType(EGSPD::CSPType::Unknown), _FilterExplicitActionTradeByBotRace(true){} + CNpcChatProfile() : /*_guildCreator(false),*/ /*_dynamicMissionGiver(false),*/ _FilterExplicitActionTradeByPlayerRace(false), + _ExplicitActionSPType(EGSPD::CSPType::Unknown), _FilterExplicitActionTradeByBotRace(true), + _DynamicMissionGiver(false), _Organization(0) {} CNpcChatProfile(const CNpcChatProfile &other0,const CNpcChatProfile &other1); virtual ~CNpcChatProfile() {} @@ -84,7 +85,7 @@ public: const std::string &getWebPageName() const { return _WebPageName; } const NLMISC::CSheetId &getOutpost() const { return _Outpost; } - const uint32 getOrganization() const { return _Organization; } + uint32 getOrganization() const { return _Organization; } protected: std::vector< RYMSG::TExplicitSale > _ExplicitSales; @@ -146,7 +147,7 @@ struct CCharacterBotChatBeginEnd : public CMirrorTransportClass propertyCont ("botChatEnd", PropUInt32, BotChatEnd); } - virtual void callback (const std::string &name, NLNET::TServiceId id) { } + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) { } }; struct CCharacterDynChatBeginEnd : public CMirrorTransportClass @@ -162,7 +163,7 @@ struct CCharacterDynChatBeginEnd : public CMirrorTransportClass propertyCont ("dnChatEnd", PropUInt32, DynChatEnd); } - virtual void callback (const std::string &name, NLNET::TServiceId id) { } + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) { } }; struct CCustomElementId diff --git a/code/ryzom/server/src/server_share/pet_interface_msg.h b/code/ryzom/server/src/server_share/pet_interface_msg.h index 09bbab13d..6571b271a 100644 --- a/code/ryzom/server/src/server_share/pet_interface_msg.h +++ b/code/ryzom/server/src/server_share/pet_interface_msg.h @@ -59,7 +59,7 @@ public: property ("CustomName", PropUCString, ucstring(""), CustomName); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; @@ -93,7 +93,7 @@ public: property ("PetMirrorRow", PropDataSetRow, TDataSetRow(), PetMirrorRow); property ("PetIndex", PropUInt16, (uint16)0, PetIdx); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; @@ -123,7 +123,7 @@ public: property ("Heading", PropFloat, 0.0f, Heading); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------- @@ -151,7 +151,7 @@ public: className ("CPetCommandConfirmationMsg"); property ("CommandError", PropUInt16, (uint16)NO_ERROR_COMMAND, CommandError); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; //---------------------------------------------------------------- @@ -171,7 +171,7 @@ public: property ("PetMirrorRow", PropDataSetRow, TDataSetRow(), PetMirrorRow); } - virtual void callback (const std::string &name, NLNET::TServiceId id) {}; + virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) {} }; #endif //RY_PET_INTERFACE_MESSAGES_H diff --git a/code/ryzom/server/src/server_share/stat_db_tree.h b/code/ryzom/server/src/server_share/stat_db_tree.h index 8faaa85ee..7472a2092 100644 --- a/code/ryzom/server/src/server_share/stat_db_tree.h +++ b/code/ryzom/server/src/server_share/stat_db_tree.h @@ -95,13 +95,13 @@ class CStatDBLeaf : public IStatDBNode public: virtual ~CStatDBLeaf() {} - bool setNode(const std::string & path, IStatDBNodePtr node) { return false; } - IStatDBNodePtr getNode(const std::string & path) { return NULL; } - void getNodes(const std::string & pathPattern, std::vector & matchingNodes, - const std::string & currentPath) {} - IStatDBNodePtr removeNode(const std::string & path) { return NULL; } + bool setNode(const std::string & /* path */, IStatDBNodePtr /* node */) { return false; } + IStatDBNodePtr getNode(const std::string & /* path */) { return NULL; } + void getNodes(const std::string & /* pathPattern */, std::vector & /* matchingNodes */, + const std::string & /* currentPath */) {} + IStatDBNodePtr removeNode(const std::string & /* path */) { return NULL; } - virtual void acceptVisitor(CStatDBNodeVisitor & visitor, const std::string & currentPath) {} + virtual void acceptVisitor(CStatDBNodeVisitor & /* visitor */, const std::string & /* currentPath */) {} }; /** diff --git a/code/ryzom/server/src/server_share/stat_db_tree_visitor.h b/code/ryzom/server/src/server_share/stat_db_tree_visitor.h index 1d57a6491..98e7455d3 100644 --- a/code/ryzom/server/src/server_share/stat_db_tree_visitor.h +++ b/code/ryzom/server/src/server_share/stat_db_tree_visitor.h @@ -34,9 +34,9 @@ class CStatDBTableLeaf; class CStatDBNodeVisitor { public: - virtual void visitBranch(CStatDBBranch * branch, const std::string & path) {} - virtual void visitValueLeaf(CStatDBValueLeaf * valueLeaf, const std::string & path) {} - virtual void visitTableLeaf(CStatDBTableLeaf * tableLeaf, const std::string & path) {} + virtual void visitBranch(CStatDBBranch * /* branch */, const std::string & /* path */) {} + virtual void visitValueLeaf(CStatDBValueLeaf * /* valueLeaf */, const std::string & /* path */) {} + virtual void visitTableLeaf(CStatDBTableLeaf * /* tableLeaf */, const std::string & /* path */) {} protected: CStatDBNodeVisitor() {} diff --git a/code/ryzom/server/src/shard_unifier_service/database_mapping.h b/code/ryzom/server/src/shard_unifier_service/database_mapping.h index d6f9b8689..61df29e9a 100644 --- a/code/ryzom/server/src/shard_unifier_service/database_mapping.h +++ b/code/ryzom/server/src/shard_unifier_service/database_mapping.h @@ -111,9 +111,9 @@ namespace RSMGR CKnownUserPtr() : _FileName(NULL), _LineNum(0), - _Ptr(NULL), _NextPtr(NULL), - _PrevPtr(NULL) + _PrevPtr(NULL), + _Ptr(NULL) { } @@ -1091,9 +1091,9 @@ namespace RSMGR CGuildInvitePtr() : _FileName(NULL), _LineNum(0), - _Ptr(NULL), _NextPtr(NULL), - _PrevPtr(NULL) + _PrevPtr(NULL), + _Ptr(NULL) { } @@ -1231,9 +1231,9 @@ namespace RSMGR CPlayerRatingPtr() : _FileName(NULL), _LineNum(0), - _Ptr(NULL), _NextPtr(NULL), - _PrevPtr(NULL) + _PrevPtr(NULL), + _Ptr(NULL) { } @@ -1371,9 +1371,9 @@ namespace RSMGR CJournalEntryPtr() : _FileName(NULL), _LineNum(0), - _Ptr(NULL), _NextPtr(NULL), - _PrevPtr(NULL) + _PrevPtr(NULL), + _Ptr(NULL) { } 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 8088e14ca..cee3e4bf5 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 @@ -36,6 +36,11 @@ #include "nel_database_mapping.h" #include "character_sync.h" +// defined by MySQL config file +#ifdef access +#undef access +#endif + using namespace std; using namespace NLMISC; using namespace NLNET; diff --git a/code/ryzom/tools/client/client_config/base_dialog.h b/code/ryzom/tools/client/client_config/base_dialog.h index c81c8a207..4082968b4 100644 --- a/code/ryzom/tools/client/client_config/base_dialog.h +++ b/code/ryzom/tools/client/client_config/base_dialog.h @@ -34,7 +34,7 @@ class CBaseDialog : public CDialog public: /// Constructor - CBaseDialog (uint id, CWnd* pParent = NULL) : CDialog(id, pParent) {}; + CBaseDialog (uint id, CWnd* pParent = NULL) : CDialog(id, pParent) {} /// On ok virtual void OnOK (); diff --git a/code/ryzom/tools/leveldesign/georges_convert/string_ex.h b/code/ryzom/tools/leveldesign/georges_convert/string_ex.h index 69489c4ac..a395e8f42 100644 --- a/code/ryzom/tools/leveldesign/georges_convert/string_ex.h +++ b/code/ryzom/tools/leveldesign/georges_convert/string_ex.h @@ -26,9 +26,9 @@ class CStringEx : public std::basic_string, std::al { public: - CStringEx() : std::basic_string, std::allocator >() {;} - CStringEx( char* _pc ) : std::basic_string, std::allocator >( (char *)_pc ) {}; - CStringEx( std::string _s ) : std::basic_string, std::allocator >( (std::string)_s) {}; + CStringEx() : std::basic_string, std::allocator >() {} + CStringEx( char* _pc ) : std::basic_string, std::allocator >( (char *)_pc ) {} + CStringEx( std::string _s ) : std::basic_string, std::allocator >( (std::string)_s) {} CStringEx( const char _c, int _i ) { append( _i, _c ); } virtual ~CStringEx(); diff --git a/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.h b/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.h index 8b61618a1..08b477e38 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.h +++ b/code/ryzom/tools/leveldesign/georges_dll/edit_list_ctrl.h @@ -84,12 +84,12 @@ public: uint Item, SubItem, ColumnCount; uint DlgIndex; - virtual TItemEdit getItemEditMode (uint item, uint subItem) {return EditFixedCombo;}; + virtual TItemEdit getItemEditMode (uint item, uint subItem) {return EditFixedCombo;} virtual void getComboBoxStrings (uint item, uint subItem, std::vector &retStrings); - virtual void getMemComboBoxProp (uint item, uint subItem, std::string ®Adr, bool &browse) { regAdr = ""; browse = false; }; - virtual void getNewItemText (uint item, uint subItem, std::string &ret) { ret = "new"; }; - virtual void getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, std::string &filter) { defExt=""; defFilename=""; filter=""; defDir="";}; - virtual void onItemChanged (uint item, uint subItem) {}; + virtual void getMemComboBoxProp (uint item, uint subItem, std::string ®Adr, bool &browse) { regAdr = ""; browse = false; } + virtual void getNewItemText (uint item, uint subItem, std::string &ret) { ret = "new"; } + virtual void getBrowseInfo (uint item, uint subItem, std::string &defExt, std::string &defFilename, std::string &defDir, std::string &filter) { defExt=""; defFilename=""; filter=""; defDir="";} + virtual void onItemChanged (uint item, uint subItem) {} void memComboBoxAsChange (bool selChange); void closeMemComboBox (bool update); diff --git a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.h b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.h index 0fe05ab8c..29e10aa00 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/form_dialog.h +++ b/code/ryzom/tools/leveldesign/georges_dll/form_dialog.h @@ -66,7 +66,7 @@ public: IFormWidget (CFormDialog *dialog, uint structId, const char *formName, TTypeSrc typeSrc, uint slot); // Destructor - virtual ~IFormWidget () {}; + virtual ~IFormWidget () {} // Update the text of the base label void updateLabel (); @@ -90,8 +90,8 @@ public: virtual bool extendableHeight () const; // Ok / cancel hit - virtual void onOk () {}; - virtual void onCancel () {}; + virtual void onOk () {} + virtual void onCancel () {} // Update widget date virtual void updateData (bool update = true) = 0; diff --git a/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.h b/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.h index 649a2927d..b6f9ef7f6 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.h +++ b/code/ryzom/tools/leveldesign/georges_dll/georges_edit_doc.h @@ -311,7 +311,7 @@ public: class CGeorgesEditDocType : public CGeorgesEditDoc { protected: // create from serialization only - CGeorgesEditDocType() {}; + CGeorgesEditDocType() {} DECLARE_DYNCREATE(CGeorgesEditDocType) // Document is a type ? @@ -341,7 +341,7 @@ protected: class CGeorgesEditDocDfn : public CGeorgesEditDoc { protected: // create from serialization only - CGeorgesEditDocDfn() {}; + CGeorgesEditDocDfn() {} DECLARE_DYNCREATE(CGeorgesEditDocDfn) // Document is a dfn ? @@ -371,7 +371,7 @@ protected: class CGeorgesEditDocForm : public CGeorgesEditDoc { protected: // create from serialization only - CGeorgesEditDocForm() {}; + CGeorgesEditDocForm() {} DECLARE_DYNCREATE(CGeorgesEditDocForm) // Docuemnt is a form ? diff --git a/code/ryzom/tools/leveldesign/georges_dll/georges_interface.h b/code/ryzom/tools/leveldesign/georges_dll/georges_interface.h index 28ab22042..fbac91024 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/georges_interface.h +++ b/code/ryzom/tools/leveldesign/georges_dll/georges_interface.h @@ -61,7 +61,7 @@ enum TUI class IGeorges { public: - virtual ~IGeorges() {}; + virtual ~IGeorges() {} // Init the UI virtual void initUI (int m_nCmdShow, bool exeStandalone, HWND parent=NULL)=0; diff --git a/code/ryzom/tools/leveldesign/georges_dll/output_console_dlg.h b/code/ryzom/tools/leveldesign/georges_dll/output_console_dlg.h index a796e7fe6..47d447c59 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/output_console_dlg.h +++ b/code/ryzom/tools/leveldesign/georges_dll/output_console_dlg.h @@ -36,8 +36,8 @@ public: void outputString (const char *message); // From CDialog - void OnOK () {}; - void OnCancel (); + void OnOK () {} + void OnCancel () // Dialog Data //{{AFX_DATA(COutputConsoleDlg) diff --git a/code/ryzom/tools/leveldesign/georges_dll/plugin_interface.h b/code/ryzom/tools/leveldesign/georges_dll/plugin_interface.h index 4908d9474..36ad36062 100644 --- a/code/ryzom/tools/leveldesign/georges_dll/plugin_interface.h +++ b/code/ryzom/tools/leveldesign/georges_dll/plugin_interface.h @@ -65,7 +65,7 @@ public: /** * Destructor must uninitialise the plugin interface */ - virtual ~IEditPlugin () {}; + virtual ~IEditPlugin () {} /// Window related @@ -157,7 +157,7 @@ public: /** * Destructor must uninitialise the plugin interface */ - virtual ~IEditDocumentPlugin () {}; + virtual ~IEditDocumentPlugin () {} /// Event message diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBase.h b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBase.h index 4cee69902..6af4bc18c 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBase.h +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBase.h @@ -62,7 +62,7 @@ public: /// The master dialog call this method when the document is changed/updated static void docChanged(); /// The docChanged static method call this method on each page. - virtual void onDocChanged() {}; + virtual void onDocChanged() {} }; diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.h b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.h index 306f39293..43a339225 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.h +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFades.h @@ -33,7 +33,7 @@ class CPageBgFades : public CPageBase // Construction public: - CPageBgFades() {}; + CPageBgFades() {} CPageBgFades(NLGEORGES::CSoundDialog *soundDialog); ~CPageBgFades(); diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.h b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.h index 6fab075c3..6e5c2488c 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.h +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageBgFlags.h @@ -46,7 +46,7 @@ class CPageBgFlags : public CPageBase // Construction public: - CPageBgFlags() {}; + CPageBgFlags() {} CPageBgFlags(NLGEORGES::CSoundDialog *soundDialog); ~CPageBgFlags(); diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComplex.h b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComplex.h index 7f9ed68ad..26ee864de 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComplex.h +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComplex.h @@ -35,7 +35,7 @@ class CPageComplex : public CPageBase // Construction public: - CPageComplex(){}; + CPageComplex(){} CPageComplex(NLGEORGES::CSoundDialog *soundDialog); ~CPageComplex(); diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.h b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.h index c34d6ef64..3c99f9089 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.h +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageComtext.h @@ -34,7 +34,7 @@ class CPageComtext : public CPageBase // Construction public: - CPageComtext(){}; + CPageComtext(){} CPageComtext(NLGEORGES::CSoundDialog *soundDialog); ~CPageComtext(); diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PagePosition.h b/code/ryzom/tools/leveldesign/georges_plugin_sound/PagePosition.h index 88f21c614..1510c2ea8 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PagePosition.h +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PagePosition.h @@ -41,7 +41,7 @@ class CPagePosition : public CPageBase // Construction public: - CPagePosition(){}; + CPagePosition(){} CPagePosition(NLGEORGES::CSoundDialog *soundDialog); ~CPagePosition(); diff --git a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageSimple.h b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageSimple.h index 8da0328dc..935f33acb 100644 --- a/code/ryzom/tools/leveldesign/georges_plugin_sound/PageSimple.h +++ b/code/ryzom/tools/leveldesign/georges_plugin_sound/PageSimple.h @@ -36,7 +36,7 @@ class CPageSimple : public CPageBase // Construction public: - CPageSimple() {}; + CPageSimple() {} CPageSimple(NLGEORGES::CSoundDialog *soundDialog); ~CPageSimple(); diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/step.h b/code/ryzom/tools/leveldesign/mission_compiler_lib/step.h index fdb1db4be..3a38f8689 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/step.h +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/step.h @@ -89,7 +89,7 @@ public: IStep(CMissionData &md, NLLIGO::IPrimitive *prim); virtual ~IStep() {} - virtual void init(CMissionData &md, NLLIGO::IPrimitive *prim) {}; + virtual void init(CMissionData &md, NLLIGO::IPrimitive *prim) {} /// Get the step name diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/action.h b/code/ryzom/tools/leveldesign/world_editor/world_editor/action.h index 511f2a16e..9145f4af4 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/action.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/action.h @@ -32,7 +32,7 @@ class IAction public: // Virtual destructor - virtual ~IAction () {}; + virtual ~IAction () {} // Do / undo virtual void undo () = 0; diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/plugin_interface.h b/code/ryzom/tools/leveldesign/world_editor/world_editor/plugin_interface.h index d2c38ca58..2bbe143c1 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/plugin_interface.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/plugin_interface.h @@ -163,7 +163,7 @@ public: /// Init the plugin. The plugin receive the world editor interface. virtual void init(IPluginAccess *pluginAccess) =0; /// Delete the plugin. - virtual ~IPluginCallback() {}; + virtual ~IPluginCallback() {} /// The current region has changed. // virtual void primRegionChanged(const std::vector ®ions) = 0; diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor_primitive_plugin/primitive_plugin.h b/code/ryzom/tools/leveldesign/world_editor/world_editor_primitive_plugin/primitive_plugin.h index 1ea94a512..7fcb78fc1 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor_primitive_plugin/primitive_plugin.h +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor_primitive_plugin/primitive_plugin.h @@ -51,9 +51,9 @@ public: CPrimitivePlugin(); - virtual void positionMoved(const NLMISC::CVector &position) {}; - virtual void lostPositionControl() {}; - virtual void onIdle() {}; + virtual void positionMoved(const NLMISC::CVector &position) {} + virtual void lostPositionControl() {} + virtual void onIdle() {} virtual void drawPrimitive(const NLLIGO::IPrimitive *primitive, const TRenderContext &renderContext); @@ -72,9 +72,9 @@ private: void serial (NLMISC::IStream &s); - static uint getVersion (); + static uint getVersion () - void removed() {}; + void removed() {} }; std::map _CreatureInfos; diff --git a/code/ryzom/tools/sheets_packer/stdpch.h b/code/ryzom/tools/sheets_packer/stdpch.h index afa7d2137..11007e314 100644 --- a/code/ryzom/tools/sheets_packer/stdpch.h +++ b/code/ryzom/tools/sheets_packer/stdpch.h @@ -36,5 +36,6 @@ #ifdef NL_OS_WINDOWS #define NOMINMAX -#include +#include +#include #endif // NL_OS_WINDOWS diff --git a/code/ryzom/tools/stats_scan/char_filter_factory.h b/code/ryzom/tools/stats_scan/char_filter_factory.h index ebfd2a964..35ee52a07 100644 --- a/code/ryzom/tools/stats_scan/char_filter_factory.h +++ b/code/ryzom/tools/stats_scan/char_filter_factory.h @@ -39,6 +39,7 @@ class CStatsScanCharacter; class ICharFilter: public NLMISC::CRefCount { public: + virtual ~ICharFilter() {} virtual std::string toString() const=0; virtual bool evaluate(const CStatsScanCharacter* c)=0; }; @@ -51,6 +52,7 @@ public: class ICharFilterBuilder: public NLMISC::CRefCount { public: + virtual ~ICharFilterBuilder() {} virtual const char* getName()=0; virtual const char* getDescription()=0; virtual ICharFilter* build(const std::string& rawArgs)=0; diff --git a/code/ryzom/tools/stats_scan/char_info_extractor_factory.h b/code/ryzom/tools/stats_scan/char_info_extractor_factory.h index 781a3d2d3..35e3e7b68 100644 --- a/code/ryzom/tools/stats_scan/char_info_extractor_factory.h +++ b/code/ryzom/tools/stats_scan/char_info_extractor_factory.h @@ -41,6 +41,7 @@ class CStatsScanCharacter; class ICharInfoExtractor: public NLMISC::CRefCount { public: + virtual ~ICharInfoExtractor() {} virtual std::string toString() const=0; virtual void execute(CCharacterScanJob* job,const CStatsScanCharacter* c)=0; }; @@ -53,6 +54,7 @@ public: class ICharInfoExtractorBuilder: public NLMISC::CRefCount { public: + virtual ~ICharInfoExtractorBuilder() {} virtual const char* getName()=0; virtual const char* getDescription()=0; virtual const char* getFields()=0; diff --git a/code/ryzom/tools/stats_scan/char_scan_script.h b/code/ryzom/tools/stats_scan/char_scan_script.h index 5f4a4d107..ac3a6780b 100644 --- a/code/ryzom/tools/stats_scan/char_scan_script.h +++ b/code/ryzom/tools/stats_scan/char_scan_script.h @@ -97,6 +97,7 @@ private: class ICharScanScriptCommand: public NLMISC::CRefCount { public: + virtual ~ICharScanScriptCommand() {} virtual const char* getName()=0; virtual const char* getSyntax()=0; virtual const char* getDescription()=0; diff --git a/code/ryzom/tools/stats_scan/job_manager.h b/code/ryzom/tools/stats_scan/job_manager.h index 136ac77be..a318cffdc 100644 --- a/code/ryzom/tools/stats_scan/job_manager.h +++ b/code/ryzom/tools/stats_scan/job_manager.h @@ -31,6 +31,9 @@ public: class IJob: public NLMISC::CRefCount { public: + // virtual dtor + virtual ~IJob() {} + // return true if the job is finished -> the job object can be deleted virtual bool finished()=0; diff --git a/code/web/api/client/auth.php b/code/web/api/client/auth.php new file mode 100644 index 000000000..f47dbd634 --- /dev/null +++ b/code/web/api/client/auth.php @@ -0,0 +1,47 @@ +. + */ + +require_once(RYAPI_PATH.'client/config.php'); + +// Og (non-ryzom.com) method +function ryzom_authenticate_with_serverkey($cid, $name, $authserver, $authkey) { +} + +// Ig method +function ryzom_authenticate_ingame($cid, $name, $authkey) { + if (isset($_SESSION['user'])) + return true; + + if (ryzom_get_param('user')) + return true; + + return false; +} + +// Session method +function ryzom_authenticate_with_session($name, $redirect) { + if (isset($_SESSION['user'])) + return true; + + if (ryzom_get_param('user')) + return true; + + return false; +} + +?> diff --git a/code/web/api/client/config.php.default b/code/web/api/client/config.php.default new file mode 100644 index 000000000..3c8ca869d --- /dev/null +++ b/code/web/api/client/config.php.default @@ -0,0 +1,20 @@ +. + */ + +// Url where player_auth.php is located +define('RYAPI_AUTH_SCRIPT', ''); diff --git a/code/web/api/client/user.php b/code/web/api/client/user.php new file mode 100644 index 000000000..b6e906b2c --- /dev/null +++ b/code/web/api/client/user.php @@ -0,0 +1,39 @@ +. + */ + +function ryzom_user_get_info($cid) { + if (isset($_SESSION['user'])) + return $_SESSION['user']; + + $user = unserialize(base64_decode(ryzom_get_param('user'))); + $_SESSION['user'] = $user; + return $user; +} + +function ryzom_get_user_id($cid, $name, $creation_date) { + if (isset($_SESSION['user'])) + return $_SESSION['user']['id']; + + $user = unserialize(base64_decode(ryzom_get_param('user'))); + $_SESSION['user'] = $user; + + return $user['id']; +} + + +?> diff --git a/code/web/api/client/utils.php b/code/web/api/client/utils.php new file mode 100644 index 000000000..62a2de0c8 --- /dev/null +++ b/code/web/api/client/utils.php @@ -0,0 +1,3 @@ + diff --git a/code/web/api/common/auth.php b/code/web/api/common/auth.php new file mode 100644 index 000000000..1d52c5d8e --- /dev/null +++ b/code/web/api/common/auth.php @@ -0,0 +1,67 @@ +The application '._t(APP_NAME).' require authentication. Please enter your credentials'; + + $c .= '
'.$welcome_message.'

'; + + if ($user['message']) + $c .= '
'._t($user['message']).'

'; + $c .= ryzom_render_login_form($name, false); + echo ryzom_app_render(_t('app_'.APP_NAME), $c); + exit; + } + return false; + } + } + + if ($lang) + $_SESSION['lang'] = $lang; + + // get user informations + $user = ryzom_user_get_info($cid); + $user['lang'] = $_SESSION['lang']; + if (isset($user['creation_date'])) + $user['id'] = ryzom_get_user_id($cid, $user['char_name'], $user['creation_date']); + if ($is_ingame && $user['last_played_date'] != '0') + $user['ig'] = true; + else + $user['ig'] = false; + unset($user['last_played_date']); + unset($user['creation_date']); + return true; +} + +?> diff --git a/code/web/api/common/config.php.default b/code/web/api/common/config.php.default new file mode 100644 index 000000000..3a00bb04e --- /dev/null +++ b/code/web/api/common/config.php.default @@ -0,0 +1,28 @@ +. + */ + +// Url where the api is +define('RYAPI_URL', 'http://'); +if (!defined('RYAPI_PATH')) + define('RYAPI_PATH', dirname(__FILE__).'/'); +// used by "home" link +if (!defined('RYAPP_URL')) + define('RYAPP_URL', 'http://'); + +?> diff --git a/code/web/api/common/db_lib.php b/code/web/api/common/db_lib.php new file mode 100644 index 000000000..c3c7e8677 --- /dev/null +++ b/code/web/api/common/db_lib.php @@ -0,0 +1,422 @@ +. + */ + +define('SQL_DEF_TEXT', 0); +define('SQL_DEF_BOOLEAN', 1); +define('SQL_DEF_INT', 2); +define('SQL_DEF_DATE', 3); + + +// Wrapper for SQL database interactions +class ServerDatabase +{ + var $hostname = ''; + var $username = ''; + var $password = ''; + var $database = ''; + + var $_connection = Null; + + function ServerDatabase($host='', $user='', $passwd='', $dbname='') + { + if (($host != '') && ($user != '') && ($dbname != '')) + { + $this->hostname = $host; + $this->username = $user; + $this->password = $passwd; + $this->database = $dbname; + } + + if (($this->hostname != '') && ($this->username != '') && ($this->database != '')) + { + $this->_connection = mysql_connect($this->hostname, $this->username, $this->password) + or die("ERR1"); // ace . $this->get_error()); + $this->select_db($this->database); + } + } + + function close() + { + @mysql_close($this->_connection); + } + + function query($sql_statement) + { + $result = mysql_query($sql_statement, $this->_connection); + return $result; + } + + function select_db($dbname) { + $this->database = $dbname; + mysql_select_db($this->database, $this->_connection) or die("Database selection error : " . $this->get_error()); + } + + function num_rows($result) + { + return @mysql_num_rows($result); + } + + function fetch_row($result, $result_type=MYSQL_BOTH) + { + return @mysql_fetch_array($result, $result_type); + } + + function fetch_assoc($result) + { + return @mysql_fetch_array($result, MYSQL_ASSOC); + } + + + function query_single_row($sql_statement) + { + $result = $this->query($sql_statement); + return @mysql_fetch_array($result); + } + + function free_result($result) + { + @mysql_free_result($result); + } + + function get_error() + { + return mysql_errno($this->_connection) .": ". mysql_error($this->_connection); + } + + function last_insert_id() + { + return @mysql_insert_id(); + } + + function change_to($host,$user,$pass,$dbname) + { + $this->close(); + $this->hostname = $host; + $this->username = $user; + $this->password = $pass; + $this->database = $dbname; + $this->ServerDatabase(); + } +} + + + + +class ryDB { + + private static $_instances = array(); + private $db; + private $defs = array(); + private $errors = ''; + + + private function __construct($db_name) { + global $_RYZOM_API_CONFIG; + + $this->db = new ServerDatabase(RYAPI_WEBDB_HOST, RYAPI_WEBDB_LOGIN, RYAPI_WEBDB_PASS, $db_name); + $this->db->query("SET NAMES utf8"); + } + + public static function getInstance($db_name) { + if (!array_key_exists($db_name, self::$_instances)) + self::$_instances[$db_name] = new ryDB($db_name); + + self::$_instances[$db_name]->db->select_db($db_name); + return self::$_instances[$db_name]; + } + + function setDbDefs($table, $defs) { + $this->defs[$table] = $defs; + } + + function getDefs($table) { + if (!array_key_exists($table, $this->defs)) + die("Please add tables defs using setDbDefs('$table', \$defs)"); + return $this->defs[$table]; + } + + function getErrors() { + return $this->db->get_error(); + } + + function now() { + return date('Y-m-d H:i:s', time()); + } + + function toDate($timestamp) { + return date('Y-m-d H:i:s', $timestamp); + } + + function fromDate($string_date) { + return strtotime($string_date); + } + + function addDbTableProp($table, $props) { + $this->props[$table] = $props; + } + + /// DIRECT QUERY + function sqlQuery($sql) { + $result = $this->db->query($sql); + $ret = array(); + while ($row = $this->db->fetch_row($result)) { + $ret[] = $row; + } + return $ret; + } + + + /// QUERY /// + function sqlSelect($table, $props, $values=array(), $extra='') { + if ($table) { + $sql = "SELECT\n\t"; + $params = array(); + $test = array(); + if (!$props) + die("Bad Select on [$table] : missing props"); + + foreach($props as $name => $type) + $params[] = '`'.addslashes($name).'`'; + + foreach($values as $name => $value) { + if ($name[0] == '=') + $test[] = '('.addslashes(substr($name, 1)).' LIKE '.var_export($value, true).')'; + else + $test[] = '('.addslashes($name).' = '.var_export($value, true).')'; + } + $sql .= implode(",\n\t", $params)."\nFROM\n\t".$table."\n"; + if ($test) + $sql .= "WHERE\n\t".implode("\nAND\n\t", $test); + } + + if ($extra) + $sql .= "\n".$extra; + return $sql.';'; + + } + + function querySingle($table, $values=array(), $extra='') { + $sql = $this->sqlSelect($table, $this->getDefs($table), $values, $extra); + $result = $this->db->query($sql); + return $this->db->fetch_row($result); + } + + function querySingleAssoc($table, $values=array(), $extra='') { + $sql = $this->sqlSelect($table, $this->getDefs($table), $values, $extra); + $result = $this->db->query($sql); + return $this->db->fetch_row($result, MYSQL_ASSOC); + } + + function query($table, $values=array(), $extra='') { + $sql = $this->sqlSelect($table, $this->getDefs($table), $values, $extra); + $result = $this->db->query($sql); + $ret = array(); + while ($row = $this->db->fetch_row($result)) { + $ret[] = $row; + } + return $ret; + } + + function queryAssoc($table, $values=array(), $extra='') { + $sql = $this->sqlSelect($table, $this->getDefs($table), $values, $extra); + $result = $this->db->query($sql); + $ret = array(); + while ($row = $this->db->fetch_row($result, MYSQL_ASSOC)) { + $ret[] = $row; + } + return $ret; + } + + /// INSERT /// + function sqlInsert($table, $props, $vals) { + $sql = 'INSERT INTO '.$table.' '; + $params = array(); + $values = array(); + foreach($props as $name => $type) { + if (!isset($vals[$name])) + continue; + $params[] = $name; + switch ($type) { + case SQL_DEF_BOOLEAN: + $values[] = $vals[$name]?1:0; + break; + case SQL_DEF_INT: + $values[] = $vals[$name]; + break; + case SQL_DEF_DATE: // date + if (is_string($vals[$name])) + $values[] = "'".addslashes($vals[$name])."'"; + else + $values[] = "'".$this->toDate($vals[$name])."'"; + break; + default: + $values[] = "'".addslashes($vals[$name])."'"; + break; + } + } + $sql .= "(\n\t".implode(",\n\t", $params)."\n) VALUES (\n\t".implode(",\n\t", $values)."\n);"; + return $sql; + } + + function insert($table, $values) { + $sql = $this->sqlInsert($table, $this->getDefs($table), $values); + $this->db->query($sql); + return $this->db->last_insert_id(); + } + + /// DELETE /// + function sqlDelete($table, $values=array(), $where='') { + $sql = "DELETE FROM\n\t".$table."\n"; + $test = array(); + foreach($values as $name => $value) + $test[] = '('.addslashes($name).' = '.var_export($value, true).')'; + + if ($test or $where) + $sql .= "WHERE\n\t"; + if ($test) + $sql .= implode("\nAND\n\t", $test); + if ($where) + $sql .= "\n".$where; + return $sql.';'; + } + + function delete($table, $values=array(), $where='') { + $sql = $this->sqlDelete($table, $values, $where); + $result = $this->db->query($sql); + return $result; + } + + /// UPDATE /// + function sqlUpdate($table, $props, $vals, $tests, $extra) { + $sql = 'UPDATE '.$table.' SET '; + $params = array(); + $test = array(); + $values = array(); + foreach($props as $name => $type) { + if (!array_key_exists($name, $vals)) + continue; + switch ($type) { + case SQL_DEF_BOOLEAN: + $values[] = '`'.$name.'` = '.($vals[$name]?'1':'0'); + break; + case SQL_DEF_DATE: + if (is_string($vals[$name])) + $values[] = '`'.$name.'` = \''.addslashes($vals[$name]).'\''; + else + $values[] = '`'.$name.'` = \''.$this->toDate($vals[$name]).'\''; + break; + default: + $values[] = '`'.$name.'` = \''.addslashes($vals[$name]).'\''; + break; + } + } + $sql .= "\n\t".implode(",\n\t", $values)."\n"; + + foreach($tests as $name => $value) { + $test[] = '('.addslashes($name).' = '.var_export($value, true).')'; + } + if ($test) + $sql .= "WHERE\n\t".implode("\nAND\n\t", $test); + + $sql .= "\n".$extra; + + return $sql; + } + + + function update($table, $values=array(), $test=array(), $extra='') { + $sql = $this->sqlUpdate($table, $this->getDefs($table), $values, $test, $extra); + $result = $this->db->query($sql); + return $result; + } + + function sqlInsertOrUpdate($table, $props, $vals) { + $sql = $this->sqlInsert($table, $props, $vals); + $sql = substr($sql, 0, strlen($sql)-1); + $params = array(); + $test = array(); + $values = array(); + foreach($props as $prop) { + if (!array_key_exists($prop[2], $vals)) + continue; + $type = $prop[0]; + $check = $prop[1]; + $name = $prop[2]; + if ($type{0} == '#') + $type = substr($type, 1); + if (($type{0} == '>') or ($type == 'id')) + continue; + switch ($type) { + case 'trad': + $values[] = '`'.$name."` = '".addslashes($vals[$name])."'"; + break; + case 'textarea': + case 'string': + case 'option': + $values[] = '`'.$name."` = '".addslashes($vals[$name])."'"; + break; + case 'id': + case 'int': + case 'float': + $values[] = '`'.$name.'` = '.addslashes($vals[$name]); + break; + case 'bool': + $values[] = '`'.$name.'` = '.($vals[$name]?'1':'0'); + break; + } + } + $sql .= "\nON DUPLICATE KEY UPDATE\n\t".implode(",\n\t", $values)."\n"; + return $sql; + } + + function insertOrUpdate($table, $values) { + $sql = $this->sqlInsertOrUpdate($table, $this->getDefs($table), $values); + return $result; + } + + + /// Display + function getTableHtml($name, $params, $values, $order_by='') + { + $ret = ''; + $tr_header = ''; + $ret .= _s('t header', $tr_header); + $i = 0; + if (!$values) + return ''; + $current_section = ''; + foreach ($values as $rows) { + if ($order_by && $rows[$order_by] != $current_section) { + $current_section = $rows[$order_by]; + if ($current_section != '0') + $ret .= _s('t row ', ''.str_repeat('', count($params)-1)); + } + $td = ''; + foreach ($params as $test => $param) + $td .= ''; + $ret .= _s('t row '.strval($i % 2), $td); + $i++; + } + $ret .= '
 '; + $tr_header .= implode(' ', array_keys($params)).''._s('section', $current_section).''._s('section', ' ').' '.$rows[$param].'
'; + return $ret; + } + +} + +?> diff --git a/code/web/api/common/logger.php b/code/web/api/common/logger.php new file mode 100644 index 000000000..1e5106b54 --- /dev/null +++ b/code/web/api/common/logger.php @@ -0,0 +1,43 @@ +log_indent += $indent; + if ($log) { + $tabs = str_repeat(" ", $this->log_indent); + $a = $tabs.str_replace("\n", "\n ".$tabs, $log); + $this->logs[] = ''.$a.''; + } + } + + function addPrint($log, $color='#FFFF00') { + $this->logs[] = ''.$log.''; + } + + function addError($log) { + $this->logs[] = ' ERROR: '.$log.''; + } + + function getLogs() { + $ret = ''; + if ($this->logs && $this->enable) + $ret = "Debug\n\n".implode("\n", $this->logs); + $this->logs = array(); + return $ret; + } +} + + +?> diff --git a/code/web/api/common/render.php b/code/web/api/common/render.php new file mode 100644 index 000000000..60b101d38 --- /dev/null +++ b/code/web/api/common/render.php @@ -0,0 +1,215 @@ +. + */ + +function ryzom_app_render($title, $content, $ig=false, $bgcolor='', $javascript=array(), $homeLink=false) { + $c = ''; + // Render header + $title_prefix = ''; + if (ON_IPHONE) { + $title_prefix = 'Ryzom - '; + } + + if (!$bgcolor) + $bgcolor = '#000000'.($ig?'00':''); + + if (!$ig) { + $c .= ''."\n"; + $c .= ' + '."\n"; + $c .= ' '.$title_prefix.(translation_exists($title)?_t($title):$title).''."\n"; + $c .= ' '."\n"; + $c .= ryzom_render_header(); + $c .= ryzom_render_header_www(); + $events = ON_IPHONE ? 'onorientationchange="updateOrientation();" ' : ''; + $c .= ' '."\n"; + $c .= ' '."\n"; + // Javascript + $js_code = ''; + foreach ($javascript as $js) + $js_code .= ''; + $c .= $js_code; + + $c .= ryzom_render_www(ryzom_render_window($title, $content, $homeLink)); + $c .= ''; + } else { + $c .= ''; + $c .= $content; + $debug = ryLogger::getInstance()->getLogs(); + if ($debug) + $c .= '
'.$debug.'
'; + $c .= ''; + } + return $c; +} + +function ryzom_render_header() { + if (ON_IPHONE) { + return ''; + } else { + return ' '; + } +} + +// Call this inside the part if you want to use ryzom_render_www +function ryzom_render_header_www() { + if (ON_IPHONE) { + return ' + + + + + '; + } else { + return ' + +'; + } +} + +// Render a Ryzom style window +function ryzom_render_window($title, $content, $homeLink=false) { + return ryzom_render_window_begin($title, $homeLink) . $content . ryzom_render_window_end(); +} + +function ryzom_render_window_begin($title, $homeLink=false) { + + if ($homeLink === false) + $homeLink = ''._t('home').''; + + return ' +
+
+
'.(translation_exists($title)?_t($title):$title).$homeLink.'
+
+
+
+
+'; +} + +function ryzom_render_window_end() { + return '
+
'.ryLogger::getInstance()->getLogs().'
+

powered by ryzom-api

+
+ '; +} + +// Render a webpage using www.ryzom.com style +function ryzom_render_www($content) { + return ryzom_render_www_begin() . $content . ryzom_render_www_end(); +} + +function ryzom_render_www_begin($url='') { + $style1 = 'position: relative; padding-top: 20px; padding-right: 30px; margin-bottom: -3px'; + $style2 = 'position: absolute; bottom: 0; right: 0; '; + if (ON_IPHONE) { + $style1 = 'position: relative; padding-top: 30px; padding-right: 30px; '; + $style2 = 'position: fixed; top: 0; right: 0; padding-right: 0px;'; + $marginBottom = ''; + } + if (!$url) { + $url_params = parse_query($_SERVER['REQUEST_URI']); + unset($url_params['lang']); + + $url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.http_build_query($url_params); + } + return ' +
+
+
+ English + French + German + Russian +
+ +
+
+'; +} + +function ryzom_render_www_end() { + return '
'; +} + +function ryzom_render_login_form($char, $aligned=true) { + $c = ''; + if ($aligned) { + $c .= '
'; + $c .= ''; + $c .= ''; + $c .= ''; + $c .= ''; + $c .= ''; + } else { + $c .= '
'._t('enter_char').'
'._t('enter_password').'
'; + $c .= ''; + $c .= ''; + $c .= ''; + $c .= ''; + $c .= ''; + } + $c .= '
'._t('login').'
'._t('password').'
'; + return $c; +} + +?> diff --git a/code/web/api/common/user.php b/code/web/api/common/user.php new file mode 100644 index 000000000..62a2de0c8 --- /dev/null +++ b/code/web/api/common/user.php @@ -0,0 +1,3 @@ + diff --git a/code/web/api/common/utils.php b/code/web/api/common/utils.php new file mode 100644 index 000000000..9f12fdfc1 --- /dev/null +++ b/code/web/api/common/utils.php @@ -0,0 +1,182 @@ + $v) { + if (is_int($k) && $prefix != null) { + $k = urlencode($prefix . $k); + } + if ((!empty($key)) || ($key === 0)) $k = $key.'['.urlencode($k).']'; + if (is_array($v) || is_object($v)) { + array_push($ret, http_build_query($v, '', $sep, $k)); + } else { + array_push($ret, $k.'='.urlencode($v)); + } + } + if (empty($sep)) $sep = ini_get('arg_separator.output'); + return implode($sep, $ret); + } +} + + +/*** + * + * Translation utilities + * + * ***/ + +function translation_exists($id) { + global $user, $ryzom_texts; + return isset($ryzom_texts[$id]) && isset($ryzom_texts[$id][$user['lang']]); +} + +// Translate the $id in the selected language +function get_translation($id, $lang, $args=array()) { + global $ryzom_texts, $user; + if(!isset($ryzom_texts[$id])) return '{'.$id.'}'; + if(!isset($ryzom_texts[$id][$lang])) return '{'.$id.'['.$lang.']}'; + if($ryzom_texts[$id][$lang] == '' && isset($ryzom_texts[$id]['en'])) return @vsprintf($ryzom_texts[$id]['en'], $args); + return @vsprintf($ryzom_texts[$id][$lang], $args); +} + + +// Translate the $id in the user language +function _t($id, $args=array()) { + global $ryzom_texts, $user; + + $a = ''; + if ($args) { + if (is_array($args)) { + $a = array(); + foreach ($args as $arg) + $a[] = strval($arg); + $a = ' '.implode(', ', $a); + } else + $a = ' '.strval($args); + } + if(!isset($ryzom_texts[$id])) return '{'.$id.$a.'}'; + if(!isset($ryzom_texts[$id][$user['lang']])) return '{'.$id.'['.$user['lang'].']'.$a.'}'; + if($ryzom_texts[$id][$user['lang']] == '' && isset($ryzom_texts[$id]['en']) && $ryzom_texts[$id]['en'] != '') return @vsprintf($ryzom_texts[$id]['en'], $args); + if($ryzom_texts[$id][$user['lang']] == '' && isset($ryzom_texts[$id]['fr']) && $ryzom_texts[$id]['fr'] != '') return '{'.$id.$a.'}'; + if($ryzom_texts[$id][$user['lang']] == '' && isset($ryzom_texts[$id]['de']) && $ryzom_texts[$id]['de'] != '') return '{'.$id.$a.'}'; + return @vsprintf($ryzom_texts[$id][$user['lang']], $args); +} + +/*** + * + * Ryzom time + * + * ***/ + + + +// Get a human and translated readable time, for example "3 days ago" +function ryzom_relative_time($timestamp) { + global $ryzom_periods, $user; + $difference = time() - $timestamp; + $lengths = array("60","60","24","7","4.35","12","10"); + + if ($difference >= 0) { // this was in the past + $ending = _t('ago'); + } else { // this was in the future + $difference = -$difference; + $ending = _t('to_go'); + } + for($j = 0,$m=count($lengths); $j<$m && $difference >= $lengths[$j]; $j++) + $difference /= $lengths[$j]; + // round hours as '1.2 hours to go' + $difference = round($difference, ($j == 2) ? 1 : 0); + + $form = ($difference == 1) ? 'singular' : 'plural'; + + // Handle exceptions + // French uses singular form if difference = 0 + if ($user['lang'] == 'fr' && ($difference == 0)) { + $form = 'singular'; + } + // Russian has a different plural form for plurals of 2 through 4 + if ($user['lang'] == 'ru' && ($form == 'plural')) { + if ($difference < 5) { + $form = '2-4'; + } + } + + $final = $ryzom_periods[$user['lang']][$form][$j]; + $text = _t('date_format', array($difference, $final, $ending)); + return $text; +} + +// Get a human and translated absolute date +function ryzom_absolute_time($timestamp) { + global $user, $ryzom_daysofweek, $ryzom_monthnames; + $day_of_month = date("j", $timestamp); + $dow = date("w", $timestamp); + $month = date("n", $timestamp); + $day_of_week = $ryzom_daysofweek[$user['lang']][$dow]; + $month_str = $ryzom_monthnames[$user['lang']][$month-1]; + $text = _t("absolute_date_format", array($day_of_month, $day_of_week, $month_str, $month, date("m", $timestamp), date("d", $timestamp))); + return $text; +} + +/*** + * + * Debug tools + * + * ***/ + +function p($var, $value=NULL) { + ob_start(); + debug_print_backtrace(); + $bt = ob_get_contents(); + ob_end_clean(); + $bt = explode("\n",$bt); + $bt = explode('[', $bt[1]); + ob_start(); + echo ''.substr($bt[count($bt)-1], 0, -1)."\n"; + if ($value !== NULL) { + echo ''.$var.' : '; + $var = $value; + } + //if (is_array($var)) + echo '
';
+	print_r($var);
+	echo '
'; +// else + // var_dump($var); + ryLogger::getInstance()->addPrint(ob_get_contents()); + ob_end_clean(); +} + +?> diff --git a/code/web/api/data/css/ryzom_iphone.css b/code/web/api/data/css/ryzom_iphone.css new file mode 100644 index 000000000..c837ffbf4 --- /dev/null +++ b/code/web/api/data/css/ryzom_iphone.css @@ -0,0 +1,248 @@ +/* Copyright (C) 2009 Winch Gate Property Limited + * + * This file is part of ryzom_api. + * ryzom_api is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ryzom_api 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with ryzom_api. If not, see . + */ + +html, body, form, fieldset, p, div, h1, h2, h3, h4, h5, h6 { + margin:0; + padding:0; + -webkit-text-size-adjust: none; +} + +body { + font-size: 14px; + background: black; + font-family: Helvetica; +} + +ul li { + padding: 0px 4px 10px 2px; + list-style: circle outside; +} +ol li { + padding: 0px 4px 10px 2px; +} +.ryzom-ui p { + padding-bottom:8px; +} + +#main { + clear: both; + padding-top: 0px; + overflow:auto; + margin-left:auto; + margin-right:auto; + text-align:left +} +.error { + padding:.5em; + background:#ff5555; + color:white; + font-weight:bold +} +/*----------------------------- + ORIENTATION +-----------------------------*/ + +.content_wide, +.content_normal { + display:none; +} + +.show_normal { + width: 320px; +} + +.show_wide { + width: 480px; +} + +.show_wide .content_wide, +.show_normal .content_normal { + display: block; +} + +/* ---------------------- */ + + +.ryzom-ui { + color: white; +} +.ryzom-ui input, .ryzom-ui select { + border-top: 1px solid #030403; + border-right: 1px solid #6e7f57; + border-bottom: 1px solid #889e6c; + border-left: 1px solid #272d1f; + background-color: #37402b; + color: #ddd; + font-size: 16px; + margin: 2px 0 5px 0; +} +.ryzom-ui input[type=text] { + width: 96%; +} + +.ryzom-ui textarea { + width: 96%; + background-color: black; + color: white; + font-size: 16px; + font-family: Helvetica; +} +/* input[type=submit] will make IE6 to ignore whole CSS rule, so cant combine this with .ryzom-ui-button below */ +input[type=submit] { + border-bottom: 1px solid #030403; + border-left: 1px solid #6e7f57; + border-top: 1px solid #889e6c; + border-right: 1px solid #272d1f; + background-color: #435120; +} +input.ryzom-ui-button, .ryzom-ui-button { + border-bottom: 1px solid #030403; + border-left: 1px solid #6e7f57; + border-top: 1px solid #889e6c; + border-right: 1px solid #272d1f; + background-color: #435120; +} + +a, a:visited {color:orange} + +a:hover {color:orange} + +a.ryzom-ui-button, a.ryzom-ui-button:visited { + color: white; + padding: 0 .5em; + text-decoration: none; +} +a.ryzom-ui-button:hover { + background: #536130; + color: #ddd; +} +/* window without title - just borders */ +.ryzom-ui-tl { +} +.ryzom-ui-tr { +} +.ryzom-ui-t { + background-image: url(skin_t.gif); + background-repeat: repeat-x; + background-position: left top; + height: 8px; + margin: 0; +} +/* window with proper header */ +.ryzom-ui-header .ryzom-ui-tl { + margin: 0px 0px; + height: 32px; +} +.ryzom-ui-header .ryzom-ui-tr { + height: 32px; +} +.ryzom-ui-header .ryzom-ui-t { + background-image: url(skin_header_m.gif); + background-repeat: repeat-x; + background-position: left top; + padding: 7px 0 0 12px; + height: 32px; + text-transform: uppercase; + color: white; + border-top: 1px solid #030403; +} +/* window body */ +.ryzom-ui-l { +} +.ryzom-ui-r { +} +.ryzom-ui-m { + margin: 0 0px; + padding: 0px; + background-image: url(skin_blank.png); + background-repeat: repeat; +} +.ryzom-ui-body { + background-image: url(skin_blank_inner.png); + background-repeat: repeat; + /* leave 5px room after bottom border */ + margin: 0 8px 5px 2px; + padding: 5px 5px 5px 5px; + border-top: 1px solid #030403; + border-right: 1px solid #6e7f57; + border-bottom: 1px solid #889e6c; + border-left: 1px solid #272d1f; +} +/* window bottom border */ +.ryzom-ui-bl { + height: 8px; +} +.ryzom-ui-br { + height: 8px; +} +.ryzom-ui-b { + height: 8px; + margin: 0 8px; +} +.ryzom-ui-notice { + margin: 0px; + padding: 0px; + color: #999; + text-align: center; +} +a.ryzom-ui-notice, a.ryzom-ui-notice:visited { + margin: 0px; + padding: 0px; + color: #BBB; + padding: 0 .5em; + text-decoration: underline; +} +a.ryzom-ui-notice:hover { + color: gray; +} + +.ryzom-ui-t .ryzom-ui-text-button { + font-size: 85%; +} +a.ryzom-ui-text-button, a:visited.ryzom-ui-text-button { + color:#FFFF11; + text-decoration:none; +} + +.ryzom-ui-text-button { + border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; +} +.ryzom-ui-text-button { + padding: 0;margin: 0; + border-color: #ff8 #ff3 #ff3 #ff8; + border-width: 1px; + border-style: solid; + padding: 0px 4px; + color: white; +} + +.ryzom-ui-wrap-ul { + float: left; + text-align: center; + padding: 0; + list-style: none; +} + +.ryzom-ui-wrap-li { + float: left; + margin: 0 0 10px 5px; + width: 6.1em; + list-style: none; + height: 70px; +} diff --git a/code/web/api/data/css/ryzom_ui.css b/code/web/api/data/css/ryzom_ui.css new file mode 100644 index 000000000..8342b77f8 --- /dev/null +++ b/code/web/api/data/css/ryzom_ui.css @@ -0,0 +1,227 @@ +/* Copyright (C) 2009 Winch Gate Property Limited + * + * This file is part of ryzom_api. + * ryzom_api is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * ryzom_api 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with ryzom_api. If not, see . + */ + +/* + * Check ryzom_api/functions_render.php for easy php function to render ryzom layout or use this following html: + * +
+
+
+
+
+
+
+
+
+ */ + +.ryzom-ui { + color: white; +} +.ryzom-ui input, .ryzom-ui select { + border-top: 1px solid #030403; + border-right: 1px solid #6e7f57; + border-bottom: 1px solid #889e6c; + border-left: 1px solid #272d1f; + background-color: #37402b; + color: #ddd; + font-size: 12px; + margin: 2px 0 5px 0; +} +.ryzom-ui input[type=text] { + width: 100%; +} + +.ryzom-ui textarea { + width: 98%; +} + +/* input[type=submit] will make IE6 to ignore whole CSS rule, so cant combine this with .ryzom-ui-button below */ +input[type=submit] { + border-bottom: 1px solid #030403; + border-left: 1px solid #6e7f57; + border-top: 1px solid #889e6c; + border-right: 1px solid #272d1f; + background-color: #435120; +} +input.ryzom-ui-button, .ryzom-ui-button { + border-bottom: 1px solid #030403; + border-left: 1px solid #6e7f57; + border-top: 1px solid #889e6c; + border-right: 1px solid #272d1f; + background-color: #435120; +} +a.ryzom-ui-button, a.ryzom-ui-button:visited { + color: white; + padding: 0 .5em; + text-decoration: none; +} +a.ryzom-ui-button:hover { + background: #536130; + color: #ddd; +} +/* window without title - just borders */ +.ryzom-ui-tl { + background-image: url(skin_tl.gif); + background-repeat: no-repeat; + background-position: left top; + width: 100%; height: 8px; +} +.ryzom-ui-tr { + background-image: url(skin_tr.gif); + background-repeat: no-repeat; + background-position: right top; + height: 8px; +} +.ryzom-ui-t { + background-image: url(skin_t.gif); + background-repeat: repeat-x; + background-position: left top; + height: 8px; + margin: 0 8px; +} +/* window with proper header */ +.ryzom-ui-header .ryzom-ui-tl { + margin: 0px 0px; + background-image: url(skin_header_l.gif); + background-repeat: no-repeat; + background-position: left top; + height: 32px; +} +.ryzom-ui-header .ryzom-ui-tr { + background-image: url(skin_header_r.gif); + background-repeat: no-repeat; + background-position: right top; + height: 32px; +} +.ryzom-ui-header .ryzom-ui-t { + background-image: url(skin_header_m.gif); + background-repeat: repeat-x; + background-position: left top; + margin-left: 12px; + margin-right: 26px; + padding-top: 9px; + height: 32px; + text-transform: uppercase; + color: white; +} +/* window body */ +.ryzom-ui-l { + background-image: url(skin_l.gif); + background-position: left top; + background-repeat: repeat-y; + width: 100%; +} +.ryzom-ui-r { + background-image: url(skin_r.gif); + background-position: right top; + background-repeat: repeat-y; + width: 100%; +} +.ryzom-ui-m { + margin: 0 8px; + padding: 8px; + background-image: url(skin_blank.png); + background-repeat: repeat; +} +.ryzom-ui-body { + background-image: url(skin_blank_inner.png); + background-repeat: repeat; + /* leave 5px room after bottom border */ + margin: 0px 0 5px 0; + padding: 10px 10px 5px 10px; + border-top: 1px solid #030403; + border-right: 1px solid #6e7f57; + border-bottom: 1px solid #889e6c; + border-left: 1px solid #272d1f; +} +/* window bottom border */ +.ryzom-ui-bl { + background-image: url(skin_bl.gif); + background-repeat: no-repeat; + background-position: left top; + height: 8px; +} +.ryzom-ui-br { + background-image: url(skin_br.gif); + background-repeat: no-repeat; + background-position: right top; + height: 8px; +} +.ryzom-ui-b { + background-image: url(skin_b.gif); + background-repeat: repeat-x; + background-position: left top; + height: 8px; + margin: 0 8px; +} +.ryzom-ui-notice { + margin: 0px; + padding: 0px; + color: #333; + text-align: center; +} +a.ryzom-ui-notice, a.ryzom-ui-notice:visited { + margin: 0px; + padding: 0px; + color: #555; + padding: 0 .5em; + text-decoration: underline; +} +a.ryzom-ui-notice:hover { + color: gray; +} + +.ryzom-ui-t .ryzom-ui-text-button { + font-size: 85%; +} +a.ryzom-ui-text-button, a:visited.ryzom-ui-text-button { + color:#FFFF11; + text-decoration:none; +} + +.ryzom-ui-text-button { + border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; +} +.ryzom-ui-text-button { + padding: 0;margin: 0; + border-color: #ff8 #ff3 #ff3 #ff8; + border-width: 1px; + border-style: solid; + padding: 0px 4px; + color: white; +} + +.ryzom-ui-wrap-ul { + float: left; + text-align: center; + padding: 0; + list-style: none; + margin-top: -5px; + margin-bottom: -20px; +} + +.ryzom-ui-wrap-li { + float: left; + margin: 0 5px 10px 5px; + width: 6.1em; + padding: 0; + list-style: none; + height: 70px; +} diff --git a/code/web/api/data/css/skin_b.gif b/code/web/api/data/css/skin_b.gif new file mode 100644 index 000000000..a1a0390bc Binary files /dev/null and b/code/web/api/data/css/skin_b.gif differ diff --git a/code/web/api/data/css/skin_bl.gif b/code/web/api/data/css/skin_bl.gif new file mode 100644 index 000000000..459dc0065 Binary files /dev/null and b/code/web/api/data/css/skin_bl.gif differ diff --git a/code/web/api/data/css/skin_blank.png b/code/web/api/data/css/skin_blank.png new file mode 100644 index 000000000..0fefeaab0 Binary files /dev/null and b/code/web/api/data/css/skin_blank.png differ diff --git a/code/web/api/data/css/skin_blank_inner.png b/code/web/api/data/css/skin_blank_inner.png new file mode 100644 index 000000000..b728324ef Binary files /dev/null and b/code/web/api/data/css/skin_blank_inner.png differ diff --git a/code/web/api/data/css/skin_br.gif b/code/web/api/data/css/skin_br.gif new file mode 100644 index 000000000..3a01335f8 Binary files /dev/null and b/code/web/api/data/css/skin_br.gif differ diff --git a/code/web/api/data/css/skin_header_l.gif b/code/web/api/data/css/skin_header_l.gif new file mode 100644 index 000000000..288016a1d Binary files /dev/null and b/code/web/api/data/css/skin_header_l.gif differ diff --git a/code/web/api/data/css/skin_header_m.gif b/code/web/api/data/css/skin_header_m.gif new file mode 100644 index 000000000..48d539173 Binary files /dev/null and b/code/web/api/data/css/skin_header_m.gif differ diff --git a/code/web/api/data/css/skin_header_r.gif b/code/web/api/data/css/skin_header_r.gif new file mode 100644 index 000000000..c8711c2f5 Binary files /dev/null and b/code/web/api/data/css/skin_header_r.gif differ diff --git a/code/web/api/data/css/skin_l.gif b/code/web/api/data/css/skin_l.gif new file mode 100644 index 000000000..4ca369db5 Binary files /dev/null and b/code/web/api/data/css/skin_l.gif differ diff --git a/code/web/api/data/css/skin_r.gif b/code/web/api/data/css/skin_r.gif new file mode 100644 index 000000000..3c821e89e Binary files /dev/null and b/code/web/api/data/css/skin_r.gif differ diff --git a/code/web/api/data/css/skin_t.gif b/code/web/api/data/css/skin_t.gif new file mode 100644 index 000000000..aefc8416b Binary files /dev/null and b/code/web/api/data/css/skin_t.gif differ diff --git a/code/web/api/data/css/skin_tl.gif b/code/web/api/data/css/skin_tl.gif new file mode 100644 index 000000000..7dd640272 Binary files /dev/null and b/code/web/api/data/css/skin_tl.gif differ diff --git a/code/web/api/data/css/skin_tr.gif b/code/web/api/data/css/skin_tr.gif new file mode 100644 index 000000000..7543d7221 Binary files /dev/null and b/code/web/api/data/css/skin_tr.gif differ diff --git a/code/web/api/data/img/bg.jpg b/code/web/api/data/img/bg.jpg new file mode 100644 index 000000000..7d07d98c7 Binary files /dev/null and b/code/web/api/data/img/bg.jpg differ diff --git a/code/web/api/data/img/lang/de.png b/code/web/api/data/img/lang/de.png new file mode 100644 index 000000000..767abe088 Binary files /dev/null and b/code/web/api/data/img/lang/de.png differ diff --git a/code/web/api/data/img/lang/en.png b/code/web/api/data/img/lang/en.png new file mode 100644 index 000000000..2673310cc Binary files /dev/null and b/code/web/api/data/img/lang/en.png differ diff --git a/code/web/api/data/img/lang/fr.png b/code/web/api/data/img/lang/fr.png new file mode 100644 index 000000000..420474693 Binary files /dev/null and b/code/web/api/data/img/lang/fr.png differ diff --git a/code/web/api/data/img/lang/ru.png b/code/web/api/data/img/lang/ru.png new file mode 100644 index 000000000..53aaf57be Binary files /dev/null and b/code/web/api/data/img/lang/ru.png differ diff --git a/code/web/api/data/img/lang/sp.png b/code/web/api/data/img/lang/sp.png new file mode 100644 index 000000000..5ef5123ba Binary files /dev/null and b/code/web/api/data/img/lang/sp.png differ diff --git a/code/web/api/data/img/logo.gif b/code/web/api/data/img/logo.gif new file mode 100644 index 000000000..adc59fd29 Binary files /dev/null and b/code/web/api/data/img/logo.gif differ diff --git a/code/web/api/index.php b/code/web/api/index.php new file mode 100644 index 000000000..70e3eb1d2 --- /dev/null +++ b/code/web/api/index.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/code/web/api/player_auth.php b/code/web/api/player_auth.php new file mode 100644 index 000000000..984a96fe7 --- /dev/null +++ b/code/web/api/player_auth.php @@ -0,0 +1,44 @@ +. + */ + +require_once('ryzom_api.php'); +$cid = ryzom_get_param('cid'); +$name = ryzom_get_param('name'); +$authserver = ryzom_get_param('authserver'); +$authkey = ryzom_get_param('authkey'); + +if ($authserver) { + if (ryzom_authenticate_with_serverkey($cid, $name, $authserver, $authkey)) + die('1'); + die('0'); +} + +if (RYZOM_IG || ryzom_get_param('ig')) { + echo 'ig'; + if (ryzom_authenticate_ingame($cid, $name, $authkey)) { + echo 'ok'; + $user_infos = ryzom_user_get_info($cid); + echo ryzom_get_user_id($cid, $name, $user_infos['creation_date']); + die('1'); + } + die('0'); +} else { + echo ryzom_authenticate_with_session($name, $cid, $_RYZOM_API_CONFIG['base_url'].'index.php'); +} + +?> diff --git a/code/web/api/ryzom_api.php b/code/web/api/ryzom_api.php new file mode 100644 index 000000000..5cd9a7ba8 --- /dev/null +++ b/code/web/api/ryzom_api.php @@ -0,0 +1,43 @@ +. + */ + +session_start(); + +// Global defines +if (!defined('ON_IPHONE')) { + if(isset($_SERVER['HTTP_USER_AGENT'])) + define('ON_IPHONE', strpos($_SERVER['HTTP_USER_AGENT'], 'Ryzom')); + else + define('ON_IPHONE', false); +} + +$includes = array('auth', 'config', 'utils', 'user'); + +foreach ($includes as $include) { + if ($_SERVER['HTTP_HOST'] == 'shard.nuneo.org' || $_SERVER['HTTP_HOST'] == 'app.ryzom.com') + require_once("server/$include.php"); + else + require_once("client/$include.php"); + + require_once("common/$include.php"); +} + +require_once("common/db_lib.php"); +require_once("common/render.php"); + +?> diff --git a/code/web/api/server/auth.php b/code/web/api/server/auth.php new file mode 100644 index 000000000..2e2b3ca1c --- /dev/null +++ b/code/web/api/server/auth.php @@ -0,0 +1,118 @@ +. + */ + +function ryzom_authenticate_with_serverkey($cid, $name, $authserver, $authkey) { + $rawkey = RYAPI_COOKIE_KEY.$name.$cid.$authserver; + $authkey = md5($rawkey); + if ($authkey != $authkey) return false; + return true; +} + +function ryzom_authenticate_ingame($shardid, $cid, $name, $authkey) { + $db = new ServerDatabase(RYAPI_NELDB_HOST, RYAPI_NELDB_LOGIN, RYAPI_NELDB_PASS, RYAPI_NELDB_RING); + $uid = intval($cid / 16); + $sql = "SELECT cookie FROM ring_users WHERE user_id = $uid"; + $row = $db->query_single_row($sql); + + $rawkey = $shardid.$name.$cid.'\''.trim($row['cookie']).'\''; + $md5rawkey = md5($rawkey); + return $authkey == $md5rawkey; +} + +// take the character name and the account password and check if it's valid +function ryzom_authenticate_with_char_and_password($character, $password, &$cid) { + $db = new ServerDatabase(RYAPI_NELDB_HOST, RYAPI_NELDB_LOGIN, RYAPI_NELDB_PASS, RYAPI_NELDB_RING); + $char = mysql_real_escape_string($character, $db->_connection); + $sql = "SELECT char_id, char_name, user_id, home_mainland_session_id FROM characters WHERE char_name = '$char'"; + $row = $db->query_single_row($sql); + $character = $row['char_name']; + $cid = $row['char_id']; + $uid = $row['user_id']; + mysql_select_db('nel', $db->_connection); + $sql = "SELECT Password FROM user WHERE UId = $uid"; + $row = $db->query_single_row($sql); + $ok = $row['Password'] == crypt($password, $row['Password']); + return $ok; +} + +function ryzom_authenticate_with_session(&$name, &$cid, &$error_message) { + $c = ''; + + $action = ryzom_get_param('action'); + if ($action == 'logout') { + unset($_SESSION['name']); + unset($_SESSION['cid']); + } + + if (isset($_SESSION['name']) && ($name == '' || $_SESSION['name'] == $name)) { + $name = $_SESSION['cid']; + $cid = $_SESSION['cid']; + return true; + } + + $char = ryzom_get_param('char'); + $password = ryzom_get_param('password'); + + if ($char && $password) { + // check credentials + if (ryzom_authenticate_with_char_and_password($char, $password, $cid)) { + $_SESSION['name'] = $char; + $_SESSION['cid'] = $cid; + return true; + } else { + $error_message = 'bad_auth'; + } + } + + return false; +} + + + +function ryzom_get_user_id($cid, $name, $creation_date) { + $name = strtolower($name); + + $db = ryDB::getInstance('webig'); + $db->setDbDefs('players', array('id' => SQL_DEF_INT, 'cid' => SQL_DEF_INT, 'name' => SQL_DEF_TEXT, 'creation_date' => SQL_DEF_DATE, 'deleted' => SQL_DEF_BOOLEAN)); + + $charProps = $db->querySingle('players', array('cid' => intval($cid), 'deleted' => 0)); + // new char => create record + if (!$charProps) { + $charProps = array('name' => $name, 'cid' => $cid, 'creation_date' => $creation_date, 'deleted' => 0); + $charProps['id'] = $db->insert('players', $charProps); + if (!$charProps['id']) + die('ryDb New Char Error'); + } else { + // char renamed => update record + if ($charProps['name'] != $name) + if (!$db->update('players', array('name' => $name), array('id' => $charProps['id']))) + die('ryDb Rename Char Error'); + + // char deleted and recreated => change to deleted + if ($charProps['creation_date'] != $creation_date) { + if (!$db->update('players', array('deleted' => 1), array('id' => $charProps['id']))) + die('ryDb Delete char Error: '.$db->getErrors()); + $charProps = array('name' => $name, 'cid' => $cid, 'creation_date' => $creation_date, 'deleted' => 0); + if (!$charProps['id'] = $db->insert('players', $charProps)) + die('ryDb New Char in Slot Error'); + } + } + return $charProps['id']; +} + +?> diff --git a/code/web/api/server/config.php.default b/code/web/api/server/config.php.default new file mode 100644 index 000000000..d145da877 --- /dev/null +++ b/code/web/api/server/config.php.default @@ -0,0 +1,33 @@ +. + */ + +define('RYAPI_SHARDID', '101'); +define('RYAPI_WEBDB_HOST', 'localhost'); +define('RYAPI_WEBDB_LOGIN', 'localhost'); +define('RYAPI_WEBDB_PASS', 'localhost'); + +define('RYAPI_NELDB_HOST', 'localhost'); +define('RYAPI_NELDB_LOGIN', 'shard'); +define('RYAPI_NELDB_PASS', 'localhost'); +define('RYAPI_NELDB_RING', 'ring_open'); +define('RYAPI_NELDB_NEL', 'nel'); + +define('RYAPI_AUTH_SCRIPT', ''); +define('RYAPI_COOKIE_KEY', ''); + +?> diff --git a/code/web/api/server/user.php b/code/web/api/server/user.php new file mode 100644 index 000000000..9124191ae --- /dev/null +++ b/code/web/api/server/user.php @@ -0,0 +1,111 @@ +. + */ + +function ryzom_user_get_info($cid) { + // User information + global $_RYZOM_API_CONFIG; + $db = new ServerDatabase(RYAPI_NELDB_HOST, RYAPI_NELDB_LOGIN, RYAPI_NELDB_PASS, RYAPI_NELDB_RING); + $sql = "SELECT char_name, race, civilisation, cult, guild_id, creation_date, last_played_date FROM characters WHERE char_id = $cid"; + $result = $db->query($sql) or die('Could not query on ryzom_user_get_info'); + $found = $db->num_rows($result) >= 1; + if (!$found) + die('Could not found on ryzom_user_get_info'); + $row = $db->fetch_assoc($result); + $db->free_result($result); + if ($row) { + $row['race'] = substr($row['race'], 2); + $row['cult'] = substr($row['cult'], 2); + $row['civ'] = substr($row['civilisation'], 2); + if ($row['guild_id'] != '0') { + //$xml = @simplexml_load_file(ryzom_guild($row['guild_id'], false)); + $xml = false; + if ($xml !== false) { + $row['guild_icon'] = (string)$xml->icon; + $row['guild_name'] = (string)$xml->name; + $result = $xml->xpath("/guild/members/member[cid=$cid]"); + while(list( , $item) = each($result)) + $row['grade'] = (string)$item->grade; + } else { + $row['guild_name'] = 'UNKNOWN_GUILD_'.$row['guild_id']; // Unknow name (normal in yubo shard) + } + } + } + + $uid = intval($cid / 16); + $db = new ServerDatabase(RYAPI_NELDB_HOST, RYAPI_NELDB_LOGIN, RYAPI_NELDB_PASS, RYAPI_NELDB_NEL); + $sql = "SELECT Privilege FROM user WHERE UId = $uid"; + $result = $db->query($sql) or die("Could not query."); + $priv_row = $db->fetch_row($result, MYSQL_NUM); + $priv = $priv_row[0]; + $db->free_result($result); + $groups = array(); + + if (strpos($priv, ':DEV:') !== false) { + $groups[] = 'DEV'; + $groups[] = 'SGM'; + $groups[] = 'GM'; + $groups[] = 'EM'; + $groups[] = 'EG'; + $groups[] = 'VG'; + $groups[] = 'G'; + } + + if (strpos($priv, ':SGM:') !== false) { + $groups[] = 'SGM'; + $groups[] = 'GM'; + $groups[] = 'VG'; + $groups[] = 'G'; + } + + if (strpos($priv, ':GM:') !== false) { + $groups[] = 'GM'; + $groups[] = 'VG'; + $groups[] = 'G'; + } + + if (strpos($priv, ':VG:') !== false) { + $groups[] = 'VG'; + $groups[] = 'G'; + } + + if (strpos($priv, ':G:') !== false) { + $groups[] = 'G'; + } + + if (strpos($priv, ':SEM:') !== false) { + $groups[] = 'SEM'; + $groups[] = 'EM'; + $groups[] = 'EG'; + } + + if (strpos($priv, ':EM:') !== false) { + $groups[] = 'EM'; + $groups[] = 'EG'; + } + + if (strpos($priv, ':EG:') !== false) { + $groups[] = 'EG'; + } + + $groups[] = 'PLAYER'; + $row['groups'] = $groups; + + return $row; +} + +?> diff --git a/code/web/api/server/utils.php b/code/web/api/server/utils.php new file mode 100644 index 000000000..49860d24e --- /dev/null +++ b/code/web/api/server/utils.php @@ -0,0 +1,49 @@ +. + */ + + +function ryzom_name_to_file($name) +{ + $r = ''; + for ($i=0; $i= chr(127)) + $r .= sprintf("%%%02x", ord($name[$i])); + else + $r .= $name[$i]; + } + return $r; +} + +// ------------------------------------- +// get user home directory +// ------------------------------------- +function ryzom_get_user_dir($user) +{ + global $_RYZOM_API_CONFIG; + + if ($user == "") + die("INTERNAL ERROR CODE 1"); + + $user = ryzom_name_to_file($user); + return $_RYZOM_API_CONFIG['cookie_path'].'/'.$_RYZOM_API_CONFIG['shardid'].'/'.substr(strtolower($user), 0, 2).'/'.strtolower($user).'/'; +} + +?> diff --git a/code/web/app/app_test/favicon.png b/code/web/app/app_test/favicon.png new file mode 100644 index 000000000..623a56663 Binary files /dev/null and b/code/web/app/app_test/favicon.png differ diff --git a/code/web/app/app_test/index.php b/code/web/app/app_test/index.php new file mode 100644 index 000000000..ad5408e22 --- /dev/null +++ b/code/web/app/app_test/index.php @@ -0,0 +1,34 @@ +enable = true; + +// Debug log +p($user); + +// Update user acces on Db +$db = ryDB::getInstance(APP_NAME); +$db->setDbDefs('test', array('id' => SQL_DEF_INT, 'num_access' => SQL_DEF_INT)); + +$num_access = $db->querySingleAssoc('test', array('id' => $user['id'])); +if ($num_access) + $db->update('test', array('num_access' => ++$num_access['num_access']), array('id' => $user['id'])); +else + $db->insert('test', array('num_access' => $num_access['num_access']=1, 'id' => $user['id'])); + +// Content +$c = _t('access', $num_access['num_access']).'
'; + +echo ryzom_app_render(APP_NAME, $c, $user['ig']); + +?> diff --git a/code/web/app/app_test/lang.php b/code/web/app/app_test/lang.php new file mode 100644 index 000000000..0a877c548 --- /dev/null +++ b/code/web/app/app_test/lang.php @@ -0,0 +1,15 @@ + + array ( + 'en' => 'User access this page %s times', + 'fr' => 'L\'utilisateur a accede a cette page %s fois', + 'de' => '', + 'ru' => '', + ), +); +if(isset($ryzom_texts)) + $ryzom_texts = array_merge ($__texts, $ryzom_texts); +else + $ryzom_texts = $__texts; +?> \ No newline at end of file diff --git a/code/web/app/config.php.default b/code/web/app/config.php.default new file mode 100644 index 000000000..0ecb2c302 --- /dev/null +++ b/code/web/app/config.php.default @@ -0,0 +1,26 @@ +. + */ + +define('RYAPP_URL', 'http://'); +define('RYAPP_PATH', dirname(__FILE__).'/'); +define('RYAPI_PATH', dirname(__FILE__).'/../api/'); + +include_once(RYAPI_PATH.'ryzom_api.php'); + +?> diff --git a/code/web/app/index.php b/code/web/app/index.php new file mode 100644 index 000000000..86223a42f --- /dev/null +++ b/code/web/app/index.php @@ -0,0 +1,36 @@ +'._t('welcome', $user['char_name']).''; +} else { + if (!$user['ig']) { + if ($user['message']) + $c .= '
'._t($user['message']).'

'; + $c .= ryzom_render_login_form(ryzom_get_param('name')); + } +} + +foreach ($apps as $app) { + $c .= ''._t($app).'
'; +} + +if ($logged && !$user['ig']) + $c .= '
'._t('logout').''; + +// Print GET values on debug view +p($_GET); +echo ryzom_app_render('Ryzom', $c, $user['ig']); + +?> \ No newline at end of file diff --git a/code/web/app/lang.php b/code/web/app/lang.php new file mode 100644 index 000000000..4780fcd00 --- /dev/null +++ b/code/web/app/lang.php @@ -0,0 +1,371 @@ + + array ( + 'en' => 'Welcome %s', + 'fr' => 'Bienvenue %s', + 'de' => 'Willkommen %s', + 'ru' => 'Добро пожаловать %s', + ), + 'latest_news_rp' => + array ( + 'en' => 'Latest RP news', + 'fr' => 'Dernières nouvelles RP', + 'de' => 'Letzte RP-Nachrichten', + 'ru' => 'Ролевые новости', + ), + 'latest_news_off' => + array ( + 'en' => 'Latest Ryzom news', + 'fr' => 'Dernières nouvelles de Ryzom', + 'de' => 'Letzte Ryzom-Nachrichten', + 'ru' => 'Последние новости Ризома', + ), + 'avail_apps' => + array ( + 'en' => 'Available applications', + 'fr' => 'Applications disponibles', + 'de' => 'Verfügbare Anwendungen', + 'ru' => 'Доступные приложения', + ), + 'home' => + array ( + 'en' => 'Home', + 'fr' => 'Accueil', + 'de' => 'Home', + 'ru' => 'К началу', + ), + 'logout' => + array ( + 'en' => 'Log out', + 'fr' => 'se déconnecter', + 'de' => 'Ausloggen', + 'ru' => 'Выйти', + ), + 'by' => + array ( + 'en' => 'by', + 'fr' => 'par', + 'de' => 'von', + 'ru' => 'сообщение', + ), + 'date_format' => + array ( + 'en' => '%1$s %2$s %3$s', + 'fr' => '%3$s %1$s %2$s', + 'de' => '%3$s %1$s %2$s', + 'ru' => '%1$s %2$s %3$s', + ), + 'ago' => + array ( + 'en' => 'ago', + 'fr' => 'il y a', + 'de' => 'Vor', + 'ru' => 'назад', + ), + 'to_go' => + array ( + 'en' => 'to go', + 'fr' => 'dans', + 'de' => 'In', + 'ru' => 'осталось', + ), + 'posted' => + array ( + 'en' => 'Posted', + 'fr' => 'Posté', + 'de' => 'Geschrieben', + 'ru' => 'Отправлено', + ), + 'error_auth' => + array ( + 'en' => 'Please press the Refresh button to display the homepage.', + 'fr' => 'Cliquez sur le bouton Rafraichir pour afficher la page d\'accueil.', + 'de' => 'Um auf die Hauptseite zu gelangen drücke bitte auf Aktualisieren.', + 'ru' => 'Для отображения домашней страницы нажмите кнопку "Обновить"', + ), + 'submit' => + array ( + 'en' => 'Submit', + 'fr' => 'Envoyer', + 'de' => 'Absenden', + 'ru' => 'Отправить', + ), + 'enter_key' => + array ( + 'en' => 'Please enter the full character API Key that you can find on your profile page', + 'fr' => 'Entrez la clé d\'API complète de votre personnage que vous trouverez sur votre page de profil', + 'de' => 'Gib bitte den lompletten Charakter-API-Schlüssel ein, diesen findest du auf deiner Profilseite', + 'ru' => 'Пожалуйста, введите полный API Ключ, который вы можете получить по адресу your profile page', + ), + 'enter_shard' => + array ( + 'en' => 'Select the server of your character', + 'fr' => 'Sélectionnez le serveur où se trouve votre personnage', + 'de' => 'Wähle den Server deines Charakters aus', + 'ru' => 'Выбрать сервер', + ), + 'enter_char' => + array ( + 'en' => 'Enter your CHARACTER name (*not* your account name)', + 'fr' => 'Saisissez le nom de votre PERSONNAGE (pas votre nom de compte)', + 'de' => 'Gib den Namen deines CHARAKTERS ein (*nicht* deinen Account-Namen)', + 'ru' => 'Введите имя ПЕРСОНАЖА (*не* имя пользователя)', + ), + 'enter_password' => + array ( + 'en' => 'Enter the password of your ACCOUNT', + 'fr' => 'Saisissez le mot de passe de votre COMPTE', + 'de' => 'Gib das Passwort deines ACCOUNTS ein', + 'ru' => 'Введите пароль своей УЧЕТНОЙ ЗАПИСИ', + ), + 'bad_login_password' => + array ( + 'en' => 'Cannot login. Perhaps you entered a bad password or you didn\'t use your CHARACTER name.', + 'fr' => 'Connexion impossible. Peut-être avez vous saisi un mauvais mot de passe ou vous n\'avez pas utilisé le nom de votre PERSONNAGE.', + 'de' => 'Login fehlgeschlagen. Vielleicht hast du ein falsches Passwort eingegeben oder du hast nicht deinen CHARAKTER-Namen verwendet.', + 'ru' => 'Невозможно подключиться. Возможно, вы использовали неверный пароль или имя ПЕРСОНАЖА.', + ), + 'app_notes' => + array ( + 'en' => 'Notepad', + 'fr' => 'Bloc Note', + 'de' => 'Notizblock', + 'ru' => 'Блокнот', + ), + 'app_news' => + array ( + 'en' => 'News', + 'fr' => 'Nouvelles', + 'de' => 'News', + 'ru' => 'Новости', + ), + 'app_mail' => + array ( + 'en' => 'Mail', + 'fr' => 'Courrier', + 'de' => 'Mail', + 'ru' => 'Почта', + ), + 'app_patch' => + array ( + 'en' => 'Atysmas', + 'fr' => 'Noel', + 'de' => 'Weihnachten', + 'ru' => 'Christmas', + ), + 'app_wiki' => + array ( + 'en' => 'Atys Wiki', + 'fr' => 'Lore & Chroniques', + 'de' => 'Atys Wiki', + 'ru' => 'Wiki Атиса', + ), + 'app_bots' => + array ( + 'en' => 'Bots', + 'fr' => 'Bots', + 'de' => 'Bots', + 'ru' => 'Боты', + ), + 'app_test' => + array ( + 'en' => 'Test Application', + 'fr' => 'Application de test', + 'de' => '', + 'ru' => '', + ), + 'app_forum' => + array ( + 'en' => 'Forums', + 'fr' => 'Forums', + 'de' => 'Foren', + 'ru' => 'Форумы', + ), + 'app_translate' => + array ( + 'en' => 'Translate', + 'fr' => 'Traduction', + 'de' => 'Übersetzen', + 'ru' => 'Перевод', + ), + 'app_race' => + array ( + 'en' => 'Race', + 'fr' => 'Course', + 'de' => 'Rennen', + 'ru' => 'Гонка', + ), + 'app_poll' => + array ( + 'en' => 'Polls', + 'fr' => 'Sondages', + 'de' => 'Polls', + 'ru' => 'Голосование', + ), + 'app_zapping' => + array ( + 'en' => 'Atysmas', + 'fr' => 'Atysmas', + 'de' => 'Atysmas', + 'ru' => 'Атисмас', + ), + 'latest_blog' => + array ( + 'en' => 'Latest news from the dev blog', + 'fr' => 'Dernières nouvelles du blog des dév', + 'de' => 'Aktuelles aus dem Dev-Blog', + 'ru' => 'Последние новости Дневника разработчиков', + ), + 'app_profile' => + array ( + 'en' => 'Profile', + 'fr' => 'Profil', + 'de' => 'Profile', + 'ru' => 'Личные данные', + ), + 'next_events' => + array ( + 'en' => 'Next events', + 'fr' => 'Prochains événements', + 'de' => 'Nächste Events', + 'ru' => 'Ближайшие события', + ), + 'absolute_date_format' => + array ( + 'en' => '%2$s, %1$s %3$s', + 'fr' => '%2$s %1$s %3$s', + 'de' => '%2$s %1$s %3$s', + 'ru' => '%2$s, %1$s %3$s', + ), + 'app_craft' => + array ( + 'en' => 'Craft: Recipe-Book', + 'fr' => 'Craft : Livre de recettes', + 'de' => 'Craft: Recipe-Book', + 'ru' => 'Ремесло: чертежи', + ), + 'app_ryzhome' => + array ( + 'en' => 'RyzHome', + 'fr' => 'Mon appart', + 'de' => 'Meine Wohnung', + 'ru' => 'Мой Дом', + ), + 'app_event' => + array ( + 'en' => 'Event Pad', + 'fr' => 'Pad Event', + 'de' => 'Event-Pad', + 'ru' => 'События', + ), + 'app_calendar' => + array ( + 'en' => 'Calendar', + 'fr' => 'Calendrier', + 'de' => 'Kalender', + 'ru' => 'Календарь', + ), + 'app_contest' => + array ( + 'en' => 'Contest', + 'fr' => 'Concours', + 'de' => 'Contest', + 'ru' => 'конкурс', + ), + 'app_rpjobs_v2' => + array ( + 'en' => 'Occupations', + 'fr' => 'Métiers', + 'de' => 'Berufe', + 'ru' => 'Занятия', + ), + 'app_rewards' => + array ( + 'en' => 'Rewards', + 'fr' => 'Récompenses', + 'de' => 'Belohnungen', + 'ru' => 'Награды', + ), + 'admin_apps' => + array ( + 'en' => 'Ryzom Team Apps', + 'fr' => 'Applications Pour L\'équipe Ryzom', + 'de' => 'Ryzom Team Apps', + 'ru' => 'Ryzom Team Apps', + ), + 'dev_apps' => + array ( + 'en' => 'Devs Apps (don\'t use!)', + 'fr' => 'Applications Devs (Ne pas utiliser !)', + 'de' => 'Devs Apps (don\'t use!)', + 'ru' => 'Devs Apps (don\'t use!)', + ), + 'app_admin' => + array ( + 'en' => 'Administration', + 'fr' => 'Administration', + 'de' => '{app_admin}', + 'ru' => '{app_admin}', + ), + 'testing_apps' => + array ( + 'en' => 'Testing Apps (don\'t use without permission)', + 'fr' => 'Applications en test (N\'utilisez que si vous y êtes invité)', + 'de' => 'Testing Apps (don\'t use without permission)', + 'ru' => 'Testing Apps (don\'t use without permission)', + ), + 'app_arcc' => + array ( + 'en' => 'A.R.C.C.', + 'fr' => 'A.R.C.C.', + 'de' => 'A.R.C.C.', + 'ru' => 'A.R.C.C.', + ), + 'link_to_forum' => + array ( + 'en' => 'Show details in forum', + 'fr' => 'Voir détails sur le forum', + 'de' => 'Zeige Details im Forum', + 'ru' => '', + ), + 'aura_and_powers_reseted' => + array ( + 'en' => 'Your auras and powers have been reset. They can be reset again in 2 hours.', + 'fr' => 'Vos auras et pouvoirs ont été remis à zéro. Prochaine remise à zéro dans 2h.', + 'de' => 'Deine Auren und Kräfte wurden zurückgesetzt. Sie können erst in 2 Stunden erneut zurückgesetzt werden.', + 'ru' => '', + ), + 'pvp_reseted' => + array ( + 'en' => 'Your PvP timers have been reset. ', + 'fr' => 'Votre tag pvp à été remis à zéro.', + 'de' => 'Deine PvP-Timer wurden zurückgesetzt.', + 'ru' => '', + ), + 'temporary_fixes' => + array ( + 'en' => 'Temporary Fixes', + 'fr' => 'Correctifs temporaires', + 'de' => 'Temporäre Fixes', + 'ru' => '', + ), + 'aura_and_powers_wait' => + array ( + 'en' => 'Please wait %d min for next reset', + 'fr' => 'Merci d\'attendre %d minutes avant une nouvelle remise à zéro', + 'de' => 'Please wait %d min for next reset', + 'ru' => '', + ), + 'app_power_reset' => + array ( + 'en' => 'Reset of Aura and Powers', + 'fr' => 'Reset des Auras et Pouvoirs', + 'de' => 'Auren und Kräfte zurücksetzen', + 'ru' => '', + ), +); +if(isset($ryzom_texts)) + $ryzom_texts = array_merge ($__texts, $ryzom_texts); +else + $ryzom_texts = $__texts;