commit
f3b94d38d5
@ -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)
|
@ -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)
|
@ -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)
|
@ -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)
|
@ -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)
|
||||
|
@ -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})
|
@ -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)
|
@ -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)
|
File diff suppressed because it is too large
Load Diff
@ -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 */
|
@ -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 */
|
@ -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 */
|
@ -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 */
|
@ -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 */
|
@ -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 */
|
@ -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 */
|
@ -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 */
|
@ -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 */
|
@ -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 */
|
@ -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 */
|
@ -0,0 +1,3 @@
|
||||
FILE(GLOB HEADERS *.h)
|
||||
|
||||
INSTALL(FILES ${HEADERS} DESTINATION include/nel/gui COMPONENT headers)
|
@ -0,0 +1,156 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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_ACTION_HANDLER_H
|
||||
#define NL_ACTION_HANDLER_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include <libxml/parser.h>
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/debug.h"
|
||||
#include "nel/misc/xml_auto_ptr.h"
|
||||
#include <map>
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
class CCtrlBase;
|
||||
|
||||
|
||||
/**
|
||||
* interface for action handlers
|
||||
* \author Nicolas Brigand
|
||||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class IActionHandler
|
||||
{
|
||||
public:
|
||||
// Execute the answer to the action
|
||||
// Params has the following form : paramName=theParam|paramName2=theParam2|...
|
||||
virtual void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */) { }
|
||||
|
||||
virtual ~IActionHandler() {}
|
||||
|
||||
static std::string getParam (const std::string &Params, const std::string &ParamName);
|
||||
|
||||
static void getAllParams (const std::string &Params, std::vector< std::pair<std::string,std::string> > &AllParams);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
interface for action handlers factory
|
||||
no release in this factory : a handler must be destroyed by the control that created it
|
||||
*/
|
||||
class CAHManager
|
||||
{
|
||||
public:
|
||||
typedef std::map< std::string, IActionHandler* > TFactoryMap;
|
||||
typedef std::map< IActionHandler*, std::string > TNameMap;
|
||||
|
||||
static CAHManager* getInstance()
|
||||
{
|
||||
if (_GlobalInstance == NULL)
|
||||
_GlobalInstance = new CAHManager;
|
||||
return _GlobalInstance;
|
||||
}
|
||||
|
||||
/// return pointer to action handler or null if it doesn't exist
|
||||
IActionHandler *getActionHandler(const std::string &name) const
|
||||
{
|
||||
if( name.empty() )
|
||||
return NULL;
|
||||
|
||||
TFactoryMap::const_iterator it = FactoryMap.find(name);
|
||||
if( it == FactoryMap.end() )
|
||||
{
|
||||
nlwarning( "Couldn't find action handler %s", name.c_str() );
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
return it->second;
|
||||
}
|
||||
|
||||
/// Return the name of the action handler given its pointer
|
||||
const std::string &getActionHandlerName(IActionHandler *pAH) const
|
||||
{
|
||||
TNameMap::const_iterator it = NameMap.find(pAH);
|
||||
return it != NameMap.end() ? it->second : EmptyName;
|
||||
}
|
||||
|
||||
/// map of action handler factories
|
||||
TFactoryMap FactoryMap;
|
||||
TNameMap NameMap;
|
||||
std::string EmptyName;
|
||||
|
||||
/// return the Action Handler 'name'. if name is of form 'ah:params', then params are filled (NB: else not changed)
|
||||
IActionHandler *getAH(const std::string &name, std::string ¶ms);
|
||||
IActionHandler *getAH(const std::string &name, class CStringShared ¶ms);
|
||||
|
||||
/** common method to parse Action Handler from a xml node
|
||||
* \param ahId eg: "onclick_l"
|
||||
* \param paramId eg: "params_l".
|
||||
* \param params returned parameters.
|
||||
* NB: if paramId is NULL, empty or does not exist in the xmlNode, then the optional param in ahId (eg: "show:phrase_book")
|
||||
* is taken
|
||||
* NB: if none of the optional param in ahId, or the specified param are filled/found, then params is not changed
|
||||
*/
|
||||
void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, std::string ¶ms);
|
||||
void parseAH(xmlNodePtr cur, const char *ahId, const char *paramId, IActionHandler *&ahRet, class CStringShared ¶ms);
|
||||
|
||||
/// Get the AH name from ptr
|
||||
const std::string &getAHName(IActionHandler *pAH){ return getActionHandlerName(pAH); }
|
||||
|
||||
void runActionHandler(const std::string &AHName, CCtrlBase *pCaller, const std::string &Params=std::string("") );
|
||||
void runActionHandler(IActionHandler *ah, CCtrlBase *pCaller, const std::string &Params=std::string("") );
|
||||
|
||||
// Submit a generic event
|
||||
void submitEvent( const std::string &evt );
|
||||
static void setEditorMode( bool b ){ editorMode = b; }
|
||||
|
||||
private:
|
||||
CAHManager(){}
|
||||
static CAHManager *_GlobalInstance;
|
||||
static bool editorMode;
|
||||
|
||||
};
|
||||
|
||||
/// Ah name must all be lower case
|
||||
#define REGISTER_ACTION_HANDLER(handler ,name) \
|
||||
class handler##Factory : public handler \
|
||||
{ \
|
||||
public: \
|
||||
handler##Factory () \
|
||||
{ \
|
||||
nlassert(name!=NULL); \
|
||||
const char *c= name; \
|
||||
while(*c!='\0') \
|
||||
{ \
|
||||
nlassert(islower(*c) || !isalpha(*c)); \
|
||||
c++; \
|
||||
} \
|
||||
CAHManager *pAHFM = CAHManager::getInstance(); \
|
||||
pAHFM->FactoryMap.insert(CAHManager::TFactoryMap::value_type(name,this)); \
|
||||
pAHFM->NameMap.insert(CAHManager::TNameMap::value_type(this,name)); \
|
||||
}; \
|
||||
}; \
|
||||
handler##Factory handler##FactoryInstance ; \
|
||||
\
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif //NL_ACTION_HANDLER_H
|
@ -0,0 +1,188 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 RZ_CTRL_BASE_H
|
||||
#define RZ_CTRL_BASE_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/view_base.h"
|
||||
#include "nel/gui/event_descriptor.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
class CCtrlBase : public CViewBase
|
||||
{
|
||||
public:
|
||||
|
||||
// Tooltip mode
|
||||
enum TToolTipParentType
|
||||
{
|
||||
TTMouse= 0, // The tooltip is displayed relatively to the mouse when it appears
|
||||
TTCtrl= 1, // The tooltip is displayed relatively to the ctrl it comes from when it apeears
|
||||
TTWindow= 2, // The tooltip is displayed relatively to the window where the control lies.
|
||||
TTSpecialWindow= 3, // The tooltip is displayed relatively to a special user window
|
||||
|
||||
NumToolTipParentRef
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
CCtrlBase(const TCtorParam ¶m) : CViewBase(param)
|
||||
{
|
||||
_ToolTipInstant= true;
|
||||
_ToolTipParent= TTCtrl;
|
||||
// see interface.txt for meaning of auto
|
||||
_ToolTipParentPosRef= Hotspot_TTAuto;
|
||||
_ToolTipPosRef= Hotspot_TTAuto;
|
||||
resizer = false;
|
||||
}
|
||||
|
||||
/// Destructor
|
||||
virtual ~CCtrlBase();
|
||||
|
||||
static std::string tooltipParentToString( TToolTipParentType type );
|
||||
static TToolTipParentType stringToToolTipParent( const std::string &str );
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
|
||||
void setProperty( const std::string &name, const std::string &value );
|
||||
|
||||
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
||||
|
||||
// special parse
|
||||
virtual bool parse(xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||
|
||||
bool handleEvent (const NLGUI::CEventDescriptor &event);
|
||||
|
||||
virtual CCtrlBase *getSubCtrl (sint32 /* x */, sint32 /* y */) { return this; }
|
||||
|
||||
/// Debug
|
||||
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
|
||||
|
||||
|
||||
/// Get the ContextHelp for this control. Default is to return _ContextHelp
|
||||
virtual void getContextHelp(ucstring &help) const {help= _ContextHelp;}
|
||||
/// Get the ContextHelp for this control, with tooltip specific code. Default behaviour is identical to getContextHelp.
|
||||
virtual void getContextHelpToolTip(ucstring &help) const { getContextHelp(help); }
|
||||
// Get the name of the context help window. Default to "context_help"
|
||||
virtual std::string getContextHelpWindowName() const;
|
||||
/// Get the ContextHelp ActionHandler. If "", noop
|
||||
const std::string &getContextHelpActionHandler() const {return _OnContextHelp;}
|
||||
/// Get the ContextHelp ActionHandler Params
|
||||
const std::string &getContextHelpAHParams() const {return _OnContextHelpParams;}
|
||||
/// true if both are empty
|
||||
bool emptyContextHelp() const;
|
||||
// Should return true if the context help should be displayed instantly
|
||||
bool wantInstantContextHelp() const { return _ToolTipInstant; }
|
||||
/// Set true if ToolTip should be displayed instantly
|
||||
void setInstantContextHelp(bool instant) { _ToolTipInstant = instant;}
|
||||
|
||||
/** If ctrl has a non rectangle shape, perform further test to know
|
||||
* if control should be taken in account for context help
|
||||
*/
|
||||
virtual bool preciseHitTest(sint32 /* x */, sint32 /* y */) const { return true; }
|
||||
|
||||
|
||||
/// return the type of anchor for the tooltip of this control
|
||||
TToolTipParentType getToolTipParent() const { return _ToolTipParent;}
|
||||
const std::string &getToolTipSpecialParent() const {return _ToolTipSpecialParent.toString();}
|
||||
/// Set the type of anchor for the tooltip of this control
|
||||
void setToolTipParent(TToolTipParentType type) { _ToolTipParent = type; }
|
||||
void setToolTipSpecialParent(const std::string &parent) { _ToolTipSpecialParent = parent; }
|
||||
/// Get the ToolTip pos references (parent relevant only if getToolTipParent()!=TTMouse)
|
||||
THotSpot getToolTipParentPosRef() const { return _ToolTipParentPosRef;}
|
||||
THotSpot getToolTipPosRef() const { return _ToolTipPosRef;}
|
||||
THotSpot getToolTipParentPosRefAlt() const { return _ToolTipParentPosRefAlt;}
|
||||
THotSpot getToolTipPosRefAlt() const { return _ToolTipPosRefAlt;}
|
||||
/// Set the ToolTip pos references (parent relevant only if getToolTipParent()!=TTMouse)
|
||||
void setToolTipParentPosRef(THotSpot pos) { _ToolTipParentPosRef = pos;}
|
||||
void setToolTipPosRef(THotSpot pos) { _ToolTipPosRef = pos;}
|
||||
|
||||
/// replace the default contextHelp
|
||||
ucstring getDefaultContextHelp() const {return _ContextHelp;}
|
||||
void setDefaultContextHelp(const ucstring &help) {_ContextHelp= help;}
|
||||
void setOnContextHelp(const std::string &help) {_OnContextHelp= help;}
|
||||
void setOnContextHelpAHParams(const std::string &p) {_OnContextHelpParams= p;}
|
||||
|
||||
|
||||
|
||||
// called when this element or a son has been captured
|
||||
virtual void elementCaptured(CCtrlBase * /* capturedElement */) {}
|
||||
|
||||
virtual bool isCtrl() const { return true; }
|
||||
|
||||
// Made for CtrlResizer to take the precedence over son controls.
|
||||
virtual uint getDeltaDepth() const { return 0; }
|
||||
|
||||
// true if this ctrl is capturable (true by default, false for tooltip)
|
||||
virtual bool isCapturable() const {return true;}
|
||||
|
||||
bool isResizer() const{ return resizer; }
|
||||
|
||||
// from CInterfaceElement
|
||||
virtual void visit(CInterfaceElementVisitor *visitor);
|
||||
|
||||
/** test if virtual desktop change is possible while this element is captured by the mouse
|
||||
* Useful for resizers
|
||||
*/
|
||||
virtual bool canChangeVirtualDesktop() const { return true; }
|
||||
|
||||
// called when keyboard capture has been lost
|
||||
virtual void onKeyboardCaptureLost() {}
|
||||
|
||||
REFLECT_EXPORT_START(CCtrlBase, CViewBase)
|
||||
REFLECT_UCSTRING("tooltip", getDefaultContextHelp, setDefaultContextHelp);
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
// special for mouse over : return true and fill the name of the cursor to display
|
||||
virtual bool getMouseOverShape(std::string &/* texName */, uint8 &/* rot */, NLMISC::CRGBA &/* col */) { return false; }
|
||||
|
||||
virtual void serial(NLMISC::IStream &f);
|
||||
|
||||
uint32 getDepth( CInterfaceGroup *group );
|
||||
|
||||
protected:
|
||||
// This is the ContextHelp filled by default in parse()
|
||||
ucstring _ContextHelp;
|
||||
CStringShared _OnContextHelp;
|
||||
CStringShared _OnContextHelpParams;
|
||||
CStringShared _ToolTipSpecialParent;
|
||||
TToolTipParentType _ToolTipParent;
|
||||
bool _ToolTipInstant : 1;
|
||||
THotSpot _ToolTipParentPosRef : 6;
|
||||
THotSpot _ToolTipPosRef : 6;
|
||||
THotSpot _ToolTipParentPosRefAlt : 6;
|
||||
THotSpot _ToolTipPosRefAlt : 6;
|
||||
protected:
|
||||
void convertTooltipHotSpot(const char *prop, THotSpot &parentHS, THotSpot &childHS);
|
||||
static std::string TooltipHotSpotToString( THotSpot parent, THotSpot child );
|
||||
|
||||
void mapAHString( const std::string &key, const std::string &value );
|
||||
std::string getAHString( const std::string &key ) const;
|
||||
|
||||
static std::map< std::string, std::map< std::string, std::string > > AHCache;
|
||||
|
||||
bool resizer;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // RZ_VIEW_BASE_H
|
||||
|
||||
/* End of ctrl_base.h */
|
@ -0,0 +1,270 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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_CTRL_BASE_BUTTON_H
|
||||
#define NL_CTRL_BASE_BUTTON_H
|
||||
|
||||
#include "nel/gui/ctrl_base.h"
|
||||
#include "nel/gui/action_handler.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
// ***************************************************************************
|
||||
/**
|
||||
* Base Class For Buttons.
|
||||
* \author Lionel Berenguier
|
||||
* \author Nevrax France
|
||||
* \date 2003
|
||||
*/
|
||||
class CCtrlBaseButton : public CCtrlBase
|
||||
{
|
||||
|
||||
public:
|
||||
enum EType { PushButton = 0, ToggleButton, RadioButton, ButtonTypeCount };
|
||||
|
||||
/// Constructor
|
||||
CCtrlBaseButton(const TCtorParam ¶m);
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
void setProperty( const std::string &name, const std::string &value );
|
||||
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
||||
|
||||
virtual bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
||||
virtual bool handleEvent (const NLGUI::CEventDescriptor& event);
|
||||
|
||||
/// \name Misc
|
||||
// @{
|
||||
void setType (EType t) { _Type = t; }
|
||||
EType getType() { return _Type; }
|
||||
std::string getTypeString() const;
|
||||
void setTypeFromString( const std::string &type );
|
||||
|
||||
void setClickWhenPushed(bool click) { _ClickWhenPushed = click; }
|
||||
bool getClickWhenPushed() const { return _ClickWhenPushed; }
|
||||
|
||||
void setPushed (bool state);
|
||||
bool getPushed () const { return _Pushed; }
|
||||
|
||||
void setFrozen (bool state);
|
||||
bool getFrozen () const { return _Frozen; }
|
||||
|
||||
// Set half tone mode for the display of frozen buttons. Default is true.
|
||||
void setFrozenHalfTone(bool enabled);
|
||||
bool getFrozenHalfTone() const { return _FrozenHalfTone; }
|
||||
|
||||
// if the radio is a radio button, then all radio button are unselected
|
||||
void unselect();
|
||||
// @}
|
||||
|
||||
|
||||
/// \name Colors
|
||||
// @{
|
||||
void setColor(NLMISC::CRGBA col) { _ColorNormal = col; }
|
||||
void setColorPushed(NLMISC::CRGBA col) { _ColorPushed = col; }
|
||||
void setColorOver(NLMISC::CRGBA col) { _ColorOver = col; }
|
||||
|
||||
NLMISC::CRGBA getColor() const { return _ColorNormal; }
|
||||
NLMISC::CRGBA getColorPushed() const { return _ColorPushed; }
|
||||
NLMISC::CRGBA getColorOver() const { return _ColorOver; }
|
||||
|
||||
// Override because mustupdate 3 states
|
||||
void setModulateGlobalColorAll(bool state);
|
||||
void setModulateGlobalColorNormal(bool state) {_ModulateGlobalColorNormal= state;}
|
||||
void setModulateGlobalColorPushed(bool state) {_ModulateGlobalColorPushed= state;}
|
||||
void setModulateGlobalColorOver(bool state) {_ModulateGlobalColorOver= state;}
|
||||
|
||||
virtual sint32 getAlpha() const { return _ColorNormal.A; }
|
||||
virtual void setAlpha (sint32 a) { _ColorOver.A = _ColorNormal.A = _ColorPushed.A = (uint8)a; }
|
||||
|
||||
std::string getColorAsString() const
|
||||
{ return NLMISC::toString(_ColorNormal.R) + " " + NLMISC::toString(_ColorNormal.G) + " " +
|
||||
NLMISC::toString(_ColorNormal.B) + " " + NLMISC::toString(_ColorNormal.A); }
|
||||
std::string getColorOverAsString() const
|
||||
{ return NLMISC::toString(_ColorOver.R) + " " + NLMISC::toString(_ColorOver.G) + " " +
|
||||
NLMISC::toString(_ColorOver.B) + " " + NLMISC::toString(_ColorOver.A); }
|
||||
std::string getColorPushedAsString() const
|
||||
{ return NLMISC::toString(_ColorPushed.R) + " " + NLMISC::toString(_ColorPushed.G) + " " +
|
||||
NLMISC::toString(_ColorPushed.B) + " " + NLMISC::toString(_ColorPushed.A); }
|
||||
|
||||
void setColorAsString(const std::string &col) { _ColorNormal = convertColor (col.c_str()); }
|
||||
void setColorOverAsString(const std::string &col) { _ColorOver = convertColor (col.c_str()); }
|
||||
void setColorPushedAsString(const std::string &col) { _ColorPushed = convertColor (col.c_str()); }
|
||||
// @}
|
||||
|
||||
///\name radio button specific
|
||||
//@{
|
||||
/** Initialize radio button reference
|
||||
* Advanced:
|
||||
* NB: must call initRBRef() for radio button if button is created without parse().
|
||||
* NB: setParent() must be called before (else assert)
|
||||
*/
|
||||
void initRBRef();
|
||||
//@}
|
||||
void initRBRefFromRadioButton(CCtrlBaseButton * pBut);
|
||||
|
||||
|
||||
/// \name Handlers
|
||||
// @{
|
||||
// Event part
|
||||
void setActionOnLeftClick (const std::string &actionHandlerName) { _AHOnLeftClickString = actionHandlerName; _AHOnLeftClick = CAHManager::getInstance()->getAH(actionHandlerName, _AHLeftClickParams); }
|
||||
void setActionOnLeftClickParams(const std::string ¶ms) { _AHOnLeftClickStringParams = params; }
|
||||
void setActionOnRightClick (const std::string &actionHandlerName) { _AHOnRightClick = CAHManager::getInstance()->getAH(actionHandlerName, _AHRightClickParams); }
|
||||
void setActionOnClockTick (const std::string &ahName) { _AHOnClockTick = CAHManager::getInstance()->getAH(ahName, _AHClockTickParams); }
|
||||
void setParamsOnLeftClick (const std::string ¶msHandlerName) { _AHLeftClickParams = paramsHandlerName; }
|
||||
void setParamsOnRightClick (const std::string ¶msHandlerName) { _AHRightClickParams = paramsHandlerName; }
|
||||
void setParamsOnClockTick (const std::string &ahParamsName) { _AHClockTickParams = ahParamsName; }
|
||||
|
||||
// get Event part
|
||||
std::string _getActionOnOver() const{ return CAHManager::getInstance()->getAHName( _AHOnOver ); }
|
||||
std::string _getActionOnLeftClick() const { return CAHManager::getInstance()->getAHName( _AHOnLeftClick ); }
|
||||
std::string _getActionOnLeftLongClick() const { return CAHManager::getInstance()->getAHName( _AHOnLeftLongClick ); }
|
||||
std::string _getActionOnDblLeftClick() const { return CAHManager::getInstance()->getAHName( _AHOnLeftDblClick ); }
|
||||
std::string _getActionOnRightClick() const { return CAHManager::getInstance()->getAHName( _AHOnRightClick ); }
|
||||
std::string _getActionOnClockTick() const { return CAHManager::getInstance()->getAHName( _AHOnClockTick ); }
|
||||
|
||||
IActionHandler *getActionOnLeftClick () const { return _AHOnLeftClick; }
|
||||
IActionHandler *getActionOnRightClick () const { return _AHOnRightClick; }
|
||||
IActionHandler *getActionOnClockTick () const { return _AHOnClockTick; }
|
||||
std::string _getParamsOnOver() const{ return _AHOverParams.toString(); }
|
||||
std::string _getParamsOnLeftClick () const { return _AHLeftClickParams.toString(); }
|
||||
const std::string &getParamsOnLeftClick () const { return _AHLeftClickParams; }
|
||||
const std::string &getParamsOnRightClick () const { return _AHRightClickParams; }
|
||||
const std::string &getParamsOnClockTick () const { return _AHClockTickParams; }
|
||||
|
||||
// run action on left click
|
||||
void runLeftClickAction();
|
||||
|
||||
// Context menu accessor/ One for each button
|
||||
void setListMenuLeft (const std::string &cm) { _ListMenuLeft = cm; }
|
||||
void setListMenuRight (const std::string &cm) { _ListMenuRight = cm; }
|
||||
void setListMenuBoth (const std::string &cm) { _ListMenuLeft= _ListMenuRight= cm; }
|
||||
std::string getListMenuLeft () { return _ListMenuLeft.toString(); }
|
||||
std::string getListMenuRight () { return _ListMenuRight.toString(); }
|
||||
// @}
|
||||
|
||||
|
||||
|
||||
int luaRunLeftClickAction(CLuaState &ls);
|
||||
REFLECT_EXPORT_START(CCtrlBaseButton, CCtrlBase)
|
||||
REFLECT_BOOL("pushed", getPushed, setPushed);
|
||||
REFLECT_STRING("col_normal", getColorAsString, setColorAsString);
|
||||
REFLECT_STRING("col_over", getColorOverAsString, setColorOverAsString);
|
||||
REFLECT_STRING("col_pushed", getColorPushedAsString, setColorPushedAsString);
|
||||
REFLECT_RGBA("col_normal_rgba", getColor, setColor);
|
||||
REFLECT_RGBA("col_over_rgba", getColorOver, setColorOver);
|
||||
REFLECT_RGBA("col_pushed_rgba", getColorPushed, setColorPushed);
|
||||
REFLECT_BOOL("frozen", getFrozen, setFrozen);
|
||||
REFLECT_BOOL("frozen_half_tone", getFrozenHalfTone, setFrozenHalfTone);
|
||||
REFLECT_STRING("onclick_l", _getActionOnLeftClick, setActionOnLeftClick);
|
||||
REFLECT_STRING("params_l", _getParamsOnLeftClick, setParamsOnLeftClick);
|
||||
REFLECT_LUA_METHOD("runLeftClickAction", luaRunLeftClickAction);
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
protected:
|
||||
EType _Type;
|
||||
|
||||
// State
|
||||
bool _Pushed : 1;
|
||||
bool _Over : 1;
|
||||
bool _OverWhenPushed : 1;
|
||||
bool _Frozen : 1;
|
||||
bool _FrozenHalfTone : 1;
|
||||
bool _ClickWhenPushed : 1;
|
||||
bool _ModulateGlobalColorNormal : 1;
|
||||
bool _ModulateGlobalColorPushed : 1;
|
||||
bool _ModulateGlobalColorOver : 1;
|
||||
bool _LeftLongClickHandled : 1; // Is it already handled ?
|
||||
bool _LeftDblClickHandled : 1;
|
||||
|
||||
|
||||
///\name radio button specific
|
||||
//@{
|
||||
CCtrlBaseButton *_RBRefBut; // The reference button. If NULL the control do not own the reference
|
||||
// There is only one radio button per group that own the reference (the first one)
|
||||
CCtrlBaseButton **_RBRef; // The pointer onto the reference button
|
||||
//@}
|
||||
|
||||
|
||||
// Colors
|
||||
NLMISC::CRGBA _ColorNormal;
|
||||
NLMISC::CRGBA _ColorPushed;
|
||||
NLMISC::CRGBA _ColorOver;
|
||||
|
||||
///\name Long click specific
|
||||
//@{
|
||||
sint64 _LeftLongClickDate; // Time we left click down
|
||||
//@}
|
||||
|
||||
// for double click : last date at which last left click occurred
|
||||
static sint64 _LastLeftClickDate;
|
||||
static NLMISC::CRefPtr<CCtrlBaseButton> _LastLeftClickButton;
|
||||
|
||||
///\name Action Handler
|
||||
//@{
|
||||
IActionHandler *_AHOnOver;
|
||||
CStringShared _AHOverParams;
|
||||
std::string _AHOnLeftClickString;
|
||||
std::string _AHOnLeftClickStringParams;
|
||||
IActionHandler *_AHOnLeftClick;
|
||||
CStringShared _AHLeftClickParams;
|
||||
IActionHandler *_AHOnLeftDblClick;
|
||||
CStringShared _AHLeftDblClickParams;
|
||||
IActionHandler *_AHOnRightClick;
|
||||
CStringShared _AHRightClickParams;
|
||||
IActionHandler *_AHOnClockTick;
|
||||
CStringShared _AHClockTickParams;
|
||||
IActionHandler *_AHOnLeftLongClick;
|
||||
CStringShared _AHLeftLongClickParams;
|
||||
//@}
|
||||
CStringShared _ListMenuLeft;
|
||||
CStringShared _ListMenuRight;
|
||||
|
||||
// get the colors modulated on request
|
||||
NLMISC::CRGBA getCurrentColorNormal(NLMISC::CRGBA globalColor) const
|
||||
{
|
||||
NLMISC::CRGBA rgba = _ColorNormal;
|
||||
if(_ModulateGlobalColorNormal)
|
||||
rgba.modulateFromColor(rgba, globalColor);
|
||||
return rgba;
|
||||
}
|
||||
NLMISC::CRGBA getCurrentColorPushed(NLMISC::CRGBA globalColor) const
|
||||
{
|
||||
NLMISC::CRGBA rgba = _ColorPushed;
|
||||
if(_ModulateGlobalColorPushed)
|
||||
rgba.modulateFromColor(rgba, globalColor);
|
||||
return rgba;
|
||||
}
|
||||
NLMISC::CRGBA getCurrentColorOver(NLMISC::CRGBA globalColor) const
|
||||
{
|
||||
NLMISC::CRGBA rgba = _ColorOver;
|
||||
if(_ModulateGlobalColorOver)
|
||||
rgba.modulateFromColor(rgba, globalColor);
|
||||
return rgba;
|
||||
}
|
||||
|
||||
// call it at draw
|
||||
void updateOver(bool &lastOver);
|
||||
virtual void elementCaptured(CCtrlBase *capturedElement);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NL_CTRL_BASE_BUTTON_H
|
||||
|
||||
/* End of ctrl_base_button.h */
|
@ -0,0 +1,109 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 RZ_CTRL_BUTTON_H
|
||||
#define RZ_CTRL_BUTTON_H
|
||||
|
||||
#include "nel/gui/ctrl_base_button.h"
|
||||
#include "nel/gui/view_renderer.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
class CEventDescriptor;
|
||||
|
||||
/**
|
||||
* <Class description>
|
||||
* \author Nicolas Brigand
|
||||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class CCtrlButton : public CCtrlBaseButton
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS( CCtrlButton )
|
||||
|
||||
/// Constructor
|
||||
CCtrlButton(const TCtorParam ¶m) : CCtrlBaseButton(param)
|
||||
{
|
||||
_Scale = false;
|
||||
_Align = 0;
|
||||
}
|
||||
|
||||
void setAlignFromString( const std::string &s );
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
void setProperty( const std::string &name, const std::string &value );
|
||||
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
||||
|
||||
// Init part
|
||||
virtual bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
||||
|
||||
virtual void updateCoords();
|
||||
|
||||
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
|
||||
|
||||
virtual bool getMouseOverShape(std::string &/* texName */, uint8 &/* rot */, NLMISC::CRGBA &/* col */);
|
||||
|
||||
// Display part
|
||||
virtual void draw();
|
||||
|
||||
void setTexture (const std::string&name);
|
||||
void setTexturePushed (const std::string&name);
|
||||
void setTextureOver (const std::string&name);
|
||||
|
||||
void fitTexture();
|
||||
|
||||
std::string getTexture () const;
|
||||
std::string getTexturePushed () const;
|
||||
std::string getTextureOver() const;
|
||||
|
||||
bool isTextureValid() const { return _TextureIdNormal != -1; }
|
||||
|
||||
// test if the texture must scale
|
||||
bool getScale() const { return _Scale; }
|
||||
void setScale(bool scale) { _Scale = scale; }
|
||||
|
||||
|
||||
/// \from CInterfaceElement
|
||||
sint32 getMaxUsedW() const;
|
||||
sint32 getMinUsedW() const;
|
||||
|
||||
REFLECT_EXPORT_START(CCtrlButton, CCtrlBaseButton)
|
||||
REFLECT_STRING("texture", getTexture, setTexture);
|
||||
REFLECT_STRING("texture_pushed", getTexturePushed, setTexturePushed);
|
||||
REFLECT_STRING("texture_over", getTextureOver, setTextureOver);
|
||||
REFLECT_BOOL("scale", getScale, setScale);
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
protected:
|
||||
|
||||
CViewRenderer::CTextureId _TextureIdNormal;
|
||||
CViewRenderer::CTextureId _TextureIdPushed;
|
||||
CViewRenderer::CTextureId _TextureIdOver;
|
||||
|
||||
private:
|
||||
|
||||
bool _Scale;
|
||||
sint32 _Align; /// 1st bit - Left/Right (0/1) 2nd bit - Bottom/Top (0/1)
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // RZ_CTRL_BUTTON_H
|
||||
|
||||
/* End of ctrl_button.h */
|
@ -0,0 +1,111 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 RZ_CTRL_COL_PICK_H
|
||||
#define RZ_CTRL_COL_PICK_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/ctrl_base.h"
|
||||
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
/**
|
||||
* Class handling a Color Picker
|
||||
* \author Matthieu 'TrapII' Besson
|
||||
* \author Nevrax France
|
||||
* \date 2003
|
||||
*/
|
||||
class CCtrlColPick : public CCtrlBase
|
||||
{
|
||||
|
||||
public:
|
||||
DECLARE_UI_CLASS( CCtrlColPick )
|
||||
|
||||
CCtrlColPick(const TCtorParam ¶m);
|
||||
~CCtrlColPick();
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
void setProperty( const std::string &name, const std::string &value );
|
||||
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
||||
|
||||
virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup);
|
||||
|
||||
virtual void updateCoords();
|
||||
virtual void draw();
|
||||
virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
|
||||
|
||||
sint32 getColorR () const { return _ColorSelect.R; }
|
||||
sint32 getColorG () const { return _ColorSelect.G; }
|
||||
sint32 getColorB () const { return _ColorSelect.B; }
|
||||
sint32 getColorA () const { return _ColorSelect.A; }
|
||||
|
||||
void setColorR (sint32 r) { _ColorSelect.R = (uint8)r; }
|
||||
void setColorG (sint32 g) { _ColorSelect.G = (uint8)g; }
|
||||
void setColorB (sint32 b) { _ColorSelect.B = (uint8)b; }
|
||||
void setColorA (sint32 a) { _ColorSelect.A = (uint8)a; }
|
||||
|
||||
|
||||
std::string getColor () const; // Get Color Selected
|
||||
void setColor (const std::string &col); // Set Color Selected
|
||||
|
||||
std::string getColorOver () const; // Get Color Over
|
||||
void setColorOver (const std::string &col); // Set Color Over
|
||||
|
||||
REFLECT_EXPORT_START(CCtrlColPick, CCtrlBase)
|
||||
REFLECT_SINT32("r", getColorR, setColorR);
|
||||
REFLECT_SINT32("g", getColorG, setColorG);
|
||||
REFLECT_SINT32("b", getColorB, setColorB);
|
||||
REFLECT_SINT32("a", getColorA, setColorA);
|
||||
REFLECT_STRING("color", getColor, setColor);
|
||||
REFLECT_STRING("color_over", getColorOver, setColorOver);
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
void selectColor (sint32 x, sint32 y);
|
||||
NLMISC::CRGBA getColor (sint32 x, sint32 y);
|
||||
|
||||
protected:
|
||||
|
||||
bool _MouseDown;
|
||||
|
||||
sint32 _Texture;
|
||||
|
||||
NLMISC::CRGBA _ColorSelect; // Last Color selected
|
||||
NLMISC::CRGBA _ColorOver; // Color Under Mouse Pointer
|
||||
|
||||
std::string _AHOnChange;
|
||||
std::string _AHOnChangeParams;
|
||||
|
||||
CInterfaceProperty _ColSelR;
|
||||
CInterfaceProperty _ColSelG;
|
||||
CInterfaceProperty _ColSelB;
|
||||
CInterfaceProperty _ColSelA;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // RZ_CTRL_COL_PICK_H
|
||||
|
||||
/* End of ctrl_col_pick.h */
|
||||
|
||||
|
@ -0,0 +1,64 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 CTRL_DRAGGABLE_H
|
||||
#define CTRL_DRAGGABLE_H
|
||||
|
||||
#include "nel/gui/ctrl_base.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
class CCtrlDraggable : public CCtrlBase
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS( CCtrlDraggable )
|
||||
|
||||
CCtrlDraggable( const TCtorParam ¶m );
|
||||
virtual ~CCtrlDraggable(){};
|
||||
|
||||
static CCtrlDraggable *getDraggedSheet(){ return _LastDraggedSheet; }
|
||||
bool isDragged() const{ return dragged; }
|
||||
void setDragged( bool dragged ){ this->dragged = dragged; }
|
||||
bool isDraggable() const{ return draggable; }
|
||||
void setDraggable( bool draggable ){ this->draggable = draggable; }
|
||||
|
||||
void abortDragging()
|
||||
{
|
||||
dragged = false;
|
||||
_LastDraggedSheet = NULL;
|
||||
}
|
||||
|
||||
// Necessary because of reflection, no other purpose
|
||||
void draw(){}
|
||||
|
||||
REFLECT_EXPORT_START(CCtrlDraggable, CCtrlBase)
|
||||
REFLECT_BOOL("dragable", isDraggable, setDraggable);
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
protected:
|
||||
static void setDraggedSheet( CCtrlDraggable *draggable ){ _LastDraggedSheet = draggable; }
|
||||
|
||||
private:
|
||||
static CCtrlDraggable *_LastDraggedSheet;
|
||||
bool dragged;
|
||||
bool draggable;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,95 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 RZ_CTRL_POLYGON_H
|
||||
#define RZ_CTRL_POLYGON_H
|
||||
|
||||
#include "nel/gui/ctrl_base.h"
|
||||
#include "nel/gui/view_renderer.h"
|
||||
#include "nel/misc/geom_ext.h"
|
||||
#include "nel/misc/polygon.h"
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
class CVector2f;
|
||||
}
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
/** Display of an arbitrary polygon in the ui.
|
||||
* polygons are clipped & batched.
|
||||
*
|
||||
* Derives from CCtrlBase in order to provide button / tooltip capability
|
||||
*
|
||||
* \author Nicolas Vizerie
|
||||
* \author Nevrax France
|
||||
* \date 1/2006
|
||||
*/
|
||||
class CCtrlPolygon : public CCtrlBase
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS( CCtrlPolygon )
|
||||
CCtrlPolygon( const TCtorParam ¶m );
|
||||
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
|
||||
virtual void updateCoords();
|
||||
virtual void draw();
|
||||
/** Change the vertices. This is costly because concav / complex polys are split in a list of triangles
|
||||
*/
|
||||
void setVertices(const std::vector<NLMISC::CVector> &vertices);
|
||||
const std::vector<NLMISC::CVector> &getVertices() const { return _Poly.Vertices; }
|
||||
// test if current position in inside the current (transformed) poly (in window space)
|
||||
bool contains(const NLMISC::CVector2f &pos) const;
|
||||
// color
|
||||
void setColorRGBA(NLMISC::CRGBA col) { _Color = col; }
|
||||
NLMISC::CRGBA getColorRGBA() const { return _Color; }
|
||||
// from CViewBase
|
||||
virtual sint32 getAlpha() const { return (sint32) _Color.A; }
|
||||
virtual void setAlpha(sint32 a);
|
||||
/** Change the matrix for this poly. Changing the matrix is usually cheaper than changing
|
||||
* The vertices because complex poly do not have to be split again
|
||||
*/
|
||||
//void setMatrix(const NLMISC::CMatrix &mat);
|
||||
//const NLMISC::CMatrix &getMatrix() const { return _Matrix; }
|
||||
// test if last call to 'setVertices' was for a valid poly (e.g one that doesn't overlapp itself)
|
||||
bool isValid() const { return _Valid; }
|
||||
virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
|
||||
|
||||
// no capturable by default (just tooltip capability wanted)
|
||||
virtual bool isCapturable() const { return false; }
|
||||
private:
|
||||
NLMISC::CPolygon _Poly;
|
||||
NLMISC::CPolygon2D _XFormPoly;
|
||||
//NLMISC::CMatrix _Matrix;
|
||||
bool _Valid;
|
||||
bool _Touched;
|
||||
NLMISC::CRGBA _Color;
|
||||
std::vector<NLMISC::CTriangle> _Tris;
|
||||
std::vector<NLMISC::CTriangle> _RealTris; // clipped tris in screen coordinates
|
||||
private:
|
||||
void updateBoudingRect();
|
||||
protected:
|
||||
// TMP TMP : have to solve matrix imprecision for display in map -> do the full computation for now ...
|
||||
virtual void computeScaledVertex(NLMISC::CVector2f &dest, const NLMISC::CVector2f &src);
|
||||
public:
|
||||
void touch();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,118 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 RZ_CTRL_QUAD_H
|
||||
#define RZ_CTRL_QUAD_H
|
||||
|
||||
#include "nel/gui/ctrl_base.h"
|
||||
#include "nel/gui/view_renderer.h"
|
||||
#include "nel/misc/geom_ext.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
/** Display of an arbitrary textured quad in the UI. The applied texture is filtered.
|
||||
* Unlike CViewBitmap, the texture is always scaled here, and this ui element coordinates
|
||||
* are driven by the quad vertices coordinates (see setQuad).
|
||||
*
|
||||
* Derives from CCtrlBase for tooltipping support
|
||||
*
|
||||
* \author Nicolas Vizerie
|
||||
* \author Nevrax France
|
||||
* \date 12/2005
|
||||
*/
|
||||
class CCtrlQuad : public CCtrlBase
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS( CCtrlQuad )
|
||||
|
||||
enum TWrapMode { Repeat = 0, Clamp, CustomUVs, WrapModeCount };
|
||||
|
||||
|
||||
CCtrlQuad( const TCtorParam ¶m );
|
||||
|
||||
// from CInterfaceElement
|
||||
bool parse(xmlNodePtr cur,CInterfaceGroup *parentGroup);
|
||||
virtual void updateCoords();
|
||||
virtual void draw();
|
||||
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
|
||||
|
||||
// from CViewBase
|
||||
virtual sint32 getAlpha() const { return (sint32) _Color.A; }
|
||||
virtual void setAlpha (sint32 a);
|
||||
|
||||
// texture
|
||||
void setTexture(const std::string &texName);
|
||||
std::string getTexture () const;
|
||||
|
||||
// color
|
||||
void setColorRGBA(NLMISC::CRGBA col) { _Color = col; }
|
||||
NLMISC::CRGBA getColorRGBA() const { return _Color; }
|
||||
|
||||
/** Set a new quad relative to parent pos
|
||||
* x,y, w, h & hotspot are updated to fit the bounding rect of the quad
|
||||
*/
|
||||
void setQuad(const NLMISC::CQuad &quad);
|
||||
void setQuad(const NLMISC::CVector &start, const NLMISC::CVector &end, float thickness);
|
||||
/** Fit the given texture size (no hotspot for now, always centered)
|
||||
* NB : current texture is not modified.
|
||||
*/
|
||||
void setQuad(const std::string &texName, const NLMISC::CVector &pos, float angle = 0.f, float offCenter = 0.f);
|
||||
void setQuad(const NLMISC::CVector &pos, float radius, float angle = 0.f);
|
||||
const NLMISC::CQuad &getQuad() const { return _Quad; }
|
||||
|
||||
void setAdditif(bool additif);
|
||||
bool getAdditif() const { return _Additif; }
|
||||
|
||||
void setFiltered(bool filtered);
|
||||
bool getFiltered() const { return _Filtered; }
|
||||
|
||||
void setPattern(float umin, float umax, TWrapMode wrapMode);
|
||||
|
||||
/** Set uvs for each corners -> this will change the wrap mode to CustomUVs
|
||||
* Use setPattern(0.f, 0.f, CCtrlQuad::Repeat) to return to previous behavior
|
||||
*/
|
||||
void setCustomUVs(const NLMISC::CUV uvs[4]);
|
||||
|
||||
|
||||
// from CCtrlBase, no op by default
|
||||
virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
|
||||
|
||||
// see if this control contains the given point (in parent coords)
|
||||
bool contains(const NLMISC::CVector2f &pos) const;
|
||||
|
||||
// no capturable by default (just tooltip capability wanted)
|
||||
virtual bool isCapturable() const { return false; }
|
||||
|
||||
|
||||
private:
|
||||
NLMISC::CRGBA _Color;
|
||||
NLMISC::CQuad _Quad;
|
||||
NLMISC::CQuadUV _RealQuad; // absolute coords
|
||||
float _ClampedUCorrection;
|
||||
CViewRenderer::CTextureId _TextureId; /// Accelerator
|
||||
bool _Additif;
|
||||
bool _Filtered;
|
||||
float _UMin;
|
||||
float _UMax;
|
||||
TWrapMode _WrapMode;
|
||||
NLMISC::CUV _CustomUVs[4];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,206 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 RZ_CTRL_SCROLL_H
|
||||
#define RZ_CTRL_SCROLL_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/ctrl_scroll_base.h"
|
||||
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
/**
|
||||
* Class handling scollbar function
|
||||
* \author Matthieu 'TrapII' Besson
|
||||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class CCtrlScroll : public CCtrlScrollBase, public NLMISC::ICDBNode::IPropertyObserver
|
||||
{
|
||||
|
||||
public:
|
||||
DECLARE_UI_CLASS( CCtrlScroll )
|
||||
CCtrlScroll(const TCtorParam ¶m);
|
||||
~CCtrlScroll();
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
void setProperty( const std::string &name, const std::string &value );
|
||||
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
||||
|
||||
virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup);
|
||||
|
||||
virtual void updateCoords();
|
||||
virtual void draw();
|
||||
virtual bool handleEvent (const NLGUI::CEventDescriptor &event);
|
||||
|
||||
void setTarget (CInterfaceGroup *pIG);
|
||||
// Return the delta value the track has moved
|
||||
sint32 moveTrackX (sint32 dx);
|
||||
sint32 moveTrackY (sint32 dy);
|
||||
|
||||
/** Move the Target Ofs with a Delta, and recompute TrackPos from this Ofs.
|
||||
* Useful for finer controled group scrolling when the list is very big (with mouseWheel or scroll buttons)
|
||||
*/
|
||||
void moveTargetX (sint32 dx);
|
||||
void moveTargetY (sint32 dy);
|
||||
|
||||
void setAlign (sint32 nAlign) { _Aligned = nAlign; }
|
||||
// invert the factor for target
|
||||
void setInverted(bool invert) { _Inverted = invert; }
|
||||
|
||||
void setTextureBottomOrLeft (const std::string &txName);
|
||||
void setTextureMiddle (const std::string &txName);
|
||||
void setTextureTopOrRight (const std::string &txName);
|
||||
std::string getTextureBottomOrLeft() const;
|
||||
std::string getTextureMiddle() const;
|
||||
std::string getTextureTopOrRight() const;
|
||||
|
||||
void setTextureBottomOrLeft (sint32 txid) { _TxIdB = txid; }
|
||||
void setTextureMiddle (sint32 txid) { _TxIdM = txid; }
|
||||
void setTextureMiddleTile (uint8 tile) { _TileM = tile; } // 0 - not tiled (1 BL) (2 BR) (3 TL) (4 TR)
|
||||
void setTextureTopOrRight (sint32 txid) { _TxIdT = txid; }
|
||||
|
||||
// number scroller
|
||||
sint32 getValue() const { return _IsDBLink ? _DBLink.getSInt32() : _Value; }
|
||||
// NB: the value is clamped (see setMinMax) and stepped (see setStepValue())
|
||||
void setValue(sint32 value);
|
||||
void setMinMax(sint32 nMin, sint32 nMax) { _Min = nMin; _Max = nMax; }
|
||||
void setStepValue(uint32 step) { _StepValue= step; }
|
||||
|
||||
void setTrackPos(sint32 pos);
|
||||
sint32 getTrackPos() const { return _TrackPos; }
|
||||
sint32 getTrackSize() const { return _TrackSize; }
|
||||
// dummy set for track size (forlua export)
|
||||
void setTrackSize(sint32 /* trackSize */) { throw NLMISC::Exception("TrackSize is read-only"); }
|
||||
|
||||
|
||||
void setFrozen (bool state);
|
||||
bool getFrozen () const { return _Frozen; }
|
||||
|
||||
int luaSetTarget(CLuaState &ls);
|
||||
int luaEnsureVisible(CLuaState &ls);
|
||||
|
||||
// name
|
||||
void setName(const std::string & val) {_Name = val;}
|
||||
std::string getName() const {return _Name;}
|
||||
|
||||
// max
|
||||
void setMax(sint32 max) {_Max = max;}
|
||||
sint32 getMax() const {return _Max;}
|
||||
|
||||
REFLECT_EXPORT_START(CCtrlScroll, CCtrlScrollBase)
|
||||
REFLECT_LUA_METHOD("setTarget", luaSetTarget)
|
||||
REFLECT_LUA_METHOD("ensureVisible", luaEnsureVisible);
|
||||
REFLECT_SINT32("value", getValue, setValue);
|
||||
REFLECT_SINT32("trackPos", getTrackPos, setTrackPos);
|
||||
REFLECT_SINT32("trackSize", getTrackSize, setTrackSize);
|
||||
REFLECT_STRING("name", getName, setName);
|
||||
REFLECT_SINT32("max", getMax, setMax);
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
/** Ensure that a child element be visible into the frame through which
|
||||
* its parent group is displayed.
|
||||
* Example : Had we a list of items for which we want some item 'itemPtr' to have its top position
|
||||
* matching the middle of the list, we would do :
|
||||
* this->ensureVisible(itemPtr, Hotspot_Tx, Hotspot_Mx);
|
||||
*
|
||||
* The scrollbar will be moved accordingly.
|
||||
*/
|
||||
void ensureVisible(CInterfaceElement *childElement, THotSpot childHotSpot, THotSpot parentHotSpot);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
CInterfaceProperty _DBLink; // If this is a value scroller we can link it with db
|
||||
sint32 _Value; // Or we can use a normal value
|
||||
sint32 _InitialValue;
|
||||
|
||||
sint32 _Min, _Max;
|
||||
std::string _AHOnScroll;
|
||||
std::string _AHOnScrollParams;
|
||||
//
|
||||
std::string _AHOnScrollEnd;
|
||||
std::string _AHOnScrollEndParams;
|
||||
//
|
||||
//
|
||||
std::string _AHOnScrollCancel;
|
||||
std::string _AHOnScrollCancelParams;
|
||||
|
||||
|
||||
sint32 _Aligned; // 0-Top 1-Bottom 2-Left 3-Right
|
||||
|
||||
sint32 _TrackDispPos;
|
||||
sint32 _TrackPos;
|
||||
sint32 _TrackSize;
|
||||
sint32 _TrackSizeMin;
|
||||
|
||||
sint32 _MouseDownOffsetX;
|
||||
sint32 _MouseDownOffsetY;
|
||||
|
||||
sint32 _TxIdB; // Same as Left if Horizontal sb
|
||||
sint32 _TxIdM;
|
||||
sint32 _TxIdT; // Same as Right if Horizontal sb
|
||||
|
||||
uint8 _TileM;
|
||||
|
||||
sint32 _LastTargetHReal;
|
||||
sint32 _LastTargetMaxHReal;
|
||||
sint32 _LastTargetOfsY;
|
||||
sint32 _LastTargetWReal;
|
||||
sint32 _LastTargetMaxWReal;
|
||||
sint32 _LastTargetOfsX;
|
||||
|
||||
bool _Vertical : 1; // true if vertical track bar
|
||||
bool _IsDBLink : 1;
|
||||
bool _ObserverOn : 1;
|
||||
bool _Inverted : 1;
|
||||
bool _MouseDown : 1;
|
||||
bool _CallingAH : 1;
|
||||
bool _Cancelable : 1; // true if the slider may be cancelled when pressed on the mouse right button
|
||||
bool _Frozen : 1;
|
||||
|
||||
// For Target Scroller only: the target offset step in pixel.
|
||||
sint32 _TargetStepX;
|
||||
sint32 _TargetStepY;
|
||||
|
||||
// For Value Scroller only: indicate the step the scroll bar has. 0 or 1 means no step
|
||||
uint32 _StepValue;
|
||||
|
||||
// Slider's name
|
||||
std::string _Name;
|
||||
|
||||
void computeTargetOfsFromPos();
|
||||
|
||||
// from IPropertyObserver
|
||||
virtual void update(NLMISC::ICDBNode *node);
|
||||
|
||||
// step the value, and clamp it
|
||||
void normalizeValue(sint32 &value);
|
||||
|
||||
void runAH(const std::string &name, const std::string ¶ms);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // RZ_CTRL_SCROLL_H
|
||||
|
||||
/* End of ctrl_scroll.h */
|
||||
|
||||
|
@ -0,0 +1,60 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 CTRL_SCROLL_BASE_H
|
||||
#define CTRL_SCROLL_BASE_H
|
||||
|
||||
#include "nel/gui/ctrl_base.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
class CInterfaceGroup;
|
||||
|
||||
class CCtrlScrollBase : public CCtrlBase
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS( CCtrlScrollBase )
|
||||
|
||||
CCtrlScrollBase( const TCtorParam ¶m );
|
||||
virtual ~CCtrlScrollBase();
|
||||
|
||||
virtual void setTarget( CInterfaceGroup *pIG );
|
||||
CInterfaceGroup* getTarget(){ return _Target; }
|
||||
virtual sint32 moveTrackX( sint32 dx );
|
||||
virtual sint32 moveTrackY( sint32 dy );
|
||||
|
||||
/** Move the Target Ofs with a Delta, and recompute TrackPos from this Ofs.
|
||||
* Useful for finer controled group scrolling when the list is very big (with mouseWheel or scroll buttons)
|
||||
*/
|
||||
virtual void moveTargetX( sint32 dx );
|
||||
virtual void moveTargetY( sint32 dy );
|
||||
|
||||
|
||||
// Necessary because of reflection, no other purpose
|
||||
void draw(){}
|
||||
|
||||
protected:
|
||||
CInterfaceGroup *_Target; // If NULL the scroller is a value scroller
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,83 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 CL_SHEET_CTRL_SELECTION_H
|
||||
#define CL_SHEET_CTRL_SELECTION_H
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
class IActionHandler;
|
||||
|
||||
/** Infos about a selection group
|
||||
*/
|
||||
class CSheetSelectionGroup
|
||||
{
|
||||
public:
|
||||
CSheetSelectionGroup(std::string name) : _Name(name), _Active(false), _TextureIndex(-1), _Color(NLMISC::CRGBA::White), _GlobalColorEnabled(true) {}
|
||||
void setTexture(const std::string &texName);
|
||||
sint32 getTextureIndex() const { return _TextureIndex; }
|
||||
sint32 getTextureWidth() const { return _TextureWidth; }
|
||||
sint32 getTextureHeight() const { return _TextureHeight; }
|
||||
void setColor(NLMISC::CRGBA color) { _Color = color; }
|
||||
NLMISC::CRGBA getColor() const { return _Color; }
|
||||
void setActive(bool active) { _Active = active; }
|
||||
bool isActive() const { return _Active; }
|
||||
const std::string &getName() const { return _Name; }
|
||||
void enableGlobalColor(bool enabled) { _GlobalColorEnabled = enabled; }
|
||||
bool isGlobalColorEnabled() const { return _GlobalColorEnabled; }
|
||||
private:
|
||||
std::string _Name;
|
||||
bool _Active;
|
||||
sint32 _TextureIndex; // index for the selection texture
|
||||
sint32 _TextureWidth;
|
||||
sint32 _TextureHeight;
|
||||
NLMISC::CRGBA _Color; // color that modulate the texture of selection
|
||||
bool _GlobalColorEnabled;
|
||||
};
|
||||
|
||||
/** Class to manage selection of sheet.
|
||||
* Sheet are managed by groups, identified by their ID.
|
||||
*/
|
||||
class CCtrlSheetSelection
|
||||
{
|
||||
public:
|
||||
// Add a group, and returns its index, or -1 if already created.
|
||||
sint addGroup(const std::string &name);
|
||||
// Get a group by its name (must exist)
|
||||
CSheetSelectionGroup *getGroup(const std::string &name);
|
||||
const CSheetSelectionGroup *getGroup(const std::string &name) const;
|
||||
// Get a group by its index
|
||||
CSheetSelectionGroup *getGroup(uint index);
|
||||
const CSheetSelectionGroup *getGroup(uint index) const;
|
||||
// Get the index of a group from its name, return -1 if not a group
|
||||
sint getGroupIndex(const std::string &name) const;
|
||||
// Deactivate all groups
|
||||
void deactivateAll();
|
||||
// delete all groups
|
||||
void deleteGroups();
|
||||
private:
|
||||
//
|
||||
typedef std::vector<CSheetSelectionGroup> TGroupVect;
|
||||
typedef std::map<std::string, uint> TGroupNameToIndex;
|
||||
private:
|
||||
TGroupVect _Groups;
|
||||
TGroupNameToIndex _GroupNameToIndex;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,175 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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_CTRL_TEXT_BUTTON_H
|
||||
#define NL_CTRL_TEXT_BUTTON_H
|
||||
|
||||
#include "nel/gui/ctrl_base_button.h"
|
||||
#include "nel/gui/view_renderer.h"
|
||||
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
class CEventDescriptor;
|
||||
class CViewText;
|
||||
|
||||
// ***************************************************************************
|
||||
/**
|
||||
* Text Button that can be either Push or Toggle button. Localized, auto-resize
|
||||
* \author Lionel Berenguier
|
||||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class CCtrlTextButton : public CCtrlBaseButton
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS( CCtrlTextButton )
|
||||
|
||||
/// Constructor
|
||||
CCtrlTextButton(const TCtorParam ¶m);
|
||||
~CCtrlTextButton();
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
void setProperty( const std::string &name, const std::string &value );
|
||||
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
||||
|
||||
// Init part
|
||||
virtual bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
||||
|
||||
virtual void updateCoords();
|
||||
|
||||
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
|
||||
|
||||
// Display part
|
||||
virtual void draw();
|
||||
|
||||
// Hide/Show the text also.
|
||||
virtual void setActive(bool state);
|
||||
|
||||
// Add also our ViewText
|
||||
virtual void onAddToGroup();
|
||||
|
||||
|
||||
/// \from CInterfaceElement
|
||||
sint32 getMaxUsedW() const;
|
||||
sint32 getMinUsedW() const;
|
||||
|
||||
// Special Text Colors accessors
|
||||
// Colors
|
||||
NLMISC::CRGBA getTextColorNormal() const {return _TextColorNormal;}
|
||||
void setTextColorNormal(NLMISC::CRGBA v) {_TextColorNormal= v;}
|
||||
NLMISC::CRGBA getTextColorPushed() const {return _TextColorPushed;}
|
||||
void setTextColorPushed(NLMISC::CRGBA v) {_TextColorPushed= v;}
|
||||
NLMISC::CRGBA getTextColorOver() const {return _TextColorOver;}
|
||||
void setTextColorOver(NLMISC::CRGBA v) {_TextColorOver= v;}
|
||||
// Shadow Colors
|
||||
NLMISC::CRGBA getTextShadowColorNormal() const {return _TextShadowColorNormal;}
|
||||
void setTextShadowColorNormal(NLMISC::CRGBA v) {_TextShadowColorNormal= v;}
|
||||
NLMISC::CRGBA getTextShadowColorPushed() const {return _TextShadowColorPushed;}
|
||||
void setTextShadowColorPushed(NLMISC::CRGBA v) {_TextShadowColorPushed= v;}
|
||||
NLMISC::CRGBA getTextShadowColorOver() const {return _TextShadowColorOver;}
|
||||
void setTextShadowColorOver(NLMISC::CRGBA v) {_TextShadowColorOver= v;}
|
||||
// Global Modulate Colors
|
||||
bool getTextModulateGlobalColorNormal() const {return _TextModulateGlobalColorNormal;}
|
||||
void setTextModulateGlobalColorNormal(bool v) {_TextModulateGlobalColorNormal= v;}
|
||||
bool getTextModulateGlobalColorPushed() const {return _TextModulateGlobalColorPushed;}
|
||||
void setTextModulateGlobalColorPushed(bool v) {_TextModulateGlobalColorPushed= v;}
|
||||
bool getTextModulateGlobalColorOver() const {return _TextModulateGlobalColorOver;}
|
||||
void setTextModulateGlobalColorOver(bool v) {_TextModulateGlobalColorOver= v;}
|
||||
// Set text (noop if text id)
|
||||
void setText (const ucstring &text);
|
||||
ucstring getText () const;
|
||||
|
||||
void setHardText (const std::string &text);
|
||||
std::string getHardText () const;
|
||||
|
||||
CViewText* getViewText();
|
||||
void setViewText(CViewText* text) {_ViewText=text;}
|
||||
|
||||
void setTextX(sint32 x);
|
||||
sint32 getTextX() const { return _TextX; }
|
||||
|
||||
void setWMargin(sint32 w) { _WMargin = w; }
|
||||
sint32 getWMargin() const { return _WMargin; }
|
||||
|
||||
sint32 getWMin() const { return _WMin; }
|
||||
void setWMin( sint32 wmin ) { _WMin = wmin; }
|
||||
|
||||
// Compute Size according to bitmap and Text (Ensure as big as possible button)
|
||||
sint32 getWMax() const;
|
||||
|
||||
int luaGetViewText(CLuaState &ls);
|
||||
|
||||
REFLECT_EXPORT_START(CCtrlTextButton, CCtrlBaseButton)
|
||||
REFLECT_UCSTRING("uc_hardtext", getText, setText);
|
||||
REFLECT_STRING("hardtext", getHardText, setHardText);
|
||||
REFLECT_SINT32("text_x", getTextX, setTextX)
|
||||
REFLECT_SINT32("wmargin", getWMargin, setWMargin)
|
||||
REFLECT_SINT32("wmin", getWMin, setWMin)
|
||||
REFLECT_LUA_METHOD("getViewText", luaGetViewText)
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
void onRemoved();
|
||||
void onWidgetDeleted( CInterfaceElement *e );
|
||||
|
||||
protected:
|
||||
|
||||
enum {NumTexture= 3};
|
||||
|
||||
CViewRenderer::CTextureId _TextureIdNormal[NumTexture];
|
||||
CViewRenderer::CTextureId _TextureIdPushed[NumTexture];
|
||||
CViewRenderer::CTextureId _TextureIdOver[NumTexture];
|
||||
|
||||
// setup
|
||||
void setup();
|
||||
|
||||
private:
|
||||
|
||||
CViewText *_ViewText;
|
||||
|
||||
bool _Setuped;
|
||||
bool _IsViewTextId;
|
||||
bool _ForceTextOver; // text is displayed over the "over" texture
|
||||
// Size of Bitmaps
|
||||
sint32 _BmpLeftW, _BmpMiddleW, _BmpRightW, _BmpH;
|
||||
// Value to add to TextW to get button W.
|
||||
sint32 _WMargin;
|
||||
// Min W Value
|
||||
sint32 _WMin;
|
||||
sint32 _TextY;
|
||||
sint32 _TextX;
|
||||
THotSpot _TextPosRef;
|
||||
THotSpot _TextParentPosRef;
|
||||
// Special Colors for text
|
||||
NLMISC::CRGBA _TextColorNormal;
|
||||
NLMISC::CRGBA _TextColorPushed;
|
||||
NLMISC::CRGBA _TextColorOver;
|
||||
NLMISC::CRGBA _TextShadowColorNormal;
|
||||
NLMISC::CRGBA _TextShadowColorPushed;
|
||||
NLMISC::CRGBA _TextShadowColorOver;
|
||||
bool _TextModulateGlobalColorNormal;
|
||||
bool _TextModulateGlobalColorPushed;
|
||||
bool _TextModulateGlobalColorOver;
|
||||
bool _TextHeaderColor;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NL_CTRL_TEXT_BUTTON_H
|
||||
|
||||
/* End of ctrl_text_button.h */
|
@ -0,0 +1,59 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 RZ_CTRL_TOOLTIP_H
|
||||
#define RZ_CTRL_TOOLTIP_H
|
||||
|
||||
#include "nel/gui/ctrl_base.h"
|
||||
#include "nel/3d/u_texture.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
class CEventDescriptor;
|
||||
|
||||
|
||||
/**
|
||||
* \author Matthieu 'Mr TRAP' Besson
|
||||
* \author Nevrax France
|
||||
* \date 2003
|
||||
*/
|
||||
class CCtrlToolTip : public CCtrlBase
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS(CCtrlToolTip)
|
||||
/// Constructor
|
||||
CCtrlToolTip(const TCtorParam ¶m) : CCtrlBase(param) {}
|
||||
|
||||
virtual bool handleEvent (const NLGUI::CEventDescriptor& eventDesc);
|
||||
virtual void draw();
|
||||
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
||||
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||
// Can do nothing with tooltip (but display it :) )
|
||||
virtual bool isCapturable() const {return false;}
|
||||
virtual void serial(NLMISC::IStream &f);
|
||||
public:
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // RZ_CTRL_TOOLTIP_H
|
||||
|
||||
/* End of ctrl_tooltip.h */
|
||||
|
@ -0,0 +1,71 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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 DBMANAGER_H
|
||||
#define DBMANAGER_H
|
||||
|
||||
#include "nel/misc/cdb_manager.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
/**
|
||||
Database Manager
|
||||
|
||||
Provides access to a simple CDB based tree hierarchical data store
|
||||
*/
|
||||
class CDBManager : public NLMISC::CCDBManager
|
||||
{
|
||||
public:
|
||||
static CDBManager* getInstance();
|
||||
static void release();
|
||||
|
||||
/**
|
||||
Retrieves a leaf node from the database.
|
||||
@param name - name of the data leaf node we are querying.
|
||||
@param create - when true if a node cannot be found it is created.
|
||||
*/
|
||||
NLMISC::CCDBNodeLeaf* getDbProp( const std::string &name, bool create = true );
|
||||
|
||||
/**
|
||||
Deletes a node from the database.
|
||||
@param name - name of the node.
|
||||
*/
|
||||
void delDbProp( const std::string &name );
|
||||
|
||||
/**
|
||||
Returns a leaf node's content as an sint32
|
||||
@param name - name of the leaf node.
|
||||
*/
|
||||
sint32 getDbValue32( const std::string &name );
|
||||
|
||||
/**
|
||||
Returns the root branch of the database.
|
||||
*/
|
||||
NLMISC::CCDBNodeBranch* getDB() const;
|
||||
|
||||
private:
|
||||
CDBManager();
|
||||
~CDBManager();
|
||||
|
||||
static CDBManager *instance;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,170 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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_DBGROUP_COMBO_BOX_H
|
||||
#define NL_DBGROUP_COMBO_BOX_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/interface_group.h"
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
class CCtrlBaseButton;
|
||||
class CViewText;
|
||||
class CGroupMenu;
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
/**
|
||||
* Widget: ComboBox of text
|
||||
* \author Lionel Berenguier
|
||||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class CDBGroupComboBox : public CInterfaceGroup
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS( CDBGroupComboBox )
|
||||
|
||||
/// Constructor
|
||||
CDBGroupComboBox(const TCtorParam ¶m);
|
||||
~CDBGroupComboBox();
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
void setProperty( const std::string &name, const std::string &value );
|
||||
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
||||
|
||||
/// CInterfaceGroup Interface
|
||||
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||
virtual void updateCoords ();
|
||||
virtual void checkCoords ();
|
||||
|
||||
// Combo Texts
|
||||
void resetTexts();
|
||||
void addText(const ucstring &text);
|
||||
void setText(uint i, const ucstring &text);
|
||||
void insertText(uint i, const ucstring &text);
|
||||
const ucstring &getText(uint i) const;
|
||||
const uint &getTextId(uint i) const;
|
||||
uint getTextPos(uint nId) const;
|
||||
const ucstring &getTexture(uint i) const;
|
||||
void removeText(uint nPos);
|
||||
uint getNumTexts() const {return (uint)_Texts.size();}
|
||||
void sortText();
|
||||
|
||||
// selection
|
||||
void setSelection(sint32 val);
|
||||
void setSelectionNoTrigger(sint32 val);
|
||||
sint32 getSelection() const;
|
||||
|
||||
// selection number
|
||||
void setSelectionNb(sint32 /* val */){}
|
||||
sint32 getSelectionNb() const {return (sint32)_Texts.size();}
|
||||
|
||||
// selection text
|
||||
void setSelectionText(const std::string & val);
|
||||
std::string getSelectionText() const;
|
||||
|
||||
// view text
|
||||
void setViewText(const ucstring & text);
|
||||
ucstring getViewText() const;
|
||||
|
||||
void setTexture(uint i, const ucstring &texture);
|
||||
|
||||
sint32 evalContentWidth() const;
|
||||
|
||||
|
||||
int luaAddText(CLuaState &ls);
|
||||
int luaRemoveSelection(CLuaState &ls);
|
||||
int luaRemoveText(CLuaState &ls);
|
||||
int luaRemoveTextByIndex(CLuaState &ls);
|
||||
int luaResetTexts(CLuaState &ls);
|
||||
int luaSetText(CLuaState &ls);
|
||||
int luaInsertText(CLuaState &ls);
|
||||
int luaGetText(CLuaState &ls);
|
||||
int luaGetNumTexts(CLuaState &ls);
|
||||
int luaSetTexture(CLuaState &ls);
|
||||
|
||||
|
||||
REFLECT_EXPORT_START(CDBGroupComboBox, CInterfaceGroup)
|
||||
REFLECT_SINT32("selection", getSelection, setSelection)
|
||||
REFLECT_LUA_METHOD("addText", luaAddText)
|
||||
REFLECT_LUA_METHOD("setText", luaSetText)
|
||||
REFLECT_LUA_METHOD("insertText", luaInsertText)
|
||||
REFLECT_LUA_METHOD("setTexture", luaSetTexture)
|
||||
REFLECT_LUA_METHOD("getText", luaGetText)
|
||||
REFLECT_LUA_METHOD("getNumTexts", luaGetNumTexts)
|
||||
REFLECT_LUA_METHOD("removeSelection", luaRemoveSelection)
|
||||
REFLECT_LUA_METHOD("removeText", luaRemoveText)
|
||||
REFLECT_LUA_METHOD("removeTextByIndex", luaRemoveTextByIndex)
|
||||
REFLECT_LUA_METHOD("resetTexts", luaResetTexts)
|
||||
REFLECT_SINT32 ("selectionNb", getSelectionNb, setSelectionNb)
|
||||
REFLECT_STRING ("selection_text", getSelectionText, setSelectionText)
|
||||
REFLECT_UCSTRING ("view_text", getViewText, setViewText)
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
|
||||
protected:
|
||||
friend class CHandlerComboBoxSelectStart;
|
||||
|
||||
bool _LinkedToDB; // if not linked to db, then _NotLinkedToDBSelection is used instead
|
||||
bool _Setuped;
|
||||
bool _DirtySelection;
|
||||
sint32 _CacheSelection;
|
||||
|
||||
// sint32
|
||||
CInterfaceProperty _Selection;
|
||||
sint32 _NotLinkedToDBSelection;
|
||||
std::vector<std::pair<uint, ucstring> > _Texts;
|
||||
std::vector<ucstring> _Textures;
|
||||
|
||||
// Action Handler called on combo click
|
||||
std::string _AHOnSelectStart;
|
||||
|
||||
// Action handler called when the content is changed
|
||||
std::string _AHOnChange;
|
||||
std::string _AHOnChangeParams;
|
||||
bool _CallingOnChangeActionHandler; // avoid infinite loop here
|
||||
|
||||
|
||||
// Children
|
||||
CViewText *_ViewText;
|
||||
CCtrlBaseButton *_SelectButton;
|
||||
|
||||
bool _IsExternViewText;
|
||||
ucstring _ExternViewText;
|
||||
|
||||
|
||||
private:
|
||||
void setup();
|
||||
void dirt();
|
||||
public:
|
||||
// private : fill a menu with current content
|
||||
void fillMenu(CGroupMenu *groupMenu) const;
|
||||
|
||||
|
||||
static std::string measureMenu;
|
||||
static std::string selectMenu;
|
||||
static std::string selectMenuOut;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NL_DBGROUP_COMBO_BOX_H
|
||||
|
||||
/* End of dbgroup_combo_box.h */
|
@ -0,0 +1,101 @@
|
||||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// 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_DBGROUP_SELECT_NUMBER_H
|
||||
#define NL_DBGROUP_SELECT_NUMBER_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/gui/interface_group.h"
|
||||
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
class CCtrlBaseButton;
|
||||
class CViewText;
|
||||
class CViewBitmap;
|
||||
|
||||
// ***************************************************************************
|
||||
/**
|
||||
* Widget to select a number
|
||||
* \author Lionel Berenguier
|
||||
* \author Nevrax France
|
||||
* \date 2002
|
||||
*/
|
||||
class CDBGroupSelectNumber : public CInterfaceGroup
|
||||
{
|
||||
public:
|
||||
DECLARE_UI_CLASS( CDBGroupSelectNumber )
|
||||
|
||||
/// Constructor
|
||||
CDBGroupSelectNumber(const TCtorParam ¶m);
|
||||
~CDBGroupSelectNumber();
|
||||
|
||||
std::string getProperty( const std::string &name ) const;
|
||||
void setProperty( const std::string &name, const std::string &value );
|
||||
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
|
||||
|
||||
/// CInterfaceGroup Interface
|
||||
virtual bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||
virtual void updateCoords ();
|
||||
virtual void checkCoords();
|
||||
virtual void draw ();
|
||||
virtual void clearViews ();
|
||||
virtual bool handleEvent (const NLGUI::CEventDescriptor &eventDesc);
|
||||
|
||||
// mod interface
|
||||
void changeValue(sint delta);
|
||||
|
||||
sint32 getMinValue () const { return _MinValue; }
|
||||
void setMinValue (sint32 m) { _MinValue = m; }
|
||||
sint32 getMaxValue () const { return _MaxValue; }
|
||||
void setMaxValue (sint32 m) { _MaxValue = m; }
|
||||
|
||||
sint32 getCurrentValue () const { return _Number.getSInt32(); }
|
||||
void setCurrentValue (sint32 val) { _Number.setSInt32(val); }
|
||||
|
||||
REFLECT_EXPORT_START(CDBGroupSelectNumber, CInterfaceGroup)
|
||||
REFLECT_SINT32("min", getMinValue, setMinValue);
|
||||
REFLECT_SINT32("max", getMaxValue, setMaxValue);
|
||||
REFLECT_EXPORT_END
|
||||
|
||||
protected:
|
||||
|
||||
// sint32
|
||||
CInterfaceProperty _Number;
|
||||
bool _LoopMode;
|
||||
sint _MinValue;
|
||||
sint _MaxValue;
|
||||
sint _DeltaMultiplier;
|
||||
|
||||
// Children
|
||||
CViewBitmap *_SlotNumber;
|
||||
CViewText *_TextNumber;
|
||||
CCtrlBaseButton *_ButtonUp;
|
||||
CCtrlBaseButton *_ButtonDown;
|
||||
|
||||
private:
|
||||
|
||||
void setup();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NL_DBGROUP_SELECT_NUMBER_H
|
||||
|
||||
/* End of dbgroup_select_number.h */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue