Merge default.

--HG--
branch : gsoc2012-gui-editor
This commit is contained in:
dfighter1985 2014-04-19 21:53:29 +02:00
commit 41f44b2aa6
4450 changed files with 216519 additions and 245222 deletions

3
.hgeol
View file

@ -1,6 +1,9 @@
[patterns]
**.h = native
**.cpp = native
**/database.xml = BIN
**/msg.xml = BIN
**.txt = native
**.xml = native

View file

@ -146,6 +146,10 @@ external_stlport
.svn
thumbs.db
Thumbs.db
*.tpl.php
.SyncID
.SyncIgnore
.SyncArchive
# build
code/nel/build/*
@ -156,6 +160,7 @@ code/build/*
code/build-2010/*
build/*
install/*
code/nel/tools/build_gamedata/configuration/buildsite.py
# Linux nel compile
code/nel/build/nel-config
@ -198,6 +203,16 @@ code/nel/tools/pacs/build_rbank/build_rbank
code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/skills.skill_tree
code/ryzom/common/data_leveldesign/leveldesign/game_element/xp_table/xptable.xp_table
code/ryzom/tools/server/sql/ryzom_admin_default_data.sql
code/ryzom/tools/server/ryzom_ams/drupal
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/autoload
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/configs
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/cron
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/img
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/plugins
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/smarty
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/translations
code/ryzom/tools/server/ryzom_ams/drupal_module/ryzommanage/ams_lib/libinclude.php
code/ryzom/tools/server/ryzom_ams/www/html/templates_c
# Linux server compile
code/ryzom/server/src/entities_game_service/entities_game_service
@ -209,5 +224,24 @@ code/ryzom/server/src/ryzom_admin_service/ryzom_admin_service
code/ryzom/server/src/ryzom_naming_service/ryzom_naming_service
code/ryzom/server/src/ryzom_welcome_service/ryzom_welcome_service
code/ryzom/server/src/tick_service/tick_service
# WebTT temp dir
# WebTT temp dir
code/ryzom/tools/server/www/webtt/app/tmp
code\ryzom\tools\server\ryzom_ams\old
# AMS ignore
code/ryzom/tools/server/ryzom_ams/www/config.php
code/ryzom/tools/server/ryzom_ams/www/is_installed
#tools and external dir's
external
external_stlport
nel_tools*
ryzom_tools*
#Dumps
*.dmp
code/nel/tools/build_gamedata/processes/ai_wmap/ai_build_wmap.cfg
code/nel/tools/build_gamedata/processes/sheets/sheets_packer.cfg
code/nel/tools/build_gamedata/processes/rbank/build_rbank.cfg
code/nel/tools/build_gamedata/processes/zone/debug_zone_dependencies.cfg

View file

@ -3,3 +3,10 @@ a409552f83cb55a5c20f867fd7bcae1d0083d01a ryzomcore_0_8_0
0000000000000000000000000000000000000000 ryzomcore_0_8_0
0000000000000000000000000000000000000000 ryzomcore_0_8_0
4eddbaff0c5e5d685db96ee3e8427aa0fd96ac83 ryzomcore_0_8_0
2e439cca8c3746df8ea64e1aab2d4d2ab9ca95d8 latest-default-graft
2e439cca8c3746df8ea64e1aab2d4d2ab9ca95d8 latest-default-graft
e4680cd1f1ce24747c4db73eeb4b107f6f6c45d4 latest-default-graft
e4680cd1f1ce24747c4db73eeb4b107f6f6c45d4 latest-default-graft
8162b598e9e233ce0886d3b8b41151f12a7bff01 latest-default-graft
8162b598e9e233ce0886d3b8b41151f12a7bff01 latest-default-graft
5f0b297fb908985504cef899469bfca9a9f9816c latest-default-graft

View file

@ -41,10 +41,8 @@ INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
# Force out of source builds.
CHECK_OUT_OF_SOURCE()
# Specify Mac OS X deployment target before including Darwin.cmake
IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6")
ENDIF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
# To be able to specify a different deployment target on Mac OS X :
# export MACOSX_DEPLOYMENT_TARGET=10.6
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(RyzomCore CXX C)
@ -106,14 +104,16 @@ IF(WIN32)
ENDIF(WITH_MFC)
ENDIF(WIN32)
FIND_PACKAGE(Threads REQUIRED)
FIND_PACKAGE(LibXml2 REQUIRED)
FIND_PACKAGE(PNG REQUIRED)
FIND_PACKAGE(Jpeg)
IF(WITH_STATIC_LIBXML2)
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
ENDIF(WITH_STATIC_LIBXML2)
IF(WITH_STATIC)
# libxml2 could need winsock2 library
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
# on Mac OS X libxml2 requires iconv and liblzma
@ -132,7 +132,7 @@ IF(FINAL_VERSION)
ENDIF(FINAL_VERSION)
IF(WITH_QT)
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml REQUIRED)
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
ENDIF(WITH_QT)
IF(WITH_NEL)
@ -142,6 +142,31 @@ IF(WITH_NEL)
IF(WITH_GUI)
FIND_PACKAGE(Libwww REQUIRED)
FIND_PACKAGE(Luabind REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
IF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
SET(CURL_STATIC ON)
ENDIF(WIN32 OR CURL_LIBRARIES MATCHES "\\.a")
IF(CURL_STATIC)
SET(CURL_DEFINITIONS -DCURL_STATICLIB)
FIND_PACKAGE(OpenSSL QUIET)
IF(OPENSSL_FOUND)
SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR})
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES})
ENDIF(OPENSSL_FOUND)
# CURL Macports version depends on libidn, libintl and libiconv too
IF(APPLE)
FIND_LIBRARY(IDN_LIBRARY idn)
FIND_LIBRARY(INTL_LIBRARY intl)
SET(CURL_LIBRARIES ${CURL_LIBRARIES} ${IDN_LIBRARY} ${INTL_LIBRARY})
ENDIF(APPLE)
ENDIF(CURL_STATIC)
ENDIF(WITH_GUI)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include ${LIBXML2_INCLUDE_DIR})

View file

@ -0,0 +1,149 @@
IF(DEFINED CMAKE_CROSSCOMPILING)
# subsequent toolchain loading is not really needed
RETURN()
ENDIF()
# Standard settings
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Linux version
SET(UNIX ON)
SET(LINUX ON)
SET(ANDROID ON)
IF(NOT NDK_ROOT)
SET(NDK_ROOT $ENV{NDK_ROOT})
IF(CMAKE_HOST_WIN32)
FILE(TO_CMAKE_PATH ${NDK_ROOT} NDK_ROOT)
ENDIF(CMAKE_HOST_WIN32)
ENDIF(NOT NDK_ROOT)
IF(NOT TARGET_CPU)
SET(TARGET_CPU "armv7")
ENDIF(NOT TARGET_CPU)
IF(TARGET_CPU STREQUAL "armv7")
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
SET(TOOLCHAIN_ARCH "arm")
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "armv5")
SET(LIBRARY_ARCHITECTURE "armeabi")
SET(CMAKE_SYSTEM_PROCESSOR "armv5")
SET(TOOLCHAIN_ARCH "arm")
SET(TOOLCHAIN_PREFIX "arm-linux-androideabi")
SET(TOOLCHAIN_BIN_PREFIX "arm")
SET(MINIMUM_NDK_TARGET 4)
ELSEIF(TARGET_CPU STREQUAL "x86")
SET(LIBRARY_ARCHITECTURE "x86")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
SET(TOOLCHAIN_ARCH "x86")
SET(TOOLCHAIN_PREFIX "x86")
SET(TOOLCHAIN_BIN_PREFIX "i686")
SET(MINIMUM_NDK_TARGET 9)
ELSEIF(TARGET_CPU STREQUAL "mips")
SET(LIBRARY_ARCHITECTURE "mips")
SET(CMAKE_SYSTEM_PROCESSOR "mips")
SET(TOOLCHAIN_ARCH "mips")
SET(TOOLCHAIN_PREFIX "mipsel-linux-android")
SET(TOOLCHAIN_BIN_PREFIX "mipsel")
SET(MINIMUM_NDK_TARGET 9)
ENDIF(TARGET_CPU STREQUAL "armv7")
IF(NOT NDK_TARGET)
SET(NDK_TARGET ${MINIMUM_NDK_TARGET})
ENDIF(NOT NDK_TARGET)
FILE(GLOB _TOOLCHAIN_VERSIONS "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-*")
IF(_TOOLCHAIN_VERSIONS)
LIST(SORT _TOOLCHAIN_VERSIONS)
LIST(REVERSE _TOOLCHAIN_VERSIONS)
FOREACH(_TOOLCHAIN_VERSION ${_TOOLCHAIN_VERSIONS})
STRING(REGEX REPLACE ".+${TOOLCHAIN_PREFIX}-([0-9.]+)" "\\1" _TOOLCHAIN_VERSION "${_TOOLCHAIN_VERSION}")
IF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
LIST(APPEND NDK_TOOLCHAIN_VERSIONS ${_TOOLCHAIN_VERSION})
ENDIF(_TOOLCHAIN_VERSION MATCHES "^([0-9.]+)$")
ENDFOREACH(_TOOLCHAIN_VERSION)
ENDIF(_TOOLCHAIN_VERSIONS)
IF(NOT NDK_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF(NOT NDK_TOOLCHAIN_VERSIONS)
IF(NDK_TOOLCHAIN_VERSION)
LIST(FIND NDK_TOOLCHAIN_VERSIONS "${NDK_TOOLCHAIN_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
ENDIF(_INDEX EQUAL -1)
ELSE(NDK_TOOLCHAIN_VERSION)
LIST(GET NDK_TOOLCHAIN_VERSIONS 0 NDK_TOOLCHAIN_VERSION)
ENDIF(NDK_TOOLCHAIN_VERSION)
MESSAGE(STATUS "Target Android NDK ${NDK_TARGET} and use GCC ${NDK_TOOLCHAIN_VERSION}")
IF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_HOST "windows")
SET(TOOLCHAIN_BIN_SUFFIX ".exe")
ELSEIF(CMAKE_HOST_APPLE)
SET(TOOLCHAIN_HOST "apple")
SET(TOOLCHAIN_BIN_SUFFIX "")
ELSEIF(CMAKE_HOST_UNIX)
SET(TOOLCHAIN_HOST "linux")
SET(TOOLCHAIN_BIN_SUFFIX "")
ENDIF(CMAKE_HOST_WIN32)
SET(TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${TOOLCHAIN_PREFIX}-${NDK_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
SET(PLATFORM_ROOT "${NDK_ROOT}/platforms/android-${NDK_TARGET}/arch-${TOOLCHAIN_ARCH}")
IF(NOT EXISTS "${TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${TOOLCHAIN_ROOT}*")
IF(_TOOLCHAIN_PREFIXES)
LIST(GET _TOOLCHAIN_PREFIXES 0 TOOLCHAIN_ROOT)
ENDIF(_TOOLCHAIN_PREFIXES)
ENDIF(NOT EXISTS "${TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android toolchain in ${TOOLCHAIN_ROOT}")
MESSAGE(STATUS "Found Android platform in ${PLATFORM_ROOT}")
# include dirs
SET(PLATFORM_INCLUDE_DIR "${PLATFORM_ROOT}/usr/include")
SET(STL_DIR "${NDK_ROOT}/sources/cxx-stl/gnu-libstdc++")
IF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
# NDK version >= 8b
SET(STL_DIR "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
ENDIF(EXISTS "${STL_DIR}/${NDK_TOOLCHAIN_VERSION}")
# Determine bin prefix for toolchain
FILE(GLOB _TOOLCHAIN_BIN_PREFIXES "${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-*-gcc${TOOLCHAIN_BIN_SUFFIX}")
IF(_TOOLCHAIN_BIN_PREFIXES)
LIST(GET _TOOLCHAIN_BIN_PREFIXES 0 _TOOLCHAIN_BIN_PREFIX)
STRING(REGEX REPLACE "${TOOLCHAIN_ROOT}/bin/([a-z0-9-]+)-gcc${TOOLCHAIN_BIN_SUFFIX}" "\\1" TOOLCHAIN_BIN_PREFIX "${_TOOLCHAIN_BIN_PREFIX}")
ENDIF(_TOOLCHAIN_BIN_PREFIXES)
SET(STL_INCLUDE_DIR "${STL_DIR}/include")
SET(STL_LIBRARY_DIR "${STL_DIR}/libs/${LIBRARY_ARCHITECTURE}")
SET(STL_INCLUDE_CPU_DIR "${STL_LIBRARY_DIR}/include")
SET(STL_LIBRARY "${STL_LIBRARY_DIR}/libgnustl_static.a")
SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN_ROOT} ${PLATFORM_ROOT}/usr ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_ANDROID_PATH} CACHE string "Android find search path root")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
INCLUDE_DIRECTORIES(${STL_INCLUDE_DIR} ${STL_INCLUDE_CPU_DIR})
MACRO(SET_TOOLCHAIN_BINARY _NAME _BINARY)
SET(${_NAME} ${TOOLCHAIN_ROOT}/bin/${TOOLCHAIN_BIN_PREFIX}-${_BINARY}${TOOLCHAIN_BIN_SUFFIX})
ENDMACRO(SET_TOOLCHAIN_BINARY)
SET_TOOLCHAIN_BINARY(CMAKE_C_COMPILER gcc)
SET_TOOLCHAIN_BINARY(CMAKE_CXX_COMPILER g++)
# Force the compilers to GCC for Android
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(${CMAKE_C_COMPILER} GNU)
CMAKE_FORCE_CXX_COMPILER(${CMAKE_CXX_COMPILER} GNU)

View file

@ -4,42 +4,32 @@
# MFC_LIBRARY_DIR, where to find libraries
# MFC_INCLUDE_DIR, where to find headers
# Try to find MFC using official module, MFC_FOUND is set
FIND_PACKAGE(MFC)
IF(CustomMFC_FIND_REQUIRED)
SET(MFC_FIND_REQUIRED TRUE)
ENDIF(CustomMFC_FIND_REQUIRED)
SET(CUSTOM_MFC_DIR FALSE)
IF(NOT MFC_DIR)
# If MFC have been found, remember their directory
IF(VC_DIR)
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF(VC_DIR)
# If using STLport and MFC have been found, remember its directory
IF(WITH_STLPORT AND MFC_FOUND AND VC_DIR)
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF(WITH_STLPORT AND MFC_FOUND AND VC_DIR)
# If using STLport or MFC haven't been found, search for afxwin.h
IF(WITH_STLPORT OR NOT MFC_FOUND)
FIND_PATH(MFC_DIR
include/afxwin.h
PATHS
HINTS
${MFC_STANDARD_DIR}
)
ENDIF(NOT MFC_DIR)
IF(CustomMFC_FIND_REQUIRED)
SET(MFC_FIND_REQUIRED TRUE)
ENDIF(CustomMFC_FIND_REQUIRED)
# Display an error message if MFC are not found, MFC_FOUND is updated
# User will be able to update MFC_DIR to the correct directory
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
# Display an error message if MFC are not found, MFC_FOUND is updated
# User will be able to update MFC_DIR to the correct directory
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
IF(MFC_FOUND)
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
IF(MFC_FOUND)
SET(CUSTOM_MFC_DIR TRUE)
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
ENDIF(MFC_FOUND)
ENDIF(WITH_STLPORT OR NOT MFC_FOUND)
# Only if using a custom path
IF(CUSTOM_MFC_DIR)
# Using 32 or 64 bits libraries
IF(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
@ -49,11 +39,12 @@ IF(CUSTOM_MFC_DIR)
# Add MFC libraries directory to default library path
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
ENDIF(CUSTOM_MFC_DIR)
IF(MFC_FOUND)
# Set definitions for using MFC in DLL
SET(MFC_DEFINITIONS -D_AFXDLL)
# Set CMake flag to use MFC DLL
SET(CMAKE_MFC_FLAG 2)
ENDIF(MFC_FOUND)
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project

View file

@ -1,38 +0,0 @@
# - Find DirectInput
# Find the DirectSound includes and libraries
#
# DINPUT_INCLUDE_DIR - where to find dinput.h
# DINPUT_LIBRARIES - List of libraries when using DirectInput.
# DINPUT_FOUND - True if DirectInput found.
if(DINPUT_INCLUDE_DIR)
# Already in cache, be silent
set(DINPUT_FIND_QUIETLY TRUE)
endif(DINPUT_INCLUDE_DIR)
find_path(DINPUT_INCLUDE_DIR dinput.h
"$ENV{DXSDK_DIR}"
"$ENV{DXSDK_DIR}/Include"
)
find_library(DINPUT_LIBRARY
NAMES dinput dinput8
PATHS
"$ENV{DXSDK_DIR}"
"$ENV{DXSDK_DIR}/Lib"
"$ENV{DXSDK_DIR}/Lib/x86"
)
# Handle the QUIETLY and REQUIRED arguments and set DINPUT_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DINPUT DEFAULT_MSG
DINPUT_INCLUDE_DIR DINPUT_LIBRARY)
if(DINPUT_FOUND)
set(DINPUT_LIBRARIES ${DINPUT_LIBRARY})
else(DINPUT_FOUND)
set(DINPUT_LIBRARIES)
endif(DINPUT_FOUND)
mark_as_advanced(DINPUT_INCLUDE_DIR DINPUT_LIBRARY)

View file

@ -6,8 +6,8 @@
# DXSDK_FOUND - True if MAX SDK found.
IF(DXSDK_DIR)
# Already in cache, be silent
SET(DXSDK_FIND_QUIETLY TRUE)
# Already in cache, be silent
SET(DXSDK_FIND_QUIETLY TRUE)
ENDIF(DXSDK_DIR)
FIND_PATH(DXSDK_DIR
@ -26,10 +26,10 @@ FIND_PATH(DXSDK_DIR
MACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME}
PATHS
"${DXSDK_LIBRARY_DIR}"
)
NAMES ${MYLIBRARYNAME}
PATHS
"${DXSDK_LIBRARY_DIR}"
)
ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
IF(DXSDK_DIR)

View file

@ -1,14 +1,13 @@
# - Locate FreeType library
# This module defines
# FREETYPE_LIBRARY, the library to link against
# FREETYPE_LIBRARIES, libraries to link against
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
# FREETYPE_INCLUDE_DIRS, where to find headers.
IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
# in cache already
SET(FREETYPE_FIND_QUIETLY TRUE)
ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
SET(Freetype_FIND_QUIETLY TRUE)
ENDIF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
FIND_PATH(FREETYPE_INCLUDE_DIRS
freetype
@ -20,9 +19,13 @@ FIND_PATH(FREETYPE_INCLUDE_DIRS
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES freetype freetype2
PATH_SUFFIXES freetype2
)
IF(NOT FREETYPE_INCLUDE_DIRS)
SET(FREETYPE_INCLUDE_DIRS "")
ENDIF(NOT FREETYPE_INCLUDE_DIRS)
# ft2build.h does not reside in the freetype include dir
FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR
ft2build.h
@ -33,6 +36,7 @@ FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES freetype2
)
# combine both include directories into one variable
@ -40,7 +44,7 @@ IF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_ADDITIONAL_INCLUDE_DIR})
ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
FIND_LIBRARY(FREETYPE_LIBRARY
FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE
NAMES freetype libfreetype freetype219 freetype246
PATHS
$ENV{FREETYPE_DIR}/lib
@ -53,22 +57,54 @@ FIND_LIBRARY(FREETYPE_LIBRARY
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/lib/x86_64-linux-gnu
)
IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
SET(FREETYPE_FOUND "YES")
FIND_LIBRARY(FREETYPE_LIBRARY_DEBUG
NAMES freetyped libfreetyped freetype219d freetype246d
PATHS
$ENV{FREETYPE_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
/usr/lib/x86_64-linux-gnu
)
IF(FREETYPE_INCLUDE_DIRS)
IF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES optimized ${FREETYPE_LIBRARY_RELEASE} debug ${FREETYPE_LIBRARY_DEBUG})
ELSEIF(FREETYPE_LIBRARY_RELEASE)
# Normal case
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_RELEASE})
ELSEIF(FREETYPE_LIBRARY_DEBUG)
# Case where Freetype is compiled from sources (debug version is compiled by default)
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_DEBUG})
ENDIF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG)
ENDIF(FREETYPE_INCLUDE_DIRS)
IF(FREETYPE_FOUND)
IF(WITH_STATIC_EXTERNAL AND APPLE)
FIND_PACKAGE(BZip2)
IF(BZIP2_FOUND)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR})
SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARY} ${BZIP2_LIBRARIES})
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES})
ENDIF(BZIP2_FOUND)
ENDIF(WITH_STATIC_EXTERNAL AND APPLE)
IF(NOT FREETYPE_FIND_QUIETLY)
MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARY}")
ENDIF(NOT FREETYPE_FIND_QUIETLY)
IF(NOT Freetype_FIND_QUIETLY)
MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARIES}")
ENDIF(NOT Freetype_FIND_QUIETLY)
ELSE(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
IF(NOT FREETYPE_FIND_QUIETLY)
IF(NOT Freetype_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find FreeType!")
ENDIF(NOT FREETYPE_FIND_QUIETLY)
ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
ENDIF(NOT Freetype_FIND_QUIETLY)
ENDIF(FREETYPE_FOUND)

View file

@ -0,0 +1,70 @@
# - Locate LibOVR library
# This module defines
# LIBOVR_LIBRARIES, the libraries to link against
# LIBOVR_FOUND, if false, do not try to link to LIBOVR
# LIBOVR_INCLUDE_DIR, where to find headers.
IF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR)
# in cache already
SET(LIBOVR_FIND_QUIETLY TRUE)
ENDIF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR)
FIND_PATH(LIBOVR_INCLUDE_DIR
OVR.h
PATHS
$ENV{LIBOVR_DIR}/Include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
)
IF(UNIX)
IF(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/x86_64")
ELSE(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/i386")
ENDIF(TARGET_X64)
ELSEIF(APPLE)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/MacOS/Release")
ELSEIF(WIN32)
IF(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/x64")
ELSE(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Win32")
ENDIF(TARGET_X64)
ENDIF(UNIX)
FIND_LIBRARY(LIBOVR_LIBRARY
NAMES ovr
PATHS
$ENV{LIBOVR_DIR}/${LIBOVR_LIBRARY_BUILD_PATH}
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
IF(NOT LIBOVR_FIND_QUIETLY)
MESSAGE(STATUS "Found LibOVR: ${LIBOVR_LIBRARY}")
ENDIF(NOT LIBOVR_FIND_QUIETLY)
SET(LIBOVR_FOUND "YES")
SET(LIBOVR_DEFINITIONS "-DHAVE_LIBOVR")
IF(UNIX)
SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY} X11 Xinerama udev pthread)
ELSE(UNIX)
SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY})
ENDIF(UNIX)
ELSE(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
IF(NOT LIBOVR_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibOVR!")
ENDIF(NOT LIBOVR_FIND_QUIETLY)
ENDIF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)

View file

@ -0,0 +1,32 @@
# - Locate LibVR library
# This module defines
# LIBVR_LIBRARIES, the libraries to link against
# LIBVR_FOUND, if false, do not try to link to LIBVR
# LIBVR_INCLUDE_DIR, where to find headers.
IF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR)
# in cache already
SET(LIBVR_FIND_QUIETLY TRUE)
ENDIF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR)
FIND_PATH(LIBVR_INCLUDE_DIR hmd.h
PATH_SUFFIXES include/LibVR
)
FIND_LIBRARY(LIBVR_LIBRARY
NAMES vr
PATH_SUFFIXES lib
PATHS
)
IF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
IF(NOT LIBVR_FIND_QUIETLY)
MESSAGE(STATUS "Found LibVR: ${LIBVR_LIBRARY}")
ENDIF(NOT LIBVR_FIND_QUIETLY)
SET(LIBVR_FOUND "YES")
SET(LIBVR_DEFINITIONS "-DHAVE_LIBVR")
ELSE(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
IF(NOT LIBVR_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibVR!")
ENDIF(NOT LIBVR_FIND_QUIETLY)
ENDIF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)

View file

@ -3,17 +3,15 @@
#
# This module defines
# LIBWWW_INCLUDE_DIR, where to find tiff.h, etc.
# LIBWWW_LIBRARY, where to find the LibWWW library.
# LIBWWW_FOUND, If false, do not try to use LibWWW.
# LIBWWW_LIBRARY, where to find the Libwww library.
# LIBWWW_FOUND, If false, do not try to use Libwww.
OPTION(WITH_LIBWWW_STATIC "Use only static libraries for libwww" OFF)
SET(LIBWWW_FIND_QUIETLY ${Libwww_FIND_QUIETLY})
# also defined, but not for general use are
IF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR)
# in cache already
SET(LIBWWW_FIND_QUIETLY TRUE)
SET(Libwww_FIND_QUIETLY TRUE)
ENDIF(LIBWWW_LIBRARIES AND LIBWWW_INCLUDE_DIR)
FIND_PATH(LIBWWW_INCLUDE_DIR
@ -47,14 +45,29 @@ IF(LIBWWW_ADDITIONAL_INCLUDE_DIR)
ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR)
# helper to find all the libwww sub libraries
MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION)
MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION FILE)
IF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES})
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
ENDIF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${ARGN}
FIND_LIBRARY(${MYLIBRARY}_RELEASE
NAMES ${FILE}
PATHS
/usr/local/lib
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(${MYLIBRARY}_DEBUG
NAMES ${FILE}d
PATHS
/usr/local/lib
/usr/lib
@ -72,17 +85,25 @@ MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD})
ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD)
IF(${MYLIBRARY})
IF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG)
IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}})
SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} optimized ${${MYLIBRARY}_RELEASE} debug ${${MYLIBRARY}_DEBUG})
ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
ELSE(${MYLIBRARY})
IF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32)
ELSEIF(${MYLIBRARY}_RELEASE)
IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_RELEASE})
ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
ELSEIF(${MYLIBRARY}_DEBUG)
IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}_DEBUG})
ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC)
ELSE(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG)
IF(NOT Libwww_FIND_QUIETLY AND NOT WIN32)
MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}")
ENDIF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32)
ENDIF(${MYLIBRARY})
ENDIF(NOT Libwww_FIND_QUIETLY AND NOT WIN32)
ENDIF(${MYLIBRARY}_RELEASE AND ${MYLIBRARY}_DEBUG)
MARK_AS_ADVANCED(${MYLIBRARY})
MARK_AS_ADVANCED(${MYLIBRARY}_RELEASE ${MYLIBRARY}_DEBUG)
ENDMACRO(FIND_WWW_LIBRARY)
MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL)
@ -163,7 +184,7 @@ LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY LIBREGEX_LIBRARY regexec)
LINK_WWW_LIBRARY(LIBWWWAPP_LIBRARY OPENSSL_LIBRARIES SSL_new)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibWWW DEFAULT_MSG
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Libwww DEFAULT_MSG
LIBWWW_LIBRARIES
LIBWWW_INCLUDE_DIR
)

View file

@ -0,0 +1,81 @@
# Locate Lua library
# This module defines
# LUA52_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES
# LUA_INCLUDE_DIR, where to find lua.h
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
#
# Note that the expected include convention is
# #include "lua.h"
# and not
# #include <lua/lua.h>
# This is because, the lua location is not standardized and may exist
# in locations other than lua/
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/lua52 include/lua5.2 include/lua-5.2 include/lua include
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(LUA_LIBRARY
NAMES lua52 lua5.2 lua-5.2 lua
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(LUA_LIBRARY)
# include the math library for Unix
if(UNIX AND NOT APPLE AND NOT BEOS)
find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
endif()
endif()
if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
unset(lua_version_str)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua52
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)

View file

@ -4,6 +4,48 @@
# LUABIND_FOUND, if false, do not try to link to LUABIND
# LUABIND_INCLUDE_DIR, where to find headers.
MACRO(FIND_CORRECT_LUA_VERSION)
# Check Lua version linked to Luabind under Linux
IF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
INCLUDE(CheckDepends)
SET(LUA52_LIBRARY "liblua5.2")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA52_LIBRARY LUALIB_FOUND)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.2")
FIND_PACKAGE(Lua52 REQUIRED)
ELSE(LUALIB_FOUND)
SET(LUA51_LIBRARY "liblua5.1")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA51_LIBRARY LUALIB_FOUND)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.1")
FIND_PACKAGE(Lua51 REQUIRED)
ELSE(LUALIB_FOUND)
SET(LUA50_LIBRARY "liblua5.0")
CHECK_LINKED_LIBRARY(LUABIND_LIBRARY_RELEASE LUA50_LIBRARY LUALIB_FOUND)
IF(LUALIB_FOUND)
MESSAGE(STATUS "Luabind is using Lua 5.0")
FIND_PACKAGE(Lua50 REQUIRED)
ELSE(LUALIB_FOUND)
MESSAGE(FATAL_ERROR "Can't determine Lua version used by Luabind")
ENDIF(LUALIB_FOUND)
ENDIF(LUALIB_FOUND)
ENDIF(LUALIB_FOUND)
ELSE(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
# TODO: find a way to detect Lua version
IF(WITH_LUA52)
FIND_PACKAGE(Lua52 REQUIRED)
ELSEIF(WITH_LUA51)
FIND_PACKAGE(Lua51 REQUIRED)
ELSE(WITH_LUA52)
FIND_PACKAGE(Lua50 REQUIRED)
ENDIF(WITH_LUA52)
ENDIF(LUABIND_LIBRARY_RELEASE MATCHES "\\.so")
ENDMACRO(FIND_CORRECT_LUA_VERSION)
IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
# in cache already
SET(Luabind_FIND_QUIETLY TRUE)
@ -84,6 +126,9 @@ IF(LUABIND_FOUND)
IF(LUABIND_VERSION_FILE)
SET(LUABIND_DEFINITIONS "-DHAVE_LUABIND_VERSION")
ENDIF(LUABIND_VERSION_FILE)
FIND_CORRECT_LUA_VERSION()
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}")
ENDIF(NOT Luabind_FIND_QUIETLY)

View file

@ -0,0 +1,96 @@
# - Find MS Visual C++
#
# VC_INCLUDE_DIR - where to find headers
# VC_INCLUDE_DIRS - where to find headers
# VC_LIBRARY_DIR - where to find libraries
# VC_FOUND - True if MSVC found.
MACRO(DETECT_VC_VERSION_HELPER _ROOT _VERSION)
# Software/Wow6432Node/...
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7;${_VERSION}]" ABSOLUTE)
IF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR)
GET_FILENAME_COMPONENT(VC${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_VERSION}]" ABSOLUTE)
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_DIR "${VC${_VERSION}_DIR}VC/")
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
ENDIF(VC${_VERSION}_DIR AND VC${_VERSION}_DIR STREQUAL "/registry")
IF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_FOUND ON)
DETECT_EXPRESS_VERSION(${_VERSION})
IF(NOT MSVC_FIND_QUIETLY)
SET(_VERSION_STR ${_VERSION})
IF(MSVC_EXPRESS)
SET(_VERSION_STR "${_VERSION_STR} Express")
ENDIF(MSVC_EXPRESS)
MESSAGE(STATUS "Found Visual C++ ${_VERSION_STR} in ${VC${_VERSION}_DIR}")
ENDIF(NOT MSVC_FIND_QUIETLY)
ELSEIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
SET(VC${_VERSION}_FOUND OFF)
SET(VC${_VERSION}_DIR "")
ENDIF(VC${_VERSION}_DIR AND NOT VC${_VERSION}_DIR STREQUAL "/registry")
ENDMACRO(DETECT_VC_VERSION_HELPER)
MACRO(DETECT_VC_VERSION _VERSION)
SET(VC${_VERSION}_FOUND OFF)
DETECT_VC_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
IF(NOT VC${_VERSION}_FOUND)
DETECT_VC_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF(NOT VC${_VERSION}_FOUND)
IF(VC${_VERSION}_FOUND)
SET(VC_FOUND ON)
SET(VC_DIR "${VC${_VERSION}_DIR}")
ENDIF(VC${_VERSION}_FOUND)
ENDMACRO(DETECT_VC_VERSION)
MACRO(DETECT_EXPRESS_VERSION _VERSION)
GET_FILENAME_COMPONENT(MSVC_EXPRESS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\${_VERSION}\\Setup\\VC;ProductDir]" ABSOLUTE)
IF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
SET(MSVC_EXPRESS ON)
ENDIF(MSVC_EXPRESS AND NOT MSVC_EXPRESS STREQUAL "/registry")
ENDMACRO(DETECT_EXPRESS_VERSION)
IF(MSVC12)
DETECT_VC_VERSION("12.0")
IF(NOT MSVC12_REDIST_DIR)
# If you have VC++ 2013 Express, put x64/Microsoft.VC120.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC12_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC11_REDIST_DIR)
ELSEIF(MSVC11)
DETECT_VC_VERSION("11.0")
IF(NOT MSVC11_REDIST_DIR)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC11_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC11_REDIST_DIR)
ELSEIF(MSVC10)
DETECT_VC_VERSION("10.0")
IF(NOT MSVC10_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC10_REDIST_DIR)
ELSEIF(MSVC90)
DETECT_VC_VERSION("9.0")
ELSEIF(MSVC80)
DETECT_VC_VERSION("8.0")
ENDIF(MSVC12)
# If you plan to use VC++ compilers with WINE, set VC_DIR environment variable
IF(NOT VC_DIR)
SET(VC_DIR $ENV{VC_DIR})
ENDIF(NOT VC_DIR)
IF(NOT VC_DIR)
STRING(REGEX REPLACE "/bin/.+" "" VC_DIR ${CMAKE_CXX_COMPILER})
ENDIF(NOT VC_DIR)
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
SET(VC_INCLUDE_DIRS ${VC_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR})

View file

@ -48,7 +48,12 @@
# License text for the above reference.)
FIND_PROGRAM(Mercurial_HG_EXECUTABLE hg
DOC "mercurial command line client")
DOC "mercurial command line client"
PATHS
/opt/local/bin
"C:/Program Files/TortoiseHg"
"C:/Program Files (x86)/TortoiseHg"
)
MARK_AS_ADVANCED(Mercurial_HG_EXECUTABLE)
IF(Mercurial_HG_EXECUTABLE)
@ -58,7 +63,7 @@ IF(Mercurial_HG_EXECUTABLE)
STRING(REGEX REPLACE ".*version ([\\.0-9]+).*"
"\\1" Mercurial_VERSION_HG "${Mercurial_VERSION_HG}")
MACRO(Mercurial_WC_INFO dir prefix)
EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip --template "{rev};{node};{tags};{author}"
WORKING_DIRECTORY ${dir}

View file

@ -58,6 +58,8 @@ ELSE(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
SET(MYSQL_LIBRARIES optimized ${MYSQL_LIBRARY_RELEASE})
IF(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_DEBUG})
ELSE(MYSQL_LIBRARY_DEBUG)
SET(MYSQL_LIBRARIES ${MYSQL_LIBRARIES} debug ${MYSQL_LIBRARY_RELEASE})
ENDIF(MYSQL_LIBRARY_DEBUG)
FIND_PACKAGE(OpenSSL)
IF(OPENSSL_FOUND)

View file

@ -1,50 +0,0 @@
# - Locate S3TC library
# This module defines
# S3TC_LIBRARY, the library to link against
# S3TC_FOUND, if false, do not try to link to S3TC
# S3TC_INCLUDE_DIR, where to find headers.
IF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
# in cache already
SET(S3TC_FIND_QUIETLY TRUE)
ENDIF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
FIND_PATH(S3TC_INCLUDE_DIR
s3_intrf.h
PATHS
$ENV{S3TC_DIR}/include
/usr/local/include
/usr/include
/sw/include
/opt/local/include
/opt/csw/include
/opt/include
PATH_SUFFIXES S3TC
)
FIND_LIBRARY(S3TC_LIBRARY
NAMES s3tc libs3tc
PATHS
$ENV{S3TC_DIR}/lib
/usr/local/lib
/usr/lib
/usr/local/X11R6/lib
/usr/X11R6/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
IF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
SET(S3TC_FOUND "YES")
IF(NOT S3TC_FIND_QUIETLY)
MESSAGE(STATUS "Found S3TC: ${S3TC_LIBRARY}")
ENDIF(NOT S3TC_FIND_QUIETLY)
ELSE(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)
IF(NOT S3TC_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find S3TC!")
ENDIF(NOT S3TC_FIND_QUIETLY)
ENDIF(S3TC_LIBRARY AND S3TC_INCLUDE_DIR)

View file

@ -6,80 +6,311 @@
# WINSDK_LIBRARY_DIR - where to find libraries
# WINSDK_FOUND - True if Windows SDK found.
IF(WINSDK_INCLUDE_DIR)
# Already in cache, be silent
SET(WindowsSDK_FIND_QUIETLY TRUE)
ENDIF(WINSDK_INCLUDE_DIR)
IF(WINSDK_FOUND)
# If Windows SDK already found, skip it
RETURN()
ENDIF(WINSDK_FOUND)
# TODO: add the possibility to use a specific Windows SDK
# Values can be CURRENT or any existing versions 7.1, 8.0A, etc...
SET(WINSDK_VERSION "CURRENT" CACHE STRING "Windows SDK version to prefer")
IF(MSVC11)
GET_FILENAME_COMPONENT(WINSDK8_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]" ABSOLUTE CACHE)
GET_FILENAME_COMPONENT(WINSDK8_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;ProductVersion]" NAME)
MACRO(DETECT_WINSDK_VERSION_HELPER _ROOT _VERSION)
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_DIR "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};InstallationFolder]" ABSOLUTE)
IF(WINSDK8_DIR)
IF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
SET(WINSDK${_VERSION}_FOUND ON)
GET_FILENAME_COMPONENT(WINSDK${_VERSION}_VERSION_FULL "[${_ROOT}\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v${_VERSION};ProductVersion]" NAME)
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows SDK ${WINSDK8_VERSION} in ${WINSDK8_DIR}")
MESSAGE(STATUS "Found Windows SDK ${_VERSION} in ${WINSDK${_VERSION}_DIR}")
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
IF(TARGET_ARM)
SET(WINSDK8_SUFFIX "arm")
ELSEIF(TARGET_X64)
SET(WINSDK8_SUFFIX "x64")
ELSEIF(TARGET_X86)
SET(WINSDK8_SUFFIX "x86")
ENDIF(TARGET_ARM)
ENDIF(WINSDK8_DIR)
ENDIF(MSVC11)
ELSE(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
SET(WINSDK${_VERSION}_DIR "")
ENDIF(WINSDK${_VERSION}_DIR AND NOT WINSDK${_VERSION}_DIR STREQUAL "/registry")
ENDMACRO(DETECT_WINSDK_VERSION_HELPER)
GET_FILENAME_COMPONENT(WINSDK71_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;InstallationFolder]" ABSOLUTE CACHE)
GET_FILENAME_COMPONENT(WINSDK71_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;ProductVersion]" NAME)
MACRO(DETECT_WINSDK_VERSION _VERSION)
SET(WINSDK${_VERSION}_FOUND OFF)
DETECT_WINSDK_VERSION_HELPER("HKEY_CURRENT_USER" ${_VERSION})
IF(WINSDK71_DIR)
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows SDK ${WINSDK71_VERSION} in ${WINSDK71_DIR}")
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
ENDIF(WINSDK71_DIR)
IF(NOT WINSDK${_VERSION}_FOUND)
DETECT_WINSDK_VERSION_HELPER("HKEY_LOCAL_MACHINE" ${_VERSION})
ENDIF(NOT WINSDK${_VERSION}_FOUND)
ENDMACRO(DETECT_WINSDK_VERSION)
GET_FILENAME_COMPONENT(WINSDKCURRENT_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE)
GET_FILENAME_COMPONENT(WINSDKCURRENT_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentVersion]" NAME)
SET(WINSDK_VERSIONS "8.0" "8.0A" "7.1" "7.1A" "7.0" "7.0A" "6.1" "6.0" "6.0A")
SET(WINSDK_DETECTED_VERSIONS)
IF(WINSDKCURRENT_DIR)
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows SDK ${WINSDKCURRENT_VERSION} in ${WINSDKCURRENT_DIR}")
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
ENDIF(WINSDKCURRENT_DIR)
# Search all supported Windows SDKs
FOREACH(_VERSION ${WINSDK_VERSIONS})
DETECT_WINSDK_VERSION(${_VERSION})
IF(WINSDK${_VERSION}_FOUND)
LIST(APPEND WINSDK_DETECTED_VERSIONS ${_VERSION})
ENDIF(WINSDK${_VERSION}_FOUND)
ENDFOREACH(_VERSION)
SET(WINSDK_SUFFIX)
IF(TARGET_ARM)
SET(WINSDK8_SUFFIX "arm")
ELSEIF(TARGET_X64)
SET(WINSDK8_SUFFIX "x64")
SET(WINSDK_SUFFIX "x64")
ELSEIF(TARGET_X86)
SET(WINSDK8_SUFFIX "x86")
ENDIF(TARGET_ARM)
SET(WINSDKCURRENT_VERSION_INCLUDE $ENV{INCLUDE})
IF(WINSDKCURRENT_VERSION_INCLUDE)
FILE(TO_CMAKE_PATH "${WINSDKCURRENT_VERSION_INCLUDE}" WINSDKCURRENT_VERSION_INCLUDE)
ENDIF(WINSDKCURRENT_VERSION_INCLUDE)
SET(WINSDKENV_DIR $ENV{WINSDK_DIR})
MACRO(FIND_WINSDK_VERSION_HEADERS)
IF(WINSDK_DIR AND NOT WINSDK_VERSION)
# Search version in headers
FIND_FILE(_MSI_FILE Msi.h
PATHS
${WINSDK_DIR}/Include/um
${WINSDK_DIR}/Include
)
IF(_MSI_FILE)
# Look for Windows SDK 8.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN8")
IF(_CONTENT)
SET(WINSDK_VERSION "8.0")
ENDIF(_CONTENT)
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 7.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN7")
IF(_CONTENT)
FIND_FILE(_WINSDKVER_FILE winsdkver.h WinSDKVer.h
PATHS
${WINSDK_DIR}/Include/um
${WINSDK_DIR}/Include
)
IF(_WINSDKVER_FILE)
# Load WinSDKVer.h content
FILE(STRINGS ${_WINSDKVER_FILE} _CONTENT REGEX "^#define NTDDI_MAXVER")
# Get NTDDI_MAXVER value
STRING(REGEX REPLACE "^.*0x([0-9A-Fa-f]+).*$" "\\1" _WINSDKVER "${_CONTENT}")
# In Windows SDK 7.1, NTDDI_MAXVER is wrong
IF(_WINSDKVER STREQUAL "06010000")
SET(WINSDK_VERSION "7.1")
ELSEIF(_WINSDKVER STREQUAL "0601")
SET(WINSDK_VERSION "7.0A")
ELSE(_WINSDKVER STREQUAL "06010000")
MESSAGE(FATAL_ERROR "Can't determine Windows SDK version with NTDDI_MAXVER 0x${_WINSDKVER}")
ENDIF(_WINSDKVER STREQUAL "06010000")
ELSE(_WINSDKVER_FILE)
SET(WINSDK_VERSION "7.0")
ENDIF(_WINSDKVER_FILE)
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 6.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_VISTA")
IF(_CONTENT)
SET(WINSDK_VERSION "6.0")
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.2
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WS03SP1")
IF(_CONTENT)
SET(WINSDK_VERSION "5.2")
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.1
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WINXP")
IF(_CONTENT)
SET(WINSDK_VERSION "5.1")
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
IF(NOT WINSDK_VERSION)
# Look for Windows SDK 5.0
FILE(STRINGS ${_MSI_FILE} _CONTENT REGEX "^#ifndef NTDDI_WIN2K")
IF(_CONTENT)
SET(WINSDK_VERSION "5.0")
ENDIF(_CONTENT)
ENDIF(NOT WINSDK_VERSION)
ELSE(_MSI_FILE)
MESSAGE(FATAL_ERROR "Unable to find Msi.h in ${WINSDK_DIR}")
ENDIF(_MSI_FILE)
ENDIF(WINSDK_DIR AND NOT WINSDK_VERSION)
ENDMACRO(FIND_WINSDK_VERSION_HEADERS)
MACRO(USE_CURRENT_WINSDK)
SET(WINSDK_DIR "")
SET(WINSDK_VERSION "")
SET(WINSDK_VERSION_FULL "")
# Use WINSDK environment variable
IF(WINSDKENV_DIR)
FIND_PATH(WINSDK_DIR Windows.h
HINTS
${WINSDKENV_DIR}/Include/um
${WINSDKENV_DIR}/Include
)
ENDIF(WINSDKENV_DIR)
# Use INCLUDE environment variable
IF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
FOREACH(_INCLUDE ${WINSDKCURRENT_VERSION_INCLUDE})
FILE(TO_CMAKE_PATH ${_INCLUDE} _INCLUDE)
# Look for Windows.h because there are several paths
IF(EXISTS ${_INCLUDE}/Windows.h)
STRING(REGEX REPLACE "/(include|INCLUDE|Include)(.*)" "" WINSDK_DIR ${_INCLUDE})
MESSAGE(STATUS "Found Windows SDK from include environment variable in ${WINSDK_DIR}")
BREAK()
ENDIF(EXISTS ${_INCLUDE}/Windows.h)
ENDFOREACH(_INCLUDE)
ENDIF(NOT WINSDK_DIR AND WINSDKCURRENT_VERSION_INCLUDE)
IF(WINSDK_DIR)
# Compare WINSDK_DIR with registered Windows SDKs
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
IF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}")
SET(WINSDK_VERSION ${_VERSION})
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
BREAK()
ENDIF(WINSDK_DIR STREQUAL "${WINSDK${_VERSION}_DIR}")
ENDFOREACH(_VERSION)
FIND_WINSDK_VERSION_HEADERS()
ENDIF(WINSDK_DIR)
IF(NOT WINSDK_DIR)
# Use Windows SDK versions installed with VC++ when possible
IF(MSVC12)
SET(WINSDK_VERSION "8.1A")
ELSEIF(MSVC11)
SET(WINSDK_VERSION "8.0A")
ELSEIF(MSVC10)
IF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
SET(WINSDK_VERSION "7.0A")
ENDIF(NOT TARGET_X64 OR NOT MSVC_EXPRESS)
ELSEIF(MSVC90)
IF(NOT MSVC_EXPRESS)
SET(WINSDK_VERSION "6.0A")
ENDIF(NOT MSVC_EXPRESS)
ELSEIF(MSVC80)
IF(NOT MSVC_EXPRESS)
# TODO: fix this version
SET(WINSDK_VERSION "5.2A")
ENDIF(NOT MSVC_EXPRESS)
ELSE(MSVC12)
MESSAGE(FATAL_ERROR "Your compiler is either too old or too recent, please update this CMake module.")
ENDIF(MSVC12)
# Use installed Windows SDK
IF(NOT WINSDK_VERSION)
IF(WINSDK7.1_FOUND)
SET(WINSDK_VERSION "7.1")
ELSEIF(WINSDK7.0_FOUND)
SET(WINSDK_VERSION "7.0")
ELSEIF(WINSDK6.1_FOUND)
SET(WINSDK_VERSION "6.1")
ELSEIF(WINSDK6.0_FOUND)
SET(WINSDK_VERSION "6.0")
ELSE(WINSDK7.1_FOUND)
MESSAGE(FATAL_ERROR "You have no compatible Windows SDK installed.")
ENDIF(WINSDK7.1_FOUND)
ENDIF(NOT WINSDK_VERSION)
# Look for correct registered Windows SDK version
FOREACH(_VERSION ${WINSDK_DETECTED_VERSIONS})
IF(WINSDK_VERSION STREQUAL _VERSION)
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
BREAK()
ENDIF(WINSDK_VERSION STREQUAL _VERSION)
ENDFOREACH(_VERSION)
ENDIF(NOT WINSDK_DIR)
ENDMACRO(USE_CURRENT_WINSDK)
IF(WINSDK_VERSION STREQUAL "CURRENT")
USE_CURRENT_WINSDK()
ELSE(WINSDK_VERSION STREQUAL "CURRENT")
IF(WINSDK${WINSDK_VERSION}_FOUND)
SET(WINSDK_VERSION_FULL "${WINSDK${WINSDK_VERSION}_VERSION_FULL}")
SET(WINSDK_DIR "${WINSDK${WINSDK_VERSION}_DIR}")
ELSE(WINSDK${WINSDK_VERSION}_FOUND)
USE_CURRENT_WINSDK()
ENDIF(WINSDK${WINSDK_VERSION}_FOUND)
ENDIF(WINSDK_VERSION STREQUAL "CURRENT")
IF(WINSDK_DIR)
MESSAGE(STATUS "Using Windows SDK ${WINSDK_VERSION}")
ELSE(WINSDK_DIR)
MESSAGE(FATAL_ERROR "Unable to find Windows SDK!")
ENDIF(WINSDK_DIR)
# directory where Win32 headers are found
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
HINTS
${WINSDK8_DIR}/Include/um
${WINSDK71_DIR}/Include
${WINSDKCURRENT_DIR}/Include
${WINSDK_DIR}/Include/um
${WINSDK_DIR}/Include
)
# directory where DirectX headers are found
FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
HINTS
${WINSDK8_DIR}/Include/shared
${WINSDK71_DIR}/Include
${WINSDKCURRENT_DIR}/Include
${WINSDK_DIR}/Include/shared
${WINSDK_DIR}/Include
)
# directory where all libraries are found
FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
HINTS
${WINSDK8_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
${WINSDK71_DIR}/Lib
${WINSDKCURRENT_DIR}/Lib
${WINSDK_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
${WINSDK_DIR}/Lib/${WINSDK_SUFFIX}
)
# signtool is used to sign executables
FIND_PROGRAM(WINSDK_SIGNTOOL signtool
HINTS
${WINSDK8_DIR}/Bin/x86
${WINSDK71_DIR}/Bin
${WINSDKCURRENT_DIR}/Bin
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
)
# midl is used to generate IDL interfaces
FIND_PROGRAM(WINSDK_MIDL midl
HINTS
${WINSDK_DIR}/Bin/x86
${WINSDK_DIR}/Bin
)
IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_FOUND TRUE)
SET(WINSDK_FOUND ON)
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR})
SET(CMAKE_LIBRARY_PATH ${WINSDK_LIBRARY_DIR} ${CMAKE_LIBRARY_PATH})
INCLUDE_DIRECTORIES(${WINSDK_INCLUDE_DIRS})
# Fix for using Windows SDK 7.1 with Visual C++ 2012
IF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
ADD_DEFINITIONS(-D_USING_V110_SDK71_)
ENDIF(WINSDK_VERSION STREQUAL "7.1" AND MSVC11)
ELSE(WINSDK_INCLUDE_DIR)
IF(NOT WindowsSDK_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")

View file

@ -19,6 +19,7 @@ IF(SOURCE_DIR)
SET(SOURCE_DIR ${ROOT_DIR})
ENDIF(NOT SOURCE_DIR AND ROOT_DIR)
ELSE(SOURCE_DIR)
SET(SOURCE_DIR ${CMAKE_SOURCE_DIR})
SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
ENDIF(SOURCE_DIR)
@ -57,6 +58,15 @@ IF(EXISTS "${ROOT_DIR}/.hg/")
ENDIF(MERCURIAL_FOUND)
ENDIF(EXISTS "${ROOT_DIR}/.hg/")
# if processing exported sources, use "revision" file if exists
IF(SOURCE_DIR AND NOT DEFINED REVISION)
SET(REVISION_FILE ${SOURCE_DIR}/revision)
IF(EXISTS ${REVISION_FILE})
FILE(STRINGS ${REVISION_FILE} REVISION LIMIT_COUNT 1)
MESSAGE(STATUS "Read revision ${REVISION} from file")
ENDIF(EXISTS ${REVISION_FILE})
ENDIF(SOURCE_DIR AND NOT DEFINED REVISION)
IF(SOURCE_DIR AND DEFINED REVISION)
IF(EXISTS ${SOURCE_DIR}/revision.h.in)
MESSAGE(STATUS "Revision: ${REVISION}")

View file

@ -10,7 +10,6 @@
IF(MSVC)
SET(PCHSupport_FOUND TRUE)
SET(_PCH_include_prefix "/I")
ELSE(MSVC)
IF(CMAKE_COMPILER_IS_GNUCXX)
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
@ -26,8 +25,6 @@ ELSE(MSVC)
# TODO: make tests for other compilers than GCC
SET(PCHSupport_FOUND TRUE)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET(_PCH_include_prefix "-I")
ENDIF(MSVC)
# Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs
@ -35,35 +32,43 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
SET(PCH_FLAGS)
SET(PCH_ARCHS)
SET(FLAGS)
SET(_FLAGS)
LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS})
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD)
LIST(APPEND _FLAGS " ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}}")
IF(NOT MSVC)
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
LIST(APPEND _FLAGS " -fPIC")
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
ENDIF(NOT MSVC)
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
ELSE(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
IF(_pic)
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
ENDIF(_pic)
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS " ${_PCH_include_prefix}\"${item}\"")
LIST(APPEND _FLAGS " -I\"${item}\"")
ENDFOREACH(item)
# Required for CMake 2.6
SET(GLOBAL_DEFINITIONS)
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
IF(oldProps)
@ -75,16 +80,41 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
LIST(APPEND _FLAGS " ${oldPropsBuild}")
ENDIF(oldPropsBuild)
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
IF(DIRINC)
FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS " -I\"${item}\"")
ENDFOREACH(item)
ENDIF(DIRINC)
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDFOREACH(item)
ENDIF(DEFINITIONS)
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
LIST(APPEND _FLAGS " ${_directory_flags}")
LIST(APPEND _FLAGS " ${_directory_definitions}")
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
# Format definitions
SEPARATE_ARGUMENTS(_FLAGS)
IF(MSVC)
# Fix path with space
SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}")
ELSE(MSVC)
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
SEPARATE_ARGUMENTS(_FLAGS)
ENDIF(MSVC)
IF(CLANG)
# Determining all architectures and get common flags
@ -178,6 +208,9 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
IF(MSVC)
GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target})
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj")
# Ninja PCH Support
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj")
ELSE(MSVC)
SET(HEADER_FORMAT "c++-header")
SET(_FLAGS "")
@ -237,6 +270,25 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
IF(MSVC)
SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"")
# Ninja PCH Support
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES OBJECT_DEPENDS "${PCH_OUTPUT}")
# NMAKE-VS2012 Error LNK2011 (NMAKE-VS2010 do not complain)
# we need to link the pch.obj file, see http://msdn.microsoft.com/en-us/library/3ay26wa2(v=vs.110).aspx
GET_TARGET_PROPERTY(_STATIC_LIBRARY_FLAGS ${_targetName} STATIC_LIBRARY_FLAGS)
IF(NOT _STATIC_LIBRARY_FLAGS)
SET(_STATIC_LIBRARY_FLAGS)
ENDIF(NOT _STATIC_LIBRARY_FLAGS)
SET(_STATIC_LIBRARY_FLAGS "${PCH_OUTPUT}.obj ${_STATIC_LIBRARY_FLAGS}")
GET_TARGET_PROPERTY(_LINK_FLAGS ${_targetName} LINK_FLAGS)
IF(NOT _LINK_FLAGS)
SET(_LINK_FLAGS)
ENDIF(NOT _LINK_FLAGS)
SET(_LINK_FLAGS "${PCH_OUTPUT}.obj ${_LINK_FLAGS}")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES STATIC_LIBRARY_FLAGS ${_STATIC_LIBRARY_FLAGS} LINK_FLAGS ${_LINK_FLAGS})
ELSE(MSVC)
# for use with distcc and gcc >4.0.1 if preprocessed files are accessible
# on all remote machines set
@ -324,17 +376,6 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}")
ENDMACRO(ADD_PRECOMPILED_HEADER)
# Macro to move PCH creation file to the front of files list
# or remove .cpp from library/executable to avoid warning
MACRO(FIX_PRECOMPILED_HEADER _files _pch)
# Remove .cpp creating PCH from the list
LIST(REMOVE_ITEM ${_files} ${_pch})
IF(MSVC)
# Prepend .cpp creating PCH to the list
LIST(INSERT ${_files} 0 ${_pch})
ENDIF(MSVC)
ENDMACRO(FIX_PRECOMPILED_HEADER)
MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
IF(NOT PCHSupport_FOUND)
MESSAGE(STATUS "PCH disabled because compiler doesn't support them")
@ -346,10 +387,6 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
# 2 => setting PCH for XCode project, works for XCode projects
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
SET(PCH_METHOD 1)
ELSEIF(CMAKE_GENERATOR MATCHES "NMake Makefiles" AND MFC_FOUND AND CMAKE_MFC_FLAG)
# To fix a bug with MFC
# Don't forget to use FIX_PRECOMPILED_HEADER before creating the target
# SET(PCH_METHOD 1)
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
SET(PCH_METHOD 2)
ELSE(CMAKE_GENERATOR MATCHES "Visual Studio")

View file

@ -0,0 +1,183 @@
# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake
# files which are included with CMake 2.8.4
# It has been altered for iOS development
#
# Options:
#
# IOS_VERSION = last(default) or specific one (4.3, 5.0, 4.1)
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
#
# IOS_PLATFORM = OS (default) or SIMULATOR or ALL
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
#
# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
# If set manually, it will override the default location and force the user of a particular Developer Platform
#
# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
# If set manually, this will force the use of a specific SDK version
IF(DEFINED CMAKE_CROSSCOMPILING)
# subsequent toolchain loading is not really needed
RETURN()
ENDIF()
# Standard settings
SET(CMAKE_SYSTEM_NAME Darwin)
SET(CMAKE_SYSTEM_VERSION 1) # TODO: determine target Darwin version
SET(UNIX ON)
SET(APPLE ON)
SET(IOS ON)
# Force the compilers to Clang for iOS
include (CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER (clang Clang)
CMAKE_FORCE_CXX_COMPILER (clang++ Clang)
# Setup iOS platform
if (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM "OS")
endif (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform")
SET(IOS_SIMULATOR_PLATFORM_LOCATION "iPhoneSimulator.platform")
# Check the platform selection and setup for developer root
if (${IOS_PLATFORM} STREQUAL "OS")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
elseif (${IOS_PLATFORM} STREQUAL "ALL")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator;-iphoneos")
else (${IOS_PLATFORM} STREQUAL "OS")
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
endif (${IOS_PLATFORM} STREQUAL "OS")
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS ${CMAKE_XCODE_EFFECTIVE_PLATFORMS} CACHE PATH "iOS Platform")
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
# Note Xcode 4.3 changed the installation location, choose the most recent one available
SET(XCODE_POST_43_ROOT "/Applications/Xcode.app/Contents/Developer/Platforms")
SET(XCODE_PRE_43_ROOT "/Developer/Platforms")
IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
IF(EXISTS ${XCODE_POST_43_ROOT})
SET(CMAKE_XCODE_ROOT ${XCODE_POST_43_ROOT})
ELSEIF(EXISTS ${XCODE_PRE_43_ROOT})
SET(CMAKE_XCODE_ROOT ${XCODE_PRE_43_ROOT})
ENDIF(EXISTS ${XCODE_POST_43_ROOT})
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_PLATFORM_LOCATION}/Developer)
IF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
ENDIF(EXISTS ${CMAKE_XCODE_ROOT}/${IOS_SIMULATOR_PLATFORM_LOCATION}/Developer)
ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
SET(CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT} CACHE PATH "Location of iOS Simulator Platform")
MACRO(GET_AVAILABLE_SDK_VERSIONS ROOT VERSIONS)
FILE(GLOB _CMAKE_IOS_SDKS "${ROOT}/SDKs/iPhoneOS*")
IF(_CMAKE_IOS_SDKS)
LIST(SORT _CMAKE_IOS_SDKS)
LIST(REVERSE _CMAKE_IOS_SDKS)
FOREACH(_CMAKE_IOS_SDK ${_CMAKE_IOS_SDKS})
STRING(REGEX REPLACE ".+iPhoneOS([0-9.]+)\\.sdk" "\\1" _IOS_SDK "${_CMAKE_IOS_SDK}")
LIST(APPEND ${VERSIONS} ${_IOS_SDK})
ENDFOREACH(_CMAKE_IOS_SDK)
ENDIF(_CMAKE_IOS_SDKS)
ENDMACRO(GET_AVAILABLE_SDK_VERSIONS)
# Find and use the most recent iOS sdk
IF(NOT DEFINED CMAKE_IOS_SDK_ROOT)
# Search for a specific version of a SDK
GET_AVAILABLE_SDK_VERSIONS(${CMAKE_IOS_DEVELOPER_ROOT} IOS_VERSIONS)
IF(NOT IOS_VERSIONS)
MESSAGE(FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
ENDIF(NOT IOS_VERSIONS)
IF(IOS_VERSION)
LIST(FIND IOS_VERSIONS "${IOS_VERSION}" _INDEX)
IF(_INDEX EQUAL -1)
LIST(GET IOS_VERSIONS 0 IOS_SDK_VERSION)
ELSE(_INDEX EQUAL -1)
SET(IOS_SDK_VERSION ${IOS_VERSION})
ENDIF(_INDEX EQUAL -1)
ELSE(IOS_VERSION)
LIST(GET IOS_VERSIONS 0 IOS_VERSION)
SET(IOS_SDK_VERSION ${IOS_VERSION})
ENDIF(IOS_VERSION)
MESSAGE(STATUS "Target iOS ${IOS_VERSION} and use SDK ${IOS_SDK_VERSION}")
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/iPhoneOS${IOS_SDK_VERSION}.sdk)
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_DEVELOPER_ROOT}/SDKs/iPhoneSimulator${IOS_SDK_VERSION}.sdk)
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
SET(CMAKE_IOS_SIMULATOR_SDK_ROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Location of the selected iOS Simulator SDK")
SET(IOS_VERSION ${IOS_VERSION} CACHE STRING "iOS target version")
# Set the sysroot default to the most recent SDK
SET(CMAKE_IOS_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
SET(CMAKE_IOS_SIMULATOR_SYSROOT ${CMAKE_IOS_SIMULATOR_SDK_ROOT} CACHE PATH "Sysroot used for iOS Simulator support")
IF(CMAKE_GENERATOR MATCHES Xcode)
SET(ARCHS "$(ARCHS_STANDARD_32_BIT)")
IF(${IOS_PLATFORM} STREQUAL "OS")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
ELSE(CMAKE_GENERATOR MATCHES Xcode)
IF(${IOS_PLATFORM} STREQUAL "OS")
SET(ARCHS "armv7")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ELSEIF(${IOS_PLATFORM} STREQUAL "SIMULATOR")
# iPhone simulator targets i386
SET(ARCHS "i386")
SET(CMAKE_SYSTEM_PROCESSOR "x86")
ELSEIF(${IOS_PLATFORM} STREQUAL "ALL")
SET(ARCHS "armv7;i386")
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
ENDIF(${IOS_PLATFORM} STREQUAL "OS")
ENDIF(CMAKE_GENERATOR MATCHES Xcode)
# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard.
# The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only
set (CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS")
# Set the find root to the iOS developer roots and to user defined paths
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_IOS_PATH} CACHE string "iOS find search path root")
# default to searching for frameworks first
set (CMAKE_FIND_FRAMEWORK FIRST)
# set up the default search directories for frameworks
set (CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
)
# only search the iOS sdks, not the remainder of the host filesystem
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
#SET(CMAKE_SYSTEM_INCLUDE_PATH /include /usr/include)
#SET(CMAKE_SYSTEM_LIBRARY_PATH /lib /usr/lib)
#SET(CMAKE_SYSTEM_PROGRAM_PATH /bin /usr/bin)

View file

@ -123,12 +123,8 @@ MACRO(NL_DEFAULT_PROPS name label)
VERSION ${NL_VERSION}
SOVERSION ${NL_VERSION_MAJOR}
COMPILE_FLAGS "/GA"
LINK_FLAGS "/VERSION:${NL_VERSION}")
LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}")
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32)
IF(WITH_STLPORT AND WIN32)
SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X")
ENDIF(WITH_STLPORT AND WIN32)
ENDMACRO(NL_DEFAULT_PROPS)
###
@ -247,6 +243,11 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
ELSE(WIN32)
OPTION(WITH_STATIC "With static libraries." OFF)
ENDIF(WIN32)
IF (WITH_STATIC)
OPTION(WITH_STATIC_LIBXML2 "With static libxml2" ON )
ELSE(WITH_STATIC)
OPTION(WITH_STATIC_LIBXML2 "With static libxml2" OFF)
ENDIF(WITH_STATIC)
OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF)
IF(WIN32)
OPTION(WITH_EXTERNAL "With provided external." ON )
@ -319,6 +320,10 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
OPTION(WITH_NEL_MAXPLUGIN "Build NeL 3dsMax Plugin" OFF)
OPTION(WITH_NEL_SAMPLES "Build NeL Samples" ON )
OPTION(WITH_NEL_TESTS "Build NeL Unit Tests" ON )
OPTION(WITH_LIBOVR "With LibOVR support" OFF)
OPTION(WITH_LIBVR "With LibVR support" OFF)
OPTION(WITH_PERFHUD "With NVIDIA PerfHUD support" OFF)
ENDMACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
MACRO(NL_SETUP_NELNS_DEFAULT_OPTIONS)
@ -337,11 +342,13 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
OPTION(WITH_RYZOM_TOOLS "Build Ryzom Core Tools" ON )
OPTION(WITH_RYZOM_SERVER "Build Ryzom Core Services" ON )
OPTION(WITH_RYZOM_SOUND "Enable Ryzom Core Sound" ON )
OPTION(WITH_RYZOM_PATCH "Enable Ryzom in-game patch support" OFF)
###
# Optional support
###
OPTION(WITH_LUA51 "Build Ryzom Core using Lua51" ON )
OPTION(WITH_LUA51 "Build Ryzom Core using Lua 5.1" ON )
OPTION(WITH_LUA52 "Build Ryzom Core using Lua 5.2" OFF)
ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS)
@ -382,11 +389,11 @@ MACRO(NL_SETUP_BUILD)
SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR})
IF(HOST_CPU MATCHES "amd64")
IF(HOST_CPU MATCHES "(amd|AMD)64")
SET(HOST_CPU "x86_64")
ELSEIF(HOST_CPU MATCHES "i.86")
SET(HOST_CPU "x86")
ENDIF(HOST_CPU MATCHES "amd64")
ENDIF(HOST_CPU MATCHES "(amd|AMD)64")
# Determine target CPU
@ -395,11 +402,11 @@ MACRO(NL_SETUP_BUILD)
SET(TARGET_CPU ${CMAKE_SYSTEM_PROCESSOR})
ENDIF(NOT TARGET_CPU)
IF(TARGET_CPU MATCHES "amd64")
IF(TARGET_CPU MATCHES "(amd|AMD)64")
SET(TARGET_CPU "x86_64")
ELSEIF(TARGET_CPU MATCHES "i.86")
SET(TARGET_CPU "x86")
ENDIF(TARGET_CPU MATCHES "amd64")
ENDIF(TARGET_CPU MATCHES "(amd|AMD)64")
IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
SET(CLANG ON)
@ -411,6 +418,11 @@ MACRO(NL_SETUP_BUILD)
MESSAGE(STATUS "Generating Xcode project")
ENDIF(CMAKE_GENERATOR MATCHES "Xcode")
IF(CMAKE_GENERATOR MATCHES "NMake")
SET(NMAKE ON)
MESSAGE(STATUS "Generating NMake project")
ENDIF(CMAKE_GENERATOR MATCHES "NMake")
# If target and host CPU are the same
IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING)
# x86-compatible CPU
@ -530,6 +542,9 @@ MACRO(NL_SETUP_BUILD)
SET(MSVC11 ON)
ENDIF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11)
# Ignore default include paths
ADD_PLATFORM_FLAGS("/X")
IF(MSVC11)
ADD_PLATFORM_FLAGS("/Gy- /MP")
# /Ox is working with VC++ 2010, but custom optimizations don't exist
@ -582,7 +597,7 @@ MACRO(NL_SETUP_BUILD)
SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_CFLAGS}")
SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${RELEASE_CFLAGS} ${NL_RELEASE_CFLAGS}")
SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt /INCREMENTAL:YES ${NL_DEBUG_LINKFLAGS}")
SET(NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt ${MSVC_INCREMENTAL_YES_FLAG} ${NL_DEBUG_LINKFLAGS}")
SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}")
IF(WITH_WARNINGS)
@ -773,16 +788,15 @@ MACRO(NL_SETUP_BUILD)
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SIMULATOR_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-mios-simulator-version-min=${IOS_VERSION}")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
IF(CMAKE_OSX_DEPLOYMENT_TARGET)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET)
ENDIF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86)
ELSE(IOS)
IF(CMAKE_OSX_SYSROOT)
ADD_PLATFORM_FLAGS("-isysroot ${CMAKE_OSX_SYSROOT}")
ENDIF(CMAKE_OSX_SYSROOT)
# Always force -mmacosx-version-min to override environement variable
ADD_PLATFORM_FLAGS("-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
IF(CMAKE_OSX_DEPLOYMENT_TARGET)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET)
ENDIF(IOS)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names")
@ -875,7 +889,7 @@ MACRO(NL_SETUP_BUILD)
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}")
SET(NL_RELEASE_LINKFLAGS "-Wl,-dead_strip ${NL_RELEASE_LINKFLAGS}")
ELSE(APPLE)
SET(NL_RELEASE_LINKFLAGS "-Wl,-s ${NL_RELEASE_LINKFLAGS}")
ENDIF(APPLE)
@ -889,20 +903,23 @@ ENDMACRO(NL_SETUP_BUILD)
MACRO(NL_SETUP_BUILD_FLAGS)
SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS ${PLATFORM_LINKFLAGS} CACHE STRING "" FORCE)
## Debug
SET(CMAKE_C_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS_DEBUG ${NL_DEBUG_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${PLATFORM_LINKFLAGS} ${NL_DEBUG_LINKFLAGS}" CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${PLATFORM_LINKFLAGS} ${NL_DEBUG_LINKFLAGS}" CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${PLATFORM_LINKFLAGS} ${NL_DEBUG_LINKFLAGS}" CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG ${NL_DEBUG_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG ${NL_DEBUG_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG ${NL_DEBUG_LINKFLAGS} CACHE STRING "" FORCE)
## Release
SET(CMAKE_C_FLAGS_RELEASE ${NL_RELEASE_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS_RELEASE ${NL_RELEASE_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${NL_RELEASE_LINKFLAGS}" CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${NL_RELEASE_LINKFLAGS}" CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${NL_RELEASE_LINKFLAGS}" CACHE STRING "" FORCE)
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE ${NL_RELEASE_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE ${NL_RELEASE_LINKFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE ${NL_RELEASE_LINKFLAGS} CACHE STRING "" FORCE)
ENDMACRO(NL_SETUP_BUILD_FLAGS)
# Macro to create x_ABSOLUTE_PREFIX from x_PREFIX
@ -1056,74 +1073,14 @@ MACRO(SETUP_EXTERNAL)
IF(WIN32)
FIND_PACKAGE(External REQUIRED)
IF(NOT VC_DIR)
SET(VC_DIR $ENV{VC_DIR})
ENDIF(NOT VC_DIR)
IF(MSVC11)
IF(NOT MSVC_REDIST_DIR)
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC_REDIST_DIR)
IF(NOT VC_DIR)
IF(NOT VC_ROOT_DIR)
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\11.0_Config;InstallDir]" ABSOLUTE)
# VC_ROOT_DIR is set to "registry" when a key is not found
IF(VC_ROOT_DIR MATCHES "registry")
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\WDExpress\\11.0_Config\\Setup\\VC;InstallDir]" ABSOLUTE)
IF(VC_ROOT_DIR MATCHES "registry")
SET(VS110COMNTOOLS $ENV{VS110COMNTOOLS})
IF(VS110COMNTOOLS)
FILE(TO_CMAKE_PATH ${VS110COMNTOOLS} VC_ROOT_DIR)
ENDIF(VS110COMNTOOLS)
IF(NOT VC_ROOT_DIR)
MESSAGE(FATAL_ERROR "Unable to find VC++ 2012 directory!")
ENDIF(NOT VC_ROOT_DIR)
ENDIF(VC_ROOT_DIR MATCHES "registry")
ENDIF(VC_ROOT_DIR MATCHES "registry")
ENDIF(NOT VC_ROOT_DIR)
# convert IDE fullpath to VC++ path
STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR})
ENDIF(NOT VC_DIR)
ELSEIF(MSVC10)
IF(NOT MSVC_REDIST_DIR)
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist")
ENDIF(NOT MSVC_REDIST_DIR)
IF(NOT VC_DIR)
IF(NOT VC_ROOT_DIR)
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0_Config;InstallDir]" ABSOLUTE)
# VC_ROOT_DIR is set to "registry" when a key is not found
IF(VC_ROOT_DIR MATCHES "registry")
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE)
IF(VC_ROOT_DIR MATCHES "registry")
SET(VS100COMNTOOLS $ENV{VS100COMNTOOLS})
IF(VS100COMNTOOLS)
FILE(TO_CMAKE_PATH ${VS100COMNTOOLS} VC_ROOT_DIR)
ENDIF(VS100COMNTOOLS)
IF(NOT VC_ROOT_DIR)
MESSAGE(FATAL_ERROR "Unable to find VC++ 2010 directory!")
ENDIF(NOT VC_ROOT_DIR)
ENDIF(VC_ROOT_DIR MATCHES "registry")
ENDIF(VC_ROOT_DIR MATCHES "registry")
ENDIF(NOT VC_ROOT_DIR)
# convert IDE fullpath to VC++ path
STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR})
ENDIF(NOT VC_DIR)
ELSE(MSVC11)
IF(NOT VC_DIR)
IF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
# convert IDE fullpath to VC++ path
STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${CMAKE_MAKE_PROGRAM})
ELSE(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
# convert compiler fullpath to VC++ path
STRING(REGEX REPLACE "VC/bin/.+" "VC" VC_DIR ${CMAKE_CXX_COMPILER})
ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
ENDIF(NOT VC_DIR)
ENDIF(MSVC11)
# If using custom boost, we need to define the right variables used by official boost CMake module
IF(DEFINED BOOST_DIR)
SET(BOOST_INCLUDEDIR ${BOOST_DIR}/include)
SET(BOOST_LIBRARYDIR ${BOOST_DIR}/lib)
ENDIF(DEFINED BOOST_DIR)
ELSE(WIN32)
FIND_PACKAGE(External QUIET)
IF(APPLE)
IF(WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a)
@ -1139,15 +1096,22 @@ MACRO(SETUP_EXTERNAL)
ENDIF(APPLE)
ENDIF(WIN32)
# Android and iOS have pthread
IF(ANDROID OR IOS)
SET(CMAKE_USE_PTHREADS_INIT 1)
SET(Threads_FOUND TRUE)
ELSE(ANDROID OR IOS)
FIND_PACKAGE(Threads REQUIRED)
# TODO: replace all -l<lib> by absolute path to <lib> in CMAKE_THREAD_LIBS_INIT
ENDIF(ANDROID OR IOS)
IF(WITH_STLPORT)
FIND_PACKAGE(STLport REQUIRED)
INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR})
IF(MSVC)
SET(VC_INCLUDE_DIR "${VC_DIR}/include")
FIND_PACKAGE(WindowsSDK REQUIRED)
# use VC++ and Windows SDK include paths
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIRS})
ENDIF(MSVC)
ENDIF(WITH_STLPORT)
IF(MSVC)
FIND_PACKAGE(MSVC REQUIRED)
FIND_PACKAGE(WindowsSDK REQUIRED)
ENDIF(MSVC)
ENDMACRO(SETUP_EXTERNAL)

View file

@ -12,7 +12,7 @@ each other so you can use only the parts you really need in your project.
If you want know more about the library content and functionalities, you
should take a look on the documents present in the doc directory.
Ryzom Core is currently developped and tested under GNU/Linux and Windows
Ryzom Core is currently developed and tested under GNU/Linux and Windows
environments.
@ -29,4 +29,7 @@ file for for more details on license terms and other legal issues.
Installation
------------
Please visit http://dev.ryzom.com for more information.
Please visit https://ryzomcore.atlassian.net/wiki/display/RC/Ryzom+Core+Home for more information.
In particular the Getting Started section on the right side of the webpage includes build
instructions for Windows, Linux and Mac.

View file

@ -41,6 +41,14 @@ IF(WITH_GTK)
FIND_PACKAGE(GTK2)
ENDIF(WITH_GTK)
IF(WITH_LIBOVR)
FIND_PACKAGE(LibOVR)
ENDIF(WITH_LIBOVR)
IF(WITH_LIBVR)
FIND_PACKAGE(LibVR)
ENDIF(WITH_LIBVR)
IF(WITH_INSTALL_LIBRARIES)
IF(UNIX)
SET(prefix ${CMAKE_INSTALL_PREFIX})
@ -68,7 +76,11 @@ IF(WITH_NEL_SAMPLES)
ADD_SUBDIRECTORY(samples)
ENDIF(WITH_NEL_SAMPLES)
IF(WITH_NEL_TOOLS)
FIND_PACKAGE(Squish)
# Allow to compile only max plugins without other tools.
IF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN)
IF(WITH_NEL_TOOLS)
FIND_PACKAGE(Squish)
ENDIF(WITH_NEL_TOOLS)
ADD_SUBDIRECTORY(tools)
ENDIF(WITH_NEL_TOOLS)
ENDIF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN)

View file

@ -138,6 +138,8 @@ private:
NLMISC::CSmartPtr<NL3D::ITexture> _BlurFinalTex;
// used as render target in first blur pass, and as displayed texture on second blur pass.
NLMISC::CSmartPtr<NL3D::ITexture> _BlurHorizontalTex;
// original render target
NLMISC::CSmartPtr<NL3D::ITexture> _OriginalRenderTarget;
// materials

File diff suppressed because it is too large Load diff

View file

@ -133,6 +133,7 @@ public:
// @{
virtual void disableHardwareVertexProgram();
virtual void disableHardwarePixelProgram();
virtual void disableHardwareVertexArrayAGP();
virtual void disableHardwareTextureShader();
@ -473,7 +474,6 @@ public:
virtual void forceDXTCCompression(bool dxtcComp);
virtual void setAnisotropicFilter(sint filter);
virtual void forceTextureResize(uint divisor);
virtual void forceNativeFragmentPrograms(bool nativeOnly);
virtual bool setMonitorColorProperties (const CMonitorColorProperties &properties);
// @}

View file

@ -0,0 +1,49 @@
/** \file geometry_program.h
* Geometry program definition
*/
/* Copyright, 2000, 2001 Nevrax Ltd.
*
* This file is part of NEVRAX NEL.
* NEVRAX NEL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* NEVRAX NEL is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with NEVRAX NEL; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
#ifndef NL_GEOMETRY_PROGRAM_H
#define NL_GEOMETRY_PROGRAM_H
#include <nel/misc/types_nl.h>
#include <nel/misc/smart_ptr.h>
#include <nel/3d/program.h>
#include <list>
namespace NL3D {
class CGeometryProgram : public IProgram
{
public:
/// Constructor
CGeometryProgram();
/// Destructor
virtual ~CGeometryProgram ();
};
} // NL3D
#endif // NL_GEOMETRY_PROGRAM_H
/* End of vertex_program.h */

View file

@ -0,0 +1,178 @@
/**
* \file gpu_program_params.h
* \brief CGPUProgramParams
* \date 2013-09-07 22:17GMT
* \author Jan Boon (Kaetemi)
* CGPUProgramParams
*/
/*
* Copyright (C) 2013 by authors
*
* This file is part of NL3D.
* NL3D is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* NL3D is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
* Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef NL3D_GPU_PROGRAM_PARAMS_H
#define NL3D_GPU_PROGRAM_PARAMS_H
#include <nel/misc/types_nl.h>
// STL includes
#include <map>
#include <vector>
// NeL includes
// Project includes
namespace NLMISC {
class CVector;
class CMatrix;
}
namespace NL3D {
/**
* \brief CGPUProgramParams
* \date 2013-09-07 22:17GMT
* \author Jan Boon (Kaetemi)
* A storage for USERCODE-PROVIDED parameters for GPU programs.
* Allows for fast updating and iteration of parameters.
* NOTE TO DRIVER IMPLEMENTORS: DO NOT USE FOR STORING COPIES
* OF HARDCODED DRIVER MATERIAL PARAMETERS OR DRIVER PARAMETERS!!!
* The 4-component alignment that is done in this storage
* class is necessary to simplify support for register-based
* assembly shaders, which require setting per 4 components.
*/
class CGPUProgramParams
{
public:
enum TType { Float, Int, UInt };
struct CMeta { uint Index, Size, Count; TType Type; std::string Name; size_t Next, Prev; }; // size is element size, count is nb of elements
private:
union CVec { float F[4]; sint32 I[4]; uint32 UI[4]; };
public:
CGPUProgramParams();
virtual ~CGPUProgramParams();
/// \name User functions
// @{
// Copy from another params storage
void copy(CGPUProgramParams *params);
// Set by index, available only when the associated program has been compiled
void set1f(uint index, float f0);
void set2f(uint index, float f0, float f1);
void set3f(uint index, float f0, float f1, float f2);
void set4f(uint index, float f0, float f1, float f2, float f3);
void set1i(uint index, sint32 i0);
void set2i(uint index, sint32 i0, sint32 i1);
void set3i(uint index, sint32 i0, sint32 i1, sint32 i2);
void set4i(uint index, sint32 i0, sint32 i1, sint32 i2, sint32 i3);
void set1ui(uint index, uint32 ui0);
void set2ui(uint index, uint32 ui0, uint32 ui1);
void set3ui(uint index, uint32 ui0, uint32 ui1, uint32 ui2);
void set4ui(uint index, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3);
void set3f(uint index, const NLMISC::CVector& v);
void set4f(uint index, const NLMISC::CVector& v, float f3);
void set4x4f(uint index, const NLMISC::CMatrix& m);
void set4fv(uint index, size_t num, const float *src);
void set4iv(uint index, size_t num, const sint32 *src);
void set4uiv(uint index, size_t num, const uint32 *src);
void unset(uint index);
// Set by name, it is recommended to use index when repeatedly setting an element
void set1f(const std::string &name, float f0);
void set2f(const std::string &name, float f0, float f1);
void set3f(const std::string &name, float f0, float f1, float f2);
void set4f(const std::string &name, float f0, float f1, float f2, float f3);
void set1i(const std::string &name, sint32 i0);
void set2i(const std::string &name, sint32 i0, sint32 i1);
void set3i(const std::string &name, sint32 i0, sint32 i1, sint32 i2);
void set4i(const std::string &name, sint32 i0, sint32 i1, sint32 i2, sint32 i3);
void set1ui(const std::string &name, uint32 ui0);
void set2ui(const std::string &name, uint32 ui0, uint32 ui1);
void set3ui(const std::string &name, uint32 ui0, uint32 ui1, uint32 ui2);
void set4ui(const std::string &name, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3);
void set3f(const std::string &name, const NLMISC::CVector& v);
void set4f(const std::string &name, const NLMISC::CVector& v, float f3);
void set4x4f(const std::string &name, const NLMISC::CMatrix& m);
void set4fv(const std::string &name, size_t num, const float *src);
void set4iv(const std::string &name, size_t num, const sint32 *src);
void set4uiv(const std::string &name, size_t num, const uint32 *src);
void unset(const std::string &name);
// @}
// Maps the given name to the given index.
// on duplicate entry the data set by name will be prefered, as it can be
// assumed to have been set after the data set by index, and the mapping
// will usually happen while iterating and finding an element with name
// but no known index.
// Unknown index will be set to ~0, unknown name will have an empty string.
void map(uint index, const std::string &name);
/// \name Internal
// @{
/// Allocate specified number of components if necessary (internal use only)
size_t allocOffset(uint index, uint size, uint count, TType type);
size_t allocOffset(const std::string &name, uint size, uint count, TType type);
size_t allocOffset(uint size, uint count, TType type);
/// Return offset for specified index
size_t getOffset(uint index) const;
size_t getOffset(const std::string &name) const;
/// Remove by offset
void freeOffset(size_t offset);
// @}
/// \name Driver and dev tools
// @{
// Iteration (returns the offsets for access using getFooByOffset)
inline size_t getBegin() const { return m_Meta.size() ? m_First : s_End; }
inline size_t getNext(size_t offset) const { return m_Meta[offset].Next; }
inline size_t getEnd() const { return s_End; }
// Data access
inline uint getSizeByOffset(size_t offset) const { return m_Meta[offset].Size; } // size of element (4 for float4)
inline uint getCountByOffset(size_t offset) const { return m_Meta[offset].Count; } // number of elements (usually 1)
inline uint getNbComponentsByOffset(size_t offset) const { return m_Meta[offset].Size * m_Meta[offset].Count; } // nb of components (size * count)
inline float *getPtrFByOffset(size_t offset) { return m_Vec[offset].F; }
inline sint32 *getPtrIByOffset(size_t offset) { return m_Vec[offset].I; }
inline uint32 *getPtrUIByOffset(size_t offset) { return m_Vec[offset].UI; }
inline TType getTypeByOffset(size_t offset) const { return m_Meta[offset].Type; }
inline uint getIndexByOffset(size_t offset) const { return m_Meta[offset].Index; }
const std::string &getNameByOffset(size_t offset) const { return m_Meta[offset].Name; };
// @}
// Utility
static inline uint getNbRegistersByComponents(uint nbComponents) { return (nbComponents + 3) >> 2; } // vector register per 4 components
private:
std::vector<CVec> m_Vec;
std::vector<CMeta> m_Meta;
std::vector<size_t> m_Map; // map from index to offset
std::map<std::string, size_t> m_MapName; // map from name to offset
size_t m_First;
size_t m_Last;
static const size_t s_End = -1;
}; /* class CGPUProgramParams */
} /* namespace NL3D */
#endif /* #ifndef NL3D_GPU_PROGRAM_PARAMS_H */
/* end of file */

View file

@ -21,6 +21,7 @@
#include "nel/misc/smart_ptr.h"
#include "nel/3d/tessellation.h"
#include "nel/3d/vertex_buffer.h"
#include "nel/3d/vertex_program.h"
namespace NL3D
@ -41,6 +42,7 @@ class CVertexProgram;
#define NL3D_LANDSCAPE_VPPOS_DELTAPOS (CVertexBuffer::TexCoord3)
#define NL3D_LANDSCAPE_VPPOS_ALPHAINFO (CVertexBuffer::TexCoord4)
class CVertexProgramLandscape;
// ***************************************************************************
/**
@ -107,6 +109,8 @@ public:
* Give a vertexProgram Id to activate. Always 0, but 1 For tile Lightmap Pass.
*/
void activate(uint vpId);
void activateVP(uint vpId);
inline CVertexProgramLandscape *getVP(uint vpId) const { return _VertexProgram[vpId]; }
// @}
@ -151,15 +155,35 @@ private:
/// \name Vertex Program mgt .
// @{
public:
enum {MaxVertexProgram= 2,};
// Vertex Program , NULL if not enabled.
CVertexProgram *_VertexProgram[MaxVertexProgram];
private:
NLMISC::CSmartPtr<CVertexProgramLandscape> _VertexProgram[MaxVertexProgram];
void deleteVertexProgram();
void setupVBFormatAndVertexProgram(bool withVertexProgram);
// @}
};
class CVertexProgramLandscape : public CVertexProgram
{
public:
struct CIdx
{
uint ProgramConstants0;
uint RefineCenter;
uint TileDist;
uint PZBModelPosition;
};
CVertexProgramLandscape(CLandscapeVBAllocator::TType type, bool lightMap = false);
virtual ~CVertexProgramLandscape() { }
virtual void buildInfo();
public:
const CIdx &idx() const { return m_Idx; }
CIdx m_Idx;
};
} // NL3D

View file

@ -22,7 +22,6 @@
#include "nel/misc/rgba.h"
#include "nel/misc/matrix.h"
#include "nel/3d/texture.h"
#include "nel/3d/shader.h"
#include <memory>
@ -171,7 +170,8 @@ public:
* - Alpha of texture in stage 0 is blended with alpha of texture in stage 1. Blend done with the alpha color of each
* stage and the whole is multiplied by the alpha in color vertex [AT0*ADiffuseCol+AT1*(1-ADiffuseCol)]*AStage
* - RGB still unchanged
*
* Water :
* - Water
*/
enum TShader { Normal=0,
Bump,
@ -183,7 +183,8 @@ public:
PerPixelLightingNoSpec,
Cloud,
Water,
shaderCount};
shaderCount,
Program /* internally used when a pixel program is active */ };
/// \name Texture Env Modes.
// @{

View file

@ -27,6 +27,7 @@
namespace NL3D {
class CVertexProgramPerPixelLight;
/**
* This vertex program is used to perform perpixel lighting with meshs. Its outputs are :
@ -49,6 +50,8 @@ namespace NL3D {
class CMeshVPPerPixelLight : public IMeshVertexProgram
{
public:
friend class CVertexProgramPerPixelLight;
/// true if want Specular Lighting.
bool SpecularLighting;
public:
@ -84,7 +87,9 @@ private:
bool _IsPointLight;
//
enum { NumVp = 8};
static std::auto_ptr<CVertexProgram> _VertexProgram[NumVp];
static NLMISC::CSmartPtr<CVertexProgramPerPixelLight> _VertexProgram[NumVp];
NLMISC::CRefPtr<CVertexProgramPerPixelLight> _ActiveVertexProgram;
};
} // NL3D

View file

@ -24,6 +24,7 @@
namespace NL3D {
class CVertexProgramWindTree;
// ***************************************************************************
/**
@ -35,6 +36,7 @@ namespace NL3D {
class CMeshVPWindTree : public IMeshVertexProgram
{
public:
friend class CVertexProgramWindTree;
enum {HrcDepth= 3};
@ -104,6 +106,7 @@ public:
// @}
private:
static void initVertexPrograms();
void setupLighting(CScene *scene, CMeshBaseInstance *mbi, const NLMISC::CMatrix &invertedModelMat);
private:
@ -112,7 +115,9 @@ private:
/** The 16 versions: Specular or not (0 or 2), + normalize normal or not (0 or 1).
* All multiplied by 4, because support from 0 to 3 pointLights activated. (0.., 4.., 8.., 12..)
*/
static std::auto_ptr<CVertexProgram> _VertexProgram[NumVp];
static NLMISC::CSmartPtr<CVertexProgramWindTree> _VertexProgram[NumVp];
NLMISC::CRefPtr<CVertexProgramWindTree> _ActiveVertexProgram;
// WindTree Time for this mesh param setup. Stored in mesh because same for all instances.
float _CurrentTime[HrcDepth];

View file

@ -0,0 +1,49 @@
/** \file pixel_program.h
* Pixel program definition
*/
/* Copyright, 2000, 2001 Nevrax Ltd.
*
* This file is part of NEVRAX NEL.
* NEVRAX NEL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* NEVRAX NEL is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with NEVRAX NEL; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
#ifndef NL_PIXEL_PROGRAM_H
#define NL_PIXEL_PROGRAM_H
#include <nel/misc/types_nl.h>
#include <nel/misc/smart_ptr.h>
#include <nel/3d/program.h>
#include <list>
namespace NL3D {
class CPixelProgram : public IProgram
{
public:
/// Constructor
CPixelProgram();
/// Destructor
virtual ~CPixelProgram ();
};
} // NL3D
#endif // NL_PIXEL_PROGRAM_H
/* End of vertex_program.h */

View file

@ -0,0 +1,264 @@
/**
* \file program.h
* \brief IProgram
* \date 2013-09-07 15:00GMT
* \author Jan Boon (Kaetemi)
* IProgram
*/
/*
* Copyright (C) 2013 by authors
*
* This file is part of NL3D.
* NL3D is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* NL3D is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
* Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef NL3D_PROGRAM_H
#define NL3D_PROGRAM_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
#include <nel/misc/smart_ptr.h>
// Project includes
namespace NL3D {
// List typedef.
class IDriver;
class IProgramDrvInfos;
typedef std::list<IProgramDrvInfos*> TGPUPrgDrvInfoPtrList;
typedef TGPUPrgDrvInfoPtrList::iterator ItGPUPrgDrvInfoPtrList;
// Class for interaction of vertex program with Driver.
// IProgramDrvInfos represent the real data of the GPU program, stored into the driver (eg: just a GLint for opengl).
class IProgramDrvInfos : public NLMISC::CRefCount
{
private:
IDriver *_Driver;
ItGPUPrgDrvInfoPtrList _DriverIterator;
public:
IProgramDrvInfos (IDriver *drv, ItGPUPrgDrvInfoPtrList it);
// The virtual dtor is important.
virtual ~IProgramDrvInfos(void);
virtual uint getUniformIndex(const char *name) const = 0;
};
// Features exposed by a program. Used to set builtin parameters on user provided shaders.
// This is only used for user provided shaders, not for builtin shaders,
// as it is a slow method which has to go through all of the options every time.
// Builtin shaders should set all flags to 0.
// Example:
// User shader flags Matrices in the Vertex Program:
// -> When rendering with a material, the driver will call setUniformDriver,
// which will check if the flag Matrices exists, and if so, it will use
// the index cache to find which matrices are needed by the shader,
// and set those which are found.
// This does not work extremely efficient, but it's the most practical option
// for passing builtin parameters onto user provided shaders.
// Note: May need additional flags related to scene sorting, etcetera.
struct CProgramFeatures
{
CProgramFeatures() : DriverFlags(0), MaterialFlags(0) { }
// Driver builtin parameters
enum TDriverFlags
{
// Matrices
Matrices = 0x00000001,
// Fog
Fog = 0x00000002,
};
uint32 DriverFlags;
enum TMaterialFlags
{
/// Use the CMaterial texture stages as the textures for a Pixel Program
TextureStages = 0x00000001,
TextureMatrices = 0x00000002,
};
// Material builtin parameters
uint32 MaterialFlags;
};
// Stucture used to cache the indices of builtin parameters which are used by the drivers
// Not used for parameters of specific nl3d programs
struct CProgramIndex
{
enum TName
{
ModelView,
ModelViewInverse,
ModelViewTranspose,
ModelViewInverseTranspose,
Projection,
ProjectionInverse,
ProjectionTranspose,
ProjectionInverseTranspose,
ModelViewProjection,
ModelViewProjectionInverse,
ModelViewProjectionTranspose,
ModelViewProjectionInverseTranspose,
Fog,
NUM_UNIFORMS
};
static const char *Names[NUM_UNIFORMS];
uint Indices[NUM_UNIFORMS];
};
/**
* \brief IProgram
* \date 2013-09-07 15:00GMT
* \author Jan Boon (Kaetemi)
* A generic GPU program
*/
class IProgram : public NLMISC::CRefCount
{
public:
enum TProfile
{
none = 0,
// types
// Vertex Shader = 0x01
// Pixel Shader = 0x02
// Geometry Shader = 0x03
// nel - 0x31,type,bitfield
nelvp = 0x31010001, // VP supported by CVertexProgramParser, similar to arbvp1, can be translated to vs_1_1
// direct3d - 0xD9,type,major,minor
// vertex programs
vs_1_1 = 0xD9010101,
vs_2_0 = 0xD9010200,
// vs_2_sw = 0xD9010201, // not sure...
// vs_2_x = 0xD9010202, // not sure...
// vs_3_0 = 0xD9010300, // not supported
// pixel programs
ps_1_1 = 0xD9020101,
ps_1_2 = 0xD9020102,
ps_1_3 = 0xD9020103,
ps_1_4 = 0xD9020104,
ps_2_0 = 0xD9020200,
// ps_2_x = 0xD9020201, // not sure...
// ps_3_0 = 0xD9020300, // not supported
// opengl - 0x61,type,bitfield
// vertex programs
// vp20 = 0x61010001, // NV_vertex_program1_1, outdated
arbvp1 = 0x61010002, // ARB_vertex_program
vp30 = 0x61010004, // NV_vertex_program2
vp40 = 0x61010008, // NV_vertex_program3 + NV_fragment_program3
gp4vp = 0x61010010, // NV_gpu_program4
gp5vp = 0x61010020, // NV_gpu_program5
// pixel programs
// fp20 = 0x61020001, // very limited and outdated, unnecessary
// fp30 = 0x61020002, // NV_fragment_program, now arbfp1, redundant
arbfp1 = 0x61020004, // ARB_fragment_program
fp40 = 0x61020008, // NV_fragment_program2, arbfp1 with "OPTION NV_fragment_program2;\n"
gp4fp = 0x61020010, // NV_gpu_program4
gp5fp = 0x61020020, // NV_gpu_program5
// geometry programs
gp4gp = 0x61030001, // NV_gpu_program4
gp5gp = 0x61030001, // NV_gpu_program5
// glsl - 0x65,type,version
glsl330v = 0x65010330, // GLSL vertex program version 330
glsl330f = 0x65020330, // GLSL fragment program version 330
glsl330g = 0x65030330, // GLSL geometry program version 330
};
struct CSource : public NLMISC::CRefCount
{
public:
std::string DisplayName;
/// Minimal required profile for this GPU program
IProgram::TProfile Profile;
const char *SourcePtr;
size_t SourceLen;
/// Copy the source code string
inline void setSource(const std::string &source) { SourceCopy = source; SourcePtr = &SourceCopy[0]; SourceLen = SourceCopy.size(); }
inline void setSource(const char *source) { SourceCopy = source; SourcePtr = &SourceCopy[0]; SourceLen = SourceCopy.size(); }
/// Set pointer to source code string without copying the string
inline void setSourcePtr(const char *sourcePtr, size_t sourceLen) { SourceCopy.clear(); SourcePtr = sourcePtr; SourceLen = sourceLen; }
inline void setSourcePtr(const char *sourcePtr) { SourceCopy.clear(); SourcePtr = sourcePtr; SourceLen = strlen(sourcePtr); }
/// CVertexProgramInfo/CPixelProgramInfo/... NeL features
CProgramFeatures Features;
/// Map with known parameter indices, used for assembly programs
std::map<std::string, uint> ParamIndices;
private:
std::string SourceCopy;
};
public:
IProgram();
virtual ~IProgram();
// Manage the sources, not allowed after compilation.
// Add multiple sources using different profiles, the driver will use the first one it supports.
inline size_t getSourceNb() const { return m_Sources.size(); };
inline CSource *getSource(size_t i) const { return m_Sources[i]; };
inline size_t addSource(CSource *source) { nlassert(!m_Source); m_Sources.push_back(source); return (m_Sources.size() - 1); }
inline void removeSource(size_t i) { nlassert(!m_Source); m_Sources.erase(m_Sources.begin() + i); }
// Get the idx of a parameter (ogl: uniform, d3d: constant, etcetera) by name. Invalid name returns ~0
inline uint getUniformIndex(const char *name) const { return m_DrvInfo->getUniformIndex(name); };
inline uint getUniformIndex(const std::string &name) const { return m_DrvInfo->getUniformIndex(name.c_str()); };
inline uint getUniformIndex(CProgramIndex::TName name) const { return m_Index.Indices[name]; }
// Get feature information of the current program
inline CSource *source() const { return m_Source; };
inline const CProgramFeatures &features() const { return m_Source->Features; };
inline TProfile profile() const { return m_Source->Profile; }
// Build feature info, called automatically by the driver after compile succeeds
void buildInfo(CSource *source);
// Override this to build additional info in a subclass
virtual void buildInfo();
protected:
/// The progam source
std::vector<NLMISC::CSmartPtr<CSource> > m_Sources;
/// The source used for compilation
NLMISC::CSmartPtr<CSource> m_Source;
CProgramIndex m_Index;
public:
/// The driver information. For the driver implementation only.
NLMISC::CRefPtr<IProgramDrvInfos> m_DrvInfo;
}; /* class IProgram */
} /* namespace NL3D */
#endif /* #ifndef NL3D_PROGRAM_H */
/* end of file */

View file

@ -128,7 +128,7 @@ inline uint32 CPSAttribMakerBinOp<uint32>::getMinValue(void) const
{
uint32 lhs = _Arg[0]->getMinValue();
uint32 rhs = _Arg[1]->getMaxValue();
return lhs > rhs ? 0 : lhs - rhs;
return rhs > lhs ? 0 : lhs - rhs;
}
break;
default:
@ -153,7 +153,7 @@ inline uint32 CPSAttribMakerBinOp<uint32>::getMaxValue(void) const
{
uint32 lhs = _Arg[0]->getMaxValue();
uint32 rhs = _Arg[1]->getMinValue();
return lhs > rhs ? 0 : lhs - rhs;
return rhs > lhs ? 0 : lhs - rhs;
}
break;
default:

View file

@ -27,6 +27,7 @@
#include "nel/3d/mesh_block_manager.h"
#include "nel/3d/shadow_map_manager.h"
#include "nel/3d/u_scene.h"
#include "nel/3d/vertex_program.h"
#include <vector>
@ -68,6 +69,41 @@ class CWaterModel;
#define NL3D_SHADOW_MESH_SKIN_MANAGER_MAXVERTICES 3000
#define NL3D_SHADOW_MESH_SKIN_MANAGER_NUMVB 8
/// Container for lighted vertex program.
class CVertexProgramLighted : public CVertexProgram
{
public:
static const uint MaxLight = 4;
static const uint MaxPointLight = (MaxLight - 1);
struct CIdxLighted
{
uint Ambient;
uint Diffuse[MaxLight];
uint Specular[MaxLight];
uint DirOrPos[MaxLight]; // light 0, directional sun; light 1,2,3, omni point light
uint EyePosition;
uint DiffuseAlpha;
};
struct CFeaturesLighted
{
/// Number of point lights that this program is generated for, varies from 0 to 3.
uint NumActivePointLights;
bool SupportSpecular;
bool Normalize;
/// Start of constants to use for lighting with assembly shaders.
uint CtStartNeLVP;
};
CVertexProgramLighted() { }
virtual ~CVertexProgramLighted() { }
virtual void buildInfo();
const CIdxLighted &idxLighted() const { return m_IdxLighted; }
const CFeaturesLighted &featuresLighted() const { return m_FeaturesLighted; }
protected:
CIdxLighted m_IdxLighted;
CFeaturesLighted m_FeaturesLighted;
};
// ***************************************************************************
@ -224,7 +260,7 @@ public:
// @{
// Max VP Light setup Infos.
enum {MaxVPLight= 4};
enum {MaxVPLight = CVertexProgramLighted::MaxLight};
/** reset the lighting setup in the driver (all lights are disabled).
* called at beginning of traverse(). Must be called by any model (before and after rendering)
@ -244,7 +280,8 @@ public:
*/
void changeLightSetup(CLightContribution *lightContribution, bool useLocalAttenuation);
/// Must call before beginVPLightSetup
void prepareVPLightSetup();
/** setup the driver VP constants to get info from current LightSetup.
* Only 0..3 Light + SunLights are supported. The VP do NOT support distance/Spot attenuation
* Also it does not handle World Matrix with non uniform scale correctly since lighting is made in ObjectSpace
@ -253,7 +290,7 @@ public:
* \param supportSpecular asitsounds. PointLights and dirLight are localViewer
* \param invObjectWM the inverse of object matrix: lights are mul by this. Vp compute in object space.
*/
void beginVPLightSetup(uint ctStart, bool supportSpecular, const CMatrix &invObjectWM);
void beginVPLightSetup(CVertexProgramLighted *program, const CMatrix &invObjectWM);
/** change the driver VP LightSetup constants which depends on material.
* \param excludeStrongest This remove the strongest light from the setup. The typical use is to have it computed by using perpixel lighting.
@ -299,7 +336,8 @@ public:
* \param numActivePoinLights tells how many point light from 0 to 3 this VP must handle. NB: the Sun directionnal is not option
* NB: nlassert(numActiveLights<=MaxVPLight-1).
*/
static std::string getLightVPFragment(uint numActivePointLights, uint ctStart, bool supportSpecular, bool normalize);
static std::string getLightVPFragmentNeLVP(uint numActivePointLights, uint ctStart, bool supportSpecular, bool normalize);
// TODO_VP_GLSL
/** This returns a reference to a driver light, by its index
* \see getStrongestLightIndex
@ -381,12 +419,14 @@ private:
mutable uint _StrongestLightIndex;
mutable bool _StrongestLightTouched;
// Current vp setuped with beginVPLightSetup()
NLMISC::CRefPtr<CVertexProgramLighted> _VPCurrent;
// Current ctStart setuped with beginVPLightSetup()
uint _VPCurrentCtStart;
//uint _VPCurrentCtStart;
// Current num of VP lights enabled.
uint _VPNumLights;
// Current support of specular
bool _VPSupportSpecular;
// bool _VPSupportSpecular;
// Sum of all ambiant of all lights + ambiantGlobal.
NLMISC::CRGBAF _VPFinalAmbient;
// Diffuse/Spec comp of all light / 255.

View file

@ -826,7 +826,8 @@ private:
void flushSSSModelRequests();
// common vb for water display
CVertexBuffer _WaterVB;
bool _RequestParticlesAnimate;
};

View file

@ -1,99 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NL_SHADER_H
#define NL_SHADER_H
#include "nel/misc/types_nl.h"
#include "nel/misc/smart_ptr.h"
#include <list>
namespace NL3D {
using NLMISC::CRefCount;
class IDriver;
// List typedef.
class IShaderDrvInfos;
typedef std::list<IShaderDrvInfos*> TShaderDrvInfoPtrList;
typedef TShaderDrvInfoPtrList::iterator ItShaderDrvInfoPtrList;
/**
* Interface for shader driver infos.
*/
class IShaderDrvInfos : public CRefCount
{
private:
IDriver *_Driver;
ItShaderDrvInfoPtrList _DriverIterator;
public:
IShaderDrvInfos(IDriver *drv, ItShaderDrvInfoPtrList it) {_Driver= drv; _DriverIterator= it;}
// The virtual dtor is important.
virtual ~IShaderDrvInfos();
};
/**
* Shader resource for the driver. It is just a container for a ".fx" text file.
*/
/* *** IMPORTANT ********************
* *** IF YOU MODIFY THE STRUCTURE OF THIS CLASS, PLEASE INCREMENT IDriver::InterfaceVersion TO INVALIDATE OLD DRIVER DLL
* **********************************
*/
// --------------------------------------------------
class CShader
{
public:
CShader();
~CShader();
// Load a shader file
bool loadShaderFile (const char *filename);
// Set the shader text
void setText (const char *text);
// Get the shader text
const char *getText () const { return _Text.c_str(); }
// Set the shader name
void setName (const char *name);
// Get the shader name
const char *getName () const { return _Name.c_str(); }
public:
// Private. For Driver only.
bool _ShaderChanged;
NLMISC::CRefPtr<IShaderDrvInfos> _DrvInfo;
private:
// The shader
std::string _Text;
// The shader name
std::string _Name;
};
} // NL3D
#endif // NL_SHADER_H
/* End of shader.h */

View file

@ -88,7 +88,7 @@ public:
/** return the bounding box of the shape. Default is to return Null bbox.
*/
virtual void getAABBox(NLMISC::CAABBox &bbox) const;
virtual void getAABBox(NLMISC::CAABBox &bbox) const;
/// get an approximation of the number of triangles this instance will render for a fixed distance.
virtual float getNumTriangles (float distance);
@ -98,7 +98,7 @@ public:
NLMISC_DECLARE_CLASS(CSkeletonShape);
/// flush textures used by this shape.
virtual void flushTextures (IDriver &/* driver */, uint /* selectedTexture */) {}
virtual void flushTextures (IDriver &/* driver */, uint /* selectedTexture */) {}
// @}

View file

@ -0,0 +1,134 @@
/**
* \file stereo_debugger.h
* \brief CStereoDebugger
* \date 2013-07-03 20:17GMT
* \author Jan Boon (Kaetemi)
* CStereoDebugger
*/
/*
* Copyright (C) 2013 by authors
*
* This file is part of NL3D.
* NL3D is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* NL3D is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
* Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*/
#if !FINAL_VERSION
#ifndef NL3D_STEREO_DEBUGGER_H
#define NL3D_STEREO_DEBUGGER_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
#include <nel/misc/smart_ptr.h>
#include <nel/misc/geom_ext.h>
// Project includes
#include <nel/3d/stereo_display.h>
#include <nel/3d/frustum.h>
#include <nel/3d/viewport.h>
#include <nel/3d/u_material.h>
#define NL_STEREO_MAX_USER_CAMERAS 8
namespace NL3D {
class ITexture;
class CTextureUser;
class CPixelProgram;
/**
* \brief CStereoDebugger
* \date 2013-07-03 20:17GMT
* \author Jan Boon (Kaetemi)
* CStereoDebugger
*/
class CStereoDebugger : public IStereoDisplay
{
public:
CStereoDebugger();
virtual ~CStereoDebugger();
/// Sets driver and generates necessary render targets
virtual void setDriver(NL3D::UDriver *driver);
void releaseTextures();
void initTextures();
void setTextures();
void verifyTextures();
/// Gets the required screen resolution for this device
virtual bool getScreenResolution(uint &width, uint &height);
/// Set latest camera position etcetera
virtual void updateCamera(uint cid, const NL3D::UCamera *camera);
/// Get the frustum to use for clipping
virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const;
/// Is there a next pass
virtual bool nextPass();
/// Gets the current viewport
virtual const NL3D::CViewport &getCurrentViewport() const;
/// Gets the current camera frustum
virtual const NL3D::CFrustum &getCurrentFrustum(uint cid) const;
/// Gets the current camera frustum
virtual void getCurrentFrustum(uint cid, NL3D::UCamera *camera) const;
/// Gets the current camera matrix
virtual void getCurrentMatrix(uint cid, NL3D::UCamera *camera) const;
/// At the start of a new render target
virtual bool wantClear();
/// The 3D scene
virtual bool wantScene();
/// Interface within the 3D scene
virtual bool wantInterface3D();
/// 2D Interface
virtual bool wantInterface2D();
/// Returns true if a new render target was set, always fase if not using render targets
virtual bool beginRenderTarget();
/// Returns true if a render target was fully drawn, always false if not using render targets
virtual bool endRenderTarget();
static void listDevices(std::vector<CStereoDeviceInfo> &devicesOut);
private:
UDriver *m_Driver;
int m_Stage;
int m_SubStage;
CViewport m_LeftViewport;
CViewport m_RightViewport;
CFrustum m_Frustum[NL_STEREO_MAX_USER_CAMERAS];
CMatrix m_CameraMatrix[NL_STEREO_MAX_USER_CAMERAS];
NLMISC::CSmartPtr<NL3D::ITexture> m_LeftTex;
NL3D::CTextureUser *m_LeftTexU;
NLMISC::CSmartPtr<NL3D::ITexture> m_RightTex;
NL3D::CTextureUser *m_RightTexU;
NL3D::UMaterial m_Mat;
NLMISC::CQuadUV m_QuadUV;
CPixelProgram *m_PixelProgram;
}; /* class CStereoDebugger */
} /* namespace NL3D */
#endif /* #ifndef NL3D_STEREO_DEBUGGER_H */
#endif /* #if !FINAL_VERSION */
/* end of file */

View file

@ -0,0 +1,143 @@
/**
* \file stereo_display.h
* \brief IStereoDisplay
* \date 2013-06-27 16:29GMT
* \author Jan Boon (Kaetemi)
* IStereoDisplay
*/
/*
* Copyright (C) 2013 by authors
*
* This file is part of NL3D.
* NL3D is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* NL3D is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
* Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef NL3D_STEREO_DISPLAY_H
#define NL3D_STEREO_DISPLAY_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
#include <nel/misc/smart_ptr.h>
// Project includes
namespace NL3D {
class UCamera;
class CViewport;
class CFrustum;
class IStereoDisplay;
class UTexture;
class UDriver;
class IStereoDeviceFactory : public NLMISC::CRefCount
{
public:
IStereoDeviceFactory() { }
virtual ~IStereoDeviceFactory() { }
virtual IStereoDisplay *createDevice() const = 0;
};
struct CStereoDeviceInfo
{
public:
enum TStereoDeviceClass
{
StereoDisplay,
StereoHMD,
StereoNGHMD,
};
enum TStereoDeviceLibrary
{
NeL3D,
OVR,
LibVR,
OpenHMD,
};
NLMISC::CSmartPtr<IStereoDeviceFactory> Factory;
TStereoDeviceLibrary Library;
TStereoDeviceClass Class;
std::string Manufacturer;
std::string ProductName;
std::string Serial; // A unique device identifier
bool AllowAuto; // Allow this device to be automatically selected when no device is configured
};
/**
* \brief IStereoDisplay
* \date 2013-06-27 16:29GMT
* \author Jan Boon (Kaetemi)
* IStereoDisplay
*/
class IStereoDisplay
{
public:
IStereoDisplay();
virtual ~IStereoDisplay();
/// Sets driver and generates necessary render targets
virtual void setDriver(NL3D::UDriver *driver) = 0;
/// Gets the required screen resolution for this device
virtual bool getScreenResolution(uint &width, uint &height) = 0;
/// Set latest camera position etcetera
virtual void updateCamera(uint cid, const NL3D::UCamera *camera) = 0;
/// Get the frustum to use for clipping
virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const = 0;
/// Is there a next pass
virtual bool nextPass() = 0;
/// Gets the current viewport
virtual const NL3D::CViewport &getCurrentViewport() const = 0;
/// Gets the current camera frustum
virtual const NL3D::CFrustum &getCurrentFrustum(uint cid) const = 0;
/// Gets the current camera frustum
virtual void getCurrentFrustum(uint cid, NL3D::UCamera *camera) const = 0;
/// Gets the current camera matrix
virtual void getCurrentMatrix(uint cid, NL3D::UCamera *camera) const = 0;
/// At the start of a new render target
virtual bool wantClear() = 0;
/// The 3D scene
virtual bool wantScene() = 0;
/// Interface within the 3D scene
virtual bool wantInterface3D() = 0;
/// 2D Interface
virtual bool wantInterface2D() = 0;
/// Returns true if a new render target was set, always fase if not using render targets
virtual bool beginRenderTarget() = 0;
/// Returns true if a render target was fully drawn, always false if not using render targets
virtual bool endRenderTarget() = 0;
static const char *getLibraryName(CStereoDeviceInfo::TStereoDeviceLibrary library);
static void listDevices(std::vector<CStereoDeviceInfo> &devicesOut);
static IStereoDisplay *createDevice(const CStereoDeviceInfo &deviceInfo);
static void releaseUnusedLibraries();
static void releaseAllLibraries();
}; /* class IStereoDisplay */
} /* namespace NL3D */
#endif /* #ifndef NL3D_STEREO_DISPLAY_H */
/* end of file */

View file

@ -0,0 +1,73 @@
/**
* \file stereo_hmd.h
* \brief IStereoHMD
* \date 2013-06-27 16:30GMT
* \author Jan Boon (Kaetemi)
* IStereoHMD
*/
/*
* Copyright (C) 2013 by authors
*
* This file is part of NL3D.
* NL3D is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* NL3D is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
* Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef NL3D_STEREO_HMD_H
#define NL3D_STEREO_HMD_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
#include <nel/3d/stereo_display.h>
namespace NL3D {
/**
* \brief IStereoHMD
* \date 2013-06-27 16:30GMT
* \author Jan Boon (Kaetemi)
* IStereoHMD
*/
class IStereoHMD : public IStereoDisplay
{
public:
IStereoHMD();
virtual ~IStereoHMD();
/// Get the HMD orientation
virtual NLMISC::CQuat getOrientation() const = 0;
/// Get GUI center (1 = width, 1 = height, 0 = center)
virtual void getInterface2DShift(uint cid, float &x, float &y, float distance) const = 0;
/// Set the head model, eye position relative to orientation point
virtual void setEyePosition(const NLMISC::CVector &v) = 0;
/// Get the head model, eye position relative to orientation point
virtual const NLMISC::CVector &getEyePosition() const = 0;
/// Set the scale of the game in units per meter
virtual void setScale(float s) = 0;
}; /* class IStereoHMD */
} /* namespace NL3D */
#endif /* #ifndef NL3D_STEREO_HMD_H */
/* end of file */

View file

@ -0,0 +1,160 @@
/**
* \file stereo_libvr.h
* \brief CStereoLibVR
* \date 2013-08-19 19:17MT
* \author Thibaut Girka (ThibG)
* CStereoLibVR
*/
/*
* Copyright (C) 2013 by authors
*
* This file is part of NL3D.
* NL3D is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* NL3D is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
* Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef NL3D_STEREO_LIBVR_H
#define NL3D_STEREO_LIBVR_H
#ifdef HAVE_LIBVR
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
#include <nel/misc/smart_ptr.h>
#include <nel/misc/geom_ext.h>
// Project includes
#include <nel/3d/stereo_hmd.h>
#include <nel/3d/frustum.h>
#include <nel/3d/viewport.h>
#include <nel/3d/u_material.h>
namespace NL3D {
class ITexture;
class CTextureUser;
class CStereoLibVRDevicePtr;
class CStereoLibVRDeviceHandle;
class CPixelProgram;
#define NL_STEREO_MAX_USER_CAMERAS 8
/**
* \brief CStereoOVR
* \date 2013-06-25 22:22GMT
* \author Jan Boon (Kaetemi)
* CStereoOVR
*/
class CStereoLibVR : public IStereoHMD
{
public:
CStereoLibVR(const CStereoLibVRDeviceHandle *handle);
virtual ~CStereoLibVR();
/// Sets driver and generates necessary render targets
virtual void setDriver(NL3D::UDriver *driver);
/// Gets the required screen resolution for this device
virtual bool getScreenResolution(uint &width, uint &height);
/// Set latest camera position etcetera
virtual void updateCamera(uint cid, const NL3D::UCamera *camera);
/// Get the frustum to use for clipping
virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const;
/// Is there a next pass
virtual bool nextPass();
/// Gets the current viewport
virtual const NL3D::CViewport &getCurrentViewport() const;
/// Gets the current camera frustum
virtual const NL3D::CFrustum &getCurrentFrustum(uint cid) const;
/// Gets the current camera frustum
virtual void getCurrentFrustum(uint cid, NL3D::UCamera *camera) const;
/// Gets the current camera matrix
virtual void getCurrentMatrix(uint cid, NL3D::UCamera *camera) const;
/// At the start of a new render target
virtual bool wantClear();
/// The 3D scene
virtual bool wantScene();
/// Interface within the 3D scene
virtual bool wantInterface3D();
/// 2D Interface
virtual bool wantInterface2D();
/// Returns true if a new render target was set, always fase if not using render targets
virtual bool beginRenderTarget();
/// Returns true if a render target was fully drawn, always false if not using render targets
virtual bool endRenderTarget();
/// Get the HMD orientation
virtual NLMISC::CQuat getOrientation() const;
/// Get GUI center (1 = width, 1 = height, 0 = center)
virtual void getInterface2DShift(uint cid, float &x, float &y, float distance) const;
/// Set the head model, eye position relative to orientation point
virtual void setEyePosition(const NLMISC::CVector &v);
/// Get the head model, eye position relative to orientation point
virtual const NLMISC::CVector &getEyePosition() const;
/// Set the scale of the game in units per meter
virtual void setScale(float s);
static void listDevices(std::vector<CStereoDeviceInfo> &devicesOut);
static bool isLibraryInUse();
static void releaseLibrary();
/// Calculates internal camera information based on the reference camera
void initCamera(uint cid, const NL3D::UCamera *camera);
/// Checks if the device used by this class was actually created
bool isDeviceCreated();
private:
CStereoLibVRDevicePtr *m_DevicePtr;
int m_Stage;
int m_SubStage;
CViewport m_LeftViewport;
CViewport m_RightViewport;
CFrustum m_ClippingFrustum[NL_STEREO_MAX_USER_CAMERAS];
CFrustum m_LeftFrustum[NL_STEREO_MAX_USER_CAMERAS];
CFrustum m_RightFrustum[NL_STEREO_MAX_USER_CAMERAS];
CMatrix m_CameraMatrix[NL_STEREO_MAX_USER_CAMERAS];
mutable bool m_OrientationCached;
mutable NLMISC::CQuat m_OrientationCache;
UDriver *m_Driver;
NLMISC::CSmartPtr<NL3D::ITexture> m_BarrelTex;
NL3D::CTextureUser *m_BarrelTexU;
NL3D::UMaterial m_BarrelMat;
NLMISC::CQuadUV m_BarrelQuadLeft;
NLMISC::CQuadUV m_BarrelQuadRight;
CPixelProgram *m_PixelProgram;
NLMISC::CVector m_EyePosition;
float m_Scale;
}; /* class CStereoLibVR */
} /* namespace NL3D */
#endif /* HAVE_LIBVR */
#endif /* #ifndef NL3D_STEREO_LIBVR_H */
/* end of file */

View file

@ -0,0 +1,62 @@
/**
* \file stereo_ng_hmd.h
* \brief IStereoNGHMD
* \date 2014-04-01 10:53GMT
* \author Jan Boon (Kaetemi)
* IStereoNGHMD
*/
/*
* Copyright (C) 2014 by authors
*
* This file is part of NL3D.
* NL3D is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* NL3D is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
* Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with NL3D. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef NL3D_STEREO_NG_HMD_H
#define NL3D_STEREO_NG_HMD_H
#include <nel/misc/types_nl.h>
// STL includes
// NeL includes
// Project includes
#include <nel/3d/stereo_hmd.h>
namespace NL3D {
/**
* \brief IStereoNGHMD
* \date 2014-04-01 10:53GMT
* \author Jan Boon (Kaetemi)
* IStereoNGHMD
*/
class IStereoNGHMD : public IStereoHMD
{
public:
IStereoNGHMD();
virtual ~IStereoNGHMD();
/// Kill the player
virtual void killUser() const = 0;
}; /* class IStereoNGHMD */
} /* namespace NL3D */
#endif /* #ifndef NL3D_STEREO_NG_HMD_H */
/* end of file */

View file

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

View file

@ -168,6 +168,7 @@ public:
*/
// @{
virtual void disableHardwareVertexProgram()=0;
virtual void disableHardwarePixelProgram()=0;
virtual void disableHardwareVertexArrayAGP()=0;
virtual void disableHardwareTextureShader()=0;
// @}
@ -672,13 +673,6 @@ public:
*/
virtual void forceTextureResize(uint divisor)=0;
/** Sets enforcement of native fragment programs. This is by default enabled.
*
* \param nativeOnly If set to false, fragment programs don't need to be native to stay loaded,
* otherwise (aka if true) they will be purged.
*/
virtual void forceNativeFragmentPrograms(bool nativeOnly) = 0;
/** Setup monitor color properties.
*
* Return false if setup failed.

View file

@ -48,6 +48,7 @@ class CVegetableLightEx;
// default distance is 60 meters.
#define NL3D_VEGETABLE_DEFAULT_DIST_MAX 60.f
class CVertexProgramVeget;
// ***************************************************************************
/**
@ -306,7 +307,8 @@ private:
// The same, but no VBHard.
CVegetableVBAllocator _VBSoftAllocator[CVegetableVBAllocator::VBTypeCount];
// Vertex Program. One VertexProgram for each rdrPass (with / without fog)
CVertexProgram *_VertexProgram[NL3D_VEGETABLE_NRDRPASS][2];
CSmartPtr<CVertexProgramVeget> _VertexProgram[NL3D_VEGETABLE_NRDRPASS][2];
CRefPtr<CVertexProgramVeget> _ActiveVertexProgram;
// Material. Useful for texture and alphaTest
@ -342,7 +344,7 @@ private:
/// setup the vertexProgram constants.
void setupVertexProgramConstants(IDriver *driver);
void setupVertexProgramConstants(IDriver *driver, bool fogEnabled);
/** swap the RdrPass type (hard or soft) of the rdrPass of an instance group.

View file

@ -19,90 +19,24 @@
#include "nel/misc/types_nl.h"
#include "nel/misc/smart_ptr.h"
#include "nel/3d/program.h"
#include <list>
namespace NL3D {
// List typedef.
class IDriver;
class IVertexProgramDrvInfos;
typedef std::list<IVertexProgramDrvInfos*> TVtxPrgDrvInfoPtrList;
typedef TVtxPrgDrvInfoPtrList::iterator ItVtxPrgDrvInfoPtrList;
// Class for interaction of vertex program with Driver.
// IVertexProgramDrvInfos represent the real data of the vertex program, stored into the driver (eg: just a GLint for opengl).
class IVertexProgramDrvInfos : public NLMISC::CRefCount
{
private:
IDriver *_Driver;
ItVtxPrgDrvInfoPtrList _DriverIterator;
public:
IVertexProgramDrvInfos (IDriver *drv, ItVtxPrgDrvInfoPtrList it);
// The virtual dtor is important.
virtual ~IVertexProgramDrvInfos(void);
};
/**
* This class is a vertex program.
*
* D3D / OPENGL compatibility notes:
* ---------------------------------
*
* To make your program compatible with D3D and OPENGL nel drivers, please follow thoses directives to write your vertex programs
*
* - Use only v[0], v[1] etc.. syntax for input registers. Don't use v0, v1 or v[OPOS] etc..
* - Use only c[0], c[1] etc.. syntax for constant registers. Don't use c0, c1 etc..
* - Use only o[HPOS], o[COL0] etc.. syntax for output registers. Don't use oPos, oD0 etc..
* - Use only uppercase for registers R1, R2 etc.. Don't use lowercase r1, r2 etc..
* - Use a semicolon to delineate instructions.
* - Use ARL instruction to load the adress register and not MOV.
* - Don't use the NOP instruction.
* - Don't use macros.
*
* -> Thoses programs work without any change under OpenGL.
* -> Direct3D driver implementation will have to modify the syntax on the fly before the setup like this:
* - "v[0]" must be changed in "v0" etc..
* - "o[HPOS]" must be changed in oPos etc..
* - Semicolon must be changed in line return character.
* - ARL instruction must be changed in MOV.
*
* Behaviour of LOG may change depending on implementation: You can only expect to have dest.z = log2(abs(src.w)).
* LIT may or may not clamp the specular exponent to [-128, 128] (not done when EXT_vertex_shader is used for example ..)
*
* Depending on the implementation, some optimizations can be achieved by masking the unused output values of instructions
* as LIT, EXPP ..
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
class CVertexProgram : public NLMISC::CRefCount
class CVertexProgram : public IProgram
{
public:
/// Constructor
CVertexProgram (const char* program);
CVertexProgram();
CVertexProgram(const char *nelvp);
/// Destructor
virtual ~CVertexProgram ();
/// Get the program
const std::string& getProgram () const { return _Program; };
private:
/// The progam
std::string _Program;
public:
/// The driver information. For the driver implementation only.
NLMISC::CRefPtr<IVertexProgramDrvInfos> _DrvInfo;
};
} // NL3D

View file

@ -21,6 +21,40 @@
#include <vector>
/**
* This class is a vertex program.
*
* D3D / OPENGL compatibility notes:
* ---------------------------------
*
* To make your program compatible with D3D and OPENGL nel drivers, please follow thoses directives to write your vertex programs
*
* - Use only v[0], v[1] etc.. syntax for input registers. Don't use v0, v1 or v[OPOS] etc..
* - Use only c[0], c[1] etc.. syntax for constant registers. Don't use c0, c1 etc..
* - Use only o[HPOS], o[COL0] etc.. syntax for output registers. Don't use oPos, oD0 etc..
* - Use only uppercase for registers R1, R2 etc.. Don't use lowercase r1, r2 etc..
* - Use a semicolon to delineate instructions.
* - Use ARL instruction to load the adress register and not MOV.
* - Don't use the NOP instruction.
* - Don't use macros.
*
* -> Thoses programs work without any change under OpenGL.
* -> Direct3D driver implementation will have to modify the syntax on the fly before the setup like this:
* - "v[0]" must be changed in "v0" etc..
* - "o[HPOS]" must be changed in oPos etc..
* - Semicolon must be changed in line return character.
* - ARL instruction must be changed in MOV.
*
* Behaviour of LOG may change depending on implementation: You can only expect to have dest.z = log2(abs(src.w)).
* LIT may or may not clamp the specular exponent to [-128, 128] (not done when EXT_vertex_shader is used for example ..)
*
* Depending on the implementation, some optimizations can be achieved by masking the unused output values of instructions
* as LIT, EXPP ..
*
* \author Cyril 'Hulud' Corvazier
* \author Nevrax France
* \date 2001
*/
/// Swizzle of an operand in a vertex program
struct CVPSwizzle

View file

@ -61,7 +61,7 @@ public:
// Get envmap 2D texture (after projection of cube map)
ITexture *getEnvMap2D() const { return _Env2D; }
// tmp for debug : render test mesh with current model / view matrixs
void renderTestMesh(IDriver &driver);
// void renderTestMesh(IDriver &driver);
// set constant alpha of envmap
void setAlpha(uint8 alpha) { _Alpha = alpha; }
uint8 getAlpha() const { return _Alpha; }

View file

@ -49,6 +49,29 @@ const NLMISC::CClassId WaveMakerModelClassId = NLMISC::CClassId(0x16da3356, 0x7
const uint WATER_VERTEX_HARD_SIZE = sizeof(float[3]);
const uint WATER_VERTEX_SOFT_SIZE = sizeof(float[5]);
// VP Water No Wave
class CVertexProgramWaterVPNoWave : public CVertexProgram
{
public:
struct CIdx
{
uint BumpMap0Scale;
uint BumpMap0Offset;
uint BumpMap1Scale;
uint BumpMap1Offset;
uint ObserverHeight;
uint ScaleReflectedRay;
uint DiffuseMapVector0;
uint DiffuseMapVector1;
};
CVertexProgramWaterVPNoWave(bool diffuse);
virtual ~CVertexProgramWaterVPNoWave() { }
virtual void buildInfo();
inline const CIdx &idx() const { return m_Idx; }
private:
CIdx m_Idx;
bool m_Diffuse;
};
/**
* A water shape.
@ -247,17 +270,17 @@ private:
static bool _GridSizeTouched;
//
static std::auto_ptr<CVertexProgram> _VertexProgramBump1;
static std::auto_ptr<CVertexProgram> _VertexProgramBump2;
/*static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramBump1;
static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramBump2;
//
static std::auto_ptr<CVertexProgram> _VertexProgramBump1Diffuse;
static std::auto_ptr<CVertexProgram> _VertexProgramBump2Diffuse;
static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramBump1Diffuse;
static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramBump2Diffuse;
//
static std::auto_ptr<CVertexProgram> _VertexProgramNoBump;
static std::auto_ptr<CVertexProgram> _VertexProgramNoBumpDiffuse;
static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramNoBump;
static NLMISC::CSmartPtr<CVertexProgram> _VertexProgramNoBumpDiffuse;*/
//
static std::auto_ptr<CVertexProgram> _VertexProgramNoWave;
static std::auto_ptr<CVertexProgram> _VertexProgramNoWaveDiffuse;
static NLMISC::CSmartPtr<CVertexProgramWaterVPNoWave> _VertexProgramNoWave;
static NLMISC::CSmartPtr<CVertexProgramWaterVPNoWave> _VertexProgramNoWaveDiffuse;
};

View file

@ -466,6 +466,7 @@ private:
uint _NumberOfPatchComputed;
uint _ProcessCount;
uint64 _CPUMask;
NLMISC::CMutex _ProcessExitedMutex;
volatile uint _ProcessExited;
// *** Bitmap sharing

View file

@ -44,7 +44,7 @@ public:
UFormElm& getRootNode ();
const UFormElm& getRootNode () const;
const std::string &getComment () const;
void write (class NLMISC::IStream &stream, bool georges4CVS);
void write (class NLMISC::IStream &stream);
void getDependencies (std::set<std::string> &dependencies) const;
uint getNumParent () const;
UForm *getParentForm (uint parent) const;
@ -73,7 +73,7 @@ public:
// ** IO functions
// Set the filename before saving the form
void write (xmlDocPtr doc, const char *filename, bool georges4CVS);
void write (xmlDocPtr doc, const char *filename);
// ** Parent access

View file

@ -161,7 +161,7 @@ public:
};
// ** IO functions
void write (xmlDocPtr root, const char *filename, bool georges4CVS);
void write (xmlDocPtr root, const char *filename);
// Count parent DFN
uint countParentDfn (uint32 round=0) const;

View file

@ -63,7 +63,7 @@ private:
TTypeMap _MapType;
// Map of filename / CRefPtr<CFormDfnCFormDfn>
TFormDfnMap _MapFormDfn;
TFormDfnMap _MapFormDfn;
// Map of form / CRefPtr<CForm>
TFormMap _MapForm;

View file

@ -54,9 +54,6 @@ public:
/// State of the form
TState State;
/// CVS Revision string
std::string Revision;
/// Comments of the form
std::string Comments;
@ -65,7 +62,7 @@ public:
/// ** IO functions
void read (xmlNodePtr root);
void write (xmlNodePtr node, bool georges4CVS) const;
void write (xmlNodePtr node) const;
// Get state string
static const char *getStateString (TState state);

View file

@ -109,7 +109,7 @@ struct TLoadFormDicoEntry
}
};
*/
const uint32 PACKED_SHEET_HEADER = 'PKSH';
const uint32 PACKED_SHEET_HEADER = NELID("PKSH");
const uint32 PACKED_SHEET_VERSION = 5;
// This Version may be used if you want to use the serialVersion() system in loadForm()
const uint32 PACKED_SHEET_VERSION_COMPATIBLE = 0;

View file

@ -55,7 +55,7 @@ public:
static bool uiCompatible (TType type, TUI ui);
// ** IO functions
void write (xmlDocPtr doc, bool georges4CVS) const;
void write (xmlDocPtr doc) const;
// Header
CFileHeader Header;

View file

@ -53,9 +53,8 @@ public:
/** Write the form in a stream.
*
* \param stream is the stream used to write the form
* \param georges4CVS should be true if you use Georges with CVS false else
*/
virtual void write (NLMISC::IStream &stream, bool georges4CVS) = 0;
virtual void write (NLMISC::IStream &stream) = 0;
/**
* Access form parents

View file

@ -74,14 +74,14 @@ namespace NLGUI
REFLECT_SINT32("rollover_container_alpha", getRolloverAlphaContainerAsSInt32, setRolloverAlphaContainer);
REFLECT_BOOL("use_global_alpha_settings", isUsingGlobalAlpha, setUseGlobalAlpha);
REFLECT_STRING("on_alpha_settings_changed", getAHOnAlphaSettingsChanged, setAHOnAlphaSettingsChanged);
REFLECT_STRING("on_alpha_settings_changed_aparams", getAHOnAlphaSettingsChangedParams, setAHOnAlphaSettingsChangedParams);
REFLECT_STRING("on_alpha_settings_changed_params", getAHOnAlphaSettingsChangedParams, setAHOnAlphaSettingsChangedParams);
REFLECT_EXPORT_END
virtual bool isMoving() const{ return false; }
// Get the header color draw. NB: depends if grayed, and if active.
virtual NLMISC::CRGBA getDrawnHeaderColor () const{ return NLMISC::CRGBA(); };
uint8 getCurrentContainerAlpha() const{ return _CurrentContainerAlpha; }
uint8 getCurrentContentAlpha() const{ return _CurrentContentAlpha; }
@ -92,7 +92,7 @@ namespace NLGUI
protected:
void triggerAlphaSettingsChangedAH();
uint8 _CurrentContainerAlpha;
uint8 _CurrentContentAlpha;
uint8 _ContainerAlpha;

View file

@ -66,6 +66,11 @@ namespace NLGUI
*/
bool affect(const CInterfaceExprValue &value);
};
struct CCDBTargetInfo
{
NLMISC::CRefPtr<NLMISC::CCDBNodeLeaf> Leaf;
std::string LeafName;
};
/// Updates triggered interface links when triggered by the observed branch
@ -85,7 +90,7 @@ namespace NLGUI
* If there are no target element, the link is permanent (removed at exit)
* NB : The target is not updated during this call.
*/
bool init(const std::vector<CTargetInfo> &targets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parent);
bool init(const std::vector<CTargetInfo> &targets, const std::vector<CCDBTargetInfo> &cdbTargets, const std::string &expr, const std::string &actionHandler, const std::string &ahParams, const std::string &ahCond, CInterfaceGroup *parent);
// force all the links that have been created to update their targets. This can be called when the interface has been loaded, and when the databse entries have been retrieved.
static void updateAllLinks();
// force all trigered links to be updated
@ -119,6 +124,7 @@ namespace NLGUI
* \return true if all targets are valid
*/
static bool splitLinkTargets(const std::string &targets, CInterfaceGroup *parentGroup, std::vector<CInterfaceLink::CTargetInfo> &targetsVect);
static bool splitLinkTargetsExt(const std::string &targets, CInterfaceGroup *parentGroup, std::vector<CInterfaceLink::CTargetInfo> &targetsVect, std::vector<CInterfaceLink::CCDBTargetInfo> &cdbTargetsVect);
////////////////////////////////////////////////////////////////////////////////////////////////////////
private:
friend struct CRemoveTargetPred;
@ -135,12 +141,14 @@ namespace NLGUI
typedef std::vector<NLMISC::ICDBNode *> TNodeVect;
private:
std::vector<CTarget> _Targets;
std::vector<CCDBTargetInfo> _CDBTargets;
TNodeVect _ObservedNodes;
std::string _Expr;
CInterfaceExprNode *_ParseTree;
std::string _ActionHandler;
std::string _AHParams;
std::string _AHCond;
CInterfaceExprNode *_AHCondParsed;
CInterfaceGroup *_AHParent;
static TLinkList _LinkList;
TLinkList::iterator _ListEntry;

View file

@ -217,6 +217,7 @@ namespace NLGUI
void clear() { setTop(0); }
int getTop();
bool empty() { return getTop() == 0; }
void pushGlobalTable();
void pushValue(int index); // copie nth element of stack to the top of the stack
void remove(int index); // remove nth element of stack
void insert(int index); // insert last element of the stack before the given position
@ -301,7 +302,8 @@ namespace NLGUI
/** Helper : Execute a function by name. Lookup for the function is done in the table at the index 'funcTableIndex'
* the behaviour is the same than with call of pcall.
*/
int pcallByName(const char *functionName, int nargs, int nresults, int funcTableIndex = LUA_GLOBALSINDEX, int errfunc = 0);
int pcallByNameGlobal(const char *functionName, int nargs, int nresults, int errfunc = 0);
int pcallByName(const char *functionName, int nargs, int nresults, int funcTableIndex, int errfunc = 0);
// push a C closure (pop n element from the stack and associate with the function)
void pushCClosure(lua_CFunction function, int n);
@ -367,6 +369,7 @@ namespace NLGUI
CLuaState &operator=(const CLuaState &/* other */) { nlassert(0); return *this; }
void executeScriptInternal(const std::string &code, const std::string &dbgSrc, int numRet = 0);
int pcallByNameInternal(const char *functionName, int nargs, int nresults, int errfunc, int initialStackSize);
};

View file

@ -42,10 +42,16 @@ inline void CLuaState::checkIndex(int index)
//H_AUTO(Lua_CLuaState_checkIndex)
// NB : more restrictive test that in the documentation there, because
// we don't expose the check stack function
#if LUA_VERSION_NUM >= 502
nlassert( (index!=0 && abs(index) <= getTop())
|| index == LUA_REGISTRYINDEX
);
#else
nlassert( (index!=0 && abs(index) <= getTop())
|| index == LUA_REGISTRYINDEX
|| index == LUA_GLOBALSINDEX
);
#endif
}
//================================================================================
@ -75,6 +81,18 @@ inline void CLuaState::setTop(int index)
lua_settop(_State, index);
}
//================================================================================
inline void CLuaState::pushGlobalTable()
{
//H_AUTO(Lua_CLuaState_pushGlobalTable)
#if LUA_VERSION_NUM >= 502
lua_pushglobaltable(_State);
#else
checkIndex(LUA_GLOBALSINDEX);
lua_pushvalue(_State, LUA_GLOBALSINDEX);
#endif
}
//================================================================================
inline void CLuaState::pushValue(int index)
{
@ -243,7 +261,11 @@ inline size_t CLuaState::strlen(int index)
{
//H_AUTO(Lua_CLuaState_strlen)
checkIndex(index);
#if LUA_VERSION_NUM >= 502
return lua_rawlen(_State, index);
#else
return lua_strlen(_State, index);
#endif
}
//================================================================================
@ -342,7 +364,11 @@ inline bool CLuaState::equal(int index1, int index2)
//H_AUTO(Lua_CLuaState_equal)
checkIndex(index1);
checkIndex(index2);
#if LUA_VERSION_NUM >= 502
return lua_compare(_State, index1, index2, LUA_OPEQ) != 0;
#else
return lua_equal(_State, index1, index2) != 0;
#endif
}
//================================================================================
@ -376,7 +402,11 @@ inline bool CLuaState::lessThan(int index1, int index2)
//H_AUTO(Lua_CLuaState_lessThan)
checkIndex(index1);
checkIndex(index2);
#if LUA_VERSION_NUM >= 502
return lua_compare(_State, index1, index2, LUA_OPLT) != 0;
#else
return lua_lessthan(_State, index1, index2) != 0;
#endif
}

View file

@ -447,7 +447,7 @@ namespace NLGUI
}
float getAlphaRolloverSpeed();
void resetAlphaRolloverSpeed();
void resetAlphaRolloverSpeedProps();
void setContainerAlpha( uint8 alpha );
uint8 getContainerAlpha() const { return _ContainerAlpha; }
@ -457,6 +457,7 @@ namespace NLGUI
uint8 getGlobalRolloverFactorContainer() const { return _GlobalRolloverFactorContainer; }
void updateGlobalAlphas();
void resetGlobalAlphasProps();
const SInterfaceTimes& getInterfaceTimes() const{ return interfaceTimes; }
void updateInterfaceTimes( const SInterfaceTimes &times ){ interfaceTimes = times; }
@ -542,6 +543,11 @@ namespace NLGUI
NLMISC::CCDBNodeLeaf *_BProp;
NLMISC::CCDBNodeLeaf *_AProp;
NLMISC::CCDBNodeLeaf *_AlphaRolloverSpeedDB;
NLMISC::CCDBNodeLeaf *_GlobalContentAlphaDB;
NLMISC::CCDBNodeLeaf *_GlobalContainerAlphaDB;
NLMISC::CCDBNodeLeaf *_GlobalContentRolloverFactorDB;
NLMISC::CCDBNodeLeaf *_GlobalContainerRolloverFactorDB;
uint8 _ContainerAlpha;
uint8 _GlobalContentAlpha;

View file

@ -21,6 +21,8 @@
#include "cdb.h"
#define NL_CDB_OPTIMIZE_PREDICT 1
namespace NLMISC{
/**
@ -247,6 +249,10 @@ protected:
/// called by clear
void removeAllBranchObserver();
#if NL_CDB_OPTIMIZE_PREDICT
CRefPtr<ICDBNode> _PredictNode;
#endif
};
}

View file

@ -586,7 +586,7 @@ template<class T, class U> inline T type_cast(U o)
#ifdef NL_ISO_CPP0X_AVAILABLE
# define nlctassert(cond) static_assert(cond, "Compile time assert in "#cond)
#else
# define nlctassert(cond) sizeof(uint[(cond) ? 1 : 0])
# define nlctassert(cond) (void)sizeof(uint[(cond) ? 1 : 0])
#endif
/**

View file

@ -19,6 +19,7 @@
#include "types_nl.h"
#include <cmath>
#include <nel/misc/debug.h>
namespace NLMISC
{

View file

@ -53,6 +53,13 @@ class CMemStream;
# endif
# define NLMISC_BSWAP64(src) (src) = (((src)>>56)&0xFF) | ((((src)>>48)&0xFF)<<8) | ((((src)>>40)&0xFF)<<16) | ((((src)>>32)&0xFF)<<24) | ((((src)>>24)&0xFF)<<32) | ((((src)>>16)&0xFF)<<40) | ((((src)>>8)&0xFF)<<48) | (((src)&0xFF)<<56)
// convert a 4 characters string to uint32
#ifdef NL_LITTLE_ENDIAN
# define NELID(x) (uint32((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | (x[3])))
#else
# define NELID(x) (uint32((x[3] << 24) | (x[2] << 16) | (x[1] << 8) | (x[0])))
#endif
// ======================================================================================================
/**
* Stream Exception.

View file

@ -90,6 +90,7 @@
# if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack or later
# define NL_ISO_STDTR1_AVAILABLE
# define NL_ISO_STDTR1_HEADER(header) <header>
# define NL_ISO_STDTR1_NAMESPACE std::tr1
# endif
# ifdef _DEBUG
# define NL_DEBUG
@ -104,6 +105,8 @@
// Windows 64bits platform SDK compilers doesn't support inline assembler
# define NL_NO_ASM
# endif
# undef _WIN32_WINNT
# define _WIN32_WINNT 0x0600 // force VISTA minimal version in 64 bits
# endif
// define NOMINMAX to be sure that windows includes will not define min max macros, but instead, use the stl template
# define NOMINMAX
@ -151,8 +154,16 @@
#ifdef NL_COMP_GCC
# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
# if GCC_VERSION > 40100
# define NL_ISO_STDTR1_AVAILABLE
# define NL_ISO_STDTR1_HEADER(header) <tr1/header>
// new libc++ bundled with clang under Mac OS X 10.9+ doesn't define __GLIBCXX__
# ifdef __GLIBCXX__
# define NL_ISO_STDTR1_AVAILABLE
# define NL_ISO_STDTR1_HEADER(header) <tr1/header>
# define NL_ISO_STDTR1_NAMESPACE std::tr1
# else
# define NL_ISO_STDTR1_AVAILABLE
# define NL_ISO_STDTR1_HEADER(header) <header>
# define NL_ISO_STDTR1_NAMESPACE std
# endif
# endif
#endif
@ -329,9 +340,9 @@ typedef unsigned int uint; // at least 32bits (depend of processor)
#elif defined(NL_ISO_STDTR1_AVAILABLE) // use std::tr1 for CHash* classes, if available (gcc 4.1+ and VC9 with TR1 feature pack)
# include NL_ISO_STDTR1_HEADER(unordered_map)
# include NL_ISO_STDTR1_HEADER(unordered_set)
# define CHashMap std::tr1::unordered_map
# define CHashSet std::tr1::unordered_set
# define CHashMultiMap std::tr1::unordered_multimap
# define CHashMap NL_ISO_STDTR1_NAMESPACE::unordered_map
# define CHashSet NL_ISO_STDTR1_NAMESPACE::unordered_set
# define CHashMultiMap NL_ISO_STDTR1_NAMESPACE::unordered_multimap
#elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 70 && NL_COMP_VC_VERSION <= 90) // VC7 through 9
# include <hash_map>
# include <hash_set>

View file

@ -316,14 +316,14 @@ public:
// output the oldest part of the buffer first
for (uint i=_Mean.getCurrentFrame(); i<_Mean.getNumFrame(); ++i)
{
str << _Mean.getLastFrames()[i];
str << (T)_Mean.getLastFrames()[i];
if (i < _Mean.getNumFrame()-1 || _Mean.getCurrentFrame() != 0)
str << ",";
}
// then output the newest part
for (uint i = 0; i < _Mean.getCurrentFrame(); i++)
{
str << _Mean.getLastFrames()[i];
str << (T)_Mean.getLastFrames()[i];
if (i < _Mean.getCurrentFrame()-1)
str << ",";
}

View file

@ -6,7 +6,7 @@ GraphicsDriver = "OpenGL";
SoundDriver = "OpenAL";
SoundDevice = "";
LanguageCode = "en";
QtStyle = "Cleanlooks";
QtStyle = "";
FontName = "andbasr.ttf";
FontShadow = 1;
BackgroundColor = {

View file

@ -289,7 +289,7 @@ int main(void)
// and finally save the form out in case we made changes.
// if you're accessing a form read-only (not using set*) you can skip this.
NLMISC::COFile saveSample(sampleConfigFile);
form->write(saveSample, false);
form->write(saveSample);
nlinfo("Saved sample config file.");
} else {
// CPath didn't find the file, just print an error and exit.

View file

@ -153,8 +153,6 @@ SOURCE_GROUP(Driver FILES
../../include/nel/3d/scene.h
scene_group.cpp
../../include/nel/3d/scene_group.h
shader.cpp
../../include/nel/3d/shader.h
texture.cpp
../../include/nel/3d/texture.h
vertex_buffer.cpp
@ -164,7 +162,15 @@ SOURCE_GROUP(Driver FILES
vertex_program.cpp
../../include/nel/3d/vertex_program.h
vertex_program_parse.cpp
../../include/nel/3d/vertex_program_parse.h)
../../include/nel/3d/vertex_program_parse.h
pixel_program.cpp
../../include/nel/3d/pixel_program.h
geometry_program.cpp
../../include/nel/3d/geometry_program.h
program.cpp
../../include/nel/3d/program.h
gpu_program_params.cpp
../../include/nel/3d/gpu_program_params.h)
SOURCE_GROUP(Font FILES
computed_string.cpp
@ -686,12 +692,26 @@ SOURCE_GROUP(Shadows FILES
../../include/nel/3d/shadow_map_manager.h
shadow_poly_receiver.cpp
../../include/nel/3d/shadow_poly_receiver.h)
SOURCE_GROUP(Stereo FILES
stereo_display.cpp
../../include/nel/3d/stereo_display.h
stereo_hmd.cpp
../../include/nel/3d/stereo_hmd.h
stereo_ng_hmd.cpp
../../include/nel/3d/stereo_ng_hmd.h
stereo_ovr.cpp
stereo_ovr_fp.cpp
../../include/nel/3d/stereo_ovr.h
stereo_libvr.cpp
../../include/nel/3d/stereo_libvr.h
stereo_debugger.cpp
../../include/nel/3d/stereo_debugger.h)
NL_TARGET_LIB(nel3d ${HEADERS} ${SRC})
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} ${LIBOVR_INCLUDE_DIR} ${LIBVR_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARY})
TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARIES} ${LIBOVR_LIBRARIES} ${LIBVR_LIBRARY})
SET_TARGET_PROPERTIES(nel3d PROPERTIES LINK_INTERFACE_LIBRARIES "")
NL_DEFAULT_PROPS(nel3d "NeL, Library: NeL 3D")
NL_ADD_RUNTIME_FLAGS(nel3d)
@ -701,6 +721,9 @@ NL_ADD_LIB_SUFFIX(nel3d)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
ADD_DEFINITIONS(${LIBOVR_DEFINITIONS})
ADD_DEFINITIONS(${LIBVR_DEFINITIONS})
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nel3d ${CMAKE_CURRENT_SOURCE_DIR}/std3d.h ${CMAKE_CURRENT_SOURCE_DIR}/std3d.cpp)
ENDIF(WITH_PCH)

View file

@ -89,8 +89,8 @@ void CAnimation::serial (NLMISC::IStream& f)
nlassert(_IdByChannelId.empty());
// Serial a header
f.serialCheck ((uint32)'_LEN');
f.serialCheck ((uint32)'MINA');
f.serialCheck (NELID("_LEN"));
f.serialCheck (NELID("MINA"));
// Serial a version
sint version=f.serialVersion (2);

View file

@ -185,9 +185,9 @@ void CAnimationSet::serial (NLMISC::IStream& f)
nlassert(!_AnimHeaderOptimisation);
// Serial an header
f.serialCheck ((uint32)'_LEN');
f.serialCheck ((uint32)'MINA');
f.serialCheck ((uint32)'TES_');
f.serialCheck (NELID("_LEN"));
f.serialCheck (NELID("MINA"));
f.serialCheck (NELID("TES_"));
// Serial a version
uint ver= f.serialVersion (1);

View file

@ -55,13 +55,18 @@ static const char *TextureOffset =
END \n";
static CVertexProgram TextureOffsetVertexProgram(TextureOffset);
static NLMISC::CSmartPtr<CVertexProgram> TextureOffsetVertexProgram;
//-----------------------------------------------------------------------------------------------------------
CBloomEffect::CBloomEffect()
{
if (!TextureOffsetVertexProgram)
{
TextureOffsetVertexProgram = new CVertexProgram(TextureOffset);
}
_Driver = NULL;
_Scene = NULL;
_SquareBloom = true;
@ -285,6 +290,8 @@ void CBloomEffect::initBloom() // clientcfg
if(!_Init)
init();
_OriginalRenderTarget = static_cast<CDriverUser *>(_Driver)->getDriver()->getRenderTarget();
// if window resize, reinitialize textures
if(_WndWidth!=_Driver->getWindowWidth() || _WndHeight!=_Driver->getWindowHeight())
{
@ -349,13 +356,15 @@ void CBloomEffect::initBloom() // clientcfg
}
}
NL3D::CTextureUser *txt = (_InitBloomEffect) ? (new CTextureUser(_InitText)) : (new CTextureUser());
if(!((CDriverUser *) _Driver)->setRenderTarget(*txt, 0, 0, _WndWidth, _WndHeight))
if (!_OriginalRenderTarget)
{
nlwarning("setRenderTarget return false with initial texture for bloom effect\n");
return;
NL3D::CTextureUser txt = (_InitBloomEffect) ? (CTextureUser(_InitText)) : (CTextureUser());
if(!(static_cast<CDriverUser *>(_Driver)->setRenderTarget(txt, 0, 0, _WndWidth, _WndHeight)))
{
nlwarning("setRenderTarget return false with initial texture for bloom effect\n");
return;
}
}
delete txt;
}
//-----------------------------------------------------------------------------------------------------------
@ -371,13 +380,13 @@ void CBloomEffect::endBloom() // clientcfg
if(_Driver->getWindowWidth()==0 || _Driver->getWindowHeight()==0)
return;
CTextureUser *txt1 = (_InitBloomEffect) ? (new CTextureUser(_InitText)) : (new CTextureUser());
CTextureUser *txt2 = new CTextureUser(_BlurFinalTex);
CRect *rect1 = new CRect(0, 0, _WndWidth, _WndHeight);
CRect *rect2 = new CRect(0, 0, _BlurWidth, _BlurHeight);
CTextureUser txt1 = _OriginalRenderTarget ? CTextureUser(_OriginalRenderTarget) : ((_InitBloomEffect) ? (CTextureUser(_InitText)) : (CTextureUser()));
CTextureUser txt2(_BlurFinalTex);
CRect rect1(0, 0, _WndWidth, _WndHeight);
CRect rect2(0, 0, _BlurWidth, _BlurHeight);
// stretch rect
((CDriverUser *) _Driver)->stretchRect(_Scene, *txt1 , *rect1,
*txt2, *rect2);
((CDriverUser *) _Driver)->stretchRect(_Scene, txt1 , rect1,
txt2, rect2);
// horizontal blur pass
doBlur(true);
@ -387,10 +396,6 @@ void CBloomEffect::endBloom() // clientcfg
// apply blur with a blend operation
applyBlur();
delete txt1;
delete txt2;
delete rect1;
delete rect2;
}
//-----------------------------------------------------------------------------------------------------------
@ -399,16 +404,30 @@ void CBloomEffect::applyBlur()
{
NL3D::IDriver *drvInternal = ((CDriverUser *) _Driver)->getDriver();
// in opengl, display in init texture
if(_InitBloomEffect)
/*if (_OriginalRenderTarget)
{
CTextureUser *txt = new CTextureUser(_InitText);
if(!((CDriverUser *) _Driver)->setRenderTarget(*txt, 0, 0, _WndWidth, _WndHeight))
CTextureUser txt(_OriginalRenderTarget);
if(!(static_cast<CDriverUser *>(_Driver)->setRenderTarget(txt, 0, 0, _WndWidth, _WndHeight)))
{
nlwarning("setRenderTarget return false with original render target for bloom effect\n");
return;
}
}
// in opengl, display in init texture
else if(_InitBloomEffect)
{
CTextureUser txt(_InitText);
if(!(static_cast<CDriverUser *>(_Driver)->setRenderTarget(txt, 0, 0, _WndWidth, _WndHeight)))
{
nlwarning("setRenderTarget return false with initial texture for bloom effect\n");
return;
}
delete txt;
}*/
CTextureUser txtApply = _OriginalRenderTarget ? CTextureUser(_OriginalRenderTarget) : ((_InitBloomEffect) ? (CTextureUser(_InitText)) : (CTextureUser()));
if(!(static_cast<CDriverUser *>(_Driver)->setRenderTarget(txtApply, 0, 0, _WndWidth, _WndHeight)))
{
nlwarning("setRenderTarget return false with initial texture for bloom effect\n");
return;
}
// display blur texture
@ -429,9 +448,9 @@ void CBloomEffect::applyBlur()
}
// initialize vertex program
drvInternal->activeVertexProgram(&TextureOffsetVertexProgram);
drvInternal->setConstant(8, 255.f, 255.f, 255.f, 255.f);
drvInternal->setConstant(9, 0.0f, 0.f, 0.f, 1.f);
drvInternal->activeVertexProgram(TextureOffsetVertexProgram);
drvInternal->setUniform4f(IDriver::VertexProgram, 8, 255.f, 255.f, 255.f, 255.f);
drvInternal->setUniform4f(IDriver::VertexProgram, 9, 0.0f, 0.f, 0.f, 1.f);
// initialize blur material
UMaterial displayBlurMat;
@ -463,7 +482,9 @@ void CBloomEffect::applyBlur()
void CBloomEffect::endInterfacesDisplayBloom() // clientcfg
{
if(_InitBloomEffect)
// Render from render target to screen if necessary.
// Don't do this when the blend was done to the screen or when rendering to a user provided rendertarget.
if ((_OriginalRenderTarget.getPtr() == NULL) && _InitBloomEffect)
{
if(!_Driver->supportBloomEffect() || !_Init)
return;
@ -475,9 +496,8 @@ void CBloomEffect::endInterfacesDisplayBloom() // clientcfg
return;
NL3D::IDriver *drvInternal = ((CDriverUser *) _Driver)->getDriver();
CTextureUser *txt = new CTextureUser();
((CDriverUser *)_Driver)->setRenderTarget(*txt, 0, 0, 0, 0);
delete txt;
CTextureUser txtNull;
((CDriverUser *)_Driver)->setRenderTarget(txtNull, 0, 0, 0, 0);
// initialize texture coordinates
float newU = drvInternal->isTextureRectangle(_InitText) ? (float)_WndWidth : 1.f;
@ -497,6 +517,8 @@ void CBloomEffect::endInterfacesDisplayBloom() // clientcfg
_Driver->drawQuad(_DisplayQuad, _DisplayInitMat);
_Driver->setMatrixMode3D(pCam);
}
_OriginalRenderTarget = NULL;
}
@ -523,19 +545,18 @@ void CBloomEffect::doBlur(bool horizontalBlur)
}
NL3D::IDriver *drvInternal = ((CDriverUser *) _Driver)->getDriver();
CTextureUser *txt = new CTextureUser(endTexture);
CTextureUser txt(endTexture);
// initialize render target
if(!((CDriverUser *) _Driver)->setRenderTarget(*txt, 0, 0, _BlurWidth, _BlurHeight))
if(!((CDriverUser *) _Driver)->setRenderTarget(txt, 0, 0, _BlurWidth, _BlurHeight))
{
nlwarning("setRenderTarget return false with blur texture for bloom effect\n");
return;
}
delete txt;
// initialize vertex program
drvInternal->activeVertexProgram(&TextureOffsetVertexProgram);
drvInternal->setConstant(8, 255.f, 255.f, 255.f, 255.f);
drvInternal->setConstant(9, 0.0f, 0.f, 0.f, 1.f);
drvInternal->activeVertexProgram(TextureOffsetVertexProgram);
drvInternal->setUniform4f(IDriver::VertexProgram, 8, 255.f, 255.f, 255.f, 255.f);
drvInternal->setUniform4f(IDriver::VertexProgram, 9, 0.0f, 0.f, 0.f, 1.f);
// set several decal constants in order to obtain in the render target texture a mix of color
// of a texel and its neighbored texels on the axe of the pass.
@ -554,10 +575,10 @@ void CBloomEffect::doBlur(bool horizontalBlur)
decalR = 1.f;
decal2R = 2.f;
}
drvInternal->setConstant(10, (decalR/(float)_BlurWidth)*blurVec.x, (decalR/(float)_BlurHeight)*blurVec.y, 0.f, 0.f);
drvInternal->setConstant(11, (decal2R/(float)_BlurWidth)*blurVec.x, (decal2R/(float)_BlurHeight)*blurVec.y, 0.f, 0.f);
drvInternal->setConstant(12, (decalL/(float)_BlurWidth)*blurVec.x, (decalL/(float)_BlurHeight)*blurVec.y, 0.f, 0.f);
drvInternal->setConstant(13, (decal2L/(float)_BlurWidth)*blurVec.x, (decal2L/(float)_BlurHeight)*blurVec.y, 0.f, 0.f);
drvInternal->setUniform2f(IDriver::VertexProgram, 10, (decalR/(float)_BlurWidth)*blurVec.x, (decalR/(float)_BlurHeight)*blurVec.y);
drvInternal->setUniform2f(IDriver::VertexProgram, 11, (decal2R/(float)_BlurWidth)*blurVec.x, (decal2R/(float)_BlurHeight)*blurVec.y);
drvInternal->setUniform2f(IDriver::VertexProgram, 12, (decalL/(float)_BlurWidth)*blurVec.x, (decalL/(float)_BlurHeight)*blurVec.y);
drvInternal->setUniform2f(IDriver::VertexProgram, 13, (decal2L/(float)_BlurWidth)*blurVec.x, (decal2L/(float)_BlurHeight)*blurVec.y);
// initialize material textures
CMaterial * matObject = _BlurMat.getObjectPtr();
@ -579,10 +600,9 @@ void CBloomEffect::doBlur(bool horizontalBlur)
// disable render target and vertex program
drvInternal->activeVertexProgram(NULL);
txt = new CTextureUser();
((CDriverUser *)_Driver)->setRenderTarget(*txt, 0, 0, 0, 0);
CTextureUser cu;
((CDriverUser *)_Driver)->setRenderTarget(cu, 0, 0, 0, 0);
_Driver->setMatrixMode3D(pCam);
delete txt;
}
}; // NL3D

View file

@ -21,6 +21,7 @@
#include "nel/3d/index_buffer.h"
#include "nel/3d/material.h"
#include "nel/3d/frustum.h"
#include "nel/3d/viewport.h"
#include "nel/misc/smart_ptr.h"
#include "nel/misc/debug.h"
@ -85,6 +86,10 @@ void CComputedString::render2D (IDriver& driver,
// get window size
uint32 wndWidth, wndHeight;
driver.getWindowSize(wndWidth, wndHeight);
CViewport vp;
driver.getViewport(vp);
wndWidth = (uint32)((float)wndWidth * vp.getWidth());
wndHeight = (uint32)((float)wndHeight * vp.getHeight());
// scale to window size.
x*= wndWidth;
z*= wndHeight;
@ -242,8 +247,8 @@ void CComputedString::render2DClip (IDriver& driver, CRenderStringBuffer &rdrBuf
uint lastIndex = 0;
for(uint i=0;i<numVerts;i++)
{
if(count==4){
if(count==4)
{
if(!LetterColors.empty())
{
if(LetterColors.getIndex(lastIndex)==i/4)

View file

@ -20,7 +20,6 @@
#include "nel/misc/types_nl.h"
#include "nel/3d/driver.h"
#include "nel/3d/shader.h"
#include "nel/3d/vertex_buffer.h"
#include "nel/misc/algo.h"
@ -33,7 +32,7 @@ namespace NL3D
{
// ***************************************************************************
const uint32 IDriver::InterfaceVersion = 0x6b; // added anisotropic filter
const uint32 IDriver::InterfaceVersion = 0x6d; // gpu program interface
// ***************************************************************************
IDriver::IDriver() : _SyncTexDrvInfos( "IDriver::_SyncTexDrvInfos" )
@ -58,7 +57,7 @@ IDriver::~IDriver()
nlassert(_MatDrvInfos.size()==0);
nlassert(_VBDrvInfos.size()==0);
nlassert(_IBDrvInfos.size()==0);
nlassert(_VtxPrgDrvInfos.size()==0);
nlassert(_GPUPrgDrvInfos.size()==0);
}
@ -95,14 +94,6 @@ bool IDriver::release(void)
delete *itmat;
}
// Release Shader drv.
ItShaderDrvInfoPtrList itshd;
while( (itshd = _ShaderDrvInfos.begin()) != _ShaderDrvInfos.end() )
{
// NB: at IShader deletion, this->_MatDrvInfos is updated (entry deleted);
delete *itshd;
}
// Release VBs drv.
ItVBDrvInfoPtrList itvb;
while( (itvb = _VBDrvInfos.begin()) != _VBDrvInfos.end() )
@ -119,12 +110,12 @@ bool IDriver::release(void)
delete *itib;
}
// Release VtxPrg drv.
ItVtxPrgDrvInfoPtrList itVtxPrg;
while( (itVtxPrg = _VtxPrgDrvInfos.begin()) != _VtxPrgDrvInfos.end() )
// Release GPUPrg drv.
ItGPUPrgDrvInfoPtrList itGPUPrg;
while( (itGPUPrg = _GPUPrgDrvInfos.begin()) != _GPUPrgDrvInfos.end() )
{
// NB: at IVertexProgramDrvInfos deletion, this->_VtxPrgDrvInfos is updated (entry deleted);
delete *itVtxPrg;
// NB: at IVertexProgramDrvInfos deletion, this->_GPUPrgDrvInfos is updated (entry deleted);
delete *itGPUPrg;
}
return true;
@ -249,14 +240,9 @@ void IDriver::removeMatDrvInfoPtr(ItMatDrvInfoPtrList shaderIt)
_MatDrvInfos.erase(shaderIt);
}
// ***************************************************************************
void IDriver::removeShaderDrvInfoPtr(ItShaderDrvInfoPtrList shaderIt)
void IDriver::removeGPUPrgDrvInfoPtr(ItGPUPrgDrvInfoPtrList gpuPrgDrvInfoIt)
{
_ShaderDrvInfos.erase(shaderIt);
}
// ***************************************************************************
void IDriver::removeVtxPrgDrvInfoPtr(ItVtxPrgDrvInfoPtrList vtxPrgDrvInfoIt)
{
_VtxPrgDrvInfos.erase(vtxPrgDrvInfoIt);
_GPUPrgDrvInfos.erase(gpuPrgDrvInfoIt);
}
// ***************************************************************************

View file

@ -193,6 +193,11 @@ CDriverD3D::CDriverD3D()
#else // NL_DISABLE_HARDWARE_VERTEX_PROGAM
_DisableHardwareVertexProgram = false;
#endif // NL_DISABLE_HARDWARE_VERTEX_PROGAM
#ifdef NL_DISABLE_HARDWARE_PIXEL_PROGAM
_DisableHardwarePixelProgram = true;
#else // NL_DISABLE_HARDWARE_PIXEL_PROGAM
_DisableHardwarePixelProgram = false;
#endif // NL_DISABLE_HARDWARE_PIXEL_PROGAM
#ifdef NL_DISABLE_HARDWARE_VERTEX_ARRAY_AGP
_DisableHardwareVertexArrayAGP = true;
#else // NL_DISABLE_HARDWARE_VERTEX_ARRAY_AGP
@ -1459,6 +1464,24 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
return false;
}
#if WITH_PERFHUD
// Look for 'NVIDIA PerfHUD' adapter
// If it is present, override default settings
for (UINT gAdapter=0;gAdapter<_D3D->GetAdapterCount();gAdapter++)
{
D3DADAPTER_IDENTIFIER9 Identifier;
HRESULT Res;
Res = _D3D->GetAdapterIdentifier(gAdapter,0,&Identifier);
if (strstr(Identifier.Description,"PerfHUD") != 0)
{
nlinfo ("Setting up with PerfHUD");
adapter=gAdapter;
_Rasterizer=D3DDEVTYPE_REF;
break;
}
}
#endif WITH_PERFHUD
// Create the D3D device
HRESULT result = _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE, &parameters, &_DeviceInterface);
if (result != D3D_OK)
@ -1482,6 +1505,8 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
}
}
// _D3D->CreateDevice (adapter, _Rasterizer, _HWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &parameters, &_DeviceInterface);
// Check some caps
@ -1546,13 +1571,15 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
#endif // NL_FORCE_TEXTURE_STAGE_COUNT
_VertexProgram = !_DisableHardwareVertexProgram && ((caps.VertexShaderVersion&0xffff) >= 0x0100);
_PixelShader = !_DisableHardwarePixelShader && (caps.PixelShaderVersion&0xffff) >= 0x0101;
_PixelProgramVersion = _DisableHardwareVertexProgram ? 0x0000 : caps.PixelShaderVersion & 0xffff;
nldebug("Pixel Program Version: %i.%i", (uint32)((_PixelProgramVersion & 0xFF00) >> 8), (uint32)(_PixelProgramVersion & 0xFF));
_PixelProgram = _PixelProgramVersion >= 0x0101;
_MaxVerticesByVertexBufferHard = caps.MaxVertexIndex;
_MaxLight = caps.MaxActiveLights;
if(_MaxLight > 0xFF) _MaxLight = 3;
if (_PixelShader)
if (_PixelProgram)
{
_MaxNumPerStageConstantLighted = _NbNeLTextureStages;
_MaxNumPerStageConstantUnlighted = _NbNeLTextureStages;
@ -1703,6 +1730,13 @@ bool CDriverD3D::release()
// Call IDriver::release() before, to destroy textures, shaders and VBs...
IDriver::release();
ItShaderDrvInfoPtrList itshd;
while( (itshd = _ShaderDrvInfos.begin()) != _ShaderDrvInfos.end() )
{
// NB: at IShader deletion, this->_MatDrvInfos is updated (entry deleted);
delete *itshd;
}
_SwapBufferCounter = 0;
if (_QuadIB)
@ -2016,6 +2050,8 @@ bool CDriverD3D::swapBuffers()
// Reset vertex program
setVertexProgram (NULL, NULL);
// Reset pixel program
setPixelShader (NULL);
if (_VBHardProfiling)
{
@ -2619,13 +2655,15 @@ bool CDriverD3D::reset (const GfxMode& mode)
#ifndef NL_NO_ASM
CFpuRestorer fpuRestorer; // fpu control word is changed by "Reset"
#endif
HRESULT hr = _DeviceInterface->Reset (&parameters);
if (hr != D3D_OK)
{
nlwarning("CDriverD3D::reset: Reset on _DeviceInterface error 0x%x", hr);
// tmp
nlstopex(("CDriverD3D::reset: Reset on _DeviceInterface"));
return false;
if (_Rasterizer!=D3DDEVTYPE_REF) {
HRESULT hr = _DeviceInterface->Reset (&parameters);
if (hr != D3D_OK)
{
nlwarning("CDriverD3D::reset: Reset on _DeviceInterface error 0x%x", hr);
// tmp
nlstopex(("CDriverD3D::reset: Reset on _DeviceInterface"));
return false;
}
}
}
@ -2987,7 +3025,7 @@ bool CDriverD3D::stretchRect(ITexture * srcText, NLMISC::CRect &srcRect, ITextur
bool CDriverD3D::supportBloomEffect() const
{
return isVertexProgramSupported();
return supportVertexProgram(CVertexProgram::nelvp);
}
// ***************************************************************************
@ -3330,9 +3368,9 @@ uint COcclusionQueryD3D::getVisibleCount()
}
// ***************************************************************************
bool CDriverD3D::isWaterShaderSupported() const
bool CDriverD3D::supportWaterShader() const
{
H_AUTO_D3D(CDriverD3D_isWaterShaderSupported);
H_AUTO_D3D(CDriverD3D_supportWaterShader);
return _PixelShaderVersion >= D3DPS_VERSION(1, 1);
}
@ -3618,7 +3656,7 @@ void CDriverD3D::CVertexProgramPtrState::apply(CDriverD3D *driver)
void CDriverD3D::CPixelShaderPtrState::apply(CDriverD3D *driver)
{
H_AUTO_D3D(CDriverD3D_CPixelShaderPtrState);
if (!driver->supportPixelShaders()) return;
if (!driver->_PixelProgram) return;
driver->_DeviceInterface->SetPixelShader(PixelShader);
}

View file

@ -35,7 +35,6 @@
#include "nel/3d/scissor.h"
#include "nel/3d/driver.h"
#include "nel/3d/material.h"
#include "nel/3d/shader.h"
#include "nel/3d/vertex_buffer.h"
#include "nel/3d/index_buffer.h"
#include "nel/3d/ptr_set.h"
@ -181,6 +180,75 @@ public:
};
using NLMISC::CRefCount;
class IDriver;
class CDriverD3D;
// List typedef.
class IShaderDrvInfos;
typedef std::list<IShaderDrvInfos*> TShaderDrvInfoPtrList;
typedef TShaderDrvInfoPtrList::iterator ItShaderDrvInfoPtrList;
/**
* Interface for shader driver infos.
*/
class IShaderDrvInfos : public CRefCount
{
private:
CDriverD3D *_Driver;
ItShaderDrvInfoPtrList _DriverIterator;
public:
IShaderDrvInfos(CDriverD3D *drv, ItShaderDrvInfoPtrList it) {_Driver= drv; _DriverIterator= it;}
// The virtual dtor is important.
virtual ~IShaderDrvInfos();
};
/**
* Shader resource for the driver. It is just a container for a ".fx" text file.
*/
/* *** IMPORTANT ********************
* *** IF YOU MODIFY THE STRUCTURE OF THIS CLASS, PLEASE INCREMENT IDriver::InterfaceVersion TO INVALIDATE OLD DRIVER DLL
* **********************************
*/
// --------------------------------------------------
class CD3DShaderFX
{
public:
CD3DShaderFX();
~CD3DShaderFX();
// Load a shader file
bool loadShaderFile (const char *filename);
// Set the shader text
void setText (const char *text);
// Get the shader text
const char *getText () const { return _Text.c_str(); }
// Set the shader name
void setName (const char *name);
// Get the shader name
const char *getName () const { return _Name.c_str(); }
public:
// Private. For Driver only.
bool _ShaderChanged;
NLMISC::CRefPtr<IShaderDrvInfos> _DrvInfo;
private:
// The shader
std::string _Text;
// The shader name
std::string _Name;
};
// ***************************************************************************
class CTextureDrvInfosD3D : public ITextureDrvInfos
{
@ -229,16 +297,48 @@ public:
};
// ***************************************************************************
class CVertexProgamDrvInfosD3D : public IVertexProgramDrvInfos
class CVertexProgamDrvInfosD3D : public IProgramDrvInfos
{
public:
// The shader
IDirect3DVertexShader9 *Shader;
CVertexProgamDrvInfosD3D(IDriver *drv, ItVtxPrgDrvInfoPtrList it);
CVertexProgamDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it);
~CVertexProgamDrvInfosD3D();
virtual uint getUniformIndex(const char *name) const
{
std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second;
return ~0;
};
std::map<std::string, uint> ParamIndices;
};
// ***************************************************************************
class CPixelProgramDrvInfosD3D : public IProgramDrvInfos
{
public:
// The shader
IDirect3DPixelShader9 *Shader;
CPixelProgramDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it);
~CPixelProgramDrvInfosD3D();
virtual uint getUniformIndex(const char *name) const
{
std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second;
return ~0;
};
std::map<std::string, uint> ParamIndices;
};
@ -333,7 +433,7 @@ public:
// Scalar handles
D3DXHANDLE ScalarFloatHandle[MaxShaderTexture];
CShaderDrvInfosD3D(IDriver *drv, ItShaderDrvInfoPtrList it);
CShaderDrvInfosD3D(CDriverD3D *drv, ItShaderDrvInfoPtrList it);
virtual ~CShaderDrvInfosD3D();
};
@ -773,13 +873,13 @@ public:
// Driver parameters
virtual void disableHardwareVertexProgram();
virtual void disableHardwarePixelProgram();
virtual void disableHardwareIndexArrayAGP();
virtual void disableHardwareVertexArrayAGP();
virtual void disableHardwareTextureShader();
virtual void forceDXTCCompression(bool dxtcComp);
virtual void setAnisotropicFilter(sint filter);
virtual void forceTextureResize(uint divisor);
virtual void forceNativeFragmentPrograms(bool /* nativeOnly */) {} // ignored
// Driver information
virtual uint getNumAdapter() const;
@ -841,6 +941,7 @@ public:
// todo hulud d3d buffers
virtual void getZBufferPart (std::vector<float> &zbuffer, NLMISC::CRect &rect);
virtual bool setRenderTarget (ITexture *tex, uint32 x, uint32 y, uint32 width, uint32 height, uint32 mipmapLevel, uint32 cubeFace);
virtual ITexture *getRenderTarget() const;
virtual bool copyTargetToTexture (ITexture *tex, uint32 offsetx, uint32 offsety, uint32 x, uint32 y, uint32 width,
uint32 height, uint32 mipmapLevel);
virtual bool getRenderTargetSize (uint32 &width, uint32 &height);
@ -959,9 +1060,9 @@ public:
virtual bool supportTextureShaders() const {return false;};
virtual bool supportMADOperator() const;
// todo hulud d3d adressing mode
virtual bool isWaterShaderSupported() const;
virtual bool supportWaterShader() const;
// todo hulud d3d adressing mode
virtual bool isTextureAddrModeSupported(CMaterial::TTexAddressingMode /* mode */) const {return false;};
virtual bool supportTextureAddrMode(CMaterial::TTexAddressingMode /* mode */) const {return false;};
// todo hulud d3d adressing mode
virtual void setMatrix2DForTextureOffsetAddrMode(const uint /* stage */, const float /* mat */[4]) {}
@ -991,18 +1092,133 @@ public:
virtual void setupMaterialPass(uint pass);
virtual void endMaterialMultiPass();
// Vertex program
virtual bool isVertexProgramSupported () const;
virtual bool isVertexProgramEmulated () const;
virtual bool activeVertexProgram (CVertexProgram *program);
virtual void setConstant (uint index, float, float, float, float);
virtual void setConstant (uint index, double, double, double, double);
virtual void setConstant (uint index, const NLMISC::CVector& value);
virtual void setConstant (uint index, const NLMISC::CVectorD& value);
virtual void setConstant (uint index, uint num, const float *src);
virtual void setConstant (uint index, uint num, const double *src);
virtual void setConstantMatrix (uint index, IDriver::TMatrix matrix, IDriver::TTransform transform);
virtual void setConstantFog (uint index);
/// \name Vertex Program
// @{
// Order of preference
// - activeVertexProgram
// - CMaterial pass[n] VP (uses activeVertexProgram, but does not override if one already set by code)
// - default generic VP that mimics fixed pipeline / no VP with fixed pipeline
/**
* Does the driver supports vertex program, but emulated by CPU ?
*/
virtual bool isVertexProgramEmulated() const;
/** Return true if the driver supports the specified vertex program profile.
*/
virtual bool supportVertexProgram(CVertexProgram::TProfile profile) const;
/** Compile the given vertex program, return if successful.
* If a vertex program was set active before compilation,
* the state of the active vertex program is undefined behaviour afterwards.
*/
virtual bool compileVertexProgram(CVertexProgram *program);
/** Set the active vertex program. This will override vertex programs specified in CMaterial render calls.
* Also used internally by setupMaterial(CMaterial) when getVertexProgram returns NULL.
* The vertex program is activated immediately.
*/
virtual bool activeVertexProgram(CVertexProgram *program);
// @}
/// \name Pixel Program
// @{
// Order of preference
// - activePixelProgram
// - CMaterial pass[n] PP (uses activePixelProgram, but does not override if one already set by code)
// - PP generated from CMaterial (uses activePixelProgram, but does not override if one already set by code)
/** Return true if the driver supports the specified pixel program profile.
*/
virtual bool supportPixelProgram(CPixelProgram::TProfile profile) const;
/** Compile the given pixel program, return if successful.
* If a pixel program was set active before compilation,
* the state of the active pixel program is undefined behaviour afterwards.
*/
virtual bool compilePixelProgram(CPixelProgram *program);
/** Set the active pixel program. This will override pixel programs specified in CMaterial render calls.
* Also used internally by setupMaterial(CMaterial) when getPixelProgram returns NULL.
* The pixel program is activated immediately.
*/
virtual bool activePixelProgram(CPixelProgram *program);
// @}
/// \name Geometry Program
// @{
// Order of preference
// - activeGeometryProgram
// - CMaterial pass[n] PP (uses activeGeometryProgram, but does not override if one already set by code)
// - none
/** Return true if the driver supports the specified pixel program profile.
*/
virtual bool supportGeometryProgram(CGeometryProgram::TProfile profile) const { return false; }
/** Compile the given pixel program, return if successful.
* If a pixel program was set active before compilation,
* the state of the active pixel program is undefined behaviour afterwards.
*/
virtual bool compileGeometryProgram(CGeometryProgram *program) { return false; }
/** Set the active pixel program. This will override pixel programs specified in CMaterial render calls.
* Also used internally by setupMaterial(CMaterial) when getGeometryProgram returns NULL.
* The pixel program is activated immediately.
*/
virtual bool activeGeometryProgram(CGeometryProgram *program) { return false; }
// @}
/// \name Program parameters
// @{
// Set parameters
virtual void setUniform1f(TProgram program, uint index, float f0);
virtual void setUniform2f(TProgram program, uint index, float f0, float f1);
virtual void setUniform3f(TProgram program, uint index, float f0, float f1, float f2);
virtual void setUniform4f(TProgram program, uint index, float f0, float f1, float f2, float f3);
virtual void setUniform1i(TProgram program, uint index, sint32 i0);
virtual void setUniform2i(TProgram program, uint index, sint32 i0, sint32 i1);
virtual void setUniform3i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2);
virtual void setUniform4i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2, sint32 i3);
virtual void setUniform1ui(TProgram program, uint index, uint32 ui0);
virtual void setUniform2ui(TProgram program, uint index, uint32 ui0, uint32 ui1);
virtual void setUniform3ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2);
virtual void setUniform4ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3);
virtual void setUniform3f(TProgram program, uint index, const NLMISC::CVector& v);
virtual void setUniform4f(TProgram program, uint index, const NLMISC::CVector& v, float f3);
virtual void setUniform4f(TProgram program, uint index, const NLMISC::CRGBAF& rgba);
virtual void setUniform4x4f(TProgram program, uint index, const NLMISC::CMatrix& m);
virtual void setUniform4fv(TProgram program, uint index, size_t num, const float *src);
virtual void setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src);
virtual void setUniform4uiv(TProgram program, uint index, size_t num, const uint32 *src);
// Set builtin parameters
virtual void setUniformMatrix(TProgram program, uint index, TMatrix matrix, TTransform transform);
virtual void setUniformFog(TProgram program, uint index);
// Set feature parameters
virtual bool setUniformDriver(TProgram program); // set all driver-specific features params (based on program->features->DriverFlags)
virtual bool setUniformMaterial(TProgram program, CMaterial &material); // set all material-specific feature params (based on program->features->MaterialFlags)
virtual void setUniformParams(TProgram program, CGPUProgramParams &params); // set all user-provided params from the storage
virtual bool isUniformProgramState() { return false; }
// @}
virtual void enableVertexProgramDoubleSidedColor(bool doubleSided);
virtual bool supportVertexProgramDoubleSidedColor() const;
@ -1021,7 +1237,7 @@ public:
* ColorOp[n] = DISABLE;
* AlphaOp[n] = DISABLE;
*/
virtual bool activeShader(CShader *shd);
bool activeShader(CD3DShaderFX *shd);
// Bench
virtual void startBench (bool wantStandardDeviation = false, bool quick = false, bool reset = true);
@ -1040,8 +1256,6 @@ public:
uint32 getMaxVertexIndex() const { return _MaxVertexIndex; }
bool supportPixelShaders() const { return _PixelShader; }
// *** Inline info
uint inlGetNumTextStages() const { return _NbNeLTextureStages; }
@ -1892,12 +2106,21 @@ public:
return d3dtex;
}
// Get the d3dtext mirror of an existing setuped pixel program.
static inline CPixelProgramDrvInfosD3D* getPixelProgramD3D(CPixelProgram& pixelProgram)
{
H_AUTO_D3D(CDriverD3D_getPixelProgramD3D);
CPixelProgramDrvInfosD3D* d3dPixelProgram;
d3dPixelProgram = (CPixelProgramDrvInfosD3D*)(IProgramDrvInfos*)(pixelProgram.m_DrvInfo);
return d3dPixelProgram;
}
// Get the d3dtext mirror of an existing setuped vertex program.
static inline CVertexProgamDrvInfosD3D* getVertexProgramD3D(CVertexProgram& vertexProgram)
{
H_AUTO_D3D(CDriverD3D_getVertexProgramD3D);
CVertexProgamDrvInfosD3D* d3dVertexProgram;
d3dVertexProgram = (CVertexProgamDrvInfosD3D*)(IVertexProgramDrvInfos*)(vertexProgram._DrvInfo);
d3dVertexProgram = (CVertexProgamDrvInfosD3D*)(IProgramDrvInfos*)(vertexProgram.m_DrvInfo);
return d3dVertexProgram;
}
@ -1943,7 +2166,7 @@ public:
void releaseInternalShaders();
bool setShaderTexture (uint textureHandle, ITexture *texture, CFXCache *cache);
bool validateShader(CShader *shader);
bool validateShader(CD3DShaderFX *shader);
void activePass (uint pass)
{
@ -2080,6 +2303,8 @@ private:
void findNearestFullscreenVideoMode();
TShaderDrvInfoPtrList _ShaderDrvInfos;
// Windows
std::string _WindowClass;
HWND _HWnd;
@ -2197,8 +2422,10 @@ private:
bool _ForceDXTCCompression:1;
bool _TextureCubeSupported;
bool _VertexProgram;
bool _PixelShader;
bool _PixelProgram;
uint16 _PixelProgramVersion;
bool _DisableHardwareVertexProgram;
bool _DisableHardwarePixelProgram;
bool _DisableHardwareVertexArrayAGP;
bool _DisableHardwareIndexArrayAGP;
bool _DisableHardwarePixelShader;
@ -2316,6 +2543,9 @@ private:
// The last vertex buffer needs vertex color
bool _FogEnabled;
NLMISC::CRefPtr<CVertexProgram> _VertexProgramUser;
NLMISC::CRefPtr<CPixelProgram> _PixelProgramUser;
// *** Internal resources
// Current render pass
@ -2344,7 +2574,7 @@ private:
CIndexBuffer _QuadIndexesAGP;
// The last setuped shader
CShader *_CurrentShader;
CD3DShaderFX *_CurrentShader;
UINT _CurrentShaderPassCount;
public:
struct CTextureRef
@ -2369,29 +2599,29 @@ private:
CRenderVariable *_ModifiedRenderState;
// Internal shaders
CShader _ShaderLightmap0;
CShader _ShaderLightmap1;
CShader _ShaderLightmap2;
CShader _ShaderLightmap3;
CShader _ShaderLightmap4;
CShader _ShaderLightmap0Blend;
CShader _ShaderLightmap1Blend;
CShader _ShaderLightmap2Blend;
CShader _ShaderLightmap3Blend;
CShader _ShaderLightmap4Blend;
CShader _ShaderLightmap0X2;
CShader _ShaderLightmap1X2;
CShader _ShaderLightmap2X2;
CShader _ShaderLightmap3X2;
CShader _ShaderLightmap4X2;
CShader _ShaderLightmap0BlendX2;
CShader _ShaderLightmap1BlendX2;
CShader _ShaderLightmap2BlendX2;
CShader _ShaderLightmap3BlendX2;
CShader _ShaderLightmap4BlendX2;
CShader _ShaderCloud;
CShader _ShaderWaterNoDiffuse;
CShader _ShaderWaterDiffuse;
CD3DShaderFX _ShaderLightmap0;
CD3DShaderFX _ShaderLightmap1;
CD3DShaderFX _ShaderLightmap2;
CD3DShaderFX _ShaderLightmap3;
CD3DShaderFX _ShaderLightmap4;
CD3DShaderFX _ShaderLightmap0Blend;
CD3DShaderFX _ShaderLightmap1Blend;
CD3DShaderFX _ShaderLightmap2Blend;
CD3DShaderFX _ShaderLightmap3Blend;
CD3DShaderFX _ShaderLightmap4Blend;
CD3DShaderFX _ShaderLightmap0X2;
CD3DShaderFX _ShaderLightmap1X2;
CD3DShaderFX _ShaderLightmap2X2;
CD3DShaderFX _ShaderLightmap3X2;
CD3DShaderFX _ShaderLightmap4X2;
CD3DShaderFX _ShaderLightmap0BlendX2;
CD3DShaderFX _ShaderLightmap1BlendX2;
CD3DShaderFX _ShaderLightmap2BlendX2;
CD3DShaderFX _ShaderLightmap3BlendX2;
CD3DShaderFX _ShaderLightmap4BlendX2;
CD3DShaderFX _ShaderCloud;
CD3DShaderFX _ShaderWaterNoDiffuse;
CD3DShaderFX _ShaderWaterDiffuse;
// Backup frame buffer
@ -2527,6 +2757,10 @@ public:
// Clip the wanted rectangle with window. return true if rect is not NULL.
bool clipRect(NLMISC::CRect &rect);
friend class IShaderDrvInfos;
void removeShaderDrvInfoPtr(ItShaderDrvInfoPtrList shaderIt);
};
#define NL_D3DCOLOR_RGBA(rgba) (D3DCOLOR_ARGB(rgba.A,rgba.R,rgba.G,rgba.B))

View file

@ -328,7 +328,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
pShader = static_cast<CMaterialDrvInfosD3D*>((IMaterialDrvInfos*)(mat._MatDrvInfo));
// Now we can get the supported shader from the cache.
CMaterial::TShader matShader = mat.getShader();
CMaterial::TShader matShader = _PixelProgramUser ? CMaterial::Program : mat.getShader();
if (_CurrentMaterialSupportedShader != CMaterial::Normal)
{
@ -567,7 +567,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
normalShaderDesc.TexEnvMode[stage] = mat.getTexEnvMode(uint8(stage));
}
if (_PixelShader)
if (_PixelProgram)
{
#ifdef NL_DEBUG_D3D
// Check, should not occured
@ -648,7 +648,9 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
// Must separate texture setup and texture activation in 2 "for"...
// because setupTexture() may disable all stage.
if (matShader == CMaterial::Normal)
if (matShader == CMaterial::Normal
|| ((matShader == CMaterial::Program) && (_PixelProgramUser->features().MaterialFlags & CProgramFeatures::TextureStages))
)
{
uint stage;
for(stage=0 ; stage<maxTexture; ++stage)
@ -668,7 +670,9 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
// Don't do it also for Specular because the EnvFunction and the TexGen may be special.
{
H_AUTO_D3D(CDriverD3D_setupMaterial_normalShaderActivateTextures)
if(matShader == CMaterial::Normal)
if (matShader == CMaterial::Normal
|| ((matShader == CMaterial::Program) && (_PixelProgramUser->features().MaterialFlags & CProgramFeatures::TextureStages))
)
{
uint stage;
for(stage=0 ; stage<maxTexture; ++stage)
@ -933,7 +937,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
activeShader (NULL);
/* If unlighted trick is needed, set the shader later */
if (!pShader->NeedsConstantForDiffuse && _PixelShader)
if (!pShader->NeedsConstantForDiffuse && _PixelProgram)
setPixelShader (pShader->PixelShader);
}
break;
@ -2019,7 +2023,7 @@ void CDriverD3D::endMaterialMultiPass()
bool CDriverD3D::supportCloudRenderSinglePass () const
{
H_AUTO_D3D(CDriver3D_supportCloudRenderSinglePass);
return _PixelShader;
return _PixelProgram;
}
// ***************************************************************************

View file

@ -0,0 +1,153 @@
/** \file driver_direct3d_pixel_program.cpp
* Direct 3d driver implementation
*
* $Id: driver_direct3d_pixel_program.cpp,v 1.1.2.4 2007/07/09 15:26:35 legallo Exp $
*
* \todo manage better the init/release system (if a throw occurs in the init, we must release correctly the driver)
*/
/* Copyright, 2000 Nevrax Ltd.
*
* This file is part of NEVRAX NEL.
* NEVRAX NEL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* NEVRAX NEL is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with NEVRAX NEL; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
#include "stddirect3d.h"
#include "driver_direct3d.h"
using namespace std;
using namespace NLMISC;
namespace NL3D
{
// ***************************************************************************
CPixelProgramDrvInfosD3D::CPixelProgramDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos (drv, it)
{
H_AUTO_D3D(CPixelProgramDrvInfosD3D_CPixelProgamDrvInfosD3D)
Shader = NULL;
}
// ***************************************************************************
CPixelProgramDrvInfosD3D::~CPixelProgramDrvInfosD3D()
{
H_AUTO_D3D(CPixelProgramDrvInfosD3D_CPixelProgramDrvInfosD3DDtor)
if (Shader)
Shader->Release();
}
// ***************************************************************************
bool CDriverD3D::supportPixelProgram (CPixelProgram::TProfile profile) const
{
H_AUTO_D3D(CDriverD3D_supportPixelProgram_profile)
return ((profile & 0xFFFF0000) == 0xD9020000)
&& (_PixelProgramVersion >= (uint16)(profile & 0x0000FFFF));
}
// ***************************************************************************
bool CDriverD3D::compilePixelProgram(CPixelProgram *program)
{
// Program setuped ?
if (program->m_DrvInfo==NULL)
{
// Find a supported pixel program profile
IProgram::CSource *source = NULL;
for (uint i = 0; i < program->getSourceNb(); ++i)
{
if (supportPixelProgram(program->getSource(i)->Profile))
{
source = program->getSource(i);
}
}
if (!source)
{
nlwarning("No supported source profile for pixel program");
return false;
}
_GPUPrgDrvInfos.push_front (NULL);
ItGPUPrgDrvInfoPtrList itPix = _GPUPrgDrvInfos.begin();
CPixelProgramDrvInfosD3D *drvInfo;
*itPix = drvInfo = new CPixelProgramDrvInfosD3D(this, itPix);
// Create a driver info structure
program->m_DrvInfo = *itPix;
LPD3DXBUFFER pShader;
LPD3DXBUFFER pErrorMsgs;
if (D3DXAssembleShader(source->SourcePtr, source->SourceLen, NULL, NULL, 0, &pShader, &pErrorMsgs) == D3D_OK)
{
if (_DeviceInterface->CreatePixelShader((DWORD*)pShader->GetBufferPointer(), &(getPixelProgramD3D(*program)->Shader)) != D3D_OK)
return false;
}
else
{
nlwarning ("Can't assemble pixel program:");
nlwarning ((const char*)pErrorMsgs->GetBufferPointer());
return false;
}
// Set parameters for assembly programs
drvInfo->ParamIndices = source->ParamIndices;
// Build the feature info
program->buildInfo(source);
}
return true;
}
// ***************************************************************************
bool CDriverD3D::activePixelProgram(CPixelProgram *program)
{
H_AUTO_D3D(CDriverD3D_activePixelProgram )
if (_DisableHardwarePixelProgram)
return false;
// Set the pixel program
if (program)
{
if (!CDriverD3D::compilePixelProgram(program)) return false;
CPixelProgramDrvInfosD3D *info = static_cast<CPixelProgramDrvInfosD3D *>((IProgramDrvInfos*)program->m_DrvInfo);
_PixelProgramUser = program;
setPixelShader(info->Shader);
}
else
{
setPixelShader(NULL);
_PixelProgramUser = NULL;
}
return true;
}
// ***************************************************************************
void CDriverD3D::disableHardwarePixelProgram()
{
H_AUTO_D3D(CDriverD3D_disableHardwarePixelProgram)
_DisableHardwarePixelProgram = true;
_PixelProgram = false;
}
} // NL3D

View file

@ -17,6 +17,8 @@
#include "stddirect3d.h"
#include "driver_direct3d.h"
#include "nel/misc/path.h"
#include "nel/misc/file.h"
using namespace std;
using namespace NLMISC;
@ -24,6 +26,93 @@ using namespace NLMISC;
namespace NL3D
{
// ***************************************************************************
CD3DShaderFX::~CD3DShaderFX()
{
// Must kill the drv mirror of this shader.
_DrvInfo.kill();
}
// ***************************************************************************
CD3DShaderFX::CD3DShaderFX()
{
_ShaderChanged = true;
}
// ***************************************************************************
void CD3DShaderFX::setText (const char *text)
{
_Text = text;
_ShaderChanged = true;
}
// ***************************************************************************
void CD3DShaderFX::setName (const char *name)
{
_Name = name;
_ShaderChanged = true;
}
// ***************************************************************************
bool CD3DShaderFX::loadShaderFile (const char *filename)
{
_Text = "";
// Lookup
string _filename = NLMISC::CPath::lookup(filename, false, true, true);
if (!_filename.empty())
{
// File length
uint size = NLMISC::CFile::getFileSize (_filename);
_Text.reserve (size+1);
try
{
NLMISC::CIFile file;
if (file.open (_filename))
{
// Read it
while (!file.eof ())
{
char line[512];
file.getline (line, 512);
_Text += line;
}
// Set the shader name
_Name = NLMISC::CFile::getFilename (filename);
return true;
}
else
{
nlwarning ("Can't open the file %s for reading", _filename.c_str());
}
}
catch (const Exception &e)
{
nlwarning ("Error while reading %s : %s", _filename.c_str(), e.what());
}
}
return false;
}
// ***************************************************************************
IShaderDrvInfos::~IShaderDrvInfos()
{
_Driver->removeShaderDrvInfoPtr(_DriverIterator);
}
void CDriverD3D::removeShaderDrvInfoPtr(ItShaderDrvInfoPtrList shaderIt)
{
_ShaderDrvInfos.erase(shaderIt);
}
// mem allocator for state records
std::allocator<uint8> CStateRecord::Allocator;
@ -249,7 +338,7 @@ HRESULT CDriverD3D::SetVertexShaderConstantI(UINT StartRegister, CONST INT* pCon
// ***************************************************************************
CShaderDrvInfosD3D::CShaderDrvInfosD3D(IDriver *drv, ItShaderDrvInfoPtrList it) : IShaderDrvInfos(drv, it)
CShaderDrvInfosD3D::CShaderDrvInfosD3D(CDriverD3D *drv, ItShaderDrvInfoPtrList it) : IShaderDrvInfos(drv, it)
{
H_AUTO_D3D(CShaderDrvInfosD3D_CShaderDrvInfosD3D)
Validated = false;
@ -265,7 +354,7 @@ CShaderDrvInfosD3D::~CShaderDrvInfosD3D()
// ***************************************************************************
bool CDriverD3D::validateShader(CShader *shader)
bool CDriverD3D::validateShader(CD3DShaderFX *shader)
{
H_AUTO_D3D(CDriverD3D_validateShader)
CShaderDrvInfosD3D *shaderInfo = static_cast<CShaderDrvInfosD3D*>((IShaderDrvInfos*)shader->_DrvInfo);
@ -327,7 +416,7 @@ bool CDriverD3D::validateShader(CShader *shader)
// ***************************************************************************
bool CDriverD3D::activeShader(CShader *shd)
bool CDriverD3D::activeShader(CD3DShaderFX *shd)
{
H_AUTO_D3D(CDriverD3D_activeShader)
if (_DisableHardwarePixelShader)
@ -393,7 +482,7 @@ bool CDriverD3D::activeShader(CShader *shd)
}
static void setFX(CShader &s, const char *name, const char *prog, CDriverD3D *drv)
static void setFX(CD3DShaderFX &s, const char *name, const char *prog, CDriverD3D *drv)
{
H_AUTO_D3D(setFX)

View file

@ -1187,6 +1187,11 @@ bool CDriverD3D::setRenderTarget (ITexture *tex, uint32 /* x */, uint32 /* y */,
return true;
}
ITexture *CDriverD3D::getRenderTarget() const
{
return _RenderTarget.Texture;
}
// ***************************************************************************
bool CDriverD3D::copyTargetToTexture (ITexture * /* tex */, uint32 /* offsetx */, uint32 /* offsety */, uint32 /* x */, uint32 /* y */, uint32 /* width */,

View file

@ -0,0 +1,242 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stddirect3d.h"
#include "driver_direct3d.h"
using namespace std;
using namespace NLMISC;
namespace NL3D
{
void CDriverD3D::setUniform4f(TProgram program, uint index, float f0, float f1, float f2, float f3)
{
H_AUTO_D3D(CDriverD3D_setUniform4f);
const float tabl[4] = { f0, f1, f2, f3 };
switch (program)
{
case VertexProgram:
if (_VertexProgram)
{
setVertexProgramConstant(index, tabl);
}
break;
case PixelProgram:
if (_PixelProgram)
{
setPixelShaderConstant(index, tabl);
}
break;
}
}
void CDriverD3D::setUniform4fv(TProgram program, uint index, size_t num, const float *src)
{
H_AUTO_D3D(CDriverD3D_setUniform4fv);
switch (program)
{
case VertexProgram:
if (_VertexProgram)
{
for (uint i = 0; i < num; ++i)
{
setVertexProgramConstant(index + i, src + (i * 4));
}
}
break;
case PixelProgram:
if (_PixelProgram)
{
for (uint i = 0; i < num; ++i)
{
setPixelShaderConstant(index + i, src + (i * 4));
}
}
break;
}
}
void CDriverD3D::setUniform1f(TProgram program, uint index, float f0)
{
CDriverD3D::setUniform4f(program, index, f0, 0.f, 0.f, 0.f);
}
void CDriverD3D::setUniform2f(TProgram program, uint index, float f0, float f1)
{
CDriverD3D::setUniform4f(program, index, f0, f1, 0.f, 0.f);
}
void CDriverD3D::setUniform3f(TProgram program, uint index, float f0, float f1, float f2)
{
CDriverD3D::setUniform4f(program, index, f0, f1, f2, 0.0f);
}
void CDriverD3D::setUniform1i(TProgram program, uint index, sint32 i0)
{
}
void CDriverD3D::setUniform2i(TProgram program, uint index, sint32 i0, sint32 i1)
{
}
void CDriverD3D::setUniform3i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2)
{
}
void CDriverD3D::setUniform4i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2, sint32 i3)
{
}
void CDriverD3D::setUniform1ui(TProgram program, uint index, uint32 ui0)
{
}
void CDriverD3D::setUniform2ui(TProgram program, uint index, uint32 ui0, uint32 ui1)
{
}
void CDriverD3D::setUniform3ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2)
{
}
void CDriverD3D::setUniform4ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3)
{
}
void CDriverD3D::setUniform3f(TProgram program, uint index, const NLMISC::CVector& v)
{
CDriverD3D::setUniform4f(program, index, v.x, v.y, v.z, 0.f);
}
void CDriverD3D::setUniform4f(TProgram program, uint index, const NLMISC::CVector& v, float f3)
{
CDriverD3D::setUniform4f(program, index, v.x, v.y, v.z, f3);
}
void CDriverD3D::setUniform4f(TProgram program, uint index, const NLMISC::CRGBAF& rgba)
{
CDriverD3D::setUniform4fv(program, index, 1, &rgba.R);
}
void CDriverD3D::setUniform4x4f(TProgram program, uint index, const NLMISC::CMatrix& m)
{
H_AUTO_D3D(CDriverD3D_setUniform4x4f);
// TODO: Verify this!
NLMISC::CMatrix mat = m;
mat.transpose();
const float *md = mat.get();
CDriverD3D::setUniform4fv(program, index, 4, md);
}
void CDriverD3D::setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src)
{
}
void CDriverD3D::setUniform4uiv(TProgram program, uint index, size_t num, const uint32 *src)
{
}
void CDriverD3D::setUniformMatrix(NL3D::IDriver::TProgram program, uint index, NL3D::IDriver::TMatrix matrix, NL3D::IDriver::TTransform transform)
{
H_AUTO_D3D(CDriverD3D_setUniformMatrix);
D3DXMATRIX mat;
D3DXMATRIX *matPtr = NULL;
switch (matrix)
{
case IDriver::ModelView:
matPtr = &_D3DModelView;
break;
case IDriver::Projection:
matPtr = &(_MatrixCache[remapMatrixIndex(D3DTS_PROJECTION)].Matrix);
break;
case IDriver::ModelViewProjection:
matPtr = &_D3DModelViewProjection;
break;
}
if (transform != IDriver::Identity)
{
switch (transform)
{
case IDriver::Inverse:
D3DXMatrixInverse(&mat, NULL, matPtr);
break;
case IDriver::Transpose:
D3DXMatrixTranspose(&mat, matPtr);
break;
case IDriver::InverseTranspose:
D3DXMatrixInverse(&mat, NULL, matPtr);
D3DXMatrixTranspose(&mat, &mat);
break;
}
matPtr = &mat;
}
D3DXMatrixTranspose(&mat, matPtr);
CDriverD3D::setUniform4fv(program, index, 4, &mat.m[0][0]);
}
void CDriverD3D::setUniformFog(NL3D::IDriver::TProgram program, uint index)
{
H_AUTO_D3D(CDriverD3D_setUniformFog)
/* "oFog" must always be between [1, 0] what ever you set in D3DRS_FOGSTART and D3DRS_FOGEND (1 for no fog, 0 for full fog).
The Geforce4 TI 4200 (drivers 53.03 and 45.23) doesn't accept other values for "oFog". */
const float delta = _FogEnd - _FogStart;
CDriverD3D::setUniform4f(program, index,
-_D3DModelView._13 / delta,
-_D3DModelView._23 / delta,
-_D3DModelView._33 / delta,
1 - (_D3DModelView._43 - _FogStart) / delta);
}
bool CDriverD3D::setUniformDriver(TProgram program)
{
// todo
return true;
}
bool CDriverD3D::setUniformMaterial(TProgram program, CMaterial &material)
{
// todo
return true;
}
void CDriverD3D::setUniformParams(TProgram program, CGPUProgramParams &params)
{
// todo
}
} // NL3D

View file

@ -26,7 +26,7 @@ namespace NL3D
// ***************************************************************************
CVertexProgamDrvInfosD3D::CVertexProgamDrvInfosD3D(IDriver *drv, ItVtxPrgDrvInfoPtrList it) : IVertexProgramDrvInfos (drv, it)
CVertexProgamDrvInfosD3D::CVertexProgamDrvInfosD3D(IDriver *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos (drv, it)
{
H_AUTO_D3D(CVertexProgamDrvInfosD3D_CVertexProgamDrvInfosD3D)
Shader = NULL;
@ -43,10 +43,10 @@ CVertexProgamDrvInfosD3D::~CVertexProgamDrvInfosD3D()
// ***************************************************************************
bool CDriverD3D::isVertexProgramSupported () const
bool CDriverD3D::supportVertexProgram (CVertexProgram::TProfile profile) const
{
H_AUTO_D3D(CDriverD3D_isVertexProgramSupported )
return _VertexProgram;
H_AUTO_D3D(CDriverD3D_supportVertexProgram )
return (profile == CVertexProgram::nelvp) && _VertexProgram;
}
// ***************************************************************************
@ -262,101 +262,130 @@ void dump(const CVPParser::TProgram &prg, std::string &dest)
// ***************************************************************************
bool CDriverD3D::compileVertexProgram(NL3D::CVertexProgram *program)
{
// Program setuped ?
if (program->m_DrvInfo == NULL)
{
// Find nelvp
IProgram::CSource *source = NULL;
for (uint i = 0; i < program->getSourceNb(); ++i)
{
if (program->getSource(i)->Profile == CVertexProgram::nelvp)
{
source = program->getSource(i);
}
}
if (!source)
{
nlwarning("Direct3D driver only supports 'nelvp' profile, vertex program cannot be used");
return false;
}
_GPUPrgDrvInfos.push_front (NULL);
ItGPUPrgDrvInfoPtrList itTex = _GPUPrgDrvInfos.begin();
CVertexProgamDrvInfosD3D *drvInfo;
*itTex = drvInfo = new CVertexProgamDrvInfosD3D(this, itTex);
// Create a driver info structure
program->m_DrvInfo = *itTex;
/** Check with our parser if the program will works with other implemented extensions, too. (EXT_vertex_shader ..).
* There are some incompatibilities.
*/
CVPParser parser;
CVPParser::TProgram parsedProgram;
std::string errorOutput;
bool result = parser.parse(source->SourcePtr, parsedProgram, errorOutput);
if (!result)
{
nlwarning("Unable to parse a vertex program :");
nlwarning(errorOutput.c_str());
#ifdef NL_DEBUG_D3D
nlassert(0);
#endif // NL_DEBUG_D3D
return false;
}
// tmp fix for Radeon 8500/9000/9200
// Currently they hang when PaletteSkin / SkinWeight are present in the vertex declaration, but not used
// so disable them in the vertex declaration
// We don't use these component in vertex programs currently..
#ifdef NL_DEBUG
for(uint k = 0; k < parsedProgram.size(); ++k)
{
for(uint l = 0; l < parsedProgram[k].getNumUsedSrc(); ++l)
{
const CVPOperand &op = parsedProgram[k].getSrc(l);
if (op.Type == CVPOperand::InputRegister)
{
nlassert(op.Value.InputRegisterValue != CVPOperand::IWeight);
nlassert(op.Value.InputRegisterValue != CVPOperand::IPaletteSkin);
}
}
}
#endif
// Dump the vertex program
std::string dest;
dump(parsedProgram, dest);
#ifdef NL_DEBUG_D3D
nlinfo("Assemble Vertex Shader : ");
string::size_type lineBegin = 0;
string::size_type lineEnd;
while ((lineEnd = dest.find('\n', lineBegin)) != string::npos)
{
nlinfo(dest.substr (lineBegin, lineEnd-lineBegin).c_str());
lineBegin = lineEnd+1;
}
nlinfo(dest.substr (lineBegin, lineEnd-lineBegin).c_str());
#endif // NL_DEBUG_D3D
LPD3DXBUFFER pShader;
LPD3DXBUFFER pErrorMsgs;
if (D3DXAssembleShader (dest.c_str(), (UINT)dest.size(), NULL, NULL, 0, &pShader, &pErrorMsgs) == D3D_OK)
{
if (_DeviceInterface->CreateVertexShader((DWORD*)pShader->GetBufferPointer(), &(getVertexProgramD3D(*program)->Shader)) != D3D_OK)
return false;
}
else
{
nlwarning ("Can't assemble vertex program:");
nlwarning ((const char*)pErrorMsgs->GetBufferPointer());
return false;
}
// Set parameters for assembly programs
drvInfo->ParamIndices = source->ParamIndices;
// Build the feature info
program->buildInfo(source);
}
return true;
}
// ***************************************************************************
bool CDriverD3D::activeVertexProgram (CVertexProgram *program)
{
H_AUTO_D3D(CDriverD3D_activeVertexProgram )
if (_DisableHardwareVertexProgram)
return false;
// Setup or unsetup ?
if (program)
{
// Program setuped ?
if (program->_DrvInfo==NULL)
{
_VtxPrgDrvInfos.push_front (NULL);
ItVtxPrgDrvInfoPtrList itTex = _VtxPrgDrvInfos.begin();
*itTex = new CVertexProgamDrvInfosD3D(this, itTex);
// Create a driver info structure
program->_DrvInfo = *itTex;
/** Check with our parser if the program will works with other implemented extensions, too. (EXT_vertex_shader ..).
* There are some incompatibilities.
*/
CVPParser parser;
CVPParser::TProgram parsedProgram;
std::string errorOutput;
bool result = parser.parse(program->getProgram().c_str(), parsedProgram, errorOutput);
if (!result)
{
nlwarning("Unable to parse a vertex program :");
nlwarning(errorOutput.c_str());
#ifdef NL_DEBUG_D3D
nlassert(0);
#endif // NL_DEBUG_D3D
return false;
}
// tmp fix for Radeon 8500/9000/9200
// Currently they hang when PaletteSkin / SkinWeight are present in the vertex declaration, but not used
// so disable them in the vertex declaration
// We don't use these component in vertex programs currently..
#ifdef NL_DEBUG
for(uint k = 0; k < parsedProgram.size(); ++k)
{
for(uint l = 0; l < parsedProgram[k].getNumUsedSrc(); ++l)
{
const CVPOperand &op = parsedProgram[k].getSrc(l);
if (op.Type == CVPOperand::InputRegister)
{
nlassert(op.Value.InputRegisterValue != CVPOperand::IWeight);
nlassert(op.Value.InputRegisterValue != CVPOperand::IPaletteSkin);
}
}
}
#endif
// Dump the vertex program
std::string dest;
dump(parsedProgram, dest);
#ifdef NL_DEBUG_D3D
nlinfo("Assemble Vertex Shader : ");
string::size_type lineBegin = 0;
string::size_type lineEnd;
while ((lineEnd = dest.find('\n', lineBegin)) != string::npos)
{
nlinfo(dest.substr (lineBegin, lineEnd-lineBegin).c_str());
lineBegin = lineEnd+1;
}
nlinfo(dest.substr (lineBegin, lineEnd-lineBegin).c_str());
#endif // NL_DEBUG_D3D
LPD3DXBUFFER pShader;
LPD3DXBUFFER pErrorMsgs;
if (D3DXAssembleShader (dest.c_str(), (UINT)dest.size(), NULL, NULL, 0, &pShader, &pErrorMsgs) == D3D_OK)
{
if (_DeviceInterface->CreateVertexShader((DWORD*)pShader->GetBufferPointer(), &(getVertexProgramD3D(*program)->Shader)) != D3D_OK)
return false;
}
else
{
nlwarning ("Can't assemble vertex program:");
nlwarning ((const char*)pErrorMsgs->GetBufferPointer());
return false;
}
}
}
// Set the vertex program
if (program)
{
CVertexProgamDrvInfosD3D *info = static_cast<CVertexProgamDrvInfosD3D *>((IVertexProgramDrvInfos*)program->_DrvInfo);
if (!CDriverD3D::compileVertexProgram(program)) return false;
CVertexProgamDrvInfosD3D *info = NLMISC::safe_cast<CVertexProgamDrvInfosD3D *>((IProgramDrvInfos*)program->m_DrvInfo);
_VertexProgramUser = program;
setVertexProgram (info->Shader, program);
/* D3DRS_FOGSTART and D3DRS_FOGEND must be set with [1, 0] else the fog doesn't work properly on VertexShader and non-VertexShader objects
(random fog flicking) with Geforce4 TI 4200 (drivers 53.03 and 45.23). The other cards seam to interpret the "oFog"'s values using D3DRS_FOGSTART,
D3DRS_FOGEND.
Related to setUniformFog().
*/
float z = 0;
float o = 1;
@ -366,6 +395,7 @@ bool CDriverD3D::activeVertexProgram (CVertexProgram *program)
else
{
setVertexProgram (NULL, NULL);
_VertexProgramUser = NULL;
// Set the old fog range
setRenderState (D3DRS_FOGSTART, *((DWORD*) (&_FogStart)));
@ -377,171 +407,6 @@ bool CDriverD3D::activeVertexProgram (CVertexProgram *program)
// ***************************************************************************
void CDriverD3D::setConstant (uint index, float f0, float f1, float f2, float f3)
{
H_AUTO_D3D(CDriverD3D_setConstant )
if (!_VertexProgram)
{
#ifdef NL_DEBUG
nlwarning("No vertex programs available!!");
#endif
return;
}
const float tabl[4] = {f0, f1, f2, f3};
setVertexProgramConstant (index, tabl);
}
// ***************************************************************************
void CDriverD3D::setConstant (uint index, double d0, double d1, double d2, double d3)
{
H_AUTO_D3D(CDriverD3D_setConstant )
if (!_VertexProgram)
{
#ifdef NL_DEBUG
nlwarning("No vertex programs available!!");
#endif
return;
}
const float tabl[4] = {(float)d0, (float)d1, (float)d2, (float)d3};
setVertexProgramConstant (index, tabl);
}
// ***************************************************************************
void CDriverD3D::setConstant (uint index, const NLMISC::CVector& value)
{
H_AUTO_D3D(CDriverD3D_setConstant )
if (!_VertexProgram)
{
#ifdef NL_DEBUG
nlwarning("No vertex programs available!!");
#endif
return;
}
const float tabl[4] = {value.x, value.y, value.z, 0};
setVertexProgramConstant (index, tabl);
}
// ***************************************************************************
void CDriverD3D::setConstant (uint index, const NLMISC::CVectorD& value)
{
H_AUTO_D3D(CDriverD3D_setConstant )
if (!_VertexProgram)
{
#ifdef NL_DEBUG
nlwarning("No vertex programs available!!");
#endif
return;
}
const float tabl[4] = {(float)value.x, (float)value.y, (float)value.z, 0};
setVertexProgramConstant (index, tabl);
}
// ***************************************************************************
void CDriverD3D::setConstant (uint index, uint num, const float *src)
{
H_AUTO_D3D(CDriverD3D_setConstant )
if (!_VertexProgram)
{
#ifdef NL_DEBUG
nlwarning("No vertex programs available!!");
#endif
return;
}
uint i;
for (i=0; i<num; i++)
setVertexProgramConstant (index+i, src+i*4);
}
// ***************************************************************************
void CDriverD3D::setConstant (uint index, uint num, const double *src)
{
H_AUTO_D3D(CDriverD3D_setConstant )
if (!_VertexProgram)
{
#ifdef NL_DEBUG
nlwarning("No vertex programs available!!");
#endif
return;
}
uint i;
for (i=0; i<num; i++)
{
const float tabl[4] = {(float)src[0], (float)src[1], (float)src[2], (float)src[3]};
setVertexProgramConstant (index+i, tabl);
src += 4;
}
}
// ***************************************************************************
void CDriverD3D::setConstantMatrix (uint index, IDriver::TMatrix matrix, IDriver::TTransform transform)
{
H_AUTO_D3D(CDriverD3D_setConstantMatrix )
if (!_VertexProgram)
{
#ifdef NL_DEBUG
nlwarning("No vertex programs available!!");
#endif
return;
}
D3DXMATRIX mat;
D3DXMATRIX *matPtr = NULL;
switch (matrix)
{
case IDriver::ModelView:
matPtr = &_D3DModelView;
break;
case IDriver::Projection:
matPtr = &(_MatrixCache[remapMatrixIndex (D3DTS_PROJECTION)].Matrix);
break;
case IDriver::ModelViewProjection:
matPtr = &_D3DModelViewProjection;
break;
}
if (transform != IDriver::Identity)
{
mat = *matPtr;
matPtr = &mat;
switch(transform)
{
case IDriver::Inverse:
D3DXMatrixInverse (&mat, NULL, &mat);
break;
case IDriver::Transpose:
D3DXMatrixTranspose (&mat, &mat);
break;
case IDriver::InverseTranspose:
D3DXMatrixInverse (&mat, NULL, &mat);
D3DXMatrixTranspose (&mat, &mat);
break;
}
}
setConstant (index, matPtr->_11, matPtr->_21, matPtr->_31, matPtr->_41);
setConstant (index+1, matPtr->_12, matPtr->_22, matPtr->_32, matPtr->_42);
setConstant (index+2, matPtr->_13, matPtr->_23, matPtr->_33, matPtr->_43);
setConstant (index+3, matPtr->_14, matPtr->_24, matPtr->_34, matPtr->_44);
}
// ***************************************************************************
void CDriverD3D::setConstantFog (uint index)
{
H_AUTO_D3D(CDriverD3D_setConstantFog )
/* "oFog" must always be between [1, 0] what ever you set in D3DRS_FOGSTART and D3DRS_FOGEND (1 for no fog, 0 for full fog).
The Geforce4 TI 4200 (drivers 53.03 and 45.23) doesn't accept other values for "oFog". */
const float delta = _FogEnd-_FogStart;
setConstant (index, - _D3DModelView._13/delta, -_D3DModelView._23/delta, -_D3DModelView._33/delta, 1-(_D3DModelView._43-_FogStart)/delta);
}
// ***************************************************************************
void CDriverD3D::enableVertexProgramDoubleSidedColor(bool /* doubleSided */)
{
H_AUTO_D3D(CDriverD3D_enableVertexProgramDoubleSidedColor)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -263,8 +263,6 @@ CDriverGL::CDriverGL()
_CurrentFogColor[2]= 0;
_CurrentFogColor[3]= 0;
_RenderTargetFBO = false;
_LightSetupDirty= false;
_ModelViewMatrixDirty= false;
_RenderSetupDirty= false;
@ -482,6 +480,7 @@ bool CDriverGL::setupDisplay()
}
_VertexProgramEnabled= false;
_PixelProgramEnabled= false;
_LastSetupGLArrayVertexProgram= false;
// Init VertexArrayRange according to supported extenstion.
@ -690,7 +689,7 @@ bool CDriverGL::stretchRect(ITexture * /* srcText */, NLMISC::CRect &/* srcRect
// ***************************************************************************
bool CDriverGL::supportBloomEffect() const
{
return (isVertexProgramSupported() && supportFrameBufferObject() && supportPackedDepthStencil() && supportTextureRectangle());
return (supportVertexProgram(CVertexProgram::nelvp) && supportFrameBufferObject() && supportPackedDepthStencil() && supportTextureRectangle());
}
// ***************************************************************************
@ -702,7 +701,7 @@ bool CDriverGL::supportNonPowerOfTwoTextures() const
// ***************************************************************************
bool CDriverGL::isTextureRectangle(ITexture * tex) const
{
return (supportTextureRectangle() && tex->isBloomTexture() && tex->mipMapOff()
return (!supportNonPowerOfTwoTextures() && supportTextureRectangle() && tex->isBloomTexture() && tex->mipMapOff()
&& (!isPowerOf2(tex->getWidth()) || !isPowerOf2(tex->getHeight())));
}
@ -737,6 +736,12 @@ void CDriverGL::disableHardwareVertexProgram()
_Extensions.DisableHardwareVertexProgram= true;
}
void CDriverGL::disableHardwarePixelProgram()
{
H_AUTO_OGL(CDriverGL_disableHardwarePixelProgram)
_Extensions.DisableHardwarePixelProgram= true;
}
// ***************************************************************************
void CDriverGL::disableHardwareVertexArrayAGP()
{
@ -854,6 +859,7 @@ bool CDriverGL::swapBuffers()
// Reset texture shaders
//resetTextureShaders();
activeVertexProgram(NULL);
activePixelProgram(NULL);
#ifndef USE_OPENGLES
/* Yoyo: must do this (GeForce bug ??) else weird results if end render with a VBHard.
@ -1400,6 +1406,7 @@ void CDriverGL::setupFog(float start, float end, CRGBA color)
glFogfv(GL_FOG_COLOR, _CurrentFogColor);
#ifndef USE_OPENGLES
/** Special : with vertex program, using the extension EXT_vertex_shader, fog is emulated using 1 more constant to scale result to [0, 1]
*/
if (_Extensions.EXTVertexShader && !_Extensions.NVVertexProgram && !_Extensions.ARBVertexProgram)
@ -1409,14 +1416,18 @@ void CDriverGL::setupFog(float start, float end, CRGBA color)
// last constant is used to store fog information (fog must be rescaled to [0, 1], because of a driver bug)
if (start != end)
{
setConstant(_EVSNumConstant, 1.f / (start - end), - end / (start - end), 0, 0);
float datas[] = { 1.f / (start - end), - end / (start - end), 0, 0 };
nglSetInvariantEXT(_EVSConstantHandle + _EVSNumConstant, GL_FLOAT, datas);
}
else
{
setConstant(_EVSNumConstant, 0.f, 0, 0, 0);
float datas[] = { 0.f, 0, 0, 0 };
nglSetInvariantEXT(_EVSConstantHandle + _EVSNumConstant, GL_FLOAT, datas);
}
}
}
#endif
_FogStart = start;
_FogEnd = end;
}
@ -1488,7 +1499,10 @@ void CDriverGL::enableUsedTextureMemorySum (bool enable)
H_AUTO_OGL(CDriverGL_enableUsedTextureMemorySum )
if (enable)
{
nlinfo ("3D: PERFORMANCE INFO: enableUsedTextureMemorySum has been set to true in CDriverGL");
_TextureUsed.reserve(512);
}
_SumTextureMemoryUsed=enable;
}
@ -1502,7 +1516,7 @@ uint32 CDriverGL::getUsedTextureMemory() const
uint32 memory=0;
// For each texture used
set<CTextureDrvInfosGL*>::const_iterator ite=_TextureUsed.begin();
std::vector<CTextureDrvInfosGL *>::const_iterator ite = _TextureUsed.begin();
while (ite!=_TextureUsed.end())
{
// Get the gl texture
@ -1510,7 +1524,8 @@ uint32 CDriverGL::getUsedTextureMemory() const
gltext= (*ite);
// Sum the memory used by this texture
memory+=gltext->TextureMemory;
if (gltext)
memory+=gltext->TextureMemory;
// Next texture
ite++;
@ -1531,9 +1546,9 @@ bool CDriverGL::supportTextureShaders() const
}
// ***************************************************************************
bool CDriverGL::isWaterShaderSupported() const
bool CDriverGL::supportWaterShader() const
{
H_AUTO_OGL(CDriverGL_isWaterShaderSupported);
H_AUTO_OGL(CDriverGL_supportWaterShader);
if(_Extensions.ARBFragmentProgram && ARBWaterShader[0] != 0) return true;
@ -1543,9 +1558,9 @@ bool CDriverGL::isWaterShaderSupported() const
}
// ***************************************************************************
bool CDriverGL::isTextureAddrModeSupported(CMaterial::TTexAddressingMode /* mode */) const
bool CDriverGL::supportTextureAddrMode(CMaterial::TTexAddressingMode /* mode */) const
{
H_AUTO_OGL(CDriverGL_isTextureAddrModeSupported)
H_AUTO_OGL(CDriverGL_supportTextureAddrMode)
if (_Extensions.NVTextureShader)
{
@ -1983,12 +1998,6 @@ static void fetchPerturbedEnvMapR200()
#endif
}
// ***************************************************************************
void CDriverGL::forceNativeFragmentPrograms(bool nativeOnly)
{
_ForceNativeFragmentPrograms = nativeOnly;
}
// ***************************************************************************
void CDriverGL::initFragmentShaders()
{
@ -2182,6 +2191,7 @@ void CDriverGL::setSwapVBLInterval(uint interval)
res = nwglSwapIntervalEXT(_Interval) == TRUE;
}
#elif defined(NL_OS_MAC)
[_ctx setValues:(GLint*)&interval forParameter:NSOpenGLCPSwapInterval];
#elif defined(NL_OS_UNIX)
if (_win && _Extensions.GLXEXTSwapControl)
{
@ -2242,6 +2252,8 @@ void CDriverGL::enablePolygonSmoothing(bool smooth)
{
H_AUTO_OGL(CDriverGL_enablePolygonSmoothing);
if (_PolygonSmooth == smooth) return;
#ifndef USE_OPENGLES
if(smooth)
glEnable(GL_POLYGON_SMOOTH);
@ -2563,14 +2575,6 @@ CVertexBuffer::TVertexColorType CDriverGL::getVertexColorFormat() const
return CVertexBuffer::TRGBA;
}
// ***************************************************************************
bool CDriverGL::activeShader(CShader * /* shd */)
{
H_AUTO_OGL(CDriverGL_activeShader)
return false;
}
// ***************************************************************************
void CDriverGL::startBench (bool wantStandardDeviation, bool quick, bool reset)
{

View file

@ -49,7 +49,6 @@
#include "nel/3d/driver.h"
#include "nel/3d/material.h"
#include "nel/3d/shader.h"
#include "nel/3d/vertex_buffer.h"
#include "nel/3d/ptr_set.h"
#include "nel/3d/texture_cube.h"
@ -196,6 +195,8 @@ public:
bool initFrameBufferObject(ITexture * tex);
bool activeFrameBufferObject(ITexture * tex);
std::vector<CTextureDrvInfosGL *>::size_type TextureUsedIdx;
};
@ -306,6 +307,7 @@ public:
virtual bool init (uint windowIcon = 0, emptyProc exitFunc = 0);
virtual void disableHardwareVertexProgram();
virtual void disableHardwarePixelProgram();
virtual void disableHardwareVertexArrayAGP();
virtual void disableHardwareTextureShader();
@ -368,8 +370,6 @@ public:
virtual void forceTextureResize(uint divisor);
virtual void forceNativeFragmentPrograms(bool nativeOnly);
/// Setup texture env functions. Used by setupMaterial
void setTextureEnvFunction(uint stage, CMaterial& mat);
@ -403,8 +403,6 @@ public:
virtual CMatrix getViewMatrix() const;
virtual bool activeShader(CShader *shd);
virtual void forceNormalize(bool normalize)
{
_ForceNormalize= normalize;
@ -563,6 +561,8 @@ public:
virtual bool setRenderTarget (ITexture *tex, uint32 x, uint32 y, uint32 width, uint32 height,
uint32 mipmapLevel, uint32 cubeFace);
virtual ITexture *getRenderTarget() const;
virtual bool copyTargetToTexture (ITexture *tex, uint32 offsetx, uint32 offsety, uint32 x, uint32 y,
uint32 width, uint32 height, uint32 mipmapLevel);
@ -600,9 +600,9 @@ public:
// @{
virtual bool supportTextureShaders() const;
virtual bool isWaterShaderSupported() const;
virtual bool supportWaterShader() const;
virtual bool isTextureAddrModeSupported(CMaterial::TTexAddressingMode mode) const;
virtual bool supportTextureAddrMode(CMaterial::TTexAddressingMode mode) const;
virtual void setMatrix2DForTextureOffsetAddrMode(const uint stage, const float mat[4]);
// @}
@ -692,6 +692,7 @@ private:
virtual class IVertexBufferHardGL *createVertexBufferHard(uint size, uint numVertices, CVertexBuffer::TPreferredMemory vbType, CVertexBuffer *vb);
friend class CTextureDrvInfosGL;
friend class CVertexProgamDrvInfosGL;
friend class CPixelProgamDrvInfosGL;
private:
// Version of the driver. Not the interface version!! Increment when implementation of the driver change.
@ -887,7 +888,7 @@ private:
// viewport before call to setRenderTarget, if BFO extension is supported
CViewport _OldViewport;
bool _RenderTargetFBO;
CSmartPtr<ITexture> _RenderTargetFBO;
// Num lights return by GL_MAX_LIGHTS
@ -1273,7 +1274,7 @@ private:
uint32 _NbSetupMaterialCall;
uint32 _NbSetupModelMatrixCall;
bool _SumTextureMemoryUsed;
std::set<CTextureDrvInfosGL*> _TextureUsed;
std::vector<CTextureDrvInfosGL *> _TextureUsed;
uint computeMipMapMemoryUsage(uint w, uint h, GLint glfmt) const;
// VBHard Lock Profiling
@ -1298,36 +1299,156 @@ private:
// @}
/// \name Vertex program interface
/// \name Vertex Program
// @{
bool isVertexProgramSupported () const;
bool isVertexProgramEmulated () const;
bool activeVertexProgram (CVertexProgram *program);
void setConstant (uint index, float, float, float, float);
void setConstant (uint index, double, double, double, double);
void setConstant (uint indexStart, const NLMISC::CVector& value);
void setConstant (uint indexStart, const NLMISC::CVectorD& value);
void setConstant (uint index, uint num, const float *src);
void setConstant (uint index, uint num, const double *src);
void setConstantMatrix (uint index, IDriver::TMatrix matrix, IDriver::TTransform transform);
void setConstantFog (uint index);
void enableVertexProgramDoubleSidedColor(bool doubleSided);
bool supportVertexProgramDoubleSidedColor() const;
// Order of preference
// - activeVertexProgram
// - CMaterial pass[n] VP (uses activeVertexProgram, but does not override if one already set by code)
// - default generic VP that mimics fixed pipeline / no VP with fixed pipeline
/**
* Does the driver supports vertex program, but emulated by CPU ?
*/
virtual bool isVertexProgramEmulated() const;
/** Return true if the driver supports the specified vertex program profile.
*/
virtual bool supportVertexProgram(CVertexProgram::TProfile profile) const;
/** Compile the given vertex program, return if successful.
* If a vertex program was set active before compilation,
* the state of the active vertex program is undefined behaviour afterwards.
*/
virtual bool compileVertexProgram(CVertexProgram *program);
/** Set the active vertex program. This will override vertex programs specified in CMaterial render calls.
* Also used internally by setupMaterial(CMaterial) when getVertexProgram returns NULL.
* The vertex program is activated immediately.
*/
virtual bool activeVertexProgram(CVertexProgram *program);
// @}
/// \name Pixel Program
// @{
// Order of preference
// - activePixelProgram
// - CMaterial pass[n] PP (uses activePixelProgram, but does not override if one already set by code)
// - PP generated from CMaterial (uses activePixelProgram, but does not override if one already set by code)
/** Return true if the driver supports the specified pixel program profile.
*/
virtual bool supportPixelProgram(CPixelProgram::TProfile profile = CPixelProgram::arbfp1) const;
/** Compile the given pixel program, return if successful.
* If a pixel program was set active before compilation,
* the state of the active pixel program is undefined behaviour afterwards.
*/
virtual bool compilePixelProgram(CPixelProgram *program);
/** Set the active pixel program. This will override pixel programs specified in CMaterial render calls.
* Also used internally by setupMaterial(CMaterial) when getPixelProgram returns NULL.
* The pixel program is activated immediately.
*/
virtual bool activePixelProgram(CPixelProgram *program);
// @}
/// \name Geometry Program
// @{
// Order of preference
// - activeGeometryProgram
// - CMaterial pass[n] PP (uses activeGeometryProgram, but does not override if one already set by code)
// - none
/** Return true if the driver supports the specified pixel program profile.
*/
virtual bool supportGeometryProgram(CGeometryProgram::TProfile profile) const { return false; }
/** Compile the given pixel program, return if successful.
* If a pixel program was set active before compilation,
* the state of the active pixel program is undefined behaviour afterwards.
*/
virtual bool compileGeometryProgram(CGeometryProgram *program) { return false; }
/** Set the active pixel program. This will override pixel programs specified in CMaterial render calls.
* Also used internally by setupMaterial(CMaterial) when getGeometryProgram returns NULL.
* The pixel program is activated immediately.
*/
virtual bool activeGeometryProgram(CGeometryProgram *program) { return false; }
// @}
/// \name Program parameters
// @{
// Set parameters
inline void setUniform4fInl(TProgram program, uint index, float f0, float f1, float f2, float f3);
inline void setUniform4fvInl(TProgram program, uint index, size_t num, const float *src);
virtual void setUniform1f(TProgram program, uint index, float f0);
virtual void setUniform2f(TProgram program, uint index, float f0, float f1);
virtual void setUniform3f(TProgram program, uint index, float f0, float f1, float f2);
virtual void setUniform4f(TProgram program, uint index, float f0, float f1, float f2, float f3);
virtual void setUniform1i(TProgram program, uint index, sint32 i0);
virtual void setUniform2i(TProgram program, uint index, sint32 i0, sint32 i1);
virtual void setUniform3i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2);
virtual void setUniform4i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2, sint32 i3);
virtual void setUniform1ui(TProgram program, uint index, uint32 ui0);
virtual void setUniform2ui(TProgram program, uint index, uint32 ui0, uint32 ui1);
virtual void setUniform3ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2);
virtual void setUniform4ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3);
virtual void setUniform3f(TProgram program, uint index, const NLMISC::CVector& v);
virtual void setUniform4f(TProgram program, uint index, const NLMISC::CVector& v, float f3);
virtual void setUniform4f(TProgram program, uint index, const NLMISC::CRGBAF& rgba);
virtual void setUniform4x4f(TProgram program, uint index, const NLMISC::CMatrix& m);
virtual void setUniform4fv(TProgram program, uint index, size_t num, const float *src);
virtual void setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src);
virtual void setUniform4uiv(TProgram program, uint index, size_t num, const uint32 *src);
// Set builtin parameters
virtual void setUniformMatrix(TProgram program, uint index, TMatrix matrix, TTransform transform);
virtual void setUniformFog(TProgram program, uint index);
// Set feature parameters
virtual bool isUniformProgramState() { return false; }
// @}
virtual void enableVertexProgramDoubleSidedColor(bool doubleSided);
virtual bool supportVertexProgramDoubleSidedColor() const;
virtual bool supportMADOperator() const ;
// @}
/// \name Vertex program implementation
// @{
bool activeNVVertexProgram (CVertexProgram *program);
bool activeARBVertexProgram (CVertexProgram *program);
bool activeEXTVertexShader (CVertexProgram *program);
bool compileNVVertexProgram (CVertexProgram *program);
bool compileARBVertexProgram (CVertexProgram *program);
bool compileEXTVertexShader (CVertexProgram *program);
//@}
/// \name Pixel program implementation
// @{
bool activeARBPixelProgram (CPixelProgram *program);
bool setupPixelProgram (CPixelProgram *program, GLuint id/*, bool &specularWritten*/);
//@}
/// \fallback for material shaders
// @{
@ -1340,15 +1461,27 @@ private:
// Don't use glIsEnabled, too slow.
return _VertexProgramEnabled;
}
bool isPixelProgramEnabled () const
{
// Don't use glIsEnabled, too slow.
return _PixelProgramEnabled;
}
// Track state of activeVertexProgram()
bool _VertexProgramEnabled;
// Track state of activePixelProgram()
bool _PixelProgramEnabled;
// Say if last setupGlArrays() was a VertexProgram setup.
bool _LastSetupGLArrayVertexProgram;
// The last vertex program that was setupped
NLMISC::CRefPtr<CVertexProgram> _LastSetuppedVP;
// The last pixel program that was setupped
NLMISC::CRefPtr<CPixelProgram> _LastSetuppedPP;
bool _ForceDXTCCompression;
/// Divisor for textureResize (power).
uint _ForceTextureResizePower;
@ -1494,7 +1627,7 @@ private:
};
// ***************************************************************************
class CVertexProgamDrvInfosGL : public IVertexProgramDrvInfos
class CVertexProgamDrvInfosGL : public IProgramDrvInfos
{
public:
// The GL Id.
@ -1515,7 +1648,36 @@ public:
// The gl id is auto created here.
CVertexProgamDrvInfosGL (CDriverGL *drv, ItVtxPrgDrvInfoPtrList it);
CVertexProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it);
virtual uint getUniformIndex(const char *name) const
{
std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second;
return ~0;
};
std::map<std::string, uint> ParamIndices;
};
// ***************************************************************************
class CPixelProgamDrvInfosGL : public IProgramDrvInfos
{
public:
// The GL Id.
GLuint ID;
// The gl id is auto created here.
CPixelProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it);
virtual uint getUniformIndex(const char *name) const
{
std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second;
return ~0;
};
std::map<std::string, uint> ParamIndices;
};
#ifdef NL_STATIC

File diff suppressed because it is too large Load diff

View file

@ -103,14 +103,29 @@ struct CGlExtensions
bool ARBTextureNonPowerOfTwo;
bool ARBMultisample;
// NV Pixel Programs
bool NVFragmentProgram2;
bool OESDrawTexture;
bool OESMapBuffer;
// extensions to get memory info
// GL_NVX_gpu_memory_info
bool NVXGPUMemoryInfo;
// GL_ATI_meminfo
bool ATIMeminfo;
// WGL_AMD_gpu_association
bool WGLAMDGPUAssociation;
public:
/// \name Disable Hardware feature. False by default. setuped by IDriver
// @{
bool DisableHardwareVertexProgram;
bool DisableHardwarePixelProgram;
bool DisableHardwareVertexArrayAGP;
bool DisableHardwareTextureShader;
// @}
@ -147,7 +162,6 @@ public:
ATIVertexArrayObject= false;
ATIEnvMapBumpMap = false;
ATIFragmentShader = false;
ATIVertexArrayObject = false;
ATIMapObjectBuffer = false;
ATIVertexAttribArrayObject = false;
EXTVertexShader= false;
@ -172,8 +186,13 @@ public:
OESDrawTexture = false;
OESMapBuffer = false;
NVXGPUMemoryInfo = false;
ATIMeminfo = false;
WGLAMDGPUAssociation = false;
/// \name Disable Hardware feature. False by default. setuped by IDriver
DisableHardwareVertexProgram= false;
DisableHardwarePixelProgram= false;
DisableHardwareVertexArrayAGP= false;
DisableHardwareTextureShader= false;
}
@ -206,6 +225,7 @@ public:
result += NVTextureShader ? "NVTextureShader " : "";
result += ATIFragmentShader ? "ATIFragmentShader " : "";
result += ARBFragmentProgram ? "ARBFragmentProgram " : "";
result += NVFragmentProgram2 ? "NVFragmentProgram2 " : "";
result += ARBVertexProgram ? "ARBVertexProgram " : "";
result += NVVertexProgram ? "NVVertexProgram " : "";
result += EXTVertexShader ? "EXTVertexShader " : "";
@ -219,12 +239,15 @@ public:
result += NVOcclusionQuery ? "NVOcclusionQuery " : "";
result += NVStateVARWithoutFlush ? "NVStateVARWithoutFlush " : "";
result += ARBMultisample ? "ARBMultisample " : "";
result += NVXGPUMemoryInfo ? "NVXGPUMemoryInfo " : "";
result += ATIMeminfo ? "ATIMeminfo " : "";
#ifdef NL_OS_WINDOWS
result += "\n WindowsGL: ";
result += WGLARBPBuffer ? "WGLARBPBuffer " : "";
result += WGLARBPixelFormat ? "WGLARBPixelFormat " : "";
result += WGLEXTSwapControl ? "WGLEXTSwapControl " : "";
result += WGLAMDGPUAssociation ? "WGLAMDGPUAssociation " : "";
#elif defined(NL_OS_MAC)
#elif defined(NL_OS_UNIX)
result += "\n GLX: ";
@ -288,230 +311,228 @@ void registerGlExtensions(CGlExtensions &ext);
// OES_mapbuffer.
//===============
extern NEL_PFNGLMAPBUFFEROESPROC nglMapBufferOES;
extern NEL_PFNGLUNMAPBUFFEROESPROC nglUnmapBufferOES;
extern NEL_PFNGLGETBUFFERPOINTERVOESPROC nglGetBufferPointervOES;
extern PFNGLMAPBUFFEROESPROC nglMapBufferOES;
extern PFNGLUNMAPBUFFEROESPROC nglUnmapBufferOES;
extern PFNGLGETBUFFERPOINTERVOESPROC nglGetBufferPointervOES;
extern NEL_PFNGLBUFFERSUBDATAPROC nglBufferSubData;
extern PFNGLDRAWTEXFOESPROC nglDrawTexfOES;
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;
extern PFNGLISRENDERBUFFEROESPROC nglIsRenderbufferOES;
extern PFNGLBINDRENDERBUFFEROESPROC nglBindRenderbufferOES;
extern PFNGLDELETERENDERBUFFERSOESPROC nglDeleteRenderbuffersOES;
extern PFNGLGENRENDERBUFFERSOESPROC nglGenRenderbuffersOES;
extern PFNGLRENDERBUFFERSTORAGEOESPROC nglRenderbufferStorageOES;
extern PFNGLGETRENDERBUFFERPARAMETERIVOESPROC nglGetRenderbufferParameterivOES;
extern PFNGLISFRAMEBUFFEROESPROC nglIsFramebufferOES;
extern PFNGLBINDFRAMEBUFFEROESPROC nglBindFramebufferOES;
extern PFNGLDELETEFRAMEBUFFERSOESPROC nglDeleteFramebuffersOES;
extern PFNGLGENFRAMEBUFFERSOESPROC nglGenFramebuffersOES;
extern PFNGLCHECKFRAMEBUFFERSTATUSOESPROC nglCheckFramebufferStatusOES;
extern PFNGLFRAMEBUFFERRENDERBUFFEROESPROC nglFramebufferRenderbufferOES;
extern PFNGLFRAMEBUFFERTEXTURE2DOESPROC nglFramebufferTexture2DOES;
extern PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC nglGetFramebufferAttachmentParameterivOES;
extern 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;
extern PFNGLTEXGENFOESPROC nglTexGenfOES;
extern PFNGLTEXGENFVOESPROC nglTexGenfvOES;
extern PFNGLTEXGENIOESPROC nglTexGeniOES;
extern PFNGLTEXGENIVOESPROC nglTexGenivOES;
extern PFNGLTEXGENXOESPROC nglTexGenxOES;
extern PFNGLTEXGENXVOESPROC nglTexGenxvOES;
extern PFNGLGETTEXGENFVOESPROC nglGetTexGenfvOES;
extern PFNGLGETTEXGENIVOESPROC nglGetTexGenivOES;
extern PFNGLGETTEXGENXVOESPROC nglGetTexGenxvOES;
#else
// ARB_multitexture
//=================
extern NEL_PFNGLACTIVETEXTUREARBPROC nglActiveTextureARB;
extern NEL_PFNGLCLIENTACTIVETEXTUREARBPROC nglClientActiveTextureARB;
extern PFNGLACTIVETEXTUREARBPROC nglActiveTextureARB;
extern PFNGLCLIENTACTIVETEXTUREARBPROC nglClientActiveTextureARB;
extern NEL_PFNGLMULTITEXCOORD1SARBPROC nglMultiTexCoord1sARB;
extern NEL_PFNGLMULTITEXCOORD1IARBPROC nglMultiTexCoord1iARB;
extern NEL_PFNGLMULTITEXCOORD1FARBPROC nglMultiTexCoord1fARB;
extern NEL_PFNGLMULTITEXCOORD1FARBPROC nglMultiTexCoord1fARB;
extern NEL_PFNGLMULTITEXCOORD1DARBPROC nglMultiTexCoord1dARB;
extern NEL_PFNGLMULTITEXCOORD2SARBPROC nglMultiTexCoord2sARB;
extern NEL_PFNGLMULTITEXCOORD2IARBPROC nglMultiTexCoord2iARB;
extern NEL_PFNGLMULTITEXCOORD2FARBPROC nglMultiTexCoord2fARB;
extern NEL_PFNGLMULTITEXCOORD2DARBPROC nglMultiTexCoord2dARB;
extern NEL_PFNGLMULTITEXCOORD3SARBPROC nglMultiTexCoord3sARB;
extern NEL_PFNGLMULTITEXCOORD3IARBPROC nglMultiTexCoord3iARB;
extern NEL_PFNGLMULTITEXCOORD3FARBPROC nglMultiTexCoord3fARB;
extern NEL_PFNGLMULTITEXCOORD3DARBPROC nglMultiTexCoord3dARB;
extern NEL_PFNGLMULTITEXCOORD4SARBPROC nglMultiTexCoord4sARB;
extern NEL_PFNGLMULTITEXCOORD4IARBPROC nglMultiTexCoord4iARB;
extern NEL_PFNGLMULTITEXCOORD4FARBPROC nglMultiTexCoord4fARB;
extern NEL_PFNGLMULTITEXCOORD4DARBPROC nglMultiTexCoord4dARB;
extern PFNGLMULTITEXCOORD1SARBPROC nglMultiTexCoord1sARB;
extern PFNGLMULTITEXCOORD1IARBPROC nglMultiTexCoord1iARB;
extern PFNGLMULTITEXCOORD1FARBPROC nglMultiTexCoord1fARB;
extern PFNGLMULTITEXCOORD1FARBPROC nglMultiTexCoord1fARB;
extern PFNGLMULTITEXCOORD1DARBPROC nglMultiTexCoord1dARB;
extern PFNGLMULTITEXCOORD2SARBPROC nglMultiTexCoord2sARB;
extern PFNGLMULTITEXCOORD2IARBPROC nglMultiTexCoord2iARB;
extern PFNGLMULTITEXCOORD2FARBPROC nglMultiTexCoord2fARB;
extern PFNGLMULTITEXCOORD2DARBPROC nglMultiTexCoord2dARB;
extern PFNGLMULTITEXCOORD3SARBPROC nglMultiTexCoord3sARB;
extern PFNGLMULTITEXCOORD3IARBPROC nglMultiTexCoord3iARB;
extern PFNGLMULTITEXCOORD3FARBPROC nglMultiTexCoord3fARB;
extern PFNGLMULTITEXCOORD3DARBPROC nglMultiTexCoord3dARB;
extern PFNGLMULTITEXCOORD4SARBPROC nglMultiTexCoord4sARB;
extern PFNGLMULTITEXCOORD4IARBPROC nglMultiTexCoord4iARB;
extern PFNGLMULTITEXCOORD4FARBPROC nglMultiTexCoord4fARB;
extern PFNGLMULTITEXCOORD4DARBPROC nglMultiTexCoord4dARB;
extern NEL_PFNGLMULTITEXCOORD1SVARBPROC nglMultiTexCoord1svARB;
extern NEL_PFNGLMULTITEXCOORD1IVARBPROC nglMultiTexCoord1ivARB;
extern NEL_PFNGLMULTITEXCOORD1FVARBPROC nglMultiTexCoord1fvARB;
extern NEL_PFNGLMULTITEXCOORD1DVARBPROC nglMultiTexCoord1dvARB;
extern NEL_PFNGLMULTITEXCOORD2SVARBPROC nglMultiTexCoord2svARB;
extern NEL_PFNGLMULTITEXCOORD2IVARBPROC nglMultiTexCoord2ivARB;
extern NEL_PFNGLMULTITEXCOORD2FVARBPROC nglMultiTexCoord2fvARB;
extern NEL_PFNGLMULTITEXCOORD2DVARBPROC nglMultiTexCoord2dvARB;
extern NEL_PFNGLMULTITEXCOORD3SVARBPROC nglMultiTexCoord3svARB;
extern NEL_PFNGLMULTITEXCOORD3IVARBPROC nglMultiTexCoord3ivARB;
extern NEL_PFNGLMULTITEXCOORD3FVARBPROC nglMultiTexCoord3fvARB;
extern NEL_PFNGLMULTITEXCOORD3DVARBPROC nglMultiTexCoord3dvARB;
extern NEL_PFNGLMULTITEXCOORD4SVARBPROC nglMultiTexCoord4svARB;
extern NEL_PFNGLMULTITEXCOORD4IVARBPROC nglMultiTexCoord4ivARB;
extern NEL_PFNGLMULTITEXCOORD4FVARBPROC nglMultiTexCoord4fvARB;
extern NEL_PFNGLMULTITEXCOORD4DVARBPROC nglMultiTexCoord4dvARB;
extern PFNGLMULTITEXCOORD1SVARBPROC nglMultiTexCoord1svARB;
extern PFNGLMULTITEXCOORD1IVARBPROC nglMultiTexCoord1ivARB;
extern PFNGLMULTITEXCOORD1FVARBPROC nglMultiTexCoord1fvARB;
extern PFNGLMULTITEXCOORD1DVARBPROC nglMultiTexCoord1dvARB;
extern PFNGLMULTITEXCOORD2SVARBPROC nglMultiTexCoord2svARB;
extern PFNGLMULTITEXCOORD2IVARBPROC nglMultiTexCoord2ivARB;
extern PFNGLMULTITEXCOORD2FVARBPROC nglMultiTexCoord2fvARB;
extern PFNGLMULTITEXCOORD2DVARBPROC nglMultiTexCoord2dvARB;
extern PFNGLMULTITEXCOORD3SVARBPROC nglMultiTexCoord3svARB;
extern PFNGLMULTITEXCOORD3IVARBPROC nglMultiTexCoord3ivARB;
extern PFNGLMULTITEXCOORD3FVARBPROC nglMultiTexCoord3fvARB;
extern PFNGLMULTITEXCOORD3DVARBPROC nglMultiTexCoord3dvARB;
extern PFNGLMULTITEXCOORD4SVARBPROC nglMultiTexCoord4svARB;
extern PFNGLMULTITEXCOORD4IVARBPROC nglMultiTexCoord4ivARB;
extern PFNGLMULTITEXCOORD4FVARBPROC nglMultiTexCoord4fvARB;
extern PFNGLMULTITEXCOORD4DVARBPROC nglMultiTexCoord4dvARB;
// ARB_TextureCompression.
//========================
extern NEL_PFNGLCOMPRESSEDTEXIMAGE3DARBPROC nglCompressedTexImage3DARB;
extern NEL_PFNGLCOMPRESSEDTEXIMAGE2DARBPROC nglCompressedTexImage2DARB;
extern NEL_PFNGLCOMPRESSEDTEXIMAGE1DARBPROC nglCompressedTexImage1DARB;
extern NEL_PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC nglCompressedTexSubImage3DARB;
extern NEL_PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC nglCompressedTexSubImage2DARB;
extern NEL_PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC nglCompressedTexSubImage1DARB;
extern NEL_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC nglGetCompressedTexImageARB;
extern PFNGLCOMPRESSEDTEXIMAGE3DARBPROC nglCompressedTexImage3DARB;
extern PFNGLCOMPRESSEDTEXIMAGE2DARBPROC nglCompressedTexImage2DARB;
extern PFNGLCOMPRESSEDTEXIMAGE1DARBPROC nglCompressedTexImage1DARB;
extern PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC nglCompressedTexSubImage3DARB;
extern PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC nglCompressedTexSubImage2DARB;
extern PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC nglCompressedTexSubImage1DARB;
extern PFNGLGETCOMPRESSEDTEXIMAGEARBPROC nglGetCompressedTexImageARB;
// VertexArrayRangeNV.
//====================
extern NEL_PFNGLFLUSHVERTEXARRAYRANGENVPROC nglFlushVertexArrayRangeNV;
extern NEL_PFNGLVERTEXARRAYRANGENVPROC nglVertexArrayRangeNV;
extern PFNGLFLUSHVERTEXARRAYRANGENVPROC nglFlushVertexArrayRangeNV;
extern PFNGLVERTEXARRAYRANGENVPROC nglVertexArrayRangeNV;
#ifdef NL_OS_WINDOWS
extern PFNWGLALLOCATEMEMORYNVPROC nwglAllocateMemoryNV;
extern PFNWGLFREEMEMORYNVPROC nwglFreeMemoryNV;
#elif defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
extern NEL_PFNGLXALLOCATEMEMORYNVPROC nglXAllocateMemoryNV;
extern NEL_PFNGLXFREEMEMORYNVPROC nglXFreeMemoryNV;
extern PFNGLXALLOCATEMEMORYNVPROC nglXAllocateMemoryNV;
extern PFNGLXFREEMEMORYNVPROC nglXFreeMemoryNV;
#endif
// FenceNV.
//====================
extern NEL_PFNGLDELETEFENCESNVPROC nglDeleteFencesNV;
extern NEL_PFNGLGENFENCESNVPROC nglGenFencesNV;
extern NEL_PFNGLISFENCENVPROC nglIsFenceNV;
extern NEL_PFNGLTESTFENCENVPROC nglTestFenceNV;
extern NEL_PFNGLGETFENCEIVNVPROC nglGetFenceivNV;
extern NEL_PFNGLFINISHFENCENVPROC nglFinishFenceNV;
extern NEL_PFNGLSETFENCENVPROC nglSetFenceNV;
extern PFNGLDELETEFENCESNVPROC nglDeleteFencesNV;
extern PFNGLGENFENCESNVPROC nglGenFencesNV;
extern PFNGLISFENCENVPROC nglIsFenceNV;
extern PFNGLTESTFENCENVPROC nglTestFenceNV;
extern PFNGLGETFENCEIVNVPROC nglGetFenceivNV;
extern PFNGLFINISHFENCENVPROC nglFinishFenceNV;
extern PFNGLSETFENCENVPROC nglSetFenceNV;
// VertexWeighting.
//==================
extern NEL_PFNGLVERTEXWEIGHTFEXTPROC nglVertexWeightfEXT;
extern NEL_PFNGLVERTEXWEIGHTFVEXTPROC nglVertexWeightfvEXT;
extern NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC nglVertexWeightPointerEXT;
extern PFNGLVERTEXWEIGHTFEXTPROC nglVertexWeightfEXT;
extern PFNGLVERTEXWEIGHTFVEXTPROC nglVertexWeightfvEXT;
extern PFNGLVERTEXWEIGHTPOINTEREXTPROC nglVertexWeightPointerEXT;
// VertexProgramExtension.
//========================
extern NEL_PFNGLAREPROGRAMSRESIDENTNVPROC nglAreProgramsResidentNV;
extern NEL_PFNGLBINDPROGRAMNVPROC nglBindProgramNV;
extern NEL_PFNGLDELETEPROGRAMSNVPROC nglDeleteProgramsNV;
extern NEL_PFNGLEXECUTEPROGRAMNVPROC nglExecuteProgramNV;
extern NEL_PFNGLGENPROGRAMSNVPROC nglGenProgramsNV;
extern NEL_PFNGLGETPROGRAMPARAMETERDVNVPROC nglGetProgramParameterdvNV;
extern NEL_PFNGLGETPROGRAMPARAMETERFVNVPROC nglGetProgramParameterfvNV;
extern NEL_PFNGLGETPROGRAMIVNVPROC nglGetProgramivNV;
extern NEL_PFNGLGETPROGRAMSTRINGNVPROC nglGetProgramStringNV;
extern NEL_PFNGLGETTRACKMATRIXIVNVPROC nglGetTrackMatrixivNV;
extern NEL_PFNGLGETVERTEXATTRIBDVNVPROC nglGetVertexAttribdvNV;
extern NEL_PFNGLGETVERTEXATTRIBFVNVPROC nglGetVertexAttribfvNV;
extern NEL_PFNGLGETVERTEXATTRIBIVNVPROC nglGetVertexAttribivNV;
extern NEL_PFNGLGETVERTEXATTRIBPOINTERVNVPROC nglGetVertexAttribPointervNV;
extern NEL_PFNGLISPROGRAMNVPROC nglIsProgramNV;
extern NEL_PFNGLLOADPROGRAMNVPROC nglLoadProgramNV;
extern NEL_PFNGLPROGRAMPARAMETER4DNVPROC nglProgramParameter4dNV;
extern NEL_PFNGLPROGRAMPARAMETER4DVNVPROC nglProgramParameter4dvNV;
extern NEL_PFNGLPROGRAMPARAMETER4FNVPROC nglProgramParameter4fNV;
extern NEL_PFNGLPROGRAMPARAMETER4FVNVPROC nglProgramParameter4fvNV;
extern NEL_PFNGLPROGRAMPARAMETERS4DVNVPROC nglProgramParameters4dvNV;
extern NEL_PFNGLPROGRAMPARAMETERS4FVNVPROC nglProgramParameters4fvNV;
extern NEL_PFNGLREQUESTRESIDENTPROGRAMSNVPROC nglRequestResidentProgramsNV;
extern NEL_PFNGLTRACKMATRIXNVPROC nglTrackMatrixNV;
extern NEL_PFNGLVERTEXATTRIBPOINTERNVPROC nglVertexAttribPointerNV;
extern NEL_PFNGLVERTEXATTRIB1DNVPROC nglVertexAttrib1dNV;
extern NEL_PFNGLVERTEXATTRIB1DVNVPROC nglVertexAttrib1dvNV;
extern NEL_PFNGLVERTEXATTRIB1FNVPROC nglVertexAttrib1fNV;
extern NEL_PFNGLVERTEXATTRIB1FVNVPROC nglVertexAttrib1fvNV;
extern NEL_PFNGLVERTEXATTRIB1SNVPROC nglVertexAttrib1sNV;
extern NEL_PFNGLVERTEXATTRIB1SVNVPROC nglVertexAttrib1svNV;
extern NEL_PFNGLVERTEXATTRIB2DNVPROC nglVertexAttrib2dNV;
extern NEL_PFNGLVERTEXATTRIB2DVNVPROC nglVertexAttrib2dvNV;
extern NEL_PFNGLVERTEXATTRIB2FNVPROC nglVertexAttrib2fNV;
extern NEL_PFNGLVERTEXATTRIB2FVNVPROC nglVertexAttrib2fvNV;
extern NEL_PFNGLVERTEXATTRIB2SNVPROC nglVertexAttrib2sNV;
extern NEL_PFNGLVERTEXATTRIB2SVNVPROC nglVertexAttrib2svNV;
extern NEL_PFNGLVERTEXATTRIB3DNVPROC nglVertexAttrib3dNV;
extern NEL_PFNGLVERTEXATTRIB3DVNVPROC nglVertexAttrib3dvNV;
extern NEL_PFNGLVERTEXATTRIB3FNVPROC nglVertexAttrib3fNV;
extern NEL_PFNGLVERTEXATTRIB3FVNVPROC nglVertexAttrib3fvNV;
extern NEL_PFNGLVERTEXATTRIB3SNVPROC nglVertexAttrib3sNV;
extern NEL_PFNGLVERTEXATTRIB3SVNVPROC nglVertexAttrib3svNV;
extern NEL_PFNGLVERTEXATTRIB4DNVPROC nglVertexAttrib4dNV;
extern NEL_PFNGLVERTEXATTRIB4DVNVPROC nglVertexAttrib4dvNV;
extern NEL_PFNGLVERTEXATTRIB4FNVPROC nglVertexAttrib4fNV;
extern NEL_PFNGLVERTEXATTRIB4FVNVPROC nglVertexAttrib4fvNV;
extern NEL_PFNGLVERTEXATTRIB4SNVPROC nglVertexAttrib4sNV;
extern NEL_PFNGLVERTEXATTRIB4SVNVPROC nglVertexAttrib4svNV;
extern NEL_PFNGLVERTEXATTRIB4UBVNVPROC nglVertexAttrib4ubvNV;
extern NEL_PFNGLVERTEXATTRIBS1DVNVPROC nglVertexAttribs1dvNV;
extern NEL_PFNGLVERTEXATTRIBS1FVNVPROC nglVertexAttribs1fvNV;
extern NEL_PFNGLVERTEXATTRIBS1SVNVPROC nglVertexAttribs1svNV;
extern NEL_PFNGLVERTEXATTRIBS2DVNVPROC nglVertexAttribs2dvNV;
extern NEL_PFNGLVERTEXATTRIBS2FVNVPROC nglVertexAttribs2fvNV;
extern NEL_PFNGLVERTEXATTRIBS2SVNVPROC nglVertexAttribs2svNV;
extern NEL_PFNGLVERTEXATTRIBS3DVNVPROC nglVertexAttribs3dvNV;
extern NEL_PFNGLVERTEXATTRIBS3FVNVPROC nglVertexAttribs3fvNV;
extern NEL_PFNGLVERTEXATTRIBS3SVNVPROC nglVertexAttribs3svNV;
extern NEL_PFNGLVERTEXATTRIBS4DVNVPROC nglVertexAttribs4dvNV;
extern NEL_PFNGLVERTEXATTRIBS4FVNVPROC nglVertexAttribs4fvNV;
extern NEL_PFNGLVERTEXATTRIBS4SVNVPROC nglVertexAttribs4svNV;
extern NEL_PFNGLVERTEXATTRIBS4UBVNVPROC nglVertexAttribs4ubvNV;
extern PFNGLAREPROGRAMSRESIDENTNVPROC nglAreProgramsResidentNV;
extern PFNGLBINDPROGRAMNVPROC nglBindProgramNV;
extern PFNGLDELETEPROGRAMSNVPROC nglDeleteProgramsNV;
extern PFNGLEXECUTEPROGRAMNVPROC nglExecuteProgramNV;
extern PFNGLGENPROGRAMSNVPROC nglGenProgramsNV;
extern PFNGLGETPROGRAMPARAMETERDVNVPROC nglGetProgramParameterdvNV;
extern PFNGLGETPROGRAMPARAMETERFVNVPROC nglGetProgramParameterfvNV;
extern PFNGLGETPROGRAMIVNVPROC nglGetProgramivNV;
extern PFNGLGETPROGRAMSTRINGNVPROC nglGetProgramStringNV;
extern PFNGLGETTRACKMATRIXIVNVPROC nglGetTrackMatrixivNV;
extern PFNGLGETVERTEXATTRIBDVNVPROC nglGetVertexAttribdvNV;
extern PFNGLGETVERTEXATTRIBFVNVPROC nglGetVertexAttribfvNV;
extern PFNGLGETVERTEXATTRIBIVNVPROC nglGetVertexAttribivNV;
extern PFNGLGETVERTEXATTRIBPOINTERVNVPROC nglGetVertexAttribPointervNV;
extern PFNGLISPROGRAMNVPROC nglIsProgramNV;
extern PFNGLLOADPROGRAMNVPROC nglLoadProgramNV;
extern PFNGLPROGRAMPARAMETER4DNVPROC nglProgramParameter4dNV;
extern PFNGLPROGRAMPARAMETER4DVNVPROC nglProgramParameter4dvNV;
extern PFNGLPROGRAMPARAMETER4FNVPROC nglProgramParameter4fNV;
extern PFNGLPROGRAMPARAMETER4FVNVPROC nglProgramParameter4fvNV;
extern PFNGLPROGRAMPARAMETERS4DVNVPROC nglProgramParameters4dvNV;
extern PFNGLPROGRAMPARAMETERS4FVNVPROC nglProgramParameters4fvNV;
extern PFNGLREQUESTRESIDENTPROGRAMSNVPROC nglRequestResidentProgramsNV;
extern PFNGLTRACKMATRIXNVPROC nglTrackMatrixNV;
extern PFNGLVERTEXATTRIBPOINTERNVPROC nglVertexAttribPointerNV;
extern PFNGLVERTEXATTRIB1DNVPROC nglVertexAttrib1dNV;
extern PFNGLVERTEXATTRIB1DVNVPROC nglVertexAttrib1dvNV;
extern PFNGLVERTEXATTRIB1FNVPROC nglVertexAttrib1fNV;
extern PFNGLVERTEXATTRIB1FVNVPROC nglVertexAttrib1fvNV;
extern PFNGLVERTEXATTRIB1SNVPROC nglVertexAttrib1sNV;
extern PFNGLVERTEXATTRIB1SVNVPROC nglVertexAttrib1svNV;
extern PFNGLVERTEXATTRIB2DNVPROC nglVertexAttrib2dNV;
extern PFNGLVERTEXATTRIB2DVNVPROC nglVertexAttrib2dvNV;
extern PFNGLVERTEXATTRIB2FNVPROC nglVertexAttrib2fNV;
extern PFNGLVERTEXATTRIB2FVNVPROC nglVertexAttrib2fvNV;
extern PFNGLVERTEXATTRIB2SNVPROC nglVertexAttrib2sNV;
extern PFNGLVERTEXATTRIB2SVNVPROC nglVertexAttrib2svNV;
extern PFNGLVERTEXATTRIB3DNVPROC nglVertexAttrib3dNV;
extern PFNGLVERTEXATTRIB3DVNVPROC nglVertexAttrib3dvNV;
extern PFNGLVERTEXATTRIB3FNVPROC nglVertexAttrib3fNV;
extern PFNGLVERTEXATTRIB3FVNVPROC nglVertexAttrib3fvNV;
extern PFNGLVERTEXATTRIB3SNVPROC nglVertexAttrib3sNV;
extern PFNGLVERTEXATTRIB3SVNVPROC nglVertexAttrib3svNV;
extern PFNGLVERTEXATTRIB4DNVPROC nglVertexAttrib4dNV;
extern PFNGLVERTEXATTRIB4DVNVPROC nglVertexAttrib4dvNV;
extern PFNGLVERTEXATTRIB4FNVPROC nglVertexAttrib4fNV;
extern PFNGLVERTEXATTRIB4FVNVPROC nglVertexAttrib4fvNV;
extern PFNGLVERTEXATTRIB4SNVPROC nglVertexAttrib4sNV;
extern PFNGLVERTEXATTRIB4SVNVPROC nglVertexAttrib4svNV;
extern PFNGLVERTEXATTRIB4UBVNVPROC nglVertexAttrib4ubvNV;
extern PFNGLVERTEXATTRIBS1DVNVPROC nglVertexAttribs1dvNV;
extern PFNGLVERTEXATTRIBS1FVNVPROC nglVertexAttribs1fvNV;
extern PFNGLVERTEXATTRIBS1SVNVPROC nglVertexAttribs1svNV;
extern PFNGLVERTEXATTRIBS2DVNVPROC nglVertexAttribs2dvNV;
extern PFNGLVERTEXATTRIBS2FVNVPROC nglVertexAttribs2fvNV;
extern PFNGLVERTEXATTRIBS2SVNVPROC nglVertexAttribs2svNV;
extern PFNGLVERTEXATTRIBS3DVNVPROC nglVertexAttribs3dvNV;
extern PFNGLVERTEXATTRIBS3FVNVPROC nglVertexAttribs3fvNV;
extern PFNGLVERTEXATTRIBS3SVNVPROC nglVertexAttribs3svNV;
extern PFNGLVERTEXATTRIBS4DVNVPROC nglVertexAttribs4dvNV;
extern PFNGLVERTEXATTRIBS4FVNVPROC nglVertexAttribs4fvNV;
extern PFNGLVERTEXATTRIBS4SVNVPROC nglVertexAttribs4svNV;
extern PFNGLVERTEXATTRIBS4UBVNVPROC nglVertexAttribs4ubvNV;
// VertexShaderExtension.
//========================
extern NEL_PFNGLBEGINVERTEXSHADEREXTPROC nglBeginVertexShaderEXT;
extern NEL_PFNGLENDVERTEXSHADEREXTPROC nglEndVertexShaderEXT;
extern NEL_PFNGLBINDVERTEXSHADEREXTPROC nglBindVertexShaderEXT;
extern NEL_PFNGLGENVERTEXSHADERSEXTPROC nglGenVertexShadersEXT;
extern NEL_PFNGLDELETEVERTEXSHADEREXTPROC nglDeleteVertexShaderEXT;
extern NEL_PFNGLSHADEROP1EXTPROC nglShaderOp1EXT;
extern NEL_PFNGLSHADEROP2EXTPROC nglShaderOp2EXT;
extern NEL_PFNGLSHADEROP3EXTPROC nglShaderOp3EXT;
extern NEL_PFNGLSWIZZLEEXTPROC nglSwizzleEXT;
extern NEL_PFNGLWRITEMASKEXTPROC nglWriteMaskEXT;
extern NEL_PFNGLINSERTCOMPONENTEXTPROC nglInsertComponentEXT;
extern NEL_PFNGLEXTRACTCOMPONENTEXTPROC nglExtractComponentEXT;
extern NEL_PFNGLGENSYMBOLSEXTPROC nglGenSymbolsEXT;
extern NEL_PFNGLSETINVARIANTEXTPROC nglSetInvariantEXT;
extern NEL_PFNGLSETLOCALCONSTANTEXTPROC nglSetLocalConstantEXT;
extern NEL_PFNGLVARIANTPOINTEREXTPROC nglVariantPointerEXT;
extern NEL_PFNGLENABLEVARIANTCLIENTSTATEEXTPROC nglEnableVariantClientStateEXT;
extern NEL_PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC nglDisableVariantClientStateEXT;
extern NEL_PFNGLBINDLIGHTPARAMETEREXTPROC nglBindLightParameterEXT;
extern NEL_PFNGLBINDMATERIALPARAMETEREXTPROC nglBindMaterialParameterEXT;
extern NEL_PFNGLBINDTEXGENPARAMETEREXTPROC nglBindTexGenParameterEXT;
extern NEL_PFNGLBINDTEXTUREUNITPARAMETEREXTPROC nglBindTextureUnitParameterEXT;
extern NEL_PFNGLBINDPARAMETEREXTPROC nglBindParameterEXT;
extern NEL_PFNGLISVARIANTENABLEDEXTPROC nglIsVariantEnabledEXT;
extern NEL_PFNGLGETVARIANTBOOLEANVEXTPROC nglGetVariantBooleanvEXT;
extern NEL_PFNGLGETVARIANTINTEGERVEXTPROC nglGetVariantIntegervEXT;
extern NEL_PFNGLGETVARIANTFLOATVEXTPROC nglGetVariantFloatvEXT;
extern NEL_PFNGLGETVARIANTPOINTERVEXTPROC nglGetVariantPointervEXT;
extern NEL_PFNGLGETINVARIANTBOOLEANVEXTPROC nglGetInvariantBooleanvEXT;
extern NEL_PFNGLGETINVARIANTINTEGERVEXTPROC nglGetInvariantIntegervEXT;
extern NEL_PFNGLGETINVARIANTFLOATVEXTPROC nglGetInvariantFloatvEXT;
extern NEL_PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC nglGetLocalConstantBooleanvEXT;
extern NEL_PFNGLGETLOCALCONSTANTINTEGERVEXTPROC nglGetLocalConstantIntegervEXT;
extern NEL_PFNGLGETLOCALCONSTANTFLOATVEXTPROC nglGetLocalConstantFloatvEXT;
extern PFNGLBEGINVERTEXSHADEREXTPROC nglBeginVertexShaderEXT;
extern PFNGLENDVERTEXSHADEREXTPROC nglEndVertexShaderEXT;
extern PFNGLBINDVERTEXSHADEREXTPROC nglBindVertexShaderEXT;
extern PFNGLGENVERTEXSHADERSEXTPROC nglGenVertexShadersEXT;
extern PFNGLDELETEVERTEXSHADEREXTPROC nglDeleteVertexShaderEXT;
extern PFNGLSHADEROP1EXTPROC nglShaderOp1EXT;
extern PFNGLSHADEROP2EXTPROC nglShaderOp2EXT;
extern PFNGLSHADEROP3EXTPROC nglShaderOp3EXT;
extern PFNGLSWIZZLEEXTPROC nglSwizzleEXT;
extern PFNGLWRITEMASKEXTPROC nglWriteMaskEXT;
extern PFNGLINSERTCOMPONENTEXTPROC nglInsertComponentEXT;
extern PFNGLEXTRACTCOMPONENTEXTPROC nglExtractComponentEXT;
extern PFNGLGENSYMBOLSEXTPROC nglGenSymbolsEXT;
extern PFNGLSETINVARIANTEXTPROC nglSetInvariantEXT;
extern PFNGLSETLOCALCONSTANTEXTPROC nglSetLocalConstantEXT;
extern PFNGLVARIANTPOINTEREXTPROC nglVariantPointerEXT;
extern PFNGLENABLEVARIANTCLIENTSTATEEXTPROC nglEnableVariantClientStateEXT;
extern PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC nglDisableVariantClientStateEXT;
extern PFNGLBINDLIGHTPARAMETEREXTPROC nglBindLightParameterEXT;
extern PFNGLBINDMATERIALPARAMETEREXTPROC nglBindMaterialParameterEXT;
extern PFNGLBINDTEXGENPARAMETEREXTPROC nglBindTexGenParameterEXT;
extern PFNGLBINDTEXTUREUNITPARAMETEREXTPROC nglBindTextureUnitParameterEXT;
extern PFNGLBINDPARAMETEREXTPROC nglBindParameterEXT;
extern PFNGLISVARIANTENABLEDEXTPROC nglIsVariantEnabledEXT;
extern PFNGLGETVARIANTBOOLEANVEXTPROC nglGetVariantBooleanvEXT;
extern PFNGLGETVARIANTINTEGERVEXTPROC nglGetVariantIntegervEXT;
extern PFNGLGETVARIANTFLOATVEXTPROC nglGetVariantFloatvEXT;
extern PFNGLGETVARIANTPOINTERVEXTPROC nglGetVariantPointervEXT;
extern PFNGLGETINVARIANTBOOLEANVEXTPROC nglGetInvariantBooleanvEXT;
extern PFNGLGETINVARIANTINTEGERVEXTPROC nglGetInvariantIntegervEXT;
extern PFNGLGETINVARIANTFLOATVEXTPROC nglGetInvariantFloatvEXT;
extern PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC nglGetLocalConstantBooleanvEXT;
extern PFNGLGETLOCALCONSTANTINTEGERVEXTPROC nglGetLocalConstantIntegervEXT;
extern PFNGLGETLOCALCONSTANTFLOATVEXTPROC nglGetLocalConstantFloatvEXT;
// ATI_envmap_bumpmap extension
@ -524,100 +545,100 @@ extern PFNGLGETTEXBUMPPARAMETERFVATIPROC nglGetTexBumpParameterfvATI;
// SecondaryColor extension
//========================
extern NEL_PFNGLSECONDARYCOLOR3BEXTPROC nglSecondaryColor3bEXT;
extern NEL_PFNGLSECONDARYCOLOR3BVEXTPROC nglSecondaryColor3bvEXT;
extern NEL_PFNGLSECONDARYCOLOR3DEXTPROC nglSecondaryColor3dEXT;
extern NEL_PFNGLSECONDARYCOLOR3DVEXTPROC nglSecondaryColor3dvEXT;
extern NEL_PFNGLSECONDARYCOLOR3FEXTPROC nglSecondaryColor3fEXT;
extern NEL_PFNGLSECONDARYCOLOR3FVEXTPROC nglSecondaryColor3fvEXT;
extern NEL_PFNGLSECONDARYCOLOR3IEXTPROC nglSecondaryColor3iEXT;
extern NEL_PFNGLSECONDARYCOLOR3IVEXTPROC nglSecondaryColor3ivEXT;
extern NEL_PFNGLSECONDARYCOLOR3SEXTPROC nglSecondaryColor3sEXT;
extern NEL_PFNGLSECONDARYCOLOR3SVEXTPROC nglSecondaryColor3svEXT;
extern NEL_PFNGLSECONDARYCOLOR3UBEXTPROC nglSecondaryColor3ubEXT;
extern NEL_PFNGLSECONDARYCOLOR3UBVEXTPROC nglSecondaryColor3ubvEXT;
extern NEL_PFNGLSECONDARYCOLOR3UIEXTPROC nglSecondaryColor3uiEXT;
extern NEL_PFNGLSECONDARYCOLOR3UIVEXTPROC nglSecondaryColor3uivEXT;
extern NEL_PFNGLSECONDARYCOLOR3USEXTPROC nglSecondaryColor3usEXT;
extern NEL_PFNGLSECONDARYCOLOR3USVEXTPROC nglSecondaryColor3usvEXT;
extern NEL_PFNGLSECONDARYCOLORPOINTEREXTPROC nglSecondaryColorPointerEXT;
extern PFNGLSECONDARYCOLOR3BEXTPROC nglSecondaryColor3bEXT;
extern PFNGLSECONDARYCOLOR3BVEXTPROC nglSecondaryColor3bvEXT;
extern PFNGLSECONDARYCOLOR3DEXTPROC nglSecondaryColor3dEXT;
extern PFNGLSECONDARYCOLOR3DVEXTPROC nglSecondaryColor3dvEXT;
extern PFNGLSECONDARYCOLOR3FEXTPROC nglSecondaryColor3fEXT;
extern PFNGLSECONDARYCOLOR3FVEXTPROC nglSecondaryColor3fvEXT;
extern PFNGLSECONDARYCOLOR3IEXTPROC nglSecondaryColor3iEXT;
extern PFNGLSECONDARYCOLOR3IVEXTPROC nglSecondaryColor3ivEXT;
extern PFNGLSECONDARYCOLOR3SEXTPROC nglSecondaryColor3sEXT;
extern PFNGLSECONDARYCOLOR3SVEXTPROC nglSecondaryColor3svEXT;
extern PFNGLSECONDARYCOLOR3UBEXTPROC nglSecondaryColor3ubEXT;
extern PFNGLSECONDARYCOLOR3UBVEXTPROC nglSecondaryColor3ubvEXT;
extern PFNGLSECONDARYCOLOR3UIEXTPROC nglSecondaryColor3uiEXT;
extern PFNGLSECONDARYCOLOR3UIVEXTPROC nglSecondaryColor3uivEXT;
extern PFNGLSECONDARYCOLOR3USEXTPROC nglSecondaryColor3usEXT;
extern PFNGLSECONDARYCOLOR3USVEXTPROC nglSecondaryColor3usvEXT;
extern PFNGLSECONDARYCOLORPOINTEREXTPROC nglSecondaryColorPointerEXT;
// BlendColor extension
//========================
extern NEL_PFNGLBLENDCOLOREXTPROC nglBlendColorEXT;
extern PFNGLBLENDCOLOREXTPROC nglBlendColorEXT;
// GL_ATI_vertex_array_object extension
//========================
extern NEL_PFNGLNEWOBJECTBUFFERATIPROC nglNewObjectBufferATI;
extern NEL_PFNGLISOBJECTBUFFERATIPROC nglIsObjectBufferATI;
extern NEL_PFNGLUPDATEOBJECTBUFFERATIPROC nglUpdateObjectBufferATI;
extern NEL_PFNGLGETOBJECTBUFFERFVATIPROC nglGetObjectBufferfvATI;
extern NEL_PFNGLGETOBJECTBUFFERIVATIPROC nglGetObjectBufferivATI;
extern NEL_PFNGLDELETEOBJECTBUFFERATIPROC nglDeleteObjectBufferATI;
extern NEL_PFNGLARRAYOBJECTATIPROC nglArrayObjectATI;
extern NEL_PFNGLGETARRAYOBJECTFVATIPROC nglGetArrayObjectfvATI;
extern NEL_PFNGLGETARRAYOBJECTIVATIPROC nglGetArrayObjectivATI;
extern NEL_PFNGLVARIANTARRAYOBJECTATIPROC nglVariantArrayObjectATI;
extern NEL_PFNGLGETVARIANTARRAYOBJECTFVATIPROC nglGetVariantArrayObjectfvATI;
extern NEL_PFNGLGETVARIANTARRAYOBJECTIVATIPROC nglGetVariantArrayObjectivATI;
extern PFNGLNEWOBJECTBUFFERATIPROC nglNewObjectBufferATI;
extern PFNGLISOBJECTBUFFERATIPROC nglIsObjectBufferATI;
extern PFNGLUPDATEOBJECTBUFFERATIPROC nglUpdateObjectBufferATI;
extern PFNGLGETOBJECTBUFFERFVATIPROC nglGetObjectBufferfvATI;
extern PFNGLGETOBJECTBUFFERIVATIPROC nglGetObjectBufferivATI;
extern PFNGLFREEOBJECTBUFFERATIPROC nglFreeObjectBufferATI;
extern PFNGLARRAYOBJECTATIPROC nglArrayObjectATI;
extern PFNGLGETARRAYOBJECTFVATIPROC nglGetArrayObjectfvATI;
extern PFNGLGETARRAYOBJECTIVATIPROC nglGetArrayObjectivATI;
extern PFNGLVARIANTARRAYOBJECTATIPROC nglVariantArrayObjectATI;
extern PFNGLGETVARIANTARRAYOBJECTFVATIPROC nglGetVariantArrayObjectfvATI;
extern PFNGLGETVARIANTARRAYOBJECTIVATIPROC nglGetVariantArrayObjectivATI;
// GL_ATI_map_object_buffer
//===================================
extern NEL_PFNGLMAPOBJECTBUFFERATIPROC nglMapObjectBufferATI;
extern NEL_PFNGLUNMAPOBJECTBUFFERATIPROC nglUnmapObjectBufferATI;
extern PFNGLMAPOBJECTBUFFERATIPROC nglMapObjectBufferATI;
extern PFNGLUNMAPOBJECTBUFFERATIPROC nglUnmapObjectBufferATI;
// GL_ATI_fragment_shader extension
//===================================
extern NEL_PFNGLGENFRAGMENTSHADERSATIPROC nglGenFragmentShadersATI;
extern NEL_PFNGLBINDFRAGMENTSHADERATIPROC nglBindFragmentShaderATI;
extern NEL_PFNGLDELETEFRAGMENTSHADERATIPROC nglDeleteFragmentShaderATI;
extern NEL_PFNGLBEGINFRAGMENTSHADERATIPROC nglBeginFragmentShaderATI;
extern NEL_PFNGLENDFRAGMENTSHADERATIPROC nglEndFragmentShaderATI;
extern NEL_PFNGLPASSTEXCOORDATIPROC nglPassTexCoordATI;
extern NEL_PFNGLSAMPLEMAPATIPROC nglSampleMapATI;
extern NEL_PFNGLCOLORFRAGMENTOP1ATIPROC nglColorFragmentOp1ATI;
extern NEL_PFNGLCOLORFRAGMENTOP2ATIPROC nglColorFragmentOp2ATI;
extern NEL_PFNGLCOLORFRAGMENTOP3ATIPROC nglColorFragmentOp3ATI;
extern NEL_PFNGLALPHAFRAGMENTOP1ATIPROC nglAlphaFragmentOp1ATI;
extern NEL_PFNGLALPHAFRAGMENTOP2ATIPROC nglAlphaFragmentOp2ATI;
extern NEL_PFNGLALPHAFRAGMENTOP3ATIPROC nglAlphaFragmentOp3ATI;
extern NEL_PFNGLSETFRAGMENTSHADERCONSTANTATIPROC nglSetFragmentShaderConstantATI;
extern PFNGLGENFRAGMENTSHADERSATIPROC nglGenFragmentShadersATI;
extern PFNGLBINDFRAGMENTSHADERATIPROC nglBindFragmentShaderATI;
extern PFNGLDELETEFRAGMENTSHADERATIPROC nglDeleteFragmentShaderATI;
extern PFNGLBEGINFRAGMENTSHADERATIPROC nglBeginFragmentShaderATI;
extern PFNGLENDFRAGMENTSHADERATIPROC nglEndFragmentShaderATI;
extern PFNGLPASSTEXCOORDATIPROC nglPassTexCoordATI;
extern PFNGLSAMPLEMAPATIPROC nglSampleMapATI;
extern PFNGLCOLORFRAGMENTOP1ATIPROC nglColorFragmentOp1ATI;
extern PFNGLCOLORFRAGMENTOP2ATIPROC nglColorFragmentOp2ATI;
extern PFNGLCOLORFRAGMENTOP3ATIPROC nglColorFragmentOp3ATI;
extern PFNGLALPHAFRAGMENTOP1ATIPROC nglAlphaFragmentOp1ATI;
extern PFNGLALPHAFRAGMENTOP2ATIPROC nglAlphaFragmentOp2ATI;
extern PFNGLALPHAFRAGMENTOP3ATIPROC nglAlphaFragmentOp3ATI;
extern PFNGLSETFRAGMENTSHADERCONSTANTATIPROC nglSetFragmentShaderConstantATI;
// GL_ATI_vertex_attrib_array_object
//==================================
extern NEL_PFNGLVERTEXATTRIBARRAYOBJECTATIPROC nglVertexAttribArrayObjectATI;
extern NEL_PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC nglGetVertexAttribArrayObjectfvATI;
extern NEL_PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC nglGetVertexAttribArrayObjectivATI;
extern PFNGLVERTEXATTRIBARRAYOBJECTATIPROC nglVertexAttribArrayObjectATI;
extern PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC nglGetVertexAttribArrayObjectfvATI;
extern PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC nglGetVertexAttribArrayObjectivATI;
// GL_ARB_fragment_shader_extension
//==================================
extern NEL_PFNGLPROGRAMSTRINGARBPROC nglProgramStringARB;
extern NEL_PFNGLBINDPROGRAMARBPROC nglBindProgramARB;
extern NEL_PFNGLDELETEPROGRAMSARBPROC nglDeleteProgramsARB;
extern NEL_PFNGLGENPROGRAMSARBPROC nglGenProgramsARB;
extern NEL_PFNGLPROGRAMENVPARAMETER4DARBPROC nglProgramEnvParameter4dARB;
extern NEL_PFNGLPROGRAMENVPARAMETER4DVARBPROC nglProgramEnvParameter4dvARB;
extern NEL_PFNGLPROGRAMENVPARAMETER4FARBPROC nglProgramEnvParameter4fARB;
extern NEL_PFNGLPROGRAMENVPARAMETER4FVARBPROC nglProgramEnvParameter4fvARB;
extern NEL_PFNGLPROGRAMLOCALPARAMETER4DARBPROC nglGetProgramLocalParameter4dARB;
extern NEL_PFNGLPROGRAMLOCALPARAMETER4DVARBPROC nglGetProgramLocalParameter4dvARB;
extern NEL_PFNGLPROGRAMLOCALPARAMETER4FARBPROC nglGetProgramLocalParameter4fARB;
extern NEL_PFNGLPROGRAMLOCALPARAMETER4FVARBPROC nglGetProgramLocalParameter4fvARB;
extern NEL_PFNGLGETPROGRAMENVPARAMETERDVARBPROC nglGetProgramEnvParameterdvARB;
extern NEL_PFNGLGETPROGRAMENVPARAMETERFVARBPROC nglGetProgramEnvParameterfvARB;
extern NEL_PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC nglGetProgramLocalParameterdvARB;
extern NEL_PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC nglGetProgramLocalParameterfvARB;
extern NEL_PFNGLGETPROGRAMIVARBPROC nglGetProgramivARB;
extern NEL_PFNGLGETPROGRAMSTRINGARBPROC nglGetProgramStringARB;
extern NEL_PFNGLISPROGRAMARBPROC nglIsProgramARB;
extern PFNGLPROGRAMSTRINGARBPROC nglProgramStringARB;
extern PFNGLBINDPROGRAMARBPROC nglBindProgramARB;
extern PFNGLDELETEPROGRAMSARBPROC nglDeleteProgramsARB;
extern PFNGLGENPROGRAMSARBPROC nglGenProgramsARB;
extern PFNGLPROGRAMENVPARAMETER4DARBPROC nglProgramEnvParameter4dARB;
extern PFNGLPROGRAMENVPARAMETER4DVARBPROC nglProgramEnvParameter4dvARB;
extern PFNGLPROGRAMENVPARAMETER4FARBPROC nglProgramEnvParameter4fARB;
extern PFNGLPROGRAMENVPARAMETER4FVARBPROC nglProgramEnvParameter4fvARB;
extern PFNGLPROGRAMLOCALPARAMETER4DARBPROC nglGetProgramLocalParameter4dARB;
extern PFNGLPROGRAMLOCALPARAMETER4DVARBPROC nglGetProgramLocalParameter4dvARB;
extern PFNGLPROGRAMLOCALPARAMETER4FARBPROC nglGetProgramLocalParameter4fARB;
extern PFNGLPROGRAMLOCALPARAMETER4FVARBPROC nglGetProgramLocalParameter4fvARB;
extern PFNGLGETPROGRAMENVPARAMETERDVARBPROC nglGetProgramEnvParameterdvARB;
extern PFNGLGETPROGRAMENVPARAMETERFVARBPROC nglGetProgramEnvParameterfvARB;
extern PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC nglGetProgramLocalParameterdvARB;
extern PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC nglGetProgramLocalParameterfvARB;
extern PFNGLGETPROGRAMIVARBPROC nglGetProgramivARB;
extern PFNGLGETPROGRAMSTRINGARBPROC nglGetProgramStringARB;
extern PFNGLISPROGRAMARBPROC nglIsProgramARB;
// GL_ARB_vertex_buffer_object
//==================================
@ -702,13 +723,13 @@ extern PFNGLISPROGRAMARBPROC nglIsProgramARB;
// GL_NV_occlusion_query
//==================================
extern NEL_PFNGLGENOCCLUSIONQUERIESNVPROC nglGenOcclusionQueriesNV;
extern NEL_PFNGLDELETEOCCLUSIONQUERIESNVPROC nglDeleteOcclusionQueriesNV;
extern NEL_PFNGLISOCCLUSIONQUERYNVPROC nglIsOcclusionQueryNV;
extern NEL_PFNGLBEGINOCCLUSIONQUERYNVPROC nglBeginOcclusionQueryNV;
extern NEL_PFNGLENDOCCLUSIONQUERYNVPROC nglEndOcclusionQueryNV;
extern NEL_PFNGLGETOCCLUSIONQUERYIVNVPROC nglGetOcclusionQueryivNV;
extern NEL_PFNGLGETOCCLUSIONQUERYUIVNVPROC nglGetOcclusionQueryuivNV;
extern PFNGLGENOCCLUSIONQUERIESNVPROC nglGenOcclusionQueriesNV;
extern PFNGLDELETEOCCLUSIONQUERIESNVPROC nglDeleteOcclusionQueriesNV;
extern PFNGLISOCCLUSIONQUERYNVPROC nglIsOcclusionQueryNV;
extern PFNGLBEGINOCCLUSIONQUERYNVPROC nglBeginOcclusionQueryNV;
extern PFNGLENDOCCLUSIONQUERYNVPROC nglEndOcclusionQueryNV;
extern PFNGLGETOCCLUSIONQUERYIVNVPROC nglGetOcclusionQueryivNV;
extern PFNGLGETOCCLUSIONQUERYUIVNVPROC nglGetOcclusionQueryuivNV;
@ -737,46 +758,60 @@ extern PFNWGLGETSWAPINTERVALEXTPROC nwglGetSwapIntervalEXT;
// WGL_ARB_extensions_string
extern PFNWGLGETEXTENSIONSSTRINGARBPROC nwglGetExtensionsStringARB;
extern PFNWGLGETEXTENSIONSSTRINGARBPROC nwglGetExtensionsStringARB;
// WGL_AMD_gpu_association
//========================
extern PFNWGLGETGPUIDSAMDPROC nwglGetGPUIDsAMD;
extern PFNWGLGETGPUINFOAMDPROC nwglGetGPUInfoAMD;
extern PFNWGLGETCONTEXTGPUIDAMDPROC nwglGetContextGPUIDAMD;
extern PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC nwglCreateAssociatedContextAMD;
extern PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC nwglCreateAssociatedContextAttribsAMD;
extern PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC nwglDeleteAssociatedContextAMD;
extern PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC nwglMakeAssociatedContextCurrentAMD;
extern PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC nwglGetCurrentAssociatedContextAMD;
extern PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC nwglBlitContextFramebufferAMD;
#elif defined(NL_OS_MAC)
#elif defined(NL_OS_UNIX)
// Swap control extensions
//===========================
extern NEL_PFNGLXSWAPINTERVALEXTPROC nglXSwapIntervalEXT;
extern PFNGLXSWAPINTERVALEXTPROC nglXSwapIntervalEXT;
extern PFNGLXSWAPINTERVALSGIPROC nglXSwapIntervalSGI;
extern PFNGLXSWAPINTERVALSGIPROC nglXSwapIntervalSGI;
extern NEL_PFNGLXSWAPINTERVALMESAPROC nglXSwapIntervalMESA;
extern NEL_PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA;
extern PFNGLXSWAPINTERVALMESAPROC nglXSwapIntervalMESA;
extern PFNGLXGETSWAPINTERVALMESAPROC nglXGetSwapIntervalMESA;
#endif
// GL_EXT_framebuffer_object
extern NEL_PFNGLISRENDERBUFFEREXTPROC nglIsRenderbufferEXT;
extern NEL_PFNGLISFRAMEBUFFEREXTPROC nglIsFramebufferEXT;
extern NEL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC nglCheckFramebufferStatusEXT;
extern NEL_PFNGLGENFRAMEBUFFERSEXTPROC nglGenFramebuffersEXT;
extern NEL_PFNGLBINDFRAMEBUFFEREXTPROC nglBindFramebufferEXT;
extern NEL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC nglFramebufferTexture2DEXT;
extern NEL_PFNGLGENRENDERBUFFERSEXTPROC nglGenRenderbuffersEXT;
extern NEL_PFNGLBINDRENDERBUFFEREXTPROC nglBindRenderbufferEXT;
extern NEL_PFNGLRENDERBUFFERSTORAGEEXTPROC nglRenderbufferStorageEXT;
extern NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC nglFramebufferRenderbufferEXT;
extern NEL_PFNGLDELETERENDERBUFFERSEXTPROC nglDeleteRenderbuffersEXT;
extern NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC nglDeleteFramebuffersEXT;
extern NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC nglGetRenderbufferParameterivEXT;
extern NEL_PFNGENERATEMIPMAPEXTPROC nglGenerateMipmapEXT;
extern PFNGLISRENDERBUFFEREXTPROC nglIsRenderbufferEXT;
extern PFNGLISFRAMEBUFFEREXTPROC nglIsFramebufferEXT;
extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC nglCheckFramebufferStatusEXT;
extern PFNGLGENFRAMEBUFFERSEXTPROC nglGenFramebuffersEXT;
extern PFNGLBINDFRAMEBUFFEREXTPROC nglBindFramebufferEXT;
extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC nglFramebufferTexture2DEXT;
extern PFNGLGENRENDERBUFFERSEXTPROC nglGenRenderbuffersEXT;
extern PFNGLBINDRENDERBUFFEREXTPROC nglBindRenderbufferEXT;
extern PFNGLRENDERBUFFERSTORAGEEXTPROC nglRenderbufferStorageEXT;
extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC nglFramebufferRenderbufferEXT;
extern PFNGLDELETERENDERBUFFERSEXTPROC nglDeleteRenderbuffersEXT;
extern PFNGLDELETEFRAMEBUFFERSEXTPROC nglDeleteFramebuffersEXT;
extern PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC nglGetRenderbufferParameterivEXT;
extern PFNGLGENERATEMIPMAPEXTPROC nglGenerateMipmapEXT;
// GL_EXT_framebuffer_blit
extern NEL_PFNGLBLITFRAMEBUFFEREXTPROC nglBlitFramebufferEXT;
extern PFNGLBLITFRAMEBUFFEREXTPROC nglBlitFramebufferEXT;
// GL_EXT_framebuffer_multisample
extern NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC nglRenderbufferStorageMultisampleEXT;
extern PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC nglRenderbufferStorageMultisampleEXT;
// GL_ARB_multisample
extern NEL_PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB;
extern PFNGLSAMPLECOVERAGEARBPROC nglSampleCoverageARB;
#endif // USE_OPENGLES

View file

@ -25,44 +25,8 @@ extern "C" {
#endif
#ifdef USE_OPENGLES
// OES_mapbuffer
//==============
typedef void* (APIENTRY * NEL_PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
typedef GLboolean (APIENTRY * NEL_PFNGLUNMAPBUFFEROESPROC) (GLenum target);
typedef void (APIENTRY * NEL_PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void** params);
typedef void (APIENTRY * NEL_PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
// GL_OES_framebuffer_object
//==================================
typedef GLboolean (APIENTRY * NEL_PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer);
typedef void (APIENTRY * NEL_PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer);
typedef void (APIENTRY * NEL_PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers);
typedef void (APIENTRY * NEL_PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers);
typedef void (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (APIENTRY * NEL_PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params);
typedef GLboolean (APIENTRY * NEL_PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer);
typedef void (APIENTRY * NEL_PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer);
typedef void (APIENTRY * NEL_PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers);
typedef void (APIENTRY * NEL_PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers);
typedef GLenum (APIENTRY * NEL_PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target);
typedef void (APIENTRY * NEL_PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef void (APIENTRY * NEL_PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef void (APIENTRY * NEL_PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
typedef void (APIENTRY * NEL_PFNGLGENERATEMIPMAPOESPROC) (GLenum target);
// GL_OES_texture_cube_map
//==================================
typedef void (APIENTRY * NEL_PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param);
typedef void (APIENTRY * NEL_PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param);
typedef void (APIENTRY * NEL_PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params);
typedef void (APIENTRY * NEL_PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
typedef void (APIENTRY * NEL_PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
typedef void (APIENTRY * NEL_PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
// use same defines for OpenGL and OpenGL ES to simplify the code
#define GL_MULTISAMPLE_ARB GL_MULTISAMPLE
#define GL_TEXTURE_CUBE_MAP_ARB GL_TEXTURE_CUBE_MAP_OES
#define GL_NONE 0
@ -86,346 +50,6 @@ typedef void (APIENTRY * NEL_PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pnam
#else
// ***************************************************************************
// ***************************************************************************
// The NEL Functions Typedefs.
// Must do it for compatibilities with futures version of gl.h
// eg: version 1.2 does not define PFNGLACTIVETEXTUREARBPROC. Hence, do it now, with our special name
// ***************************************************************************
// ***************************************************************************
#define WGL_COVERAGE_SAMPLES_NV 0x2042
#define WGL_COLOR_SAMPLES_NV 0x20B9
// ARB_multitexture
//=================
typedef void (APIENTRY * NEL_PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
typedef void (APIENTRY * NEL_PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
typedef void (APIENTRY * NEL_PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
// ARB_TextureCompression.
//========================
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * NEL_PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
typedef void (APIENTRY * NEL_PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img);
// VertexArrayRangeNV.
//====================
typedef void (APIENTRY * NEL_PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void);
typedef void (APIENTRY * NEL_PFNGLVERTEXARRAYRANGENVPROC) (GLsizei size, const GLvoid *pointer);
// FenceNV.
//====================
typedef void (APIENTRY * NEL_PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
typedef void (APIENTRY * NEL_PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
typedef GLboolean (APIENTRY * NEL_PFNGLISFENCENVPROC) (GLuint fence);
typedef GLboolean (APIENTRY * NEL_PFNGLTESTFENCENVPROC) (GLuint fence);
typedef void (APIENTRY * NEL_PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLFINISHFENCENVPROC) (GLuint fence);
typedef void (APIENTRY * NEL_PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
// VertexWeighting.
//==================
typedef void (APIENTRY * NEL_PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);
typedef void (APIENTRY * NEL_PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight);
typedef void (APIENTRY * NEL_PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer);
// VertexProgramExtension.
//========================
typedef GLboolean (APIENTRY * NEL_PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences);
typedef void (APIENTRY * NEL_PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id);
typedef void (APIENTRY * NEL_PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
typedef void (APIENTRY * NEL_PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs);
typedef void (APIENTRY * NEL_PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params);
typedef void (APIENTRY * NEL_PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program);
typedef void (APIENTRY * NEL_PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params);
typedef void (APIENTRY * NEL_PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer);
typedef GLboolean (APIENTRY * NEL_PFNGLISPROGRAMNVPROC) (GLuint id);
typedef void (APIENTRY * NEL_PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
typedef void (APIENTRY * NEL_PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef void (APIENTRY * NEL_PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (APIENTRY * NEL_PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
typedef void (APIENTRY * NEL_PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v);
// VertexShaderExtension (EXT)
//============================
typedef void (APIENTRY * NEL_PFNGLBEGINVERTEXSHADEREXTPROC) ( void );
typedef void (APIENTRY * NEL_PFNGLENDVERTEXSHADEREXTPROC) ( void );
typedef void (APIENTRY * NEL_PFNGLBINDVERTEXSHADEREXTPROC) ( GLuint id );
typedef GLuint (APIENTRY * NEL_PFNGLGENVERTEXSHADERSEXTPROC) ( GLuint range );
typedef void (APIENTRY * NEL_PFNGLDELETEVERTEXSHADEREXTPROC) ( GLuint id );
typedef void (APIENTRY * NEL_PFNGLSHADEROP1EXTPROC) ( GLenum op, GLuint res, GLuint arg1 );
typedef void (APIENTRY * NEL_PFNGLSHADEROP2EXTPROC) ( GLenum op, GLuint res, GLuint arg1, GLuint arg2 );
typedef void (APIENTRY * NEL_PFNGLSHADEROP3EXTPROC) ( GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3 );
typedef void (APIENTRY * NEL_PFNGLSWIZZLEEXTPROC) ( GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW );
typedef void (APIENTRY * NEL_PFNGLWRITEMASKEXTPROC) ( GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW );
typedef void (APIENTRY * NEL_PFNGLINSERTCOMPONENTEXTPROC) ( GLuint res, GLuint src, GLuint num );
typedef void (APIENTRY * NEL_PFNGLEXTRACTCOMPONENTEXTPROC) ( GLuint res, GLuint src, GLuint num );
typedef GLuint (APIENTRY * NEL_PFNGLGENSYMBOLSEXTPROC) ( GLenum datatype, GLenum storagetype, GLenum range, GLuint components ) ;
typedef void (APIENTRY * NEL_PFNGLSETINVARIANTEXTPROC) ( GLuint id, GLenum type, void *addr );
typedef void (APIENTRY * NEL_PFNGLSETLOCALCONSTANTEXTPROC) ( GLuint id, GLenum type, void *addr );
typedef void (APIENTRY * NEL_PFNGLVARIANTPOINTEREXTPROC) ( GLuint id, GLenum type, GLuint stride, void *addr );
typedef void (APIENTRY * NEL_PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) ( GLuint id);
typedef void (APIENTRY * NEL_PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) ( GLuint id);
typedef GLuint (APIENTRY * NEL_PFNGLBINDLIGHTPARAMETEREXTPROC) ( GLenum light, GLenum value);
typedef GLuint (APIENTRY * NEL_PFNGLBINDMATERIALPARAMETEREXTPROC) ( GLenum face, GLenum value);
typedef GLuint (APIENTRY * NEL_PFNGLBINDTEXGENPARAMETEREXTPROC) ( GLenum unit, GLenum coord, GLenum value);
typedef GLuint (APIENTRY * NEL_PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) ( GLenum unit, GLenum value);
typedef GLuint (APIENTRY * NEL_PFNGLBINDPARAMETEREXTPROC) ( GLenum value);
typedef GLboolean (APIENTRY * NEL_PFNGLISVARIANTENABLEDEXTPROC) ( GLuint id, GLenum cap);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTBOOLEANVEXTPROC) ( GLuint id, GLenum value, GLboolean *data);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTINTEGERVEXTPROC) ( GLuint id, GLenum value, GLint *data);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTFLOATVEXTPROC) ( GLuint id, GLenum value, GLfloat *data);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTPOINTERVEXTPROC) ( GLuint id, GLenum value, void **data);
typedef void (APIENTRY * NEL_PFNGLGETINVARIANTBOOLEANVEXTPROC) ( GLuint id, GLenum value, GLboolean *data);
typedef void (APIENTRY * NEL_PFNGLGETINVARIANTINTEGERVEXTPROC) ( GLuint id, GLenum value, GLint *data);
typedef void (APIENTRY * NEL_PFNGLGETINVARIANTFLOATVEXTPROC) ( GLuint id, GLenum value, GLfloat *data);
typedef void (APIENTRY * NEL_PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) ( GLuint id, GLenum value, GLboolean *data);
typedef void (APIENTRY * NEL_PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) ( GLuint id, GLenum value, GLint *data);
typedef void (APIENTRY * NEL_PFNGLGETLOCALCONSTANTFLOATVEXTPROC) ( GLuint id, GLenum value, GLfloat *data);
// SecondaryColor extension
//========================
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);
typedef void (APIENTRY * NEL_PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);
// BlendColor extension
//========================
typedef void (APIENTRY * NEL_PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
// GL_ATI_vertex_array_object extension
//========================
typedef GLuint (APIENTRY * NEL_PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage);
typedef GLboolean (APIENTRY * NEL_PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer);
typedef void (APIENTRY * NEL_PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve);
typedef void (APIENTRY * NEL_PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLDELETEOBJECTBUFFERATIPROC) (GLuint buffer);
typedef void (APIENTRY * NEL_PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
typedef void (APIENTRY * NEL_PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params);
typedef void (APIENTRY * NEL_PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params);
typedef void (APIENTRY * NEL_PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params);
// GL_ATI_fragment_shader extension
//==================================
typedef GLuint (APIENTRY *NEL_PFNGLGENFRAGMENTSHADERSATIPROC)(GLuint range);
typedef GLvoid (APIENTRY *NEL_PFNGLBINDFRAGMENTSHADERATIPROC)(GLuint id);
typedef GLvoid (APIENTRY *NEL_PFNGLDELETEFRAGMENTSHADERATIPROC)(GLuint id);
typedef GLvoid (APIENTRY *NEL_PFNGLBEGINFRAGMENTSHADERATIPROC)();
typedef GLvoid (APIENTRY *NEL_PFNGLENDFRAGMENTSHADERATIPROC)();
typedef GLvoid (APIENTRY *NEL_PFNGLPASSTEXCOORDATIPROC)(GLuint dst, GLuint coord, GLenum swizzle);
typedef GLvoid (APIENTRY *NEL_PFNGLSAMPLEMAPATIPROC)(GLuint dst, GLuint interp, GLenum swizzle);
typedef GLvoid (APIENTRY *NEL_PFNGLCOLORFRAGMENTOP1ATIPROC)(GLenum op, GLuint dst, GLuint dstMask,
GLuint dstMod, GLuint arg1, GLuint arg1Rep,
GLuint arg1Mod);
typedef GLvoid (APIENTRY *NEL_PFNGLCOLORFRAGMENTOP2ATIPROC)(GLenum op, GLuint dst, GLuint dstMask,
GLuint dstMod, GLuint arg1, GLuint arg1Rep,
GLuint arg1Mod, GLuint arg2, GLuint arg2Rep,
GLuint arg2Mod);
typedef GLvoid (APIENTRY *NEL_PFNGLCOLORFRAGMENTOP3ATIPROC)(GLenum op, GLuint dst, GLuint dstMask,
GLuint dstMod, GLuint arg1, GLuint arg1Rep,
GLuint arg1Mod, GLuint arg2, GLuint arg2Rep,
GLuint arg2Mod, GLuint arg3, GLuint arg3Rep,
GLuint arg3Mod);
typedef GLvoid (APIENTRY *NEL_PFNGLALPHAFRAGMENTOP1ATIPROC)(GLenum op, GLuint dst, GLuint dstMod,
GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
typedef GLvoid (APIENTRY *NEL_PFNGLALPHAFRAGMENTOP2ATIPROC)(GLenum op, GLuint dst, GLuint dstMod,
GLuint arg1, GLuint arg1Rep, GLuint arg1Mod,
GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
typedef GLvoid (APIENTRY *NEL_PFNGLALPHAFRAGMENTOP3ATIPROC)(GLenum op, GLuint dst, GLuint dstMod,
GLuint arg1, GLuint arg1Rep, GLuint arg1Mod,
GLuint arg2, GLuint arg2Rep, GLuint arg2Mod,
GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
typedef GLvoid (APIENTRY *NEL_PFNGLSETFRAGMENTSHADERCONSTANTATIPROC)(GLuint dst, const GLfloat *value);
// GL_ATI_map_object_buffer
//==================================
typedef void *(APIENTRY * NEL_PFNGLMAPOBJECTBUFFERATIPROC)(GLuint buffer);
typedef void (APIENTRY * NEL_PFNGLUNMAPOBJECTBUFFERATIPROC)(GLuint buffer);
// GL_ATI_vertex_attrib_array_object
//==================================
typedef GLvoid (APIENTRY * NEL_PFNGLVERTEXATTRIBARRAYOBJECTATIPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);
typedef GLvoid (APIENTRY * NEL_PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC)(GLuint index, GLenum pname, GLfloat *params);
typedef GLvoid (APIENTRY * NEL_PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC)(GLuint index, GLenum pname, GLint *params);
// GL_ARB_fragment_program
//==================================
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMSTRINGARBPROC)(GLenum target, GLenum format, GLsizei len,const GLvoid *string);
typedef GLvoid (APIENTRY *NEL_PFNGLBINDPROGRAMARBPROC)(GLenum target, GLuint program);
typedef GLvoid (APIENTRY *NEL_PFNGLDELETEPROGRAMSARBPROC)(GLsizei n, const GLuint *programs);
typedef GLvoid (APIENTRY *NEL_PFNGLGENPROGRAMSARBPROC)(GLsizei n, GLuint *programs);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMENVPARAMETER4DARBPROC)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMENVPARAMETER4DVARBPROC)(GLenum target, GLuint index, const GLdouble *params);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMENVPARAMETER4FARBPROC)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMENVPARAMETER4FVARBPROC)(GLenum target, GLuint index, const GLfloat *params);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMLOCALPARAMETER4DARBPROC)(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMLOCALPARAMETER4DVARBPROC)(GLenum target, GLuint index, const GLdouble *params);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMLOCALPARAMETER4FARBPROC)(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef GLvoid (APIENTRY *NEL_PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)(GLenum target, GLuint index, const GLfloat *params);
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMENVPARAMETERDVARBPROC)(GLenum target, GLuint index, GLdouble *params);
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMENVPARAMETERFVARBPROC)(GLenum target, GLuint index, GLfloat *params);
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC)(GLenum target, GLuint index, GLdouble *params);
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC)(GLenum target, GLuint index, GLfloat *params);
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMIVARBPROC)(GLenum target, GLenum pname, int *params);
typedef GLvoid (APIENTRY *NEL_PFNGLGETPROGRAMSTRINGARBPROC)(GLenum target, GLenum pname, GLvoid *string);
typedef GLboolean (APIENTRY *NEL_PFNGLISPROGRAMARBPROC)(GLuint program);
typedef GLboolean (APIENTRY * NEL_PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
typedef GLboolean (APIENTRY * NEL_PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);
typedef GLenum (APIENTRY * NEL_PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum pname);
typedef GLvoid (APIENTRY * NEL_PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers);
typedef GLvoid (APIENTRY * NEL_PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);
typedef GLvoid (APIENTRY * NEL_PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
typedef GLvoid (APIENTRY * NEL_PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers);
typedef GLvoid (APIENTRY * NEL_PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
typedef GLvoid (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
typedef GLvoid (APIENTRY * NEL_PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef GLvoid (APIENTRY * NEL_PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
typedef GLvoid (APIENTRY * NEL_PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers);
typedef GLvoid (APIENTRY * NEL_PFNGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
typedef GLvoid (APIENTRY * NEL_PFNGENERATEMIPMAPEXTPROC) (GLenum target);
typedef GLvoid (APIENTRY * NEL_PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef GLvoid (APIENTRY * NEL_PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
#ifndef NL_GL_NV_occlusion_query
#define NL_GL_NV_occlusion_query 1
typedef GLvoid (APIENTRY * NEL_PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids);
typedef GLvoid (APIENTRY * NEL_PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids);
typedef GLboolean (APIENTRY * NEL_PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id);
typedef GLvoid (APIENTRY * NEL_PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id);
typedef GLvoid (APIENTRY * NEL_PFNGLENDOCCLUSIONQUERYNVPROC) ();
typedef GLvoid (APIENTRY * NEL_PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params);
typedef GLvoid (APIENTRY * NEL_PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params);
#endif /* GL_NV_occlusion_query */
#ifndef NL_GL_ARB_multisample
#define NL_GL_ARB_multisample 1
typedef GLvoid (APIENTRY * NEL_PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert);
#endif
#if defined(NL_OS_MAC)
// Mac GL extensions
@ -433,18 +57,6 @@ typedef GLvoid (APIENTRY * NEL_PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, G
#elif defined(NL_OS_UNIX)
// GLX extensions
#ifndef NL_GLX_EXT_swap_control
#define NL_GLX_EXT_swap_control 1
#ifndef GLX_EXT_swap_control
#define GLX_SWAP_INTERVAL_EXT 0x20F1
#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
#endif
typedef GLint (APIENTRY * NEL_PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, GLint interval);
#endif // NL_GLX_EXT_swap_control
#ifndef NL_GLX_MESA_swap_control
#define NL_GLX_MESA_swap_control 1

View file

@ -283,14 +283,15 @@ void CDriverGL::setTextureShaders(const uint8 *addressingModes, const CSmartPtr<
bool CDriverGL::setupMaterial(CMaterial& mat)
{
H_AUTO_OGL(CDriverGL_setupMaterial)
CShaderGL* pShader;
GLenum glenum = GL_ZERO;
uint32 touched = mat.getTouched();
uint stage;
// profile.
_NbSetupMaterialCall++;
CMaterial::TShader matShader;
CShaderGL* pShader;
GLenum glenum = GL_ZERO;
uint32 touched = mat.getTouched();
// 0. Retrieve/Create driver shader.
//==================================
@ -359,9 +360,29 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
mat.clearTouched(0xFFFFFFFF);
}
// Now we can get the supported shader from the cache.
CMaterial::TShader matShader = pShader->SupportedShader;
// 2b. User supplied pixel shader overrides material
//==================================
/*if (_VertexProgramEnabled)
{
if (!setUniformDriver(VertexProgram)) return false;
if (!setUniformMaterialInternal(VertexProgram, mat)) return false;
}*/
if (_PixelProgramEnabled)
{
matShader = CMaterial::Program;
// if (!setUniformDriver(PixelProgram)) return false;
// if (!setUniformMaterialInternal(PixelProgram, mat)) return false;
if (!_LastSetuppedPP) return false;
}
else
{
// Now we can get the supported shader from the cache.
matShader = pShader->SupportedShader;
}
// 2b. Update more shader state
//==================================
// if the shader has changed since last time
if(matShader != _CurrentMaterialSupportedShader)
{
@ -382,9 +403,11 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
// Must setup textures each frame. (need to test if touched).
// Must separate texture setup and texture activation in 2 "for"...
// because setupTexture() may disable all stage.
if (matShader != CMaterial::Water)
if (matShader != CMaterial::Water
&& ((matShader != CMaterial::Program) || (_LastSetuppedPP->features().MaterialFlags & CProgramFeatures::TextureStages))
)
{
for(stage=0 ; stage<inlGetNumTextStages() ; stage++)
for (uint stage = 0; stage < inlGetNumTextStages(); ++stage)
{
ITexture *text= mat.getTexture(uint8(stage));
if (text != NULL && !setupTexture(*text))
@ -394,7 +417,7 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
// Here, for Lightmap materials, setup the lightmaps.
if(matShader == CMaterial::LightMap)
{
for(stage = 0; stage < mat._LightMaps.size(); stage++)
for (uint stage = 0; stage < mat._LightMaps.size(); ++stage)
{
ITexture *text = mat._LightMaps[stage].Texture;
if (text != NULL && !setupTexture(*text))
@ -418,9 +441,10 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
&& matShader != CMaterial::Cloud
&& matShader != CMaterial::Water
&& matShader != CMaterial::Specular
&& ((matShader != CMaterial::Program) || (_LastSetuppedPP->features().MaterialFlags & CProgramFeatures::TextureStages))
)
{
for(stage=0 ; stage<inlGetNumTextStages() ; stage++)
for(uint stage=0 ; stage<inlGetNumTextStages() ; stage++)
{
ITexture *text= mat.getTexture(uint8(stage));
@ -548,11 +572,13 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
resetLightMapVertexSetup();
// Textures user matrix
if (matShader == CMaterial::Normal)
if (matShader == CMaterial::Normal
|| ((matShader == CMaterial::Program) && (_LastSetuppedPP->features().MaterialFlags & CProgramFeatures::TextureMatrices))
)
{
setupUserTextureMatrix(inlGetNumTextStages(), mat);
}
else // deactivate texture matrix
else
{
disableUserTextureMatrix();
}
@ -1476,7 +1502,7 @@ CTextureCube *CDriverGL::getSpecularCubeMap(uint exp)
{
1.f, 4.f, 8.f, 24.f, 48.f, 128.f, 256.f, 511.f
};
const uint numCubeMap = sizeof(expToCubeMap) / sizeof(float);
const uint numCubeMap = sizeof(cubeMapExp) / sizeof(float);
static bool tableBuilt = false;
if (!tableBuilt)

View file

@ -0,0 +1,251 @@
/** \file driver_opengl_pixel_program.cpp
* OpenGL driver implementation for pixel program manipulation.
*
* $Id: driver_opengl_pixel_program.cpp,v 1.1.2.4 2007/07/09 15:29:00 legallo Exp $
*
* \todo manage better the init/release system (if a throw occurs in the init, we must release correctly the driver)
*/
/* Copyright, 2000 Nevrax Ltd.
*
* This file is part of NEVRAX NEL.
* NEVRAX NEL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* NEVRAX NEL is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with NEVRAX NEL; see the file COPYING. If not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
#include "stdopengl.h"
#include "driver_opengl.h"
#include "nel/3d/index_buffer.h"
#include "nel/3d/pixel_program.h"
#include <algorithm>
// tmp
#include "nel/misc/file.h"
using namespace std;
using namespace NLMISC;
namespace NL3D
{
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
// ***************************************************************************
CPixelProgamDrvInfosGL::CPixelProgamDrvInfosGL (CDriverGL *drv, ItGPUPrgDrvInfoPtrList it) : IProgramDrvInfos (drv, it)
{
H_AUTO_OGL(CPixelProgamDrvInfosGL_CPixelProgamDrvInfosGL)
#ifndef USE_OPENGLES
// Extension must exist
nlassert(drv->_Extensions.ARBFragmentProgram);
if (drv->_Extensions.ARBFragmentProgram) // ARB implementation
{
nglGenProgramsARB(1, &ID);
}
#endif
}
// ***************************************************************************
bool CDriverGL::supportPixelProgram(CPixelProgram::TProfile profile) const
{
H_AUTO_OGL(CPixelProgamDrvInfosGL_supportPixelProgram_profile)
switch (profile)
{
case CPixelProgram::arbfp1:
return _Extensions.ARBFragmentProgram;
case CPixelProgram::fp40:
return _Extensions.NVFragmentProgram2;
}
return false;
}
// ***************************************************************************
bool CDriverGL::activePixelProgram(CPixelProgram *program)
{
H_AUTO_OGL(CDriverGL_activePixelProgram)
if (_Extensions.ARBFragmentProgram)
{
return activeARBPixelProgram(program);
}
return false;
}
// ***************************************************************************
bool CDriverGL::compilePixelProgram(NL3D::CPixelProgram *program)
{
#ifndef USE_OPENGLES
// Program setuped ?
if (program->m_DrvInfo == NULL)
{
glDisable(GL_FRAGMENT_PROGRAM_ARB);
_PixelProgramEnabled = false;
// Insert into driver list. (so it is deleted when driver is deleted).
ItGPUPrgDrvInfoPtrList it = _GPUPrgDrvInfos.insert(_GPUPrgDrvInfos.end(), (NL3D::IProgramDrvInfos*)NULL);
// Create a driver info
CPixelProgamDrvInfosGL *drvInfo;
*it = drvInfo = new CPixelProgamDrvInfosGL(this, it);
// Set the pointer
program->m_DrvInfo = drvInfo;
if (!setupPixelProgram(program, drvInfo->ID))
{
delete drvInfo;
program->m_DrvInfo = NULL;
_GPUPrgDrvInfos.erase(it);
return false;
}
}
return true;
#else
return false;
#endif
}
// ***************************************************************************
bool CDriverGL::activeARBPixelProgram(CPixelProgram *program)
{
H_AUTO_OGL(CDriverGL_activeARBPixelProgram)
#ifndef USE_OPENGLES
// Setup or unsetup ?
if (program)
{
// Program setuped ?
if (!CDriverGL::compilePixelProgram(program)) return false;
// Cast the driver info pointer
CPixelProgamDrvInfosGL *drvInfo = safe_cast<CPixelProgamDrvInfosGL*>((IProgramDrvInfos*)program->m_DrvInfo);
glEnable(GL_FRAGMENT_PROGRAM_ARB);
_PixelProgramEnabled = true;
nglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, drvInfo->ID);
_LastSetuppedPP = program;
}
else
{
glDisable(GL_FRAGMENT_PROGRAM_ARB);
_PixelProgramEnabled = false;
}
return true;
#else
return false;
#endif
}
// ***************************************************************************
bool CDriverGL::setupPixelProgram(CPixelProgram *program, GLuint id/*, bool &specularWritten*/)
{
H_AUTO_OGL(CDriverGL_setupARBPixelProgram);
#ifndef USE_OPENGLES
CPixelProgamDrvInfosGL *drvInfo = static_cast<CPixelProgamDrvInfosGL *>((IProgramDrvInfos *)program->m_DrvInfo);
// Find a supported pixel program profile
IProgram::CSource *source = NULL;
for (uint i = 0; i < program->getSourceNb(); ++i)
{
if (supportPixelProgram(program->getSource(i)->Profile))
{
source = program->getSource(i);
}
}
if (!source)
{
nlwarning("No supported source profile for pixel program");
return false;
}
// Compile the program
nglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, id);
glGetError();
nglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, source->SourceLen, source->SourcePtr);
GLenum err = glGetError();
if (err != GL_NO_ERROR)
{
if (err == GL_INVALID_OPERATION)
{
GLint position;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &position);
nlassert(position != -1); // there was an error..
nlassert(position < (GLint) source->SourceLen);
uint line = 0;
const char *lineStart = source->SourcePtr;
for(uint k = 0; k < (uint) position; ++k)
{
if (source->SourcePtr[k] == '\n')
{
lineStart = source->SourcePtr + k;
++line;
}
}
nlwarning("ARB fragment program parse error at line %d.", (int) line);
// search end of line
const char *lineEnd = source->SourcePtr + source->SourceLen;
for(uint k = position; k < source->SourceLen; ++k)
{
if (source->SourcePtr[k] == '\n')
{
lineEnd = source->SourcePtr + k;
break;
}
}
nlwarning(std::string(lineStart, lineEnd).c_str());
// display the gl error msg
const GLubyte *errorMsg = glGetString(GL_PROGRAM_ERROR_STRING_ARB);
nlassert((const char *) errorMsg);
nlwarning((const char *) errorMsg);
}
nlassert(0);
return false;
}
// Set parameters for assembly programs
drvInfo->ParamIndices = source->ParamIndices;
// Build the feature info
program->buildInfo(source);
return true;
#else
return false;
#endif
}
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

View file

@ -79,6 +79,8 @@ CTextureDrvInfosGL::CTextureDrvInfosGL(IDriver *drv, ItTexDrvInfoPtrMap it, CDri
InitFBO = false;
AttachDepthStencil = true;
UsePackedDepthStencil = drvGl->supportPackedDepthStencil();
TextureUsedIdx = 0;
}
// ***************************************************************************
CTextureDrvInfosGL::~CTextureDrvInfosGL()
@ -91,7 +93,10 @@ CTextureDrvInfosGL::~CTextureDrvInfosGL()
_Driver->_AllocatedTextureMemory-= TextureMemory;
// release in TextureUsed.
_Driver->_TextureUsed.erase (this);
if (TextureUsedIdx < _Driver->_TextureUsed.size() && _Driver->_TextureUsed[TextureUsedIdx] == this)
{
_Driver->_TextureUsed[TextureUsedIdx] = NULL;
}
if(InitFBO)
{
@ -1492,7 +1497,11 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
if (_SumTextureMemoryUsed)
{
// Insert the pointer of this texture
_TextureUsed.insert (gltext);
if (gltext->TextureUsedIdx >= _TextureUsed.size() || _TextureUsed[gltext->TextureUsedIdx] != gltext)
{
gltext->TextureUsedIdx = _TextureUsed.size();
_TextureUsed.push_back(gltext);
}
}
if(tex->isTextureCube())
@ -2314,7 +2323,7 @@ bool CDriverGL::setRenderTarget (ITexture *tex, uint32 x, uint32 y, uint32 width
newVP.init(0, 0, ((float)width/(float)w), ((float)height/(float)h));
setupViewport(newVP);
_RenderTargetFBO = true;
_RenderTargetFBO = tex;
return activeFrameBufferObject(tex);
}
@ -2334,7 +2343,7 @@ bool CDriverGL::setRenderTarget (ITexture *tex, uint32 x, uint32 y, uint32 width
setupViewport(_OldViewport);
_OldViewport = _CurrViewport;
_RenderTargetFBO = false;
_RenderTargetFBO = NULL;
return false;
}
@ -2347,12 +2356,17 @@ bool CDriverGL::setRenderTarget (ITexture *tex, uint32 x, uint32 y, uint32 width
// Update the scissor
setupScissor (_CurrScissor);
_RenderTargetFBO = false;
_RenderTargetFBO = NULL;
_OldViewport = _CurrViewport;
return true;
}
ITexture *CDriverGL::getRenderTarget() const
{
return _RenderTargetFBO ? _RenderTargetFBO : _TextureTarget;
}
// ***************************************************************************
bool CDriverGL::copyTargetToTexture (ITexture *tex,

View file

@ -0,0 +1,509 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdopengl.h"
#include "driver_opengl.h"
using namespace std;
using namespace NLMISC;
namespace NL3D {
#ifdef NL_STATIC
#ifdef USE_OPENGLES
namespace NLDRIVERGLES {
#else
namespace NLDRIVERGL {
#endif
#endif
inline void CDriverGL::setUniform4fInl(TProgram program, uint index, float f0, float f1, float f2, float f3)
{
H_AUTO_OGL(CDriverGL_setUniform4f);
#ifndef USE_OPENGLES
switch (program)
{
case VertexProgram:
if (_Extensions.NVVertexProgram)
{
// Setup constant
nglProgramParameter4fNV(GL_VERTEX_PROGRAM_NV, index, f0, f1, f2, f3);
}
else if (_Extensions.ARBVertexProgram)
{
nglProgramEnvParameter4fARB(GL_VERTEX_PROGRAM_ARB, index, f0, f1, f2, f3);
}
else if (_Extensions.EXTVertexShader)
{
float datas[] = { f0, f1, f2, f3 };
nglSetInvariantEXT(_EVSConstantHandle + index, GL_FLOAT, datas);
}
break;
case PixelProgram:
if (_Extensions.ARBFragmentProgram)
{
nglProgramEnvParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, index, f0, f1, f2, f3);
}
break;
}
#endif
}
inline void CDriverGL::setUniform4fvInl(TProgram program, uint index, size_t num, const float *src)
{
H_AUTO_OGL(CDriverGL_setUniform4fv);
#ifndef USE_OPENGLES
switch (program)
{
case VertexProgram:
if (_Extensions.NVVertexProgram)
{
nglProgramParameters4fvNV(GL_VERTEX_PROGRAM_NV, index, num, src);
}
else if (_Extensions.ARBVertexProgram) // ARB pixel and geometry program will only exist when ARB vertex program exists
{
for (uint k = 0; k < num; ++k)
{
nglProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, index + k, src + 4 * k);
}
}
else if (_Extensions.EXTVertexShader)
{
for (uint k = 0; k < num; ++k)
{
nglSetInvariantEXT(_EVSConstantHandle + index + k, GL_FLOAT, (void *)(src + 4 * k));
}
}
break;
case PixelProgram:
if (_Extensions.ARBFragmentProgram) // ARB pixel and geometry program will only exist when ARB vertex program exists
{
for (uint k = 0; k < num; ++k)
{
nglProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, index + k, src + 4 * k);
}
}
break;
}
#endif
}
void CDriverGL::setUniform1f(TProgram program, uint index, float f0)
{
CDriverGL::setUniform4fInl(program, index, f0, 0.f, 0.f, 0.f);
}
void CDriverGL::setUniform2f(TProgram program, uint index, float f0, float f1)
{
CDriverGL::setUniform4fInl(program, index, f0, f1, 0.f, 0.f);
}
void CDriverGL::setUniform3f(TProgram program, uint index, float f0, float f1, float f2)
{
CDriverGL::setUniform4fInl(program, index, f0, f1, f2, 0.0f);
}
void CDriverGL::setUniform4f(TProgram program, uint index, float f0, float f1, float f2, float f3)
{
CDriverGL::setUniform4fInl(program, index, f0, f1, f2, f3);
}
void CDriverGL::setUniform1i(TProgram program, uint index, sint32 i0)
{
}
void CDriverGL::setUniform2i(TProgram program, uint index, sint32 i0, sint32 i1)
{
}
void CDriverGL::setUniform3i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2)
{
}
void CDriverGL::setUniform4i(TProgram program, uint index, sint32 i0, sint32 i1, sint32 i2, sint32 i3)
{
}
void CDriverGL::setUniform1ui(TProgram program, uint index, uint32 ui0)
{
}
void CDriverGL::setUniform2ui(TProgram program, uint index, uint32 ui0, uint32 ui1)
{
}
void CDriverGL::setUniform3ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2)
{
}
void CDriverGL::setUniform4ui(TProgram program, uint index, uint32 ui0, uint32 ui1, uint32 ui2, uint32 ui3)
{
}
void CDriverGL::setUniform3f(TProgram program, uint index, const NLMISC::CVector& v)
{
CDriverGL::setUniform4fInl(program, index, v.x, v.y, v.z, 0.f);
}
void CDriverGL::setUniform4f(TProgram program, uint index, const NLMISC::CVector& v, float f3)
{
CDriverGL::setUniform4fInl(program, index, v.x, v.y, v.z, f3);
}
void CDriverGL::setUniform4f(TProgram program, uint index, const NLMISC::CRGBAF& rgba)
{
CDriverGL::setUniform4fvInl(program, index, 1, &rgba.R);
}
void CDriverGL::setUniform4x4f(TProgram program, uint index, const NLMISC::CMatrix& m)
{
H_AUTO_OGL(CDriverGL_setUniform4x4f);
// TODO: Verify this!
NLMISC::CMatrix mat = m;
mat.transpose();
const float *md = mat.get();
CDriverGL::setUniform4fvInl(program, index, 4, md);
}
void CDriverGL::setUniform4fv(TProgram program, uint index, size_t num, const float *src)
{
CDriverGL::setUniform4fvInl(program, index, num, src);
}
void CDriverGL::setUniform4iv(TProgram program, uint index, size_t num, const sint32 *src)
{
}
void CDriverGL::setUniform4uiv(TProgram program, uint index, size_t num, const uint32 *src)
{
}
const uint CDriverGL::GLMatrix[IDriver::NumMatrix]=
{
GL_MODELVIEW,
GL_PROJECTION,
#ifdef USE_OPENGLES
GL_MODELVIEW
#else
GL_MODELVIEW_PROJECTION_NV
#endif
};
const uint CDriverGL::GLTransform[IDriver::NumTransform]=
{
#ifdef USE_OPENGLES
0,
0,
0,
0
#else
GL_IDENTITY_NV,
GL_INVERSE_NV,
GL_TRANSPOSE_NV,
GL_INVERSE_TRANSPOSE_NV
#endif
};
void CDriverGL::setUniformMatrix(NL3D::IDriver::TProgram program, uint index, NL3D::IDriver::TMatrix matrix, NL3D::IDriver::TTransform transform)
{
H_AUTO_OGL(CDriverGL_setUniformMatrix);
#ifndef USE_OPENGLES
// Vertex program exist ?
if (program == VertexProgram && _Extensions.NVVertexProgram)
{
// First, ensure that the render setup is correclty setuped.
refreshRenderSetup();
// Track the matrix
nglTrackMatrixNV(GL_VERTEX_PROGRAM_NV, index, GLMatrix[matrix], GLTransform[transform]);
// Release Track => matrix data is copied.
nglTrackMatrixNV(GL_VERTEX_PROGRAM_NV, index, GL_NONE, GL_IDENTITY_NV);
}
else
{
// First, ensure that the render setup is correctly setuped.
refreshRenderSetup();
CMatrix mat;
switch (matrix)
{
case IDriver::ModelView:
mat = _ModelViewMatrix;
break;
case IDriver::Projection:
{
refreshProjMatrixFromGL();
mat = _GLProjMat;
}
break;
case IDriver::ModelViewProjection:
refreshProjMatrixFromGL();
mat = _GLProjMat * _ModelViewMatrix;
break;
default:
break;
}
switch(transform)
{
case IDriver::Identity: break;
case IDriver::Inverse:
mat.invert();
break;
case IDriver::Transpose:
mat.transpose();
break;
case IDriver::InverseTranspose:
mat.invert();
mat.transpose();
break;
default:
break;
}
mat.transpose();
const float *md = mat.get();
CDriverGL::setUniform4fvInl(program, index, 4, md);
}
#endif
}
void CDriverGL::setUniformFog(NL3D::IDriver::TProgram program, uint index)
{
H_AUTO_OGL(CDriverGL_setUniformFog)
const float *values = _ModelViewMatrix.get();
CDriverGL::setUniform4fInl(program, index, -values[2], -values[6], -values[10], -values[14]);
}
/*
bool CDriverGL::setUniformDriver(TProgram program)
{
IProgram *prog = NULL;
switch (program)
{
case VertexProgram:
prog = _LastSetuppedVP;
break;
case PixelProgram:
prog = _LastSetuppedPP;
break;
}
if (!prog) return false;
const CProgramFeatures &features = prog->features();
if (features.DriverFlags)
{
if (features.DriverFlags & CProgramFeatures::Matrices)
{
if (prog->getUniformIndex(CProgramIndex::ModelView) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelView), ModelView, Identity);
}
if (prog->getUniformIndex(CProgramIndex::ModelViewInverse) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewInverse), ModelView, Inverse);
}
if (prog->getUniformIndex(CProgramIndex::ModelViewTranspose) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewTranspose), ModelView, Transpose);
}
if (prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose), ModelView, InverseTranspose);
}
if (prog->getUniformIndex(CProgramIndex::Projection) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::Projection), Projection, Identity);
}
if (prog->getUniformIndex(CProgramIndex::ProjectionInverse) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionInverse), Projection, Inverse);
}
if (prog->getUniformIndex(CProgramIndex::ProjectionTranspose) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionTranspose), Projection, Transpose);
}
if (prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose), Projection, InverseTranspose);
}
if (prog->getUniformIndex(CProgramIndex::ModelViewProjection) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjection), ModelViewProjection, Identity);
}
if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse), ModelViewProjection, Inverse);
}
if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose), ModelViewProjection, Transpose);
}
if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose) != ~0)
{
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose), ModelViewProjection, InverseTranspose);
}
}
if (features.DriverFlags & CProgramFeatures::Fog)
{
if (prog->getUniformIndex(CProgramIndex::Fog) != ~0)
{
setUniformFog(program, prog->getUniformIndex(CProgramIndex::Fog));
}
}
}
return true;
}
bool CDriverGL::setUniformMaterial(TProgram program, CMaterial &material)
{
IProgram *prog = NULL;
switch (program)
{
case VertexProgram:
prog = _LastSetuppedVP;
break;
case PixelProgram:
prog = _LastSetuppedPP;
break;
}
if (!prog) return false;
const CProgramFeatures &features = prog->features();
// These are also already set by setupMaterial, so setupMaterial uses setUniformMaterialInternal instead
if (features.MaterialFlags & (CProgramFeatures::TextureStages | CProgramFeatures::TextureMatrices))
{
if (features.MaterialFlags & CProgramFeatures::TextureStages)
{
for (uint stage = 0; stage < inlGetNumTextStages(); ++stage)
{
ITexture *text= material.getTexture(uint8(stage));
// Must setup textures each frame. (need to test if touched).
if (text != NULL && !setupTexture(*text))
return false;
// activate the texture, or disable texturing if NULL.
activateTexture(stage, text);
// If texture not NULL, Change texture env function.
setTextureEnvFunction(stage, material);
}
}
if (features.MaterialFlags & CProgramFeatures::TextureMatrices)
{
// Textures user matrix
setupUserTextureMatrix(inlGetNumTextStages(), material);
}
}
return true;
}
bool CDriverGL::setUniformMaterialInternal(TProgram program, CMaterial &material)
{
IProgram *prog = NULL;
switch (program)
{
case VertexProgram:
prog = _LastSetuppedVP;
break;
case PixelProgram:
prog = _LastSetuppedPP;
break;
}
if (!prog) return false;
const CProgramFeatures &features = prog->features();
if (features.MaterialFlags & ~(CProgramFeatures::TextureStages | CProgramFeatures::TextureMatrices))
{
// none
}
return true;
}
void CDriverGL::setUniformParams(TProgram program, CGPUProgramParams &params)
{
IProgram *prog = NULL;
switch (program)
{
case VertexProgram:
prog = _LastSetuppedVP;
break;
case PixelProgram:
prog = _LastSetuppedPP;
break;
}
if (!prog) return;
size_t offset = params.getBegin();
while (offset != params.getEnd())
{
uint size = params.getSizeByOffset(offset);
uint count = params.getCountByOffset(offset);
nlassert(size == 4 || count == 1); // only support float4 arrays
nlassert(params.getTypeByOffset(offset) == CGPUProgramParams::Float); // only support float
uint index = params.getIndexByOffset(offset);
if (index == ~0)
{
const std::string &name = params.getNameByOffset(offset);
nlassert(!name.empty()); // missing both parameter name and index, code error
uint index = prog->getUniformIndex(name.c_str());
nlassert(index != ~0); // invalid parameter name
params.map(index, name);
}
setUniform4fv(program, index, count, params.getPtrFByOffset(offset));
offset = params.getNext(offset);
}
}
*/
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif
} // NL3D

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